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