google_runtimeconfig1_beta1/
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    /// Manage your Google Cloud Platform services' runtime configuration
20    Cloudruntimeconfig,
21}
22
23impl AsRef<str> for Scope {
24    fn as_ref(&self) -> &str {
25        match *self {
26            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27            Scope::Cloudruntimeconfig => "https://www.googleapis.com/auth/cloudruntimeconfig",
28        }
29    }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34    fn default() -> Scope {
35        Scope::CloudPlatform
36    }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all CloudRuntimeConfig related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
53/// use runtimeconfig1_beta1::api::Variable;
54/// use runtimeconfig1_beta1::{Result, Error};
55/// # async fn dox() {
56/// use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
57///
58/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
59/// // `client_secret`, among other things.
60/// let secret: yup_oauth2::ApplicationSecret = Default::default();
61/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
62/// // unless you replace  `None` with the desired Flow.
63/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
64/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
65/// // retrieve them from storage.
66/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
67///     .with_native_roots()
68///     .unwrap()
69///     .https_only()
70///     .enable_http2()
71///     .build();
72///
73/// let executor = hyper_util::rt::TokioExecutor::new();
74/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
75///     secret,
76///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
77///     yup_oauth2::client::CustomHyperClientBuilder::from(
78///         hyper_util::client::legacy::Client::builder(executor).build(connector),
79///     ),
80/// ).build().await.unwrap();
81///
82/// let client = hyper_util::client::legacy::Client::builder(
83///     hyper_util::rt::TokioExecutor::new()
84/// )
85/// .build(
86///     hyper_rustls::HttpsConnectorBuilder::new()
87///         .with_native_roots()
88///         .unwrap()
89///         .https_or_http()
90///         .enable_http2()
91///         .build()
92/// );
93/// let mut hub = CloudRuntimeConfig::new(client, auth);
94/// // As the method needs a request, you would usually fill it with the desired information
95/// // into the respective structure. Some of the parts shown here might not be applicable !
96/// // Values shown here are possibly random and not representative !
97/// let mut req = Variable::default();
98///
99/// // You can configure optional parameters by calling the respective setters at will, and
100/// // execute the final call using `doit()`.
101/// // Values shown here are possibly random and not representative !
102/// let result = hub.projects().configs_variables_create(req, "parent")
103///              .request_id("At")
104///              .doit().await;
105///
106/// match result {
107///     Err(e) => match e {
108///         // The Error enum provides details about what exactly happened.
109///         // You can also just use its `Debug`, `Display` or `Error` traits
110///          Error::HttpError(_)
111///         |Error::Io(_)
112///         |Error::MissingAPIKey
113///         |Error::MissingToken(_)
114///         |Error::Cancelled
115///         |Error::UploadSizeLimitExceeded(_, _)
116///         |Error::Failure(_)
117///         |Error::BadRequest(_)
118///         |Error::FieldClash(_)
119///         |Error::JsonDecodeError(_, _) => println!("{}", e),
120///     },
121///     Ok(res) => println!("Success: {:?}", res),
122/// }
123/// # }
124/// ```
125#[derive(Clone)]
126pub struct CloudRuntimeConfig<C> {
127    pub client: common::Client<C>,
128    pub auth: Box<dyn common::GetToken>,
129    _user_agent: String,
130    _base_url: String,
131    _root_url: String,
132}
133
134impl<C> common::Hub for CloudRuntimeConfig<C> {}
135
136impl<'a, C> CloudRuntimeConfig<C> {
137    pub fn new<A: 'static + common::GetToken>(
138        client: common::Client<C>,
139        auth: A,
140    ) -> CloudRuntimeConfig<C> {
141        CloudRuntimeConfig {
142            client,
143            auth: Box::new(auth),
144            _user_agent: "google-api-rust-client/7.0.0".to_string(),
145            _base_url: "https://runtimeconfig.googleapis.com/".to_string(),
146            _root_url: "https://runtimeconfig.googleapis.com/".to_string(),
147        }
148    }
149
150    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
151        ProjectMethods { hub: self }
152    }
153
154    /// Set the user-agent header field to use in all requests to the server.
155    /// It defaults to `google-api-rust-client/7.0.0`.
156    ///
157    /// Returns the previously set user-agent.
158    pub fn user_agent(&mut self, agent_name: String) -> String {
159        std::mem::replace(&mut self._user_agent, agent_name)
160    }
161
162    /// Set the base url to use in all requests to the server.
163    /// It defaults to `https://runtimeconfig.googleapis.com/`.
164    ///
165    /// Returns the previously set base url.
166    pub fn base_url(&mut self, new_base_url: String) -> String {
167        std::mem::replace(&mut self._base_url, new_base_url)
168    }
169
170    /// Set the root url to use in all requests to the server.
171    /// It defaults to `https://runtimeconfig.googleapis.com/`.
172    ///
173    /// Returns the previously set root url.
174    pub fn root_url(&mut self, new_root_url: String) -> String {
175        std::mem::replace(&mut self._root_url, new_root_url)
176    }
177}
178
179// ############
180// SCHEMAS ###
181// ##########
182/// Associates `members`, or principals, with a `role`.
183///
184/// This type is not used in any activity, and only used as *part* of another schema.
185///
186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
187#[serde_with::serde_as]
188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
189pub struct Binding {
190    /// 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).
191    pub condition: Option<Expr>,
192    /// 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`.
193    pub members: Option<Vec<String>>,
194    /// 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).
195    pub role: Option<String>,
196}
197
198impl common::Part for Binding {}
199
200/// A Cardinality condition for the Waiter resource. A cardinality condition is met when the number of variables under a specified path prefix reaches a predefined number. For example, if you set a Cardinality condition where the `path` is set to `/foo` and the number of paths is set to `2`, the following variables would meet the condition in a RuntimeConfig resource: + `/foo/variable1 = "value1"` + `/foo/variable2 = "value2"` + `/bar/variable3 = "value3"` It would not satisfy the same condition with the `number` set to `3`, however, because there is only 2 paths that start with `/foo`. Cardinality conditions are recursive; all subtrees under the specific path prefix are counted.
201///
202/// This type is not used in any activity, and only used as *part* of another schema.
203///
204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
205#[serde_with::serde_as]
206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
207pub struct Cardinality {
208    /// The number variables under the `path` that must exist to meet this condition. Defaults to 1 if not specified.
209    pub number: Option<i32>,
210    /// The root of the variable subtree to monitor. For example, `/foo`.
211    pub path: Option<String>,
212}
213
214impl common::Part for Cardinality {}
215
216/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
217///
218/// # Activities
219///
220/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
221/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
222///
223/// * [configs variables delete projects](ProjectConfigVariableDeleteCall) (response)
224/// * [configs waiters delete projects](ProjectConfigWaiterDeleteCall) (response)
225/// * [configs delete projects](ProjectConfigDeleteCall) (response)
226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
227#[serde_with::serde_as]
228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
229pub struct Empty {
230    _never_set: Option<bool>,
231}
232
233impl common::ResponseResult for Empty {}
234
235/// The condition that a Waiter resource is waiting for.
236///
237/// This type is not used in any activity, and only used as *part* of another schema.
238///
239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
240#[serde_with::serde_as]
241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
242pub struct EndCondition {
243    /// The cardinality of the `EndCondition`.
244    pub cardinality: Option<Cardinality>,
245}
246
247impl common::Part for EndCondition {}
248
249/// 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.
250///
251/// This type is not used in any activity, and only used as *part* of another schema.
252///
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct Expr {
257    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
258    pub description: Option<String>,
259    /// Textual representation of an expression in Common Expression Language syntax.
260    pub expression: Option<String>,
261    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
262    pub location: Option<String>,
263    /// 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.
264    pub title: Option<String>,
265}
266
267impl common::Part for Expr {}
268
269/// `ListConfigs()` returns the following response. The order of returned objects is arbitrary; that is, it is not ordered in any particular way.
270///
271/// # Activities
272///
273/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
274/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
275///
276/// * [configs list projects](ProjectConfigListCall) (response)
277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
278#[serde_with::serde_as]
279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
280pub struct ListConfigsResponse {
281    /// A list of the configurations in the project. The order of returned objects is arbitrary; that is, it is not ordered in any particular way.
282    pub configs: Option<Vec<RuntimeConfig>>,
283    /// This token allows you to get the next page of results for list requests. If the number of results is larger than `pageSize`, use the `nextPageToken` as a value for the query parameter `pageToken` in the next list request. Subsequent list requests will have their own `nextPageToken` to continue paging through the results
284    #[serde(rename = "nextPageToken")]
285    pub next_page_token: Option<String>,
286}
287
288impl common::ResponseResult for ListConfigsResponse {}
289
290/// Response for the `ListVariables()` method.
291///
292/// # Activities
293///
294/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
295/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
296///
297/// * [configs variables list projects](ProjectConfigVariableListCall) (response)
298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
299#[serde_with::serde_as]
300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
301pub struct ListVariablesResponse {
302    /// This token allows you to get the next page of results for list requests. If the number of results is larger than `pageSize`, use the `nextPageToken` as a value for the query parameter `pageToken` in the next list request. Subsequent list requests will have their own `nextPageToken` to continue paging through the results
303    #[serde(rename = "nextPageToken")]
304    pub next_page_token: Option<String>,
305    /// A list of variables and their values. The order of returned variable objects is arbitrary.
306    pub variables: Option<Vec<Variable>>,
307}
308
309impl common::ResponseResult for ListVariablesResponse {}
310
311/// Response for the `ListWaiters()` method. Order of returned waiter objects is arbitrary.
312///
313/// # Activities
314///
315/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
316/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
317///
318/// * [configs waiters list projects](ProjectConfigWaiterListCall) (response)
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct ListWaitersResponse {
323    /// This token allows you to get the next page of results for list requests. If the number of results is larger than `pageSize`, use the `nextPageToken` as a value for the query parameter `pageToken` in the next list request. Subsequent list requests will have their own `nextPageToken` to continue paging through the results
324    #[serde(rename = "nextPageToken")]
325    pub next_page_token: Option<String>,
326    /// Found waiters in the project.
327    pub waiters: Option<Vec<Waiter>>,
328}
329
330impl common::ResponseResult for ListWaitersResponse {}
331
332/// This resource represents a long-running operation that is the result of a network API call.
333///
334/// # Activities
335///
336/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
337/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
338///
339/// * [configs operations get projects](ProjectConfigOperationGetCall) (response)
340/// * [configs waiters create projects](ProjectConfigWaiterCreateCall) (response)
341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
342#[serde_with::serde_as]
343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
344pub struct Operation {
345    /// 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.
346    pub done: Option<bool>,
347    /// The error result of the operation in case of failure or cancellation.
348    pub error: Option<Status>,
349    /// 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.
350    pub metadata: Option<HashMap<String, serde_json::Value>>,
351    /// 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}`.
352    pub name: Option<String>,
353    /// 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`.
354    pub response: Option<HashMap<String, serde_json::Value>>,
355}
356
357impl common::ResponseResult for Operation {}
358
359/// 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/).
360///
361/// # Activities
362///
363/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
364/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
365///
366/// * [configs get iam policy projects](ProjectConfigGetIamPolicyCall) (response)
367/// * [configs set iam policy projects](ProjectConfigSetIamPolicyCall) (response)
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct Policy {
372    /// 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`.
373    pub bindings: Option<Vec<Binding>>,
374    /// `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.
375    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
376    pub etag: Option<Vec<u8>>,
377    /// 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).
378    pub version: Option<i32>,
379}
380
381impl common::ResponseResult for Policy {}
382
383/// A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig service. A RuntimeConfig resource consists of metadata and a hierarchy of variables.
384///
385/// # Activities
386///
387/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
388/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
389///
390/// * [configs create projects](ProjectConfigCreateCall) (request|response)
391/// * [configs get projects](ProjectConfigGetCall) (response)
392/// * [configs update projects](ProjectConfigUpdateCall) (request|response)
393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
394#[serde_with::serde_as]
395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
396pub struct RuntimeConfig {
397    /// An optional description of the RuntimeConfig object.
398    pub description: Option<String>,
399    /// The resource name of a runtime config. The name must have the format: projects/\[PROJECT_ID\]/configs/\[CONFIG_NAME\] The `[PROJECT_ID]` must be a valid project ID, and `[CONFIG_NAME]` is an arbitrary name that matches the `[0-9A-Za-z](?:[_.A-Za-z0-9-]{0,62}[_.A-Za-z0-9])?` regular expression. The length of `[CONFIG_NAME]` must be less than 64 characters. You pick the RuntimeConfig resource name, but the server will validate that the name adheres to this format. After you create the resource, you cannot change the resource’s name.
400    pub name: Option<String>,
401}
402
403impl common::RequestValue for RuntimeConfig {}
404impl common::ResponseResult for RuntimeConfig {}
405
406/// Request message for `SetIamPolicy` method.
407///
408/// # Activities
409///
410/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
411/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
412///
413/// * [configs set iam policy projects](ProjectConfigSetIamPolicyCall) (request)
414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
415#[serde_with::serde_as]
416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
417pub struct SetIamPolicyRequest {
418    /// 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.
419    pub policy: Option<Policy>,
420}
421
422impl common::RequestValue for SetIamPolicyRequest {}
423
424/// 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).
425///
426/// This type is not used in any activity, and only used as *part* of another schema.
427///
428#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
429#[serde_with::serde_as]
430#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
431pub struct Status {
432    /// The status code, which should be an enum value of google.rpc.Code.
433    pub code: Option<i32>,
434    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
435    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
436    /// 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.
437    pub message: Option<String>,
438}
439
440impl common::Part for Status {}
441
442/// Request message for `TestIamPermissions` method.
443///
444/// # Activities
445///
446/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
447/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
448///
449/// * [configs operations test iam permissions projects](ProjectConfigOperationTestIamPermissionCall) (request)
450/// * [configs variables test iam permissions projects](ProjectConfigVariableTestIamPermissionCall) (request)
451/// * [configs waiters test iam permissions projects](ProjectConfigWaiterTestIamPermissionCall) (request)
452/// * [configs test iam permissions projects](ProjectConfigTestIamPermissionCall) (request)
453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
454#[serde_with::serde_as]
455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
456pub struct TestIamPermissionsRequest {
457    /// 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).
458    pub permissions: Option<Vec<String>>,
459}
460
461impl common::RequestValue for TestIamPermissionsRequest {}
462
463/// Response message for `TestIamPermissions` method.
464///
465/// # Activities
466///
467/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
468/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
469///
470/// * [configs operations test iam permissions projects](ProjectConfigOperationTestIamPermissionCall) (response)
471/// * [configs variables test iam permissions projects](ProjectConfigVariableTestIamPermissionCall) (response)
472/// * [configs waiters test iam permissions projects](ProjectConfigWaiterTestIamPermissionCall) (response)
473/// * [configs test iam permissions projects](ProjectConfigTestIamPermissionCall) (response)
474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
475#[serde_with::serde_as]
476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
477pub struct TestIamPermissionsResponse {
478    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
479    pub permissions: Option<Vec<String>>,
480}
481
482impl common::ResponseResult for TestIamPermissionsResponse {}
483
484/// Describes a single variable within a RuntimeConfig resource. The name denotes the hierarchical variable name. For example, `ports/serving_port` is a valid variable name. The variable value is an opaque string and only leaf variables can have values (that is, variables that do not have any child variables).
485///
486/// # Activities
487///
488/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
489/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
490///
491/// * [configs variables create projects](ProjectConfigVariableCreateCall) (request|response)
492/// * [configs variables get projects](ProjectConfigVariableGetCall) (response)
493/// * [configs variables update projects](ProjectConfigVariableUpdateCall) (request|response)
494/// * [configs variables watch projects](ProjectConfigVariableWatchCall) (response)
495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
496#[serde_with::serde_as]
497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
498pub struct Variable {
499    /// The name of the variable resource, in the format: projects/\[PROJECT_ID\]/configs/\[CONFIG_NAME\]/variables/\[VARIABLE_NAME\] The `[PROJECT_ID]` must be a valid project ID, `[CONFIG_NAME]` must be a valid RuntimeConfig resource and `[VARIABLE_NAME]` follows Unix file system file path naming. The `[VARIABLE_NAME]` can contain ASCII letters, numbers, slashes and dashes. Slashes are used as path element separators and are not part of the `[VARIABLE_NAME]` itself, so `[VARIABLE_NAME]` must contain at least one non-slash character. Multiple slashes are coalesced into single slash character. Each path segment should match [0-9A-Za-z](?:[_.A-Za-z0-9-]{0,62}[_.A-Za-z0-9])? regular expression. The length of a `[VARIABLE_NAME]` must be less than 256 characters. Once you create a variable, you cannot change the variable name.
500    pub name: Option<String>,
501    /// Output only. The current state of the variable. The variable state indicates the outcome of the `variables().watch` call and is visible through the `get` and `list` calls.
502    pub state: Option<String>,
503    /// The string value of the variable. The length of the value must be less than 4096 bytes. Empty values are also accepted. For example, `text: "my text value"`. The string must be valid UTF-8.
504    pub text: Option<String>,
505    /// Output only. The time of the last variable update. Timestamp will be UTC timestamp.
506    #[serde(rename = "updateTime")]
507    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
508    /// The binary value of the variable. The length of the value must be less than 4096 bytes. Empty values are also accepted. The value must be base64 encoded, and must comply with IETF RFC4648 (https://www.ietf.org/rfc/rfc4648.txt). Only one of `value` or `text` can be set.
509    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
510    pub value: Option<Vec<u8>>,
511}
512
513impl common::RequestValue for Variable {}
514impl common::ResponseResult for Variable {}
515
516/// A Waiter resource waits for some end condition within a RuntimeConfig resource to be met before it returns. For example, assume you have a distributed system where each node writes to a Variable resource indicating the node’s readiness as part of the startup process. You then configure a Waiter resource with the success condition set to wait until some number of nodes have checked in. Afterwards, your application runs some arbitrary code after the condition has been met and the waiter returns successfully. Once created, a Waiter resource is immutable. To learn more about using waiters, read the [Creating a Waiter](https://cloud.google.com/deployment-manager/runtime-configurator/creating-a-waiter) documentation.
517///
518/// # Activities
519///
520/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
521/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
522///
523/// * [configs waiters create projects](ProjectConfigWaiterCreateCall) (request)
524/// * [configs waiters get projects](ProjectConfigWaiterGetCall) (response)
525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
526#[serde_with::serde_as]
527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
528pub struct Waiter {
529    /// Output only. The instant at which this Waiter resource was created. Adding the value of `timeout` to this instant yields the timeout deadline for the waiter.
530    #[serde(rename = "createTime")]
531    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
532    /// Output only. If the value is `false`, it means the waiter is still waiting for one of its conditions to be met. If true, the waiter has finished. If the waiter finished due to a timeout or failure, `error` will be set.
533    pub done: Option<bool>,
534    /// Output only. If the waiter ended due to a failure or timeout, this value will be set.
535    pub error: Option<Status>,
536    /// [Optional] The failure condition of this waiter. If this condition is met, `done` will be set to `true` and the `error` code will be set to `ABORTED`. The failure condition takes precedence over the success condition. If both conditions are met, a failure will be indicated. This value is optional; if no failure condition is set, the only failure scenario will be a timeout.
537    pub failure: Option<EndCondition>,
538    /// The name of the Waiter resource, in the format: projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME] The `[PROJECT_ID]` must be a valid Google Cloud project ID, the `[CONFIG_NAME]` must be a valid RuntimeConfig resource, the `[WAITER_NAME]` must match RFC 1035 segment specification, and the length of `[WAITER_NAME]` must be less than 64 bytes. After you create a Waiter resource, you cannot change the resource name.
539    pub name: Option<String>,
540    /// [Required] The success condition. If this condition is met, `done` will be set to `true` and the `error` value will remain unset. The failure condition takes precedence over the success condition. If both conditions are met, a failure will be indicated.
541    pub success: Option<EndCondition>,
542    /// [Required] Specifies the timeout of the waiter in seconds, beginning from the instant that `waiters().create` method is called. If this time elapses before the success or failure conditions are met, the waiter fails and sets the `error` code to `DEADLINE_EXCEEDED`.
543    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
544    pub timeout: Option<chrono::Duration>,
545}
546
547impl common::RequestValue for Waiter {}
548impl common::ResponseResult for Waiter {}
549
550/// Request for the `WatchVariable()` method.
551///
552/// # Activities
553///
554/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
555/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
556///
557/// * [configs variables watch projects](ProjectConfigVariableWatchCall) (request)
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct WatchVariableRequest {
562    /// If specified, checks the current timestamp of the variable and if the current timestamp is newer than `newerThan` timestamp, the method returns immediately. If not specified or the variable has an older timestamp, the watcher waits for a the value to change before returning.
563    #[serde(rename = "newerThan")]
564    pub newer_than: Option<chrono::DateTime<chrono::offset::Utc>>,
565}
566
567impl common::RequestValue for WatchVariableRequest {}
568
569// ###################
570// MethodBuilders ###
571// #################
572
573/// A builder providing access to all methods supported on *project* resources.
574/// It is not used directly, but through the [`CloudRuntimeConfig`] hub.
575///
576/// # Example
577///
578/// Instantiate a resource builder
579///
580/// ```test_harness,no_run
581/// extern crate hyper;
582/// extern crate hyper_rustls;
583/// extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
584///
585/// # async fn dox() {
586/// use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
587///
588/// let secret: yup_oauth2::ApplicationSecret = Default::default();
589/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
590///     .with_native_roots()
591///     .unwrap()
592///     .https_only()
593///     .enable_http2()
594///     .build();
595///
596/// let executor = hyper_util::rt::TokioExecutor::new();
597/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
598///     secret,
599///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
600///     yup_oauth2::client::CustomHyperClientBuilder::from(
601///         hyper_util::client::legacy::Client::builder(executor).build(connector),
602///     ),
603/// ).build().await.unwrap();
604///
605/// let client = hyper_util::client::legacy::Client::builder(
606///     hyper_util::rt::TokioExecutor::new()
607/// )
608/// .build(
609///     hyper_rustls::HttpsConnectorBuilder::new()
610///         .with_native_roots()
611///         .unwrap()
612///         .https_or_http()
613///         .enable_http2()
614///         .build()
615/// );
616/// let mut hub = CloudRuntimeConfig::new(client, auth);
617/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
618/// // like `configs_create(...)`, `configs_delete(...)`, `configs_get(...)`, `configs_get_iam_policy(...)`, `configs_list(...)`, `configs_operations_get(...)`, `configs_operations_test_iam_permissions(...)`, `configs_set_iam_policy(...)`, `configs_test_iam_permissions(...)`, `configs_update(...)`, `configs_variables_create(...)`, `configs_variables_delete(...)`, `configs_variables_get(...)`, `configs_variables_list(...)`, `configs_variables_test_iam_permissions(...)`, `configs_variables_update(...)`, `configs_variables_watch(...)`, `configs_waiters_create(...)`, `configs_waiters_delete(...)`, `configs_waiters_get(...)`, `configs_waiters_list(...)` and `configs_waiters_test_iam_permissions(...)`
619/// // to build up your call.
620/// let rb = hub.projects();
621/// # }
622/// ```
623pub struct ProjectMethods<'a, C>
624where
625    C: 'a,
626{
627    hub: &'a CloudRuntimeConfig<C>,
628}
629
630impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
631
632impl<'a, C> ProjectMethods<'a, C> {
633    /// Create a builder to help you perform the following task:
634    ///
635    /// 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.
636    ///
637    /// # Arguments
638    ///
639    /// * `name` - The name of the operation resource.
640    pub fn configs_operations_get(&self, name: &str) -> ProjectConfigOperationGetCall<'a, C> {
641        ProjectConfigOperationGetCall {
642            hub: self.hub,
643            _name: name.to_string(),
644            _delegate: Default::default(),
645            _additional_params: Default::default(),
646            _scopes: Default::default(),
647        }
648    }
649
650    /// Create a builder to help you perform the following task:
651    ///
652    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
653    ///
654    /// # Arguments
655    ///
656    /// * `request` - No description provided.
657    /// * `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.
658    pub fn configs_operations_test_iam_permissions(
659        &self,
660        request: TestIamPermissionsRequest,
661        resource: &str,
662    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C> {
663        ProjectConfigOperationTestIamPermissionCall {
664            hub: self.hub,
665            _request: request,
666            _resource: resource.to_string(),
667            _delegate: Default::default(),
668            _additional_params: Default::default(),
669            _scopes: Default::default(),
670        }
671    }
672
673    /// Create a builder to help you perform the following task:
674    ///
675    /// Creates a variable within the given configuration. You cannot create a variable with a name that is a prefix of an existing variable name, or a name that has an existing variable name as a prefix. To learn more about creating a variable, read the [Setting and Getting Data](https://cloud.google.com/deployment-manager/runtime-configurator/set-and-get-variables) documentation.
676    ///
677    /// # Arguments
678    ///
679    /// * `request` - No description provided.
680    /// * `parent` - The path to the RutimeConfig resource that this variable should belong to. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
681    pub fn configs_variables_create(
682        &self,
683        request: Variable,
684        parent: &str,
685    ) -> ProjectConfigVariableCreateCall<'a, C> {
686        ProjectConfigVariableCreateCall {
687            hub: self.hub,
688            _request: request,
689            _parent: parent.to_string(),
690            _request_id: Default::default(),
691            _delegate: Default::default(),
692            _additional_params: Default::default(),
693            _scopes: Default::default(),
694        }
695    }
696
697    /// Create a builder to help you perform the following task:
698    ///
699    /// Deletes a variable or multiple variables. If you specify a variable name, then that variable is deleted. If you specify a prefix and `recursive` is true, then all variables with that prefix are deleted. You must set a `recursive` to true if you delete variables by prefix.
700    ///
701    /// # Arguments
702    ///
703    /// * `name` - The name of the variable to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`
704    pub fn configs_variables_delete(&self, name: &str) -> ProjectConfigVariableDeleteCall<'a, C> {
705        ProjectConfigVariableDeleteCall {
706            hub: self.hub,
707            _name: name.to_string(),
708            _recursive: Default::default(),
709            _delegate: Default::default(),
710            _additional_params: Default::default(),
711            _scopes: Default::default(),
712        }
713    }
714
715    /// Create a builder to help you perform the following task:
716    ///
717    /// Gets information about a single variable.
718    ///
719    /// # Arguments
720    ///
721    /// * `name` - The name of the variable to return, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIBLE_NAME]`
722    pub fn configs_variables_get(&self, name: &str) -> ProjectConfigVariableGetCall<'a, C> {
723        ProjectConfigVariableGetCall {
724            hub: self.hub,
725            _name: name.to_string(),
726            _delegate: Default::default(),
727            _additional_params: Default::default(),
728            _scopes: Default::default(),
729        }
730    }
731
732    /// Create a builder to help you perform the following task:
733    ///
734    /// Lists variables within given a configuration, matching any provided filters. This only lists variable names, not the values, unless `return_values` is true, in which case only variables that user has IAM permission to GetVariable will be returned.
735    ///
736    /// # Arguments
737    ///
738    /// * `parent` - The path to the RuntimeConfig resource for which you want to list variables. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
739    pub fn configs_variables_list(&self, parent: &str) -> ProjectConfigVariableListCall<'a, C> {
740        ProjectConfigVariableListCall {
741            hub: self.hub,
742            _parent: parent.to_string(),
743            _return_values: Default::default(),
744            _page_token: Default::default(),
745            _page_size: Default::default(),
746            _filter: Default::default(),
747            _delegate: Default::default(),
748            _additional_params: Default::default(),
749            _scopes: Default::default(),
750        }
751    }
752
753    /// Create a builder to help you perform the following task:
754    ///
755    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
756    ///
757    /// # Arguments
758    ///
759    /// * `request` - No description provided.
760    /// * `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.
761    pub fn configs_variables_test_iam_permissions(
762        &self,
763        request: TestIamPermissionsRequest,
764        resource: &str,
765    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C> {
766        ProjectConfigVariableTestIamPermissionCall {
767            hub: self.hub,
768            _request: request,
769            _resource: resource.to_string(),
770            _delegate: Default::default(),
771            _additional_params: Default::default(),
772            _scopes: Default::default(),
773        }
774    }
775
776    /// Create a builder to help you perform the following task:
777    ///
778    /// Updates an existing variable with a new value.
779    ///
780    /// # Arguments
781    ///
782    /// * `request` - No description provided.
783    /// * `name` - The name of the variable to update, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`
784    pub fn configs_variables_update(
785        &self,
786        request: Variable,
787        name: &str,
788    ) -> ProjectConfigVariableUpdateCall<'a, C> {
789        ProjectConfigVariableUpdateCall {
790            hub: self.hub,
791            _request: request,
792            _name: name.to_string(),
793            _delegate: Default::default(),
794            _additional_params: Default::default(),
795            _scopes: Default::default(),
796        }
797    }
798
799    /// Create a builder to help you perform the following task:
800    ///
801    /// Watches a specific variable and waits for a change in the variable’s value. When there is a change, this method returns the new value or times out. If a variable is deleted while being watched, the `variableState` state is set to `DELETED` and the method returns the last known variable `value`. If you set the deadline for watching to a larger value than internal timeout (60 seconds), the current variable value is returned and the `variableState` will be `VARIABLE_STATE_UNSPECIFIED`. To learn more about creating a watcher, read the [Watching a Variable for Changes](https://cloud.google.com/deployment-manager/runtime-configurator/watching-a-variable) documentation.
802    ///
803    /// # Arguments
804    ///
805    /// * `request` - No description provided.
806    /// * `name` - The name of the variable to watch, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
807    pub fn configs_variables_watch(
808        &self,
809        request: WatchVariableRequest,
810        name: &str,
811    ) -> ProjectConfigVariableWatchCall<'a, C> {
812        ProjectConfigVariableWatchCall {
813            hub: self.hub,
814            _request: request,
815            _name: name.to_string(),
816            _delegate: Default::default(),
817            _additional_params: Default::default(),
818            _scopes: Default::default(),
819        }
820    }
821
822    /// Create a builder to help you perform the following task:
823    ///
824    /// Creates a Waiter resource. This operation returns a long-running Operation resource which can be polled for completion. However, a waiter with the given name will exist (and can be retrieved) prior to the operation completing. If the operation fails, the failed Waiter resource will still exist and must be deleted prior to subsequent creation attempts.
825    ///
826    /// # Arguments
827    ///
828    /// * `request` - No description provided.
829    /// * `parent` - The path to the configuration that will own the waiter. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`.
830    pub fn configs_waiters_create(
831        &self,
832        request: Waiter,
833        parent: &str,
834    ) -> ProjectConfigWaiterCreateCall<'a, C> {
835        ProjectConfigWaiterCreateCall {
836            hub: self.hub,
837            _request: request,
838            _parent: parent.to_string(),
839            _request_id: Default::default(),
840            _delegate: Default::default(),
841            _additional_params: Default::default(),
842            _scopes: Default::default(),
843        }
844    }
845
846    /// Create a builder to help you perform the following task:
847    ///
848    /// Deletes the waiter with the specified name.
849    ///
850    /// # Arguments
851    ///
852    /// * `name` - The Waiter resource to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`
853    pub fn configs_waiters_delete(&self, name: &str) -> ProjectConfigWaiterDeleteCall<'a, C> {
854        ProjectConfigWaiterDeleteCall {
855            hub: self.hub,
856            _name: name.to_string(),
857            _delegate: Default::default(),
858            _additional_params: Default::default(),
859            _scopes: Default::default(),
860        }
861    }
862
863    /// Create a builder to help you perform the following task:
864    ///
865    /// Gets information about a single waiter.
866    ///
867    /// # Arguments
868    ///
869    /// * `name` - The fully-qualified name of the Waiter resource object to retrieve, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`
870    pub fn configs_waiters_get(&self, name: &str) -> ProjectConfigWaiterGetCall<'a, C> {
871        ProjectConfigWaiterGetCall {
872            hub: self.hub,
873            _name: name.to_string(),
874            _delegate: Default::default(),
875            _additional_params: Default::default(),
876            _scopes: Default::default(),
877        }
878    }
879
880    /// Create a builder to help you perform the following task:
881    ///
882    /// List waiters within the given configuration.
883    ///
884    /// # Arguments
885    ///
886    /// * `parent` - The path to the configuration for which you want to get a list of waiters. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
887    pub fn configs_waiters_list(&self, parent: &str) -> ProjectConfigWaiterListCall<'a, C> {
888        ProjectConfigWaiterListCall {
889            hub: self.hub,
890            _parent: parent.to_string(),
891            _page_token: Default::default(),
892            _page_size: Default::default(),
893            _delegate: Default::default(),
894            _additional_params: Default::default(),
895            _scopes: Default::default(),
896        }
897    }
898
899    /// Create a builder to help you perform the following task:
900    ///
901    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
902    ///
903    /// # Arguments
904    ///
905    /// * `request` - No description provided.
906    /// * `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.
907    pub fn configs_waiters_test_iam_permissions(
908        &self,
909        request: TestIamPermissionsRequest,
910        resource: &str,
911    ) -> ProjectConfigWaiterTestIamPermissionCall<'a, C> {
912        ProjectConfigWaiterTestIamPermissionCall {
913            hub: self.hub,
914            _request: request,
915            _resource: resource.to_string(),
916            _delegate: Default::default(),
917            _additional_params: Default::default(),
918            _scopes: Default::default(),
919        }
920    }
921
922    /// Create a builder to help you perform the following task:
923    ///
924    /// Creates a new RuntimeConfig resource. The configuration name must be unique within project.
925    ///
926    /// # Arguments
927    ///
928    /// * `request` - No description provided.
929    /// * `parent` - The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) for this request, in the format `projects/[PROJECT_ID]`.
930    pub fn configs_create(
931        &self,
932        request: RuntimeConfig,
933        parent: &str,
934    ) -> ProjectConfigCreateCall<'a, C> {
935        ProjectConfigCreateCall {
936            hub: self.hub,
937            _request: request,
938            _parent: parent.to_string(),
939            _request_id: Default::default(),
940            _delegate: Default::default(),
941            _additional_params: Default::default(),
942            _scopes: Default::default(),
943        }
944    }
945
946    /// Create a builder to help you perform the following task:
947    ///
948    /// Deletes a RuntimeConfig resource.
949    ///
950    /// # Arguments
951    ///
952    /// * `name` - The RuntimeConfig resource to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
953    pub fn configs_delete(&self, name: &str) -> ProjectConfigDeleteCall<'a, C> {
954        ProjectConfigDeleteCall {
955            hub: self.hub,
956            _name: name.to_string(),
957            _delegate: Default::default(),
958            _additional_params: Default::default(),
959            _scopes: Default::default(),
960        }
961    }
962
963    /// Create a builder to help you perform the following task:
964    ///
965    /// Gets information about a RuntimeConfig resource.
966    ///
967    /// # Arguments
968    ///
969    /// * `name` - The name of the RuntimeConfig resource to retrieve, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
970    pub fn configs_get(&self, name: &str) -> ProjectConfigGetCall<'a, C> {
971        ProjectConfigGetCall {
972            hub: self.hub,
973            _name: name.to_string(),
974            _delegate: Default::default(),
975            _additional_params: Default::default(),
976            _scopes: Default::default(),
977        }
978    }
979
980    /// Create a builder to help you perform the following task:
981    ///
982    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
983    ///
984    /// # Arguments
985    ///
986    /// * `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.
987    pub fn configs_get_iam_policy(&self, resource: &str) -> ProjectConfigGetIamPolicyCall<'a, C> {
988        ProjectConfigGetIamPolicyCall {
989            hub: self.hub,
990            _resource: resource.to_string(),
991            _options_requested_policy_version: Default::default(),
992            _delegate: Default::default(),
993            _additional_params: Default::default(),
994            _scopes: Default::default(),
995        }
996    }
997
998    /// Create a builder to help you perform the following task:
999    ///
1000    /// Lists all the RuntimeConfig resources within project.
1001    ///
1002    /// # Arguments
1003    ///
1004    /// * `parent` - The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) for this request, in the format `projects/[PROJECT_ID]`.
1005    pub fn configs_list(&self, parent: &str) -> ProjectConfigListCall<'a, C> {
1006        ProjectConfigListCall {
1007            hub: self.hub,
1008            _parent: parent.to_string(),
1009            _page_token: Default::default(),
1010            _page_size: Default::default(),
1011            _delegate: Default::default(),
1012            _additional_params: Default::default(),
1013            _scopes: Default::default(),
1014        }
1015    }
1016
1017    /// Create a builder to help you perform the following task:
1018    ///
1019    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1020    ///
1021    /// # Arguments
1022    ///
1023    /// * `request` - No description provided.
1024    /// * `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.
1025    pub fn configs_set_iam_policy(
1026        &self,
1027        request: SetIamPolicyRequest,
1028        resource: &str,
1029    ) -> ProjectConfigSetIamPolicyCall<'a, C> {
1030        ProjectConfigSetIamPolicyCall {
1031            hub: self.hub,
1032            _request: request,
1033            _resource: resource.to_string(),
1034            _delegate: Default::default(),
1035            _additional_params: Default::default(),
1036            _scopes: Default::default(),
1037        }
1038    }
1039
1040    /// Create a builder to help you perform the following task:
1041    ///
1042    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1043    ///
1044    /// # Arguments
1045    ///
1046    /// * `request` - No description provided.
1047    /// * `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.
1048    pub fn configs_test_iam_permissions(
1049        &self,
1050        request: TestIamPermissionsRequest,
1051        resource: &str,
1052    ) -> ProjectConfigTestIamPermissionCall<'a, C> {
1053        ProjectConfigTestIamPermissionCall {
1054            hub: self.hub,
1055            _request: request,
1056            _resource: resource.to_string(),
1057            _delegate: Default::default(),
1058            _additional_params: Default::default(),
1059            _scopes: Default::default(),
1060        }
1061    }
1062
1063    /// Create a builder to help you perform the following task:
1064    ///
1065    /// Updates a RuntimeConfig resource. The configuration must exist beforehand.
1066    ///
1067    /// # Arguments
1068    ///
1069    /// * `request` - No description provided.
1070    /// * `name` - The name of the RuntimeConfig resource to update, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
1071    pub fn configs_update(
1072        &self,
1073        request: RuntimeConfig,
1074        name: &str,
1075    ) -> ProjectConfigUpdateCall<'a, C> {
1076        ProjectConfigUpdateCall {
1077            hub: self.hub,
1078            _request: request,
1079            _name: name.to_string(),
1080            _delegate: Default::default(),
1081            _additional_params: Default::default(),
1082            _scopes: Default::default(),
1083        }
1084    }
1085}
1086
1087// ###################
1088// CallBuilders   ###
1089// #################
1090
1091/// 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.
1092///
1093/// A builder for the *configs.operations.get* method supported by a *project* resource.
1094/// It is not used directly, but through a [`ProjectMethods`] instance.
1095///
1096/// # Example
1097///
1098/// Instantiate a resource method builder
1099///
1100/// ```test_harness,no_run
1101/// # extern crate hyper;
1102/// # extern crate hyper_rustls;
1103/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
1104/// # async fn dox() {
1105/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1106///
1107/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1108/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1109/// #     .with_native_roots()
1110/// #     .unwrap()
1111/// #     .https_only()
1112/// #     .enable_http2()
1113/// #     .build();
1114///
1115/// # let executor = hyper_util::rt::TokioExecutor::new();
1116/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1117/// #     secret,
1118/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1119/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1120/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1121/// #     ),
1122/// # ).build().await.unwrap();
1123///
1124/// # let client = hyper_util::client::legacy::Client::builder(
1125/// #     hyper_util::rt::TokioExecutor::new()
1126/// # )
1127/// # .build(
1128/// #     hyper_rustls::HttpsConnectorBuilder::new()
1129/// #         .with_native_roots()
1130/// #         .unwrap()
1131/// #         .https_or_http()
1132/// #         .enable_http2()
1133/// #         .build()
1134/// # );
1135/// # let mut hub = CloudRuntimeConfig::new(client, auth);
1136/// // You can configure optional parameters by calling the respective setters at will, and
1137/// // execute the final call using `doit()`.
1138/// // Values shown here are possibly random and not representative !
1139/// let result = hub.projects().configs_operations_get("name")
1140///              .doit().await;
1141/// # }
1142/// ```
1143pub struct ProjectConfigOperationGetCall<'a, C>
1144where
1145    C: 'a,
1146{
1147    hub: &'a CloudRuntimeConfig<C>,
1148    _name: String,
1149    _delegate: Option<&'a mut dyn common::Delegate>,
1150    _additional_params: HashMap<String, String>,
1151    _scopes: BTreeSet<String>,
1152}
1153
1154impl<'a, C> common::CallBuilder for ProjectConfigOperationGetCall<'a, C> {}
1155
1156impl<'a, C> ProjectConfigOperationGetCall<'a, C>
1157where
1158    C: common::Connector,
1159{
1160    /// Perform the operation you have build so far.
1161    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1162        use std::borrow::Cow;
1163        use std::io::{Read, Seek};
1164
1165        use common::{url::Params, ToParts};
1166        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1167
1168        let mut dd = common::DefaultDelegate;
1169        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1170        dlg.begin(common::MethodInfo {
1171            id: "runtimeconfig.projects.configs.operations.get",
1172            http_method: hyper::Method::GET,
1173        });
1174
1175        for &field in ["alt", "name"].iter() {
1176            if self._additional_params.contains_key(field) {
1177                dlg.finished(false);
1178                return Err(common::Error::FieldClash(field));
1179            }
1180        }
1181
1182        let mut params = Params::with_capacity(3 + self._additional_params.len());
1183        params.push("name", self._name);
1184
1185        params.extend(self._additional_params.iter());
1186
1187        params.push("alt", "json");
1188        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1189        if self._scopes.is_empty() {
1190            self._scopes
1191                .insert(Scope::CloudPlatform.as_ref().to_string());
1192        }
1193
1194        #[allow(clippy::single_element_loop)]
1195        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1196            url = params.uri_replacement(url, param_name, find_this, true);
1197        }
1198        {
1199            let to_remove = ["name"];
1200            params.remove_params(&to_remove);
1201        }
1202
1203        let url = params.parse_with_url(&url);
1204
1205        loop {
1206            let token = match self
1207                .hub
1208                .auth
1209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1210                .await
1211            {
1212                Ok(token) => token,
1213                Err(e) => match dlg.token(e) {
1214                    Ok(token) => token,
1215                    Err(e) => {
1216                        dlg.finished(false);
1217                        return Err(common::Error::MissingToken(e));
1218                    }
1219                },
1220            };
1221            let mut req_result = {
1222                let client = &self.hub.client;
1223                dlg.pre_request();
1224                let mut req_builder = hyper::Request::builder()
1225                    .method(hyper::Method::GET)
1226                    .uri(url.as_str())
1227                    .header(USER_AGENT, self.hub._user_agent.clone());
1228
1229                if let Some(token) = token.as_ref() {
1230                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1231                }
1232
1233                let request = req_builder
1234                    .header(CONTENT_LENGTH, 0_u64)
1235                    .body(common::to_body::<String>(None));
1236
1237                client.request(request.unwrap()).await
1238            };
1239
1240            match req_result {
1241                Err(err) => {
1242                    if let common::Retry::After(d) = dlg.http_error(&err) {
1243                        sleep(d).await;
1244                        continue;
1245                    }
1246                    dlg.finished(false);
1247                    return Err(common::Error::HttpError(err));
1248                }
1249                Ok(res) => {
1250                    let (mut parts, body) = res.into_parts();
1251                    let mut body = common::Body::new(body);
1252                    if !parts.status.is_success() {
1253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1254                        let error = serde_json::from_str(&common::to_string(&bytes));
1255                        let response = common::to_response(parts, bytes.into());
1256
1257                        if let common::Retry::After(d) =
1258                            dlg.http_failure(&response, error.as_ref().ok())
1259                        {
1260                            sleep(d).await;
1261                            continue;
1262                        }
1263
1264                        dlg.finished(false);
1265
1266                        return Err(match error {
1267                            Ok(value) => common::Error::BadRequest(value),
1268                            _ => common::Error::Failure(response),
1269                        });
1270                    }
1271                    let response = {
1272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1273                        let encoded = common::to_string(&bytes);
1274                        match serde_json::from_str(&encoded) {
1275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1276                            Err(error) => {
1277                                dlg.response_json_decode_error(&encoded, &error);
1278                                return Err(common::Error::JsonDecodeError(
1279                                    encoded.to_string(),
1280                                    error,
1281                                ));
1282                            }
1283                        }
1284                    };
1285
1286                    dlg.finished(true);
1287                    return Ok(response);
1288                }
1289            }
1290        }
1291    }
1292
1293    /// The name of the operation resource.
1294    ///
1295    /// Sets the *name* path property to the given value.
1296    ///
1297    /// Even though the property as already been set when instantiating this call,
1298    /// we provide this method for API completeness.
1299    pub fn name(mut self, new_value: &str) -> ProjectConfigOperationGetCall<'a, C> {
1300        self._name = new_value.to_string();
1301        self
1302    }
1303    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1304    /// while executing the actual API request.
1305    ///
1306    /// ````text
1307    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1308    /// ````
1309    ///
1310    /// Sets the *delegate* property to the given value.
1311    pub fn delegate(
1312        mut self,
1313        new_value: &'a mut dyn common::Delegate,
1314    ) -> ProjectConfigOperationGetCall<'a, C> {
1315        self._delegate = Some(new_value);
1316        self
1317    }
1318
1319    /// Set any additional parameter of the query string used in the request.
1320    /// It should be used to set parameters which are not yet available through their own
1321    /// setters.
1322    ///
1323    /// Please note that this method must not be used to set any of the known parameters
1324    /// which have their own setter method. If done anyway, the request will fail.
1325    ///
1326    /// # Additional Parameters
1327    ///
1328    /// * *$.xgafv* (query-string) - V1 error format.
1329    /// * *access_token* (query-string) - OAuth access token.
1330    /// * *alt* (query-string) - Data format for response.
1331    /// * *callback* (query-string) - JSONP
1332    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1333    /// * *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.
1334    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1335    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1336    /// * *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.
1337    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1338    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1339    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigOperationGetCall<'a, C>
1340    where
1341        T: AsRef<str>,
1342    {
1343        self._additional_params
1344            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1345        self
1346    }
1347
1348    /// Identifies the authorization scope for the method you are building.
1349    ///
1350    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1351    /// [`Scope::CloudPlatform`].
1352    ///
1353    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1354    /// tokens for more than one scope.
1355    ///
1356    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1357    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1358    /// sufficient, a read-write scope will do as well.
1359    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigOperationGetCall<'a, C>
1360    where
1361        St: AsRef<str>,
1362    {
1363        self._scopes.insert(String::from(scope.as_ref()));
1364        self
1365    }
1366    /// Identifies the authorization scope(s) for the method you are building.
1367    ///
1368    /// See [`Self::add_scope()`] for details.
1369    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigOperationGetCall<'a, C>
1370    where
1371        I: IntoIterator<Item = St>,
1372        St: AsRef<str>,
1373    {
1374        self._scopes
1375            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1376        self
1377    }
1378
1379    /// Removes all scopes, and no default scope will be used either.
1380    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1381    /// for details).
1382    pub fn clear_scopes(mut self) -> ProjectConfigOperationGetCall<'a, C> {
1383        self._scopes.clear();
1384        self
1385    }
1386}
1387
1388/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
1389///
1390/// A builder for the *configs.operations.testIamPermissions* method supported by a *project* resource.
1391/// It is not used directly, but through a [`ProjectMethods`] instance.
1392///
1393/// # Example
1394///
1395/// Instantiate a resource method builder
1396///
1397/// ```test_harness,no_run
1398/// # extern crate hyper;
1399/// # extern crate hyper_rustls;
1400/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
1401/// use runtimeconfig1_beta1::api::TestIamPermissionsRequest;
1402/// # async fn dox() {
1403/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1404///
1405/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1406/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1407/// #     .with_native_roots()
1408/// #     .unwrap()
1409/// #     .https_only()
1410/// #     .enable_http2()
1411/// #     .build();
1412///
1413/// # let executor = hyper_util::rt::TokioExecutor::new();
1414/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1415/// #     secret,
1416/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1417/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1418/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1419/// #     ),
1420/// # ).build().await.unwrap();
1421///
1422/// # let client = hyper_util::client::legacy::Client::builder(
1423/// #     hyper_util::rt::TokioExecutor::new()
1424/// # )
1425/// # .build(
1426/// #     hyper_rustls::HttpsConnectorBuilder::new()
1427/// #         .with_native_roots()
1428/// #         .unwrap()
1429/// #         .https_or_http()
1430/// #         .enable_http2()
1431/// #         .build()
1432/// # );
1433/// # let mut hub = CloudRuntimeConfig::new(client, auth);
1434/// // As the method needs a request, you would usually fill it with the desired information
1435/// // into the respective structure. Some of the parts shown here might not be applicable !
1436/// // Values shown here are possibly random and not representative !
1437/// let mut req = TestIamPermissionsRequest::default();
1438///
1439/// // You can configure optional parameters by calling the respective setters at will, and
1440/// // execute the final call using `doit()`.
1441/// // Values shown here are possibly random and not representative !
1442/// let result = hub.projects().configs_operations_test_iam_permissions(req, "resource")
1443///              .doit().await;
1444/// # }
1445/// ```
1446pub struct ProjectConfigOperationTestIamPermissionCall<'a, C>
1447where
1448    C: 'a,
1449{
1450    hub: &'a CloudRuntimeConfig<C>,
1451    _request: TestIamPermissionsRequest,
1452    _resource: String,
1453    _delegate: Option<&'a mut dyn common::Delegate>,
1454    _additional_params: HashMap<String, String>,
1455    _scopes: BTreeSet<String>,
1456}
1457
1458impl<'a, C> common::CallBuilder for ProjectConfigOperationTestIamPermissionCall<'a, C> {}
1459
1460impl<'a, C> ProjectConfigOperationTestIamPermissionCall<'a, C>
1461where
1462    C: common::Connector,
1463{
1464    /// Perform the operation you have build so far.
1465    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
1466        use std::borrow::Cow;
1467        use std::io::{Read, Seek};
1468
1469        use common::{url::Params, ToParts};
1470        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1471
1472        let mut dd = common::DefaultDelegate;
1473        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1474        dlg.begin(common::MethodInfo {
1475            id: "runtimeconfig.projects.configs.operations.testIamPermissions",
1476            http_method: hyper::Method::POST,
1477        });
1478
1479        for &field in ["alt", "resource"].iter() {
1480            if self._additional_params.contains_key(field) {
1481                dlg.finished(false);
1482                return Err(common::Error::FieldClash(field));
1483            }
1484        }
1485
1486        let mut params = Params::with_capacity(4 + self._additional_params.len());
1487        params.push("resource", self._resource);
1488
1489        params.extend(self._additional_params.iter());
1490
1491        params.push("alt", "json");
1492        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
1493        if self._scopes.is_empty() {
1494            self._scopes
1495                .insert(Scope::CloudPlatform.as_ref().to_string());
1496        }
1497
1498        #[allow(clippy::single_element_loop)]
1499        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
1500            url = params.uri_replacement(url, param_name, find_this, true);
1501        }
1502        {
1503            let to_remove = ["resource"];
1504            params.remove_params(&to_remove);
1505        }
1506
1507        let url = params.parse_with_url(&url);
1508
1509        let mut json_mime_type = mime::APPLICATION_JSON;
1510        let mut request_value_reader = {
1511            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1512            common::remove_json_null_values(&mut value);
1513            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1514            serde_json::to_writer(&mut dst, &value).unwrap();
1515            dst
1516        };
1517        let request_size = request_value_reader
1518            .seek(std::io::SeekFrom::End(0))
1519            .unwrap();
1520        request_value_reader
1521            .seek(std::io::SeekFrom::Start(0))
1522            .unwrap();
1523
1524        loop {
1525            let token = match self
1526                .hub
1527                .auth
1528                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1529                .await
1530            {
1531                Ok(token) => token,
1532                Err(e) => match dlg.token(e) {
1533                    Ok(token) => token,
1534                    Err(e) => {
1535                        dlg.finished(false);
1536                        return Err(common::Error::MissingToken(e));
1537                    }
1538                },
1539            };
1540            request_value_reader
1541                .seek(std::io::SeekFrom::Start(0))
1542                .unwrap();
1543            let mut req_result = {
1544                let client = &self.hub.client;
1545                dlg.pre_request();
1546                let mut req_builder = hyper::Request::builder()
1547                    .method(hyper::Method::POST)
1548                    .uri(url.as_str())
1549                    .header(USER_AGENT, self.hub._user_agent.clone());
1550
1551                if let Some(token) = token.as_ref() {
1552                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1553                }
1554
1555                let request = req_builder
1556                    .header(CONTENT_TYPE, json_mime_type.to_string())
1557                    .header(CONTENT_LENGTH, request_size as u64)
1558                    .body(common::to_body(
1559                        request_value_reader.get_ref().clone().into(),
1560                    ));
1561
1562                client.request(request.unwrap()).await
1563            };
1564
1565            match req_result {
1566                Err(err) => {
1567                    if let common::Retry::After(d) = dlg.http_error(&err) {
1568                        sleep(d).await;
1569                        continue;
1570                    }
1571                    dlg.finished(false);
1572                    return Err(common::Error::HttpError(err));
1573                }
1574                Ok(res) => {
1575                    let (mut parts, body) = res.into_parts();
1576                    let mut body = common::Body::new(body);
1577                    if !parts.status.is_success() {
1578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1579                        let error = serde_json::from_str(&common::to_string(&bytes));
1580                        let response = common::to_response(parts, bytes.into());
1581
1582                        if let common::Retry::After(d) =
1583                            dlg.http_failure(&response, error.as_ref().ok())
1584                        {
1585                            sleep(d).await;
1586                            continue;
1587                        }
1588
1589                        dlg.finished(false);
1590
1591                        return Err(match error {
1592                            Ok(value) => common::Error::BadRequest(value),
1593                            _ => common::Error::Failure(response),
1594                        });
1595                    }
1596                    let response = {
1597                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1598                        let encoded = common::to_string(&bytes);
1599                        match serde_json::from_str(&encoded) {
1600                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1601                            Err(error) => {
1602                                dlg.response_json_decode_error(&encoded, &error);
1603                                return Err(common::Error::JsonDecodeError(
1604                                    encoded.to_string(),
1605                                    error,
1606                                ));
1607                            }
1608                        }
1609                    };
1610
1611                    dlg.finished(true);
1612                    return Ok(response);
1613                }
1614            }
1615        }
1616    }
1617
1618    ///
1619    /// Sets the *request* property to the given value.
1620    ///
1621    /// Even though the property as already been set when instantiating this call,
1622    /// we provide this method for API completeness.
1623    pub fn request(
1624        mut self,
1625        new_value: TestIamPermissionsRequest,
1626    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C> {
1627        self._request = new_value;
1628        self
1629    }
1630    /// 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.
1631    ///
1632    /// Sets the *resource* path property to the given value.
1633    ///
1634    /// Even though the property as already been set when instantiating this call,
1635    /// we provide this method for API completeness.
1636    pub fn resource(
1637        mut self,
1638        new_value: &str,
1639    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C> {
1640        self._resource = new_value.to_string();
1641        self
1642    }
1643    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1644    /// while executing the actual API request.
1645    ///
1646    /// ````text
1647    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1648    /// ````
1649    ///
1650    /// Sets the *delegate* property to the given value.
1651    pub fn delegate(
1652        mut self,
1653        new_value: &'a mut dyn common::Delegate,
1654    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C> {
1655        self._delegate = Some(new_value);
1656        self
1657    }
1658
1659    /// Set any additional parameter of the query string used in the request.
1660    /// It should be used to set parameters which are not yet available through their own
1661    /// setters.
1662    ///
1663    /// Please note that this method must not be used to set any of the known parameters
1664    /// which have their own setter method. If done anyway, the request will fail.
1665    ///
1666    /// # Additional Parameters
1667    ///
1668    /// * *$.xgafv* (query-string) - V1 error format.
1669    /// * *access_token* (query-string) - OAuth access token.
1670    /// * *alt* (query-string) - Data format for response.
1671    /// * *callback* (query-string) - JSONP
1672    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1673    /// * *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.
1674    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1675    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1676    /// * *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.
1677    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1678    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1679    pub fn param<T>(
1680        mut self,
1681        name: T,
1682        value: T,
1683    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C>
1684    where
1685        T: AsRef<str>,
1686    {
1687        self._additional_params
1688            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1689        self
1690    }
1691
1692    /// Identifies the authorization scope for the method you are building.
1693    ///
1694    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1695    /// [`Scope::CloudPlatform`].
1696    ///
1697    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1698    /// tokens for more than one scope.
1699    ///
1700    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1701    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1702    /// sufficient, a read-write scope will do as well.
1703    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigOperationTestIamPermissionCall<'a, C>
1704    where
1705        St: AsRef<str>,
1706    {
1707        self._scopes.insert(String::from(scope.as_ref()));
1708        self
1709    }
1710    /// Identifies the authorization scope(s) for the method you are building.
1711    ///
1712    /// See [`Self::add_scope()`] for details.
1713    pub fn add_scopes<I, St>(
1714        mut self,
1715        scopes: I,
1716    ) -> ProjectConfigOperationTestIamPermissionCall<'a, C>
1717    where
1718        I: IntoIterator<Item = St>,
1719        St: AsRef<str>,
1720    {
1721        self._scopes
1722            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1723        self
1724    }
1725
1726    /// Removes all scopes, and no default scope will be used either.
1727    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1728    /// for details).
1729    pub fn clear_scopes(mut self) -> ProjectConfigOperationTestIamPermissionCall<'a, C> {
1730        self._scopes.clear();
1731        self
1732    }
1733}
1734
1735/// Creates a variable within the given configuration. You cannot create a variable with a name that is a prefix of an existing variable name, or a name that has an existing variable name as a prefix. To learn more about creating a variable, read the [Setting and Getting Data](https://cloud.google.com/deployment-manager/runtime-configurator/set-and-get-variables) documentation.
1736///
1737/// A builder for the *configs.variables.create* method supported by a *project* resource.
1738/// It is not used directly, but through a [`ProjectMethods`] instance.
1739///
1740/// # Example
1741///
1742/// Instantiate a resource method builder
1743///
1744/// ```test_harness,no_run
1745/// # extern crate hyper;
1746/// # extern crate hyper_rustls;
1747/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
1748/// use runtimeconfig1_beta1::api::Variable;
1749/// # async fn dox() {
1750/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1751///
1752/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1753/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1754/// #     .with_native_roots()
1755/// #     .unwrap()
1756/// #     .https_only()
1757/// #     .enable_http2()
1758/// #     .build();
1759///
1760/// # let executor = hyper_util::rt::TokioExecutor::new();
1761/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1762/// #     secret,
1763/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1764/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
1765/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
1766/// #     ),
1767/// # ).build().await.unwrap();
1768///
1769/// # let client = hyper_util::client::legacy::Client::builder(
1770/// #     hyper_util::rt::TokioExecutor::new()
1771/// # )
1772/// # .build(
1773/// #     hyper_rustls::HttpsConnectorBuilder::new()
1774/// #         .with_native_roots()
1775/// #         .unwrap()
1776/// #         .https_or_http()
1777/// #         .enable_http2()
1778/// #         .build()
1779/// # );
1780/// # let mut hub = CloudRuntimeConfig::new(client, auth);
1781/// // As the method needs a request, you would usually fill it with the desired information
1782/// // into the respective structure. Some of the parts shown here might not be applicable !
1783/// // Values shown here are possibly random and not representative !
1784/// let mut req = Variable::default();
1785///
1786/// // You can configure optional parameters by calling the respective setters at will, and
1787/// // execute the final call using `doit()`.
1788/// // Values shown here are possibly random and not representative !
1789/// let result = hub.projects().configs_variables_create(req, "parent")
1790///              .request_id("takimata")
1791///              .doit().await;
1792/// # }
1793/// ```
1794pub struct ProjectConfigVariableCreateCall<'a, C>
1795where
1796    C: 'a,
1797{
1798    hub: &'a CloudRuntimeConfig<C>,
1799    _request: Variable,
1800    _parent: String,
1801    _request_id: Option<String>,
1802    _delegate: Option<&'a mut dyn common::Delegate>,
1803    _additional_params: HashMap<String, String>,
1804    _scopes: BTreeSet<String>,
1805}
1806
1807impl<'a, C> common::CallBuilder for ProjectConfigVariableCreateCall<'a, C> {}
1808
1809impl<'a, C> ProjectConfigVariableCreateCall<'a, C>
1810where
1811    C: common::Connector,
1812{
1813    /// Perform the operation you have build so far.
1814    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
1815        use std::borrow::Cow;
1816        use std::io::{Read, Seek};
1817
1818        use common::{url::Params, ToParts};
1819        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1820
1821        let mut dd = common::DefaultDelegate;
1822        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1823        dlg.begin(common::MethodInfo {
1824            id: "runtimeconfig.projects.configs.variables.create",
1825            http_method: hyper::Method::POST,
1826        });
1827
1828        for &field in ["alt", "parent", "requestId"].iter() {
1829            if self._additional_params.contains_key(field) {
1830                dlg.finished(false);
1831                return Err(common::Error::FieldClash(field));
1832            }
1833        }
1834
1835        let mut params = Params::with_capacity(5 + self._additional_params.len());
1836        params.push("parent", self._parent);
1837        if let Some(value) = self._request_id.as_ref() {
1838            params.push("requestId", value);
1839        }
1840
1841        params.extend(self._additional_params.iter());
1842
1843        params.push("alt", "json");
1844        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/variables";
1845        if self._scopes.is_empty() {
1846            self._scopes
1847                .insert(Scope::CloudPlatform.as_ref().to_string());
1848        }
1849
1850        #[allow(clippy::single_element_loop)]
1851        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1852            url = params.uri_replacement(url, param_name, find_this, true);
1853        }
1854        {
1855            let to_remove = ["parent"];
1856            params.remove_params(&to_remove);
1857        }
1858
1859        let url = params.parse_with_url(&url);
1860
1861        let mut json_mime_type = mime::APPLICATION_JSON;
1862        let mut request_value_reader = {
1863            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1864            common::remove_json_null_values(&mut value);
1865            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1866            serde_json::to_writer(&mut dst, &value).unwrap();
1867            dst
1868        };
1869        let request_size = request_value_reader
1870            .seek(std::io::SeekFrom::End(0))
1871            .unwrap();
1872        request_value_reader
1873            .seek(std::io::SeekFrom::Start(0))
1874            .unwrap();
1875
1876        loop {
1877            let token = match self
1878                .hub
1879                .auth
1880                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1881                .await
1882            {
1883                Ok(token) => token,
1884                Err(e) => match dlg.token(e) {
1885                    Ok(token) => token,
1886                    Err(e) => {
1887                        dlg.finished(false);
1888                        return Err(common::Error::MissingToken(e));
1889                    }
1890                },
1891            };
1892            request_value_reader
1893                .seek(std::io::SeekFrom::Start(0))
1894                .unwrap();
1895            let mut req_result = {
1896                let client = &self.hub.client;
1897                dlg.pre_request();
1898                let mut req_builder = hyper::Request::builder()
1899                    .method(hyper::Method::POST)
1900                    .uri(url.as_str())
1901                    .header(USER_AGENT, self.hub._user_agent.clone());
1902
1903                if let Some(token) = token.as_ref() {
1904                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1905                }
1906
1907                let request = req_builder
1908                    .header(CONTENT_TYPE, json_mime_type.to_string())
1909                    .header(CONTENT_LENGTH, request_size as u64)
1910                    .body(common::to_body(
1911                        request_value_reader.get_ref().clone().into(),
1912                    ));
1913
1914                client.request(request.unwrap()).await
1915            };
1916
1917            match req_result {
1918                Err(err) => {
1919                    if let common::Retry::After(d) = dlg.http_error(&err) {
1920                        sleep(d).await;
1921                        continue;
1922                    }
1923                    dlg.finished(false);
1924                    return Err(common::Error::HttpError(err));
1925                }
1926                Ok(res) => {
1927                    let (mut parts, body) = res.into_parts();
1928                    let mut body = common::Body::new(body);
1929                    if !parts.status.is_success() {
1930                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1931                        let error = serde_json::from_str(&common::to_string(&bytes));
1932                        let response = common::to_response(parts, bytes.into());
1933
1934                        if let common::Retry::After(d) =
1935                            dlg.http_failure(&response, error.as_ref().ok())
1936                        {
1937                            sleep(d).await;
1938                            continue;
1939                        }
1940
1941                        dlg.finished(false);
1942
1943                        return Err(match error {
1944                            Ok(value) => common::Error::BadRequest(value),
1945                            _ => common::Error::Failure(response),
1946                        });
1947                    }
1948                    let response = {
1949                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1950                        let encoded = common::to_string(&bytes);
1951                        match serde_json::from_str(&encoded) {
1952                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1953                            Err(error) => {
1954                                dlg.response_json_decode_error(&encoded, &error);
1955                                return Err(common::Error::JsonDecodeError(
1956                                    encoded.to_string(),
1957                                    error,
1958                                ));
1959                            }
1960                        }
1961                    };
1962
1963                    dlg.finished(true);
1964                    return Ok(response);
1965                }
1966            }
1967        }
1968    }
1969
1970    ///
1971    /// Sets the *request* property to the given value.
1972    ///
1973    /// Even though the property as already been set when instantiating this call,
1974    /// we provide this method for API completeness.
1975    pub fn request(mut self, new_value: Variable) -> ProjectConfigVariableCreateCall<'a, C> {
1976        self._request = new_value;
1977        self
1978    }
1979    /// The path to the RutimeConfig resource that this variable should belong to. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
1980    ///
1981    /// Sets the *parent* path property to the given value.
1982    ///
1983    /// Even though the property as already been set when instantiating this call,
1984    /// we provide this method for API completeness.
1985    pub fn parent(mut self, new_value: &str) -> ProjectConfigVariableCreateCall<'a, C> {
1986        self._parent = new_value.to_string();
1987        self
1988    }
1989    /// An optional but recommended unique `request_id`. If the server receives two `create()` requests with the same `request_id`, then the second request will be ignored and the first resource created and stored in the backend is returned. Empty `request_id` fields are ignored. It is responsibility of the client to ensure uniqueness of the `request_id` strings. `request_id` strings are limited to 64 characters.
1990    ///
1991    /// Sets the *request id* query property to the given value.
1992    pub fn request_id(mut self, new_value: &str) -> ProjectConfigVariableCreateCall<'a, C> {
1993        self._request_id = Some(new_value.to_string());
1994        self
1995    }
1996    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1997    /// while executing the actual API request.
1998    ///
1999    /// ````text
2000    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2001    /// ````
2002    ///
2003    /// Sets the *delegate* property to the given value.
2004    pub fn delegate(
2005        mut self,
2006        new_value: &'a mut dyn common::Delegate,
2007    ) -> ProjectConfigVariableCreateCall<'a, C> {
2008        self._delegate = Some(new_value);
2009        self
2010    }
2011
2012    /// Set any additional parameter of the query string used in the request.
2013    /// It should be used to set parameters which are not yet available through their own
2014    /// setters.
2015    ///
2016    /// Please note that this method must not be used to set any of the known parameters
2017    /// which have their own setter method. If done anyway, the request will fail.
2018    ///
2019    /// # Additional Parameters
2020    ///
2021    /// * *$.xgafv* (query-string) - V1 error format.
2022    /// * *access_token* (query-string) - OAuth access token.
2023    /// * *alt* (query-string) - Data format for response.
2024    /// * *callback* (query-string) - JSONP
2025    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2026    /// * *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.
2027    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2028    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2029    /// * *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.
2030    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2031    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2032    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableCreateCall<'a, C>
2033    where
2034        T: AsRef<str>,
2035    {
2036        self._additional_params
2037            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2038        self
2039    }
2040
2041    /// Identifies the authorization scope for the method you are building.
2042    ///
2043    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2044    /// [`Scope::CloudPlatform`].
2045    ///
2046    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2047    /// tokens for more than one scope.
2048    ///
2049    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2050    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2051    /// sufficient, a read-write scope will do as well.
2052    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableCreateCall<'a, C>
2053    where
2054        St: AsRef<str>,
2055    {
2056        self._scopes.insert(String::from(scope.as_ref()));
2057        self
2058    }
2059    /// Identifies the authorization scope(s) for the method you are building.
2060    ///
2061    /// See [`Self::add_scope()`] for details.
2062    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableCreateCall<'a, C>
2063    where
2064        I: IntoIterator<Item = St>,
2065        St: AsRef<str>,
2066    {
2067        self._scopes
2068            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2069        self
2070    }
2071
2072    /// Removes all scopes, and no default scope will be used either.
2073    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2074    /// for details).
2075    pub fn clear_scopes(mut self) -> ProjectConfigVariableCreateCall<'a, C> {
2076        self._scopes.clear();
2077        self
2078    }
2079}
2080
2081/// Deletes a variable or multiple variables. If you specify a variable name, then that variable is deleted. If you specify a prefix and `recursive` is true, then all variables with that prefix are deleted. You must set a `recursive` to true if you delete variables by prefix.
2082///
2083/// A builder for the *configs.variables.delete* method supported by a *project* resource.
2084/// It is not used directly, but through a [`ProjectMethods`] instance.
2085///
2086/// # Example
2087///
2088/// Instantiate a resource method builder
2089///
2090/// ```test_harness,no_run
2091/// # extern crate hyper;
2092/// # extern crate hyper_rustls;
2093/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
2094/// # async fn dox() {
2095/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2096///
2097/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2098/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2099/// #     .with_native_roots()
2100/// #     .unwrap()
2101/// #     .https_only()
2102/// #     .enable_http2()
2103/// #     .build();
2104///
2105/// # let executor = hyper_util::rt::TokioExecutor::new();
2106/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2107/// #     secret,
2108/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2109/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2110/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2111/// #     ),
2112/// # ).build().await.unwrap();
2113///
2114/// # let client = hyper_util::client::legacy::Client::builder(
2115/// #     hyper_util::rt::TokioExecutor::new()
2116/// # )
2117/// # .build(
2118/// #     hyper_rustls::HttpsConnectorBuilder::new()
2119/// #         .with_native_roots()
2120/// #         .unwrap()
2121/// #         .https_or_http()
2122/// #         .enable_http2()
2123/// #         .build()
2124/// # );
2125/// # let mut hub = CloudRuntimeConfig::new(client, auth);
2126/// // You can configure optional parameters by calling the respective setters at will, and
2127/// // execute the final call using `doit()`.
2128/// // Values shown here are possibly random and not representative !
2129/// let result = hub.projects().configs_variables_delete("name")
2130///              .recursive(true)
2131///              .doit().await;
2132/// # }
2133/// ```
2134pub struct ProjectConfigVariableDeleteCall<'a, C>
2135where
2136    C: 'a,
2137{
2138    hub: &'a CloudRuntimeConfig<C>,
2139    _name: String,
2140    _recursive: Option<bool>,
2141    _delegate: Option<&'a mut dyn common::Delegate>,
2142    _additional_params: HashMap<String, String>,
2143    _scopes: BTreeSet<String>,
2144}
2145
2146impl<'a, C> common::CallBuilder for ProjectConfigVariableDeleteCall<'a, C> {}
2147
2148impl<'a, C> ProjectConfigVariableDeleteCall<'a, C>
2149where
2150    C: common::Connector,
2151{
2152    /// Perform the operation you have build so far.
2153    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2154        use std::borrow::Cow;
2155        use std::io::{Read, Seek};
2156
2157        use common::{url::Params, ToParts};
2158        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2159
2160        let mut dd = common::DefaultDelegate;
2161        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2162        dlg.begin(common::MethodInfo {
2163            id: "runtimeconfig.projects.configs.variables.delete",
2164            http_method: hyper::Method::DELETE,
2165        });
2166
2167        for &field in ["alt", "name", "recursive"].iter() {
2168            if self._additional_params.contains_key(field) {
2169                dlg.finished(false);
2170                return Err(common::Error::FieldClash(field));
2171            }
2172        }
2173
2174        let mut params = Params::with_capacity(4 + self._additional_params.len());
2175        params.push("name", self._name);
2176        if let Some(value) = self._recursive.as_ref() {
2177            params.push("recursive", value.to_string());
2178        }
2179
2180        params.extend(self._additional_params.iter());
2181
2182        params.push("alt", "json");
2183        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2184        if self._scopes.is_empty() {
2185            self._scopes
2186                .insert(Scope::CloudPlatform.as_ref().to_string());
2187        }
2188
2189        #[allow(clippy::single_element_loop)]
2190        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2191            url = params.uri_replacement(url, param_name, find_this, true);
2192        }
2193        {
2194            let to_remove = ["name"];
2195            params.remove_params(&to_remove);
2196        }
2197
2198        let url = params.parse_with_url(&url);
2199
2200        loop {
2201            let token = match self
2202                .hub
2203                .auth
2204                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2205                .await
2206            {
2207                Ok(token) => token,
2208                Err(e) => match dlg.token(e) {
2209                    Ok(token) => token,
2210                    Err(e) => {
2211                        dlg.finished(false);
2212                        return Err(common::Error::MissingToken(e));
2213                    }
2214                },
2215            };
2216            let mut req_result = {
2217                let client = &self.hub.client;
2218                dlg.pre_request();
2219                let mut req_builder = hyper::Request::builder()
2220                    .method(hyper::Method::DELETE)
2221                    .uri(url.as_str())
2222                    .header(USER_AGENT, self.hub._user_agent.clone());
2223
2224                if let Some(token) = token.as_ref() {
2225                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2226                }
2227
2228                let request = req_builder
2229                    .header(CONTENT_LENGTH, 0_u64)
2230                    .body(common::to_body::<String>(None));
2231
2232                client.request(request.unwrap()).await
2233            };
2234
2235            match req_result {
2236                Err(err) => {
2237                    if let common::Retry::After(d) = dlg.http_error(&err) {
2238                        sleep(d).await;
2239                        continue;
2240                    }
2241                    dlg.finished(false);
2242                    return Err(common::Error::HttpError(err));
2243                }
2244                Ok(res) => {
2245                    let (mut parts, body) = res.into_parts();
2246                    let mut body = common::Body::new(body);
2247                    if !parts.status.is_success() {
2248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2249                        let error = serde_json::from_str(&common::to_string(&bytes));
2250                        let response = common::to_response(parts, bytes.into());
2251
2252                        if let common::Retry::After(d) =
2253                            dlg.http_failure(&response, error.as_ref().ok())
2254                        {
2255                            sleep(d).await;
2256                            continue;
2257                        }
2258
2259                        dlg.finished(false);
2260
2261                        return Err(match error {
2262                            Ok(value) => common::Error::BadRequest(value),
2263                            _ => common::Error::Failure(response),
2264                        });
2265                    }
2266                    let response = {
2267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2268                        let encoded = common::to_string(&bytes);
2269                        match serde_json::from_str(&encoded) {
2270                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2271                            Err(error) => {
2272                                dlg.response_json_decode_error(&encoded, &error);
2273                                return Err(common::Error::JsonDecodeError(
2274                                    encoded.to_string(),
2275                                    error,
2276                                ));
2277                            }
2278                        }
2279                    };
2280
2281                    dlg.finished(true);
2282                    return Ok(response);
2283                }
2284            }
2285        }
2286    }
2287
2288    /// The name of the variable to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`
2289    ///
2290    /// Sets the *name* path property to the given value.
2291    ///
2292    /// Even though the property as already been set when instantiating this call,
2293    /// we provide this method for API completeness.
2294    pub fn name(mut self, new_value: &str) -> ProjectConfigVariableDeleteCall<'a, C> {
2295        self._name = new_value.to_string();
2296        self
2297    }
2298    /// Set to `true` to recursively delete multiple variables with the same prefix.
2299    ///
2300    /// Sets the *recursive* query property to the given value.
2301    pub fn recursive(mut self, new_value: bool) -> ProjectConfigVariableDeleteCall<'a, C> {
2302        self._recursive = Some(new_value);
2303        self
2304    }
2305    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2306    /// while executing the actual API request.
2307    ///
2308    /// ````text
2309    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2310    /// ````
2311    ///
2312    /// Sets the *delegate* property to the given value.
2313    pub fn delegate(
2314        mut self,
2315        new_value: &'a mut dyn common::Delegate,
2316    ) -> ProjectConfigVariableDeleteCall<'a, C> {
2317        self._delegate = Some(new_value);
2318        self
2319    }
2320
2321    /// Set any additional parameter of the query string used in the request.
2322    /// It should be used to set parameters which are not yet available through their own
2323    /// setters.
2324    ///
2325    /// Please note that this method must not be used to set any of the known parameters
2326    /// which have their own setter method. If done anyway, the request will fail.
2327    ///
2328    /// # Additional Parameters
2329    ///
2330    /// * *$.xgafv* (query-string) - V1 error format.
2331    /// * *access_token* (query-string) - OAuth access token.
2332    /// * *alt* (query-string) - Data format for response.
2333    /// * *callback* (query-string) - JSONP
2334    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2335    /// * *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.
2336    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2337    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2338    /// * *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.
2339    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2340    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2341    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableDeleteCall<'a, C>
2342    where
2343        T: AsRef<str>,
2344    {
2345        self._additional_params
2346            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2347        self
2348    }
2349
2350    /// Identifies the authorization scope for the method you are building.
2351    ///
2352    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2353    /// [`Scope::CloudPlatform`].
2354    ///
2355    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2356    /// tokens for more than one scope.
2357    ///
2358    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2359    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2360    /// sufficient, a read-write scope will do as well.
2361    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableDeleteCall<'a, C>
2362    where
2363        St: AsRef<str>,
2364    {
2365        self._scopes.insert(String::from(scope.as_ref()));
2366        self
2367    }
2368    /// Identifies the authorization scope(s) for the method you are building.
2369    ///
2370    /// See [`Self::add_scope()`] for details.
2371    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableDeleteCall<'a, C>
2372    where
2373        I: IntoIterator<Item = St>,
2374        St: AsRef<str>,
2375    {
2376        self._scopes
2377            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2378        self
2379    }
2380
2381    /// Removes all scopes, and no default scope will be used either.
2382    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2383    /// for details).
2384    pub fn clear_scopes(mut self) -> ProjectConfigVariableDeleteCall<'a, C> {
2385        self._scopes.clear();
2386        self
2387    }
2388}
2389
2390/// Gets information about a single variable.
2391///
2392/// A builder for the *configs.variables.get* method supported by a *project* resource.
2393/// It is not used directly, but through a [`ProjectMethods`] instance.
2394///
2395/// # Example
2396///
2397/// Instantiate a resource method builder
2398///
2399/// ```test_harness,no_run
2400/// # extern crate hyper;
2401/// # extern crate hyper_rustls;
2402/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
2403/// # async fn dox() {
2404/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2405///
2406/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2407/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2408/// #     .with_native_roots()
2409/// #     .unwrap()
2410/// #     .https_only()
2411/// #     .enable_http2()
2412/// #     .build();
2413///
2414/// # let executor = hyper_util::rt::TokioExecutor::new();
2415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2416/// #     secret,
2417/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2418/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2419/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2420/// #     ),
2421/// # ).build().await.unwrap();
2422///
2423/// # let client = hyper_util::client::legacy::Client::builder(
2424/// #     hyper_util::rt::TokioExecutor::new()
2425/// # )
2426/// # .build(
2427/// #     hyper_rustls::HttpsConnectorBuilder::new()
2428/// #         .with_native_roots()
2429/// #         .unwrap()
2430/// #         .https_or_http()
2431/// #         .enable_http2()
2432/// #         .build()
2433/// # );
2434/// # let mut hub = CloudRuntimeConfig::new(client, auth);
2435/// // You can configure optional parameters by calling the respective setters at will, and
2436/// // execute the final call using `doit()`.
2437/// // Values shown here are possibly random and not representative !
2438/// let result = hub.projects().configs_variables_get("name")
2439///              .doit().await;
2440/// # }
2441/// ```
2442pub struct ProjectConfigVariableGetCall<'a, C>
2443where
2444    C: 'a,
2445{
2446    hub: &'a CloudRuntimeConfig<C>,
2447    _name: String,
2448    _delegate: Option<&'a mut dyn common::Delegate>,
2449    _additional_params: HashMap<String, String>,
2450    _scopes: BTreeSet<String>,
2451}
2452
2453impl<'a, C> common::CallBuilder for ProjectConfigVariableGetCall<'a, C> {}
2454
2455impl<'a, C> ProjectConfigVariableGetCall<'a, C>
2456where
2457    C: common::Connector,
2458{
2459    /// Perform the operation you have build so far.
2460    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
2461        use std::borrow::Cow;
2462        use std::io::{Read, Seek};
2463
2464        use common::{url::Params, ToParts};
2465        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2466
2467        let mut dd = common::DefaultDelegate;
2468        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2469        dlg.begin(common::MethodInfo {
2470            id: "runtimeconfig.projects.configs.variables.get",
2471            http_method: hyper::Method::GET,
2472        });
2473
2474        for &field in ["alt", "name"].iter() {
2475            if self._additional_params.contains_key(field) {
2476                dlg.finished(false);
2477                return Err(common::Error::FieldClash(field));
2478            }
2479        }
2480
2481        let mut params = Params::with_capacity(3 + self._additional_params.len());
2482        params.push("name", self._name);
2483
2484        params.extend(self._additional_params.iter());
2485
2486        params.push("alt", "json");
2487        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2488        if self._scopes.is_empty() {
2489            self._scopes
2490                .insert(Scope::CloudPlatform.as_ref().to_string());
2491        }
2492
2493        #[allow(clippy::single_element_loop)]
2494        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2495            url = params.uri_replacement(url, param_name, find_this, true);
2496        }
2497        {
2498            let to_remove = ["name"];
2499            params.remove_params(&to_remove);
2500        }
2501
2502        let url = params.parse_with_url(&url);
2503
2504        loop {
2505            let token = match self
2506                .hub
2507                .auth
2508                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2509                .await
2510            {
2511                Ok(token) => token,
2512                Err(e) => match dlg.token(e) {
2513                    Ok(token) => token,
2514                    Err(e) => {
2515                        dlg.finished(false);
2516                        return Err(common::Error::MissingToken(e));
2517                    }
2518                },
2519            };
2520            let mut req_result = {
2521                let client = &self.hub.client;
2522                dlg.pre_request();
2523                let mut req_builder = hyper::Request::builder()
2524                    .method(hyper::Method::GET)
2525                    .uri(url.as_str())
2526                    .header(USER_AGENT, self.hub._user_agent.clone());
2527
2528                if let Some(token) = token.as_ref() {
2529                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2530                }
2531
2532                let request = req_builder
2533                    .header(CONTENT_LENGTH, 0_u64)
2534                    .body(common::to_body::<String>(None));
2535
2536                client.request(request.unwrap()).await
2537            };
2538
2539            match req_result {
2540                Err(err) => {
2541                    if let common::Retry::After(d) = dlg.http_error(&err) {
2542                        sleep(d).await;
2543                        continue;
2544                    }
2545                    dlg.finished(false);
2546                    return Err(common::Error::HttpError(err));
2547                }
2548                Ok(res) => {
2549                    let (mut parts, body) = res.into_parts();
2550                    let mut body = common::Body::new(body);
2551                    if !parts.status.is_success() {
2552                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2553                        let error = serde_json::from_str(&common::to_string(&bytes));
2554                        let response = common::to_response(parts, bytes.into());
2555
2556                        if let common::Retry::After(d) =
2557                            dlg.http_failure(&response, error.as_ref().ok())
2558                        {
2559                            sleep(d).await;
2560                            continue;
2561                        }
2562
2563                        dlg.finished(false);
2564
2565                        return Err(match error {
2566                            Ok(value) => common::Error::BadRequest(value),
2567                            _ => common::Error::Failure(response),
2568                        });
2569                    }
2570                    let response = {
2571                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2572                        let encoded = common::to_string(&bytes);
2573                        match serde_json::from_str(&encoded) {
2574                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2575                            Err(error) => {
2576                                dlg.response_json_decode_error(&encoded, &error);
2577                                return Err(common::Error::JsonDecodeError(
2578                                    encoded.to_string(),
2579                                    error,
2580                                ));
2581                            }
2582                        }
2583                    };
2584
2585                    dlg.finished(true);
2586                    return Ok(response);
2587                }
2588            }
2589        }
2590    }
2591
2592    /// The name of the variable to return, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIBLE_NAME]`
2593    ///
2594    /// Sets the *name* path property to the given value.
2595    ///
2596    /// Even though the property as already been set when instantiating this call,
2597    /// we provide this method for API completeness.
2598    pub fn name(mut self, new_value: &str) -> ProjectConfigVariableGetCall<'a, C> {
2599        self._name = new_value.to_string();
2600        self
2601    }
2602    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2603    /// while executing the actual API request.
2604    ///
2605    /// ````text
2606    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2607    /// ````
2608    ///
2609    /// Sets the *delegate* property to the given value.
2610    pub fn delegate(
2611        mut self,
2612        new_value: &'a mut dyn common::Delegate,
2613    ) -> ProjectConfigVariableGetCall<'a, C> {
2614        self._delegate = Some(new_value);
2615        self
2616    }
2617
2618    /// Set any additional parameter of the query string used in the request.
2619    /// It should be used to set parameters which are not yet available through their own
2620    /// setters.
2621    ///
2622    /// Please note that this method must not be used to set any of the known parameters
2623    /// which have their own setter method. If done anyway, the request will fail.
2624    ///
2625    /// # Additional Parameters
2626    ///
2627    /// * *$.xgafv* (query-string) - V1 error format.
2628    /// * *access_token* (query-string) - OAuth access token.
2629    /// * *alt* (query-string) - Data format for response.
2630    /// * *callback* (query-string) - JSONP
2631    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2632    /// * *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.
2633    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2634    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2635    /// * *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.
2636    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2637    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2638    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableGetCall<'a, C>
2639    where
2640        T: AsRef<str>,
2641    {
2642        self._additional_params
2643            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2644        self
2645    }
2646
2647    /// Identifies the authorization scope for the method you are building.
2648    ///
2649    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2650    /// [`Scope::CloudPlatform`].
2651    ///
2652    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2653    /// tokens for more than one scope.
2654    ///
2655    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2656    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2657    /// sufficient, a read-write scope will do as well.
2658    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableGetCall<'a, C>
2659    where
2660        St: AsRef<str>,
2661    {
2662        self._scopes.insert(String::from(scope.as_ref()));
2663        self
2664    }
2665    /// Identifies the authorization scope(s) for the method you are building.
2666    ///
2667    /// See [`Self::add_scope()`] for details.
2668    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableGetCall<'a, C>
2669    where
2670        I: IntoIterator<Item = St>,
2671        St: AsRef<str>,
2672    {
2673        self._scopes
2674            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2675        self
2676    }
2677
2678    /// Removes all scopes, and no default scope will be used either.
2679    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2680    /// for details).
2681    pub fn clear_scopes(mut self) -> ProjectConfigVariableGetCall<'a, C> {
2682        self._scopes.clear();
2683        self
2684    }
2685}
2686
2687/// Lists variables within given a configuration, matching any provided filters. This only lists variable names, not the values, unless `return_values` is true, in which case only variables that user has IAM permission to GetVariable will be returned.
2688///
2689/// A builder for the *configs.variables.list* method supported by a *project* resource.
2690/// It is not used directly, but through a [`ProjectMethods`] instance.
2691///
2692/// # Example
2693///
2694/// Instantiate a resource method builder
2695///
2696/// ```test_harness,no_run
2697/// # extern crate hyper;
2698/// # extern crate hyper_rustls;
2699/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
2700/// # async fn dox() {
2701/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2702///
2703/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2704/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2705/// #     .with_native_roots()
2706/// #     .unwrap()
2707/// #     .https_only()
2708/// #     .enable_http2()
2709/// #     .build();
2710///
2711/// # let executor = hyper_util::rt::TokioExecutor::new();
2712/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2713/// #     secret,
2714/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2715/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2716/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2717/// #     ),
2718/// # ).build().await.unwrap();
2719///
2720/// # let client = hyper_util::client::legacy::Client::builder(
2721/// #     hyper_util::rt::TokioExecutor::new()
2722/// # )
2723/// # .build(
2724/// #     hyper_rustls::HttpsConnectorBuilder::new()
2725/// #         .with_native_roots()
2726/// #         .unwrap()
2727/// #         .https_or_http()
2728/// #         .enable_http2()
2729/// #         .build()
2730/// # );
2731/// # let mut hub = CloudRuntimeConfig::new(client, auth);
2732/// // You can configure optional parameters by calling the respective setters at will, and
2733/// // execute the final call using `doit()`.
2734/// // Values shown here are possibly random and not representative !
2735/// let result = hub.projects().configs_variables_list("parent")
2736///              .return_values(false)
2737///              .page_token("dolor")
2738///              .page_size(-17)
2739///              .filter("ipsum")
2740///              .doit().await;
2741/// # }
2742/// ```
2743pub struct ProjectConfigVariableListCall<'a, C>
2744where
2745    C: 'a,
2746{
2747    hub: &'a CloudRuntimeConfig<C>,
2748    _parent: String,
2749    _return_values: Option<bool>,
2750    _page_token: Option<String>,
2751    _page_size: Option<i32>,
2752    _filter: Option<String>,
2753    _delegate: Option<&'a mut dyn common::Delegate>,
2754    _additional_params: HashMap<String, String>,
2755    _scopes: BTreeSet<String>,
2756}
2757
2758impl<'a, C> common::CallBuilder for ProjectConfigVariableListCall<'a, C> {}
2759
2760impl<'a, C> ProjectConfigVariableListCall<'a, C>
2761where
2762    C: common::Connector,
2763{
2764    /// Perform the operation you have build so far.
2765    pub async fn doit(mut self) -> common::Result<(common::Response, ListVariablesResponse)> {
2766        use std::borrow::Cow;
2767        use std::io::{Read, Seek};
2768
2769        use common::{url::Params, ToParts};
2770        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2771
2772        let mut dd = common::DefaultDelegate;
2773        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2774        dlg.begin(common::MethodInfo {
2775            id: "runtimeconfig.projects.configs.variables.list",
2776            http_method: hyper::Method::GET,
2777        });
2778
2779        for &field in [
2780            "alt",
2781            "parent",
2782            "returnValues",
2783            "pageToken",
2784            "pageSize",
2785            "filter",
2786        ]
2787        .iter()
2788        {
2789            if self._additional_params.contains_key(field) {
2790                dlg.finished(false);
2791                return Err(common::Error::FieldClash(field));
2792            }
2793        }
2794
2795        let mut params = Params::with_capacity(7 + self._additional_params.len());
2796        params.push("parent", self._parent);
2797        if let Some(value) = self._return_values.as_ref() {
2798            params.push("returnValues", value.to_string());
2799        }
2800        if let Some(value) = self._page_token.as_ref() {
2801            params.push("pageToken", value);
2802        }
2803        if let Some(value) = self._page_size.as_ref() {
2804            params.push("pageSize", value.to_string());
2805        }
2806        if let Some(value) = self._filter.as_ref() {
2807            params.push("filter", value);
2808        }
2809
2810        params.extend(self._additional_params.iter());
2811
2812        params.push("alt", "json");
2813        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/variables";
2814        if self._scopes.is_empty() {
2815            self._scopes
2816                .insert(Scope::CloudPlatform.as_ref().to_string());
2817        }
2818
2819        #[allow(clippy::single_element_loop)]
2820        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2821            url = params.uri_replacement(url, param_name, find_this, true);
2822        }
2823        {
2824            let to_remove = ["parent"];
2825            params.remove_params(&to_remove);
2826        }
2827
2828        let url = params.parse_with_url(&url);
2829
2830        loop {
2831            let token = match self
2832                .hub
2833                .auth
2834                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2835                .await
2836            {
2837                Ok(token) => token,
2838                Err(e) => match dlg.token(e) {
2839                    Ok(token) => token,
2840                    Err(e) => {
2841                        dlg.finished(false);
2842                        return Err(common::Error::MissingToken(e));
2843                    }
2844                },
2845            };
2846            let mut req_result = {
2847                let client = &self.hub.client;
2848                dlg.pre_request();
2849                let mut req_builder = hyper::Request::builder()
2850                    .method(hyper::Method::GET)
2851                    .uri(url.as_str())
2852                    .header(USER_AGENT, self.hub._user_agent.clone());
2853
2854                if let Some(token) = token.as_ref() {
2855                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2856                }
2857
2858                let request = req_builder
2859                    .header(CONTENT_LENGTH, 0_u64)
2860                    .body(common::to_body::<String>(None));
2861
2862                client.request(request.unwrap()).await
2863            };
2864
2865            match req_result {
2866                Err(err) => {
2867                    if let common::Retry::After(d) = dlg.http_error(&err) {
2868                        sleep(d).await;
2869                        continue;
2870                    }
2871                    dlg.finished(false);
2872                    return Err(common::Error::HttpError(err));
2873                }
2874                Ok(res) => {
2875                    let (mut parts, body) = res.into_parts();
2876                    let mut body = common::Body::new(body);
2877                    if !parts.status.is_success() {
2878                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2879                        let error = serde_json::from_str(&common::to_string(&bytes));
2880                        let response = common::to_response(parts, bytes.into());
2881
2882                        if let common::Retry::After(d) =
2883                            dlg.http_failure(&response, error.as_ref().ok())
2884                        {
2885                            sleep(d).await;
2886                            continue;
2887                        }
2888
2889                        dlg.finished(false);
2890
2891                        return Err(match error {
2892                            Ok(value) => common::Error::BadRequest(value),
2893                            _ => common::Error::Failure(response),
2894                        });
2895                    }
2896                    let response = {
2897                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2898                        let encoded = common::to_string(&bytes);
2899                        match serde_json::from_str(&encoded) {
2900                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2901                            Err(error) => {
2902                                dlg.response_json_decode_error(&encoded, &error);
2903                                return Err(common::Error::JsonDecodeError(
2904                                    encoded.to_string(),
2905                                    error,
2906                                ));
2907                            }
2908                        }
2909                    };
2910
2911                    dlg.finished(true);
2912                    return Ok(response);
2913                }
2914            }
2915        }
2916    }
2917
2918    /// The path to the RuntimeConfig resource for which you want to list variables. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
2919    ///
2920    /// Sets the *parent* path property to the given value.
2921    ///
2922    /// Even though the property as already been set when instantiating this call,
2923    /// we provide this method for API completeness.
2924    pub fn parent(mut self, new_value: &str) -> ProjectConfigVariableListCall<'a, C> {
2925        self._parent = new_value.to_string();
2926        self
2927    }
2928    /// The flag indicates whether the user wants to return values of variables. If true, then only those variables that user has IAM GetVariable permission will be returned along with their values.
2929    ///
2930    /// Sets the *return values* query property to the given value.
2931    pub fn return_values(mut self, new_value: bool) -> ProjectConfigVariableListCall<'a, C> {
2932        self._return_values = Some(new_value);
2933        self
2934    }
2935    /// Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results.
2936    ///
2937    /// Sets the *page token* query property to the given value.
2938    pub fn page_token(mut self, new_value: &str) -> ProjectConfigVariableListCall<'a, C> {
2939        self._page_token = Some(new_value.to_string());
2940        self
2941    }
2942    /// Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements.
2943    ///
2944    /// Sets the *page size* query property to the given value.
2945    pub fn page_size(mut self, new_value: i32) -> ProjectConfigVariableListCall<'a, C> {
2946        self._page_size = Some(new_value);
2947        self
2948    }
2949    /// Filters variables by matching the specified filter. For example: `projects/example-project/config/[CONFIG_NAME]/variables/example-variable`.
2950    ///
2951    /// Sets the *filter* query property to the given value.
2952    pub fn filter(mut self, new_value: &str) -> ProjectConfigVariableListCall<'a, C> {
2953        self._filter = Some(new_value.to_string());
2954        self
2955    }
2956    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2957    /// while executing the actual API request.
2958    ///
2959    /// ````text
2960    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2961    /// ````
2962    ///
2963    /// Sets the *delegate* property to the given value.
2964    pub fn delegate(
2965        mut self,
2966        new_value: &'a mut dyn common::Delegate,
2967    ) -> ProjectConfigVariableListCall<'a, C> {
2968        self._delegate = Some(new_value);
2969        self
2970    }
2971
2972    /// Set any additional parameter of the query string used in the request.
2973    /// It should be used to set parameters which are not yet available through their own
2974    /// setters.
2975    ///
2976    /// Please note that this method must not be used to set any of the known parameters
2977    /// which have their own setter method. If done anyway, the request will fail.
2978    ///
2979    /// # Additional Parameters
2980    ///
2981    /// * *$.xgafv* (query-string) - V1 error format.
2982    /// * *access_token* (query-string) - OAuth access token.
2983    /// * *alt* (query-string) - Data format for response.
2984    /// * *callback* (query-string) - JSONP
2985    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2986    /// * *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.
2987    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2988    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2989    /// * *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.
2990    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2991    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2992    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableListCall<'a, C>
2993    where
2994        T: AsRef<str>,
2995    {
2996        self._additional_params
2997            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2998        self
2999    }
3000
3001    /// Identifies the authorization scope for the method you are building.
3002    ///
3003    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3004    /// [`Scope::CloudPlatform`].
3005    ///
3006    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3007    /// tokens for more than one scope.
3008    ///
3009    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3010    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3011    /// sufficient, a read-write scope will do as well.
3012    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableListCall<'a, C>
3013    where
3014        St: AsRef<str>,
3015    {
3016        self._scopes.insert(String::from(scope.as_ref()));
3017        self
3018    }
3019    /// Identifies the authorization scope(s) for the method you are building.
3020    ///
3021    /// See [`Self::add_scope()`] for details.
3022    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableListCall<'a, C>
3023    where
3024        I: IntoIterator<Item = St>,
3025        St: AsRef<str>,
3026    {
3027        self._scopes
3028            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3029        self
3030    }
3031
3032    /// Removes all scopes, and no default scope will be used either.
3033    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3034    /// for details).
3035    pub fn clear_scopes(mut self) -> ProjectConfigVariableListCall<'a, C> {
3036        self._scopes.clear();
3037        self
3038    }
3039}
3040
3041/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
3042///
3043/// A builder for the *configs.variables.testIamPermissions* method supported by a *project* resource.
3044/// It is not used directly, but through a [`ProjectMethods`] instance.
3045///
3046/// # Example
3047///
3048/// Instantiate a resource method builder
3049///
3050/// ```test_harness,no_run
3051/// # extern crate hyper;
3052/// # extern crate hyper_rustls;
3053/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
3054/// use runtimeconfig1_beta1::api::TestIamPermissionsRequest;
3055/// # async fn dox() {
3056/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3057///
3058/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3059/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3060/// #     .with_native_roots()
3061/// #     .unwrap()
3062/// #     .https_only()
3063/// #     .enable_http2()
3064/// #     .build();
3065///
3066/// # let executor = hyper_util::rt::TokioExecutor::new();
3067/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3068/// #     secret,
3069/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3070/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3071/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3072/// #     ),
3073/// # ).build().await.unwrap();
3074///
3075/// # let client = hyper_util::client::legacy::Client::builder(
3076/// #     hyper_util::rt::TokioExecutor::new()
3077/// # )
3078/// # .build(
3079/// #     hyper_rustls::HttpsConnectorBuilder::new()
3080/// #         .with_native_roots()
3081/// #         .unwrap()
3082/// #         .https_or_http()
3083/// #         .enable_http2()
3084/// #         .build()
3085/// # );
3086/// # let mut hub = CloudRuntimeConfig::new(client, auth);
3087/// // As the method needs a request, you would usually fill it with the desired information
3088/// // into the respective structure. Some of the parts shown here might not be applicable !
3089/// // Values shown here are possibly random and not representative !
3090/// let mut req = TestIamPermissionsRequest::default();
3091///
3092/// // You can configure optional parameters by calling the respective setters at will, and
3093/// // execute the final call using `doit()`.
3094/// // Values shown here are possibly random and not representative !
3095/// let result = hub.projects().configs_variables_test_iam_permissions(req, "resource")
3096///              .doit().await;
3097/// # }
3098/// ```
3099pub struct ProjectConfigVariableTestIamPermissionCall<'a, C>
3100where
3101    C: 'a,
3102{
3103    hub: &'a CloudRuntimeConfig<C>,
3104    _request: TestIamPermissionsRequest,
3105    _resource: String,
3106    _delegate: Option<&'a mut dyn common::Delegate>,
3107    _additional_params: HashMap<String, String>,
3108    _scopes: BTreeSet<String>,
3109}
3110
3111impl<'a, C> common::CallBuilder for ProjectConfigVariableTestIamPermissionCall<'a, C> {}
3112
3113impl<'a, C> ProjectConfigVariableTestIamPermissionCall<'a, C>
3114where
3115    C: common::Connector,
3116{
3117    /// Perform the operation you have build so far.
3118    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
3119        use std::borrow::Cow;
3120        use std::io::{Read, Seek};
3121
3122        use common::{url::Params, ToParts};
3123        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3124
3125        let mut dd = common::DefaultDelegate;
3126        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3127        dlg.begin(common::MethodInfo {
3128            id: "runtimeconfig.projects.configs.variables.testIamPermissions",
3129            http_method: hyper::Method::POST,
3130        });
3131
3132        for &field in ["alt", "resource"].iter() {
3133            if self._additional_params.contains_key(field) {
3134                dlg.finished(false);
3135                return Err(common::Error::FieldClash(field));
3136            }
3137        }
3138
3139        let mut params = Params::with_capacity(4 + self._additional_params.len());
3140        params.push("resource", self._resource);
3141
3142        params.extend(self._additional_params.iter());
3143
3144        params.push("alt", "json");
3145        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
3146        if self._scopes.is_empty() {
3147            self._scopes
3148                .insert(Scope::CloudPlatform.as_ref().to_string());
3149        }
3150
3151        #[allow(clippy::single_element_loop)]
3152        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3153            url = params.uri_replacement(url, param_name, find_this, true);
3154        }
3155        {
3156            let to_remove = ["resource"];
3157            params.remove_params(&to_remove);
3158        }
3159
3160        let url = params.parse_with_url(&url);
3161
3162        let mut json_mime_type = mime::APPLICATION_JSON;
3163        let mut request_value_reader = {
3164            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3165            common::remove_json_null_values(&mut value);
3166            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3167            serde_json::to_writer(&mut dst, &value).unwrap();
3168            dst
3169        };
3170        let request_size = request_value_reader
3171            .seek(std::io::SeekFrom::End(0))
3172            .unwrap();
3173        request_value_reader
3174            .seek(std::io::SeekFrom::Start(0))
3175            .unwrap();
3176
3177        loop {
3178            let token = match self
3179                .hub
3180                .auth
3181                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3182                .await
3183            {
3184                Ok(token) => token,
3185                Err(e) => match dlg.token(e) {
3186                    Ok(token) => token,
3187                    Err(e) => {
3188                        dlg.finished(false);
3189                        return Err(common::Error::MissingToken(e));
3190                    }
3191                },
3192            };
3193            request_value_reader
3194                .seek(std::io::SeekFrom::Start(0))
3195                .unwrap();
3196            let mut req_result = {
3197                let client = &self.hub.client;
3198                dlg.pre_request();
3199                let mut req_builder = hyper::Request::builder()
3200                    .method(hyper::Method::POST)
3201                    .uri(url.as_str())
3202                    .header(USER_AGENT, self.hub._user_agent.clone());
3203
3204                if let Some(token) = token.as_ref() {
3205                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3206                }
3207
3208                let request = req_builder
3209                    .header(CONTENT_TYPE, json_mime_type.to_string())
3210                    .header(CONTENT_LENGTH, request_size as u64)
3211                    .body(common::to_body(
3212                        request_value_reader.get_ref().clone().into(),
3213                    ));
3214
3215                client.request(request.unwrap()).await
3216            };
3217
3218            match req_result {
3219                Err(err) => {
3220                    if let common::Retry::After(d) = dlg.http_error(&err) {
3221                        sleep(d).await;
3222                        continue;
3223                    }
3224                    dlg.finished(false);
3225                    return Err(common::Error::HttpError(err));
3226                }
3227                Ok(res) => {
3228                    let (mut parts, body) = res.into_parts();
3229                    let mut body = common::Body::new(body);
3230                    if !parts.status.is_success() {
3231                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3232                        let error = serde_json::from_str(&common::to_string(&bytes));
3233                        let response = common::to_response(parts, bytes.into());
3234
3235                        if let common::Retry::After(d) =
3236                            dlg.http_failure(&response, error.as_ref().ok())
3237                        {
3238                            sleep(d).await;
3239                            continue;
3240                        }
3241
3242                        dlg.finished(false);
3243
3244                        return Err(match error {
3245                            Ok(value) => common::Error::BadRequest(value),
3246                            _ => common::Error::Failure(response),
3247                        });
3248                    }
3249                    let response = {
3250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3251                        let encoded = common::to_string(&bytes);
3252                        match serde_json::from_str(&encoded) {
3253                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3254                            Err(error) => {
3255                                dlg.response_json_decode_error(&encoded, &error);
3256                                return Err(common::Error::JsonDecodeError(
3257                                    encoded.to_string(),
3258                                    error,
3259                                ));
3260                            }
3261                        }
3262                    };
3263
3264                    dlg.finished(true);
3265                    return Ok(response);
3266                }
3267            }
3268        }
3269    }
3270
3271    ///
3272    /// Sets the *request* property to the given value.
3273    ///
3274    /// Even though the property as already been set when instantiating this call,
3275    /// we provide this method for API completeness.
3276    pub fn request(
3277        mut self,
3278        new_value: TestIamPermissionsRequest,
3279    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C> {
3280        self._request = new_value;
3281        self
3282    }
3283    /// 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.
3284    ///
3285    /// Sets the *resource* path property to the given value.
3286    ///
3287    /// Even though the property as already been set when instantiating this call,
3288    /// we provide this method for API completeness.
3289    pub fn resource(
3290        mut self,
3291        new_value: &str,
3292    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C> {
3293        self._resource = new_value.to_string();
3294        self
3295    }
3296    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3297    /// while executing the actual API request.
3298    ///
3299    /// ````text
3300    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3301    /// ````
3302    ///
3303    /// Sets the *delegate* property to the given value.
3304    pub fn delegate(
3305        mut self,
3306        new_value: &'a mut dyn common::Delegate,
3307    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C> {
3308        self._delegate = Some(new_value);
3309        self
3310    }
3311
3312    /// Set any additional parameter of the query string used in the request.
3313    /// It should be used to set parameters which are not yet available through their own
3314    /// setters.
3315    ///
3316    /// Please note that this method must not be used to set any of the known parameters
3317    /// which have their own setter method. If done anyway, the request will fail.
3318    ///
3319    /// # Additional Parameters
3320    ///
3321    /// * *$.xgafv* (query-string) - V1 error format.
3322    /// * *access_token* (query-string) - OAuth access token.
3323    /// * *alt* (query-string) - Data format for response.
3324    /// * *callback* (query-string) - JSONP
3325    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3326    /// * *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.
3327    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3328    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3329    /// * *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.
3330    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3331    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3332    pub fn param<T>(
3333        mut self,
3334        name: T,
3335        value: T,
3336    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C>
3337    where
3338        T: AsRef<str>,
3339    {
3340        self._additional_params
3341            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3342        self
3343    }
3344
3345    /// Identifies the authorization scope for the method you are building.
3346    ///
3347    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3348    /// [`Scope::CloudPlatform`].
3349    ///
3350    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3351    /// tokens for more than one scope.
3352    ///
3353    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3354    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3355    /// sufficient, a read-write scope will do as well.
3356    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableTestIamPermissionCall<'a, C>
3357    where
3358        St: AsRef<str>,
3359    {
3360        self._scopes.insert(String::from(scope.as_ref()));
3361        self
3362    }
3363    /// Identifies the authorization scope(s) for the method you are building.
3364    ///
3365    /// See [`Self::add_scope()`] for details.
3366    pub fn add_scopes<I, St>(
3367        mut self,
3368        scopes: I,
3369    ) -> ProjectConfigVariableTestIamPermissionCall<'a, C>
3370    where
3371        I: IntoIterator<Item = St>,
3372        St: AsRef<str>,
3373    {
3374        self._scopes
3375            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3376        self
3377    }
3378
3379    /// Removes all scopes, and no default scope will be used either.
3380    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3381    /// for details).
3382    pub fn clear_scopes(mut self) -> ProjectConfigVariableTestIamPermissionCall<'a, C> {
3383        self._scopes.clear();
3384        self
3385    }
3386}
3387
3388/// Updates an existing variable with a new value.
3389///
3390/// A builder for the *configs.variables.update* method supported by a *project* resource.
3391/// It is not used directly, but through a [`ProjectMethods`] instance.
3392///
3393/// # Example
3394///
3395/// Instantiate a resource method builder
3396///
3397/// ```test_harness,no_run
3398/// # extern crate hyper;
3399/// # extern crate hyper_rustls;
3400/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
3401/// use runtimeconfig1_beta1::api::Variable;
3402/// # async fn dox() {
3403/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3404///
3405/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3406/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3407/// #     .with_native_roots()
3408/// #     .unwrap()
3409/// #     .https_only()
3410/// #     .enable_http2()
3411/// #     .build();
3412///
3413/// # let executor = hyper_util::rt::TokioExecutor::new();
3414/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3415/// #     secret,
3416/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3417/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3418/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3419/// #     ),
3420/// # ).build().await.unwrap();
3421///
3422/// # let client = hyper_util::client::legacy::Client::builder(
3423/// #     hyper_util::rt::TokioExecutor::new()
3424/// # )
3425/// # .build(
3426/// #     hyper_rustls::HttpsConnectorBuilder::new()
3427/// #         .with_native_roots()
3428/// #         .unwrap()
3429/// #         .https_or_http()
3430/// #         .enable_http2()
3431/// #         .build()
3432/// # );
3433/// # let mut hub = CloudRuntimeConfig::new(client, auth);
3434/// // As the method needs a request, you would usually fill it with the desired information
3435/// // into the respective structure. Some of the parts shown here might not be applicable !
3436/// // Values shown here are possibly random and not representative !
3437/// let mut req = Variable::default();
3438///
3439/// // You can configure optional parameters by calling the respective setters at will, and
3440/// // execute the final call using `doit()`.
3441/// // Values shown here are possibly random and not representative !
3442/// let result = hub.projects().configs_variables_update(req, "name")
3443///              .doit().await;
3444/// # }
3445/// ```
3446pub struct ProjectConfigVariableUpdateCall<'a, C>
3447where
3448    C: 'a,
3449{
3450    hub: &'a CloudRuntimeConfig<C>,
3451    _request: Variable,
3452    _name: String,
3453    _delegate: Option<&'a mut dyn common::Delegate>,
3454    _additional_params: HashMap<String, String>,
3455    _scopes: BTreeSet<String>,
3456}
3457
3458impl<'a, C> common::CallBuilder for ProjectConfigVariableUpdateCall<'a, C> {}
3459
3460impl<'a, C> ProjectConfigVariableUpdateCall<'a, C>
3461where
3462    C: common::Connector,
3463{
3464    /// Perform the operation you have build so far.
3465    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
3466        use std::borrow::Cow;
3467        use std::io::{Read, Seek};
3468
3469        use common::{url::Params, ToParts};
3470        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3471
3472        let mut dd = common::DefaultDelegate;
3473        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3474        dlg.begin(common::MethodInfo {
3475            id: "runtimeconfig.projects.configs.variables.update",
3476            http_method: hyper::Method::PUT,
3477        });
3478
3479        for &field in ["alt", "name"].iter() {
3480            if self._additional_params.contains_key(field) {
3481                dlg.finished(false);
3482                return Err(common::Error::FieldClash(field));
3483            }
3484        }
3485
3486        let mut params = Params::with_capacity(4 + self._additional_params.len());
3487        params.push("name", self._name);
3488
3489        params.extend(self._additional_params.iter());
3490
3491        params.push("alt", "json");
3492        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3493        if self._scopes.is_empty() {
3494            self._scopes
3495                .insert(Scope::CloudPlatform.as_ref().to_string());
3496        }
3497
3498        #[allow(clippy::single_element_loop)]
3499        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3500            url = params.uri_replacement(url, param_name, find_this, true);
3501        }
3502        {
3503            let to_remove = ["name"];
3504            params.remove_params(&to_remove);
3505        }
3506
3507        let url = params.parse_with_url(&url);
3508
3509        let mut json_mime_type = mime::APPLICATION_JSON;
3510        let mut request_value_reader = {
3511            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3512            common::remove_json_null_values(&mut value);
3513            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3514            serde_json::to_writer(&mut dst, &value).unwrap();
3515            dst
3516        };
3517        let request_size = request_value_reader
3518            .seek(std::io::SeekFrom::End(0))
3519            .unwrap();
3520        request_value_reader
3521            .seek(std::io::SeekFrom::Start(0))
3522            .unwrap();
3523
3524        loop {
3525            let token = match self
3526                .hub
3527                .auth
3528                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3529                .await
3530            {
3531                Ok(token) => token,
3532                Err(e) => match dlg.token(e) {
3533                    Ok(token) => token,
3534                    Err(e) => {
3535                        dlg.finished(false);
3536                        return Err(common::Error::MissingToken(e));
3537                    }
3538                },
3539            };
3540            request_value_reader
3541                .seek(std::io::SeekFrom::Start(0))
3542                .unwrap();
3543            let mut req_result = {
3544                let client = &self.hub.client;
3545                dlg.pre_request();
3546                let mut req_builder = hyper::Request::builder()
3547                    .method(hyper::Method::PUT)
3548                    .uri(url.as_str())
3549                    .header(USER_AGENT, self.hub._user_agent.clone());
3550
3551                if let Some(token) = token.as_ref() {
3552                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3553                }
3554
3555                let request = req_builder
3556                    .header(CONTENT_TYPE, json_mime_type.to_string())
3557                    .header(CONTENT_LENGTH, request_size as u64)
3558                    .body(common::to_body(
3559                        request_value_reader.get_ref().clone().into(),
3560                    ));
3561
3562                client.request(request.unwrap()).await
3563            };
3564
3565            match req_result {
3566                Err(err) => {
3567                    if let common::Retry::After(d) = dlg.http_error(&err) {
3568                        sleep(d).await;
3569                        continue;
3570                    }
3571                    dlg.finished(false);
3572                    return Err(common::Error::HttpError(err));
3573                }
3574                Ok(res) => {
3575                    let (mut parts, body) = res.into_parts();
3576                    let mut body = common::Body::new(body);
3577                    if !parts.status.is_success() {
3578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3579                        let error = serde_json::from_str(&common::to_string(&bytes));
3580                        let response = common::to_response(parts, bytes.into());
3581
3582                        if let common::Retry::After(d) =
3583                            dlg.http_failure(&response, error.as_ref().ok())
3584                        {
3585                            sleep(d).await;
3586                            continue;
3587                        }
3588
3589                        dlg.finished(false);
3590
3591                        return Err(match error {
3592                            Ok(value) => common::Error::BadRequest(value),
3593                            _ => common::Error::Failure(response),
3594                        });
3595                    }
3596                    let response = {
3597                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3598                        let encoded = common::to_string(&bytes);
3599                        match serde_json::from_str(&encoded) {
3600                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3601                            Err(error) => {
3602                                dlg.response_json_decode_error(&encoded, &error);
3603                                return Err(common::Error::JsonDecodeError(
3604                                    encoded.to_string(),
3605                                    error,
3606                                ));
3607                            }
3608                        }
3609                    };
3610
3611                    dlg.finished(true);
3612                    return Ok(response);
3613                }
3614            }
3615        }
3616    }
3617
3618    ///
3619    /// Sets the *request* property to the given value.
3620    ///
3621    /// Even though the property as already been set when instantiating this call,
3622    /// we provide this method for API completeness.
3623    pub fn request(mut self, new_value: Variable) -> ProjectConfigVariableUpdateCall<'a, C> {
3624        self._request = new_value;
3625        self
3626    }
3627    /// The name of the variable to update, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]`
3628    ///
3629    /// Sets the *name* path property to the given value.
3630    ///
3631    /// Even though the property as already been set when instantiating this call,
3632    /// we provide this method for API completeness.
3633    pub fn name(mut self, new_value: &str) -> ProjectConfigVariableUpdateCall<'a, C> {
3634        self._name = new_value.to_string();
3635        self
3636    }
3637    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3638    /// while executing the actual API request.
3639    ///
3640    /// ````text
3641    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3642    /// ````
3643    ///
3644    /// Sets the *delegate* property to the given value.
3645    pub fn delegate(
3646        mut self,
3647        new_value: &'a mut dyn common::Delegate,
3648    ) -> ProjectConfigVariableUpdateCall<'a, C> {
3649        self._delegate = Some(new_value);
3650        self
3651    }
3652
3653    /// Set any additional parameter of the query string used in the request.
3654    /// It should be used to set parameters which are not yet available through their own
3655    /// setters.
3656    ///
3657    /// Please note that this method must not be used to set any of the known parameters
3658    /// which have their own setter method. If done anyway, the request will fail.
3659    ///
3660    /// # Additional Parameters
3661    ///
3662    /// * *$.xgafv* (query-string) - V1 error format.
3663    /// * *access_token* (query-string) - OAuth access token.
3664    /// * *alt* (query-string) - Data format for response.
3665    /// * *callback* (query-string) - JSONP
3666    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3667    /// * *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.
3668    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3669    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3670    /// * *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.
3671    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3672    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3673    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableUpdateCall<'a, C>
3674    where
3675        T: AsRef<str>,
3676    {
3677        self._additional_params
3678            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3679        self
3680    }
3681
3682    /// Identifies the authorization scope for the method you are building.
3683    ///
3684    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3685    /// [`Scope::CloudPlatform`].
3686    ///
3687    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3688    /// tokens for more than one scope.
3689    ///
3690    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3691    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3692    /// sufficient, a read-write scope will do as well.
3693    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableUpdateCall<'a, C>
3694    where
3695        St: AsRef<str>,
3696    {
3697        self._scopes.insert(String::from(scope.as_ref()));
3698        self
3699    }
3700    /// Identifies the authorization scope(s) for the method you are building.
3701    ///
3702    /// See [`Self::add_scope()`] for details.
3703    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableUpdateCall<'a, C>
3704    where
3705        I: IntoIterator<Item = St>,
3706        St: AsRef<str>,
3707    {
3708        self._scopes
3709            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3710        self
3711    }
3712
3713    /// Removes all scopes, and no default scope will be used either.
3714    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3715    /// for details).
3716    pub fn clear_scopes(mut self) -> ProjectConfigVariableUpdateCall<'a, C> {
3717        self._scopes.clear();
3718        self
3719    }
3720}
3721
3722/// Watches a specific variable and waits for a change in the variable’s value. When there is a change, this method returns the new value or times out. If a variable is deleted while being watched, the `variableState` state is set to `DELETED` and the method returns the last known variable `value`. If you set the deadline for watching to a larger value than internal timeout (60 seconds), the current variable value is returned and the `variableState` will be `VARIABLE_STATE_UNSPECIFIED`. To learn more about creating a watcher, read the [Watching a Variable for Changes](https://cloud.google.com/deployment-manager/runtime-configurator/watching-a-variable) documentation.
3723///
3724/// A builder for the *configs.variables.watch* method supported by a *project* resource.
3725/// It is not used directly, but through a [`ProjectMethods`] instance.
3726///
3727/// # Example
3728///
3729/// Instantiate a resource method builder
3730///
3731/// ```test_harness,no_run
3732/// # extern crate hyper;
3733/// # extern crate hyper_rustls;
3734/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
3735/// use runtimeconfig1_beta1::api::WatchVariableRequest;
3736/// # async fn dox() {
3737/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3738///
3739/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3740/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3741/// #     .with_native_roots()
3742/// #     .unwrap()
3743/// #     .https_only()
3744/// #     .enable_http2()
3745/// #     .build();
3746///
3747/// # let executor = hyper_util::rt::TokioExecutor::new();
3748/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3749/// #     secret,
3750/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3751/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3752/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3753/// #     ),
3754/// # ).build().await.unwrap();
3755///
3756/// # let client = hyper_util::client::legacy::Client::builder(
3757/// #     hyper_util::rt::TokioExecutor::new()
3758/// # )
3759/// # .build(
3760/// #     hyper_rustls::HttpsConnectorBuilder::new()
3761/// #         .with_native_roots()
3762/// #         .unwrap()
3763/// #         .https_or_http()
3764/// #         .enable_http2()
3765/// #         .build()
3766/// # );
3767/// # let mut hub = CloudRuntimeConfig::new(client, auth);
3768/// // As the method needs a request, you would usually fill it with the desired information
3769/// // into the respective structure. Some of the parts shown here might not be applicable !
3770/// // Values shown here are possibly random and not representative !
3771/// let mut req = WatchVariableRequest::default();
3772///
3773/// // You can configure optional parameters by calling the respective setters at will, and
3774/// // execute the final call using `doit()`.
3775/// // Values shown here are possibly random and not representative !
3776/// let result = hub.projects().configs_variables_watch(req, "name")
3777///              .doit().await;
3778/// # }
3779/// ```
3780pub struct ProjectConfigVariableWatchCall<'a, C>
3781where
3782    C: 'a,
3783{
3784    hub: &'a CloudRuntimeConfig<C>,
3785    _request: WatchVariableRequest,
3786    _name: String,
3787    _delegate: Option<&'a mut dyn common::Delegate>,
3788    _additional_params: HashMap<String, String>,
3789    _scopes: BTreeSet<String>,
3790}
3791
3792impl<'a, C> common::CallBuilder for ProjectConfigVariableWatchCall<'a, C> {}
3793
3794impl<'a, C> ProjectConfigVariableWatchCall<'a, C>
3795where
3796    C: common::Connector,
3797{
3798    /// Perform the operation you have build so far.
3799    pub async fn doit(mut self) -> common::Result<(common::Response, Variable)> {
3800        use std::borrow::Cow;
3801        use std::io::{Read, Seek};
3802
3803        use common::{url::Params, ToParts};
3804        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3805
3806        let mut dd = common::DefaultDelegate;
3807        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3808        dlg.begin(common::MethodInfo {
3809            id: "runtimeconfig.projects.configs.variables.watch",
3810            http_method: hyper::Method::POST,
3811        });
3812
3813        for &field in ["alt", "name"].iter() {
3814            if self._additional_params.contains_key(field) {
3815                dlg.finished(false);
3816                return Err(common::Error::FieldClash(field));
3817            }
3818        }
3819
3820        let mut params = Params::with_capacity(4 + self._additional_params.len());
3821        params.push("name", self._name);
3822
3823        params.extend(self._additional_params.iter());
3824
3825        params.push("alt", "json");
3826        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:watch";
3827        if self._scopes.is_empty() {
3828            self._scopes
3829                .insert(Scope::CloudPlatform.as_ref().to_string());
3830        }
3831
3832        #[allow(clippy::single_element_loop)]
3833        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3834            url = params.uri_replacement(url, param_name, find_this, true);
3835        }
3836        {
3837            let to_remove = ["name"];
3838            params.remove_params(&to_remove);
3839        }
3840
3841        let url = params.parse_with_url(&url);
3842
3843        let mut json_mime_type = mime::APPLICATION_JSON;
3844        let mut request_value_reader = {
3845            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3846            common::remove_json_null_values(&mut value);
3847            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3848            serde_json::to_writer(&mut dst, &value).unwrap();
3849            dst
3850        };
3851        let request_size = request_value_reader
3852            .seek(std::io::SeekFrom::End(0))
3853            .unwrap();
3854        request_value_reader
3855            .seek(std::io::SeekFrom::Start(0))
3856            .unwrap();
3857
3858        loop {
3859            let token = match self
3860                .hub
3861                .auth
3862                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3863                .await
3864            {
3865                Ok(token) => token,
3866                Err(e) => match dlg.token(e) {
3867                    Ok(token) => token,
3868                    Err(e) => {
3869                        dlg.finished(false);
3870                        return Err(common::Error::MissingToken(e));
3871                    }
3872                },
3873            };
3874            request_value_reader
3875                .seek(std::io::SeekFrom::Start(0))
3876                .unwrap();
3877            let mut req_result = {
3878                let client = &self.hub.client;
3879                dlg.pre_request();
3880                let mut req_builder = hyper::Request::builder()
3881                    .method(hyper::Method::POST)
3882                    .uri(url.as_str())
3883                    .header(USER_AGENT, self.hub._user_agent.clone());
3884
3885                if let Some(token) = token.as_ref() {
3886                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3887                }
3888
3889                let request = req_builder
3890                    .header(CONTENT_TYPE, json_mime_type.to_string())
3891                    .header(CONTENT_LENGTH, request_size as u64)
3892                    .body(common::to_body(
3893                        request_value_reader.get_ref().clone().into(),
3894                    ));
3895
3896                client.request(request.unwrap()).await
3897            };
3898
3899            match req_result {
3900                Err(err) => {
3901                    if let common::Retry::After(d) = dlg.http_error(&err) {
3902                        sleep(d).await;
3903                        continue;
3904                    }
3905                    dlg.finished(false);
3906                    return Err(common::Error::HttpError(err));
3907                }
3908                Ok(res) => {
3909                    let (mut parts, body) = res.into_parts();
3910                    let mut body = common::Body::new(body);
3911                    if !parts.status.is_success() {
3912                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3913                        let error = serde_json::from_str(&common::to_string(&bytes));
3914                        let response = common::to_response(parts, bytes.into());
3915
3916                        if let common::Retry::After(d) =
3917                            dlg.http_failure(&response, error.as_ref().ok())
3918                        {
3919                            sleep(d).await;
3920                            continue;
3921                        }
3922
3923                        dlg.finished(false);
3924
3925                        return Err(match error {
3926                            Ok(value) => common::Error::BadRequest(value),
3927                            _ => common::Error::Failure(response),
3928                        });
3929                    }
3930                    let response = {
3931                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3932                        let encoded = common::to_string(&bytes);
3933                        match serde_json::from_str(&encoded) {
3934                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3935                            Err(error) => {
3936                                dlg.response_json_decode_error(&encoded, &error);
3937                                return Err(common::Error::JsonDecodeError(
3938                                    encoded.to_string(),
3939                                    error,
3940                                ));
3941                            }
3942                        }
3943                    };
3944
3945                    dlg.finished(true);
3946                    return Ok(response);
3947                }
3948            }
3949        }
3950    }
3951
3952    ///
3953    /// Sets the *request* property to the given value.
3954    ///
3955    /// Even though the property as already been set when instantiating this call,
3956    /// we provide this method for API completeness.
3957    pub fn request(
3958        mut self,
3959        new_value: WatchVariableRequest,
3960    ) -> ProjectConfigVariableWatchCall<'a, C> {
3961        self._request = new_value;
3962        self
3963    }
3964    /// The name of the variable to watch, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
3965    ///
3966    /// Sets the *name* path property to the given value.
3967    ///
3968    /// Even though the property as already been set when instantiating this call,
3969    /// we provide this method for API completeness.
3970    pub fn name(mut self, new_value: &str) -> ProjectConfigVariableWatchCall<'a, C> {
3971        self._name = new_value.to_string();
3972        self
3973    }
3974    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3975    /// while executing the actual API request.
3976    ///
3977    /// ````text
3978    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3979    /// ````
3980    ///
3981    /// Sets the *delegate* property to the given value.
3982    pub fn delegate(
3983        mut self,
3984        new_value: &'a mut dyn common::Delegate,
3985    ) -> ProjectConfigVariableWatchCall<'a, C> {
3986        self._delegate = Some(new_value);
3987        self
3988    }
3989
3990    /// Set any additional parameter of the query string used in the request.
3991    /// It should be used to set parameters which are not yet available through their own
3992    /// setters.
3993    ///
3994    /// Please note that this method must not be used to set any of the known parameters
3995    /// which have their own setter method. If done anyway, the request will fail.
3996    ///
3997    /// # Additional Parameters
3998    ///
3999    /// * *$.xgafv* (query-string) - V1 error format.
4000    /// * *access_token* (query-string) - OAuth access token.
4001    /// * *alt* (query-string) - Data format for response.
4002    /// * *callback* (query-string) - JSONP
4003    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4004    /// * *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.
4005    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4006    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4007    /// * *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.
4008    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4009    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4010    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigVariableWatchCall<'a, C>
4011    where
4012        T: AsRef<str>,
4013    {
4014        self._additional_params
4015            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4016        self
4017    }
4018
4019    /// Identifies the authorization scope for the method you are building.
4020    ///
4021    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4022    /// [`Scope::CloudPlatform`].
4023    ///
4024    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4025    /// tokens for more than one scope.
4026    ///
4027    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4028    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4029    /// sufficient, a read-write scope will do as well.
4030    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigVariableWatchCall<'a, C>
4031    where
4032        St: AsRef<str>,
4033    {
4034        self._scopes.insert(String::from(scope.as_ref()));
4035        self
4036    }
4037    /// Identifies the authorization scope(s) for the method you are building.
4038    ///
4039    /// See [`Self::add_scope()`] for details.
4040    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigVariableWatchCall<'a, C>
4041    where
4042        I: IntoIterator<Item = St>,
4043        St: AsRef<str>,
4044    {
4045        self._scopes
4046            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4047        self
4048    }
4049
4050    /// Removes all scopes, and no default scope will be used either.
4051    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4052    /// for details).
4053    pub fn clear_scopes(mut self) -> ProjectConfigVariableWatchCall<'a, C> {
4054        self._scopes.clear();
4055        self
4056    }
4057}
4058
4059/// Creates a Waiter resource. This operation returns a long-running Operation resource which can be polled for completion. However, a waiter with the given name will exist (and can be retrieved) prior to the operation completing. If the operation fails, the failed Waiter resource will still exist and must be deleted prior to subsequent creation attempts.
4060///
4061/// A builder for the *configs.waiters.create* method supported by a *project* resource.
4062/// It is not used directly, but through a [`ProjectMethods`] instance.
4063///
4064/// # Example
4065///
4066/// Instantiate a resource method builder
4067///
4068/// ```test_harness,no_run
4069/// # extern crate hyper;
4070/// # extern crate hyper_rustls;
4071/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
4072/// use runtimeconfig1_beta1::api::Waiter;
4073/// # async fn dox() {
4074/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4075///
4076/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4077/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4078/// #     .with_native_roots()
4079/// #     .unwrap()
4080/// #     .https_only()
4081/// #     .enable_http2()
4082/// #     .build();
4083///
4084/// # let executor = hyper_util::rt::TokioExecutor::new();
4085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4086/// #     secret,
4087/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4088/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4089/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4090/// #     ),
4091/// # ).build().await.unwrap();
4092///
4093/// # let client = hyper_util::client::legacy::Client::builder(
4094/// #     hyper_util::rt::TokioExecutor::new()
4095/// # )
4096/// # .build(
4097/// #     hyper_rustls::HttpsConnectorBuilder::new()
4098/// #         .with_native_roots()
4099/// #         .unwrap()
4100/// #         .https_or_http()
4101/// #         .enable_http2()
4102/// #         .build()
4103/// # );
4104/// # let mut hub = CloudRuntimeConfig::new(client, auth);
4105/// // As the method needs a request, you would usually fill it with the desired information
4106/// // into the respective structure. Some of the parts shown here might not be applicable !
4107/// // Values shown here are possibly random and not representative !
4108/// let mut req = Waiter::default();
4109///
4110/// // You can configure optional parameters by calling the respective setters at will, and
4111/// // execute the final call using `doit()`.
4112/// // Values shown here are possibly random and not representative !
4113/// let result = hub.projects().configs_waiters_create(req, "parent")
4114///              .request_id("sed")
4115///              .doit().await;
4116/// # }
4117/// ```
4118pub struct ProjectConfigWaiterCreateCall<'a, C>
4119where
4120    C: 'a,
4121{
4122    hub: &'a CloudRuntimeConfig<C>,
4123    _request: Waiter,
4124    _parent: String,
4125    _request_id: Option<String>,
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 ProjectConfigWaiterCreateCall<'a, C> {}
4132
4133impl<'a, C> ProjectConfigWaiterCreateCall<'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, Operation)> {
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: "runtimeconfig.projects.configs.waiters.create",
4149            http_method: hyper::Method::POST,
4150        });
4151
4152        for &field in ["alt", "parent", "requestId"].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._request_id.as_ref() {
4162            params.push("requestId", value);
4163        }
4164
4165        params.extend(self._additional_params.iter());
4166
4167        params.push("alt", "json");
4168        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/waiters";
4169        if self._scopes.is_empty() {
4170            self._scopes
4171                .insert(Scope::CloudPlatform.as_ref().to_string());
4172        }
4173
4174        #[allow(clippy::single_element_loop)]
4175        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4176            url = params.uri_replacement(url, param_name, find_this, true);
4177        }
4178        {
4179            let to_remove = ["parent"];
4180            params.remove_params(&to_remove);
4181        }
4182
4183        let url = params.parse_with_url(&url);
4184
4185        let mut json_mime_type = mime::APPLICATION_JSON;
4186        let mut request_value_reader = {
4187            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4188            common::remove_json_null_values(&mut value);
4189            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4190            serde_json::to_writer(&mut dst, &value).unwrap();
4191            dst
4192        };
4193        let request_size = request_value_reader
4194            .seek(std::io::SeekFrom::End(0))
4195            .unwrap();
4196        request_value_reader
4197            .seek(std::io::SeekFrom::Start(0))
4198            .unwrap();
4199
4200        loop {
4201            let token = match self
4202                .hub
4203                .auth
4204                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4205                .await
4206            {
4207                Ok(token) => token,
4208                Err(e) => match dlg.token(e) {
4209                    Ok(token) => token,
4210                    Err(e) => {
4211                        dlg.finished(false);
4212                        return Err(common::Error::MissingToken(e));
4213                    }
4214                },
4215            };
4216            request_value_reader
4217                .seek(std::io::SeekFrom::Start(0))
4218                .unwrap();
4219            let mut req_result = {
4220                let client = &self.hub.client;
4221                dlg.pre_request();
4222                let mut req_builder = hyper::Request::builder()
4223                    .method(hyper::Method::POST)
4224                    .uri(url.as_str())
4225                    .header(USER_AGENT, self.hub._user_agent.clone());
4226
4227                if let Some(token) = token.as_ref() {
4228                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4229                }
4230
4231                let request = req_builder
4232                    .header(CONTENT_TYPE, json_mime_type.to_string())
4233                    .header(CONTENT_LENGTH, request_size as u64)
4234                    .body(common::to_body(
4235                        request_value_reader.get_ref().clone().into(),
4236                    ));
4237
4238                client.request(request.unwrap()).await
4239            };
4240
4241            match req_result {
4242                Err(err) => {
4243                    if let common::Retry::After(d) = dlg.http_error(&err) {
4244                        sleep(d).await;
4245                        continue;
4246                    }
4247                    dlg.finished(false);
4248                    return Err(common::Error::HttpError(err));
4249                }
4250                Ok(res) => {
4251                    let (mut parts, body) = res.into_parts();
4252                    let mut body = common::Body::new(body);
4253                    if !parts.status.is_success() {
4254                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4255                        let error = serde_json::from_str(&common::to_string(&bytes));
4256                        let response = common::to_response(parts, bytes.into());
4257
4258                        if let common::Retry::After(d) =
4259                            dlg.http_failure(&response, error.as_ref().ok())
4260                        {
4261                            sleep(d).await;
4262                            continue;
4263                        }
4264
4265                        dlg.finished(false);
4266
4267                        return Err(match error {
4268                            Ok(value) => common::Error::BadRequest(value),
4269                            _ => common::Error::Failure(response),
4270                        });
4271                    }
4272                    let response = {
4273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4274                        let encoded = common::to_string(&bytes);
4275                        match serde_json::from_str(&encoded) {
4276                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4277                            Err(error) => {
4278                                dlg.response_json_decode_error(&encoded, &error);
4279                                return Err(common::Error::JsonDecodeError(
4280                                    encoded.to_string(),
4281                                    error,
4282                                ));
4283                            }
4284                        }
4285                    };
4286
4287                    dlg.finished(true);
4288                    return Ok(response);
4289                }
4290            }
4291        }
4292    }
4293
4294    ///
4295    /// Sets the *request* property to the given value.
4296    ///
4297    /// Even though the property as already been set when instantiating this call,
4298    /// we provide this method for API completeness.
4299    pub fn request(mut self, new_value: Waiter) -> ProjectConfigWaiterCreateCall<'a, C> {
4300        self._request = new_value;
4301        self
4302    }
4303    /// The path to the configuration that will own the waiter. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`.
4304    ///
4305    /// Sets the *parent* path property to the given value.
4306    ///
4307    /// Even though the property as already been set when instantiating this call,
4308    /// we provide this method for API completeness.
4309    pub fn parent(mut self, new_value: &str) -> ProjectConfigWaiterCreateCall<'a, C> {
4310        self._parent = new_value.to_string();
4311        self
4312    }
4313    /// An optional but recommended unique `request_id`. If the server receives two `create()` requests with the same `request_id`, then the second request will be ignored and the first resource created and stored in the backend is returned. Empty `request_id` fields are ignored. It is responsibility of the client to ensure uniqueness of the `request_id` strings. `request_id` strings are limited to 64 characters.
4314    ///
4315    /// Sets the *request id* query property to the given value.
4316    pub fn request_id(mut self, new_value: &str) -> ProjectConfigWaiterCreateCall<'a, C> {
4317        self._request_id = Some(new_value.to_string());
4318        self
4319    }
4320    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4321    /// while executing the actual API request.
4322    ///
4323    /// ````text
4324    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4325    /// ````
4326    ///
4327    /// Sets the *delegate* property to the given value.
4328    pub fn delegate(
4329        mut self,
4330        new_value: &'a mut dyn common::Delegate,
4331    ) -> ProjectConfigWaiterCreateCall<'a, C> {
4332        self._delegate = Some(new_value);
4333        self
4334    }
4335
4336    /// Set any additional parameter of the query string used in the request.
4337    /// It should be used to set parameters which are not yet available through their own
4338    /// setters.
4339    ///
4340    /// Please note that this method must not be used to set any of the known parameters
4341    /// which have their own setter method. If done anyway, the request will fail.
4342    ///
4343    /// # Additional Parameters
4344    ///
4345    /// * *$.xgafv* (query-string) - V1 error format.
4346    /// * *access_token* (query-string) - OAuth access token.
4347    /// * *alt* (query-string) - Data format for response.
4348    /// * *callback* (query-string) - JSONP
4349    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4350    /// * *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.
4351    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4352    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4353    /// * *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.
4354    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4355    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4356    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigWaiterCreateCall<'a, C>
4357    where
4358        T: AsRef<str>,
4359    {
4360        self._additional_params
4361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4362        self
4363    }
4364
4365    /// Identifies the authorization scope for the method you are building.
4366    ///
4367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4368    /// [`Scope::CloudPlatform`].
4369    ///
4370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4371    /// tokens for more than one scope.
4372    ///
4373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4375    /// sufficient, a read-write scope will do as well.
4376    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigWaiterCreateCall<'a, C>
4377    where
4378        St: AsRef<str>,
4379    {
4380        self._scopes.insert(String::from(scope.as_ref()));
4381        self
4382    }
4383    /// Identifies the authorization scope(s) for the method you are building.
4384    ///
4385    /// See [`Self::add_scope()`] for details.
4386    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigWaiterCreateCall<'a, C>
4387    where
4388        I: IntoIterator<Item = St>,
4389        St: AsRef<str>,
4390    {
4391        self._scopes
4392            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4393        self
4394    }
4395
4396    /// Removes all scopes, and no default scope will be used either.
4397    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4398    /// for details).
4399    pub fn clear_scopes(mut self) -> ProjectConfigWaiterCreateCall<'a, C> {
4400        self._scopes.clear();
4401        self
4402    }
4403}
4404
4405/// Deletes the waiter with the specified name.
4406///
4407/// A builder for the *configs.waiters.delete* method supported by a *project* resource.
4408/// It is not used directly, but through a [`ProjectMethods`] instance.
4409///
4410/// # Example
4411///
4412/// Instantiate a resource method builder
4413///
4414/// ```test_harness,no_run
4415/// # extern crate hyper;
4416/// # extern crate hyper_rustls;
4417/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
4418/// # async fn dox() {
4419/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4420///
4421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4422/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4423/// #     .with_native_roots()
4424/// #     .unwrap()
4425/// #     .https_only()
4426/// #     .enable_http2()
4427/// #     .build();
4428///
4429/// # let executor = hyper_util::rt::TokioExecutor::new();
4430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4431/// #     secret,
4432/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4433/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4434/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4435/// #     ),
4436/// # ).build().await.unwrap();
4437///
4438/// # let client = hyper_util::client::legacy::Client::builder(
4439/// #     hyper_util::rt::TokioExecutor::new()
4440/// # )
4441/// # .build(
4442/// #     hyper_rustls::HttpsConnectorBuilder::new()
4443/// #         .with_native_roots()
4444/// #         .unwrap()
4445/// #         .https_or_http()
4446/// #         .enable_http2()
4447/// #         .build()
4448/// # );
4449/// # let mut hub = CloudRuntimeConfig::new(client, auth);
4450/// // You can configure optional parameters by calling the respective setters at will, and
4451/// // execute the final call using `doit()`.
4452/// // Values shown here are possibly random and not representative !
4453/// let result = hub.projects().configs_waiters_delete("name")
4454///              .doit().await;
4455/// # }
4456/// ```
4457pub struct ProjectConfigWaiterDeleteCall<'a, C>
4458where
4459    C: 'a,
4460{
4461    hub: &'a CloudRuntimeConfig<C>,
4462    _name: String,
4463    _delegate: Option<&'a mut dyn common::Delegate>,
4464    _additional_params: HashMap<String, String>,
4465    _scopes: BTreeSet<String>,
4466}
4467
4468impl<'a, C> common::CallBuilder for ProjectConfigWaiterDeleteCall<'a, C> {}
4469
4470impl<'a, C> ProjectConfigWaiterDeleteCall<'a, C>
4471where
4472    C: common::Connector,
4473{
4474    /// Perform the operation you have build so far.
4475    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4476        use std::borrow::Cow;
4477        use std::io::{Read, Seek};
4478
4479        use common::{url::Params, ToParts};
4480        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4481
4482        let mut dd = common::DefaultDelegate;
4483        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4484        dlg.begin(common::MethodInfo {
4485            id: "runtimeconfig.projects.configs.waiters.delete",
4486            http_method: hyper::Method::DELETE,
4487        });
4488
4489        for &field in ["alt", "name"].iter() {
4490            if self._additional_params.contains_key(field) {
4491                dlg.finished(false);
4492                return Err(common::Error::FieldClash(field));
4493            }
4494        }
4495
4496        let mut params = Params::with_capacity(3 + self._additional_params.len());
4497        params.push("name", self._name);
4498
4499        params.extend(self._additional_params.iter());
4500
4501        params.push("alt", "json");
4502        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4503        if self._scopes.is_empty() {
4504            self._scopes
4505                .insert(Scope::CloudPlatform.as_ref().to_string());
4506        }
4507
4508        #[allow(clippy::single_element_loop)]
4509        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4510            url = params.uri_replacement(url, param_name, find_this, true);
4511        }
4512        {
4513            let to_remove = ["name"];
4514            params.remove_params(&to_remove);
4515        }
4516
4517        let url = params.parse_with_url(&url);
4518
4519        loop {
4520            let token = match self
4521                .hub
4522                .auth
4523                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4524                .await
4525            {
4526                Ok(token) => token,
4527                Err(e) => match dlg.token(e) {
4528                    Ok(token) => token,
4529                    Err(e) => {
4530                        dlg.finished(false);
4531                        return Err(common::Error::MissingToken(e));
4532                    }
4533                },
4534            };
4535            let mut req_result = {
4536                let client = &self.hub.client;
4537                dlg.pre_request();
4538                let mut req_builder = hyper::Request::builder()
4539                    .method(hyper::Method::DELETE)
4540                    .uri(url.as_str())
4541                    .header(USER_AGENT, self.hub._user_agent.clone());
4542
4543                if let Some(token) = token.as_ref() {
4544                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4545                }
4546
4547                let request = req_builder
4548                    .header(CONTENT_LENGTH, 0_u64)
4549                    .body(common::to_body::<String>(None));
4550
4551                client.request(request.unwrap()).await
4552            };
4553
4554            match req_result {
4555                Err(err) => {
4556                    if let common::Retry::After(d) = dlg.http_error(&err) {
4557                        sleep(d).await;
4558                        continue;
4559                    }
4560                    dlg.finished(false);
4561                    return Err(common::Error::HttpError(err));
4562                }
4563                Ok(res) => {
4564                    let (mut parts, body) = res.into_parts();
4565                    let mut body = common::Body::new(body);
4566                    if !parts.status.is_success() {
4567                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4568                        let error = serde_json::from_str(&common::to_string(&bytes));
4569                        let response = common::to_response(parts, bytes.into());
4570
4571                        if let common::Retry::After(d) =
4572                            dlg.http_failure(&response, error.as_ref().ok())
4573                        {
4574                            sleep(d).await;
4575                            continue;
4576                        }
4577
4578                        dlg.finished(false);
4579
4580                        return Err(match error {
4581                            Ok(value) => common::Error::BadRequest(value),
4582                            _ => common::Error::Failure(response),
4583                        });
4584                    }
4585                    let response = {
4586                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4587                        let encoded = common::to_string(&bytes);
4588                        match serde_json::from_str(&encoded) {
4589                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4590                            Err(error) => {
4591                                dlg.response_json_decode_error(&encoded, &error);
4592                                return Err(common::Error::JsonDecodeError(
4593                                    encoded.to_string(),
4594                                    error,
4595                                ));
4596                            }
4597                        }
4598                    };
4599
4600                    dlg.finished(true);
4601                    return Ok(response);
4602                }
4603            }
4604        }
4605    }
4606
4607    /// The Waiter resource to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`
4608    ///
4609    /// Sets the *name* path property to the given value.
4610    ///
4611    /// Even though the property as already been set when instantiating this call,
4612    /// we provide this method for API completeness.
4613    pub fn name(mut self, new_value: &str) -> ProjectConfigWaiterDeleteCall<'a, C> {
4614        self._name = new_value.to_string();
4615        self
4616    }
4617    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4618    /// while executing the actual API request.
4619    ///
4620    /// ````text
4621    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4622    /// ````
4623    ///
4624    /// Sets the *delegate* property to the given value.
4625    pub fn delegate(
4626        mut self,
4627        new_value: &'a mut dyn common::Delegate,
4628    ) -> ProjectConfigWaiterDeleteCall<'a, C> {
4629        self._delegate = Some(new_value);
4630        self
4631    }
4632
4633    /// Set any additional parameter of the query string used in the request.
4634    /// It should be used to set parameters which are not yet available through their own
4635    /// setters.
4636    ///
4637    /// Please note that this method must not be used to set any of the known parameters
4638    /// which have their own setter method. If done anyway, the request will fail.
4639    ///
4640    /// # Additional Parameters
4641    ///
4642    /// * *$.xgafv* (query-string) - V1 error format.
4643    /// * *access_token* (query-string) - OAuth access token.
4644    /// * *alt* (query-string) - Data format for response.
4645    /// * *callback* (query-string) - JSONP
4646    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4647    /// * *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.
4648    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4649    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4650    /// * *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.
4651    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4652    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4653    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigWaiterDeleteCall<'a, C>
4654    where
4655        T: AsRef<str>,
4656    {
4657        self._additional_params
4658            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4659        self
4660    }
4661
4662    /// Identifies the authorization scope for the method you are building.
4663    ///
4664    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4665    /// [`Scope::CloudPlatform`].
4666    ///
4667    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4668    /// tokens for more than one scope.
4669    ///
4670    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4671    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4672    /// sufficient, a read-write scope will do as well.
4673    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigWaiterDeleteCall<'a, C>
4674    where
4675        St: AsRef<str>,
4676    {
4677        self._scopes.insert(String::from(scope.as_ref()));
4678        self
4679    }
4680    /// Identifies the authorization scope(s) for the method you are building.
4681    ///
4682    /// See [`Self::add_scope()`] for details.
4683    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigWaiterDeleteCall<'a, C>
4684    where
4685        I: IntoIterator<Item = St>,
4686        St: AsRef<str>,
4687    {
4688        self._scopes
4689            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4690        self
4691    }
4692
4693    /// Removes all scopes, and no default scope will be used either.
4694    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4695    /// for details).
4696    pub fn clear_scopes(mut self) -> ProjectConfigWaiterDeleteCall<'a, C> {
4697        self._scopes.clear();
4698        self
4699    }
4700}
4701
4702/// Gets information about a single waiter.
4703///
4704/// A builder for the *configs.waiters.get* method supported by a *project* resource.
4705/// It is not used directly, but through a [`ProjectMethods`] instance.
4706///
4707/// # Example
4708///
4709/// Instantiate a resource method builder
4710///
4711/// ```test_harness,no_run
4712/// # extern crate hyper;
4713/// # extern crate hyper_rustls;
4714/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
4715/// # async fn dox() {
4716/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4717///
4718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4720/// #     .with_native_roots()
4721/// #     .unwrap()
4722/// #     .https_only()
4723/// #     .enable_http2()
4724/// #     .build();
4725///
4726/// # let executor = hyper_util::rt::TokioExecutor::new();
4727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4728/// #     secret,
4729/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4730/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4731/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4732/// #     ),
4733/// # ).build().await.unwrap();
4734///
4735/// # let client = hyper_util::client::legacy::Client::builder(
4736/// #     hyper_util::rt::TokioExecutor::new()
4737/// # )
4738/// # .build(
4739/// #     hyper_rustls::HttpsConnectorBuilder::new()
4740/// #         .with_native_roots()
4741/// #         .unwrap()
4742/// #         .https_or_http()
4743/// #         .enable_http2()
4744/// #         .build()
4745/// # );
4746/// # let mut hub = CloudRuntimeConfig::new(client, auth);
4747/// // You can configure optional parameters by calling the respective setters at will, and
4748/// // execute the final call using `doit()`.
4749/// // Values shown here are possibly random and not representative !
4750/// let result = hub.projects().configs_waiters_get("name")
4751///              .doit().await;
4752/// # }
4753/// ```
4754pub struct ProjectConfigWaiterGetCall<'a, C>
4755where
4756    C: 'a,
4757{
4758    hub: &'a CloudRuntimeConfig<C>,
4759    _name: String,
4760    _delegate: Option<&'a mut dyn common::Delegate>,
4761    _additional_params: HashMap<String, String>,
4762    _scopes: BTreeSet<String>,
4763}
4764
4765impl<'a, C> common::CallBuilder for ProjectConfigWaiterGetCall<'a, C> {}
4766
4767impl<'a, C> ProjectConfigWaiterGetCall<'a, C>
4768where
4769    C: common::Connector,
4770{
4771    /// Perform the operation you have build so far.
4772    pub async fn doit(mut self) -> common::Result<(common::Response, Waiter)> {
4773        use std::borrow::Cow;
4774        use std::io::{Read, Seek};
4775
4776        use common::{url::Params, ToParts};
4777        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4778
4779        let mut dd = common::DefaultDelegate;
4780        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4781        dlg.begin(common::MethodInfo {
4782            id: "runtimeconfig.projects.configs.waiters.get",
4783            http_method: hyper::Method::GET,
4784        });
4785
4786        for &field in ["alt", "name"].iter() {
4787            if self._additional_params.contains_key(field) {
4788                dlg.finished(false);
4789                return Err(common::Error::FieldClash(field));
4790            }
4791        }
4792
4793        let mut params = Params::with_capacity(3 + self._additional_params.len());
4794        params.push("name", self._name);
4795
4796        params.extend(self._additional_params.iter());
4797
4798        params.push("alt", "json");
4799        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4800        if self._scopes.is_empty() {
4801            self._scopes
4802                .insert(Scope::CloudPlatform.as_ref().to_string());
4803        }
4804
4805        #[allow(clippy::single_element_loop)]
4806        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4807            url = params.uri_replacement(url, param_name, find_this, true);
4808        }
4809        {
4810            let to_remove = ["name"];
4811            params.remove_params(&to_remove);
4812        }
4813
4814        let url = params.parse_with_url(&url);
4815
4816        loop {
4817            let token = match self
4818                .hub
4819                .auth
4820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4821                .await
4822            {
4823                Ok(token) => token,
4824                Err(e) => match dlg.token(e) {
4825                    Ok(token) => token,
4826                    Err(e) => {
4827                        dlg.finished(false);
4828                        return Err(common::Error::MissingToken(e));
4829                    }
4830                },
4831            };
4832            let mut req_result = {
4833                let client = &self.hub.client;
4834                dlg.pre_request();
4835                let mut req_builder = hyper::Request::builder()
4836                    .method(hyper::Method::GET)
4837                    .uri(url.as_str())
4838                    .header(USER_AGENT, self.hub._user_agent.clone());
4839
4840                if let Some(token) = token.as_ref() {
4841                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4842                }
4843
4844                let request = req_builder
4845                    .header(CONTENT_LENGTH, 0_u64)
4846                    .body(common::to_body::<String>(None));
4847
4848                client.request(request.unwrap()).await
4849            };
4850
4851            match req_result {
4852                Err(err) => {
4853                    if let common::Retry::After(d) = dlg.http_error(&err) {
4854                        sleep(d).await;
4855                        continue;
4856                    }
4857                    dlg.finished(false);
4858                    return Err(common::Error::HttpError(err));
4859                }
4860                Ok(res) => {
4861                    let (mut parts, body) = res.into_parts();
4862                    let mut body = common::Body::new(body);
4863                    if !parts.status.is_success() {
4864                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4865                        let error = serde_json::from_str(&common::to_string(&bytes));
4866                        let response = common::to_response(parts, bytes.into());
4867
4868                        if let common::Retry::After(d) =
4869                            dlg.http_failure(&response, error.as_ref().ok())
4870                        {
4871                            sleep(d).await;
4872                            continue;
4873                        }
4874
4875                        dlg.finished(false);
4876
4877                        return Err(match error {
4878                            Ok(value) => common::Error::BadRequest(value),
4879                            _ => common::Error::Failure(response),
4880                        });
4881                    }
4882                    let response = {
4883                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4884                        let encoded = common::to_string(&bytes);
4885                        match serde_json::from_str(&encoded) {
4886                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4887                            Err(error) => {
4888                                dlg.response_json_decode_error(&encoded, &error);
4889                                return Err(common::Error::JsonDecodeError(
4890                                    encoded.to_string(),
4891                                    error,
4892                                ));
4893                            }
4894                        }
4895                    };
4896
4897                    dlg.finished(true);
4898                    return Ok(response);
4899                }
4900            }
4901        }
4902    }
4903
4904    /// The fully-qualified name of the Waiter resource object to retrieve, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]`
4905    ///
4906    /// Sets the *name* path property to the given value.
4907    ///
4908    /// Even though the property as already been set when instantiating this call,
4909    /// we provide this method for API completeness.
4910    pub fn name(mut self, new_value: &str) -> ProjectConfigWaiterGetCall<'a, C> {
4911        self._name = new_value.to_string();
4912        self
4913    }
4914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4915    /// while executing the actual API request.
4916    ///
4917    /// ````text
4918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4919    /// ````
4920    ///
4921    /// Sets the *delegate* property to the given value.
4922    pub fn delegate(
4923        mut self,
4924        new_value: &'a mut dyn common::Delegate,
4925    ) -> ProjectConfigWaiterGetCall<'a, C> {
4926        self._delegate = Some(new_value);
4927        self
4928    }
4929
4930    /// Set any additional parameter of the query string used in the request.
4931    /// It should be used to set parameters which are not yet available through their own
4932    /// setters.
4933    ///
4934    /// Please note that this method must not be used to set any of the known parameters
4935    /// which have their own setter method. If done anyway, the request will fail.
4936    ///
4937    /// # Additional Parameters
4938    ///
4939    /// * *$.xgafv* (query-string) - V1 error format.
4940    /// * *access_token* (query-string) - OAuth access token.
4941    /// * *alt* (query-string) - Data format for response.
4942    /// * *callback* (query-string) - JSONP
4943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4944    /// * *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.
4945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4947    /// * *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.
4948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4950    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigWaiterGetCall<'a, C>
4951    where
4952        T: AsRef<str>,
4953    {
4954        self._additional_params
4955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4956        self
4957    }
4958
4959    /// Identifies the authorization scope for the method you are building.
4960    ///
4961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4962    /// [`Scope::CloudPlatform`].
4963    ///
4964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4965    /// tokens for more than one scope.
4966    ///
4967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4969    /// sufficient, a read-write scope will do as well.
4970    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigWaiterGetCall<'a, C>
4971    where
4972        St: AsRef<str>,
4973    {
4974        self._scopes.insert(String::from(scope.as_ref()));
4975        self
4976    }
4977    /// Identifies the authorization scope(s) for the method you are building.
4978    ///
4979    /// See [`Self::add_scope()`] for details.
4980    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigWaiterGetCall<'a, C>
4981    where
4982        I: IntoIterator<Item = St>,
4983        St: AsRef<str>,
4984    {
4985        self._scopes
4986            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4987        self
4988    }
4989
4990    /// Removes all scopes, and no default scope will be used either.
4991    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4992    /// for details).
4993    pub fn clear_scopes(mut self) -> ProjectConfigWaiterGetCall<'a, C> {
4994        self._scopes.clear();
4995        self
4996    }
4997}
4998
4999/// List waiters within the given configuration.
5000///
5001/// A builder for the *configs.waiters.list* method supported by a *project* resource.
5002/// It is not used directly, but through a [`ProjectMethods`] instance.
5003///
5004/// # Example
5005///
5006/// Instantiate a resource method builder
5007///
5008/// ```test_harness,no_run
5009/// # extern crate hyper;
5010/// # extern crate hyper_rustls;
5011/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
5012/// # async fn dox() {
5013/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5014///
5015/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5016/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5017/// #     .with_native_roots()
5018/// #     .unwrap()
5019/// #     .https_only()
5020/// #     .enable_http2()
5021/// #     .build();
5022///
5023/// # let executor = hyper_util::rt::TokioExecutor::new();
5024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5025/// #     secret,
5026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5027/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5028/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5029/// #     ),
5030/// # ).build().await.unwrap();
5031///
5032/// # let client = hyper_util::client::legacy::Client::builder(
5033/// #     hyper_util::rt::TokioExecutor::new()
5034/// # )
5035/// # .build(
5036/// #     hyper_rustls::HttpsConnectorBuilder::new()
5037/// #         .with_native_roots()
5038/// #         .unwrap()
5039/// #         .https_or_http()
5040/// #         .enable_http2()
5041/// #         .build()
5042/// # );
5043/// # let mut hub = CloudRuntimeConfig::new(client, auth);
5044/// // You can configure optional parameters by calling the respective setters at will, and
5045/// // execute the final call using `doit()`.
5046/// // Values shown here are possibly random and not representative !
5047/// let result = hub.projects().configs_waiters_list("parent")
5048///              .page_token("est")
5049///              .page_size(-50)
5050///              .doit().await;
5051/// # }
5052/// ```
5053pub struct ProjectConfigWaiterListCall<'a, C>
5054where
5055    C: 'a,
5056{
5057    hub: &'a CloudRuntimeConfig<C>,
5058    _parent: String,
5059    _page_token: Option<String>,
5060    _page_size: Option<i32>,
5061    _delegate: Option<&'a mut dyn common::Delegate>,
5062    _additional_params: HashMap<String, String>,
5063    _scopes: BTreeSet<String>,
5064}
5065
5066impl<'a, C> common::CallBuilder for ProjectConfigWaiterListCall<'a, C> {}
5067
5068impl<'a, C> ProjectConfigWaiterListCall<'a, C>
5069where
5070    C: common::Connector,
5071{
5072    /// Perform the operation you have build so far.
5073    pub async fn doit(mut self) -> common::Result<(common::Response, ListWaitersResponse)> {
5074        use std::borrow::Cow;
5075        use std::io::{Read, Seek};
5076
5077        use common::{url::Params, ToParts};
5078        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5079
5080        let mut dd = common::DefaultDelegate;
5081        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5082        dlg.begin(common::MethodInfo {
5083            id: "runtimeconfig.projects.configs.waiters.list",
5084            http_method: hyper::Method::GET,
5085        });
5086
5087        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
5088            if self._additional_params.contains_key(field) {
5089                dlg.finished(false);
5090                return Err(common::Error::FieldClash(field));
5091            }
5092        }
5093
5094        let mut params = Params::with_capacity(5 + self._additional_params.len());
5095        params.push("parent", self._parent);
5096        if let Some(value) = self._page_token.as_ref() {
5097            params.push("pageToken", value);
5098        }
5099        if let Some(value) = self._page_size.as_ref() {
5100            params.push("pageSize", value.to_string());
5101        }
5102
5103        params.extend(self._additional_params.iter());
5104
5105        params.push("alt", "json");
5106        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/waiters";
5107        if self._scopes.is_empty() {
5108            self._scopes
5109                .insert(Scope::CloudPlatform.as_ref().to_string());
5110        }
5111
5112        #[allow(clippy::single_element_loop)]
5113        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5114            url = params.uri_replacement(url, param_name, find_this, true);
5115        }
5116        {
5117            let to_remove = ["parent"];
5118            params.remove_params(&to_remove);
5119        }
5120
5121        let url = params.parse_with_url(&url);
5122
5123        loop {
5124            let token = match self
5125                .hub
5126                .auth
5127                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5128                .await
5129            {
5130                Ok(token) => token,
5131                Err(e) => match dlg.token(e) {
5132                    Ok(token) => token,
5133                    Err(e) => {
5134                        dlg.finished(false);
5135                        return Err(common::Error::MissingToken(e));
5136                    }
5137                },
5138            };
5139            let mut req_result = {
5140                let client = &self.hub.client;
5141                dlg.pre_request();
5142                let mut req_builder = hyper::Request::builder()
5143                    .method(hyper::Method::GET)
5144                    .uri(url.as_str())
5145                    .header(USER_AGENT, self.hub._user_agent.clone());
5146
5147                if let Some(token) = token.as_ref() {
5148                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5149                }
5150
5151                let request = req_builder
5152                    .header(CONTENT_LENGTH, 0_u64)
5153                    .body(common::to_body::<String>(None));
5154
5155                client.request(request.unwrap()).await
5156            };
5157
5158            match req_result {
5159                Err(err) => {
5160                    if let common::Retry::After(d) = dlg.http_error(&err) {
5161                        sleep(d).await;
5162                        continue;
5163                    }
5164                    dlg.finished(false);
5165                    return Err(common::Error::HttpError(err));
5166                }
5167                Ok(res) => {
5168                    let (mut parts, body) = res.into_parts();
5169                    let mut body = common::Body::new(body);
5170                    if !parts.status.is_success() {
5171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5172                        let error = serde_json::from_str(&common::to_string(&bytes));
5173                        let response = common::to_response(parts, bytes.into());
5174
5175                        if let common::Retry::After(d) =
5176                            dlg.http_failure(&response, error.as_ref().ok())
5177                        {
5178                            sleep(d).await;
5179                            continue;
5180                        }
5181
5182                        dlg.finished(false);
5183
5184                        return Err(match error {
5185                            Ok(value) => common::Error::BadRequest(value),
5186                            _ => common::Error::Failure(response),
5187                        });
5188                    }
5189                    let response = {
5190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5191                        let encoded = common::to_string(&bytes);
5192                        match serde_json::from_str(&encoded) {
5193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5194                            Err(error) => {
5195                                dlg.response_json_decode_error(&encoded, &error);
5196                                return Err(common::Error::JsonDecodeError(
5197                                    encoded.to_string(),
5198                                    error,
5199                                ));
5200                            }
5201                        }
5202                    };
5203
5204                    dlg.finished(true);
5205                    return Ok(response);
5206                }
5207            }
5208        }
5209    }
5210
5211    /// The path to the configuration for which you want to get a list of waiters. The configuration must exist beforehand; the path must be in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
5212    ///
5213    /// Sets the *parent* path property to the given value.
5214    ///
5215    /// Even though the property as already been set when instantiating this call,
5216    /// we provide this method for API completeness.
5217    pub fn parent(mut self, new_value: &str) -> ProjectConfigWaiterListCall<'a, C> {
5218        self._parent = new_value.to_string();
5219        self
5220    }
5221    /// Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results.
5222    ///
5223    /// Sets the *page token* query property to the given value.
5224    pub fn page_token(mut self, new_value: &str) -> ProjectConfigWaiterListCall<'a, C> {
5225        self._page_token = Some(new_value.to_string());
5226        self
5227    }
5228    /// Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements.
5229    ///
5230    /// Sets the *page size* query property to the given value.
5231    pub fn page_size(mut self, new_value: i32) -> ProjectConfigWaiterListCall<'a, C> {
5232        self._page_size = Some(new_value);
5233        self
5234    }
5235    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5236    /// while executing the actual API request.
5237    ///
5238    /// ````text
5239    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5240    /// ````
5241    ///
5242    /// Sets the *delegate* property to the given value.
5243    pub fn delegate(
5244        mut self,
5245        new_value: &'a mut dyn common::Delegate,
5246    ) -> ProjectConfigWaiterListCall<'a, C> {
5247        self._delegate = Some(new_value);
5248        self
5249    }
5250
5251    /// Set any additional parameter of the query string used in the request.
5252    /// It should be used to set parameters which are not yet available through their own
5253    /// setters.
5254    ///
5255    /// Please note that this method must not be used to set any of the known parameters
5256    /// which have their own setter method. If done anyway, the request will fail.
5257    ///
5258    /// # Additional Parameters
5259    ///
5260    /// * *$.xgafv* (query-string) - V1 error format.
5261    /// * *access_token* (query-string) - OAuth access token.
5262    /// * *alt* (query-string) - Data format for response.
5263    /// * *callback* (query-string) - JSONP
5264    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5265    /// * *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.
5266    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5267    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5268    /// * *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.
5269    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5270    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5271    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigWaiterListCall<'a, C>
5272    where
5273        T: AsRef<str>,
5274    {
5275        self._additional_params
5276            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5277        self
5278    }
5279
5280    /// Identifies the authorization scope for the method you are building.
5281    ///
5282    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5283    /// [`Scope::CloudPlatform`].
5284    ///
5285    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5286    /// tokens for more than one scope.
5287    ///
5288    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5289    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5290    /// sufficient, a read-write scope will do as well.
5291    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigWaiterListCall<'a, C>
5292    where
5293        St: AsRef<str>,
5294    {
5295        self._scopes.insert(String::from(scope.as_ref()));
5296        self
5297    }
5298    /// Identifies the authorization scope(s) for the method you are building.
5299    ///
5300    /// See [`Self::add_scope()`] for details.
5301    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigWaiterListCall<'a, C>
5302    where
5303        I: IntoIterator<Item = St>,
5304        St: AsRef<str>,
5305    {
5306        self._scopes
5307            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5308        self
5309    }
5310
5311    /// Removes all scopes, and no default scope will be used either.
5312    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5313    /// for details).
5314    pub fn clear_scopes(mut self) -> ProjectConfigWaiterListCall<'a, C> {
5315        self._scopes.clear();
5316        self
5317    }
5318}
5319
5320/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5321///
5322/// A builder for the *configs.waiters.testIamPermissions* method supported by a *project* resource.
5323/// It is not used directly, but through a [`ProjectMethods`] instance.
5324///
5325/// # Example
5326///
5327/// Instantiate a resource method builder
5328///
5329/// ```test_harness,no_run
5330/// # extern crate hyper;
5331/// # extern crate hyper_rustls;
5332/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
5333/// use runtimeconfig1_beta1::api::TestIamPermissionsRequest;
5334/// # async fn dox() {
5335/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5336///
5337/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5338/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5339/// #     .with_native_roots()
5340/// #     .unwrap()
5341/// #     .https_only()
5342/// #     .enable_http2()
5343/// #     .build();
5344///
5345/// # let executor = hyper_util::rt::TokioExecutor::new();
5346/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5347/// #     secret,
5348/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5349/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5350/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5351/// #     ),
5352/// # ).build().await.unwrap();
5353///
5354/// # let client = hyper_util::client::legacy::Client::builder(
5355/// #     hyper_util::rt::TokioExecutor::new()
5356/// # )
5357/// # .build(
5358/// #     hyper_rustls::HttpsConnectorBuilder::new()
5359/// #         .with_native_roots()
5360/// #         .unwrap()
5361/// #         .https_or_http()
5362/// #         .enable_http2()
5363/// #         .build()
5364/// # );
5365/// # let mut hub = CloudRuntimeConfig::new(client, auth);
5366/// // As the method needs a request, you would usually fill it with the desired information
5367/// // into the respective structure. Some of the parts shown here might not be applicable !
5368/// // Values shown here are possibly random and not representative !
5369/// let mut req = TestIamPermissionsRequest::default();
5370///
5371/// // You can configure optional parameters by calling the respective setters at will, and
5372/// // execute the final call using `doit()`.
5373/// // Values shown here are possibly random and not representative !
5374/// let result = hub.projects().configs_waiters_test_iam_permissions(req, "resource")
5375///              .doit().await;
5376/// # }
5377/// ```
5378pub struct ProjectConfigWaiterTestIamPermissionCall<'a, C>
5379where
5380    C: 'a,
5381{
5382    hub: &'a CloudRuntimeConfig<C>,
5383    _request: TestIamPermissionsRequest,
5384    _resource: String,
5385    _delegate: Option<&'a mut dyn common::Delegate>,
5386    _additional_params: HashMap<String, String>,
5387    _scopes: BTreeSet<String>,
5388}
5389
5390impl<'a, C> common::CallBuilder for ProjectConfigWaiterTestIamPermissionCall<'a, C> {}
5391
5392impl<'a, C> ProjectConfigWaiterTestIamPermissionCall<'a, C>
5393where
5394    C: common::Connector,
5395{
5396    /// Perform the operation you have build so far.
5397    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
5398        use std::borrow::Cow;
5399        use std::io::{Read, Seek};
5400
5401        use common::{url::Params, ToParts};
5402        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5403
5404        let mut dd = common::DefaultDelegate;
5405        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5406        dlg.begin(common::MethodInfo {
5407            id: "runtimeconfig.projects.configs.waiters.testIamPermissions",
5408            http_method: hyper::Method::POST,
5409        });
5410
5411        for &field in ["alt", "resource"].iter() {
5412            if self._additional_params.contains_key(field) {
5413                dlg.finished(false);
5414                return Err(common::Error::FieldClash(field));
5415            }
5416        }
5417
5418        let mut params = Params::with_capacity(4 + self._additional_params.len());
5419        params.push("resource", self._resource);
5420
5421        params.extend(self._additional_params.iter());
5422
5423        params.push("alt", "json");
5424        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
5425        if self._scopes.is_empty() {
5426            self._scopes
5427                .insert(Scope::CloudPlatform.as_ref().to_string());
5428        }
5429
5430        #[allow(clippy::single_element_loop)]
5431        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5432            url = params.uri_replacement(url, param_name, find_this, true);
5433        }
5434        {
5435            let to_remove = ["resource"];
5436            params.remove_params(&to_remove);
5437        }
5438
5439        let url = params.parse_with_url(&url);
5440
5441        let mut json_mime_type = mime::APPLICATION_JSON;
5442        let mut request_value_reader = {
5443            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5444            common::remove_json_null_values(&mut value);
5445            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5446            serde_json::to_writer(&mut dst, &value).unwrap();
5447            dst
5448        };
5449        let request_size = request_value_reader
5450            .seek(std::io::SeekFrom::End(0))
5451            .unwrap();
5452        request_value_reader
5453            .seek(std::io::SeekFrom::Start(0))
5454            .unwrap();
5455
5456        loop {
5457            let token = match self
5458                .hub
5459                .auth
5460                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5461                .await
5462            {
5463                Ok(token) => token,
5464                Err(e) => match dlg.token(e) {
5465                    Ok(token) => token,
5466                    Err(e) => {
5467                        dlg.finished(false);
5468                        return Err(common::Error::MissingToken(e));
5469                    }
5470                },
5471            };
5472            request_value_reader
5473                .seek(std::io::SeekFrom::Start(0))
5474                .unwrap();
5475            let mut req_result = {
5476                let client = &self.hub.client;
5477                dlg.pre_request();
5478                let mut req_builder = hyper::Request::builder()
5479                    .method(hyper::Method::POST)
5480                    .uri(url.as_str())
5481                    .header(USER_AGENT, self.hub._user_agent.clone());
5482
5483                if let Some(token) = token.as_ref() {
5484                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5485                }
5486
5487                let request = req_builder
5488                    .header(CONTENT_TYPE, json_mime_type.to_string())
5489                    .header(CONTENT_LENGTH, request_size as u64)
5490                    .body(common::to_body(
5491                        request_value_reader.get_ref().clone().into(),
5492                    ));
5493
5494                client.request(request.unwrap()).await
5495            };
5496
5497            match req_result {
5498                Err(err) => {
5499                    if let common::Retry::After(d) = dlg.http_error(&err) {
5500                        sleep(d).await;
5501                        continue;
5502                    }
5503                    dlg.finished(false);
5504                    return Err(common::Error::HttpError(err));
5505                }
5506                Ok(res) => {
5507                    let (mut parts, body) = res.into_parts();
5508                    let mut body = common::Body::new(body);
5509                    if !parts.status.is_success() {
5510                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5511                        let error = serde_json::from_str(&common::to_string(&bytes));
5512                        let response = common::to_response(parts, bytes.into());
5513
5514                        if let common::Retry::After(d) =
5515                            dlg.http_failure(&response, error.as_ref().ok())
5516                        {
5517                            sleep(d).await;
5518                            continue;
5519                        }
5520
5521                        dlg.finished(false);
5522
5523                        return Err(match error {
5524                            Ok(value) => common::Error::BadRequest(value),
5525                            _ => common::Error::Failure(response),
5526                        });
5527                    }
5528                    let response = {
5529                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5530                        let encoded = common::to_string(&bytes);
5531                        match serde_json::from_str(&encoded) {
5532                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5533                            Err(error) => {
5534                                dlg.response_json_decode_error(&encoded, &error);
5535                                return Err(common::Error::JsonDecodeError(
5536                                    encoded.to_string(),
5537                                    error,
5538                                ));
5539                            }
5540                        }
5541                    };
5542
5543                    dlg.finished(true);
5544                    return Ok(response);
5545                }
5546            }
5547        }
5548    }
5549
5550    ///
5551    /// Sets the *request* property to the given value.
5552    ///
5553    /// Even though the property as already been set when instantiating this call,
5554    /// we provide this method for API completeness.
5555    pub fn request(
5556        mut self,
5557        new_value: TestIamPermissionsRequest,
5558    ) -> ProjectConfigWaiterTestIamPermissionCall<'a, C> {
5559        self._request = new_value;
5560        self
5561    }
5562    /// 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.
5563    ///
5564    /// Sets the *resource* path property to the given value.
5565    ///
5566    /// Even though the property as already been set when instantiating this call,
5567    /// we provide this method for API completeness.
5568    pub fn resource(mut self, new_value: &str) -> ProjectConfigWaiterTestIamPermissionCall<'a, C> {
5569        self._resource = new_value.to_string();
5570        self
5571    }
5572    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5573    /// while executing the actual API request.
5574    ///
5575    /// ````text
5576    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5577    /// ````
5578    ///
5579    /// Sets the *delegate* property to the given value.
5580    pub fn delegate(
5581        mut self,
5582        new_value: &'a mut dyn common::Delegate,
5583    ) -> ProjectConfigWaiterTestIamPermissionCall<'a, C> {
5584        self._delegate = Some(new_value);
5585        self
5586    }
5587
5588    /// Set any additional parameter of the query string used in the request.
5589    /// It should be used to set parameters which are not yet available through their own
5590    /// setters.
5591    ///
5592    /// Please note that this method must not be used to set any of the known parameters
5593    /// which have their own setter method. If done anyway, the request will fail.
5594    ///
5595    /// # Additional Parameters
5596    ///
5597    /// * *$.xgafv* (query-string) - V1 error format.
5598    /// * *access_token* (query-string) - OAuth access token.
5599    /// * *alt* (query-string) - Data format for response.
5600    /// * *callback* (query-string) - JSONP
5601    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5602    /// * *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.
5603    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5604    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5605    /// * *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.
5606    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5607    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5608    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigWaiterTestIamPermissionCall<'a, C>
5609    where
5610        T: AsRef<str>,
5611    {
5612        self._additional_params
5613            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5614        self
5615    }
5616
5617    /// Identifies the authorization scope for the method you are building.
5618    ///
5619    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5620    /// [`Scope::CloudPlatform`].
5621    ///
5622    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5623    /// tokens for more than one scope.
5624    ///
5625    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5626    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5627    /// sufficient, a read-write scope will do as well.
5628    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigWaiterTestIamPermissionCall<'a, C>
5629    where
5630        St: AsRef<str>,
5631    {
5632        self._scopes.insert(String::from(scope.as_ref()));
5633        self
5634    }
5635    /// Identifies the authorization scope(s) for the method you are building.
5636    ///
5637    /// See [`Self::add_scope()`] for details.
5638    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigWaiterTestIamPermissionCall<'a, C>
5639    where
5640        I: IntoIterator<Item = St>,
5641        St: AsRef<str>,
5642    {
5643        self._scopes
5644            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5645        self
5646    }
5647
5648    /// Removes all scopes, and no default scope will be used either.
5649    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5650    /// for details).
5651    pub fn clear_scopes(mut self) -> ProjectConfigWaiterTestIamPermissionCall<'a, C> {
5652        self._scopes.clear();
5653        self
5654    }
5655}
5656
5657/// Creates a new RuntimeConfig resource. The configuration name must be unique within project.
5658///
5659/// A builder for the *configs.create* method supported by a *project* resource.
5660/// It is not used directly, but through a [`ProjectMethods`] instance.
5661///
5662/// # Example
5663///
5664/// Instantiate a resource method builder
5665///
5666/// ```test_harness,no_run
5667/// # extern crate hyper;
5668/// # extern crate hyper_rustls;
5669/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
5670/// use runtimeconfig1_beta1::api::RuntimeConfig;
5671/// # async fn dox() {
5672/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5673///
5674/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5675/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5676/// #     .with_native_roots()
5677/// #     .unwrap()
5678/// #     .https_only()
5679/// #     .enable_http2()
5680/// #     .build();
5681///
5682/// # let executor = hyper_util::rt::TokioExecutor::new();
5683/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5684/// #     secret,
5685/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5686/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5687/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5688/// #     ),
5689/// # ).build().await.unwrap();
5690///
5691/// # let client = hyper_util::client::legacy::Client::builder(
5692/// #     hyper_util::rt::TokioExecutor::new()
5693/// # )
5694/// # .build(
5695/// #     hyper_rustls::HttpsConnectorBuilder::new()
5696/// #         .with_native_roots()
5697/// #         .unwrap()
5698/// #         .https_or_http()
5699/// #         .enable_http2()
5700/// #         .build()
5701/// # );
5702/// # let mut hub = CloudRuntimeConfig::new(client, auth);
5703/// // As the method needs a request, you would usually fill it with the desired information
5704/// // into the respective structure. Some of the parts shown here might not be applicable !
5705/// // Values shown here are possibly random and not representative !
5706/// let mut req = RuntimeConfig::default();
5707///
5708/// // You can configure optional parameters by calling the respective setters at will, and
5709/// // execute the final call using `doit()`.
5710/// // Values shown here are possibly random and not representative !
5711/// let result = hub.projects().configs_create(req, "parent")
5712///              .request_id("gubergren")
5713///              .doit().await;
5714/// # }
5715/// ```
5716pub struct ProjectConfigCreateCall<'a, C>
5717where
5718    C: 'a,
5719{
5720    hub: &'a CloudRuntimeConfig<C>,
5721    _request: RuntimeConfig,
5722    _parent: String,
5723    _request_id: Option<String>,
5724    _delegate: Option<&'a mut dyn common::Delegate>,
5725    _additional_params: HashMap<String, String>,
5726    _scopes: BTreeSet<String>,
5727}
5728
5729impl<'a, C> common::CallBuilder for ProjectConfigCreateCall<'a, C> {}
5730
5731impl<'a, C> ProjectConfigCreateCall<'a, C>
5732where
5733    C: common::Connector,
5734{
5735    /// Perform the operation you have build so far.
5736    pub async fn doit(mut self) -> common::Result<(common::Response, RuntimeConfig)> {
5737        use std::borrow::Cow;
5738        use std::io::{Read, Seek};
5739
5740        use common::{url::Params, ToParts};
5741        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5742
5743        let mut dd = common::DefaultDelegate;
5744        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5745        dlg.begin(common::MethodInfo {
5746            id: "runtimeconfig.projects.configs.create",
5747            http_method: hyper::Method::POST,
5748        });
5749
5750        for &field in ["alt", "parent", "requestId"].iter() {
5751            if self._additional_params.contains_key(field) {
5752                dlg.finished(false);
5753                return Err(common::Error::FieldClash(field));
5754            }
5755        }
5756
5757        let mut params = Params::with_capacity(5 + self._additional_params.len());
5758        params.push("parent", self._parent);
5759        if let Some(value) = self._request_id.as_ref() {
5760            params.push("requestId", value);
5761        }
5762
5763        params.extend(self._additional_params.iter());
5764
5765        params.push("alt", "json");
5766        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/configs";
5767        if self._scopes.is_empty() {
5768            self._scopes
5769                .insert(Scope::CloudPlatform.as_ref().to_string());
5770        }
5771
5772        #[allow(clippy::single_element_loop)]
5773        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5774            url = params.uri_replacement(url, param_name, find_this, true);
5775        }
5776        {
5777            let to_remove = ["parent"];
5778            params.remove_params(&to_remove);
5779        }
5780
5781        let url = params.parse_with_url(&url);
5782
5783        let mut json_mime_type = mime::APPLICATION_JSON;
5784        let mut request_value_reader = {
5785            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5786            common::remove_json_null_values(&mut value);
5787            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5788            serde_json::to_writer(&mut dst, &value).unwrap();
5789            dst
5790        };
5791        let request_size = request_value_reader
5792            .seek(std::io::SeekFrom::End(0))
5793            .unwrap();
5794        request_value_reader
5795            .seek(std::io::SeekFrom::Start(0))
5796            .unwrap();
5797
5798        loop {
5799            let token = match self
5800                .hub
5801                .auth
5802                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5803                .await
5804            {
5805                Ok(token) => token,
5806                Err(e) => match dlg.token(e) {
5807                    Ok(token) => token,
5808                    Err(e) => {
5809                        dlg.finished(false);
5810                        return Err(common::Error::MissingToken(e));
5811                    }
5812                },
5813            };
5814            request_value_reader
5815                .seek(std::io::SeekFrom::Start(0))
5816                .unwrap();
5817            let mut req_result = {
5818                let client = &self.hub.client;
5819                dlg.pre_request();
5820                let mut req_builder = hyper::Request::builder()
5821                    .method(hyper::Method::POST)
5822                    .uri(url.as_str())
5823                    .header(USER_AGENT, self.hub._user_agent.clone());
5824
5825                if let Some(token) = token.as_ref() {
5826                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5827                }
5828
5829                let request = req_builder
5830                    .header(CONTENT_TYPE, json_mime_type.to_string())
5831                    .header(CONTENT_LENGTH, request_size as u64)
5832                    .body(common::to_body(
5833                        request_value_reader.get_ref().clone().into(),
5834                    ));
5835
5836                client.request(request.unwrap()).await
5837            };
5838
5839            match req_result {
5840                Err(err) => {
5841                    if let common::Retry::After(d) = dlg.http_error(&err) {
5842                        sleep(d).await;
5843                        continue;
5844                    }
5845                    dlg.finished(false);
5846                    return Err(common::Error::HttpError(err));
5847                }
5848                Ok(res) => {
5849                    let (mut parts, body) = res.into_parts();
5850                    let mut body = common::Body::new(body);
5851                    if !parts.status.is_success() {
5852                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5853                        let error = serde_json::from_str(&common::to_string(&bytes));
5854                        let response = common::to_response(parts, bytes.into());
5855
5856                        if let common::Retry::After(d) =
5857                            dlg.http_failure(&response, error.as_ref().ok())
5858                        {
5859                            sleep(d).await;
5860                            continue;
5861                        }
5862
5863                        dlg.finished(false);
5864
5865                        return Err(match error {
5866                            Ok(value) => common::Error::BadRequest(value),
5867                            _ => common::Error::Failure(response),
5868                        });
5869                    }
5870                    let response = {
5871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5872                        let encoded = common::to_string(&bytes);
5873                        match serde_json::from_str(&encoded) {
5874                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5875                            Err(error) => {
5876                                dlg.response_json_decode_error(&encoded, &error);
5877                                return Err(common::Error::JsonDecodeError(
5878                                    encoded.to_string(),
5879                                    error,
5880                                ));
5881                            }
5882                        }
5883                    };
5884
5885                    dlg.finished(true);
5886                    return Ok(response);
5887                }
5888            }
5889        }
5890    }
5891
5892    ///
5893    /// Sets the *request* property to the given value.
5894    ///
5895    /// Even though the property as already been set when instantiating this call,
5896    /// we provide this method for API completeness.
5897    pub fn request(mut self, new_value: RuntimeConfig) -> ProjectConfigCreateCall<'a, C> {
5898        self._request = new_value;
5899        self
5900    }
5901    /// The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) for this request, in the format `projects/[PROJECT_ID]`.
5902    ///
5903    /// Sets the *parent* path property to the given value.
5904    ///
5905    /// Even though the property as already been set when instantiating this call,
5906    /// we provide this method for API completeness.
5907    pub fn parent(mut self, new_value: &str) -> ProjectConfigCreateCall<'a, C> {
5908        self._parent = new_value.to_string();
5909        self
5910    }
5911    /// An optional but recommended unique `request_id`. If the server receives two `create()` requests with the same `request_id`, then the second request will be ignored and the first resource created and stored in the backend is returned. Empty `request_id` fields are ignored. It is responsibility of the client to ensure uniqueness of the `request_id` strings. `request_id` strings are limited to 64 characters.
5912    ///
5913    /// Sets the *request id* query property to the given value.
5914    pub fn request_id(mut self, new_value: &str) -> ProjectConfigCreateCall<'a, C> {
5915        self._request_id = Some(new_value.to_string());
5916        self
5917    }
5918    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5919    /// while executing the actual API request.
5920    ///
5921    /// ````text
5922    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5923    /// ````
5924    ///
5925    /// Sets the *delegate* property to the given value.
5926    pub fn delegate(
5927        mut self,
5928        new_value: &'a mut dyn common::Delegate,
5929    ) -> ProjectConfigCreateCall<'a, C> {
5930        self._delegate = Some(new_value);
5931        self
5932    }
5933
5934    /// Set any additional parameter of the query string used in the request.
5935    /// It should be used to set parameters which are not yet available through their own
5936    /// setters.
5937    ///
5938    /// Please note that this method must not be used to set any of the known parameters
5939    /// which have their own setter method. If done anyway, the request will fail.
5940    ///
5941    /// # Additional Parameters
5942    ///
5943    /// * *$.xgafv* (query-string) - V1 error format.
5944    /// * *access_token* (query-string) - OAuth access token.
5945    /// * *alt* (query-string) - Data format for response.
5946    /// * *callback* (query-string) - JSONP
5947    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5948    /// * *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.
5949    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5950    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5951    /// * *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.
5952    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5953    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5954    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigCreateCall<'a, C>
5955    where
5956        T: AsRef<str>,
5957    {
5958        self._additional_params
5959            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5960        self
5961    }
5962
5963    /// Identifies the authorization scope for the method you are building.
5964    ///
5965    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5966    /// [`Scope::CloudPlatform`].
5967    ///
5968    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5969    /// tokens for more than one scope.
5970    ///
5971    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5972    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5973    /// sufficient, a read-write scope will do as well.
5974    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigCreateCall<'a, C>
5975    where
5976        St: AsRef<str>,
5977    {
5978        self._scopes.insert(String::from(scope.as_ref()));
5979        self
5980    }
5981    /// Identifies the authorization scope(s) for the method you are building.
5982    ///
5983    /// See [`Self::add_scope()`] for details.
5984    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigCreateCall<'a, C>
5985    where
5986        I: IntoIterator<Item = St>,
5987        St: AsRef<str>,
5988    {
5989        self._scopes
5990            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5991        self
5992    }
5993
5994    /// Removes all scopes, and no default scope will be used either.
5995    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5996    /// for details).
5997    pub fn clear_scopes(mut self) -> ProjectConfigCreateCall<'a, C> {
5998        self._scopes.clear();
5999        self
6000    }
6001}
6002
6003/// Deletes a RuntimeConfig resource.
6004///
6005/// A builder for the *configs.delete* method supported by a *project* resource.
6006/// It is not used directly, but through a [`ProjectMethods`] instance.
6007///
6008/// # Example
6009///
6010/// Instantiate a resource method builder
6011///
6012/// ```test_harness,no_run
6013/// # extern crate hyper;
6014/// # extern crate hyper_rustls;
6015/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
6016/// # async fn dox() {
6017/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6018///
6019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6020/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6021/// #     .with_native_roots()
6022/// #     .unwrap()
6023/// #     .https_only()
6024/// #     .enable_http2()
6025/// #     .build();
6026///
6027/// # let executor = hyper_util::rt::TokioExecutor::new();
6028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6029/// #     secret,
6030/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6031/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6032/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6033/// #     ),
6034/// # ).build().await.unwrap();
6035///
6036/// # let client = hyper_util::client::legacy::Client::builder(
6037/// #     hyper_util::rt::TokioExecutor::new()
6038/// # )
6039/// # .build(
6040/// #     hyper_rustls::HttpsConnectorBuilder::new()
6041/// #         .with_native_roots()
6042/// #         .unwrap()
6043/// #         .https_or_http()
6044/// #         .enable_http2()
6045/// #         .build()
6046/// # );
6047/// # let mut hub = CloudRuntimeConfig::new(client, auth);
6048/// // You can configure optional parameters by calling the respective setters at will, and
6049/// // execute the final call using `doit()`.
6050/// // Values shown here are possibly random and not representative !
6051/// let result = hub.projects().configs_delete("name")
6052///              .doit().await;
6053/// # }
6054/// ```
6055pub struct ProjectConfigDeleteCall<'a, C>
6056where
6057    C: 'a,
6058{
6059    hub: &'a CloudRuntimeConfig<C>,
6060    _name: String,
6061    _delegate: Option<&'a mut dyn common::Delegate>,
6062    _additional_params: HashMap<String, String>,
6063    _scopes: BTreeSet<String>,
6064}
6065
6066impl<'a, C> common::CallBuilder for ProjectConfigDeleteCall<'a, C> {}
6067
6068impl<'a, C> ProjectConfigDeleteCall<'a, C>
6069where
6070    C: common::Connector,
6071{
6072    /// Perform the operation you have build so far.
6073    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6074        use std::borrow::Cow;
6075        use std::io::{Read, Seek};
6076
6077        use common::{url::Params, ToParts};
6078        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6079
6080        let mut dd = common::DefaultDelegate;
6081        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6082        dlg.begin(common::MethodInfo {
6083            id: "runtimeconfig.projects.configs.delete",
6084            http_method: hyper::Method::DELETE,
6085        });
6086
6087        for &field in ["alt", "name"].iter() {
6088            if self._additional_params.contains_key(field) {
6089                dlg.finished(false);
6090                return Err(common::Error::FieldClash(field));
6091            }
6092        }
6093
6094        let mut params = Params::with_capacity(3 + self._additional_params.len());
6095        params.push("name", self._name);
6096
6097        params.extend(self._additional_params.iter());
6098
6099        params.push("alt", "json");
6100        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6101        if self._scopes.is_empty() {
6102            self._scopes
6103                .insert(Scope::CloudPlatform.as_ref().to_string());
6104        }
6105
6106        #[allow(clippy::single_element_loop)]
6107        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6108            url = params.uri_replacement(url, param_name, find_this, true);
6109        }
6110        {
6111            let to_remove = ["name"];
6112            params.remove_params(&to_remove);
6113        }
6114
6115        let url = params.parse_with_url(&url);
6116
6117        loop {
6118            let token = match self
6119                .hub
6120                .auth
6121                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6122                .await
6123            {
6124                Ok(token) => token,
6125                Err(e) => match dlg.token(e) {
6126                    Ok(token) => token,
6127                    Err(e) => {
6128                        dlg.finished(false);
6129                        return Err(common::Error::MissingToken(e));
6130                    }
6131                },
6132            };
6133            let mut req_result = {
6134                let client = &self.hub.client;
6135                dlg.pre_request();
6136                let mut req_builder = hyper::Request::builder()
6137                    .method(hyper::Method::DELETE)
6138                    .uri(url.as_str())
6139                    .header(USER_AGENT, self.hub._user_agent.clone());
6140
6141                if let Some(token) = token.as_ref() {
6142                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6143                }
6144
6145                let request = req_builder
6146                    .header(CONTENT_LENGTH, 0_u64)
6147                    .body(common::to_body::<String>(None));
6148
6149                client.request(request.unwrap()).await
6150            };
6151
6152            match req_result {
6153                Err(err) => {
6154                    if let common::Retry::After(d) = dlg.http_error(&err) {
6155                        sleep(d).await;
6156                        continue;
6157                    }
6158                    dlg.finished(false);
6159                    return Err(common::Error::HttpError(err));
6160                }
6161                Ok(res) => {
6162                    let (mut parts, body) = res.into_parts();
6163                    let mut body = common::Body::new(body);
6164                    if !parts.status.is_success() {
6165                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6166                        let error = serde_json::from_str(&common::to_string(&bytes));
6167                        let response = common::to_response(parts, bytes.into());
6168
6169                        if let common::Retry::After(d) =
6170                            dlg.http_failure(&response, error.as_ref().ok())
6171                        {
6172                            sleep(d).await;
6173                            continue;
6174                        }
6175
6176                        dlg.finished(false);
6177
6178                        return Err(match error {
6179                            Ok(value) => common::Error::BadRequest(value),
6180                            _ => common::Error::Failure(response),
6181                        });
6182                    }
6183                    let response = {
6184                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6185                        let encoded = common::to_string(&bytes);
6186                        match serde_json::from_str(&encoded) {
6187                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6188                            Err(error) => {
6189                                dlg.response_json_decode_error(&encoded, &error);
6190                                return Err(common::Error::JsonDecodeError(
6191                                    encoded.to_string(),
6192                                    error,
6193                                ));
6194                            }
6195                        }
6196                    };
6197
6198                    dlg.finished(true);
6199                    return Ok(response);
6200                }
6201            }
6202        }
6203    }
6204
6205    /// The RuntimeConfig resource to delete, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
6206    ///
6207    /// Sets the *name* path property to the given value.
6208    ///
6209    /// Even though the property as already been set when instantiating this call,
6210    /// we provide this method for API completeness.
6211    pub fn name(mut self, new_value: &str) -> ProjectConfigDeleteCall<'a, C> {
6212        self._name = new_value.to_string();
6213        self
6214    }
6215    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6216    /// while executing the actual API request.
6217    ///
6218    /// ````text
6219    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6220    /// ````
6221    ///
6222    /// Sets the *delegate* property to the given value.
6223    pub fn delegate(
6224        mut self,
6225        new_value: &'a mut dyn common::Delegate,
6226    ) -> ProjectConfigDeleteCall<'a, C> {
6227        self._delegate = Some(new_value);
6228        self
6229    }
6230
6231    /// Set any additional parameter of the query string used in the request.
6232    /// It should be used to set parameters which are not yet available through their own
6233    /// setters.
6234    ///
6235    /// Please note that this method must not be used to set any of the known parameters
6236    /// which have their own setter method. If done anyway, the request will fail.
6237    ///
6238    /// # Additional Parameters
6239    ///
6240    /// * *$.xgafv* (query-string) - V1 error format.
6241    /// * *access_token* (query-string) - OAuth access token.
6242    /// * *alt* (query-string) - Data format for response.
6243    /// * *callback* (query-string) - JSONP
6244    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6245    /// * *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.
6246    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6247    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6248    /// * *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.
6249    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6250    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6251    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigDeleteCall<'a, C>
6252    where
6253        T: AsRef<str>,
6254    {
6255        self._additional_params
6256            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6257        self
6258    }
6259
6260    /// Identifies the authorization scope for the method you are building.
6261    ///
6262    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6263    /// [`Scope::CloudPlatform`].
6264    ///
6265    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6266    /// tokens for more than one scope.
6267    ///
6268    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6269    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6270    /// sufficient, a read-write scope will do as well.
6271    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigDeleteCall<'a, C>
6272    where
6273        St: AsRef<str>,
6274    {
6275        self._scopes.insert(String::from(scope.as_ref()));
6276        self
6277    }
6278    /// Identifies the authorization scope(s) for the method you are building.
6279    ///
6280    /// See [`Self::add_scope()`] for details.
6281    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigDeleteCall<'a, C>
6282    where
6283        I: IntoIterator<Item = St>,
6284        St: AsRef<str>,
6285    {
6286        self._scopes
6287            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6288        self
6289    }
6290
6291    /// Removes all scopes, and no default scope will be used either.
6292    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6293    /// for details).
6294    pub fn clear_scopes(mut self) -> ProjectConfigDeleteCall<'a, C> {
6295        self._scopes.clear();
6296        self
6297    }
6298}
6299
6300/// Gets information about a RuntimeConfig resource.
6301///
6302/// A builder for the *configs.get* method supported by a *project* resource.
6303/// It is not used directly, but through a [`ProjectMethods`] instance.
6304///
6305/// # Example
6306///
6307/// Instantiate a resource method builder
6308///
6309/// ```test_harness,no_run
6310/// # extern crate hyper;
6311/// # extern crate hyper_rustls;
6312/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
6313/// # async fn dox() {
6314/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6315///
6316/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6317/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6318/// #     .with_native_roots()
6319/// #     .unwrap()
6320/// #     .https_only()
6321/// #     .enable_http2()
6322/// #     .build();
6323///
6324/// # let executor = hyper_util::rt::TokioExecutor::new();
6325/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6326/// #     secret,
6327/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6328/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6329/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6330/// #     ),
6331/// # ).build().await.unwrap();
6332///
6333/// # let client = hyper_util::client::legacy::Client::builder(
6334/// #     hyper_util::rt::TokioExecutor::new()
6335/// # )
6336/// # .build(
6337/// #     hyper_rustls::HttpsConnectorBuilder::new()
6338/// #         .with_native_roots()
6339/// #         .unwrap()
6340/// #         .https_or_http()
6341/// #         .enable_http2()
6342/// #         .build()
6343/// # );
6344/// # let mut hub = CloudRuntimeConfig::new(client, auth);
6345/// // You can configure optional parameters by calling the respective setters at will, and
6346/// // execute the final call using `doit()`.
6347/// // Values shown here are possibly random and not representative !
6348/// let result = hub.projects().configs_get("name")
6349///              .doit().await;
6350/// # }
6351/// ```
6352pub struct ProjectConfigGetCall<'a, C>
6353where
6354    C: 'a,
6355{
6356    hub: &'a CloudRuntimeConfig<C>,
6357    _name: String,
6358    _delegate: Option<&'a mut dyn common::Delegate>,
6359    _additional_params: HashMap<String, String>,
6360    _scopes: BTreeSet<String>,
6361}
6362
6363impl<'a, C> common::CallBuilder for ProjectConfigGetCall<'a, C> {}
6364
6365impl<'a, C> ProjectConfigGetCall<'a, C>
6366where
6367    C: common::Connector,
6368{
6369    /// Perform the operation you have build so far.
6370    pub async fn doit(mut self) -> common::Result<(common::Response, RuntimeConfig)> {
6371        use std::borrow::Cow;
6372        use std::io::{Read, Seek};
6373
6374        use common::{url::Params, ToParts};
6375        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6376
6377        let mut dd = common::DefaultDelegate;
6378        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6379        dlg.begin(common::MethodInfo {
6380            id: "runtimeconfig.projects.configs.get",
6381            http_method: hyper::Method::GET,
6382        });
6383
6384        for &field in ["alt", "name"].iter() {
6385            if self._additional_params.contains_key(field) {
6386                dlg.finished(false);
6387                return Err(common::Error::FieldClash(field));
6388            }
6389        }
6390
6391        let mut params = Params::with_capacity(3 + self._additional_params.len());
6392        params.push("name", self._name);
6393
6394        params.extend(self._additional_params.iter());
6395
6396        params.push("alt", "json");
6397        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
6398        if self._scopes.is_empty() {
6399            self._scopes
6400                .insert(Scope::CloudPlatform.as_ref().to_string());
6401        }
6402
6403        #[allow(clippy::single_element_loop)]
6404        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6405            url = params.uri_replacement(url, param_name, find_this, true);
6406        }
6407        {
6408            let to_remove = ["name"];
6409            params.remove_params(&to_remove);
6410        }
6411
6412        let url = params.parse_with_url(&url);
6413
6414        loop {
6415            let token = match self
6416                .hub
6417                .auth
6418                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6419                .await
6420            {
6421                Ok(token) => token,
6422                Err(e) => match dlg.token(e) {
6423                    Ok(token) => token,
6424                    Err(e) => {
6425                        dlg.finished(false);
6426                        return Err(common::Error::MissingToken(e));
6427                    }
6428                },
6429            };
6430            let mut req_result = {
6431                let client = &self.hub.client;
6432                dlg.pre_request();
6433                let mut req_builder = hyper::Request::builder()
6434                    .method(hyper::Method::GET)
6435                    .uri(url.as_str())
6436                    .header(USER_AGENT, self.hub._user_agent.clone());
6437
6438                if let Some(token) = token.as_ref() {
6439                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6440                }
6441
6442                let request = req_builder
6443                    .header(CONTENT_LENGTH, 0_u64)
6444                    .body(common::to_body::<String>(None));
6445
6446                client.request(request.unwrap()).await
6447            };
6448
6449            match req_result {
6450                Err(err) => {
6451                    if let common::Retry::After(d) = dlg.http_error(&err) {
6452                        sleep(d).await;
6453                        continue;
6454                    }
6455                    dlg.finished(false);
6456                    return Err(common::Error::HttpError(err));
6457                }
6458                Ok(res) => {
6459                    let (mut parts, body) = res.into_parts();
6460                    let mut body = common::Body::new(body);
6461                    if !parts.status.is_success() {
6462                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6463                        let error = serde_json::from_str(&common::to_string(&bytes));
6464                        let response = common::to_response(parts, bytes.into());
6465
6466                        if let common::Retry::After(d) =
6467                            dlg.http_failure(&response, error.as_ref().ok())
6468                        {
6469                            sleep(d).await;
6470                            continue;
6471                        }
6472
6473                        dlg.finished(false);
6474
6475                        return Err(match error {
6476                            Ok(value) => common::Error::BadRequest(value),
6477                            _ => common::Error::Failure(response),
6478                        });
6479                    }
6480                    let response = {
6481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6482                        let encoded = common::to_string(&bytes);
6483                        match serde_json::from_str(&encoded) {
6484                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6485                            Err(error) => {
6486                                dlg.response_json_decode_error(&encoded, &error);
6487                                return Err(common::Error::JsonDecodeError(
6488                                    encoded.to_string(),
6489                                    error,
6490                                ));
6491                            }
6492                        }
6493                    };
6494
6495                    dlg.finished(true);
6496                    return Ok(response);
6497                }
6498            }
6499        }
6500    }
6501
6502    /// The name of the RuntimeConfig resource to retrieve, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
6503    ///
6504    /// Sets the *name* path property to the given value.
6505    ///
6506    /// Even though the property as already been set when instantiating this call,
6507    /// we provide this method for API completeness.
6508    pub fn name(mut self, new_value: &str) -> ProjectConfigGetCall<'a, C> {
6509        self._name = new_value.to_string();
6510        self
6511    }
6512    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6513    /// while executing the actual API request.
6514    ///
6515    /// ````text
6516    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6517    /// ````
6518    ///
6519    /// Sets the *delegate* property to the given value.
6520    pub fn delegate(
6521        mut self,
6522        new_value: &'a mut dyn common::Delegate,
6523    ) -> ProjectConfigGetCall<'a, C> {
6524        self._delegate = Some(new_value);
6525        self
6526    }
6527
6528    /// Set any additional parameter of the query string used in the request.
6529    /// It should be used to set parameters which are not yet available through their own
6530    /// setters.
6531    ///
6532    /// Please note that this method must not be used to set any of the known parameters
6533    /// which have their own setter method. If done anyway, the request will fail.
6534    ///
6535    /// # Additional Parameters
6536    ///
6537    /// * *$.xgafv* (query-string) - V1 error format.
6538    /// * *access_token* (query-string) - OAuth access token.
6539    /// * *alt* (query-string) - Data format for response.
6540    /// * *callback* (query-string) - JSONP
6541    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6542    /// * *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.
6543    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6544    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6545    /// * *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.
6546    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6547    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6548    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigGetCall<'a, C>
6549    where
6550        T: AsRef<str>,
6551    {
6552        self._additional_params
6553            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6554        self
6555    }
6556
6557    /// Identifies the authorization scope for the method you are building.
6558    ///
6559    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6560    /// [`Scope::CloudPlatform`].
6561    ///
6562    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6563    /// tokens for more than one scope.
6564    ///
6565    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6566    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6567    /// sufficient, a read-write scope will do as well.
6568    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigGetCall<'a, C>
6569    where
6570        St: AsRef<str>,
6571    {
6572        self._scopes.insert(String::from(scope.as_ref()));
6573        self
6574    }
6575    /// Identifies the authorization scope(s) for the method you are building.
6576    ///
6577    /// See [`Self::add_scope()`] for details.
6578    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigGetCall<'a, C>
6579    where
6580        I: IntoIterator<Item = St>,
6581        St: AsRef<str>,
6582    {
6583        self._scopes
6584            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6585        self
6586    }
6587
6588    /// Removes all scopes, and no default scope will be used either.
6589    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6590    /// for details).
6591    pub fn clear_scopes(mut self) -> ProjectConfigGetCall<'a, C> {
6592        self._scopes.clear();
6593        self
6594    }
6595}
6596
6597/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6598///
6599/// A builder for the *configs.getIamPolicy* method supported by a *project* resource.
6600/// It is not used directly, but through a [`ProjectMethods`] instance.
6601///
6602/// # Example
6603///
6604/// Instantiate a resource method builder
6605///
6606/// ```test_harness,no_run
6607/// # extern crate hyper;
6608/// # extern crate hyper_rustls;
6609/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
6610/// # async fn dox() {
6611/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6612///
6613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6614/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6615/// #     .with_native_roots()
6616/// #     .unwrap()
6617/// #     .https_only()
6618/// #     .enable_http2()
6619/// #     .build();
6620///
6621/// # let executor = hyper_util::rt::TokioExecutor::new();
6622/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6623/// #     secret,
6624/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6625/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6626/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6627/// #     ),
6628/// # ).build().await.unwrap();
6629///
6630/// # let client = hyper_util::client::legacy::Client::builder(
6631/// #     hyper_util::rt::TokioExecutor::new()
6632/// # )
6633/// # .build(
6634/// #     hyper_rustls::HttpsConnectorBuilder::new()
6635/// #         .with_native_roots()
6636/// #         .unwrap()
6637/// #         .https_or_http()
6638/// #         .enable_http2()
6639/// #         .build()
6640/// # );
6641/// # let mut hub = CloudRuntimeConfig::new(client, auth);
6642/// // You can configure optional parameters by calling the respective setters at will, and
6643/// // execute the final call using `doit()`.
6644/// // Values shown here are possibly random and not representative !
6645/// let result = hub.projects().configs_get_iam_policy("resource")
6646///              .options_requested_policy_version(-25)
6647///              .doit().await;
6648/// # }
6649/// ```
6650pub struct ProjectConfigGetIamPolicyCall<'a, C>
6651where
6652    C: 'a,
6653{
6654    hub: &'a CloudRuntimeConfig<C>,
6655    _resource: String,
6656    _options_requested_policy_version: Option<i32>,
6657    _delegate: Option<&'a mut dyn common::Delegate>,
6658    _additional_params: HashMap<String, String>,
6659    _scopes: BTreeSet<String>,
6660}
6661
6662impl<'a, C> common::CallBuilder for ProjectConfigGetIamPolicyCall<'a, C> {}
6663
6664impl<'a, C> ProjectConfigGetIamPolicyCall<'a, C>
6665where
6666    C: common::Connector,
6667{
6668    /// Perform the operation you have build so far.
6669    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6670        use std::borrow::Cow;
6671        use std::io::{Read, Seek};
6672
6673        use common::{url::Params, ToParts};
6674        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6675
6676        let mut dd = common::DefaultDelegate;
6677        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6678        dlg.begin(common::MethodInfo {
6679            id: "runtimeconfig.projects.configs.getIamPolicy",
6680            http_method: hyper::Method::GET,
6681        });
6682
6683        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6684            if self._additional_params.contains_key(field) {
6685                dlg.finished(false);
6686                return Err(common::Error::FieldClash(field));
6687            }
6688        }
6689
6690        let mut params = Params::with_capacity(4 + self._additional_params.len());
6691        params.push("resource", self._resource);
6692        if let Some(value) = self._options_requested_policy_version.as_ref() {
6693            params.push("options.requestedPolicyVersion", value.to_string());
6694        }
6695
6696        params.extend(self._additional_params.iter());
6697
6698        params.push("alt", "json");
6699        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
6700        if self._scopes.is_empty() {
6701            self._scopes
6702                .insert(Scope::CloudPlatform.as_ref().to_string());
6703        }
6704
6705        #[allow(clippy::single_element_loop)]
6706        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6707            url = params.uri_replacement(url, param_name, find_this, true);
6708        }
6709        {
6710            let to_remove = ["resource"];
6711            params.remove_params(&to_remove);
6712        }
6713
6714        let url = params.parse_with_url(&url);
6715
6716        loop {
6717            let token = match self
6718                .hub
6719                .auth
6720                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6721                .await
6722            {
6723                Ok(token) => token,
6724                Err(e) => match dlg.token(e) {
6725                    Ok(token) => token,
6726                    Err(e) => {
6727                        dlg.finished(false);
6728                        return Err(common::Error::MissingToken(e));
6729                    }
6730                },
6731            };
6732            let mut req_result = {
6733                let client = &self.hub.client;
6734                dlg.pre_request();
6735                let mut req_builder = hyper::Request::builder()
6736                    .method(hyper::Method::GET)
6737                    .uri(url.as_str())
6738                    .header(USER_AGENT, self.hub._user_agent.clone());
6739
6740                if let Some(token) = token.as_ref() {
6741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6742                }
6743
6744                let request = req_builder
6745                    .header(CONTENT_LENGTH, 0_u64)
6746                    .body(common::to_body::<String>(None));
6747
6748                client.request(request.unwrap()).await
6749            };
6750
6751            match req_result {
6752                Err(err) => {
6753                    if let common::Retry::After(d) = dlg.http_error(&err) {
6754                        sleep(d).await;
6755                        continue;
6756                    }
6757                    dlg.finished(false);
6758                    return Err(common::Error::HttpError(err));
6759                }
6760                Ok(res) => {
6761                    let (mut parts, body) = res.into_parts();
6762                    let mut body = common::Body::new(body);
6763                    if !parts.status.is_success() {
6764                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6765                        let error = serde_json::from_str(&common::to_string(&bytes));
6766                        let response = common::to_response(parts, bytes.into());
6767
6768                        if let common::Retry::After(d) =
6769                            dlg.http_failure(&response, error.as_ref().ok())
6770                        {
6771                            sleep(d).await;
6772                            continue;
6773                        }
6774
6775                        dlg.finished(false);
6776
6777                        return Err(match error {
6778                            Ok(value) => common::Error::BadRequest(value),
6779                            _ => common::Error::Failure(response),
6780                        });
6781                    }
6782                    let response = {
6783                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6784                        let encoded = common::to_string(&bytes);
6785                        match serde_json::from_str(&encoded) {
6786                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6787                            Err(error) => {
6788                                dlg.response_json_decode_error(&encoded, &error);
6789                                return Err(common::Error::JsonDecodeError(
6790                                    encoded.to_string(),
6791                                    error,
6792                                ));
6793                            }
6794                        }
6795                    };
6796
6797                    dlg.finished(true);
6798                    return Ok(response);
6799                }
6800            }
6801        }
6802    }
6803
6804    /// 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.
6805    ///
6806    /// Sets the *resource* path property to the given value.
6807    ///
6808    /// Even though the property as already been set when instantiating this call,
6809    /// we provide this method for API completeness.
6810    pub fn resource(mut self, new_value: &str) -> ProjectConfigGetIamPolicyCall<'a, C> {
6811        self._resource = new_value.to_string();
6812        self
6813    }
6814    /// 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).
6815    ///
6816    /// Sets the *options.requested policy version* query property to the given value.
6817    pub fn options_requested_policy_version(
6818        mut self,
6819        new_value: i32,
6820    ) -> ProjectConfigGetIamPolicyCall<'a, C> {
6821        self._options_requested_policy_version = Some(new_value);
6822        self
6823    }
6824    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6825    /// while executing the actual API request.
6826    ///
6827    /// ````text
6828    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6829    /// ````
6830    ///
6831    /// Sets the *delegate* property to the given value.
6832    pub fn delegate(
6833        mut self,
6834        new_value: &'a mut dyn common::Delegate,
6835    ) -> ProjectConfigGetIamPolicyCall<'a, C> {
6836        self._delegate = Some(new_value);
6837        self
6838    }
6839
6840    /// Set any additional parameter of the query string used in the request.
6841    /// It should be used to set parameters which are not yet available through their own
6842    /// setters.
6843    ///
6844    /// Please note that this method must not be used to set any of the known parameters
6845    /// which have their own setter method. If done anyway, the request will fail.
6846    ///
6847    /// # Additional Parameters
6848    ///
6849    /// * *$.xgafv* (query-string) - V1 error format.
6850    /// * *access_token* (query-string) - OAuth access token.
6851    /// * *alt* (query-string) - Data format for response.
6852    /// * *callback* (query-string) - JSONP
6853    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6854    /// * *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.
6855    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6856    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6857    /// * *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.
6858    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6859    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6860    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigGetIamPolicyCall<'a, C>
6861    where
6862        T: AsRef<str>,
6863    {
6864        self._additional_params
6865            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6866        self
6867    }
6868
6869    /// Identifies the authorization scope for the method you are building.
6870    ///
6871    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6872    /// [`Scope::CloudPlatform`].
6873    ///
6874    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6875    /// tokens for more than one scope.
6876    ///
6877    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6878    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6879    /// sufficient, a read-write scope will do as well.
6880    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigGetIamPolicyCall<'a, C>
6881    where
6882        St: AsRef<str>,
6883    {
6884        self._scopes.insert(String::from(scope.as_ref()));
6885        self
6886    }
6887    /// Identifies the authorization scope(s) for the method you are building.
6888    ///
6889    /// See [`Self::add_scope()`] for details.
6890    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigGetIamPolicyCall<'a, C>
6891    where
6892        I: IntoIterator<Item = St>,
6893        St: AsRef<str>,
6894    {
6895        self._scopes
6896            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6897        self
6898    }
6899
6900    /// Removes all scopes, and no default scope will be used either.
6901    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6902    /// for details).
6903    pub fn clear_scopes(mut self) -> ProjectConfigGetIamPolicyCall<'a, C> {
6904        self._scopes.clear();
6905        self
6906    }
6907}
6908
6909/// Lists all the RuntimeConfig resources within project.
6910///
6911/// A builder for the *configs.list* method supported by a *project* resource.
6912/// It is not used directly, but through a [`ProjectMethods`] instance.
6913///
6914/// # Example
6915///
6916/// Instantiate a resource method builder
6917///
6918/// ```test_harness,no_run
6919/// # extern crate hyper;
6920/// # extern crate hyper_rustls;
6921/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
6922/// # async fn dox() {
6923/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6924///
6925/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6926/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6927/// #     .with_native_roots()
6928/// #     .unwrap()
6929/// #     .https_only()
6930/// #     .enable_http2()
6931/// #     .build();
6932///
6933/// # let executor = hyper_util::rt::TokioExecutor::new();
6934/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6935/// #     secret,
6936/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6937/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6938/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6939/// #     ),
6940/// # ).build().await.unwrap();
6941///
6942/// # let client = hyper_util::client::legacy::Client::builder(
6943/// #     hyper_util::rt::TokioExecutor::new()
6944/// # )
6945/// # .build(
6946/// #     hyper_rustls::HttpsConnectorBuilder::new()
6947/// #         .with_native_roots()
6948/// #         .unwrap()
6949/// #         .https_or_http()
6950/// #         .enable_http2()
6951/// #         .build()
6952/// # );
6953/// # let mut hub = CloudRuntimeConfig::new(client, auth);
6954/// // You can configure optional parameters by calling the respective setters at will, and
6955/// // execute the final call using `doit()`.
6956/// // Values shown here are possibly random and not representative !
6957/// let result = hub.projects().configs_list("parent")
6958///              .page_token("sed")
6959///              .page_size(-70)
6960///              .doit().await;
6961/// # }
6962/// ```
6963pub struct ProjectConfigListCall<'a, C>
6964where
6965    C: 'a,
6966{
6967    hub: &'a CloudRuntimeConfig<C>,
6968    _parent: String,
6969    _page_token: Option<String>,
6970    _page_size: Option<i32>,
6971    _delegate: Option<&'a mut dyn common::Delegate>,
6972    _additional_params: HashMap<String, String>,
6973    _scopes: BTreeSet<String>,
6974}
6975
6976impl<'a, C> common::CallBuilder for ProjectConfigListCall<'a, C> {}
6977
6978impl<'a, C> ProjectConfigListCall<'a, C>
6979where
6980    C: common::Connector,
6981{
6982    /// Perform the operation you have build so far.
6983    pub async fn doit(mut self) -> common::Result<(common::Response, ListConfigsResponse)> {
6984        use std::borrow::Cow;
6985        use std::io::{Read, Seek};
6986
6987        use common::{url::Params, ToParts};
6988        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6989
6990        let mut dd = common::DefaultDelegate;
6991        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6992        dlg.begin(common::MethodInfo {
6993            id: "runtimeconfig.projects.configs.list",
6994            http_method: hyper::Method::GET,
6995        });
6996
6997        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6998            if self._additional_params.contains_key(field) {
6999                dlg.finished(false);
7000                return Err(common::Error::FieldClash(field));
7001            }
7002        }
7003
7004        let mut params = Params::with_capacity(5 + self._additional_params.len());
7005        params.push("parent", self._parent);
7006        if let Some(value) = self._page_token.as_ref() {
7007            params.push("pageToken", value);
7008        }
7009        if let Some(value) = self._page_size.as_ref() {
7010            params.push("pageSize", value.to_string());
7011        }
7012
7013        params.extend(self._additional_params.iter());
7014
7015        params.push("alt", "json");
7016        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/configs";
7017        if self._scopes.is_empty() {
7018            self._scopes
7019                .insert(Scope::CloudPlatform.as_ref().to_string());
7020        }
7021
7022        #[allow(clippy::single_element_loop)]
7023        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7024            url = params.uri_replacement(url, param_name, find_this, true);
7025        }
7026        {
7027            let to_remove = ["parent"];
7028            params.remove_params(&to_remove);
7029        }
7030
7031        let url = params.parse_with_url(&url);
7032
7033        loop {
7034            let token = match self
7035                .hub
7036                .auth
7037                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7038                .await
7039            {
7040                Ok(token) => token,
7041                Err(e) => match dlg.token(e) {
7042                    Ok(token) => token,
7043                    Err(e) => {
7044                        dlg.finished(false);
7045                        return Err(common::Error::MissingToken(e));
7046                    }
7047                },
7048            };
7049            let mut req_result = {
7050                let client = &self.hub.client;
7051                dlg.pre_request();
7052                let mut req_builder = hyper::Request::builder()
7053                    .method(hyper::Method::GET)
7054                    .uri(url.as_str())
7055                    .header(USER_AGENT, self.hub._user_agent.clone());
7056
7057                if let Some(token) = token.as_ref() {
7058                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7059                }
7060
7061                let request = req_builder
7062                    .header(CONTENT_LENGTH, 0_u64)
7063                    .body(common::to_body::<String>(None));
7064
7065                client.request(request.unwrap()).await
7066            };
7067
7068            match req_result {
7069                Err(err) => {
7070                    if let common::Retry::After(d) = dlg.http_error(&err) {
7071                        sleep(d).await;
7072                        continue;
7073                    }
7074                    dlg.finished(false);
7075                    return Err(common::Error::HttpError(err));
7076                }
7077                Ok(res) => {
7078                    let (mut parts, body) = res.into_parts();
7079                    let mut body = common::Body::new(body);
7080                    if !parts.status.is_success() {
7081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7082                        let error = serde_json::from_str(&common::to_string(&bytes));
7083                        let response = common::to_response(parts, bytes.into());
7084
7085                        if let common::Retry::After(d) =
7086                            dlg.http_failure(&response, error.as_ref().ok())
7087                        {
7088                            sleep(d).await;
7089                            continue;
7090                        }
7091
7092                        dlg.finished(false);
7093
7094                        return Err(match error {
7095                            Ok(value) => common::Error::BadRequest(value),
7096                            _ => common::Error::Failure(response),
7097                        });
7098                    }
7099                    let response = {
7100                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7101                        let encoded = common::to_string(&bytes);
7102                        match serde_json::from_str(&encoded) {
7103                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7104                            Err(error) => {
7105                                dlg.response_json_decode_error(&encoded, &error);
7106                                return Err(common::Error::JsonDecodeError(
7107                                    encoded.to_string(),
7108                                    error,
7109                                ));
7110                            }
7111                        }
7112                    };
7113
7114                    dlg.finished(true);
7115                    return Ok(response);
7116                }
7117            }
7118        }
7119    }
7120
7121    /// The [project ID](https://support.google.com/cloud/answer/6158840?hl=en&ref_topic=6158848) for this request, in the format `projects/[PROJECT_ID]`.
7122    ///
7123    /// Sets the *parent* path property to the given value.
7124    ///
7125    /// Even though the property as already been set when instantiating this call,
7126    /// we provide this method for API completeness.
7127    pub fn parent(mut self, new_value: &str) -> ProjectConfigListCall<'a, C> {
7128        self._parent = new_value.to_string();
7129        self
7130    }
7131    /// Specifies a page token to use. Set `pageToken` to a `nextPageToken` returned by a previous list request to get the next page of results.
7132    ///
7133    /// Sets the *page token* query property to the given value.
7134    pub fn page_token(mut self, new_value: &str) -> ProjectConfigListCall<'a, C> {
7135        self._page_token = Some(new_value.to_string());
7136        self
7137    }
7138    /// Specifies the number of results to return per page. If there are fewer elements than the specified number, returns all elements.
7139    ///
7140    /// Sets the *page size* query property to the given value.
7141    pub fn page_size(mut self, new_value: i32) -> ProjectConfigListCall<'a, C> {
7142        self._page_size = Some(new_value);
7143        self
7144    }
7145    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7146    /// while executing the actual API request.
7147    ///
7148    /// ````text
7149    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7150    /// ````
7151    ///
7152    /// Sets the *delegate* property to the given value.
7153    pub fn delegate(
7154        mut self,
7155        new_value: &'a mut dyn common::Delegate,
7156    ) -> ProjectConfigListCall<'a, C> {
7157        self._delegate = Some(new_value);
7158        self
7159    }
7160
7161    /// Set any additional parameter of the query string used in the request.
7162    /// It should be used to set parameters which are not yet available through their own
7163    /// setters.
7164    ///
7165    /// Please note that this method must not be used to set any of the known parameters
7166    /// which have their own setter method. If done anyway, the request will fail.
7167    ///
7168    /// # Additional Parameters
7169    ///
7170    /// * *$.xgafv* (query-string) - V1 error format.
7171    /// * *access_token* (query-string) - OAuth access token.
7172    /// * *alt* (query-string) - Data format for response.
7173    /// * *callback* (query-string) - JSONP
7174    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7175    /// * *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.
7176    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7177    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7178    /// * *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.
7179    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7180    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7181    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigListCall<'a, C>
7182    where
7183        T: AsRef<str>,
7184    {
7185        self._additional_params
7186            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7187        self
7188    }
7189
7190    /// Identifies the authorization scope for the method you are building.
7191    ///
7192    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7193    /// [`Scope::CloudPlatform`].
7194    ///
7195    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7196    /// tokens for more than one scope.
7197    ///
7198    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7199    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7200    /// sufficient, a read-write scope will do as well.
7201    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigListCall<'a, C>
7202    where
7203        St: AsRef<str>,
7204    {
7205        self._scopes.insert(String::from(scope.as_ref()));
7206        self
7207    }
7208    /// Identifies the authorization scope(s) for the method you are building.
7209    ///
7210    /// See [`Self::add_scope()`] for details.
7211    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigListCall<'a, C>
7212    where
7213        I: IntoIterator<Item = St>,
7214        St: AsRef<str>,
7215    {
7216        self._scopes
7217            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7218        self
7219    }
7220
7221    /// Removes all scopes, and no default scope will be used either.
7222    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7223    /// for details).
7224    pub fn clear_scopes(mut self) -> ProjectConfigListCall<'a, C> {
7225        self._scopes.clear();
7226        self
7227    }
7228}
7229
7230/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7231///
7232/// A builder for the *configs.setIamPolicy* method supported by a *project* resource.
7233/// It is not used directly, but through a [`ProjectMethods`] instance.
7234///
7235/// # Example
7236///
7237/// Instantiate a resource method builder
7238///
7239/// ```test_harness,no_run
7240/// # extern crate hyper;
7241/// # extern crate hyper_rustls;
7242/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
7243/// use runtimeconfig1_beta1::api::SetIamPolicyRequest;
7244/// # async fn dox() {
7245/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7246///
7247/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7248/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7249/// #     .with_native_roots()
7250/// #     .unwrap()
7251/// #     .https_only()
7252/// #     .enable_http2()
7253/// #     .build();
7254///
7255/// # let executor = hyper_util::rt::TokioExecutor::new();
7256/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7257/// #     secret,
7258/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7259/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7260/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7261/// #     ),
7262/// # ).build().await.unwrap();
7263///
7264/// # let client = hyper_util::client::legacy::Client::builder(
7265/// #     hyper_util::rt::TokioExecutor::new()
7266/// # )
7267/// # .build(
7268/// #     hyper_rustls::HttpsConnectorBuilder::new()
7269/// #         .with_native_roots()
7270/// #         .unwrap()
7271/// #         .https_or_http()
7272/// #         .enable_http2()
7273/// #         .build()
7274/// # );
7275/// # let mut hub = CloudRuntimeConfig::new(client, auth);
7276/// // As the method needs a request, you would usually fill it with the desired information
7277/// // into the respective structure. Some of the parts shown here might not be applicable !
7278/// // Values shown here are possibly random and not representative !
7279/// let mut req = SetIamPolicyRequest::default();
7280///
7281/// // You can configure optional parameters by calling the respective setters at will, and
7282/// // execute the final call using `doit()`.
7283/// // Values shown here are possibly random and not representative !
7284/// let result = hub.projects().configs_set_iam_policy(req, "resource")
7285///              .doit().await;
7286/// # }
7287/// ```
7288pub struct ProjectConfigSetIamPolicyCall<'a, C>
7289where
7290    C: 'a,
7291{
7292    hub: &'a CloudRuntimeConfig<C>,
7293    _request: SetIamPolicyRequest,
7294    _resource: String,
7295    _delegate: Option<&'a mut dyn common::Delegate>,
7296    _additional_params: HashMap<String, String>,
7297    _scopes: BTreeSet<String>,
7298}
7299
7300impl<'a, C> common::CallBuilder for ProjectConfigSetIamPolicyCall<'a, C> {}
7301
7302impl<'a, C> ProjectConfigSetIamPolicyCall<'a, C>
7303where
7304    C: common::Connector,
7305{
7306    /// Perform the operation you have build so far.
7307    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7308        use std::borrow::Cow;
7309        use std::io::{Read, Seek};
7310
7311        use common::{url::Params, ToParts};
7312        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7313
7314        let mut dd = common::DefaultDelegate;
7315        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7316        dlg.begin(common::MethodInfo {
7317            id: "runtimeconfig.projects.configs.setIamPolicy",
7318            http_method: hyper::Method::POST,
7319        });
7320
7321        for &field in ["alt", "resource"].iter() {
7322            if self._additional_params.contains_key(field) {
7323                dlg.finished(false);
7324                return Err(common::Error::FieldClash(field));
7325            }
7326        }
7327
7328        let mut params = Params::with_capacity(4 + self._additional_params.len());
7329        params.push("resource", self._resource);
7330
7331        params.extend(self._additional_params.iter());
7332
7333        params.push("alt", "json");
7334        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
7335        if self._scopes.is_empty() {
7336            self._scopes
7337                .insert(Scope::CloudPlatform.as_ref().to_string());
7338        }
7339
7340        #[allow(clippy::single_element_loop)]
7341        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7342            url = params.uri_replacement(url, param_name, find_this, true);
7343        }
7344        {
7345            let to_remove = ["resource"];
7346            params.remove_params(&to_remove);
7347        }
7348
7349        let url = params.parse_with_url(&url);
7350
7351        let mut json_mime_type = mime::APPLICATION_JSON;
7352        let mut request_value_reader = {
7353            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7354            common::remove_json_null_values(&mut value);
7355            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7356            serde_json::to_writer(&mut dst, &value).unwrap();
7357            dst
7358        };
7359        let request_size = request_value_reader
7360            .seek(std::io::SeekFrom::End(0))
7361            .unwrap();
7362        request_value_reader
7363            .seek(std::io::SeekFrom::Start(0))
7364            .unwrap();
7365
7366        loop {
7367            let token = match self
7368                .hub
7369                .auth
7370                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7371                .await
7372            {
7373                Ok(token) => token,
7374                Err(e) => match dlg.token(e) {
7375                    Ok(token) => token,
7376                    Err(e) => {
7377                        dlg.finished(false);
7378                        return Err(common::Error::MissingToken(e));
7379                    }
7380                },
7381            };
7382            request_value_reader
7383                .seek(std::io::SeekFrom::Start(0))
7384                .unwrap();
7385            let mut req_result = {
7386                let client = &self.hub.client;
7387                dlg.pre_request();
7388                let mut req_builder = hyper::Request::builder()
7389                    .method(hyper::Method::POST)
7390                    .uri(url.as_str())
7391                    .header(USER_AGENT, self.hub._user_agent.clone());
7392
7393                if let Some(token) = token.as_ref() {
7394                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7395                }
7396
7397                let request = req_builder
7398                    .header(CONTENT_TYPE, json_mime_type.to_string())
7399                    .header(CONTENT_LENGTH, request_size as u64)
7400                    .body(common::to_body(
7401                        request_value_reader.get_ref().clone().into(),
7402                    ));
7403
7404                client.request(request.unwrap()).await
7405            };
7406
7407            match req_result {
7408                Err(err) => {
7409                    if let common::Retry::After(d) = dlg.http_error(&err) {
7410                        sleep(d).await;
7411                        continue;
7412                    }
7413                    dlg.finished(false);
7414                    return Err(common::Error::HttpError(err));
7415                }
7416                Ok(res) => {
7417                    let (mut parts, body) = res.into_parts();
7418                    let mut body = common::Body::new(body);
7419                    if !parts.status.is_success() {
7420                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7421                        let error = serde_json::from_str(&common::to_string(&bytes));
7422                        let response = common::to_response(parts, bytes.into());
7423
7424                        if let common::Retry::After(d) =
7425                            dlg.http_failure(&response, error.as_ref().ok())
7426                        {
7427                            sleep(d).await;
7428                            continue;
7429                        }
7430
7431                        dlg.finished(false);
7432
7433                        return Err(match error {
7434                            Ok(value) => common::Error::BadRequest(value),
7435                            _ => common::Error::Failure(response),
7436                        });
7437                    }
7438                    let response = {
7439                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7440                        let encoded = common::to_string(&bytes);
7441                        match serde_json::from_str(&encoded) {
7442                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7443                            Err(error) => {
7444                                dlg.response_json_decode_error(&encoded, &error);
7445                                return Err(common::Error::JsonDecodeError(
7446                                    encoded.to_string(),
7447                                    error,
7448                                ));
7449                            }
7450                        }
7451                    };
7452
7453                    dlg.finished(true);
7454                    return Ok(response);
7455                }
7456            }
7457        }
7458    }
7459
7460    ///
7461    /// Sets the *request* property to the given value.
7462    ///
7463    /// Even though the property as already been set when instantiating this call,
7464    /// we provide this method for API completeness.
7465    pub fn request(
7466        mut self,
7467        new_value: SetIamPolicyRequest,
7468    ) -> ProjectConfigSetIamPolicyCall<'a, C> {
7469        self._request = new_value;
7470        self
7471    }
7472    /// 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.
7473    ///
7474    /// Sets the *resource* path property to the given value.
7475    ///
7476    /// Even though the property as already been set when instantiating this call,
7477    /// we provide this method for API completeness.
7478    pub fn resource(mut self, new_value: &str) -> ProjectConfigSetIamPolicyCall<'a, C> {
7479        self._resource = new_value.to_string();
7480        self
7481    }
7482    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7483    /// while executing the actual API request.
7484    ///
7485    /// ````text
7486    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7487    /// ````
7488    ///
7489    /// Sets the *delegate* property to the given value.
7490    pub fn delegate(
7491        mut self,
7492        new_value: &'a mut dyn common::Delegate,
7493    ) -> ProjectConfigSetIamPolicyCall<'a, C> {
7494        self._delegate = Some(new_value);
7495        self
7496    }
7497
7498    /// Set any additional parameter of the query string used in the request.
7499    /// It should be used to set parameters which are not yet available through their own
7500    /// setters.
7501    ///
7502    /// Please note that this method must not be used to set any of the known parameters
7503    /// which have their own setter method. If done anyway, the request will fail.
7504    ///
7505    /// # Additional Parameters
7506    ///
7507    /// * *$.xgafv* (query-string) - V1 error format.
7508    /// * *access_token* (query-string) - OAuth access token.
7509    /// * *alt* (query-string) - Data format for response.
7510    /// * *callback* (query-string) - JSONP
7511    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7512    /// * *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.
7513    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7514    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7515    /// * *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.
7516    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7517    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7518    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigSetIamPolicyCall<'a, C>
7519    where
7520        T: AsRef<str>,
7521    {
7522        self._additional_params
7523            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7524        self
7525    }
7526
7527    /// Identifies the authorization scope for the method you are building.
7528    ///
7529    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7530    /// [`Scope::CloudPlatform`].
7531    ///
7532    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7533    /// tokens for more than one scope.
7534    ///
7535    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7536    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7537    /// sufficient, a read-write scope will do as well.
7538    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigSetIamPolicyCall<'a, C>
7539    where
7540        St: AsRef<str>,
7541    {
7542        self._scopes.insert(String::from(scope.as_ref()));
7543        self
7544    }
7545    /// Identifies the authorization scope(s) for the method you are building.
7546    ///
7547    /// See [`Self::add_scope()`] for details.
7548    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigSetIamPolicyCall<'a, C>
7549    where
7550        I: IntoIterator<Item = St>,
7551        St: AsRef<str>,
7552    {
7553        self._scopes
7554            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7555        self
7556    }
7557
7558    /// Removes all scopes, and no default scope will be used either.
7559    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7560    /// for details).
7561    pub fn clear_scopes(mut self) -> ProjectConfigSetIamPolicyCall<'a, C> {
7562        self._scopes.clear();
7563        self
7564    }
7565}
7566
7567/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7568///
7569/// A builder for the *configs.testIamPermissions* method supported by a *project* resource.
7570/// It is not used directly, but through a [`ProjectMethods`] instance.
7571///
7572/// # Example
7573///
7574/// Instantiate a resource method builder
7575///
7576/// ```test_harness,no_run
7577/// # extern crate hyper;
7578/// # extern crate hyper_rustls;
7579/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
7580/// use runtimeconfig1_beta1::api::TestIamPermissionsRequest;
7581/// # async fn dox() {
7582/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7583///
7584/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7585/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7586/// #     .with_native_roots()
7587/// #     .unwrap()
7588/// #     .https_only()
7589/// #     .enable_http2()
7590/// #     .build();
7591///
7592/// # let executor = hyper_util::rt::TokioExecutor::new();
7593/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7594/// #     secret,
7595/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7596/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7597/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7598/// #     ),
7599/// # ).build().await.unwrap();
7600///
7601/// # let client = hyper_util::client::legacy::Client::builder(
7602/// #     hyper_util::rt::TokioExecutor::new()
7603/// # )
7604/// # .build(
7605/// #     hyper_rustls::HttpsConnectorBuilder::new()
7606/// #         .with_native_roots()
7607/// #         .unwrap()
7608/// #         .https_or_http()
7609/// #         .enable_http2()
7610/// #         .build()
7611/// # );
7612/// # let mut hub = CloudRuntimeConfig::new(client, auth);
7613/// // As the method needs a request, you would usually fill it with the desired information
7614/// // into the respective structure. Some of the parts shown here might not be applicable !
7615/// // Values shown here are possibly random and not representative !
7616/// let mut req = TestIamPermissionsRequest::default();
7617///
7618/// // You can configure optional parameters by calling the respective setters at will, and
7619/// // execute the final call using `doit()`.
7620/// // Values shown here are possibly random and not representative !
7621/// let result = hub.projects().configs_test_iam_permissions(req, "resource")
7622///              .doit().await;
7623/// # }
7624/// ```
7625pub struct ProjectConfigTestIamPermissionCall<'a, C>
7626where
7627    C: 'a,
7628{
7629    hub: &'a CloudRuntimeConfig<C>,
7630    _request: TestIamPermissionsRequest,
7631    _resource: String,
7632    _delegate: Option<&'a mut dyn common::Delegate>,
7633    _additional_params: HashMap<String, String>,
7634    _scopes: BTreeSet<String>,
7635}
7636
7637impl<'a, C> common::CallBuilder for ProjectConfigTestIamPermissionCall<'a, C> {}
7638
7639impl<'a, C> ProjectConfigTestIamPermissionCall<'a, C>
7640where
7641    C: common::Connector,
7642{
7643    /// Perform the operation you have build so far.
7644    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7645        use std::borrow::Cow;
7646        use std::io::{Read, Seek};
7647
7648        use common::{url::Params, ToParts};
7649        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7650
7651        let mut dd = common::DefaultDelegate;
7652        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7653        dlg.begin(common::MethodInfo {
7654            id: "runtimeconfig.projects.configs.testIamPermissions",
7655            http_method: hyper::Method::POST,
7656        });
7657
7658        for &field in ["alt", "resource"].iter() {
7659            if self._additional_params.contains_key(field) {
7660                dlg.finished(false);
7661                return Err(common::Error::FieldClash(field));
7662            }
7663        }
7664
7665        let mut params = Params::with_capacity(4 + self._additional_params.len());
7666        params.push("resource", self._resource);
7667
7668        params.extend(self._additional_params.iter());
7669
7670        params.push("alt", "json");
7671        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
7672        if self._scopes.is_empty() {
7673            self._scopes
7674                .insert(Scope::CloudPlatform.as_ref().to_string());
7675        }
7676
7677        #[allow(clippy::single_element_loop)]
7678        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7679            url = params.uri_replacement(url, param_name, find_this, true);
7680        }
7681        {
7682            let to_remove = ["resource"];
7683            params.remove_params(&to_remove);
7684        }
7685
7686        let url = params.parse_with_url(&url);
7687
7688        let mut json_mime_type = mime::APPLICATION_JSON;
7689        let mut request_value_reader = {
7690            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7691            common::remove_json_null_values(&mut value);
7692            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7693            serde_json::to_writer(&mut dst, &value).unwrap();
7694            dst
7695        };
7696        let request_size = request_value_reader
7697            .seek(std::io::SeekFrom::End(0))
7698            .unwrap();
7699        request_value_reader
7700            .seek(std::io::SeekFrom::Start(0))
7701            .unwrap();
7702
7703        loop {
7704            let token = match self
7705                .hub
7706                .auth
7707                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7708                .await
7709            {
7710                Ok(token) => token,
7711                Err(e) => match dlg.token(e) {
7712                    Ok(token) => token,
7713                    Err(e) => {
7714                        dlg.finished(false);
7715                        return Err(common::Error::MissingToken(e));
7716                    }
7717                },
7718            };
7719            request_value_reader
7720                .seek(std::io::SeekFrom::Start(0))
7721                .unwrap();
7722            let mut req_result = {
7723                let client = &self.hub.client;
7724                dlg.pre_request();
7725                let mut req_builder = hyper::Request::builder()
7726                    .method(hyper::Method::POST)
7727                    .uri(url.as_str())
7728                    .header(USER_AGENT, self.hub._user_agent.clone());
7729
7730                if let Some(token) = token.as_ref() {
7731                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7732                }
7733
7734                let request = req_builder
7735                    .header(CONTENT_TYPE, json_mime_type.to_string())
7736                    .header(CONTENT_LENGTH, request_size as u64)
7737                    .body(common::to_body(
7738                        request_value_reader.get_ref().clone().into(),
7739                    ));
7740
7741                client.request(request.unwrap()).await
7742            };
7743
7744            match req_result {
7745                Err(err) => {
7746                    if let common::Retry::After(d) = dlg.http_error(&err) {
7747                        sleep(d).await;
7748                        continue;
7749                    }
7750                    dlg.finished(false);
7751                    return Err(common::Error::HttpError(err));
7752                }
7753                Ok(res) => {
7754                    let (mut parts, body) = res.into_parts();
7755                    let mut body = common::Body::new(body);
7756                    if !parts.status.is_success() {
7757                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7758                        let error = serde_json::from_str(&common::to_string(&bytes));
7759                        let response = common::to_response(parts, bytes.into());
7760
7761                        if let common::Retry::After(d) =
7762                            dlg.http_failure(&response, error.as_ref().ok())
7763                        {
7764                            sleep(d).await;
7765                            continue;
7766                        }
7767
7768                        dlg.finished(false);
7769
7770                        return Err(match error {
7771                            Ok(value) => common::Error::BadRequest(value),
7772                            _ => common::Error::Failure(response),
7773                        });
7774                    }
7775                    let response = {
7776                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7777                        let encoded = common::to_string(&bytes);
7778                        match serde_json::from_str(&encoded) {
7779                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7780                            Err(error) => {
7781                                dlg.response_json_decode_error(&encoded, &error);
7782                                return Err(common::Error::JsonDecodeError(
7783                                    encoded.to_string(),
7784                                    error,
7785                                ));
7786                            }
7787                        }
7788                    };
7789
7790                    dlg.finished(true);
7791                    return Ok(response);
7792                }
7793            }
7794        }
7795    }
7796
7797    ///
7798    /// Sets the *request* property to the given value.
7799    ///
7800    /// Even though the property as already been set when instantiating this call,
7801    /// we provide this method for API completeness.
7802    pub fn request(
7803        mut self,
7804        new_value: TestIamPermissionsRequest,
7805    ) -> ProjectConfigTestIamPermissionCall<'a, C> {
7806        self._request = new_value;
7807        self
7808    }
7809    /// 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.
7810    ///
7811    /// Sets the *resource* path property to the given value.
7812    ///
7813    /// Even though the property as already been set when instantiating this call,
7814    /// we provide this method for API completeness.
7815    pub fn resource(mut self, new_value: &str) -> ProjectConfigTestIamPermissionCall<'a, C> {
7816        self._resource = new_value.to_string();
7817        self
7818    }
7819    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7820    /// while executing the actual API request.
7821    ///
7822    /// ````text
7823    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7824    /// ````
7825    ///
7826    /// Sets the *delegate* property to the given value.
7827    pub fn delegate(
7828        mut self,
7829        new_value: &'a mut dyn common::Delegate,
7830    ) -> ProjectConfigTestIamPermissionCall<'a, C> {
7831        self._delegate = Some(new_value);
7832        self
7833    }
7834
7835    /// Set any additional parameter of the query string used in the request.
7836    /// It should be used to set parameters which are not yet available through their own
7837    /// setters.
7838    ///
7839    /// Please note that this method must not be used to set any of the known parameters
7840    /// which have their own setter method. If done anyway, the request will fail.
7841    ///
7842    /// # Additional Parameters
7843    ///
7844    /// * *$.xgafv* (query-string) - V1 error format.
7845    /// * *access_token* (query-string) - OAuth access token.
7846    /// * *alt* (query-string) - Data format for response.
7847    /// * *callback* (query-string) - JSONP
7848    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7849    /// * *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.
7850    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7851    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7852    /// * *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.
7853    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7854    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7855    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigTestIamPermissionCall<'a, C>
7856    where
7857        T: AsRef<str>,
7858    {
7859        self._additional_params
7860            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7861        self
7862    }
7863
7864    /// Identifies the authorization scope for the method you are building.
7865    ///
7866    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7867    /// [`Scope::CloudPlatform`].
7868    ///
7869    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7870    /// tokens for more than one scope.
7871    ///
7872    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7873    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7874    /// sufficient, a read-write scope will do as well.
7875    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigTestIamPermissionCall<'a, C>
7876    where
7877        St: AsRef<str>,
7878    {
7879        self._scopes.insert(String::from(scope.as_ref()));
7880        self
7881    }
7882    /// Identifies the authorization scope(s) for the method you are building.
7883    ///
7884    /// See [`Self::add_scope()`] for details.
7885    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigTestIamPermissionCall<'a, C>
7886    where
7887        I: IntoIterator<Item = St>,
7888        St: AsRef<str>,
7889    {
7890        self._scopes
7891            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7892        self
7893    }
7894
7895    /// Removes all scopes, and no default scope will be used either.
7896    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7897    /// for details).
7898    pub fn clear_scopes(mut self) -> ProjectConfigTestIamPermissionCall<'a, C> {
7899        self._scopes.clear();
7900        self
7901    }
7902}
7903
7904/// Updates a RuntimeConfig resource. The configuration must exist beforehand.
7905///
7906/// A builder for the *configs.update* method supported by a *project* resource.
7907/// It is not used directly, but through a [`ProjectMethods`] instance.
7908///
7909/// # Example
7910///
7911/// Instantiate a resource method builder
7912///
7913/// ```test_harness,no_run
7914/// # extern crate hyper;
7915/// # extern crate hyper_rustls;
7916/// # extern crate google_runtimeconfig1_beta1 as runtimeconfig1_beta1;
7917/// use runtimeconfig1_beta1::api::RuntimeConfig;
7918/// # async fn dox() {
7919/// # use runtimeconfig1_beta1::{CloudRuntimeConfig, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7920///
7921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7923/// #     .with_native_roots()
7924/// #     .unwrap()
7925/// #     .https_only()
7926/// #     .enable_http2()
7927/// #     .build();
7928///
7929/// # let executor = hyper_util::rt::TokioExecutor::new();
7930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7931/// #     secret,
7932/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7933/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7934/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7935/// #     ),
7936/// # ).build().await.unwrap();
7937///
7938/// # let client = hyper_util::client::legacy::Client::builder(
7939/// #     hyper_util::rt::TokioExecutor::new()
7940/// # )
7941/// # .build(
7942/// #     hyper_rustls::HttpsConnectorBuilder::new()
7943/// #         .with_native_roots()
7944/// #         .unwrap()
7945/// #         .https_or_http()
7946/// #         .enable_http2()
7947/// #         .build()
7948/// # );
7949/// # let mut hub = CloudRuntimeConfig::new(client, auth);
7950/// // As the method needs a request, you would usually fill it with the desired information
7951/// // into the respective structure. Some of the parts shown here might not be applicable !
7952/// // Values shown here are possibly random and not representative !
7953/// let mut req = RuntimeConfig::default();
7954///
7955/// // You can configure optional parameters by calling the respective setters at will, and
7956/// // execute the final call using `doit()`.
7957/// // Values shown here are possibly random and not representative !
7958/// let result = hub.projects().configs_update(req, "name")
7959///              .doit().await;
7960/// # }
7961/// ```
7962pub struct ProjectConfigUpdateCall<'a, C>
7963where
7964    C: 'a,
7965{
7966    hub: &'a CloudRuntimeConfig<C>,
7967    _request: RuntimeConfig,
7968    _name: String,
7969    _delegate: Option<&'a mut dyn common::Delegate>,
7970    _additional_params: HashMap<String, String>,
7971    _scopes: BTreeSet<String>,
7972}
7973
7974impl<'a, C> common::CallBuilder for ProjectConfigUpdateCall<'a, C> {}
7975
7976impl<'a, C> ProjectConfigUpdateCall<'a, C>
7977where
7978    C: common::Connector,
7979{
7980    /// Perform the operation you have build so far.
7981    pub async fn doit(mut self) -> common::Result<(common::Response, RuntimeConfig)> {
7982        use std::borrow::Cow;
7983        use std::io::{Read, Seek};
7984
7985        use common::{url::Params, ToParts};
7986        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7987
7988        let mut dd = common::DefaultDelegate;
7989        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7990        dlg.begin(common::MethodInfo {
7991            id: "runtimeconfig.projects.configs.update",
7992            http_method: hyper::Method::PUT,
7993        });
7994
7995        for &field in ["alt", "name"].iter() {
7996            if self._additional_params.contains_key(field) {
7997                dlg.finished(false);
7998                return Err(common::Error::FieldClash(field));
7999            }
8000        }
8001
8002        let mut params = Params::with_capacity(4 + self._additional_params.len());
8003        params.push("name", self._name);
8004
8005        params.extend(self._additional_params.iter());
8006
8007        params.push("alt", "json");
8008        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8009        if self._scopes.is_empty() {
8010            self._scopes
8011                .insert(Scope::CloudPlatform.as_ref().to_string());
8012        }
8013
8014        #[allow(clippy::single_element_loop)]
8015        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8016            url = params.uri_replacement(url, param_name, find_this, true);
8017        }
8018        {
8019            let to_remove = ["name"];
8020            params.remove_params(&to_remove);
8021        }
8022
8023        let url = params.parse_with_url(&url);
8024
8025        let mut json_mime_type = mime::APPLICATION_JSON;
8026        let mut request_value_reader = {
8027            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8028            common::remove_json_null_values(&mut value);
8029            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8030            serde_json::to_writer(&mut dst, &value).unwrap();
8031            dst
8032        };
8033        let request_size = request_value_reader
8034            .seek(std::io::SeekFrom::End(0))
8035            .unwrap();
8036        request_value_reader
8037            .seek(std::io::SeekFrom::Start(0))
8038            .unwrap();
8039
8040        loop {
8041            let token = match self
8042                .hub
8043                .auth
8044                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8045                .await
8046            {
8047                Ok(token) => token,
8048                Err(e) => match dlg.token(e) {
8049                    Ok(token) => token,
8050                    Err(e) => {
8051                        dlg.finished(false);
8052                        return Err(common::Error::MissingToken(e));
8053                    }
8054                },
8055            };
8056            request_value_reader
8057                .seek(std::io::SeekFrom::Start(0))
8058                .unwrap();
8059            let mut req_result = {
8060                let client = &self.hub.client;
8061                dlg.pre_request();
8062                let mut req_builder = hyper::Request::builder()
8063                    .method(hyper::Method::PUT)
8064                    .uri(url.as_str())
8065                    .header(USER_AGENT, self.hub._user_agent.clone());
8066
8067                if let Some(token) = token.as_ref() {
8068                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8069                }
8070
8071                let request = req_builder
8072                    .header(CONTENT_TYPE, json_mime_type.to_string())
8073                    .header(CONTENT_LENGTH, request_size as u64)
8074                    .body(common::to_body(
8075                        request_value_reader.get_ref().clone().into(),
8076                    ));
8077
8078                client.request(request.unwrap()).await
8079            };
8080
8081            match req_result {
8082                Err(err) => {
8083                    if let common::Retry::After(d) = dlg.http_error(&err) {
8084                        sleep(d).await;
8085                        continue;
8086                    }
8087                    dlg.finished(false);
8088                    return Err(common::Error::HttpError(err));
8089                }
8090                Ok(res) => {
8091                    let (mut parts, body) = res.into_parts();
8092                    let mut body = common::Body::new(body);
8093                    if !parts.status.is_success() {
8094                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8095                        let error = serde_json::from_str(&common::to_string(&bytes));
8096                        let response = common::to_response(parts, bytes.into());
8097
8098                        if let common::Retry::After(d) =
8099                            dlg.http_failure(&response, error.as_ref().ok())
8100                        {
8101                            sleep(d).await;
8102                            continue;
8103                        }
8104
8105                        dlg.finished(false);
8106
8107                        return Err(match error {
8108                            Ok(value) => common::Error::BadRequest(value),
8109                            _ => common::Error::Failure(response),
8110                        });
8111                    }
8112                    let response = {
8113                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8114                        let encoded = common::to_string(&bytes);
8115                        match serde_json::from_str(&encoded) {
8116                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8117                            Err(error) => {
8118                                dlg.response_json_decode_error(&encoded, &error);
8119                                return Err(common::Error::JsonDecodeError(
8120                                    encoded.to_string(),
8121                                    error,
8122                                ));
8123                            }
8124                        }
8125                    };
8126
8127                    dlg.finished(true);
8128                    return Ok(response);
8129                }
8130            }
8131        }
8132    }
8133
8134    ///
8135    /// Sets the *request* property to the given value.
8136    ///
8137    /// Even though the property as already been set when instantiating this call,
8138    /// we provide this method for API completeness.
8139    pub fn request(mut self, new_value: RuntimeConfig) -> ProjectConfigUpdateCall<'a, C> {
8140        self._request = new_value;
8141        self
8142    }
8143    /// The name of the RuntimeConfig resource to update, in the format: `projects/[PROJECT_ID]/configs/[CONFIG_NAME]`
8144    ///
8145    /// Sets the *name* path property to the given value.
8146    ///
8147    /// Even though the property as already been set when instantiating this call,
8148    /// we provide this method for API completeness.
8149    pub fn name(mut self, new_value: &str) -> ProjectConfigUpdateCall<'a, C> {
8150        self._name = new_value.to_string();
8151        self
8152    }
8153    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8154    /// while executing the actual API request.
8155    ///
8156    /// ````text
8157    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8158    /// ````
8159    ///
8160    /// Sets the *delegate* property to the given value.
8161    pub fn delegate(
8162        mut self,
8163        new_value: &'a mut dyn common::Delegate,
8164    ) -> ProjectConfigUpdateCall<'a, C> {
8165        self._delegate = Some(new_value);
8166        self
8167    }
8168
8169    /// Set any additional parameter of the query string used in the request.
8170    /// It should be used to set parameters which are not yet available through their own
8171    /// setters.
8172    ///
8173    /// Please note that this method must not be used to set any of the known parameters
8174    /// which have their own setter method. If done anyway, the request will fail.
8175    ///
8176    /// # Additional Parameters
8177    ///
8178    /// * *$.xgafv* (query-string) - V1 error format.
8179    /// * *access_token* (query-string) - OAuth access token.
8180    /// * *alt* (query-string) - Data format for response.
8181    /// * *callback* (query-string) - JSONP
8182    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8183    /// * *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.
8184    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8185    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8186    /// * *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.
8187    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8188    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8189    pub fn param<T>(mut self, name: T, value: T) -> ProjectConfigUpdateCall<'a, C>
8190    where
8191        T: AsRef<str>,
8192    {
8193        self._additional_params
8194            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8195        self
8196    }
8197
8198    /// Identifies the authorization scope for the method you are building.
8199    ///
8200    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8201    /// [`Scope::CloudPlatform`].
8202    ///
8203    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8204    /// tokens for more than one scope.
8205    ///
8206    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8207    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8208    /// sufficient, a read-write scope will do as well.
8209    pub fn add_scope<St>(mut self, scope: St) -> ProjectConfigUpdateCall<'a, C>
8210    where
8211        St: AsRef<str>,
8212    {
8213        self._scopes.insert(String::from(scope.as_ref()));
8214        self
8215    }
8216    /// Identifies the authorization scope(s) for the method you are building.
8217    ///
8218    /// See [`Self::add_scope()`] for details.
8219    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectConfigUpdateCall<'a, C>
8220    where
8221        I: IntoIterator<Item = St>,
8222        St: AsRef<str>,
8223    {
8224        self._scopes
8225            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8226        self
8227    }
8228
8229    /// Removes all scopes, and no default scope will be used either.
8230    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8231    /// for details).
8232    pub fn clear_scopes(mut self) -> ProjectConfigUpdateCall<'a, C> {
8233        self._scopes.clear();
8234        self
8235    }
8236}