google_cloudfunctions1/
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 CloudFunctions 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_cloudfunctions1 as cloudfunctions1;
49/// use cloudfunctions1::{Result, Error};
50/// # async fn dox() {
51/// use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62///     secret,
63///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64/// ).build().await.unwrap();
65///
66/// let client = hyper_util::client::legacy::Client::builder(
67///     hyper_util::rt::TokioExecutor::new()
68/// )
69/// .build(
70///     hyper_rustls::HttpsConnectorBuilder::new()
71///         .with_native_roots()
72///         .unwrap()
73///         .https_or_http()
74///         .enable_http1()
75///         .build()
76/// );
77/// let mut hub = CloudFunctions::new(client, auth);
78/// // You can configure optional parameters by calling the respective setters at will, and
79/// // execute the final call using `doit()`.
80/// // Values shown here are possibly random and not representative !
81/// let result = hub.operations().list()
82///              .page_token("amet.")
83///              .page_size(-59)
84///              .name("amet.")
85///              .filter("duo")
86///              .doit().await;
87///
88/// match result {
89///     Err(e) => match e {
90///         // The Error enum provides details about what exactly happened.
91///         // You can also just use its `Debug`, `Display` or `Error` traits
92///          Error::HttpError(_)
93///         |Error::Io(_)
94///         |Error::MissingAPIKey
95///         |Error::MissingToken(_)
96///         |Error::Cancelled
97///         |Error::UploadSizeLimitExceeded(_, _)
98///         |Error::Failure(_)
99///         |Error::BadRequest(_)
100///         |Error::FieldClash(_)
101///         |Error::JsonDecodeError(_, _) => println!("{}", e),
102///     },
103///     Ok(res) => println!("Success: {:?}", res),
104/// }
105/// # }
106/// ```
107#[derive(Clone)]
108pub struct CloudFunctions<C> {
109    pub client: common::Client<C>,
110    pub auth: Box<dyn common::GetToken>,
111    _user_agent: String,
112    _base_url: String,
113    _root_url: String,
114}
115
116impl<C> common::Hub for CloudFunctions<C> {}
117
118impl<'a, C> CloudFunctions<C> {
119    pub fn new<A: 'static + common::GetToken>(
120        client: common::Client<C>,
121        auth: A,
122    ) -> CloudFunctions<C> {
123        CloudFunctions {
124            client,
125            auth: Box::new(auth),
126            _user_agent: "google-api-rust-client/6.0.0".to_string(),
127            _base_url: "https://cloudfunctions.googleapis.com/".to_string(),
128            _root_url: "https://cloudfunctions.googleapis.com/".to_string(),
129        }
130    }
131
132    pub fn operations(&'a self) -> OperationMethods<'a, C> {
133        OperationMethods { hub: self }
134    }
135    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136        ProjectMethods { hub: self }
137    }
138
139    /// Set the user-agent header field to use in all requests to the server.
140    /// It defaults to `google-api-rust-client/6.0.0`.
141    ///
142    /// Returns the previously set user-agent.
143    pub fn user_agent(&mut self, agent_name: String) -> String {
144        std::mem::replace(&mut self._user_agent, agent_name)
145    }
146
147    /// Set the base url to use in all requests to the server.
148    /// It defaults to `https://cloudfunctions.googleapis.com/`.
149    ///
150    /// Returns the previously set base url.
151    pub fn base_url(&mut self, new_base_url: String) -> String {
152        std::mem::replace(&mut self._base_url, new_base_url)
153    }
154
155    /// Set the root url to use in all requests to the server.
156    /// It defaults to `https://cloudfunctions.googleapis.com/`.
157    ///
158    /// Returns the previously set root url.
159    pub fn root_url(&mut self, new_root_url: String) -> String {
160        std::mem::replace(&mut self._root_url, new_root_url)
161    }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// 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.
168///
169/// This type is not used in any activity, and only used as *part* of another schema.
170///
171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
172#[serde_with::serde_as]
173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
174pub struct AuditConfig {
175    /// The configuration for logging of each type of permission.
176    #[serde(rename = "auditLogConfigs")]
177    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
178    /// 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.
179    pub service: Option<String>,
180}
181
182impl common::Part for AuditConfig {}
183
184/// 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.
185///
186/// This type is not used in any activity, and only used as *part* of another schema.
187///
188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
189#[serde_with::serde_as]
190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
191pub struct AuditLogConfig {
192    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
193    #[serde(rename = "exemptedMembers")]
194    pub exempted_members: Option<Vec<String>>,
195    /// The log type that this config enables.
196    #[serde(rename = "logType")]
197    pub log_type: Option<String>,
198}
199
200impl common::Part for AuditLogConfig {}
201
202/// Security patches are applied automatically to the runtime without requiring the function to be redeployed.
203///
204/// This type is not used in any activity, and only used as *part* of another schema.
205///
206#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
207#[serde_with::serde_as]
208#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
209pub struct AutomaticUpdatePolicy {
210    _never_set: Option<bool>,
211}
212
213impl common::Part for AutomaticUpdatePolicy {}
214
215/// Associates `members`, or principals, with a `role`.
216///
217/// This type is not used in any activity, and only used as *part* of another schema.
218///
219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
220#[serde_with::serde_as]
221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
222pub struct Binding {
223    /// 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).
224    pub condition: Option<Expr>,
225    /// 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`.
226    pub members: Option<Vec<String>>,
227    /// 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).
228    pub role: Option<String>,
229}
230
231impl common::Part for Binding {}
232
233/// Request for the `CallFunction` method.
234///
235/// # Activities
236///
237/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
238/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
239///
240/// * [locations functions call projects](ProjectLocationFunctionCallCall) (request)
241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
242#[serde_with::serde_as]
243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
244pub struct CallFunctionRequest {
245    /// Required. Input to be passed to the function.
246    pub data: Option<String>,
247}
248
249impl common::RequestValue for CallFunctionRequest {}
250
251/// Response of `CallFunction` method.
252///
253/// # Activities
254///
255/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
256/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
257///
258/// * [locations functions call projects](ProjectLocationFunctionCallCall) (response)
259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
260#[serde_with::serde_as]
261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
262pub struct CallFunctionResponse {
263    /// Either system or user-function generated error. Set if execution was not successful.
264    pub error: Option<String>,
265    /// Execution id of function invocation.
266    #[serde(rename = "executionId")]
267    pub execution_id: Option<String>,
268    /// Result populated for successful execution of synchronous function. Will not be populated if function does not return a result through context.
269    pub result: Option<String>,
270}
271
272impl common::ResponseResult for CallFunctionResponse {}
273
274/// Describes a Cloud Function that contains user computation executed in response to an event. It encapsulate function and triggers configurations.
275///
276/// # Activities
277///
278/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
279/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
280///
281/// * [locations functions create projects](ProjectLocationFunctionCreateCall) (request)
282/// * [locations functions get projects](ProjectLocationFunctionGetCall) (response)
283/// * [locations functions patch projects](ProjectLocationFunctionPatchCall) (request)
284#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
285#[serde_with::serde_as]
286#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
287pub struct CloudFunction {
288    /// no description provided
289    #[serde(rename = "automaticUpdatePolicy")]
290    pub automatic_update_policy: Option<AutomaticUpdatePolicy>,
291    /// The amount of memory in MB available for a function. Defaults to 256MB.
292    #[serde(rename = "availableMemoryMb")]
293    pub available_memory_mb: Option<i32>,
294    /// Build environment variables that shall be available during build time.
295    #[serde(rename = "buildEnvironmentVariables")]
296    pub build_environment_variables: Option<HashMap<String, String>>,
297    /// Output only. The Cloud Build ID of the latest successful deployment of the function.
298    #[serde(rename = "buildId")]
299    pub build_id: Option<String>,
300    /// Output only. The Cloud Build Name of the function deployment. `projects//locations//builds/`.
301    #[serde(rename = "buildName")]
302    pub build_name: Option<String>,
303    /// Optional. A service account the user provides for use with Cloud Build.
304    #[serde(rename = "buildServiceAccount")]
305    pub build_service_account: Option<String>,
306    /// Name of the Cloud Build Custom Worker Pool that should be used to build the function. The format of this field is `projects/{project}/locations/{region}/workerPools/{workerPool}` where `{project}` and `{region}` are the project id and region respectively where the worker pool is defined and `{workerPool}` is the short name of the worker pool. If the project id is not the same as the function, then the Cloud Functions Service Agent (`service-@gcf-admin-robot.iam.gserviceaccount.com`) must be granted the role Cloud Build Custom Workers Builder (`roles/cloudbuild.customworkers.builder`) in the project.
307    #[serde(rename = "buildWorkerPool")]
308    pub build_worker_pool: Option<String>,
309    /// User-provided description of a function.
310    pub description: Option<String>,
311    /// Docker Registry to use for this deployment. If unspecified, it defaults to `ARTIFACT_REGISTRY`. If `docker_repository` field is specified, this field should either be left unspecified or set to `ARTIFACT_REGISTRY`.
312    #[serde(rename = "dockerRegistry")]
313    pub docker_registry: Option<String>,
314    /// User-managed repository created in Artifact Registry to which the function's Docker image will be pushed after it is built by Cloud Build. May optionally be encrypted with a customer-managed encryption key (CMEK). If unspecified and `docker_registry` is not explicitly set to `CONTAINER_REGISTRY`, GCF will create and use a default Artifact Registry repository named 'gcf-artifacts' in the region. It must match the pattern `projects/{project}/locations/{location}/repositories/{repository}`. Cross-project repositories are not supported. Cross-location repositories are not supported. Repository format must be 'DOCKER'.
315    #[serde(rename = "dockerRepository")]
316    pub docker_repository: Option<String>,
317    /// The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix (ID of the function), if not specified.
318    #[serde(rename = "entryPoint")]
319    pub entry_point: Option<String>,
320    /// Environment variables that shall be available during function execution.
321    #[serde(rename = "environmentVariables")]
322    pub environment_variables: Option<HashMap<String, String>>,
323    /// A source that fires events in response to a condition in another service.
324    #[serde(rename = "eventTrigger")]
325    pub event_trigger: Option<EventTrigger>,
326    /// An HTTPS endpoint type of source that can be triggered via URL.
327    #[serde(rename = "httpsTrigger")]
328    pub https_trigger: Option<HttpsTrigger>,
329    /// The ingress settings for the function, controlling what traffic can reach it.
330    #[serde(rename = "ingressSettings")]
331    pub ingress_settings: Option<String>,
332    /// Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. It must match the pattern `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. If specified, you must also provide an artifact registry repository using the `docker_repository` field that was created with the same KMS crypto key. The following service accounts need to be granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the Key/KeyRing/Project/Organization (least access preferred). 1. Google Cloud Functions service account (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) - Required to protect the function's image. 2. Google Storage service account (service-{project_number}@gs-project-accounts.iam.gserviceaccount.com) - Required to protect the function's source code. If this service account does not exist, deploying a function without a KMS key or retrieving the service agent name provisions it. For more information, see https://cloud.google.com/storage/docs/projects#service-agents and https://cloud.google.com/storage/docs/getting-service-agent#gsutil. Google Cloud Functions delegates access to service agents to protect function resources in internal projects that are not accessible by the end user.
333    #[serde(rename = "kmsKeyName")]
334    pub kms_key_name: Option<String>,
335    /// Labels associated with this Cloud Function.
336    pub labels: Option<HashMap<String, String>>,
337    /// The limit on the maximum number of function instances that may coexist at a given time. In some cases, such as rapid traffic surges, Cloud Functions may, for a short period of time, create more instances than the specified max instances limit. If your function cannot tolerate this temporary behavior, you may want to factor in a safety margin and set a lower max instances value than your function can tolerate. See the [Max Instances](https://cloud.google.com/functions/docs/max-instances) Guide for more details.
338    #[serde(rename = "maxInstances")]
339    pub max_instances: Option<i32>,
340    /// A lower bound for the number function instances that may coexist at a given time.
341    #[serde(rename = "minInstances")]
342    pub min_instances: Option<i32>,
343    /// A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`
344    pub name: Option<String>,
345    /// Deprecated: use vpc_connector
346    pub network: Option<String>,
347    /// no description provided
348    #[serde(rename = "onDeployUpdatePolicy")]
349    pub on_deploy_update_policy: Option<OnDeployUpdatePolicy>,
350    /// The runtime in which to run the function. Required when deploying a new function, optional when updating an existing function. For a complete list of possible choices, see the [`gcloud` command reference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).
351    pub runtime: Option<String>,
352    /// Secret environment variables configuration.
353    #[serde(rename = "secretEnvironmentVariables")]
354    pub secret_environment_variables: Option<Vec<SecretEnvVar>>,
355    /// Secret volumes configuration.
356    #[serde(rename = "secretVolumes")]
357    pub secret_volumes: Option<Vec<SecretVolume>>,
358    /// The email of the function's service account. If empty, defaults to `{project_id}@appspot.gserviceaccount.com`.
359    #[serde(rename = "serviceAccountEmail")]
360    pub service_account_email: Option<String>,
361    /// The Google Cloud Storage URL, starting with `gs://`, pointing to the zip archive which contains the function.
362    #[serde(rename = "sourceArchiveUrl")]
363    pub source_archive_url: Option<String>,
364    /// **Beta Feature** The source repository where a function is hosted.
365    #[serde(rename = "sourceRepository")]
366    pub source_repository: Option<SourceRepository>,
367    /// Input only. An identifier for Firebase function sources. Disclaimer: This field is only supported for Firebase function deployments.
368    #[serde(rename = "sourceToken")]
369    pub source_token: Option<String>,
370    /// The Google Cloud Storage signed URL used for source uploading, generated by calling [google.cloud.functions.v1.GenerateUploadUrl]. The signature is validated on write methods (Create, Update) The signature is stripped from the Function object on read methods (Get, List)
371    #[serde(rename = "sourceUploadUrl")]
372    pub source_upload_url: Option<String>,
373    /// Output only. Status of the function deployment.
374    pub status: Option<String>,
375    /// The function execution timeout. Execution is considered failed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds.
376    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
377    pub timeout: Option<chrono::Duration>,
378    /// Output only. The last update timestamp of a Cloud Function.
379    #[serde(rename = "updateTime")]
380    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
381    /// Output only. The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created.
382    #[serde(rename = "versionId")]
383    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
384    pub version_id: Option<i64>,
385    /// The VPC Network Connector that this cloud function can connect to. It can be either the fully-qualified URI, or the short name of the network connector resource. The format of this field is `projects/*/locations/*/connectors/*` This field is mutually exclusive with `network` field and will eventually replace it. See [the VPC documentation](https://cloud.google.com/compute/docs/vpc) for more information on connecting Cloud projects.
386    #[serde(rename = "vpcConnector")]
387    pub vpc_connector: Option<String>,
388    /// The egress settings for the connector, controlling what traffic is diverted through it.
389    #[serde(rename = "vpcConnectorEgressSettings")]
390    pub vpc_connector_egress_settings: Option<String>,
391}
392
393impl common::RequestValue for CloudFunction {}
394impl common::ResponseResult for CloudFunction {}
395
396/// Describes EventTrigger, used to request events be sent from another service.
397///
398/// This type is not used in any activity, and only used as *part* of another schema.
399///
400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
401#[serde_with::serde_as]
402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
403pub struct EventTrigger {
404    /// Required. The type of event to observe. For example: `providers/cloud.storage/eventTypes/object.change` and `providers/cloud.pubsub/eventTypes/topic.publish`. Event types match pattern `providers/*/eventTypes/*.*`. The pattern contains: 1. namespace: For example, `cloud.storage` and `google.firebase.analytics`. 2. resource type: The type of resource on which event occurs. For example, the Google Cloud Storage API includes the type `object`. 3. action: The action that generates the event. For example, action for a Google Cloud Storage Object is 'change'. These parts are lower case.
405    #[serde(rename = "eventType")]
406    pub event_type: Option<String>,
407    /// Specifies policy for failed executions.
408    #[serde(rename = "failurePolicy")]
409    pub failure_policy: Option<FailurePolicy>,
410    /// Required. The resource(s) from which to observe events, for example, `projects/_/buckets/myBucket`. Not all syntactically correct values are accepted by all services. For example: 1. The authorization model must support it. Google Cloud Functions only allows EventTriggers to be deployed that observe resources in the same project as the `CloudFunction`. 2. The resource type must match the pattern expected for an `event_type`. For example, an `EventTrigger` that has an `event_type` of "google.pubsub.topic.publish" should have a resource that matches Google Cloud Pub/Sub topics. Additionally, some services may support short names when creating an `EventTrigger`. These will always be returned in the normalized "long" format. See each *service's* documentation for supported formats.
411    pub resource: Option<String>,
412    /// The hostname of the service that should be observed. If no string is provided, the default service implementing the API will be used. For example, `storage.googleapis.com` is the default for all event types in the `google.storage` namespace.
413    pub service: Option<String>,
414}
415
416impl common::Part for EventTrigger {}
417
418/// 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.
419///
420/// This type is not used in any activity, and only used as *part* of another schema.
421///
422#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
423#[serde_with::serde_as]
424#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
425pub struct Expr {
426    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
427    pub description: Option<String>,
428    /// Textual representation of an expression in Common Expression Language syntax.
429    pub expression: Option<String>,
430    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
431    pub location: Option<String>,
432    /// 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.
433    pub title: Option<String>,
434}
435
436impl common::Part for Expr {}
437
438/// Describes the policy in case of function's execution failure. If empty, then defaults to ignoring failures (i.e. not retrying them).
439///
440/// This type is not used in any activity, and only used as *part* of another schema.
441///
442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
443#[serde_with::serde_as]
444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
445pub struct FailurePolicy {
446    /// If specified, then the function will be retried in case of a failure.
447    pub retry: Option<Retry>,
448}
449
450impl common::Part for FailurePolicy {}
451
452/// Request of `GenerateDownloadUrl` method.
453///
454/// # Activities
455///
456/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
457/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
458///
459/// * [locations functions generate download url projects](ProjectLocationFunctionGenerateDownloadUrlCall) (request)
460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
461#[serde_with::serde_as]
462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
463pub struct GenerateDownloadUrlRequest {
464    /// The optional version of function. If not set, default, current version is used.
465    #[serde(rename = "versionId")]
466    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
467    pub version_id: Option<u64>,
468}
469
470impl common::RequestValue for GenerateDownloadUrlRequest {}
471
472/// Response of `GenerateDownloadUrl` method.
473///
474/// # Activities
475///
476/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
478///
479/// * [locations functions generate download url projects](ProjectLocationFunctionGenerateDownloadUrlCall) (response)
480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
481#[serde_with::serde_as]
482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
483pub struct GenerateDownloadUrlResponse {
484    /// The generated Google Cloud Storage signed URL that should be used for function source code download.
485    #[serde(rename = "downloadUrl")]
486    pub download_url: Option<String>,
487}
488
489impl common::ResponseResult for GenerateDownloadUrlResponse {}
490
491/// Request of `GenerateSourceUploadUrl` method.
492///
493/// # Activities
494///
495/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
496/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
497///
498/// * [locations functions generate upload url projects](ProjectLocationFunctionGenerateUploadUrlCall) (request)
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct GenerateUploadUrlRequest {
503    /// Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function source code objects in intermediate Cloud Storage buckets. When you generate an upload url and upload your source code, it gets copied to an intermediate Cloud Storage bucket. The source code is then copied to a versioned directory in the sources bucket in the consumer project during the function deployment. It must match the pattern `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. The Google Cloud Functions service account (service-{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the Key/KeyRing/Project/Organization (least access preferred). GCF will delegate access to the Google Storage service account in the internal project.
504    #[serde(rename = "kmsKeyName")]
505    pub kms_key_name: Option<String>,
506}
507
508impl common::RequestValue for GenerateUploadUrlRequest {}
509
510/// Response of `GenerateSourceUploadUrl` method.
511///
512/// # Activities
513///
514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
516///
517/// * [locations functions generate upload url projects](ProjectLocationFunctionGenerateUploadUrlCall) (response)
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct GenerateUploadUrlResponse {
522    /// The generated Google Cloud Storage signed URL that should be used for a function source code upload. The uploaded file should be a zip archive which contains a function.
523    #[serde(rename = "uploadUrl")]
524    pub upload_url: Option<String>,
525}
526
527impl common::ResponseResult for GenerateUploadUrlResponse {}
528
529/// Describes HttpsTrigger, could be used to connect web hooks to function.
530///
531/// This type is not used in any activity, and only used as *part* of another schema.
532///
533#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
534#[serde_with::serde_as]
535#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
536pub struct HttpsTrigger {
537    /// The security level for the function.
538    #[serde(rename = "securityLevel")]
539    pub security_level: Option<String>,
540    /// Output only. The deployed url for the function.
541    pub url: Option<String>,
542}
543
544impl common::Part for HttpsTrigger {}
545
546/// Response for the `ListFunctions` method.
547///
548/// # Activities
549///
550/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
551/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
552///
553/// * [locations functions list projects](ProjectLocationFunctionListCall) (response)
554#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
555#[serde_with::serde_as]
556#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
557pub struct ListFunctionsResponse {
558    /// The functions that match the request.
559    pub functions: Option<Vec<CloudFunction>>,
560    /// If not empty, indicates that there may be more functions that match the request; this value should be passed in a new google.cloud.functions.v1.ListFunctionsRequest to get more functions.
561    #[serde(rename = "nextPageToken")]
562    pub next_page_token: Option<String>,
563    /// Locations that could not be reached. The response does not include any functions from these locations.
564    pub unreachable: Option<Vec<String>>,
565}
566
567impl common::ResponseResult for ListFunctionsResponse {}
568
569/// The response message for Locations.ListLocations.
570///
571/// # Activities
572///
573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
575///
576/// * [locations list projects](ProjectLocationListCall) (response)
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct ListLocationsResponse {
581    /// A list of locations that matches the specified filter in the request.
582    pub locations: Option<Vec<Location>>,
583    /// The standard List next-page token.
584    #[serde(rename = "nextPageToken")]
585    pub next_page_token: Option<String>,
586}
587
588impl common::ResponseResult for ListLocationsResponse {}
589
590/// The response message for Operations.ListOperations.
591///
592/// # Activities
593///
594/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
595/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
596///
597/// * [list operations](OperationListCall) (response)
598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
599#[serde_with::serde_as]
600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
601pub struct ListOperationsResponse {
602    /// The standard List next-page token.
603    #[serde(rename = "nextPageToken")]
604    pub next_page_token: Option<String>,
605    /// A list of operations that matches the specified filter in the request.
606    pub operations: Option<Vec<Operation>>,
607}
608
609impl common::ResponseResult for ListOperationsResponse {}
610
611/// A resource that represents a Google Cloud location.
612///
613/// This type is not used in any activity, and only used as *part* of another schema.
614///
615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
616#[serde_with::serde_as]
617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
618pub struct Location {
619    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
620    #[serde(rename = "displayName")]
621    pub display_name: Option<String>,
622    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
623    pub labels: Option<HashMap<String, String>>,
624    /// The canonical id for this location. For example: `"us-east1"`.
625    #[serde(rename = "locationId")]
626    pub location_id: Option<String>,
627    /// Service-specific metadata. For example the available capacity at the given location.
628    pub metadata: Option<HashMap<String, serde_json::Value>>,
629    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
630    pub name: Option<String>,
631}
632
633impl common::Part for Location {}
634
635/// Security patches are only applied when a function is redeployed.
636///
637/// This type is not used in any activity, and only used as *part* of another schema.
638///
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct OnDeployUpdatePolicy {
643    /// Output only. Contains the runtime version which was used during latest function deployment.
644    #[serde(rename = "runtimeVersion")]
645    pub runtime_version: Option<String>,
646}
647
648impl common::Part for OnDeployUpdatePolicy {}
649
650/// This resource represents a long-running operation that is the result of a network API call.
651///
652/// # Activities
653///
654/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
655/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
656///
657/// * [get operations](OperationGetCall) (response)
658/// * [list operations](OperationListCall) (none)
659/// * [locations functions create projects](ProjectLocationFunctionCreateCall) (response)
660/// * [locations functions delete projects](ProjectLocationFunctionDeleteCall) (response)
661/// * [locations functions patch projects](ProjectLocationFunctionPatchCall) (response)
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct Operation {
666    /// 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.
667    pub done: Option<bool>,
668    /// The error result of the operation in case of failure or cancellation.
669    pub error: Option<Status>,
670    /// 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.
671    pub metadata: Option<HashMap<String, serde_json::Value>>,
672    /// 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}`.
673    pub name: Option<String>,
674    /// 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`.
675    pub response: Option<HashMap<String, serde_json::Value>>,
676}
677
678impl common::Resource for Operation {}
679impl common::ResponseResult for Operation {}
680
681/// 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/).
682///
683/// # Activities
684///
685/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
686/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
687///
688/// * [locations functions get iam policy projects](ProjectLocationFunctionGetIamPolicyCall) (response)
689/// * [locations functions set iam policy projects](ProjectLocationFunctionSetIamPolicyCall) (response)
690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
691#[serde_with::serde_as]
692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
693pub struct Policy {
694    /// Specifies cloud audit logging configuration for this policy.
695    #[serde(rename = "auditConfigs")]
696    pub audit_configs: Option<Vec<AuditConfig>>,
697    /// 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`.
698    pub bindings: Option<Vec<Binding>>,
699    /// `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.
700    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
701    pub etag: Option<Vec<u8>>,
702    /// 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).
703    pub version: Option<i32>,
704}
705
706impl common::ResponseResult for Policy {}
707
708/// Describes the retry policy in case of function's execution failure. A function execution will be retried on any failure. A failed execution will be retried up to 7 days with an exponential backoff (capped at 10 seconds). Retried execution is charged as any other execution.
709///
710/// This type is not used in any activity, and only used as *part* of another schema.
711///
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct Retry {
716    _never_set: Option<bool>,
717}
718
719impl common::Part for Retry {}
720
721/// Configuration for a secret environment variable. It has the information necessary to fetch the secret value from secret manager and expose it as an environment variable.
722///
723/// This type is not used in any activity, and only used as *part* of another schema.
724///
725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
726#[serde_with::serde_as]
727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
728pub struct SecretEnvVar {
729    /// Name of the environment variable.
730    pub key: Option<String>,
731    /// Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function.
732    #[serde(rename = "projectId")]
733    pub project_id: Option<String>,
734    /// Name of the secret in secret manager (not the full resource name).
735    pub secret: Option<String>,
736    /// Version of the secret (version number or the string 'latest'). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new instances start.
737    pub version: Option<String>,
738}
739
740impl common::Part for SecretEnvVar {}
741
742/// Configuration for a single version.
743///
744/// This type is not used in any activity, and only used as *part* of another schema.
745///
746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
747#[serde_with::serde_as]
748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
749pub struct SecretVersion {
750    /// Relative path of the file under the mount path where the secret value for this version will be fetched and made available. For example, setting the mount_path as '/etc/secrets' and path as `/secret_foo` would mount the secret value file at `/etc/secrets/secret_foo`.
751    pub path: Option<String>,
752    /// Version of the secret (version number or the string 'latest'). It is preferable to use `latest` version with secret volumes as secret value changes are reflected immediately.
753    pub version: Option<String>,
754}
755
756impl common::Part for SecretVersion {}
757
758/// Configuration for a secret volume. It has the information necessary to fetch the secret value from secret manager and make it available as files mounted at the requested paths within the application container. Secret value is not a part of the configuration. Every filesystem read operation performs a lookup in secret manager to retrieve the secret value.
759///
760/// This type is not used in any activity, and only used as *part* of another schema.
761///
762#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
763#[serde_with::serde_as]
764#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
765pub struct SecretVolume {
766    /// The path within the container to mount the secret volume. For example, setting the mount_path as `/etc/secrets` would mount the secret value files under the `/etc/secrets` directory. This directory will also be completely shadowed and unavailable to mount any other secrets. Recommended mount paths: /etc/secrets Restricted mount paths: /cloudsql, /dev/log, /pod, /proc, /var/log
767    #[serde(rename = "mountPath")]
768    pub mount_path: Option<String>,
769    /// Project identifier (preferrably project number but can also be the project ID) of the project that contains the secret. If not set, it will be populated with the function's project assuming that the secret exists in the same project as of the function.
770    #[serde(rename = "projectId")]
771    pub project_id: Option<String>,
772    /// Name of the secret in secret manager (not the full resource name).
773    pub secret: Option<String>,
774    /// List of secret versions to mount for this secret. If empty, the `latest` version of the secret will be made available in a file named after the secret under the mount point.
775    pub versions: Option<Vec<SecretVersion>>,
776}
777
778impl common::Part for SecretVolume {}
779
780/// Request message for `SetIamPolicy` method.
781///
782/// # Activities
783///
784/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
785/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
786///
787/// * [locations functions set iam policy projects](ProjectLocationFunctionSetIamPolicyCall) (request)
788#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
789#[serde_with::serde_as]
790#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
791pub struct SetIamPolicyRequest {
792    /// 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.
793    pub policy: Option<Policy>,
794    /// 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"`
795    #[serde(rename = "updateMask")]
796    pub update_mask: Option<common::FieldMask>,
797}
798
799impl common::RequestValue for SetIamPolicyRequest {}
800
801/// Describes SourceRepository, used to represent parameters related to source repository where a function is hosted.
802///
803/// This type is not used in any activity, and only used as *part* of another schema.
804///
805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
806#[serde_with::serde_as]
807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
808pub struct SourceRepository {
809    /// Output only. The URL pointing to the hosted repository where the function were defined at the time of deployment. It always points to a specific commit in the format described above.
810    #[serde(rename = "deployedUrl")]
811    pub deployed_url: Option<String>,
812    /// The URL pointing to the hosted repository where the function is defined. There are supported Cloud Source Repository URLs in the following formats: To refer to a specific commit: `https://source.developers.google.com/projects/*/repos/*/revisions/*/paths/*` To refer to a moveable alias (branch): `https://source.developers.google.com/projects/*/repos/*/moveable-aliases/*/paths/*` In particular, to refer to HEAD use `master` moveable alias. To refer to a specific fixed alias (tag): `https://source.developers.google.com/projects/*/repos/*/fixed-aliases/*/paths/*` You may omit `paths/*` if you want to use the main directory.
813    pub url: Option<String>,
814}
815
816impl common::Part for SourceRepository {}
817
818/// 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).
819///
820/// This type is not used in any activity, and only used as *part* of another schema.
821///
822#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
823#[serde_with::serde_as]
824#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
825pub struct Status {
826    /// The status code, which should be an enum value of google.rpc.Code.
827    pub code: Option<i32>,
828    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
829    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
830    /// 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.
831    pub message: Option<String>,
832}
833
834impl common::Part for Status {}
835
836/// Request message for `TestIamPermissions` method.
837///
838/// # Activities
839///
840/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
841/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
842///
843/// * [locations functions test iam permissions projects](ProjectLocationFunctionTestIamPermissionCall) (request)
844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
845#[serde_with::serde_as]
846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
847pub struct TestIamPermissionsRequest {
848    /// 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).
849    pub permissions: Option<Vec<String>>,
850}
851
852impl common::RequestValue for TestIamPermissionsRequest {}
853
854/// Response message for `TestIamPermissions` method.
855///
856/// # Activities
857///
858/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
859/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
860///
861/// * [locations functions test iam permissions projects](ProjectLocationFunctionTestIamPermissionCall) (response)
862#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
863#[serde_with::serde_as]
864#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
865pub struct TestIamPermissionsResponse {
866    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
867    pub permissions: Option<Vec<String>>,
868}
869
870impl common::ResponseResult for TestIamPermissionsResponse {}
871
872// ###################
873// MethodBuilders ###
874// #################
875
876/// A builder providing access to all methods supported on *operation* resources.
877/// It is not used directly, but through the [`CloudFunctions`] hub.
878///
879/// # Example
880///
881/// Instantiate a resource builder
882///
883/// ```test_harness,no_run
884/// extern crate hyper;
885/// extern crate hyper_rustls;
886/// extern crate google_cloudfunctions1 as cloudfunctions1;
887///
888/// # async fn dox() {
889/// use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
890///
891/// let secret: yup_oauth2::ApplicationSecret = Default::default();
892/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
893///     secret,
894///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
895/// ).build().await.unwrap();
896///
897/// let client = hyper_util::client::legacy::Client::builder(
898///     hyper_util::rt::TokioExecutor::new()
899/// )
900/// .build(
901///     hyper_rustls::HttpsConnectorBuilder::new()
902///         .with_native_roots()
903///         .unwrap()
904///         .https_or_http()
905///         .enable_http1()
906///         .build()
907/// );
908/// let mut hub = CloudFunctions::new(client, auth);
909/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
910/// // like `get(...)` and `list(...)`
911/// // to build up your call.
912/// let rb = hub.operations();
913/// # }
914/// ```
915pub struct OperationMethods<'a, C>
916where
917    C: 'a,
918{
919    hub: &'a CloudFunctions<C>,
920}
921
922impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
923
924impl<'a, C> OperationMethods<'a, C> {
925    /// Create a builder to help you perform the following task:
926    ///
927    /// 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.
928    ///
929    /// # Arguments
930    ///
931    /// * `name` - The name of the operation resource.
932    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
933        OperationGetCall {
934            hub: self.hub,
935            _name: name.to_string(),
936            _delegate: Default::default(),
937            _additional_params: Default::default(),
938            _scopes: Default::default(),
939        }
940    }
941
942    /// Create a builder to help you perform the following task:
943    ///
944    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
945    pub fn list(&self) -> OperationListCall<'a, C> {
946        OperationListCall {
947            hub: self.hub,
948            _page_token: Default::default(),
949            _page_size: Default::default(),
950            _name: Default::default(),
951            _filter: Default::default(),
952            _delegate: Default::default(),
953            _additional_params: Default::default(),
954            _scopes: Default::default(),
955        }
956    }
957}
958
959/// A builder providing access to all methods supported on *project* resources.
960/// It is not used directly, but through the [`CloudFunctions`] hub.
961///
962/// # Example
963///
964/// Instantiate a resource builder
965///
966/// ```test_harness,no_run
967/// extern crate hyper;
968/// extern crate hyper_rustls;
969/// extern crate google_cloudfunctions1 as cloudfunctions1;
970///
971/// # async fn dox() {
972/// use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
973///
974/// let secret: yup_oauth2::ApplicationSecret = Default::default();
975/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
976///     secret,
977///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
978/// ).build().await.unwrap();
979///
980/// let client = hyper_util::client::legacy::Client::builder(
981///     hyper_util::rt::TokioExecutor::new()
982/// )
983/// .build(
984///     hyper_rustls::HttpsConnectorBuilder::new()
985///         .with_native_roots()
986///         .unwrap()
987///         .https_or_http()
988///         .enable_http1()
989///         .build()
990/// );
991/// let mut hub = CloudFunctions::new(client, auth);
992/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
993/// // like `locations_functions_call(...)`, `locations_functions_create(...)`, `locations_functions_delete(...)`, `locations_functions_generate_download_url(...)`, `locations_functions_generate_upload_url(...)`, `locations_functions_get(...)`, `locations_functions_get_iam_policy(...)`, `locations_functions_list(...)`, `locations_functions_patch(...)`, `locations_functions_set_iam_policy(...)`, `locations_functions_test_iam_permissions(...)` and `locations_list(...)`
994/// // to build up your call.
995/// let rb = hub.projects();
996/// # }
997/// ```
998pub struct ProjectMethods<'a, C>
999where
1000    C: 'a,
1001{
1002    hub: &'a CloudFunctions<C>,
1003}
1004
1005impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1006
1007impl<'a, C> ProjectMethods<'a, C> {
1008    /// Create a builder to help you perform the following task:
1009    ///
1010    /// Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
1011    ///
1012    /// # Arguments
1013    ///
1014    /// * `request` - No description provided.
1015    /// * `name` - Required. The name of the function to be called.
1016    pub fn locations_functions_call(
1017        &self,
1018        request: CallFunctionRequest,
1019        name: &str,
1020    ) -> ProjectLocationFunctionCallCall<'a, C> {
1021        ProjectLocationFunctionCallCall {
1022            hub: self.hub,
1023            _request: request,
1024            _name: name.to_string(),
1025            _delegate: Default::default(),
1026            _additional_params: Default::default(),
1027            _scopes: Default::default(),
1028        }
1029    }
1030
1031    /// Create a builder to help you perform the following task:
1032    ///
1033    /// Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.
1034    ///
1035    /// # Arguments
1036    ///
1037    /// * `request` - No description provided.
1038    /// * `location` - Required. The project and location in which the function should be created, specified in the format `projects/*/locations/*`
1039    pub fn locations_functions_create(
1040        &self,
1041        request: CloudFunction,
1042        location: &str,
1043    ) -> ProjectLocationFunctionCreateCall<'a, C> {
1044        ProjectLocationFunctionCreateCall {
1045            hub: self.hub,
1046            _request: request,
1047            _location: location.to_string(),
1048            _delegate: Default::default(),
1049            _additional_params: Default::default(),
1050            _scopes: Default::default(),
1051        }
1052    }
1053
1054    /// Create a builder to help you perform the following task:
1055    ///
1056    /// Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
1057    ///
1058    /// # Arguments
1059    ///
1060    /// * `name` - Required. The name of the function which should be deleted.
1061    pub fn locations_functions_delete(
1062        &self,
1063        name: &str,
1064    ) -> ProjectLocationFunctionDeleteCall<'a, C> {
1065        ProjectLocationFunctionDeleteCall {
1066            hub: self.hub,
1067            _name: name.to_string(),
1068            _delegate: Default::default(),
1069            _additional_params: Default::default(),
1070            _scopes: Default::default(),
1071        }
1072    }
1073
1074    /// Create a builder to help you perform the following task:
1075    ///
1076    /// Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
1077    ///
1078    /// # Arguments
1079    ///
1080    /// * `request` - No description provided.
1081    /// * `name` - The name of function for which source code Google Cloud Storage signed URL should be generated.
1082    pub fn locations_functions_generate_download_url(
1083        &self,
1084        request: GenerateDownloadUrlRequest,
1085        name: &str,
1086    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {
1087        ProjectLocationFunctionGenerateDownloadUrlCall {
1088            hub: self.hub,
1089            _request: request,
1090            _name: name.to_string(),
1091            _delegate: Default::default(),
1092            _additional_params: Default::default(),
1093            _scopes: Default::default(),
1094        }
1095    }
1096
1097    /// Create a builder to help you perform the following task:
1098    ///
1099    /// Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`
1100    ///
1101    /// # Arguments
1102    ///
1103    /// * `request` - No description provided.
1104    /// * `parent` - The project and location in which the Google Cloud Storage signed URL should be generated, specified in the format `projects/*/locations/*`.
1105    pub fn locations_functions_generate_upload_url(
1106        &self,
1107        request: GenerateUploadUrlRequest,
1108        parent: &str,
1109    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {
1110        ProjectLocationFunctionGenerateUploadUrlCall {
1111            hub: self.hub,
1112            _request: request,
1113            _parent: parent.to_string(),
1114            _delegate: Default::default(),
1115            _additional_params: Default::default(),
1116            _scopes: Default::default(),
1117        }
1118    }
1119
1120    /// Create a builder to help you perform the following task:
1121    ///
1122    /// Returns a function with the given name from the requested project.
1123    ///
1124    /// # Arguments
1125    ///
1126    /// * `name` - Required. The name of the function which details should be obtained.
1127    pub fn locations_functions_get(&self, name: &str) -> ProjectLocationFunctionGetCall<'a, C> {
1128        ProjectLocationFunctionGetCall {
1129            hub: self.hub,
1130            _name: name.to_string(),
1131            _version_id: Default::default(),
1132            _delegate: Default::default(),
1133            _additional_params: Default::default(),
1134            _scopes: Default::default(),
1135        }
1136    }
1137
1138    /// Create a builder to help you perform the following task:
1139    ///
1140    /// Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
1141    ///
1142    /// # Arguments
1143    ///
1144    /// * `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.
1145    pub fn locations_functions_get_iam_policy(
1146        &self,
1147        resource: &str,
1148    ) -> ProjectLocationFunctionGetIamPolicyCall<'a, C> {
1149        ProjectLocationFunctionGetIamPolicyCall {
1150            hub: self.hub,
1151            _resource: resource.to_string(),
1152            _options_requested_policy_version: Default::default(),
1153            _delegate: Default::default(),
1154            _additional_params: Default::default(),
1155            _scopes: Default::default(),
1156        }
1157    }
1158
1159    /// Create a builder to help you perform the following task:
1160    ///
1161    /// Returns a list of functions that belong to the requested project.
1162    ///
1163    /// # Arguments
1164    ///
1165    /// * `parent` - The project and location from which the function should be listed, specified in the format `projects/*/locations/*` If you want to list functions in all locations, use "-" in place of a location. When listing functions in all locations, if one or more location(s) are unreachable, the response will contain functions from all reachable locations along with the names of any unreachable locations.
1166    pub fn locations_functions_list(&self, parent: &str) -> ProjectLocationFunctionListCall<'a, C> {
1167        ProjectLocationFunctionListCall {
1168            hub: self.hub,
1169            _parent: parent.to_string(),
1170            _page_token: Default::default(),
1171            _page_size: Default::default(),
1172            _delegate: Default::default(),
1173            _additional_params: Default::default(),
1174            _scopes: Default::default(),
1175        }
1176    }
1177
1178    /// Create a builder to help you perform the following task:
1179    ///
1180    /// Updates existing function.
1181    ///
1182    /// # Arguments
1183    ///
1184    /// * `request` - No description provided.
1185    /// * `name` - A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`
1186    pub fn locations_functions_patch(
1187        &self,
1188        request: CloudFunction,
1189        name: &str,
1190    ) -> ProjectLocationFunctionPatchCall<'a, C> {
1191        ProjectLocationFunctionPatchCall {
1192            hub: self.hub,
1193            _request: request,
1194            _name: name.to_string(),
1195            _update_mask: Default::default(),
1196            _delegate: Default::default(),
1197            _additional_params: Default::default(),
1198            _scopes: Default::default(),
1199        }
1200    }
1201
1202    /// Create a builder to help you perform the following task:
1203    ///
1204    /// Sets the IAM access control policy on the specified function. Replaces any existing policy.
1205    ///
1206    /// # Arguments
1207    ///
1208    /// * `request` - No description provided.
1209    /// * `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.
1210    pub fn locations_functions_set_iam_policy(
1211        &self,
1212        request: SetIamPolicyRequest,
1213        resource: &str,
1214    ) -> ProjectLocationFunctionSetIamPolicyCall<'a, C> {
1215        ProjectLocationFunctionSetIamPolicyCall {
1216            hub: self.hub,
1217            _request: request,
1218            _resource: resource.to_string(),
1219            _delegate: Default::default(),
1220            _additional_params: Default::default(),
1221            _scopes: Default::default(),
1222        }
1223    }
1224
1225    /// Create a builder to help you perform the following task:
1226    ///
1227    /// Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
1228    ///
1229    /// # Arguments
1230    ///
1231    /// * `request` - No description provided.
1232    /// * `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.
1233    pub fn locations_functions_test_iam_permissions(
1234        &self,
1235        request: TestIamPermissionsRequest,
1236        resource: &str,
1237    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C> {
1238        ProjectLocationFunctionTestIamPermissionCall {
1239            hub: self.hub,
1240            _request: request,
1241            _resource: resource.to_string(),
1242            _delegate: Default::default(),
1243            _additional_params: Default::default(),
1244            _scopes: Default::default(),
1245        }
1246    }
1247
1248    /// Create a builder to help you perform the following task:
1249    ///
1250    /// Lists information about the supported locations for this service.
1251    ///
1252    /// # Arguments
1253    ///
1254    /// * `name` - The resource that owns the locations collection, if applicable.
1255    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1256        ProjectLocationListCall {
1257            hub: self.hub,
1258            _name: name.to_string(),
1259            _page_token: Default::default(),
1260            _page_size: Default::default(),
1261            _filter: Default::default(),
1262            _delegate: Default::default(),
1263            _additional_params: Default::default(),
1264            _scopes: Default::default(),
1265        }
1266    }
1267}
1268
1269// ###################
1270// CallBuilders   ###
1271// #################
1272
1273/// 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.
1274///
1275/// A builder for the *get* method supported by a *operation* resource.
1276/// It is not used directly, but through a [`OperationMethods`] instance.
1277///
1278/// # Example
1279///
1280/// Instantiate a resource method builder
1281///
1282/// ```test_harness,no_run
1283/// # extern crate hyper;
1284/// # extern crate hyper_rustls;
1285/// # extern crate google_cloudfunctions1 as cloudfunctions1;
1286/// # async fn dox() {
1287/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1288///
1289/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1290/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1291/// #     secret,
1292/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1293/// # ).build().await.unwrap();
1294///
1295/// # let client = hyper_util::client::legacy::Client::builder(
1296/// #     hyper_util::rt::TokioExecutor::new()
1297/// # )
1298/// # .build(
1299/// #     hyper_rustls::HttpsConnectorBuilder::new()
1300/// #         .with_native_roots()
1301/// #         .unwrap()
1302/// #         .https_or_http()
1303/// #         .enable_http1()
1304/// #         .build()
1305/// # );
1306/// # let mut hub = CloudFunctions::new(client, auth);
1307/// // You can configure optional parameters by calling the respective setters at will, and
1308/// // execute the final call using `doit()`.
1309/// // Values shown here are possibly random and not representative !
1310/// let result = hub.operations().get("name")
1311///              .doit().await;
1312/// # }
1313/// ```
1314pub struct OperationGetCall<'a, C>
1315where
1316    C: 'a,
1317{
1318    hub: &'a CloudFunctions<C>,
1319    _name: String,
1320    _delegate: Option<&'a mut dyn common::Delegate>,
1321    _additional_params: HashMap<String, String>,
1322    _scopes: BTreeSet<String>,
1323}
1324
1325impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
1326
1327impl<'a, C> OperationGetCall<'a, C>
1328where
1329    C: common::Connector,
1330{
1331    /// Perform the operation you have build so far.
1332    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1333        use std::borrow::Cow;
1334        use std::io::{Read, Seek};
1335
1336        use common::{url::Params, ToParts};
1337        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1338
1339        let mut dd = common::DefaultDelegate;
1340        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1341        dlg.begin(common::MethodInfo {
1342            id: "cloudfunctions.operations.get",
1343            http_method: hyper::Method::GET,
1344        });
1345
1346        for &field in ["alt", "name"].iter() {
1347            if self._additional_params.contains_key(field) {
1348                dlg.finished(false);
1349                return Err(common::Error::FieldClash(field));
1350            }
1351        }
1352
1353        let mut params = Params::with_capacity(3 + self._additional_params.len());
1354        params.push("name", self._name);
1355
1356        params.extend(self._additional_params.iter());
1357
1358        params.push("alt", "json");
1359        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1360        if self._scopes.is_empty() {
1361            self._scopes
1362                .insert(Scope::CloudPlatform.as_ref().to_string());
1363        }
1364
1365        #[allow(clippy::single_element_loop)]
1366        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1367            url = params.uri_replacement(url, param_name, find_this, true);
1368        }
1369        {
1370            let to_remove = ["name"];
1371            params.remove_params(&to_remove);
1372        }
1373
1374        let url = params.parse_with_url(&url);
1375
1376        loop {
1377            let token = match self
1378                .hub
1379                .auth
1380                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1381                .await
1382            {
1383                Ok(token) => token,
1384                Err(e) => match dlg.token(e) {
1385                    Ok(token) => token,
1386                    Err(e) => {
1387                        dlg.finished(false);
1388                        return Err(common::Error::MissingToken(e));
1389                    }
1390                },
1391            };
1392            let mut req_result = {
1393                let client = &self.hub.client;
1394                dlg.pre_request();
1395                let mut req_builder = hyper::Request::builder()
1396                    .method(hyper::Method::GET)
1397                    .uri(url.as_str())
1398                    .header(USER_AGENT, self.hub._user_agent.clone());
1399
1400                if let Some(token) = token.as_ref() {
1401                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1402                }
1403
1404                let request = req_builder
1405                    .header(CONTENT_LENGTH, 0_u64)
1406                    .body(common::to_body::<String>(None));
1407
1408                client.request(request.unwrap()).await
1409            };
1410
1411            match req_result {
1412                Err(err) => {
1413                    if let common::Retry::After(d) = dlg.http_error(&err) {
1414                        sleep(d).await;
1415                        continue;
1416                    }
1417                    dlg.finished(false);
1418                    return Err(common::Error::HttpError(err));
1419                }
1420                Ok(res) => {
1421                    let (mut parts, body) = res.into_parts();
1422                    let mut body = common::Body::new(body);
1423                    if !parts.status.is_success() {
1424                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1425                        let error = serde_json::from_str(&common::to_string(&bytes));
1426                        let response = common::to_response(parts, bytes.into());
1427
1428                        if let common::Retry::After(d) =
1429                            dlg.http_failure(&response, error.as_ref().ok())
1430                        {
1431                            sleep(d).await;
1432                            continue;
1433                        }
1434
1435                        dlg.finished(false);
1436
1437                        return Err(match error {
1438                            Ok(value) => common::Error::BadRequest(value),
1439                            _ => common::Error::Failure(response),
1440                        });
1441                    }
1442                    let response = {
1443                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1444                        let encoded = common::to_string(&bytes);
1445                        match serde_json::from_str(&encoded) {
1446                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1447                            Err(error) => {
1448                                dlg.response_json_decode_error(&encoded, &error);
1449                                return Err(common::Error::JsonDecodeError(
1450                                    encoded.to_string(),
1451                                    error,
1452                                ));
1453                            }
1454                        }
1455                    };
1456
1457                    dlg.finished(true);
1458                    return Ok(response);
1459                }
1460            }
1461        }
1462    }
1463
1464    /// The name of the operation resource.
1465    ///
1466    /// Sets the *name* path property to the given value.
1467    ///
1468    /// Even though the property as already been set when instantiating this call,
1469    /// we provide this method for API completeness.
1470    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
1471        self._name = new_value.to_string();
1472        self
1473    }
1474    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1475    /// while executing the actual API request.
1476    ///
1477    /// ````text
1478    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1479    /// ````
1480    ///
1481    /// Sets the *delegate* property to the given value.
1482    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
1483        self._delegate = Some(new_value);
1484        self
1485    }
1486
1487    /// Set any additional parameter of the query string used in the request.
1488    /// It should be used to set parameters which are not yet available through their own
1489    /// setters.
1490    ///
1491    /// Please note that this method must not be used to set any of the known parameters
1492    /// which have their own setter method. If done anyway, the request will fail.
1493    ///
1494    /// # Additional Parameters
1495    ///
1496    /// * *$.xgafv* (query-string) - V1 error format.
1497    /// * *access_token* (query-string) - OAuth access token.
1498    /// * *alt* (query-string) - Data format for response.
1499    /// * *callback* (query-string) - JSONP
1500    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1501    /// * *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.
1502    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1503    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1504    /// * *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.
1505    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1506    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1507    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
1508    where
1509        T: AsRef<str>,
1510    {
1511        self._additional_params
1512            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1513        self
1514    }
1515
1516    /// Identifies the authorization scope for the method you are building.
1517    ///
1518    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1519    /// [`Scope::CloudPlatform`].
1520    ///
1521    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1522    /// tokens for more than one scope.
1523    ///
1524    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1525    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1526    /// sufficient, a read-write scope will do as well.
1527    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
1528    where
1529        St: AsRef<str>,
1530    {
1531        self._scopes.insert(String::from(scope.as_ref()));
1532        self
1533    }
1534    /// Identifies the authorization scope(s) for the method you are building.
1535    ///
1536    /// See [`Self::add_scope()`] for details.
1537    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
1538    where
1539        I: IntoIterator<Item = St>,
1540        St: AsRef<str>,
1541    {
1542        self._scopes
1543            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1544        self
1545    }
1546
1547    /// Removes all scopes, and no default scope will be used either.
1548    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1549    /// for details).
1550    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
1551        self._scopes.clear();
1552        self
1553    }
1554}
1555
1556/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1557///
1558/// A builder for the *list* method supported by a *operation* resource.
1559/// It is not used directly, but through a [`OperationMethods`] instance.
1560///
1561/// # Example
1562///
1563/// Instantiate a resource method builder
1564///
1565/// ```test_harness,no_run
1566/// # extern crate hyper;
1567/// # extern crate hyper_rustls;
1568/// # extern crate google_cloudfunctions1 as cloudfunctions1;
1569/// # async fn dox() {
1570/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1571///
1572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1574/// #     secret,
1575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1576/// # ).build().await.unwrap();
1577///
1578/// # let client = hyper_util::client::legacy::Client::builder(
1579/// #     hyper_util::rt::TokioExecutor::new()
1580/// # )
1581/// # .build(
1582/// #     hyper_rustls::HttpsConnectorBuilder::new()
1583/// #         .with_native_roots()
1584/// #         .unwrap()
1585/// #         .https_or_http()
1586/// #         .enable_http1()
1587/// #         .build()
1588/// # );
1589/// # let mut hub = CloudFunctions::new(client, auth);
1590/// // You can configure optional parameters by calling the respective setters at will, and
1591/// // execute the final call using `doit()`.
1592/// // Values shown here are possibly random and not representative !
1593/// let result = hub.operations().list()
1594///              .page_token("gubergren")
1595///              .page_size(-51)
1596///              .name("gubergren")
1597///              .filter("eos")
1598///              .doit().await;
1599/// # }
1600/// ```
1601pub struct OperationListCall<'a, C>
1602where
1603    C: 'a,
1604{
1605    hub: &'a CloudFunctions<C>,
1606    _page_token: Option<String>,
1607    _page_size: Option<i32>,
1608    _name: Option<String>,
1609    _filter: Option<String>,
1610    _delegate: Option<&'a mut dyn common::Delegate>,
1611    _additional_params: HashMap<String, String>,
1612    _scopes: BTreeSet<String>,
1613}
1614
1615impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
1616
1617impl<'a, C> OperationListCall<'a, C>
1618where
1619    C: common::Connector,
1620{
1621    /// Perform the operation you have build so far.
1622    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
1623        use std::borrow::Cow;
1624        use std::io::{Read, Seek};
1625
1626        use common::{url::Params, ToParts};
1627        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1628
1629        let mut dd = common::DefaultDelegate;
1630        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1631        dlg.begin(common::MethodInfo {
1632            id: "cloudfunctions.operations.list",
1633            http_method: hyper::Method::GET,
1634        });
1635
1636        for &field in ["alt", "pageToken", "pageSize", "name", "filter"].iter() {
1637            if self._additional_params.contains_key(field) {
1638                dlg.finished(false);
1639                return Err(common::Error::FieldClash(field));
1640            }
1641        }
1642
1643        let mut params = Params::with_capacity(6 + self._additional_params.len());
1644        if let Some(value) = self._page_token.as_ref() {
1645            params.push("pageToken", value);
1646        }
1647        if let Some(value) = self._page_size.as_ref() {
1648            params.push("pageSize", value.to_string());
1649        }
1650        if let Some(value) = self._name.as_ref() {
1651            params.push("name", value);
1652        }
1653        if let Some(value) = self._filter.as_ref() {
1654            params.push("filter", value);
1655        }
1656
1657        params.extend(self._additional_params.iter());
1658
1659        params.push("alt", "json");
1660        let mut url = self.hub._base_url.clone() + "v1/operations";
1661        if self._scopes.is_empty() {
1662            self._scopes
1663                .insert(Scope::CloudPlatform.as_ref().to_string());
1664        }
1665
1666        let url = params.parse_with_url(&url);
1667
1668        loop {
1669            let token = match self
1670                .hub
1671                .auth
1672                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1673                .await
1674            {
1675                Ok(token) => token,
1676                Err(e) => match dlg.token(e) {
1677                    Ok(token) => token,
1678                    Err(e) => {
1679                        dlg.finished(false);
1680                        return Err(common::Error::MissingToken(e));
1681                    }
1682                },
1683            };
1684            let mut req_result = {
1685                let client = &self.hub.client;
1686                dlg.pre_request();
1687                let mut req_builder = hyper::Request::builder()
1688                    .method(hyper::Method::GET)
1689                    .uri(url.as_str())
1690                    .header(USER_AGENT, self.hub._user_agent.clone());
1691
1692                if let Some(token) = token.as_ref() {
1693                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1694                }
1695
1696                let request = req_builder
1697                    .header(CONTENT_LENGTH, 0_u64)
1698                    .body(common::to_body::<String>(None));
1699
1700                client.request(request.unwrap()).await
1701            };
1702
1703            match req_result {
1704                Err(err) => {
1705                    if let common::Retry::After(d) = dlg.http_error(&err) {
1706                        sleep(d).await;
1707                        continue;
1708                    }
1709                    dlg.finished(false);
1710                    return Err(common::Error::HttpError(err));
1711                }
1712                Ok(res) => {
1713                    let (mut parts, body) = res.into_parts();
1714                    let mut body = common::Body::new(body);
1715                    if !parts.status.is_success() {
1716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1717                        let error = serde_json::from_str(&common::to_string(&bytes));
1718                        let response = common::to_response(parts, bytes.into());
1719
1720                        if let common::Retry::After(d) =
1721                            dlg.http_failure(&response, error.as_ref().ok())
1722                        {
1723                            sleep(d).await;
1724                            continue;
1725                        }
1726
1727                        dlg.finished(false);
1728
1729                        return Err(match error {
1730                            Ok(value) => common::Error::BadRequest(value),
1731                            _ => common::Error::Failure(response),
1732                        });
1733                    }
1734                    let response = {
1735                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1736                        let encoded = common::to_string(&bytes);
1737                        match serde_json::from_str(&encoded) {
1738                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1739                            Err(error) => {
1740                                dlg.response_json_decode_error(&encoded, &error);
1741                                return Err(common::Error::JsonDecodeError(
1742                                    encoded.to_string(),
1743                                    error,
1744                                ));
1745                            }
1746                        }
1747                    };
1748
1749                    dlg.finished(true);
1750                    return Ok(response);
1751                }
1752            }
1753        }
1754    }
1755
1756    /// The standard list page token.
1757    ///
1758    /// Sets the *page token* query property to the given value.
1759    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
1760        self._page_token = Some(new_value.to_string());
1761        self
1762    }
1763    /// The standard list page size.
1764    ///
1765    /// Sets the *page size* query property to the given value.
1766    pub fn page_size(mut self, new_value: i32) -> OperationListCall<'a, C> {
1767        self._page_size = Some(new_value);
1768        self
1769    }
1770    /// The name of the operation's parent resource.
1771    ///
1772    /// Sets the *name* query property to the given value.
1773    pub fn name(mut self, new_value: &str) -> OperationListCall<'a, C> {
1774        self._name = Some(new_value.to_string());
1775        self
1776    }
1777    /// The standard list filter.
1778    ///
1779    /// Sets the *filter* query property to the given value.
1780    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
1781        self._filter = Some(new_value.to_string());
1782        self
1783    }
1784    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1785    /// while executing the actual API request.
1786    ///
1787    /// ````text
1788    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1789    /// ````
1790    ///
1791    /// Sets the *delegate* property to the given value.
1792    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
1793        self._delegate = Some(new_value);
1794        self
1795    }
1796
1797    /// Set any additional parameter of the query string used in the request.
1798    /// It should be used to set parameters which are not yet available through their own
1799    /// setters.
1800    ///
1801    /// Please note that this method must not be used to set any of the known parameters
1802    /// which have their own setter method. If done anyway, the request will fail.
1803    ///
1804    /// # Additional Parameters
1805    ///
1806    /// * *$.xgafv* (query-string) - V1 error format.
1807    /// * *access_token* (query-string) - OAuth access token.
1808    /// * *alt* (query-string) - Data format for response.
1809    /// * *callback* (query-string) - JSONP
1810    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1811    /// * *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.
1812    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1813    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1814    /// * *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.
1815    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1816    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1817    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
1818    where
1819        T: AsRef<str>,
1820    {
1821        self._additional_params
1822            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1823        self
1824    }
1825
1826    /// Identifies the authorization scope for the method you are building.
1827    ///
1828    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1829    /// [`Scope::CloudPlatform`].
1830    ///
1831    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1832    /// tokens for more than one scope.
1833    ///
1834    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1835    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1836    /// sufficient, a read-write scope will do as well.
1837    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
1838    where
1839        St: AsRef<str>,
1840    {
1841        self._scopes.insert(String::from(scope.as_ref()));
1842        self
1843    }
1844    /// Identifies the authorization scope(s) for the method you are building.
1845    ///
1846    /// See [`Self::add_scope()`] for details.
1847    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
1848    where
1849        I: IntoIterator<Item = St>,
1850        St: AsRef<str>,
1851    {
1852        self._scopes
1853            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1854        self
1855    }
1856
1857    /// Removes all scopes, and no default scope will be used either.
1858    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1859    /// for details).
1860    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
1861        self._scopes.clear();
1862        self
1863    }
1864}
1865
1866/// Synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
1867///
1868/// A builder for the *locations.functions.call* method supported by a *project* resource.
1869/// It is not used directly, but through a [`ProjectMethods`] instance.
1870///
1871/// # Example
1872///
1873/// Instantiate a resource method builder
1874///
1875/// ```test_harness,no_run
1876/// # extern crate hyper;
1877/// # extern crate hyper_rustls;
1878/// # extern crate google_cloudfunctions1 as cloudfunctions1;
1879/// use cloudfunctions1::api::CallFunctionRequest;
1880/// # async fn dox() {
1881/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1882///
1883/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1884/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1885/// #     secret,
1886/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1887/// # ).build().await.unwrap();
1888///
1889/// # let client = hyper_util::client::legacy::Client::builder(
1890/// #     hyper_util::rt::TokioExecutor::new()
1891/// # )
1892/// # .build(
1893/// #     hyper_rustls::HttpsConnectorBuilder::new()
1894/// #         .with_native_roots()
1895/// #         .unwrap()
1896/// #         .https_or_http()
1897/// #         .enable_http1()
1898/// #         .build()
1899/// # );
1900/// # let mut hub = CloudFunctions::new(client, auth);
1901/// // As the method needs a request, you would usually fill it with the desired information
1902/// // into the respective structure. Some of the parts shown here might not be applicable !
1903/// // Values shown here are possibly random and not representative !
1904/// let mut req = CallFunctionRequest::default();
1905///
1906/// // You can configure optional parameters by calling the respective setters at will, and
1907/// // execute the final call using `doit()`.
1908/// // Values shown here are possibly random and not representative !
1909/// let result = hub.projects().locations_functions_call(req, "name")
1910///              .doit().await;
1911/// # }
1912/// ```
1913pub struct ProjectLocationFunctionCallCall<'a, C>
1914where
1915    C: 'a,
1916{
1917    hub: &'a CloudFunctions<C>,
1918    _request: CallFunctionRequest,
1919    _name: String,
1920    _delegate: Option<&'a mut dyn common::Delegate>,
1921    _additional_params: HashMap<String, String>,
1922    _scopes: BTreeSet<String>,
1923}
1924
1925impl<'a, C> common::CallBuilder for ProjectLocationFunctionCallCall<'a, C> {}
1926
1927impl<'a, C> ProjectLocationFunctionCallCall<'a, C>
1928where
1929    C: common::Connector,
1930{
1931    /// Perform the operation you have build so far.
1932    pub async fn doit(mut self) -> common::Result<(common::Response, CallFunctionResponse)> {
1933        use std::borrow::Cow;
1934        use std::io::{Read, Seek};
1935
1936        use common::{url::Params, ToParts};
1937        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1938
1939        let mut dd = common::DefaultDelegate;
1940        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1941        dlg.begin(common::MethodInfo {
1942            id: "cloudfunctions.projects.locations.functions.call",
1943            http_method: hyper::Method::POST,
1944        });
1945
1946        for &field in ["alt", "name"].iter() {
1947            if self._additional_params.contains_key(field) {
1948                dlg.finished(false);
1949                return Err(common::Error::FieldClash(field));
1950            }
1951        }
1952
1953        let mut params = Params::with_capacity(4 + self._additional_params.len());
1954        params.push("name", self._name);
1955
1956        params.extend(self._additional_params.iter());
1957
1958        params.push("alt", "json");
1959        let mut url = self.hub._base_url.clone() + "v1/{+name}:call";
1960        if self._scopes.is_empty() {
1961            self._scopes
1962                .insert(Scope::CloudPlatform.as_ref().to_string());
1963        }
1964
1965        #[allow(clippy::single_element_loop)]
1966        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1967            url = params.uri_replacement(url, param_name, find_this, true);
1968        }
1969        {
1970            let to_remove = ["name"];
1971            params.remove_params(&to_remove);
1972        }
1973
1974        let url = params.parse_with_url(&url);
1975
1976        let mut json_mime_type = mime::APPLICATION_JSON;
1977        let mut request_value_reader = {
1978            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1979            common::remove_json_null_values(&mut value);
1980            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1981            serde_json::to_writer(&mut dst, &value).unwrap();
1982            dst
1983        };
1984        let request_size = request_value_reader
1985            .seek(std::io::SeekFrom::End(0))
1986            .unwrap();
1987        request_value_reader
1988            .seek(std::io::SeekFrom::Start(0))
1989            .unwrap();
1990
1991        loop {
1992            let token = match self
1993                .hub
1994                .auth
1995                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1996                .await
1997            {
1998                Ok(token) => token,
1999                Err(e) => match dlg.token(e) {
2000                    Ok(token) => token,
2001                    Err(e) => {
2002                        dlg.finished(false);
2003                        return Err(common::Error::MissingToken(e));
2004                    }
2005                },
2006            };
2007            request_value_reader
2008                .seek(std::io::SeekFrom::Start(0))
2009                .unwrap();
2010            let mut req_result = {
2011                let client = &self.hub.client;
2012                dlg.pre_request();
2013                let mut req_builder = hyper::Request::builder()
2014                    .method(hyper::Method::POST)
2015                    .uri(url.as_str())
2016                    .header(USER_AGENT, self.hub._user_agent.clone());
2017
2018                if let Some(token) = token.as_ref() {
2019                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2020                }
2021
2022                let request = req_builder
2023                    .header(CONTENT_TYPE, json_mime_type.to_string())
2024                    .header(CONTENT_LENGTH, request_size as u64)
2025                    .body(common::to_body(
2026                        request_value_reader.get_ref().clone().into(),
2027                    ));
2028
2029                client.request(request.unwrap()).await
2030            };
2031
2032            match req_result {
2033                Err(err) => {
2034                    if let common::Retry::After(d) = dlg.http_error(&err) {
2035                        sleep(d).await;
2036                        continue;
2037                    }
2038                    dlg.finished(false);
2039                    return Err(common::Error::HttpError(err));
2040                }
2041                Ok(res) => {
2042                    let (mut parts, body) = res.into_parts();
2043                    let mut body = common::Body::new(body);
2044                    if !parts.status.is_success() {
2045                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2046                        let error = serde_json::from_str(&common::to_string(&bytes));
2047                        let response = common::to_response(parts, bytes.into());
2048
2049                        if let common::Retry::After(d) =
2050                            dlg.http_failure(&response, error.as_ref().ok())
2051                        {
2052                            sleep(d).await;
2053                            continue;
2054                        }
2055
2056                        dlg.finished(false);
2057
2058                        return Err(match error {
2059                            Ok(value) => common::Error::BadRequest(value),
2060                            _ => common::Error::Failure(response),
2061                        });
2062                    }
2063                    let response = {
2064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2065                        let encoded = common::to_string(&bytes);
2066                        match serde_json::from_str(&encoded) {
2067                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2068                            Err(error) => {
2069                                dlg.response_json_decode_error(&encoded, &error);
2070                                return Err(common::Error::JsonDecodeError(
2071                                    encoded.to_string(),
2072                                    error,
2073                                ));
2074                            }
2075                        }
2076                    };
2077
2078                    dlg.finished(true);
2079                    return Ok(response);
2080                }
2081            }
2082        }
2083    }
2084
2085    ///
2086    /// Sets the *request* property to the given value.
2087    ///
2088    /// Even though the property as already been set when instantiating this call,
2089    /// we provide this method for API completeness.
2090    pub fn request(
2091        mut self,
2092        new_value: CallFunctionRequest,
2093    ) -> ProjectLocationFunctionCallCall<'a, C> {
2094        self._request = new_value;
2095        self
2096    }
2097    /// Required. The name of the function to be called.
2098    ///
2099    /// Sets the *name* path property to the given value.
2100    ///
2101    /// Even though the property as already been set when instantiating this call,
2102    /// we provide this method for API completeness.
2103    pub fn name(mut self, new_value: &str) -> ProjectLocationFunctionCallCall<'a, C> {
2104        self._name = new_value.to_string();
2105        self
2106    }
2107    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2108    /// while executing the actual API request.
2109    ///
2110    /// ````text
2111    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2112    /// ````
2113    ///
2114    /// Sets the *delegate* property to the given value.
2115    pub fn delegate(
2116        mut self,
2117        new_value: &'a mut dyn common::Delegate,
2118    ) -> ProjectLocationFunctionCallCall<'a, C> {
2119        self._delegate = Some(new_value);
2120        self
2121    }
2122
2123    /// Set any additional parameter of the query string used in the request.
2124    /// It should be used to set parameters which are not yet available through their own
2125    /// setters.
2126    ///
2127    /// Please note that this method must not be used to set any of the known parameters
2128    /// which have their own setter method. If done anyway, the request will fail.
2129    ///
2130    /// # Additional Parameters
2131    ///
2132    /// * *$.xgafv* (query-string) - V1 error format.
2133    /// * *access_token* (query-string) - OAuth access token.
2134    /// * *alt* (query-string) - Data format for response.
2135    /// * *callback* (query-string) - JSONP
2136    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2137    /// * *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.
2138    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2139    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2140    /// * *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.
2141    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2142    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2143    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionCallCall<'a, C>
2144    where
2145        T: AsRef<str>,
2146    {
2147        self._additional_params
2148            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2149        self
2150    }
2151
2152    /// Identifies the authorization scope for the method you are building.
2153    ///
2154    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2155    /// [`Scope::CloudPlatform`].
2156    ///
2157    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2158    /// tokens for more than one scope.
2159    ///
2160    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2161    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2162    /// sufficient, a read-write scope will do as well.
2163    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionCallCall<'a, C>
2164    where
2165        St: AsRef<str>,
2166    {
2167        self._scopes.insert(String::from(scope.as_ref()));
2168        self
2169    }
2170    /// Identifies the authorization scope(s) for the method you are building.
2171    ///
2172    /// See [`Self::add_scope()`] for details.
2173    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionCallCall<'a, C>
2174    where
2175        I: IntoIterator<Item = St>,
2176        St: AsRef<str>,
2177    {
2178        self._scopes
2179            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2180        self
2181    }
2182
2183    /// Removes all scopes, and no default scope will be used either.
2184    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2185    /// for details).
2186    pub fn clear_scopes(mut self) -> ProjectLocationFunctionCallCall<'a, C> {
2187        self._scopes.clear();
2188        self
2189    }
2190}
2191
2192/// Creates a new function. If a function with the given name already exists in the specified project, the long running operation will return `ALREADY_EXISTS` error.
2193///
2194/// A builder for the *locations.functions.create* method supported by a *project* resource.
2195/// It is not used directly, but through a [`ProjectMethods`] instance.
2196///
2197/// # Example
2198///
2199/// Instantiate a resource method builder
2200///
2201/// ```test_harness,no_run
2202/// # extern crate hyper;
2203/// # extern crate hyper_rustls;
2204/// # extern crate google_cloudfunctions1 as cloudfunctions1;
2205/// use cloudfunctions1::api::CloudFunction;
2206/// # async fn dox() {
2207/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2208///
2209/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2211/// #     secret,
2212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2213/// # ).build().await.unwrap();
2214///
2215/// # let client = hyper_util::client::legacy::Client::builder(
2216/// #     hyper_util::rt::TokioExecutor::new()
2217/// # )
2218/// # .build(
2219/// #     hyper_rustls::HttpsConnectorBuilder::new()
2220/// #         .with_native_roots()
2221/// #         .unwrap()
2222/// #         .https_or_http()
2223/// #         .enable_http1()
2224/// #         .build()
2225/// # );
2226/// # let mut hub = CloudFunctions::new(client, auth);
2227/// // As the method needs a request, you would usually fill it with the desired information
2228/// // into the respective structure. Some of the parts shown here might not be applicable !
2229/// // Values shown here are possibly random and not representative !
2230/// let mut req = CloudFunction::default();
2231///
2232/// // You can configure optional parameters by calling the respective setters at will, and
2233/// // execute the final call using `doit()`.
2234/// // Values shown here are possibly random and not representative !
2235/// let result = hub.projects().locations_functions_create(req, "location")
2236///              .doit().await;
2237/// # }
2238/// ```
2239pub struct ProjectLocationFunctionCreateCall<'a, C>
2240where
2241    C: 'a,
2242{
2243    hub: &'a CloudFunctions<C>,
2244    _request: CloudFunction,
2245    _location: String,
2246    _delegate: Option<&'a mut dyn common::Delegate>,
2247    _additional_params: HashMap<String, String>,
2248    _scopes: BTreeSet<String>,
2249}
2250
2251impl<'a, C> common::CallBuilder for ProjectLocationFunctionCreateCall<'a, C> {}
2252
2253impl<'a, C> ProjectLocationFunctionCreateCall<'a, C>
2254where
2255    C: common::Connector,
2256{
2257    /// Perform the operation you have build so far.
2258    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2259        use std::borrow::Cow;
2260        use std::io::{Read, Seek};
2261
2262        use common::{url::Params, ToParts};
2263        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2264
2265        let mut dd = common::DefaultDelegate;
2266        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2267        dlg.begin(common::MethodInfo {
2268            id: "cloudfunctions.projects.locations.functions.create",
2269            http_method: hyper::Method::POST,
2270        });
2271
2272        for &field in ["alt", "location"].iter() {
2273            if self._additional_params.contains_key(field) {
2274                dlg.finished(false);
2275                return Err(common::Error::FieldClash(field));
2276            }
2277        }
2278
2279        let mut params = Params::with_capacity(4 + self._additional_params.len());
2280        params.push("location", self._location);
2281
2282        params.extend(self._additional_params.iter());
2283
2284        params.push("alt", "json");
2285        let mut url = self.hub._base_url.clone() + "v1/{+location}/functions";
2286        if self._scopes.is_empty() {
2287            self._scopes
2288                .insert(Scope::CloudPlatform.as_ref().to_string());
2289        }
2290
2291        #[allow(clippy::single_element_loop)]
2292        for &(find_this, param_name) in [("{+location}", "location")].iter() {
2293            url = params.uri_replacement(url, param_name, find_this, true);
2294        }
2295        {
2296            let to_remove = ["location"];
2297            params.remove_params(&to_remove);
2298        }
2299
2300        let url = params.parse_with_url(&url);
2301
2302        let mut json_mime_type = mime::APPLICATION_JSON;
2303        let mut request_value_reader = {
2304            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2305            common::remove_json_null_values(&mut value);
2306            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2307            serde_json::to_writer(&mut dst, &value).unwrap();
2308            dst
2309        };
2310        let request_size = request_value_reader
2311            .seek(std::io::SeekFrom::End(0))
2312            .unwrap();
2313        request_value_reader
2314            .seek(std::io::SeekFrom::Start(0))
2315            .unwrap();
2316
2317        loop {
2318            let token = match self
2319                .hub
2320                .auth
2321                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2322                .await
2323            {
2324                Ok(token) => token,
2325                Err(e) => match dlg.token(e) {
2326                    Ok(token) => token,
2327                    Err(e) => {
2328                        dlg.finished(false);
2329                        return Err(common::Error::MissingToken(e));
2330                    }
2331                },
2332            };
2333            request_value_reader
2334                .seek(std::io::SeekFrom::Start(0))
2335                .unwrap();
2336            let mut req_result = {
2337                let client = &self.hub.client;
2338                dlg.pre_request();
2339                let mut req_builder = hyper::Request::builder()
2340                    .method(hyper::Method::POST)
2341                    .uri(url.as_str())
2342                    .header(USER_AGENT, self.hub._user_agent.clone());
2343
2344                if let Some(token) = token.as_ref() {
2345                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2346                }
2347
2348                let request = req_builder
2349                    .header(CONTENT_TYPE, json_mime_type.to_string())
2350                    .header(CONTENT_LENGTH, request_size as u64)
2351                    .body(common::to_body(
2352                        request_value_reader.get_ref().clone().into(),
2353                    ));
2354
2355                client.request(request.unwrap()).await
2356            };
2357
2358            match req_result {
2359                Err(err) => {
2360                    if let common::Retry::After(d) = dlg.http_error(&err) {
2361                        sleep(d).await;
2362                        continue;
2363                    }
2364                    dlg.finished(false);
2365                    return Err(common::Error::HttpError(err));
2366                }
2367                Ok(res) => {
2368                    let (mut parts, body) = res.into_parts();
2369                    let mut body = common::Body::new(body);
2370                    if !parts.status.is_success() {
2371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2372                        let error = serde_json::from_str(&common::to_string(&bytes));
2373                        let response = common::to_response(parts, bytes.into());
2374
2375                        if let common::Retry::After(d) =
2376                            dlg.http_failure(&response, error.as_ref().ok())
2377                        {
2378                            sleep(d).await;
2379                            continue;
2380                        }
2381
2382                        dlg.finished(false);
2383
2384                        return Err(match error {
2385                            Ok(value) => common::Error::BadRequest(value),
2386                            _ => common::Error::Failure(response),
2387                        });
2388                    }
2389                    let response = {
2390                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2391                        let encoded = common::to_string(&bytes);
2392                        match serde_json::from_str(&encoded) {
2393                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2394                            Err(error) => {
2395                                dlg.response_json_decode_error(&encoded, &error);
2396                                return Err(common::Error::JsonDecodeError(
2397                                    encoded.to_string(),
2398                                    error,
2399                                ));
2400                            }
2401                        }
2402                    };
2403
2404                    dlg.finished(true);
2405                    return Ok(response);
2406                }
2407            }
2408        }
2409    }
2410
2411    ///
2412    /// Sets the *request* property to the given value.
2413    ///
2414    /// Even though the property as already been set when instantiating this call,
2415    /// we provide this method for API completeness.
2416    pub fn request(mut self, new_value: CloudFunction) -> ProjectLocationFunctionCreateCall<'a, C> {
2417        self._request = new_value;
2418        self
2419    }
2420    /// Required. The project and location in which the function should be created, specified in the format `projects/*/locations/*`
2421    ///
2422    /// Sets the *location* path property to the given value.
2423    ///
2424    /// Even though the property as already been set when instantiating this call,
2425    /// we provide this method for API completeness.
2426    pub fn location(mut self, new_value: &str) -> ProjectLocationFunctionCreateCall<'a, C> {
2427        self._location = new_value.to_string();
2428        self
2429    }
2430    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2431    /// while executing the actual API request.
2432    ///
2433    /// ````text
2434    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2435    /// ````
2436    ///
2437    /// Sets the *delegate* property to the given value.
2438    pub fn delegate(
2439        mut self,
2440        new_value: &'a mut dyn common::Delegate,
2441    ) -> ProjectLocationFunctionCreateCall<'a, C> {
2442        self._delegate = Some(new_value);
2443        self
2444    }
2445
2446    /// Set any additional parameter of the query string used in the request.
2447    /// It should be used to set parameters which are not yet available through their own
2448    /// setters.
2449    ///
2450    /// Please note that this method must not be used to set any of the known parameters
2451    /// which have their own setter method. If done anyway, the request will fail.
2452    ///
2453    /// # Additional Parameters
2454    ///
2455    /// * *$.xgafv* (query-string) - V1 error format.
2456    /// * *access_token* (query-string) - OAuth access token.
2457    /// * *alt* (query-string) - Data format for response.
2458    /// * *callback* (query-string) - JSONP
2459    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2460    /// * *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.
2461    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2462    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2463    /// * *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.
2464    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2465    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2466    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionCreateCall<'a, C>
2467    where
2468        T: AsRef<str>,
2469    {
2470        self._additional_params
2471            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2472        self
2473    }
2474
2475    /// Identifies the authorization scope for the method you are building.
2476    ///
2477    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2478    /// [`Scope::CloudPlatform`].
2479    ///
2480    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2481    /// tokens for more than one scope.
2482    ///
2483    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2484    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2485    /// sufficient, a read-write scope will do as well.
2486    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionCreateCall<'a, C>
2487    where
2488        St: AsRef<str>,
2489    {
2490        self._scopes.insert(String::from(scope.as_ref()));
2491        self
2492    }
2493    /// Identifies the authorization scope(s) for the method you are building.
2494    ///
2495    /// See [`Self::add_scope()`] for details.
2496    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionCreateCall<'a, C>
2497    where
2498        I: IntoIterator<Item = St>,
2499        St: AsRef<str>,
2500    {
2501        self._scopes
2502            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2503        self
2504    }
2505
2506    /// Removes all scopes, and no default scope will be used either.
2507    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2508    /// for details).
2509    pub fn clear_scopes(mut self) -> ProjectLocationFunctionCreateCall<'a, C> {
2510        self._scopes.clear();
2511        self
2512    }
2513}
2514
2515/// Deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
2516///
2517/// A builder for the *locations.functions.delete* method supported by a *project* resource.
2518/// It is not used directly, but through a [`ProjectMethods`] instance.
2519///
2520/// # Example
2521///
2522/// Instantiate a resource method builder
2523///
2524/// ```test_harness,no_run
2525/// # extern crate hyper;
2526/// # extern crate hyper_rustls;
2527/// # extern crate google_cloudfunctions1 as cloudfunctions1;
2528/// # async fn dox() {
2529/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2530///
2531/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2532/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2533/// #     secret,
2534/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2535/// # ).build().await.unwrap();
2536///
2537/// # let client = hyper_util::client::legacy::Client::builder(
2538/// #     hyper_util::rt::TokioExecutor::new()
2539/// # )
2540/// # .build(
2541/// #     hyper_rustls::HttpsConnectorBuilder::new()
2542/// #         .with_native_roots()
2543/// #         .unwrap()
2544/// #         .https_or_http()
2545/// #         .enable_http1()
2546/// #         .build()
2547/// # );
2548/// # let mut hub = CloudFunctions::new(client, auth);
2549/// // You can configure optional parameters by calling the respective setters at will, and
2550/// // execute the final call using `doit()`.
2551/// // Values shown here are possibly random and not representative !
2552/// let result = hub.projects().locations_functions_delete("name")
2553///              .doit().await;
2554/// # }
2555/// ```
2556pub struct ProjectLocationFunctionDeleteCall<'a, C>
2557where
2558    C: 'a,
2559{
2560    hub: &'a CloudFunctions<C>,
2561    _name: String,
2562    _delegate: Option<&'a mut dyn common::Delegate>,
2563    _additional_params: HashMap<String, String>,
2564    _scopes: BTreeSet<String>,
2565}
2566
2567impl<'a, C> common::CallBuilder for ProjectLocationFunctionDeleteCall<'a, C> {}
2568
2569impl<'a, C> ProjectLocationFunctionDeleteCall<'a, C>
2570where
2571    C: common::Connector,
2572{
2573    /// Perform the operation you have build so far.
2574    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2575        use std::borrow::Cow;
2576        use std::io::{Read, Seek};
2577
2578        use common::{url::Params, ToParts};
2579        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2580
2581        let mut dd = common::DefaultDelegate;
2582        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2583        dlg.begin(common::MethodInfo {
2584            id: "cloudfunctions.projects.locations.functions.delete",
2585            http_method: hyper::Method::DELETE,
2586        });
2587
2588        for &field in ["alt", "name"].iter() {
2589            if self._additional_params.contains_key(field) {
2590                dlg.finished(false);
2591                return Err(common::Error::FieldClash(field));
2592            }
2593        }
2594
2595        let mut params = Params::with_capacity(3 + self._additional_params.len());
2596        params.push("name", self._name);
2597
2598        params.extend(self._additional_params.iter());
2599
2600        params.push("alt", "json");
2601        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2602        if self._scopes.is_empty() {
2603            self._scopes
2604                .insert(Scope::CloudPlatform.as_ref().to_string());
2605        }
2606
2607        #[allow(clippy::single_element_loop)]
2608        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2609            url = params.uri_replacement(url, param_name, find_this, true);
2610        }
2611        {
2612            let to_remove = ["name"];
2613            params.remove_params(&to_remove);
2614        }
2615
2616        let url = params.parse_with_url(&url);
2617
2618        loop {
2619            let token = match self
2620                .hub
2621                .auth
2622                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2623                .await
2624            {
2625                Ok(token) => token,
2626                Err(e) => match dlg.token(e) {
2627                    Ok(token) => token,
2628                    Err(e) => {
2629                        dlg.finished(false);
2630                        return Err(common::Error::MissingToken(e));
2631                    }
2632                },
2633            };
2634            let mut req_result = {
2635                let client = &self.hub.client;
2636                dlg.pre_request();
2637                let mut req_builder = hyper::Request::builder()
2638                    .method(hyper::Method::DELETE)
2639                    .uri(url.as_str())
2640                    .header(USER_AGENT, self.hub._user_agent.clone());
2641
2642                if let Some(token) = token.as_ref() {
2643                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2644                }
2645
2646                let request = req_builder
2647                    .header(CONTENT_LENGTH, 0_u64)
2648                    .body(common::to_body::<String>(None));
2649
2650                client.request(request.unwrap()).await
2651            };
2652
2653            match req_result {
2654                Err(err) => {
2655                    if let common::Retry::After(d) = dlg.http_error(&err) {
2656                        sleep(d).await;
2657                        continue;
2658                    }
2659                    dlg.finished(false);
2660                    return Err(common::Error::HttpError(err));
2661                }
2662                Ok(res) => {
2663                    let (mut parts, body) = res.into_parts();
2664                    let mut body = common::Body::new(body);
2665                    if !parts.status.is_success() {
2666                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2667                        let error = serde_json::from_str(&common::to_string(&bytes));
2668                        let response = common::to_response(parts, bytes.into());
2669
2670                        if let common::Retry::After(d) =
2671                            dlg.http_failure(&response, error.as_ref().ok())
2672                        {
2673                            sleep(d).await;
2674                            continue;
2675                        }
2676
2677                        dlg.finished(false);
2678
2679                        return Err(match error {
2680                            Ok(value) => common::Error::BadRequest(value),
2681                            _ => common::Error::Failure(response),
2682                        });
2683                    }
2684                    let response = {
2685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2686                        let encoded = common::to_string(&bytes);
2687                        match serde_json::from_str(&encoded) {
2688                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2689                            Err(error) => {
2690                                dlg.response_json_decode_error(&encoded, &error);
2691                                return Err(common::Error::JsonDecodeError(
2692                                    encoded.to_string(),
2693                                    error,
2694                                ));
2695                            }
2696                        }
2697                    };
2698
2699                    dlg.finished(true);
2700                    return Ok(response);
2701                }
2702            }
2703        }
2704    }
2705
2706    /// Required. The name of the function which should be deleted.
2707    ///
2708    /// Sets the *name* path property to the given value.
2709    ///
2710    /// Even though the property as already been set when instantiating this call,
2711    /// we provide this method for API completeness.
2712    pub fn name(mut self, new_value: &str) -> ProjectLocationFunctionDeleteCall<'a, C> {
2713        self._name = new_value.to_string();
2714        self
2715    }
2716    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2717    /// while executing the actual API request.
2718    ///
2719    /// ````text
2720    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2721    /// ````
2722    ///
2723    /// Sets the *delegate* property to the given value.
2724    pub fn delegate(
2725        mut self,
2726        new_value: &'a mut dyn common::Delegate,
2727    ) -> ProjectLocationFunctionDeleteCall<'a, C> {
2728        self._delegate = Some(new_value);
2729        self
2730    }
2731
2732    /// Set any additional parameter of the query string used in the request.
2733    /// It should be used to set parameters which are not yet available through their own
2734    /// setters.
2735    ///
2736    /// Please note that this method must not be used to set any of the known parameters
2737    /// which have their own setter method. If done anyway, the request will fail.
2738    ///
2739    /// # Additional Parameters
2740    ///
2741    /// * *$.xgafv* (query-string) - V1 error format.
2742    /// * *access_token* (query-string) - OAuth access token.
2743    /// * *alt* (query-string) - Data format for response.
2744    /// * *callback* (query-string) - JSONP
2745    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2746    /// * *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.
2747    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2748    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2749    /// * *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.
2750    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2751    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2752    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionDeleteCall<'a, C>
2753    where
2754        T: AsRef<str>,
2755    {
2756        self._additional_params
2757            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2758        self
2759    }
2760
2761    /// Identifies the authorization scope for the method you are building.
2762    ///
2763    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2764    /// [`Scope::CloudPlatform`].
2765    ///
2766    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2767    /// tokens for more than one scope.
2768    ///
2769    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2770    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2771    /// sufficient, a read-write scope will do as well.
2772    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionDeleteCall<'a, C>
2773    where
2774        St: AsRef<str>,
2775    {
2776        self._scopes.insert(String::from(scope.as_ref()));
2777        self
2778    }
2779    /// Identifies the authorization scope(s) for the method you are building.
2780    ///
2781    /// See [`Self::add_scope()`] for details.
2782    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionDeleteCall<'a, C>
2783    where
2784        I: IntoIterator<Item = St>,
2785        St: AsRef<str>,
2786    {
2787        self._scopes
2788            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2789        self
2790    }
2791
2792    /// Removes all scopes, and no default scope will be used either.
2793    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2794    /// for details).
2795    pub fn clear_scopes(mut self) -> ProjectLocationFunctionDeleteCall<'a, C> {
2796        self._scopes.clear();
2797        self
2798    }
2799}
2800
2801/// Returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls
2802///
2803/// A builder for the *locations.functions.generateDownloadUrl* method supported by a *project* resource.
2804/// It is not used directly, but through a [`ProjectMethods`] instance.
2805///
2806/// # Example
2807///
2808/// Instantiate a resource method builder
2809///
2810/// ```test_harness,no_run
2811/// # extern crate hyper;
2812/// # extern crate hyper_rustls;
2813/// # extern crate google_cloudfunctions1 as cloudfunctions1;
2814/// use cloudfunctions1::api::GenerateDownloadUrlRequest;
2815/// # async fn dox() {
2816/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2817///
2818/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2820/// #     secret,
2821/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2822/// # ).build().await.unwrap();
2823///
2824/// # let client = hyper_util::client::legacy::Client::builder(
2825/// #     hyper_util::rt::TokioExecutor::new()
2826/// # )
2827/// # .build(
2828/// #     hyper_rustls::HttpsConnectorBuilder::new()
2829/// #         .with_native_roots()
2830/// #         .unwrap()
2831/// #         .https_or_http()
2832/// #         .enable_http1()
2833/// #         .build()
2834/// # );
2835/// # let mut hub = CloudFunctions::new(client, auth);
2836/// // As the method needs a request, you would usually fill it with the desired information
2837/// // into the respective structure. Some of the parts shown here might not be applicable !
2838/// // Values shown here are possibly random and not representative !
2839/// let mut req = GenerateDownloadUrlRequest::default();
2840///
2841/// // You can configure optional parameters by calling the respective setters at will, and
2842/// // execute the final call using `doit()`.
2843/// // Values shown here are possibly random and not representative !
2844/// let result = hub.projects().locations_functions_generate_download_url(req, "name")
2845///              .doit().await;
2846/// # }
2847/// ```
2848pub struct ProjectLocationFunctionGenerateDownloadUrlCall<'a, C>
2849where
2850    C: 'a,
2851{
2852    hub: &'a CloudFunctions<C>,
2853    _request: GenerateDownloadUrlRequest,
2854    _name: String,
2855    _delegate: Option<&'a mut dyn common::Delegate>,
2856    _additional_params: HashMap<String, String>,
2857    _scopes: BTreeSet<String>,
2858}
2859
2860impl<'a, C> common::CallBuilder for ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {}
2861
2862impl<'a, C> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C>
2863where
2864    C: common::Connector,
2865{
2866    /// Perform the operation you have build so far.
2867    pub async fn doit(mut self) -> common::Result<(common::Response, GenerateDownloadUrlResponse)> {
2868        use std::borrow::Cow;
2869        use std::io::{Read, Seek};
2870
2871        use common::{url::Params, ToParts};
2872        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2873
2874        let mut dd = common::DefaultDelegate;
2875        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2876        dlg.begin(common::MethodInfo {
2877            id: "cloudfunctions.projects.locations.functions.generateDownloadUrl",
2878            http_method: hyper::Method::POST,
2879        });
2880
2881        for &field in ["alt", "name"].iter() {
2882            if self._additional_params.contains_key(field) {
2883                dlg.finished(false);
2884                return Err(common::Error::FieldClash(field));
2885            }
2886        }
2887
2888        let mut params = Params::with_capacity(4 + self._additional_params.len());
2889        params.push("name", self._name);
2890
2891        params.extend(self._additional_params.iter());
2892
2893        params.push("alt", "json");
2894        let mut url = self.hub._base_url.clone() + "v1/{+name}:generateDownloadUrl";
2895        if self._scopes.is_empty() {
2896            self._scopes
2897                .insert(Scope::CloudPlatform.as_ref().to_string());
2898        }
2899
2900        #[allow(clippy::single_element_loop)]
2901        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2902            url = params.uri_replacement(url, param_name, find_this, true);
2903        }
2904        {
2905            let to_remove = ["name"];
2906            params.remove_params(&to_remove);
2907        }
2908
2909        let url = params.parse_with_url(&url);
2910
2911        let mut json_mime_type = mime::APPLICATION_JSON;
2912        let mut request_value_reader = {
2913            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2914            common::remove_json_null_values(&mut value);
2915            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2916            serde_json::to_writer(&mut dst, &value).unwrap();
2917            dst
2918        };
2919        let request_size = request_value_reader
2920            .seek(std::io::SeekFrom::End(0))
2921            .unwrap();
2922        request_value_reader
2923            .seek(std::io::SeekFrom::Start(0))
2924            .unwrap();
2925
2926        loop {
2927            let token = match self
2928                .hub
2929                .auth
2930                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2931                .await
2932            {
2933                Ok(token) => token,
2934                Err(e) => match dlg.token(e) {
2935                    Ok(token) => token,
2936                    Err(e) => {
2937                        dlg.finished(false);
2938                        return Err(common::Error::MissingToken(e));
2939                    }
2940                },
2941            };
2942            request_value_reader
2943                .seek(std::io::SeekFrom::Start(0))
2944                .unwrap();
2945            let mut req_result = {
2946                let client = &self.hub.client;
2947                dlg.pre_request();
2948                let mut req_builder = hyper::Request::builder()
2949                    .method(hyper::Method::POST)
2950                    .uri(url.as_str())
2951                    .header(USER_AGENT, self.hub._user_agent.clone());
2952
2953                if let Some(token) = token.as_ref() {
2954                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2955                }
2956
2957                let request = req_builder
2958                    .header(CONTENT_TYPE, json_mime_type.to_string())
2959                    .header(CONTENT_LENGTH, request_size as u64)
2960                    .body(common::to_body(
2961                        request_value_reader.get_ref().clone().into(),
2962                    ));
2963
2964                client.request(request.unwrap()).await
2965            };
2966
2967            match req_result {
2968                Err(err) => {
2969                    if let common::Retry::After(d) = dlg.http_error(&err) {
2970                        sleep(d).await;
2971                        continue;
2972                    }
2973                    dlg.finished(false);
2974                    return Err(common::Error::HttpError(err));
2975                }
2976                Ok(res) => {
2977                    let (mut parts, body) = res.into_parts();
2978                    let mut body = common::Body::new(body);
2979                    if !parts.status.is_success() {
2980                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2981                        let error = serde_json::from_str(&common::to_string(&bytes));
2982                        let response = common::to_response(parts, bytes.into());
2983
2984                        if let common::Retry::After(d) =
2985                            dlg.http_failure(&response, error.as_ref().ok())
2986                        {
2987                            sleep(d).await;
2988                            continue;
2989                        }
2990
2991                        dlg.finished(false);
2992
2993                        return Err(match error {
2994                            Ok(value) => common::Error::BadRequest(value),
2995                            _ => common::Error::Failure(response),
2996                        });
2997                    }
2998                    let response = {
2999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3000                        let encoded = common::to_string(&bytes);
3001                        match serde_json::from_str(&encoded) {
3002                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3003                            Err(error) => {
3004                                dlg.response_json_decode_error(&encoded, &error);
3005                                return Err(common::Error::JsonDecodeError(
3006                                    encoded.to_string(),
3007                                    error,
3008                                ));
3009                            }
3010                        }
3011                    };
3012
3013                    dlg.finished(true);
3014                    return Ok(response);
3015                }
3016            }
3017        }
3018    }
3019
3020    ///
3021    /// Sets the *request* property to the given value.
3022    ///
3023    /// Even though the property as already been set when instantiating this call,
3024    /// we provide this method for API completeness.
3025    pub fn request(
3026        mut self,
3027        new_value: GenerateDownloadUrlRequest,
3028    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {
3029        self._request = new_value;
3030        self
3031    }
3032    /// The name of function for which source code Google Cloud Storage signed URL should be generated.
3033    ///
3034    /// Sets the *name* path property to the given value.
3035    ///
3036    /// Even though the property as already been set when instantiating this call,
3037    /// we provide this method for API completeness.
3038    pub fn name(
3039        mut self,
3040        new_value: &str,
3041    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {
3042        self._name = new_value.to_string();
3043        self
3044    }
3045    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3046    /// while executing the actual API request.
3047    ///
3048    /// ````text
3049    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3050    /// ````
3051    ///
3052    /// Sets the *delegate* property to the given value.
3053    pub fn delegate(
3054        mut self,
3055        new_value: &'a mut dyn common::Delegate,
3056    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {
3057        self._delegate = Some(new_value);
3058        self
3059    }
3060
3061    /// Set any additional parameter of the query string used in the request.
3062    /// It should be used to set parameters which are not yet available through their own
3063    /// setters.
3064    ///
3065    /// Please note that this method must not be used to set any of the known parameters
3066    /// which have their own setter method. If done anyway, the request will fail.
3067    ///
3068    /// # Additional Parameters
3069    ///
3070    /// * *$.xgafv* (query-string) - V1 error format.
3071    /// * *access_token* (query-string) - OAuth access token.
3072    /// * *alt* (query-string) - Data format for response.
3073    /// * *callback* (query-string) - JSONP
3074    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3075    /// * *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.
3076    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3077    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3078    /// * *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.
3079    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3080    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3081    pub fn param<T>(
3082        mut self,
3083        name: T,
3084        value: T,
3085    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C>
3086    where
3087        T: AsRef<str>,
3088    {
3089        self._additional_params
3090            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3091        self
3092    }
3093
3094    /// Identifies the authorization scope for the method you are building.
3095    ///
3096    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3097    /// [`Scope::CloudPlatform`].
3098    ///
3099    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3100    /// tokens for more than one scope.
3101    ///
3102    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3103    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3104    /// sufficient, a read-write scope will do as well.
3105    pub fn add_scope<St>(
3106        mut self,
3107        scope: St,
3108    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C>
3109    where
3110        St: AsRef<str>,
3111    {
3112        self._scopes.insert(String::from(scope.as_ref()));
3113        self
3114    }
3115    /// Identifies the authorization scope(s) for the method you are building.
3116    ///
3117    /// See [`Self::add_scope()`] for details.
3118    pub fn add_scopes<I, St>(
3119        mut self,
3120        scopes: I,
3121    ) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C>
3122    where
3123        I: IntoIterator<Item = St>,
3124        St: AsRef<str>,
3125    {
3126        self._scopes
3127            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3128        self
3129    }
3130
3131    /// Removes all scopes, and no default scope will be used either.
3132    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3133    /// for details).
3134    pub fn clear_scopes(mut self) -> ProjectLocationFunctionGenerateDownloadUrlCall<'a, C> {
3135        self._scopes.clear();
3136        self
3137    }
3138}
3139
3140/// Returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls. Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code. When uploading source code to the generated signed URL, please follow these restrictions: * Source file type should be a zip file. * Source file size should not exceed 100MB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * `content-type: application/zip` * `x-goog-content-length-range: 0,104857600` And this header SHOULD NOT be specified: * `Authorization: Bearer YOUR_TOKEN`
3141///
3142/// A builder for the *locations.functions.generateUploadUrl* method supported by a *project* resource.
3143/// It is not used directly, but through a [`ProjectMethods`] instance.
3144///
3145/// # Example
3146///
3147/// Instantiate a resource method builder
3148///
3149/// ```test_harness,no_run
3150/// # extern crate hyper;
3151/// # extern crate hyper_rustls;
3152/// # extern crate google_cloudfunctions1 as cloudfunctions1;
3153/// use cloudfunctions1::api::GenerateUploadUrlRequest;
3154/// # async fn dox() {
3155/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3156///
3157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3158/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3159/// #     secret,
3160/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3161/// # ).build().await.unwrap();
3162///
3163/// # let client = hyper_util::client::legacy::Client::builder(
3164/// #     hyper_util::rt::TokioExecutor::new()
3165/// # )
3166/// # .build(
3167/// #     hyper_rustls::HttpsConnectorBuilder::new()
3168/// #         .with_native_roots()
3169/// #         .unwrap()
3170/// #         .https_or_http()
3171/// #         .enable_http1()
3172/// #         .build()
3173/// # );
3174/// # let mut hub = CloudFunctions::new(client, auth);
3175/// // As the method needs a request, you would usually fill it with the desired information
3176/// // into the respective structure. Some of the parts shown here might not be applicable !
3177/// // Values shown here are possibly random and not representative !
3178/// let mut req = GenerateUploadUrlRequest::default();
3179///
3180/// // You can configure optional parameters by calling the respective setters at will, and
3181/// // execute the final call using `doit()`.
3182/// // Values shown here are possibly random and not representative !
3183/// let result = hub.projects().locations_functions_generate_upload_url(req, "parent")
3184///              .doit().await;
3185/// # }
3186/// ```
3187pub struct ProjectLocationFunctionGenerateUploadUrlCall<'a, C>
3188where
3189    C: 'a,
3190{
3191    hub: &'a CloudFunctions<C>,
3192    _request: GenerateUploadUrlRequest,
3193    _parent: String,
3194    _delegate: Option<&'a mut dyn common::Delegate>,
3195    _additional_params: HashMap<String, String>,
3196    _scopes: BTreeSet<String>,
3197}
3198
3199impl<'a, C> common::CallBuilder for ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {}
3200
3201impl<'a, C> ProjectLocationFunctionGenerateUploadUrlCall<'a, C>
3202where
3203    C: common::Connector,
3204{
3205    /// Perform the operation you have build so far.
3206    pub async fn doit(mut self) -> common::Result<(common::Response, GenerateUploadUrlResponse)> {
3207        use std::borrow::Cow;
3208        use std::io::{Read, Seek};
3209
3210        use common::{url::Params, ToParts};
3211        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3212
3213        let mut dd = common::DefaultDelegate;
3214        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3215        dlg.begin(common::MethodInfo {
3216            id: "cloudfunctions.projects.locations.functions.generateUploadUrl",
3217            http_method: hyper::Method::POST,
3218        });
3219
3220        for &field in ["alt", "parent"].iter() {
3221            if self._additional_params.contains_key(field) {
3222                dlg.finished(false);
3223                return Err(common::Error::FieldClash(field));
3224            }
3225        }
3226
3227        let mut params = Params::with_capacity(4 + self._additional_params.len());
3228        params.push("parent", self._parent);
3229
3230        params.extend(self._additional_params.iter());
3231
3232        params.push("alt", "json");
3233        let mut url = self.hub._base_url.clone() + "v1/{+parent}/functions:generateUploadUrl";
3234        if self._scopes.is_empty() {
3235            self._scopes
3236                .insert(Scope::CloudPlatform.as_ref().to_string());
3237        }
3238
3239        #[allow(clippy::single_element_loop)]
3240        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3241            url = params.uri_replacement(url, param_name, find_this, true);
3242        }
3243        {
3244            let to_remove = ["parent"];
3245            params.remove_params(&to_remove);
3246        }
3247
3248        let url = params.parse_with_url(&url);
3249
3250        let mut json_mime_type = mime::APPLICATION_JSON;
3251        let mut request_value_reader = {
3252            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3253            common::remove_json_null_values(&mut value);
3254            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3255            serde_json::to_writer(&mut dst, &value).unwrap();
3256            dst
3257        };
3258        let request_size = request_value_reader
3259            .seek(std::io::SeekFrom::End(0))
3260            .unwrap();
3261        request_value_reader
3262            .seek(std::io::SeekFrom::Start(0))
3263            .unwrap();
3264
3265        loop {
3266            let token = match self
3267                .hub
3268                .auth
3269                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3270                .await
3271            {
3272                Ok(token) => token,
3273                Err(e) => match dlg.token(e) {
3274                    Ok(token) => token,
3275                    Err(e) => {
3276                        dlg.finished(false);
3277                        return Err(common::Error::MissingToken(e));
3278                    }
3279                },
3280            };
3281            request_value_reader
3282                .seek(std::io::SeekFrom::Start(0))
3283                .unwrap();
3284            let mut req_result = {
3285                let client = &self.hub.client;
3286                dlg.pre_request();
3287                let mut req_builder = hyper::Request::builder()
3288                    .method(hyper::Method::POST)
3289                    .uri(url.as_str())
3290                    .header(USER_AGENT, self.hub._user_agent.clone());
3291
3292                if let Some(token) = token.as_ref() {
3293                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3294                }
3295
3296                let request = req_builder
3297                    .header(CONTENT_TYPE, json_mime_type.to_string())
3298                    .header(CONTENT_LENGTH, request_size as u64)
3299                    .body(common::to_body(
3300                        request_value_reader.get_ref().clone().into(),
3301                    ));
3302
3303                client.request(request.unwrap()).await
3304            };
3305
3306            match req_result {
3307                Err(err) => {
3308                    if let common::Retry::After(d) = dlg.http_error(&err) {
3309                        sleep(d).await;
3310                        continue;
3311                    }
3312                    dlg.finished(false);
3313                    return Err(common::Error::HttpError(err));
3314                }
3315                Ok(res) => {
3316                    let (mut parts, body) = res.into_parts();
3317                    let mut body = common::Body::new(body);
3318                    if !parts.status.is_success() {
3319                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3320                        let error = serde_json::from_str(&common::to_string(&bytes));
3321                        let response = common::to_response(parts, bytes.into());
3322
3323                        if let common::Retry::After(d) =
3324                            dlg.http_failure(&response, error.as_ref().ok())
3325                        {
3326                            sleep(d).await;
3327                            continue;
3328                        }
3329
3330                        dlg.finished(false);
3331
3332                        return Err(match error {
3333                            Ok(value) => common::Error::BadRequest(value),
3334                            _ => common::Error::Failure(response),
3335                        });
3336                    }
3337                    let response = {
3338                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3339                        let encoded = common::to_string(&bytes);
3340                        match serde_json::from_str(&encoded) {
3341                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3342                            Err(error) => {
3343                                dlg.response_json_decode_error(&encoded, &error);
3344                                return Err(common::Error::JsonDecodeError(
3345                                    encoded.to_string(),
3346                                    error,
3347                                ));
3348                            }
3349                        }
3350                    };
3351
3352                    dlg.finished(true);
3353                    return Ok(response);
3354                }
3355            }
3356        }
3357    }
3358
3359    ///
3360    /// Sets the *request* property to the given value.
3361    ///
3362    /// Even though the property as already been set when instantiating this call,
3363    /// we provide this method for API completeness.
3364    pub fn request(
3365        mut self,
3366        new_value: GenerateUploadUrlRequest,
3367    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {
3368        self._request = new_value;
3369        self
3370    }
3371    /// The project and location in which the Google Cloud Storage signed URL should be generated, specified in the format `projects/*/locations/*`.
3372    ///
3373    /// Sets the *parent* path property to the given value.
3374    ///
3375    /// Even though the property as already been set when instantiating this call,
3376    /// we provide this method for API completeness.
3377    pub fn parent(
3378        mut self,
3379        new_value: &str,
3380    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {
3381        self._parent = new_value.to_string();
3382        self
3383    }
3384    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3385    /// while executing the actual API request.
3386    ///
3387    /// ````text
3388    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3389    /// ````
3390    ///
3391    /// Sets the *delegate* property to the given value.
3392    pub fn delegate(
3393        mut self,
3394        new_value: &'a mut dyn common::Delegate,
3395    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {
3396        self._delegate = Some(new_value);
3397        self
3398    }
3399
3400    /// Set any additional parameter of the query string used in the request.
3401    /// It should be used to set parameters which are not yet available through their own
3402    /// setters.
3403    ///
3404    /// Please note that this method must not be used to set any of the known parameters
3405    /// which have their own setter method. If done anyway, the request will fail.
3406    ///
3407    /// # Additional Parameters
3408    ///
3409    /// * *$.xgafv* (query-string) - V1 error format.
3410    /// * *access_token* (query-string) - OAuth access token.
3411    /// * *alt* (query-string) - Data format for response.
3412    /// * *callback* (query-string) - JSONP
3413    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3414    /// * *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.
3415    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3416    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3417    /// * *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.
3418    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3419    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3420    pub fn param<T>(
3421        mut self,
3422        name: T,
3423        value: T,
3424    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C>
3425    where
3426        T: AsRef<str>,
3427    {
3428        self._additional_params
3429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3430        self
3431    }
3432
3433    /// Identifies the authorization scope for the method you are building.
3434    ///
3435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3436    /// [`Scope::CloudPlatform`].
3437    ///
3438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3439    /// tokens for more than one scope.
3440    ///
3441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3443    /// sufficient, a read-write scope will do as well.
3444    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C>
3445    where
3446        St: AsRef<str>,
3447    {
3448        self._scopes.insert(String::from(scope.as_ref()));
3449        self
3450    }
3451    /// Identifies the authorization scope(s) for the method you are building.
3452    ///
3453    /// See [`Self::add_scope()`] for details.
3454    pub fn add_scopes<I, St>(
3455        mut self,
3456        scopes: I,
3457    ) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C>
3458    where
3459        I: IntoIterator<Item = St>,
3460        St: AsRef<str>,
3461    {
3462        self._scopes
3463            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3464        self
3465    }
3466
3467    /// Removes all scopes, and no default scope will be used either.
3468    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3469    /// for details).
3470    pub fn clear_scopes(mut self) -> ProjectLocationFunctionGenerateUploadUrlCall<'a, C> {
3471        self._scopes.clear();
3472        self
3473    }
3474}
3475
3476/// Returns a function with the given name from the requested project.
3477///
3478/// A builder for the *locations.functions.get* method supported by a *project* resource.
3479/// It is not used directly, but through a [`ProjectMethods`] instance.
3480///
3481/// # Example
3482///
3483/// Instantiate a resource method builder
3484///
3485/// ```test_harness,no_run
3486/// # extern crate hyper;
3487/// # extern crate hyper_rustls;
3488/// # extern crate google_cloudfunctions1 as cloudfunctions1;
3489/// # async fn dox() {
3490/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3491///
3492/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3493/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3494/// #     secret,
3495/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3496/// # ).build().await.unwrap();
3497///
3498/// # let client = hyper_util::client::legacy::Client::builder(
3499/// #     hyper_util::rt::TokioExecutor::new()
3500/// # )
3501/// # .build(
3502/// #     hyper_rustls::HttpsConnectorBuilder::new()
3503/// #         .with_native_roots()
3504/// #         .unwrap()
3505/// #         .https_or_http()
3506/// #         .enable_http1()
3507/// #         .build()
3508/// # );
3509/// # let mut hub = CloudFunctions::new(client, auth);
3510/// // You can configure optional parameters by calling the respective setters at will, and
3511/// // execute the final call using `doit()`.
3512/// // Values shown here are possibly random and not representative !
3513/// let result = hub.projects().locations_functions_get("name")
3514///              .version_id(-50)
3515///              .doit().await;
3516/// # }
3517/// ```
3518pub struct ProjectLocationFunctionGetCall<'a, C>
3519where
3520    C: 'a,
3521{
3522    hub: &'a CloudFunctions<C>,
3523    _name: String,
3524    _version_id: Option<i64>,
3525    _delegate: Option<&'a mut dyn common::Delegate>,
3526    _additional_params: HashMap<String, String>,
3527    _scopes: BTreeSet<String>,
3528}
3529
3530impl<'a, C> common::CallBuilder for ProjectLocationFunctionGetCall<'a, C> {}
3531
3532impl<'a, C> ProjectLocationFunctionGetCall<'a, C>
3533where
3534    C: common::Connector,
3535{
3536    /// Perform the operation you have build so far.
3537    pub async fn doit(mut self) -> common::Result<(common::Response, CloudFunction)> {
3538        use std::borrow::Cow;
3539        use std::io::{Read, Seek};
3540
3541        use common::{url::Params, ToParts};
3542        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3543
3544        let mut dd = common::DefaultDelegate;
3545        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3546        dlg.begin(common::MethodInfo {
3547            id: "cloudfunctions.projects.locations.functions.get",
3548            http_method: hyper::Method::GET,
3549        });
3550
3551        for &field in ["alt", "name", "versionId"].iter() {
3552            if self._additional_params.contains_key(field) {
3553                dlg.finished(false);
3554                return Err(common::Error::FieldClash(field));
3555            }
3556        }
3557
3558        let mut params = Params::with_capacity(4 + self._additional_params.len());
3559        params.push("name", self._name);
3560        if let Some(value) = self._version_id.as_ref() {
3561            params.push("versionId", value.to_string());
3562        }
3563
3564        params.extend(self._additional_params.iter());
3565
3566        params.push("alt", "json");
3567        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3568        if self._scopes.is_empty() {
3569            self._scopes
3570                .insert(Scope::CloudPlatform.as_ref().to_string());
3571        }
3572
3573        #[allow(clippy::single_element_loop)]
3574        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3575            url = params.uri_replacement(url, param_name, find_this, true);
3576        }
3577        {
3578            let to_remove = ["name"];
3579            params.remove_params(&to_remove);
3580        }
3581
3582        let url = params.parse_with_url(&url);
3583
3584        loop {
3585            let token = match self
3586                .hub
3587                .auth
3588                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3589                .await
3590            {
3591                Ok(token) => token,
3592                Err(e) => match dlg.token(e) {
3593                    Ok(token) => token,
3594                    Err(e) => {
3595                        dlg.finished(false);
3596                        return Err(common::Error::MissingToken(e));
3597                    }
3598                },
3599            };
3600            let mut req_result = {
3601                let client = &self.hub.client;
3602                dlg.pre_request();
3603                let mut req_builder = hyper::Request::builder()
3604                    .method(hyper::Method::GET)
3605                    .uri(url.as_str())
3606                    .header(USER_AGENT, self.hub._user_agent.clone());
3607
3608                if let Some(token) = token.as_ref() {
3609                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3610                }
3611
3612                let request = req_builder
3613                    .header(CONTENT_LENGTH, 0_u64)
3614                    .body(common::to_body::<String>(None));
3615
3616                client.request(request.unwrap()).await
3617            };
3618
3619            match req_result {
3620                Err(err) => {
3621                    if let common::Retry::After(d) = dlg.http_error(&err) {
3622                        sleep(d).await;
3623                        continue;
3624                    }
3625                    dlg.finished(false);
3626                    return Err(common::Error::HttpError(err));
3627                }
3628                Ok(res) => {
3629                    let (mut parts, body) = res.into_parts();
3630                    let mut body = common::Body::new(body);
3631                    if !parts.status.is_success() {
3632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3633                        let error = serde_json::from_str(&common::to_string(&bytes));
3634                        let response = common::to_response(parts, bytes.into());
3635
3636                        if let common::Retry::After(d) =
3637                            dlg.http_failure(&response, error.as_ref().ok())
3638                        {
3639                            sleep(d).await;
3640                            continue;
3641                        }
3642
3643                        dlg.finished(false);
3644
3645                        return Err(match error {
3646                            Ok(value) => common::Error::BadRequest(value),
3647                            _ => common::Error::Failure(response),
3648                        });
3649                    }
3650                    let response = {
3651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3652                        let encoded = common::to_string(&bytes);
3653                        match serde_json::from_str(&encoded) {
3654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3655                            Err(error) => {
3656                                dlg.response_json_decode_error(&encoded, &error);
3657                                return Err(common::Error::JsonDecodeError(
3658                                    encoded.to_string(),
3659                                    error,
3660                                ));
3661                            }
3662                        }
3663                    };
3664
3665                    dlg.finished(true);
3666                    return Ok(response);
3667                }
3668            }
3669        }
3670    }
3671
3672    /// Required. The name of the function which details should be obtained.
3673    ///
3674    /// Sets the *name* path property to the given value.
3675    ///
3676    /// Even though the property as already been set when instantiating this call,
3677    /// we provide this method for API completeness.
3678    pub fn name(mut self, new_value: &str) -> ProjectLocationFunctionGetCall<'a, C> {
3679        self._name = new_value.to_string();
3680        self
3681    }
3682    /// Optional. The optional version of the function whose details should be obtained. The version of a 1st Gen function is an integer that starts from 1 and gets incremented on redeployments. Each deployment creates a config version of the underlying function. GCF may keep historical configs for old versions. This field can be specified to fetch the historical configs. Leave it blank or set to 0 to get the latest version of the function.
3683    ///
3684    /// Sets the *version id* query property to the given value.
3685    pub fn version_id(mut self, new_value: i64) -> ProjectLocationFunctionGetCall<'a, C> {
3686        self._version_id = Some(new_value);
3687        self
3688    }
3689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3690    /// while executing the actual API request.
3691    ///
3692    /// ````text
3693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3694    /// ````
3695    ///
3696    /// Sets the *delegate* property to the given value.
3697    pub fn delegate(
3698        mut self,
3699        new_value: &'a mut dyn common::Delegate,
3700    ) -> ProjectLocationFunctionGetCall<'a, C> {
3701        self._delegate = Some(new_value);
3702        self
3703    }
3704
3705    /// Set any additional parameter of the query string used in the request.
3706    /// It should be used to set parameters which are not yet available through their own
3707    /// setters.
3708    ///
3709    /// Please note that this method must not be used to set any of the known parameters
3710    /// which have their own setter method. If done anyway, the request will fail.
3711    ///
3712    /// # Additional Parameters
3713    ///
3714    /// * *$.xgafv* (query-string) - V1 error format.
3715    /// * *access_token* (query-string) - OAuth access token.
3716    /// * *alt* (query-string) - Data format for response.
3717    /// * *callback* (query-string) - JSONP
3718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3719    /// * *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.
3720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3722    /// * *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.
3723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3725    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionGetCall<'a, C>
3726    where
3727        T: AsRef<str>,
3728    {
3729        self._additional_params
3730            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3731        self
3732    }
3733
3734    /// Identifies the authorization scope for the method you are building.
3735    ///
3736    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3737    /// [`Scope::CloudPlatform`].
3738    ///
3739    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3740    /// tokens for more than one scope.
3741    ///
3742    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3743    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3744    /// sufficient, a read-write scope will do as well.
3745    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionGetCall<'a, C>
3746    where
3747        St: AsRef<str>,
3748    {
3749        self._scopes.insert(String::from(scope.as_ref()));
3750        self
3751    }
3752    /// Identifies the authorization scope(s) for the method you are building.
3753    ///
3754    /// See [`Self::add_scope()`] for details.
3755    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionGetCall<'a, C>
3756    where
3757        I: IntoIterator<Item = St>,
3758        St: AsRef<str>,
3759    {
3760        self._scopes
3761            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3762        self
3763    }
3764
3765    /// Removes all scopes, and no default scope will be used either.
3766    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3767    /// for details).
3768    pub fn clear_scopes(mut self) -> ProjectLocationFunctionGetCall<'a, C> {
3769        self._scopes.clear();
3770        self
3771    }
3772}
3773
3774/// Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
3775///
3776/// A builder for the *locations.functions.getIamPolicy* method supported by a *project* resource.
3777/// It is not used directly, but through a [`ProjectMethods`] instance.
3778///
3779/// # Example
3780///
3781/// Instantiate a resource method builder
3782///
3783/// ```test_harness,no_run
3784/// # extern crate hyper;
3785/// # extern crate hyper_rustls;
3786/// # extern crate google_cloudfunctions1 as cloudfunctions1;
3787/// # async fn dox() {
3788/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3789///
3790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3791/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3792/// #     secret,
3793/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3794/// # ).build().await.unwrap();
3795///
3796/// # let client = hyper_util::client::legacy::Client::builder(
3797/// #     hyper_util::rt::TokioExecutor::new()
3798/// # )
3799/// # .build(
3800/// #     hyper_rustls::HttpsConnectorBuilder::new()
3801/// #         .with_native_roots()
3802/// #         .unwrap()
3803/// #         .https_or_http()
3804/// #         .enable_http1()
3805/// #         .build()
3806/// # );
3807/// # let mut hub = CloudFunctions::new(client, auth);
3808/// // You can configure optional parameters by calling the respective setters at will, and
3809/// // execute the final call using `doit()`.
3810/// // Values shown here are possibly random and not representative !
3811/// let result = hub.projects().locations_functions_get_iam_policy("resource")
3812///              .options_requested_policy_version(-37)
3813///              .doit().await;
3814/// # }
3815/// ```
3816pub struct ProjectLocationFunctionGetIamPolicyCall<'a, C>
3817where
3818    C: 'a,
3819{
3820    hub: &'a CloudFunctions<C>,
3821    _resource: String,
3822    _options_requested_policy_version: Option<i32>,
3823    _delegate: Option<&'a mut dyn common::Delegate>,
3824    _additional_params: HashMap<String, String>,
3825    _scopes: BTreeSet<String>,
3826}
3827
3828impl<'a, C> common::CallBuilder for ProjectLocationFunctionGetIamPolicyCall<'a, C> {}
3829
3830impl<'a, C> ProjectLocationFunctionGetIamPolicyCall<'a, C>
3831where
3832    C: common::Connector,
3833{
3834    /// Perform the operation you have build so far.
3835    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3836        use std::borrow::Cow;
3837        use std::io::{Read, Seek};
3838
3839        use common::{url::Params, ToParts};
3840        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3841
3842        let mut dd = common::DefaultDelegate;
3843        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3844        dlg.begin(common::MethodInfo {
3845            id: "cloudfunctions.projects.locations.functions.getIamPolicy",
3846            http_method: hyper::Method::GET,
3847        });
3848
3849        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3850            if self._additional_params.contains_key(field) {
3851                dlg.finished(false);
3852                return Err(common::Error::FieldClash(field));
3853            }
3854        }
3855
3856        let mut params = Params::with_capacity(4 + self._additional_params.len());
3857        params.push("resource", self._resource);
3858        if let Some(value) = self._options_requested_policy_version.as_ref() {
3859            params.push("options.requestedPolicyVersion", value.to_string());
3860        }
3861
3862        params.extend(self._additional_params.iter());
3863
3864        params.push("alt", "json");
3865        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
3866        if self._scopes.is_empty() {
3867            self._scopes
3868                .insert(Scope::CloudPlatform.as_ref().to_string());
3869        }
3870
3871        #[allow(clippy::single_element_loop)]
3872        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3873            url = params.uri_replacement(url, param_name, find_this, true);
3874        }
3875        {
3876            let to_remove = ["resource"];
3877            params.remove_params(&to_remove);
3878        }
3879
3880        let url = params.parse_with_url(&url);
3881
3882        loop {
3883            let token = match self
3884                .hub
3885                .auth
3886                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3887                .await
3888            {
3889                Ok(token) => token,
3890                Err(e) => match dlg.token(e) {
3891                    Ok(token) => token,
3892                    Err(e) => {
3893                        dlg.finished(false);
3894                        return Err(common::Error::MissingToken(e));
3895                    }
3896                },
3897            };
3898            let mut req_result = {
3899                let client = &self.hub.client;
3900                dlg.pre_request();
3901                let mut req_builder = hyper::Request::builder()
3902                    .method(hyper::Method::GET)
3903                    .uri(url.as_str())
3904                    .header(USER_AGENT, self.hub._user_agent.clone());
3905
3906                if let Some(token) = token.as_ref() {
3907                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3908                }
3909
3910                let request = req_builder
3911                    .header(CONTENT_LENGTH, 0_u64)
3912                    .body(common::to_body::<String>(None));
3913
3914                client.request(request.unwrap()).await
3915            };
3916
3917            match req_result {
3918                Err(err) => {
3919                    if let common::Retry::After(d) = dlg.http_error(&err) {
3920                        sleep(d).await;
3921                        continue;
3922                    }
3923                    dlg.finished(false);
3924                    return Err(common::Error::HttpError(err));
3925                }
3926                Ok(res) => {
3927                    let (mut parts, body) = res.into_parts();
3928                    let mut body = common::Body::new(body);
3929                    if !parts.status.is_success() {
3930                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3931                        let error = serde_json::from_str(&common::to_string(&bytes));
3932                        let response = common::to_response(parts, bytes.into());
3933
3934                        if let common::Retry::After(d) =
3935                            dlg.http_failure(&response, error.as_ref().ok())
3936                        {
3937                            sleep(d).await;
3938                            continue;
3939                        }
3940
3941                        dlg.finished(false);
3942
3943                        return Err(match error {
3944                            Ok(value) => common::Error::BadRequest(value),
3945                            _ => common::Error::Failure(response),
3946                        });
3947                    }
3948                    let response = {
3949                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3950                        let encoded = common::to_string(&bytes);
3951                        match serde_json::from_str(&encoded) {
3952                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3953                            Err(error) => {
3954                                dlg.response_json_decode_error(&encoded, &error);
3955                                return Err(common::Error::JsonDecodeError(
3956                                    encoded.to_string(),
3957                                    error,
3958                                ));
3959                            }
3960                        }
3961                    };
3962
3963                    dlg.finished(true);
3964                    return Ok(response);
3965                }
3966            }
3967        }
3968    }
3969
3970    /// 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.
3971    ///
3972    /// Sets the *resource* path property to the given value.
3973    ///
3974    /// Even though the property as already been set when instantiating this call,
3975    /// we provide this method for API completeness.
3976    pub fn resource(mut self, new_value: &str) -> ProjectLocationFunctionGetIamPolicyCall<'a, C> {
3977        self._resource = new_value.to_string();
3978        self
3979    }
3980    /// 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).
3981    ///
3982    /// Sets the *options.requested policy version* query property to the given value.
3983    pub fn options_requested_policy_version(
3984        mut self,
3985        new_value: i32,
3986    ) -> ProjectLocationFunctionGetIamPolicyCall<'a, C> {
3987        self._options_requested_policy_version = Some(new_value);
3988        self
3989    }
3990    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3991    /// while executing the actual API request.
3992    ///
3993    /// ````text
3994    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3995    /// ````
3996    ///
3997    /// Sets the *delegate* property to the given value.
3998    pub fn delegate(
3999        mut self,
4000        new_value: &'a mut dyn common::Delegate,
4001    ) -> ProjectLocationFunctionGetIamPolicyCall<'a, C> {
4002        self._delegate = Some(new_value);
4003        self
4004    }
4005
4006    /// Set any additional parameter of the query string used in the request.
4007    /// It should be used to set parameters which are not yet available through their own
4008    /// setters.
4009    ///
4010    /// Please note that this method must not be used to set any of the known parameters
4011    /// which have their own setter method. If done anyway, the request will fail.
4012    ///
4013    /// # Additional Parameters
4014    ///
4015    /// * *$.xgafv* (query-string) - V1 error format.
4016    /// * *access_token* (query-string) - OAuth access token.
4017    /// * *alt* (query-string) - Data format for response.
4018    /// * *callback* (query-string) - JSONP
4019    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4020    /// * *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.
4021    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4022    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4023    /// * *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.
4024    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4025    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4026    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionGetIamPolicyCall<'a, C>
4027    where
4028        T: AsRef<str>,
4029    {
4030        self._additional_params
4031            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4032        self
4033    }
4034
4035    /// Identifies the authorization scope for the method you are building.
4036    ///
4037    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4038    /// [`Scope::CloudPlatform`].
4039    ///
4040    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4041    /// tokens for more than one scope.
4042    ///
4043    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4044    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4045    /// sufficient, a read-write scope will do as well.
4046    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionGetIamPolicyCall<'a, C>
4047    where
4048        St: AsRef<str>,
4049    {
4050        self._scopes.insert(String::from(scope.as_ref()));
4051        self
4052    }
4053    /// Identifies the authorization scope(s) for the method you are building.
4054    ///
4055    /// See [`Self::add_scope()`] for details.
4056    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionGetIamPolicyCall<'a, C>
4057    where
4058        I: IntoIterator<Item = St>,
4059        St: AsRef<str>,
4060    {
4061        self._scopes
4062            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4063        self
4064    }
4065
4066    /// Removes all scopes, and no default scope will be used either.
4067    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4068    /// for details).
4069    pub fn clear_scopes(mut self) -> ProjectLocationFunctionGetIamPolicyCall<'a, C> {
4070        self._scopes.clear();
4071        self
4072    }
4073}
4074
4075/// Returns a list of functions that belong to the requested project.
4076///
4077/// A builder for the *locations.functions.list* method supported by a *project* resource.
4078/// It is not used directly, but through a [`ProjectMethods`] instance.
4079///
4080/// # Example
4081///
4082/// Instantiate a resource method builder
4083///
4084/// ```test_harness,no_run
4085/// # extern crate hyper;
4086/// # extern crate hyper_rustls;
4087/// # extern crate google_cloudfunctions1 as cloudfunctions1;
4088/// # async fn dox() {
4089/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4090///
4091/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4092/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4093/// #     secret,
4094/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4095/// # ).build().await.unwrap();
4096///
4097/// # let client = hyper_util::client::legacy::Client::builder(
4098/// #     hyper_util::rt::TokioExecutor::new()
4099/// # )
4100/// # .build(
4101/// #     hyper_rustls::HttpsConnectorBuilder::new()
4102/// #         .with_native_roots()
4103/// #         .unwrap()
4104/// #         .https_or_http()
4105/// #         .enable_http1()
4106/// #         .build()
4107/// # );
4108/// # let mut hub = CloudFunctions::new(client, auth);
4109/// // You can configure optional parameters by calling the respective setters at will, and
4110/// // execute the final call using `doit()`.
4111/// // Values shown here are possibly random and not representative !
4112/// let result = hub.projects().locations_functions_list("parent")
4113///              .page_token("rebum.")
4114///              .page_size(-57)
4115///              .doit().await;
4116/// # }
4117/// ```
4118pub struct ProjectLocationFunctionListCall<'a, C>
4119where
4120    C: 'a,
4121{
4122    hub: &'a CloudFunctions<C>,
4123    _parent: String,
4124    _page_token: Option<String>,
4125    _page_size: Option<i32>,
4126    _delegate: Option<&'a mut dyn common::Delegate>,
4127    _additional_params: HashMap<String, String>,
4128    _scopes: BTreeSet<String>,
4129}
4130
4131impl<'a, C> common::CallBuilder for ProjectLocationFunctionListCall<'a, C> {}
4132
4133impl<'a, C> ProjectLocationFunctionListCall<'a, C>
4134where
4135    C: common::Connector,
4136{
4137    /// Perform the operation you have build so far.
4138    pub async fn doit(mut self) -> common::Result<(common::Response, ListFunctionsResponse)> {
4139        use std::borrow::Cow;
4140        use std::io::{Read, Seek};
4141
4142        use common::{url::Params, ToParts};
4143        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4144
4145        let mut dd = common::DefaultDelegate;
4146        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4147        dlg.begin(common::MethodInfo {
4148            id: "cloudfunctions.projects.locations.functions.list",
4149            http_method: hyper::Method::GET,
4150        });
4151
4152        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4153            if self._additional_params.contains_key(field) {
4154                dlg.finished(false);
4155                return Err(common::Error::FieldClash(field));
4156            }
4157        }
4158
4159        let mut params = Params::with_capacity(5 + self._additional_params.len());
4160        params.push("parent", self._parent);
4161        if let Some(value) = self._page_token.as_ref() {
4162            params.push("pageToken", value);
4163        }
4164        if let Some(value) = self._page_size.as_ref() {
4165            params.push("pageSize", value.to_string());
4166        }
4167
4168        params.extend(self._additional_params.iter());
4169
4170        params.push("alt", "json");
4171        let mut url = self.hub._base_url.clone() + "v1/{+parent}/functions";
4172        if self._scopes.is_empty() {
4173            self._scopes
4174                .insert(Scope::CloudPlatform.as_ref().to_string());
4175        }
4176
4177        #[allow(clippy::single_element_loop)]
4178        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4179            url = params.uri_replacement(url, param_name, find_this, true);
4180        }
4181        {
4182            let to_remove = ["parent"];
4183            params.remove_params(&to_remove);
4184        }
4185
4186        let url = params.parse_with_url(&url);
4187
4188        loop {
4189            let token = match self
4190                .hub
4191                .auth
4192                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4193                .await
4194            {
4195                Ok(token) => token,
4196                Err(e) => match dlg.token(e) {
4197                    Ok(token) => token,
4198                    Err(e) => {
4199                        dlg.finished(false);
4200                        return Err(common::Error::MissingToken(e));
4201                    }
4202                },
4203            };
4204            let mut req_result = {
4205                let client = &self.hub.client;
4206                dlg.pre_request();
4207                let mut req_builder = hyper::Request::builder()
4208                    .method(hyper::Method::GET)
4209                    .uri(url.as_str())
4210                    .header(USER_AGENT, self.hub._user_agent.clone());
4211
4212                if let Some(token) = token.as_ref() {
4213                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4214                }
4215
4216                let request = req_builder
4217                    .header(CONTENT_LENGTH, 0_u64)
4218                    .body(common::to_body::<String>(None));
4219
4220                client.request(request.unwrap()).await
4221            };
4222
4223            match req_result {
4224                Err(err) => {
4225                    if let common::Retry::After(d) = dlg.http_error(&err) {
4226                        sleep(d).await;
4227                        continue;
4228                    }
4229                    dlg.finished(false);
4230                    return Err(common::Error::HttpError(err));
4231                }
4232                Ok(res) => {
4233                    let (mut parts, body) = res.into_parts();
4234                    let mut body = common::Body::new(body);
4235                    if !parts.status.is_success() {
4236                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4237                        let error = serde_json::from_str(&common::to_string(&bytes));
4238                        let response = common::to_response(parts, bytes.into());
4239
4240                        if let common::Retry::After(d) =
4241                            dlg.http_failure(&response, error.as_ref().ok())
4242                        {
4243                            sleep(d).await;
4244                            continue;
4245                        }
4246
4247                        dlg.finished(false);
4248
4249                        return Err(match error {
4250                            Ok(value) => common::Error::BadRequest(value),
4251                            _ => common::Error::Failure(response),
4252                        });
4253                    }
4254                    let response = {
4255                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4256                        let encoded = common::to_string(&bytes);
4257                        match serde_json::from_str(&encoded) {
4258                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4259                            Err(error) => {
4260                                dlg.response_json_decode_error(&encoded, &error);
4261                                return Err(common::Error::JsonDecodeError(
4262                                    encoded.to_string(),
4263                                    error,
4264                                ));
4265                            }
4266                        }
4267                    };
4268
4269                    dlg.finished(true);
4270                    return Ok(response);
4271                }
4272            }
4273        }
4274    }
4275
4276    /// The project and location from which the function should be listed, specified in the format `projects/*/locations/*` If you want to list functions in all locations, use "-" in place of a location. When listing functions in all locations, if one or more location(s) are unreachable, the response will contain functions from all reachable locations along with the names of any unreachable locations.
4277    ///
4278    /// Sets the *parent* path property to the given value.
4279    ///
4280    /// Even though the property as already been set when instantiating this call,
4281    /// we provide this method for API completeness.
4282    pub fn parent(mut self, new_value: &str) -> ProjectLocationFunctionListCall<'a, C> {
4283        self._parent = new_value.to_string();
4284        self
4285    }
4286    /// The value returned by the last `ListFunctionsResponse`; indicates that this is a continuation of a prior `ListFunctions` call, and that the system should return the next page of data.
4287    ///
4288    /// Sets the *page token* query property to the given value.
4289    pub fn page_token(mut self, new_value: &str) -> ProjectLocationFunctionListCall<'a, C> {
4290        self._page_token = Some(new_value.to_string());
4291        self
4292    }
4293    /// Maximum number of functions to return per call.
4294    ///
4295    /// Sets the *page size* query property to the given value.
4296    pub fn page_size(mut self, new_value: i32) -> ProjectLocationFunctionListCall<'a, C> {
4297        self._page_size = Some(new_value);
4298        self
4299    }
4300    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4301    /// while executing the actual API request.
4302    ///
4303    /// ````text
4304    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4305    /// ````
4306    ///
4307    /// Sets the *delegate* property to the given value.
4308    pub fn delegate(
4309        mut self,
4310        new_value: &'a mut dyn common::Delegate,
4311    ) -> ProjectLocationFunctionListCall<'a, C> {
4312        self._delegate = Some(new_value);
4313        self
4314    }
4315
4316    /// Set any additional parameter of the query string used in the request.
4317    /// It should be used to set parameters which are not yet available through their own
4318    /// setters.
4319    ///
4320    /// Please note that this method must not be used to set any of the known parameters
4321    /// which have their own setter method. If done anyway, the request will fail.
4322    ///
4323    /// # Additional Parameters
4324    ///
4325    /// * *$.xgafv* (query-string) - V1 error format.
4326    /// * *access_token* (query-string) - OAuth access token.
4327    /// * *alt* (query-string) - Data format for response.
4328    /// * *callback* (query-string) - JSONP
4329    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4330    /// * *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.
4331    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4332    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4333    /// * *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.
4334    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4335    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4336    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionListCall<'a, C>
4337    where
4338        T: AsRef<str>,
4339    {
4340        self._additional_params
4341            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4342        self
4343    }
4344
4345    /// Identifies the authorization scope for the method you are building.
4346    ///
4347    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4348    /// [`Scope::CloudPlatform`].
4349    ///
4350    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4351    /// tokens for more than one scope.
4352    ///
4353    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4354    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4355    /// sufficient, a read-write scope will do as well.
4356    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionListCall<'a, C>
4357    where
4358        St: AsRef<str>,
4359    {
4360        self._scopes.insert(String::from(scope.as_ref()));
4361        self
4362    }
4363    /// Identifies the authorization scope(s) for the method you are building.
4364    ///
4365    /// See [`Self::add_scope()`] for details.
4366    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionListCall<'a, C>
4367    where
4368        I: IntoIterator<Item = St>,
4369        St: AsRef<str>,
4370    {
4371        self._scopes
4372            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4373        self
4374    }
4375
4376    /// Removes all scopes, and no default scope will be used either.
4377    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4378    /// for details).
4379    pub fn clear_scopes(mut self) -> ProjectLocationFunctionListCall<'a, C> {
4380        self._scopes.clear();
4381        self
4382    }
4383}
4384
4385/// Updates existing function.
4386///
4387/// A builder for the *locations.functions.patch* method supported by a *project* resource.
4388/// It is not used directly, but through a [`ProjectMethods`] instance.
4389///
4390/// # Example
4391///
4392/// Instantiate a resource method builder
4393///
4394/// ```test_harness,no_run
4395/// # extern crate hyper;
4396/// # extern crate hyper_rustls;
4397/// # extern crate google_cloudfunctions1 as cloudfunctions1;
4398/// use cloudfunctions1::api::CloudFunction;
4399/// # async fn dox() {
4400/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4401///
4402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4403/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4404/// #     secret,
4405/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4406/// # ).build().await.unwrap();
4407///
4408/// # let client = hyper_util::client::legacy::Client::builder(
4409/// #     hyper_util::rt::TokioExecutor::new()
4410/// # )
4411/// # .build(
4412/// #     hyper_rustls::HttpsConnectorBuilder::new()
4413/// #         .with_native_roots()
4414/// #         .unwrap()
4415/// #         .https_or_http()
4416/// #         .enable_http1()
4417/// #         .build()
4418/// # );
4419/// # let mut hub = CloudFunctions::new(client, auth);
4420/// // As the method needs a request, you would usually fill it with the desired information
4421/// // into the respective structure. Some of the parts shown here might not be applicable !
4422/// // Values shown here are possibly random and not representative !
4423/// let mut req = CloudFunction::default();
4424///
4425/// // You can configure optional parameters by calling the respective setters at will, and
4426/// // execute the final call using `doit()`.
4427/// // Values shown here are possibly random and not representative !
4428/// let result = hub.projects().locations_functions_patch(req, "name")
4429///              .update_mask(FieldMask::new::<&str>(&[]))
4430///              .doit().await;
4431/// # }
4432/// ```
4433pub struct ProjectLocationFunctionPatchCall<'a, C>
4434where
4435    C: 'a,
4436{
4437    hub: &'a CloudFunctions<C>,
4438    _request: CloudFunction,
4439    _name: String,
4440    _update_mask: Option<common::FieldMask>,
4441    _delegate: Option<&'a mut dyn common::Delegate>,
4442    _additional_params: HashMap<String, String>,
4443    _scopes: BTreeSet<String>,
4444}
4445
4446impl<'a, C> common::CallBuilder for ProjectLocationFunctionPatchCall<'a, C> {}
4447
4448impl<'a, C> ProjectLocationFunctionPatchCall<'a, C>
4449where
4450    C: common::Connector,
4451{
4452    /// Perform the operation you have build so far.
4453    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4454        use std::borrow::Cow;
4455        use std::io::{Read, Seek};
4456
4457        use common::{url::Params, ToParts};
4458        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4459
4460        let mut dd = common::DefaultDelegate;
4461        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4462        dlg.begin(common::MethodInfo {
4463            id: "cloudfunctions.projects.locations.functions.patch",
4464            http_method: hyper::Method::PATCH,
4465        });
4466
4467        for &field in ["alt", "name", "updateMask"].iter() {
4468            if self._additional_params.contains_key(field) {
4469                dlg.finished(false);
4470                return Err(common::Error::FieldClash(field));
4471            }
4472        }
4473
4474        let mut params = Params::with_capacity(5 + self._additional_params.len());
4475        params.push("name", self._name);
4476        if let Some(value) = self._update_mask.as_ref() {
4477            params.push("updateMask", value.to_string());
4478        }
4479
4480        params.extend(self._additional_params.iter());
4481
4482        params.push("alt", "json");
4483        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4484        if self._scopes.is_empty() {
4485            self._scopes
4486                .insert(Scope::CloudPlatform.as_ref().to_string());
4487        }
4488
4489        #[allow(clippy::single_element_loop)]
4490        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4491            url = params.uri_replacement(url, param_name, find_this, true);
4492        }
4493        {
4494            let to_remove = ["name"];
4495            params.remove_params(&to_remove);
4496        }
4497
4498        let url = params.parse_with_url(&url);
4499
4500        let mut json_mime_type = mime::APPLICATION_JSON;
4501        let mut request_value_reader = {
4502            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4503            common::remove_json_null_values(&mut value);
4504            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4505            serde_json::to_writer(&mut dst, &value).unwrap();
4506            dst
4507        };
4508        let request_size = request_value_reader
4509            .seek(std::io::SeekFrom::End(0))
4510            .unwrap();
4511        request_value_reader
4512            .seek(std::io::SeekFrom::Start(0))
4513            .unwrap();
4514
4515        loop {
4516            let token = match self
4517                .hub
4518                .auth
4519                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4520                .await
4521            {
4522                Ok(token) => token,
4523                Err(e) => match dlg.token(e) {
4524                    Ok(token) => token,
4525                    Err(e) => {
4526                        dlg.finished(false);
4527                        return Err(common::Error::MissingToken(e));
4528                    }
4529                },
4530            };
4531            request_value_reader
4532                .seek(std::io::SeekFrom::Start(0))
4533                .unwrap();
4534            let mut req_result = {
4535                let client = &self.hub.client;
4536                dlg.pre_request();
4537                let mut req_builder = hyper::Request::builder()
4538                    .method(hyper::Method::PATCH)
4539                    .uri(url.as_str())
4540                    .header(USER_AGENT, self.hub._user_agent.clone());
4541
4542                if let Some(token) = token.as_ref() {
4543                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4544                }
4545
4546                let request = req_builder
4547                    .header(CONTENT_TYPE, json_mime_type.to_string())
4548                    .header(CONTENT_LENGTH, request_size as u64)
4549                    .body(common::to_body(
4550                        request_value_reader.get_ref().clone().into(),
4551                    ));
4552
4553                client.request(request.unwrap()).await
4554            };
4555
4556            match req_result {
4557                Err(err) => {
4558                    if let common::Retry::After(d) = dlg.http_error(&err) {
4559                        sleep(d).await;
4560                        continue;
4561                    }
4562                    dlg.finished(false);
4563                    return Err(common::Error::HttpError(err));
4564                }
4565                Ok(res) => {
4566                    let (mut parts, body) = res.into_parts();
4567                    let mut body = common::Body::new(body);
4568                    if !parts.status.is_success() {
4569                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4570                        let error = serde_json::from_str(&common::to_string(&bytes));
4571                        let response = common::to_response(parts, bytes.into());
4572
4573                        if let common::Retry::After(d) =
4574                            dlg.http_failure(&response, error.as_ref().ok())
4575                        {
4576                            sleep(d).await;
4577                            continue;
4578                        }
4579
4580                        dlg.finished(false);
4581
4582                        return Err(match error {
4583                            Ok(value) => common::Error::BadRequest(value),
4584                            _ => common::Error::Failure(response),
4585                        });
4586                    }
4587                    let response = {
4588                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4589                        let encoded = common::to_string(&bytes);
4590                        match serde_json::from_str(&encoded) {
4591                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4592                            Err(error) => {
4593                                dlg.response_json_decode_error(&encoded, &error);
4594                                return Err(common::Error::JsonDecodeError(
4595                                    encoded.to_string(),
4596                                    error,
4597                                ));
4598                            }
4599                        }
4600                    };
4601
4602                    dlg.finished(true);
4603                    return Ok(response);
4604                }
4605            }
4606        }
4607    }
4608
4609    ///
4610    /// Sets the *request* property to the given value.
4611    ///
4612    /// Even though the property as already been set when instantiating this call,
4613    /// we provide this method for API completeness.
4614    pub fn request(mut self, new_value: CloudFunction) -> ProjectLocationFunctionPatchCall<'a, C> {
4615        self._request = new_value;
4616        self
4617    }
4618    /// A user-defined name of the function. Function names must be unique globally and match pattern `projects/*/locations/*/functions/*`
4619    ///
4620    /// Sets the *name* path property to the given value.
4621    ///
4622    /// Even though the property as already been set when instantiating this call,
4623    /// we provide this method for API completeness.
4624    pub fn name(mut self, new_value: &str) -> ProjectLocationFunctionPatchCall<'a, C> {
4625        self._name = new_value.to_string();
4626        self
4627    }
4628    /// Required. The list of fields in `CloudFunction` that have to be updated.
4629    ///
4630    /// Sets the *update mask* query property to the given value.
4631    pub fn update_mask(
4632        mut self,
4633        new_value: common::FieldMask,
4634    ) -> ProjectLocationFunctionPatchCall<'a, C> {
4635        self._update_mask = Some(new_value);
4636        self
4637    }
4638    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4639    /// while executing the actual API request.
4640    ///
4641    /// ````text
4642    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4643    /// ````
4644    ///
4645    /// Sets the *delegate* property to the given value.
4646    pub fn delegate(
4647        mut self,
4648        new_value: &'a mut dyn common::Delegate,
4649    ) -> ProjectLocationFunctionPatchCall<'a, C> {
4650        self._delegate = Some(new_value);
4651        self
4652    }
4653
4654    /// Set any additional parameter of the query string used in the request.
4655    /// It should be used to set parameters which are not yet available through their own
4656    /// setters.
4657    ///
4658    /// Please note that this method must not be used to set any of the known parameters
4659    /// which have their own setter method. If done anyway, the request will fail.
4660    ///
4661    /// # Additional Parameters
4662    ///
4663    /// * *$.xgafv* (query-string) - V1 error format.
4664    /// * *access_token* (query-string) - OAuth access token.
4665    /// * *alt* (query-string) - Data format for response.
4666    /// * *callback* (query-string) - JSONP
4667    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4668    /// * *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.
4669    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4670    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4671    /// * *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.
4672    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4673    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4674    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionPatchCall<'a, C>
4675    where
4676        T: AsRef<str>,
4677    {
4678        self._additional_params
4679            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4680        self
4681    }
4682
4683    /// Identifies the authorization scope for the method you are building.
4684    ///
4685    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4686    /// [`Scope::CloudPlatform`].
4687    ///
4688    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4689    /// tokens for more than one scope.
4690    ///
4691    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4692    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4693    /// sufficient, a read-write scope will do as well.
4694    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionPatchCall<'a, C>
4695    where
4696        St: AsRef<str>,
4697    {
4698        self._scopes.insert(String::from(scope.as_ref()));
4699        self
4700    }
4701    /// Identifies the authorization scope(s) for the method you are building.
4702    ///
4703    /// See [`Self::add_scope()`] for details.
4704    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionPatchCall<'a, C>
4705    where
4706        I: IntoIterator<Item = St>,
4707        St: AsRef<str>,
4708    {
4709        self._scopes
4710            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4711        self
4712    }
4713
4714    /// Removes all scopes, and no default scope will be used either.
4715    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4716    /// for details).
4717    pub fn clear_scopes(mut self) -> ProjectLocationFunctionPatchCall<'a, C> {
4718        self._scopes.clear();
4719        self
4720    }
4721}
4722
4723/// Sets the IAM access control policy on the specified function. Replaces any existing policy.
4724///
4725/// A builder for the *locations.functions.setIamPolicy* method supported by a *project* resource.
4726/// It is not used directly, but through a [`ProjectMethods`] instance.
4727///
4728/// # Example
4729///
4730/// Instantiate a resource method builder
4731///
4732/// ```test_harness,no_run
4733/// # extern crate hyper;
4734/// # extern crate hyper_rustls;
4735/// # extern crate google_cloudfunctions1 as cloudfunctions1;
4736/// use cloudfunctions1::api::SetIamPolicyRequest;
4737/// # async fn dox() {
4738/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4739///
4740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4741/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4742/// #     secret,
4743/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4744/// # ).build().await.unwrap();
4745///
4746/// # let client = hyper_util::client::legacy::Client::builder(
4747/// #     hyper_util::rt::TokioExecutor::new()
4748/// # )
4749/// # .build(
4750/// #     hyper_rustls::HttpsConnectorBuilder::new()
4751/// #         .with_native_roots()
4752/// #         .unwrap()
4753/// #         .https_or_http()
4754/// #         .enable_http1()
4755/// #         .build()
4756/// # );
4757/// # let mut hub = CloudFunctions::new(client, auth);
4758/// // As the method needs a request, you would usually fill it with the desired information
4759/// // into the respective structure. Some of the parts shown here might not be applicable !
4760/// // Values shown here are possibly random and not representative !
4761/// let mut req = SetIamPolicyRequest::default();
4762///
4763/// // You can configure optional parameters by calling the respective setters at will, and
4764/// // execute the final call using `doit()`.
4765/// // Values shown here are possibly random and not representative !
4766/// let result = hub.projects().locations_functions_set_iam_policy(req, "resource")
4767///              .doit().await;
4768/// # }
4769/// ```
4770pub struct ProjectLocationFunctionSetIamPolicyCall<'a, C>
4771where
4772    C: 'a,
4773{
4774    hub: &'a CloudFunctions<C>,
4775    _request: SetIamPolicyRequest,
4776    _resource: String,
4777    _delegate: Option<&'a mut dyn common::Delegate>,
4778    _additional_params: HashMap<String, String>,
4779    _scopes: BTreeSet<String>,
4780}
4781
4782impl<'a, C> common::CallBuilder for ProjectLocationFunctionSetIamPolicyCall<'a, C> {}
4783
4784impl<'a, C> ProjectLocationFunctionSetIamPolicyCall<'a, C>
4785where
4786    C: common::Connector,
4787{
4788    /// Perform the operation you have build so far.
4789    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4790        use std::borrow::Cow;
4791        use std::io::{Read, Seek};
4792
4793        use common::{url::Params, ToParts};
4794        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4795
4796        let mut dd = common::DefaultDelegate;
4797        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4798        dlg.begin(common::MethodInfo {
4799            id: "cloudfunctions.projects.locations.functions.setIamPolicy",
4800            http_method: hyper::Method::POST,
4801        });
4802
4803        for &field in ["alt", "resource"].iter() {
4804            if self._additional_params.contains_key(field) {
4805                dlg.finished(false);
4806                return Err(common::Error::FieldClash(field));
4807            }
4808        }
4809
4810        let mut params = Params::with_capacity(4 + self._additional_params.len());
4811        params.push("resource", self._resource);
4812
4813        params.extend(self._additional_params.iter());
4814
4815        params.push("alt", "json");
4816        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4817        if self._scopes.is_empty() {
4818            self._scopes
4819                .insert(Scope::CloudPlatform.as_ref().to_string());
4820        }
4821
4822        #[allow(clippy::single_element_loop)]
4823        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4824            url = params.uri_replacement(url, param_name, find_this, true);
4825        }
4826        {
4827            let to_remove = ["resource"];
4828            params.remove_params(&to_remove);
4829        }
4830
4831        let url = params.parse_with_url(&url);
4832
4833        let mut json_mime_type = mime::APPLICATION_JSON;
4834        let mut request_value_reader = {
4835            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4836            common::remove_json_null_values(&mut value);
4837            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4838            serde_json::to_writer(&mut dst, &value).unwrap();
4839            dst
4840        };
4841        let request_size = request_value_reader
4842            .seek(std::io::SeekFrom::End(0))
4843            .unwrap();
4844        request_value_reader
4845            .seek(std::io::SeekFrom::Start(0))
4846            .unwrap();
4847
4848        loop {
4849            let token = match self
4850                .hub
4851                .auth
4852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4853                .await
4854            {
4855                Ok(token) => token,
4856                Err(e) => match dlg.token(e) {
4857                    Ok(token) => token,
4858                    Err(e) => {
4859                        dlg.finished(false);
4860                        return Err(common::Error::MissingToken(e));
4861                    }
4862                },
4863            };
4864            request_value_reader
4865                .seek(std::io::SeekFrom::Start(0))
4866                .unwrap();
4867            let mut req_result = {
4868                let client = &self.hub.client;
4869                dlg.pre_request();
4870                let mut req_builder = hyper::Request::builder()
4871                    .method(hyper::Method::POST)
4872                    .uri(url.as_str())
4873                    .header(USER_AGENT, self.hub._user_agent.clone());
4874
4875                if let Some(token) = token.as_ref() {
4876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4877                }
4878
4879                let request = req_builder
4880                    .header(CONTENT_TYPE, json_mime_type.to_string())
4881                    .header(CONTENT_LENGTH, request_size as u64)
4882                    .body(common::to_body(
4883                        request_value_reader.get_ref().clone().into(),
4884                    ));
4885
4886                client.request(request.unwrap()).await
4887            };
4888
4889            match req_result {
4890                Err(err) => {
4891                    if let common::Retry::After(d) = dlg.http_error(&err) {
4892                        sleep(d).await;
4893                        continue;
4894                    }
4895                    dlg.finished(false);
4896                    return Err(common::Error::HttpError(err));
4897                }
4898                Ok(res) => {
4899                    let (mut parts, body) = res.into_parts();
4900                    let mut body = common::Body::new(body);
4901                    if !parts.status.is_success() {
4902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4903                        let error = serde_json::from_str(&common::to_string(&bytes));
4904                        let response = common::to_response(parts, bytes.into());
4905
4906                        if let common::Retry::After(d) =
4907                            dlg.http_failure(&response, error.as_ref().ok())
4908                        {
4909                            sleep(d).await;
4910                            continue;
4911                        }
4912
4913                        dlg.finished(false);
4914
4915                        return Err(match error {
4916                            Ok(value) => common::Error::BadRequest(value),
4917                            _ => common::Error::Failure(response),
4918                        });
4919                    }
4920                    let response = {
4921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4922                        let encoded = common::to_string(&bytes);
4923                        match serde_json::from_str(&encoded) {
4924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4925                            Err(error) => {
4926                                dlg.response_json_decode_error(&encoded, &error);
4927                                return Err(common::Error::JsonDecodeError(
4928                                    encoded.to_string(),
4929                                    error,
4930                                ));
4931                            }
4932                        }
4933                    };
4934
4935                    dlg.finished(true);
4936                    return Ok(response);
4937                }
4938            }
4939        }
4940    }
4941
4942    ///
4943    /// Sets the *request* property to the given value.
4944    ///
4945    /// Even though the property as already been set when instantiating this call,
4946    /// we provide this method for API completeness.
4947    pub fn request(
4948        mut self,
4949        new_value: SetIamPolicyRequest,
4950    ) -> ProjectLocationFunctionSetIamPolicyCall<'a, C> {
4951        self._request = new_value;
4952        self
4953    }
4954    /// 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.
4955    ///
4956    /// Sets the *resource* path property to the given value.
4957    ///
4958    /// Even though the property as already been set when instantiating this call,
4959    /// we provide this method for API completeness.
4960    pub fn resource(mut self, new_value: &str) -> ProjectLocationFunctionSetIamPolicyCall<'a, C> {
4961        self._resource = new_value.to_string();
4962        self
4963    }
4964    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4965    /// while executing the actual API request.
4966    ///
4967    /// ````text
4968    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4969    /// ````
4970    ///
4971    /// Sets the *delegate* property to the given value.
4972    pub fn delegate(
4973        mut self,
4974        new_value: &'a mut dyn common::Delegate,
4975    ) -> ProjectLocationFunctionSetIamPolicyCall<'a, C> {
4976        self._delegate = Some(new_value);
4977        self
4978    }
4979
4980    /// Set any additional parameter of the query string used in the request.
4981    /// It should be used to set parameters which are not yet available through their own
4982    /// setters.
4983    ///
4984    /// Please note that this method must not be used to set any of the known parameters
4985    /// which have their own setter method. If done anyway, the request will fail.
4986    ///
4987    /// # Additional Parameters
4988    ///
4989    /// * *$.xgafv* (query-string) - V1 error format.
4990    /// * *access_token* (query-string) - OAuth access token.
4991    /// * *alt* (query-string) - Data format for response.
4992    /// * *callback* (query-string) - JSONP
4993    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4994    /// * *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.
4995    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4996    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4997    /// * *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.
4998    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4999    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5000    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFunctionSetIamPolicyCall<'a, C>
5001    where
5002        T: AsRef<str>,
5003    {
5004        self._additional_params
5005            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5006        self
5007    }
5008
5009    /// Identifies the authorization scope for the method you are building.
5010    ///
5011    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5012    /// [`Scope::CloudPlatform`].
5013    ///
5014    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5015    /// tokens for more than one scope.
5016    ///
5017    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5018    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5019    /// sufficient, a read-write scope will do as well.
5020    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionSetIamPolicyCall<'a, C>
5021    where
5022        St: AsRef<str>,
5023    {
5024        self._scopes.insert(String::from(scope.as_ref()));
5025        self
5026    }
5027    /// Identifies the authorization scope(s) for the method you are building.
5028    ///
5029    /// See [`Self::add_scope()`] for details.
5030    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFunctionSetIamPolicyCall<'a, C>
5031    where
5032        I: IntoIterator<Item = St>,
5033        St: AsRef<str>,
5034    {
5035        self._scopes
5036            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5037        self
5038    }
5039
5040    /// Removes all scopes, and no default scope will be used either.
5041    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5042    /// for details).
5043    pub fn clear_scopes(mut self) -> ProjectLocationFunctionSetIamPolicyCall<'a, C> {
5044        self._scopes.clear();
5045        self
5046    }
5047}
5048
5049/// Tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
5050///
5051/// A builder for the *locations.functions.testIamPermissions* method supported by a *project* resource.
5052/// It is not used directly, but through a [`ProjectMethods`] instance.
5053///
5054/// # Example
5055///
5056/// Instantiate a resource method builder
5057///
5058/// ```test_harness,no_run
5059/// # extern crate hyper;
5060/// # extern crate hyper_rustls;
5061/// # extern crate google_cloudfunctions1 as cloudfunctions1;
5062/// use cloudfunctions1::api::TestIamPermissionsRequest;
5063/// # async fn dox() {
5064/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5065///
5066/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5067/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5068/// #     secret,
5069/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5070/// # ).build().await.unwrap();
5071///
5072/// # let client = hyper_util::client::legacy::Client::builder(
5073/// #     hyper_util::rt::TokioExecutor::new()
5074/// # )
5075/// # .build(
5076/// #     hyper_rustls::HttpsConnectorBuilder::new()
5077/// #         .with_native_roots()
5078/// #         .unwrap()
5079/// #         .https_or_http()
5080/// #         .enable_http1()
5081/// #         .build()
5082/// # );
5083/// # let mut hub = CloudFunctions::new(client, auth);
5084/// // As the method needs a request, you would usually fill it with the desired information
5085/// // into the respective structure. Some of the parts shown here might not be applicable !
5086/// // Values shown here are possibly random and not representative !
5087/// let mut req = TestIamPermissionsRequest::default();
5088///
5089/// // You can configure optional parameters by calling the respective setters at will, and
5090/// // execute the final call using `doit()`.
5091/// // Values shown here are possibly random and not representative !
5092/// let result = hub.projects().locations_functions_test_iam_permissions(req, "resource")
5093///              .doit().await;
5094/// # }
5095/// ```
5096pub struct ProjectLocationFunctionTestIamPermissionCall<'a, C>
5097where
5098    C: 'a,
5099{
5100    hub: &'a CloudFunctions<C>,
5101    _request: TestIamPermissionsRequest,
5102    _resource: String,
5103    _delegate: Option<&'a mut dyn common::Delegate>,
5104    _additional_params: HashMap<String, String>,
5105    _scopes: BTreeSet<String>,
5106}
5107
5108impl<'a, C> common::CallBuilder for ProjectLocationFunctionTestIamPermissionCall<'a, C> {}
5109
5110impl<'a, C> ProjectLocationFunctionTestIamPermissionCall<'a, C>
5111where
5112    C: common::Connector,
5113{
5114    /// Perform the operation you have build so far.
5115    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
5116        use std::borrow::Cow;
5117        use std::io::{Read, Seek};
5118
5119        use common::{url::Params, ToParts};
5120        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5121
5122        let mut dd = common::DefaultDelegate;
5123        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5124        dlg.begin(common::MethodInfo {
5125            id: "cloudfunctions.projects.locations.functions.testIamPermissions",
5126            http_method: hyper::Method::POST,
5127        });
5128
5129        for &field in ["alt", "resource"].iter() {
5130            if self._additional_params.contains_key(field) {
5131                dlg.finished(false);
5132                return Err(common::Error::FieldClash(field));
5133            }
5134        }
5135
5136        let mut params = Params::with_capacity(4 + self._additional_params.len());
5137        params.push("resource", self._resource);
5138
5139        params.extend(self._additional_params.iter());
5140
5141        params.push("alt", "json");
5142        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
5143        if self._scopes.is_empty() {
5144            self._scopes
5145                .insert(Scope::CloudPlatform.as_ref().to_string());
5146        }
5147
5148        #[allow(clippy::single_element_loop)]
5149        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5150            url = params.uri_replacement(url, param_name, find_this, true);
5151        }
5152        {
5153            let to_remove = ["resource"];
5154            params.remove_params(&to_remove);
5155        }
5156
5157        let url = params.parse_with_url(&url);
5158
5159        let mut json_mime_type = mime::APPLICATION_JSON;
5160        let mut request_value_reader = {
5161            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5162            common::remove_json_null_values(&mut value);
5163            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5164            serde_json::to_writer(&mut dst, &value).unwrap();
5165            dst
5166        };
5167        let request_size = request_value_reader
5168            .seek(std::io::SeekFrom::End(0))
5169            .unwrap();
5170        request_value_reader
5171            .seek(std::io::SeekFrom::Start(0))
5172            .unwrap();
5173
5174        loop {
5175            let token = match self
5176                .hub
5177                .auth
5178                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5179                .await
5180            {
5181                Ok(token) => token,
5182                Err(e) => match dlg.token(e) {
5183                    Ok(token) => token,
5184                    Err(e) => {
5185                        dlg.finished(false);
5186                        return Err(common::Error::MissingToken(e));
5187                    }
5188                },
5189            };
5190            request_value_reader
5191                .seek(std::io::SeekFrom::Start(0))
5192                .unwrap();
5193            let mut req_result = {
5194                let client = &self.hub.client;
5195                dlg.pre_request();
5196                let mut req_builder = hyper::Request::builder()
5197                    .method(hyper::Method::POST)
5198                    .uri(url.as_str())
5199                    .header(USER_AGENT, self.hub._user_agent.clone());
5200
5201                if let Some(token) = token.as_ref() {
5202                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5203                }
5204
5205                let request = req_builder
5206                    .header(CONTENT_TYPE, json_mime_type.to_string())
5207                    .header(CONTENT_LENGTH, request_size as u64)
5208                    .body(common::to_body(
5209                        request_value_reader.get_ref().clone().into(),
5210                    ));
5211
5212                client.request(request.unwrap()).await
5213            };
5214
5215            match req_result {
5216                Err(err) => {
5217                    if let common::Retry::After(d) = dlg.http_error(&err) {
5218                        sleep(d).await;
5219                        continue;
5220                    }
5221                    dlg.finished(false);
5222                    return Err(common::Error::HttpError(err));
5223                }
5224                Ok(res) => {
5225                    let (mut parts, body) = res.into_parts();
5226                    let mut body = common::Body::new(body);
5227                    if !parts.status.is_success() {
5228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5229                        let error = serde_json::from_str(&common::to_string(&bytes));
5230                        let response = common::to_response(parts, bytes.into());
5231
5232                        if let common::Retry::After(d) =
5233                            dlg.http_failure(&response, error.as_ref().ok())
5234                        {
5235                            sleep(d).await;
5236                            continue;
5237                        }
5238
5239                        dlg.finished(false);
5240
5241                        return Err(match error {
5242                            Ok(value) => common::Error::BadRequest(value),
5243                            _ => common::Error::Failure(response),
5244                        });
5245                    }
5246                    let response = {
5247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5248                        let encoded = common::to_string(&bytes);
5249                        match serde_json::from_str(&encoded) {
5250                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5251                            Err(error) => {
5252                                dlg.response_json_decode_error(&encoded, &error);
5253                                return Err(common::Error::JsonDecodeError(
5254                                    encoded.to_string(),
5255                                    error,
5256                                ));
5257                            }
5258                        }
5259                    };
5260
5261                    dlg.finished(true);
5262                    return Ok(response);
5263                }
5264            }
5265        }
5266    }
5267
5268    ///
5269    /// Sets the *request* property to the given value.
5270    ///
5271    /// Even though the property as already been set when instantiating this call,
5272    /// we provide this method for API completeness.
5273    pub fn request(
5274        mut self,
5275        new_value: TestIamPermissionsRequest,
5276    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C> {
5277        self._request = new_value;
5278        self
5279    }
5280    /// 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.
5281    ///
5282    /// Sets the *resource* path property to the given value.
5283    ///
5284    /// Even though the property as already been set when instantiating this call,
5285    /// we provide this method for API completeness.
5286    pub fn resource(
5287        mut self,
5288        new_value: &str,
5289    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C> {
5290        self._resource = new_value.to_string();
5291        self
5292    }
5293    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5294    /// while executing the actual API request.
5295    ///
5296    /// ````text
5297    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5298    /// ````
5299    ///
5300    /// Sets the *delegate* property to the given value.
5301    pub fn delegate(
5302        mut self,
5303        new_value: &'a mut dyn common::Delegate,
5304    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C> {
5305        self._delegate = Some(new_value);
5306        self
5307    }
5308
5309    /// Set any additional parameter of the query string used in the request.
5310    /// It should be used to set parameters which are not yet available through their own
5311    /// setters.
5312    ///
5313    /// Please note that this method must not be used to set any of the known parameters
5314    /// which have their own setter method. If done anyway, the request will fail.
5315    ///
5316    /// # Additional Parameters
5317    ///
5318    /// * *$.xgafv* (query-string) - V1 error format.
5319    /// * *access_token* (query-string) - OAuth access token.
5320    /// * *alt* (query-string) - Data format for response.
5321    /// * *callback* (query-string) - JSONP
5322    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5323    /// * *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.
5324    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5325    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5326    /// * *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.
5327    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5328    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5329    pub fn param<T>(
5330        mut self,
5331        name: T,
5332        value: T,
5333    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C>
5334    where
5335        T: AsRef<str>,
5336    {
5337        self._additional_params
5338            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5339        self
5340    }
5341
5342    /// Identifies the authorization scope for the method you are building.
5343    ///
5344    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5345    /// [`Scope::CloudPlatform`].
5346    ///
5347    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5348    /// tokens for more than one scope.
5349    ///
5350    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5351    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5352    /// sufficient, a read-write scope will do as well.
5353    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFunctionTestIamPermissionCall<'a, C>
5354    where
5355        St: AsRef<str>,
5356    {
5357        self._scopes.insert(String::from(scope.as_ref()));
5358        self
5359    }
5360    /// Identifies the authorization scope(s) for the method you are building.
5361    ///
5362    /// See [`Self::add_scope()`] for details.
5363    pub fn add_scopes<I, St>(
5364        mut self,
5365        scopes: I,
5366    ) -> ProjectLocationFunctionTestIamPermissionCall<'a, C>
5367    where
5368        I: IntoIterator<Item = St>,
5369        St: AsRef<str>,
5370    {
5371        self._scopes
5372            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5373        self
5374    }
5375
5376    /// Removes all scopes, and no default scope will be used either.
5377    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5378    /// for details).
5379    pub fn clear_scopes(mut self) -> ProjectLocationFunctionTestIamPermissionCall<'a, C> {
5380        self._scopes.clear();
5381        self
5382    }
5383}
5384
5385/// Lists information about the supported locations for this service.
5386///
5387/// A builder for the *locations.list* method supported by a *project* resource.
5388/// It is not used directly, but through a [`ProjectMethods`] instance.
5389///
5390/// # Example
5391///
5392/// Instantiate a resource method builder
5393///
5394/// ```test_harness,no_run
5395/// # extern crate hyper;
5396/// # extern crate hyper_rustls;
5397/// # extern crate google_cloudfunctions1 as cloudfunctions1;
5398/// # async fn dox() {
5399/// # use cloudfunctions1::{CloudFunctions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5400///
5401/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5402/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5403/// #     secret,
5404/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5405/// # ).build().await.unwrap();
5406///
5407/// # let client = hyper_util::client::legacy::Client::builder(
5408/// #     hyper_util::rt::TokioExecutor::new()
5409/// # )
5410/// # .build(
5411/// #     hyper_rustls::HttpsConnectorBuilder::new()
5412/// #         .with_native_roots()
5413/// #         .unwrap()
5414/// #         .https_or_http()
5415/// #         .enable_http1()
5416/// #         .build()
5417/// # );
5418/// # let mut hub = CloudFunctions::new(client, auth);
5419/// // You can configure optional parameters by calling the respective setters at will, and
5420/// // execute the final call using `doit()`.
5421/// // Values shown here are possibly random and not representative !
5422/// let result = hub.projects().locations_list("name")
5423///              .page_token("ea")
5424///              .page_size(-99)
5425///              .filter("Lorem")
5426///              .doit().await;
5427/// # }
5428/// ```
5429pub struct ProjectLocationListCall<'a, C>
5430where
5431    C: 'a,
5432{
5433    hub: &'a CloudFunctions<C>,
5434    _name: String,
5435    _page_token: Option<String>,
5436    _page_size: Option<i32>,
5437    _filter: Option<String>,
5438    _delegate: Option<&'a mut dyn common::Delegate>,
5439    _additional_params: HashMap<String, String>,
5440    _scopes: BTreeSet<String>,
5441}
5442
5443impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
5444
5445impl<'a, C> ProjectLocationListCall<'a, C>
5446where
5447    C: common::Connector,
5448{
5449    /// Perform the operation you have build so far.
5450    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
5451        use std::borrow::Cow;
5452        use std::io::{Read, Seek};
5453
5454        use common::{url::Params, ToParts};
5455        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5456
5457        let mut dd = common::DefaultDelegate;
5458        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5459        dlg.begin(common::MethodInfo {
5460            id: "cloudfunctions.projects.locations.list",
5461            http_method: hyper::Method::GET,
5462        });
5463
5464        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
5465            if self._additional_params.contains_key(field) {
5466                dlg.finished(false);
5467                return Err(common::Error::FieldClash(field));
5468            }
5469        }
5470
5471        let mut params = Params::with_capacity(6 + self._additional_params.len());
5472        params.push("name", self._name);
5473        if let Some(value) = self._page_token.as_ref() {
5474            params.push("pageToken", value);
5475        }
5476        if let Some(value) = self._page_size.as_ref() {
5477            params.push("pageSize", value.to_string());
5478        }
5479        if let Some(value) = self._filter.as_ref() {
5480            params.push("filter", value);
5481        }
5482
5483        params.extend(self._additional_params.iter());
5484
5485        params.push("alt", "json");
5486        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
5487        if self._scopes.is_empty() {
5488            self._scopes
5489                .insert(Scope::CloudPlatform.as_ref().to_string());
5490        }
5491
5492        #[allow(clippy::single_element_loop)]
5493        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5494            url = params.uri_replacement(url, param_name, find_this, true);
5495        }
5496        {
5497            let to_remove = ["name"];
5498            params.remove_params(&to_remove);
5499        }
5500
5501        let url = params.parse_with_url(&url);
5502
5503        loop {
5504            let token = match self
5505                .hub
5506                .auth
5507                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5508                .await
5509            {
5510                Ok(token) => token,
5511                Err(e) => match dlg.token(e) {
5512                    Ok(token) => token,
5513                    Err(e) => {
5514                        dlg.finished(false);
5515                        return Err(common::Error::MissingToken(e));
5516                    }
5517                },
5518            };
5519            let mut req_result = {
5520                let client = &self.hub.client;
5521                dlg.pre_request();
5522                let mut req_builder = hyper::Request::builder()
5523                    .method(hyper::Method::GET)
5524                    .uri(url.as_str())
5525                    .header(USER_AGENT, self.hub._user_agent.clone());
5526
5527                if let Some(token) = token.as_ref() {
5528                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5529                }
5530
5531                let request = req_builder
5532                    .header(CONTENT_LENGTH, 0_u64)
5533                    .body(common::to_body::<String>(None));
5534
5535                client.request(request.unwrap()).await
5536            };
5537
5538            match req_result {
5539                Err(err) => {
5540                    if let common::Retry::After(d) = dlg.http_error(&err) {
5541                        sleep(d).await;
5542                        continue;
5543                    }
5544                    dlg.finished(false);
5545                    return Err(common::Error::HttpError(err));
5546                }
5547                Ok(res) => {
5548                    let (mut parts, body) = res.into_parts();
5549                    let mut body = common::Body::new(body);
5550                    if !parts.status.is_success() {
5551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5552                        let error = serde_json::from_str(&common::to_string(&bytes));
5553                        let response = common::to_response(parts, bytes.into());
5554
5555                        if let common::Retry::After(d) =
5556                            dlg.http_failure(&response, error.as_ref().ok())
5557                        {
5558                            sleep(d).await;
5559                            continue;
5560                        }
5561
5562                        dlg.finished(false);
5563
5564                        return Err(match error {
5565                            Ok(value) => common::Error::BadRequest(value),
5566                            _ => common::Error::Failure(response),
5567                        });
5568                    }
5569                    let response = {
5570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5571                        let encoded = common::to_string(&bytes);
5572                        match serde_json::from_str(&encoded) {
5573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5574                            Err(error) => {
5575                                dlg.response_json_decode_error(&encoded, &error);
5576                                return Err(common::Error::JsonDecodeError(
5577                                    encoded.to_string(),
5578                                    error,
5579                                ));
5580                            }
5581                        }
5582                    };
5583
5584                    dlg.finished(true);
5585                    return Ok(response);
5586                }
5587            }
5588        }
5589    }
5590
5591    /// The resource that owns the locations collection, if applicable.
5592    ///
5593    /// Sets the *name* path property to the given value.
5594    ///
5595    /// Even though the property as already been set when instantiating this call,
5596    /// we provide this method for API completeness.
5597    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
5598        self._name = new_value.to_string();
5599        self
5600    }
5601    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
5602    ///
5603    /// Sets the *page token* query property to the given value.
5604    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
5605        self._page_token = Some(new_value.to_string());
5606        self
5607    }
5608    /// The maximum number of results to return. If not set, the service selects a default.
5609    ///
5610    /// Sets the *page size* query property to the given value.
5611    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
5612        self._page_size = Some(new_value);
5613        self
5614    }
5615    /// 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).
5616    ///
5617    /// Sets the *filter* query property to the given value.
5618    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
5619        self._filter = Some(new_value.to_string());
5620        self
5621    }
5622    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5623    /// while executing the actual API request.
5624    ///
5625    /// ````text
5626    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5627    /// ````
5628    ///
5629    /// Sets the *delegate* property to the given value.
5630    pub fn delegate(
5631        mut self,
5632        new_value: &'a mut dyn common::Delegate,
5633    ) -> ProjectLocationListCall<'a, C> {
5634        self._delegate = Some(new_value);
5635        self
5636    }
5637
5638    /// Set any additional parameter of the query string used in the request.
5639    /// It should be used to set parameters which are not yet available through their own
5640    /// setters.
5641    ///
5642    /// Please note that this method must not be used to set any of the known parameters
5643    /// which have their own setter method. If done anyway, the request will fail.
5644    ///
5645    /// # Additional Parameters
5646    ///
5647    /// * *$.xgafv* (query-string) - V1 error format.
5648    /// * *access_token* (query-string) - OAuth access token.
5649    /// * *alt* (query-string) - Data format for response.
5650    /// * *callback* (query-string) - JSONP
5651    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5652    /// * *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.
5653    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5654    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5655    /// * *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.
5656    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5657    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5658    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
5659    where
5660        T: AsRef<str>,
5661    {
5662        self._additional_params
5663            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5664        self
5665    }
5666
5667    /// Identifies the authorization scope for the method you are building.
5668    ///
5669    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5670    /// [`Scope::CloudPlatform`].
5671    ///
5672    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5673    /// tokens for more than one scope.
5674    ///
5675    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5676    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5677    /// sufficient, a read-write scope will do as well.
5678    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
5679    where
5680        St: AsRef<str>,
5681    {
5682        self._scopes.insert(String::from(scope.as_ref()));
5683        self
5684    }
5685    /// Identifies the authorization scope(s) for the method you are building.
5686    ///
5687    /// See [`Self::add_scope()`] for details.
5688    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
5689    where
5690        I: IntoIterator<Item = St>,
5691        St: AsRef<str>,
5692    {
5693        self._scopes
5694            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5695        self
5696    }
5697
5698    /// Removes all scopes, and no default scope will be used either.
5699    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5700    /// for details).
5701    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
5702        self._scopes.clear();
5703        self
5704    }
5705}