google_secretmanager1_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
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all SecretManager related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
49/// use secretmanager1_beta1::api::DestroySecretVersionRequest;
50/// use secretmanager1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = SecretManager::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = DestroySecretVersionRequest::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().secrets_versions_destroy(req, "name")
99/// .doit().await;
100///
101/// match result {
102/// Err(e) => match e {
103/// // The Error enum provides details about what exactly happened.
104/// // You can also just use its `Debug`, `Display` or `Error` traits
105/// Error::HttpError(_)
106/// |Error::Io(_)
107/// |Error::MissingAPIKey
108/// |Error::MissingToken(_)
109/// |Error::Cancelled
110/// |Error::UploadSizeLimitExceeded(_, _)
111/// |Error::Failure(_)
112/// |Error::BadRequest(_)
113/// |Error::FieldClash(_)
114/// |Error::JsonDecodeError(_, _) => println!("{}", e),
115/// },
116/// Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct SecretManager<C> {
122 pub client: common::Client<C>,
123 pub auth: Box<dyn common::GetToken>,
124 _user_agent: String,
125 _base_url: String,
126 _root_url: String,
127}
128
129impl<C> common::Hub for SecretManager<C> {}
130
131impl<'a, C> SecretManager<C> {
132 pub fn new<A: 'static + common::GetToken>(
133 client: common::Client<C>,
134 auth: A,
135 ) -> SecretManager<C> {
136 SecretManager {
137 client,
138 auth: Box::new(auth),
139 _user_agent: "google-api-rust-client/7.0.0".to_string(),
140 _base_url: "https://secretmanager.googleapis.com/".to_string(),
141 _root_url: "https://secretmanager.googleapis.com/".to_string(),
142 }
143 }
144
145 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
146 ProjectMethods { hub: self }
147 }
148
149 /// Set the user-agent header field to use in all requests to the server.
150 /// It defaults to `google-api-rust-client/7.0.0`.
151 ///
152 /// Returns the previously set user-agent.
153 pub fn user_agent(&mut self, agent_name: String) -> String {
154 std::mem::replace(&mut self._user_agent, agent_name)
155 }
156
157 /// Set the base url to use in all requests to the server.
158 /// It defaults to `https://secretmanager.googleapis.com/`.
159 ///
160 /// Returns the previously set base url.
161 pub fn base_url(&mut self, new_base_url: String) -> String {
162 std::mem::replace(&mut self._base_url, new_base_url)
163 }
164
165 /// Set the root url to use in all requests to the server.
166 /// It defaults to `https://secretmanager.googleapis.com/`.
167 ///
168 /// Returns the previously set root url.
169 pub fn root_url(&mut self, new_root_url: String) -> String {
170 std::mem::replace(&mut self._root_url, new_root_url)
171 }
172}
173
174// ############
175// SCHEMAS ###
176// ##########
177/// Response message for SecretManagerService.AccessSecretVersion.
178///
179/// # Activities
180///
181/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
182/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
183///
184/// * [secrets versions access projects](ProjectSecretVersionAccesCall) (response)
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct AccessSecretVersionResponse {
189 /// The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`.
190 pub name: Option<String>,
191 /// Secret payload
192 pub payload: Option<SecretPayload>,
193}
194
195impl common::ResponseResult for AccessSecretVersionResponse {}
196
197/// Request message for SecretManagerService.AddSecretVersion.
198///
199/// # Activities
200///
201/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
202/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
203///
204/// * [secrets add version projects](ProjectSecretAddVersionCall) (request)
205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
206#[serde_with::serde_as]
207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
208pub struct AddSecretVersionRequest {
209 /// Required. The secret payload of the SecretVersion.
210 pub payload: Option<SecretPayload>,
211}
212
213impl common::RequestValue for AddSecretVersionRequest {}
214
215/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
216///
217/// This type is not used in any activity, and only used as *part* of another schema.
218///
219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
220#[serde_with::serde_as]
221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
222pub struct AuditConfig {
223 /// The configuration for logging of each type of permission.
224 #[serde(rename = "auditLogConfigs")]
225 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
226 /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
227 pub service: Option<String>,
228}
229
230impl common::Part for AuditConfig {}
231
232/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
233///
234/// This type is not used in any activity, and only used as *part* of another schema.
235///
236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
237#[serde_with::serde_as]
238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
239pub struct AuditLogConfig {
240 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
241 #[serde(rename = "exemptedMembers")]
242 pub exempted_members: Option<Vec<String>>,
243 /// The log type that this config enables.
244 #[serde(rename = "logType")]
245 pub log_type: Option<String>,
246}
247
248impl common::Part for AuditLogConfig {}
249
250/// A replication policy that replicates the Secret payload without any restrictions.
251///
252/// This type is not used in any activity, and only used as *part* of another schema.
253///
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct Automatic {
258 _never_set: Option<bool>,
259}
260
261impl common::Part for Automatic {}
262
263/// Associates `members`, or principals, with a `role`.
264///
265/// This type is not used in any activity, and only used as *part* of another schema.
266///
267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
268#[serde_with::serde_as]
269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
270pub struct Binding {
271 /// 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).
272 pub condition: Option<Expr>,
273 /// 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`.
274 pub members: Option<Vec<String>>,
275 /// 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).
276 pub role: Option<String>,
277}
278
279impl common::Part for Binding {}
280
281/// Request message for SecretManagerService.DestroySecretVersion.
282///
283/// # Activities
284///
285/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
286/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
287///
288/// * [secrets versions destroy projects](ProjectSecretVersionDestroyCall) (request)
289#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
290#[serde_with::serde_as]
291#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
292pub struct DestroySecretVersionRequest {
293 _never_set: Option<bool>,
294}
295
296impl common::RequestValue for DestroySecretVersionRequest {}
297
298/// Request message for SecretManagerService.DisableSecretVersion.
299///
300/// # Activities
301///
302/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
303/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
304///
305/// * [secrets versions disable projects](ProjectSecretVersionDisableCall) (request)
306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
307#[serde_with::serde_as]
308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
309pub struct DisableSecretVersionRequest {
310 _never_set: Option<bool>,
311}
312
313impl common::RequestValue for DisableSecretVersionRequest {}
314
315/// 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); }
316///
317/// # Activities
318///
319/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
320/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
321///
322/// * [secrets delete projects](ProjectSecretDeleteCall) (response)
323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
324#[serde_with::serde_as]
325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
326pub struct Empty {
327 _never_set: Option<bool>,
328}
329
330impl common::ResponseResult for Empty {}
331
332/// Request message for SecretManagerService.EnableSecretVersion.
333///
334/// # Activities
335///
336/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
337/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
338///
339/// * [secrets versions enable projects](ProjectSecretVersionEnableCall) (request)
340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
341#[serde_with::serde_as]
342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
343pub struct EnableSecretVersionRequest {
344 _never_set: Option<bool>,
345}
346
347impl common::RequestValue for EnableSecretVersionRequest {}
348
349/// 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.
350///
351/// This type is not used in any activity, and only used as *part* of another schema.
352///
353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
354#[serde_with::serde_as]
355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
356pub struct Expr {
357 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
358 pub description: Option<String>,
359 /// Textual representation of an expression in Common Expression Language syntax.
360 pub expression: Option<String>,
361 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
362 pub location: Option<String>,
363 /// 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.
364 pub title: Option<String>,
365}
366
367impl common::Part for Expr {}
368
369/// The response message for Locations.ListLocations.
370///
371/// # Activities
372///
373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
375///
376/// * [locations list projects](ProjectLocationListCall) (response)
377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
378#[serde_with::serde_as]
379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
380pub struct ListLocationsResponse {
381 /// A list of locations that matches the specified filter in the request.
382 pub locations: Option<Vec<Location>>,
383 /// The standard List next-page token.
384 #[serde(rename = "nextPageToken")]
385 pub next_page_token: Option<String>,
386}
387
388impl common::ResponseResult for ListLocationsResponse {}
389
390/// Response message for SecretManagerService.ListSecretVersions.
391///
392/// # Activities
393///
394/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
395/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
396///
397/// * [secrets versions list projects](ProjectSecretVersionListCall) (response)
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct ListSecretVersionsResponse {
402 /// A token to retrieve the next page of results. Pass this value in ListSecretVersionsRequest.page_token to retrieve the next page.
403 #[serde(rename = "nextPageToken")]
404 pub next_page_token: Option<String>,
405 /// The total number of SecretVersions.
406 #[serde(rename = "totalSize")]
407 pub total_size: Option<i32>,
408 /// The list of SecretVersions sorted in reverse by create_time (newest first).
409 pub versions: Option<Vec<SecretVersion>>,
410}
411
412impl common::ResponseResult for ListSecretVersionsResponse {}
413
414/// Response message for SecretManagerService.ListSecrets.
415///
416/// # Activities
417///
418/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
419/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
420///
421/// * [secrets list projects](ProjectSecretListCall) (response)
422#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
423#[serde_with::serde_as]
424#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
425pub struct ListSecretsResponse {
426 /// A token to retrieve the next page of results. Pass this value in ListSecretsRequest.page_token to retrieve the next page.
427 #[serde(rename = "nextPageToken")]
428 pub next_page_token: Option<String>,
429 /// The list of Secrets sorted in reverse by create_time (newest first).
430 pub secrets: Option<Vec<Secret>>,
431 /// The total number of Secrets.
432 #[serde(rename = "totalSize")]
433 pub total_size: Option<i32>,
434}
435
436impl common::ResponseResult for ListSecretsResponse {}
437
438/// A resource that represents a Google Cloud location.
439///
440/// # Activities
441///
442/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
443/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
444///
445/// * [locations get projects](ProjectLocationGetCall) (response)
446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
447#[serde_with::serde_as]
448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
449pub struct Location {
450 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
451 #[serde(rename = "displayName")]
452 pub display_name: Option<String>,
453 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
454 pub labels: Option<HashMap<String, String>>,
455 /// The canonical id for this location. For example: `"us-east1"`.
456 #[serde(rename = "locationId")]
457 pub location_id: Option<String>,
458 /// Service-specific metadata. For example the available capacity at the given location.
459 pub metadata: Option<HashMap<String, serde_json::Value>>,
460 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
461 pub name: Option<String>,
462}
463
464impl common::ResponseResult for Location {}
465
466/// 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/).
467///
468/// # Activities
469///
470/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
471/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
472///
473/// * [secrets get iam policy projects](ProjectSecretGetIamPolicyCall) (response)
474/// * [secrets set iam policy projects](ProjectSecretSetIamPolicyCall) (response)
475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
476#[serde_with::serde_as]
477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
478pub struct Policy {
479 /// Specifies cloud audit logging configuration for this policy.
480 #[serde(rename = "auditConfigs")]
481 pub audit_configs: Option<Vec<AuditConfig>>,
482 /// 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`.
483 pub bindings: Option<Vec<Binding>>,
484 /// `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.
485 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
486 pub etag: Option<Vec<u8>>,
487 /// 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).
488 pub version: Option<i32>,
489}
490
491impl common::ResponseResult for Policy {}
492
493/// Represents a Replica for this Secret.
494///
495/// This type is not used in any activity, and only used as *part* of another schema.
496///
497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
498#[serde_with::serde_as]
499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
500pub struct Replica {
501 /// The canonical IDs of the location to replicate data. For example: `"us-east1"`.
502 pub location: Option<String>,
503}
504
505impl common::Part for Replica {}
506
507/// A policy that defines the replication configuration of data.
508///
509/// This type is not used in any activity, and only used as *part* of another schema.
510///
511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
512#[serde_with::serde_as]
513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
514pub struct Replication {
515 /// The Secret will automatically be replicated without any restrictions.
516 pub automatic: Option<Automatic>,
517 /// The Secret will only be replicated into the locations specified.
518 #[serde(rename = "userManaged")]
519 pub user_managed: Option<UserManaged>,
520}
521
522impl common::Part for Replication {}
523
524/// A Secret is a logical secret whose value and versions can be accessed. A Secret is made up of zero or more SecretVersions that represent the secret data.
525///
526/// # Activities
527///
528/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
529/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
530///
531/// * [secrets create projects](ProjectSecretCreateCall) (request|response)
532/// * [secrets get projects](ProjectSecretGetCall) (response)
533/// * [secrets patch projects](ProjectSecretPatchCall) (request|response)
534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
535#[serde_with::serde_as]
536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
537pub struct Secret {
538 /// Output only. The time at which the Secret was created.
539 #[serde(rename = "createTime")]
540 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
541 /// The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: `\p{Ll}\p{Lo}{0,62}` Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}` No more than 64 labels can be assigned to a given resource.
542 pub labels: Option<HashMap<String, String>>,
543 /// Output only. The resource name of the Secret in the format `projects/*/secrets/*`.
544 pub name: Option<String>,
545 /// Required. Immutable. The replication policy of the secret data attached to the Secret. The replication policy cannot be changed after the Secret has been created.
546 pub replication: Option<Replication>,
547 /// Optional. Input only. Immutable. Mapping of Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing" Tags are used to organize and group resources. Tags can be used to control policy evaluation for the resource.
548 pub tags: Option<HashMap<String, String>>,
549}
550
551impl common::RequestValue for Secret {}
552impl common::ResponseResult for Secret {}
553
554/// A secret payload resource in the Secret Manager API. This contains the sensitive secret data that is associated with a SecretVersion.
555///
556/// This type is not used in any activity, and only used as *part* of another schema.
557///
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct SecretPayload {
562 /// The secret data. Must be no larger than 64KiB.
563 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
564 pub data: Option<Vec<u8>>,
565}
566
567impl common::Part for SecretPayload {}
568
569/// A secret version resource in the Secret Manager API.
570///
571/// # Activities
572///
573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
575///
576/// * [secrets versions destroy projects](ProjectSecretVersionDestroyCall) (response)
577/// * [secrets versions disable projects](ProjectSecretVersionDisableCall) (response)
578/// * [secrets versions enable projects](ProjectSecretVersionEnableCall) (response)
579/// * [secrets versions get projects](ProjectSecretVersionGetCall) (response)
580/// * [secrets add version projects](ProjectSecretAddVersionCall) (response)
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct SecretVersion {
585 /// Output only. The time at which the SecretVersion was created.
586 #[serde(rename = "createTime")]
587 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
588 /// Output only. The time this SecretVersion was destroyed. Only present if state is DESTROYED.
589 #[serde(rename = "destroyTime")]
590 pub destroy_time: Option<chrono::DateTime<chrono::offset::Utc>>,
591 /// Output only. The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`. SecretVersion IDs in a Secret start at 1 and are incremented for each subsequent version of the secret.
592 pub name: Option<String>,
593 /// Output only. The current state of the SecretVersion.
594 pub state: Option<String>,
595}
596
597impl common::ResponseResult for SecretVersion {}
598
599/// Request message for `SetIamPolicy` method.
600///
601/// # Activities
602///
603/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
604/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
605///
606/// * [secrets set iam policy projects](ProjectSecretSetIamPolicyCall) (request)
607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
608#[serde_with::serde_as]
609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
610pub struct SetIamPolicyRequest {
611 /// 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.
612 pub policy: Option<Policy>,
613 /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
614 #[serde(rename = "updateMask")]
615 pub update_mask: Option<common::FieldMask>,
616}
617
618impl common::RequestValue for SetIamPolicyRequest {}
619
620/// Request message for `TestIamPermissions` method.
621///
622/// # Activities
623///
624/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
625/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
626///
627/// * [secrets test iam permissions projects](ProjectSecretTestIamPermissionCall) (request)
628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
629#[serde_with::serde_as]
630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
631pub struct TestIamPermissionsRequest {
632 /// 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).
633 pub permissions: Option<Vec<String>>,
634}
635
636impl common::RequestValue for TestIamPermissionsRequest {}
637
638/// Response message for `TestIamPermissions` method.
639///
640/// # Activities
641///
642/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
643/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
644///
645/// * [secrets test iam permissions projects](ProjectSecretTestIamPermissionCall) (response)
646#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
647#[serde_with::serde_as]
648#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
649pub struct TestIamPermissionsResponse {
650 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
651 pub permissions: Option<Vec<String>>,
652}
653
654impl common::ResponseResult for TestIamPermissionsResponse {}
655
656/// A replication policy that replicates the Secret payload into the locations specified in Replication.UserManaged.replicas
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct UserManaged {
664 /// Required. The list of Replicas for this Secret. Cannot be empty.
665 pub replicas: Option<Vec<Replica>>,
666}
667
668impl common::Part for UserManaged {}
669
670// ###################
671// MethodBuilders ###
672// #################
673
674/// A builder providing access to all methods supported on *project* resources.
675/// It is not used directly, but through the [`SecretManager`] hub.
676///
677/// # Example
678///
679/// Instantiate a resource builder
680///
681/// ```test_harness,no_run
682/// extern crate hyper;
683/// extern crate hyper_rustls;
684/// extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
685///
686/// # async fn dox() {
687/// use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
688///
689/// let secret: yup_oauth2::ApplicationSecret = Default::default();
690/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
691/// .with_native_roots()
692/// .unwrap()
693/// .https_only()
694/// .enable_http2()
695/// .build();
696///
697/// let executor = hyper_util::rt::TokioExecutor::new();
698/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
699/// secret,
700/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
701/// yup_oauth2::client::CustomHyperClientBuilder::from(
702/// hyper_util::client::legacy::Client::builder(executor).build(connector),
703/// ),
704/// ).build().await.unwrap();
705///
706/// let client = hyper_util::client::legacy::Client::builder(
707/// hyper_util::rt::TokioExecutor::new()
708/// )
709/// .build(
710/// hyper_rustls::HttpsConnectorBuilder::new()
711/// .with_native_roots()
712/// .unwrap()
713/// .https_or_http()
714/// .enable_http2()
715/// .build()
716/// );
717/// let mut hub = SecretManager::new(client, auth);
718/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
719/// // like `locations_get(...)`, `locations_list(...)`, `secrets_add_version(...)`, `secrets_create(...)`, `secrets_delete(...)`, `secrets_get(...)`, `secrets_get_iam_policy(...)`, `secrets_list(...)`, `secrets_patch(...)`, `secrets_set_iam_policy(...)`, `secrets_test_iam_permissions(...)`, `secrets_versions_access(...)`, `secrets_versions_destroy(...)`, `secrets_versions_disable(...)`, `secrets_versions_enable(...)`, `secrets_versions_get(...)` and `secrets_versions_list(...)`
720/// // to build up your call.
721/// let rb = hub.projects();
722/// # }
723/// ```
724pub struct ProjectMethods<'a, C>
725where
726 C: 'a,
727{
728 hub: &'a SecretManager<C>,
729}
730
731impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
732
733impl<'a, C> ProjectMethods<'a, C> {
734 /// Create a builder to help you perform the following task:
735 ///
736 /// Gets information about a location.
737 ///
738 /// # Arguments
739 ///
740 /// * `name` - Resource name for the location.
741 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
742 ProjectLocationGetCall {
743 hub: self.hub,
744 _name: name.to_string(),
745 _delegate: Default::default(),
746 _additional_params: Default::default(),
747 _scopes: Default::default(),
748 }
749 }
750
751 /// Create a builder to help you perform the following task:
752 ///
753 /// Lists information about the supported locations for this service.
754 ///
755 /// # Arguments
756 ///
757 /// * `name` - The resource that owns the locations collection, if applicable.
758 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
759 ProjectLocationListCall {
760 hub: self.hub,
761 _name: name.to_string(),
762 _page_token: Default::default(),
763 _page_size: Default::default(),
764 _filter: Default::default(),
765 _extra_location_types: Default::default(),
766 _delegate: Default::default(),
767 _additional_params: Default::default(),
768 _scopes: Default::default(),
769 }
770 }
771
772 /// Create a builder to help you perform the following task:
773 ///
774 /// Accesses a SecretVersion. This call returns the secret data. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
775 ///
776 /// # Arguments
777 ///
778 /// * `name` - Required. The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`.
779 pub fn secrets_versions_access(&self, name: &str) -> ProjectSecretVersionAccesCall<'a, C> {
780 ProjectSecretVersionAccesCall {
781 hub: self.hub,
782 _name: name.to_string(),
783 _delegate: Default::default(),
784 _additional_params: Default::default(),
785 _scopes: Default::default(),
786 }
787 }
788
789 /// Create a builder to help you perform the following task:
790 ///
791 /// Destroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.
792 ///
793 /// # Arguments
794 ///
795 /// * `request` - No description provided.
796 /// * `name` - Required. The resource name of the SecretVersion to destroy in the format `projects/*/secrets/*/versions/*`.
797 pub fn secrets_versions_destroy(
798 &self,
799 request: DestroySecretVersionRequest,
800 name: &str,
801 ) -> ProjectSecretVersionDestroyCall<'a, C> {
802 ProjectSecretVersionDestroyCall {
803 hub: self.hub,
804 _request: request,
805 _name: name.to_string(),
806 _delegate: Default::default(),
807 _additional_params: Default::default(),
808 _scopes: Default::default(),
809 }
810 }
811
812 /// Create a builder to help you perform the following task:
813 ///
814 /// Disables a SecretVersion. Sets the state of the SecretVersion to DISABLED.
815 ///
816 /// # Arguments
817 ///
818 /// * `request` - No description provided.
819 /// * `name` - Required. The resource name of the SecretVersion to disable in the format `projects/*/secrets/*/versions/*`.
820 pub fn secrets_versions_disable(
821 &self,
822 request: DisableSecretVersionRequest,
823 name: &str,
824 ) -> ProjectSecretVersionDisableCall<'a, C> {
825 ProjectSecretVersionDisableCall {
826 hub: self.hub,
827 _request: request,
828 _name: name.to_string(),
829 _delegate: Default::default(),
830 _additional_params: Default::default(),
831 _scopes: Default::default(),
832 }
833 }
834
835 /// Create a builder to help you perform the following task:
836 ///
837 /// Enables a SecretVersion. Sets the state of the SecretVersion to ENABLED.
838 ///
839 /// # Arguments
840 ///
841 /// * `request` - No description provided.
842 /// * `name` - Required. The resource name of the SecretVersion to enable in the format `projects/*/secrets/*/versions/*`.
843 pub fn secrets_versions_enable(
844 &self,
845 request: EnableSecretVersionRequest,
846 name: &str,
847 ) -> ProjectSecretVersionEnableCall<'a, C> {
848 ProjectSecretVersionEnableCall {
849 hub: self.hub,
850 _request: request,
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 /// Gets metadata for a SecretVersion. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
861 ///
862 /// # Arguments
863 ///
864 /// * `name` - Required. The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
865 pub fn secrets_versions_get(&self, name: &str) -> ProjectSecretVersionGetCall<'a, C> {
866 ProjectSecretVersionGetCall {
867 hub: self.hub,
868 _name: name.to_string(),
869 _delegate: Default::default(),
870 _additional_params: Default::default(),
871 _scopes: Default::default(),
872 }
873 }
874
875 /// Create a builder to help you perform the following task:
876 ///
877 /// Lists SecretVersions. This call does not return secret data.
878 ///
879 /// # Arguments
880 ///
881 /// * `parent` - Required. The resource name of the Secret associated with the SecretVersions to list, in the format `projects/*/secrets/*`.
882 pub fn secrets_versions_list(&self, parent: &str) -> ProjectSecretVersionListCall<'a, C> {
883 ProjectSecretVersionListCall {
884 hub: self.hub,
885 _parent: parent.to_string(),
886 _page_token: Default::default(),
887 _page_size: Default::default(),
888 _delegate: Default::default(),
889 _additional_params: Default::default(),
890 _scopes: Default::default(),
891 }
892 }
893
894 /// Create a builder to help you perform the following task:
895 ///
896 /// Creates a new SecretVersion containing secret data and attaches it to an existing Secret.
897 ///
898 /// # Arguments
899 ///
900 /// * `request` - No description provided.
901 /// * `parent` - Required. The resource name of the Secret to associate with the SecretVersion in the format `projects/*/secrets/*`.
902 pub fn secrets_add_version(
903 &self,
904 request: AddSecretVersionRequest,
905 parent: &str,
906 ) -> ProjectSecretAddVersionCall<'a, C> {
907 ProjectSecretAddVersionCall {
908 hub: self.hub,
909 _request: request,
910 _parent: parent.to_string(),
911 _delegate: Default::default(),
912 _additional_params: Default::default(),
913 _scopes: Default::default(),
914 }
915 }
916
917 /// Create a builder to help you perform the following task:
918 ///
919 /// Creates a new Secret containing no SecretVersions.
920 ///
921 /// # Arguments
922 ///
923 /// * `request` - No description provided.
924 /// * `parent` - Required. The resource name of the project to associate with the Secret, in the format `projects/*`.
925 pub fn secrets_create(&self, request: Secret, parent: &str) -> ProjectSecretCreateCall<'a, C> {
926 ProjectSecretCreateCall {
927 hub: self.hub,
928 _request: request,
929 _parent: parent.to_string(),
930 _secret_id: Default::default(),
931 _delegate: Default::default(),
932 _additional_params: Default::default(),
933 _scopes: Default::default(),
934 }
935 }
936
937 /// Create a builder to help you perform the following task:
938 ///
939 /// Deletes a Secret.
940 ///
941 /// # Arguments
942 ///
943 /// * `name` - Required. The resource name of the Secret to delete in the format `projects/*/secrets/*`.
944 pub fn secrets_delete(&self, name: &str) -> ProjectSecretDeleteCall<'a, C> {
945 ProjectSecretDeleteCall {
946 hub: self.hub,
947 _name: name.to_string(),
948 _delegate: Default::default(),
949 _additional_params: Default::default(),
950 _scopes: Default::default(),
951 }
952 }
953
954 /// Create a builder to help you perform the following task:
955 ///
956 /// Gets metadata for a given Secret.
957 ///
958 /// # Arguments
959 ///
960 /// * `name` - Required. The resource name of the Secret, in the format `projects/*/secrets/*`.
961 pub fn secrets_get(&self, name: &str) -> ProjectSecretGetCall<'a, C> {
962 ProjectSecretGetCall {
963 hub: self.hub,
964 _name: name.to_string(),
965 _delegate: Default::default(),
966 _additional_params: Default::default(),
967 _scopes: Default::default(),
968 }
969 }
970
971 /// Create a builder to help you perform the following task:
972 ///
973 /// Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.
974 ///
975 /// # Arguments
976 ///
977 /// * `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.
978 pub fn secrets_get_iam_policy(&self, resource: &str) -> ProjectSecretGetIamPolicyCall<'a, C> {
979 ProjectSecretGetIamPolicyCall {
980 hub: self.hub,
981 _resource: resource.to_string(),
982 _options_requested_policy_version: Default::default(),
983 _delegate: Default::default(),
984 _additional_params: Default::default(),
985 _scopes: Default::default(),
986 }
987 }
988
989 /// Create a builder to help you perform the following task:
990 ///
991 /// Lists Secrets.
992 ///
993 /// # Arguments
994 ///
995 /// * `parent` - Required. The resource name of the project associated with the Secrets, in the format `projects/*`.
996 pub fn secrets_list(&self, parent: &str) -> ProjectSecretListCall<'a, C> {
997 ProjectSecretListCall {
998 hub: self.hub,
999 _parent: parent.to_string(),
1000 _page_token: Default::default(),
1001 _page_size: Default::default(),
1002 _delegate: Default::default(),
1003 _additional_params: Default::default(),
1004 _scopes: Default::default(),
1005 }
1006 }
1007
1008 /// Create a builder to help you perform the following task:
1009 ///
1010 /// Updates metadata of an existing Secret.
1011 ///
1012 /// # Arguments
1013 ///
1014 /// * `request` - No description provided.
1015 /// * `name` - Output only. The resource name of the Secret in the format `projects/*/secrets/*`.
1016 pub fn secrets_patch(&self, request: Secret, name: &str) -> ProjectSecretPatchCall<'a, C> {
1017 ProjectSecretPatchCall {
1018 hub: self.hub,
1019 _request: request,
1020 _name: name.to_string(),
1021 _update_mask: Default::default(),
1022 _delegate: Default::default(),
1023 _additional_params: Default::default(),
1024 _scopes: Default::default(),
1025 }
1026 }
1027
1028 /// Create a builder to help you perform the following task:
1029 ///
1030 /// Sets the access control policy on the specified secret. Replaces any existing policy. Permissions on SecretVersions are enforced according to the policy set on the associated Secret.
1031 ///
1032 /// # Arguments
1033 ///
1034 /// * `request` - No description provided.
1035 /// * `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.
1036 pub fn secrets_set_iam_policy(
1037 &self,
1038 request: SetIamPolicyRequest,
1039 resource: &str,
1040 ) -> ProjectSecretSetIamPolicyCall<'a, C> {
1041 ProjectSecretSetIamPolicyCall {
1042 hub: self.hub,
1043 _request: request,
1044 _resource: resource.to_string(),
1045 _delegate: Default::default(),
1046 _additional_params: Default::default(),
1047 _scopes: Default::default(),
1048 }
1049 }
1050
1051 /// Create a builder to help you perform the following task:
1052 ///
1053 /// Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns 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.
1054 ///
1055 /// # Arguments
1056 ///
1057 /// * `request` - No description provided.
1058 /// * `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.
1059 pub fn secrets_test_iam_permissions(
1060 &self,
1061 request: TestIamPermissionsRequest,
1062 resource: &str,
1063 ) -> ProjectSecretTestIamPermissionCall<'a, C> {
1064 ProjectSecretTestIamPermissionCall {
1065 hub: self.hub,
1066 _request: request,
1067 _resource: resource.to_string(),
1068 _delegate: Default::default(),
1069 _additional_params: Default::default(),
1070 _scopes: Default::default(),
1071 }
1072 }
1073}
1074
1075// ###################
1076// CallBuilders ###
1077// #################
1078
1079/// Gets information about a location.
1080///
1081/// A builder for the *locations.get* method supported by a *project* resource.
1082/// It is not used directly, but through a [`ProjectMethods`] instance.
1083///
1084/// # Example
1085///
1086/// Instantiate a resource method builder
1087///
1088/// ```test_harness,no_run
1089/// # extern crate hyper;
1090/// # extern crate hyper_rustls;
1091/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
1092/// # async fn dox() {
1093/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1094///
1095/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1096/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1097/// # .with_native_roots()
1098/// # .unwrap()
1099/// # .https_only()
1100/// # .enable_http2()
1101/// # .build();
1102///
1103/// # let executor = hyper_util::rt::TokioExecutor::new();
1104/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1105/// # secret,
1106/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1107/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1108/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1109/// # ),
1110/// # ).build().await.unwrap();
1111///
1112/// # let client = hyper_util::client::legacy::Client::builder(
1113/// # hyper_util::rt::TokioExecutor::new()
1114/// # )
1115/// # .build(
1116/// # hyper_rustls::HttpsConnectorBuilder::new()
1117/// # .with_native_roots()
1118/// # .unwrap()
1119/// # .https_or_http()
1120/// # .enable_http2()
1121/// # .build()
1122/// # );
1123/// # let mut hub = SecretManager::new(client, auth);
1124/// // You can configure optional parameters by calling the respective setters at will, and
1125/// // execute the final call using `doit()`.
1126/// // Values shown here are possibly random and not representative !
1127/// let result = hub.projects().locations_get("name")
1128/// .doit().await;
1129/// # }
1130/// ```
1131pub struct ProjectLocationGetCall<'a, C>
1132where
1133 C: 'a,
1134{
1135 hub: &'a SecretManager<C>,
1136 _name: String,
1137 _delegate: Option<&'a mut dyn common::Delegate>,
1138 _additional_params: HashMap<String, String>,
1139 _scopes: BTreeSet<String>,
1140}
1141
1142impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
1143
1144impl<'a, C> ProjectLocationGetCall<'a, C>
1145where
1146 C: common::Connector,
1147{
1148 /// Perform the operation you have build so far.
1149 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
1150 use std::borrow::Cow;
1151 use std::io::{Read, Seek};
1152
1153 use common::{url::Params, ToParts};
1154 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1155
1156 let mut dd = common::DefaultDelegate;
1157 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1158 dlg.begin(common::MethodInfo {
1159 id: "secretmanager.projects.locations.get",
1160 http_method: hyper::Method::GET,
1161 });
1162
1163 for &field in ["alt", "name"].iter() {
1164 if self._additional_params.contains_key(field) {
1165 dlg.finished(false);
1166 return Err(common::Error::FieldClash(field));
1167 }
1168 }
1169
1170 let mut params = Params::with_capacity(3 + self._additional_params.len());
1171 params.push("name", self._name);
1172
1173 params.extend(self._additional_params.iter());
1174
1175 params.push("alt", "json");
1176 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1177 if self._scopes.is_empty() {
1178 self._scopes
1179 .insert(Scope::CloudPlatform.as_ref().to_string());
1180 }
1181
1182 #[allow(clippy::single_element_loop)]
1183 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1184 url = params.uri_replacement(url, param_name, find_this, true);
1185 }
1186 {
1187 let to_remove = ["name"];
1188 params.remove_params(&to_remove);
1189 }
1190
1191 let url = params.parse_with_url(&url);
1192
1193 loop {
1194 let token = match self
1195 .hub
1196 .auth
1197 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1198 .await
1199 {
1200 Ok(token) => token,
1201 Err(e) => match dlg.token(e) {
1202 Ok(token) => token,
1203 Err(e) => {
1204 dlg.finished(false);
1205 return Err(common::Error::MissingToken(e));
1206 }
1207 },
1208 };
1209 let mut req_result = {
1210 let client = &self.hub.client;
1211 dlg.pre_request();
1212 let mut req_builder = hyper::Request::builder()
1213 .method(hyper::Method::GET)
1214 .uri(url.as_str())
1215 .header(USER_AGENT, self.hub._user_agent.clone());
1216
1217 if let Some(token) = token.as_ref() {
1218 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1219 }
1220
1221 let request = req_builder
1222 .header(CONTENT_LENGTH, 0_u64)
1223 .body(common::to_body::<String>(None));
1224
1225 client.request(request.unwrap()).await
1226 };
1227
1228 match req_result {
1229 Err(err) => {
1230 if let common::Retry::After(d) = dlg.http_error(&err) {
1231 sleep(d).await;
1232 continue;
1233 }
1234 dlg.finished(false);
1235 return Err(common::Error::HttpError(err));
1236 }
1237 Ok(res) => {
1238 let (mut parts, body) = res.into_parts();
1239 let mut body = common::Body::new(body);
1240 if !parts.status.is_success() {
1241 let bytes = common::to_bytes(body).await.unwrap_or_default();
1242 let error = serde_json::from_str(&common::to_string(&bytes));
1243 let response = common::to_response(parts, bytes.into());
1244
1245 if let common::Retry::After(d) =
1246 dlg.http_failure(&response, error.as_ref().ok())
1247 {
1248 sleep(d).await;
1249 continue;
1250 }
1251
1252 dlg.finished(false);
1253
1254 return Err(match error {
1255 Ok(value) => common::Error::BadRequest(value),
1256 _ => common::Error::Failure(response),
1257 });
1258 }
1259 let response = {
1260 let bytes = common::to_bytes(body).await.unwrap_or_default();
1261 let encoded = common::to_string(&bytes);
1262 match serde_json::from_str(&encoded) {
1263 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1264 Err(error) => {
1265 dlg.response_json_decode_error(&encoded, &error);
1266 return Err(common::Error::JsonDecodeError(
1267 encoded.to_string(),
1268 error,
1269 ));
1270 }
1271 }
1272 };
1273
1274 dlg.finished(true);
1275 return Ok(response);
1276 }
1277 }
1278 }
1279 }
1280
1281 /// Resource name for the location.
1282 ///
1283 /// Sets the *name* path property to the given value.
1284 ///
1285 /// Even though the property as already been set when instantiating this call,
1286 /// we provide this method for API completeness.
1287 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
1288 self._name = new_value.to_string();
1289 self
1290 }
1291 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1292 /// while executing the actual API request.
1293 ///
1294 /// ````text
1295 /// It should be used to handle progress information, and to implement a certain level of resilience.
1296 /// ````
1297 ///
1298 /// Sets the *delegate* property to the given value.
1299 pub fn delegate(
1300 mut self,
1301 new_value: &'a mut dyn common::Delegate,
1302 ) -> ProjectLocationGetCall<'a, C> {
1303 self._delegate = Some(new_value);
1304 self
1305 }
1306
1307 /// Set any additional parameter of the query string used in the request.
1308 /// It should be used to set parameters which are not yet available through their own
1309 /// setters.
1310 ///
1311 /// Please note that this method must not be used to set any of the known parameters
1312 /// which have their own setter method. If done anyway, the request will fail.
1313 ///
1314 /// # Additional Parameters
1315 ///
1316 /// * *$.xgafv* (query-string) - V1 error format.
1317 /// * *access_token* (query-string) - OAuth access token.
1318 /// * *alt* (query-string) - Data format for response.
1319 /// * *callback* (query-string) - JSONP
1320 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1321 /// * *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.
1322 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1323 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1324 /// * *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.
1325 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1326 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1327 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
1328 where
1329 T: AsRef<str>,
1330 {
1331 self._additional_params
1332 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1333 self
1334 }
1335
1336 /// Identifies the authorization scope for the method you are building.
1337 ///
1338 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1339 /// [`Scope::CloudPlatform`].
1340 ///
1341 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1342 /// tokens for more than one scope.
1343 ///
1344 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1345 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1346 /// sufficient, a read-write scope will do as well.
1347 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
1348 where
1349 St: AsRef<str>,
1350 {
1351 self._scopes.insert(String::from(scope.as_ref()));
1352 self
1353 }
1354 /// Identifies the authorization scope(s) for the method you are building.
1355 ///
1356 /// See [`Self::add_scope()`] for details.
1357 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
1358 where
1359 I: IntoIterator<Item = St>,
1360 St: AsRef<str>,
1361 {
1362 self._scopes
1363 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1364 self
1365 }
1366
1367 /// Removes all scopes, and no default scope will be used either.
1368 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1369 /// for details).
1370 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
1371 self._scopes.clear();
1372 self
1373 }
1374}
1375
1376/// Lists information about the supported locations for this service.
1377///
1378/// A builder for the *locations.list* method supported by a *project* resource.
1379/// It is not used directly, but through a [`ProjectMethods`] instance.
1380///
1381/// # Example
1382///
1383/// Instantiate a resource method builder
1384///
1385/// ```test_harness,no_run
1386/// # extern crate hyper;
1387/// # extern crate hyper_rustls;
1388/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
1389/// # async fn dox() {
1390/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1391///
1392/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1393/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1394/// # .with_native_roots()
1395/// # .unwrap()
1396/// # .https_only()
1397/// # .enable_http2()
1398/// # .build();
1399///
1400/// # let executor = hyper_util::rt::TokioExecutor::new();
1401/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1402/// # secret,
1403/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1404/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1405/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1406/// # ),
1407/// # ).build().await.unwrap();
1408///
1409/// # let client = hyper_util::client::legacy::Client::builder(
1410/// # hyper_util::rt::TokioExecutor::new()
1411/// # )
1412/// # .build(
1413/// # hyper_rustls::HttpsConnectorBuilder::new()
1414/// # .with_native_roots()
1415/// # .unwrap()
1416/// # .https_or_http()
1417/// # .enable_http2()
1418/// # .build()
1419/// # );
1420/// # let mut hub = SecretManager::new(client, auth);
1421/// // You can configure optional parameters by calling the respective setters at will, and
1422/// // execute the final call using `doit()`.
1423/// // Values shown here are possibly random and not representative !
1424/// let result = hub.projects().locations_list("name")
1425/// .page_token("At")
1426/// .page_size(-8)
1427/// .filter("sed")
1428/// .add_extra_location_types("amet.")
1429/// .doit().await;
1430/// # }
1431/// ```
1432pub struct ProjectLocationListCall<'a, C>
1433where
1434 C: 'a,
1435{
1436 hub: &'a SecretManager<C>,
1437 _name: String,
1438 _page_token: Option<String>,
1439 _page_size: Option<i32>,
1440 _filter: Option<String>,
1441 _extra_location_types: Vec<String>,
1442 _delegate: Option<&'a mut dyn common::Delegate>,
1443 _additional_params: HashMap<String, String>,
1444 _scopes: BTreeSet<String>,
1445}
1446
1447impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
1448
1449impl<'a, C> ProjectLocationListCall<'a, C>
1450where
1451 C: common::Connector,
1452{
1453 /// Perform the operation you have build so far.
1454 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
1455 use std::borrow::Cow;
1456 use std::io::{Read, Seek};
1457
1458 use common::{url::Params, ToParts};
1459 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1460
1461 let mut dd = common::DefaultDelegate;
1462 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1463 dlg.begin(common::MethodInfo {
1464 id: "secretmanager.projects.locations.list",
1465 http_method: hyper::Method::GET,
1466 });
1467
1468 for &field in [
1469 "alt",
1470 "name",
1471 "pageToken",
1472 "pageSize",
1473 "filter",
1474 "extraLocationTypes",
1475 ]
1476 .iter()
1477 {
1478 if self._additional_params.contains_key(field) {
1479 dlg.finished(false);
1480 return Err(common::Error::FieldClash(field));
1481 }
1482 }
1483
1484 let mut params = Params::with_capacity(7 + self._additional_params.len());
1485 params.push("name", self._name);
1486 if let Some(value) = self._page_token.as_ref() {
1487 params.push("pageToken", value);
1488 }
1489 if let Some(value) = self._page_size.as_ref() {
1490 params.push("pageSize", value.to_string());
1491 }
1492 if let Some(value) = self._filter.as_ref() {
1493 params.push("filter", value);
1494 }
1495 if !self._extra_location_types.is_empty() {
1496 for f in self._extra_location_types.iter() {
1497 params.push("extraLocationTypes", f);
1498 }
1499 }
1500
1501 params.extend(self._additional_params.iter());
1502
1503 params.push("alt", "json");
1504 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
1505 if self._scopes.is_empty() {
1506 self._scopes
1507 .insert(Scope::CloudPlatform.as_ref().to_string());
1508 }
1509
1510 #[allow(clippy::single_element_loop)]
1511 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1512 url = params.uri_replacement(url, param_name, find_this, true);
1513 }
1514 {
1515 let to_remove = ["name"];
1516 params.remove_params(&to_remove);
1517 }
1518
1519 let url = params.parse_with_url(&url);
1520
1521 loop {
1522 let token = match self
1523 .hub
1524 .auth
1525 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1526 .await
1527 {
1528 Ok(token) => token,
1529 Err(e) => match dlg.token(e) {
1530 Ok(token) => token,
1531 Err(e) => {
1532 dlg.finished(false);
1533 return Err(common::Error::MissingToken(e));
1534 }
1535 },
1536 };
1537 let mut req_result = {
1538 let client = &self.hub.client;
1539 dlg.pre_request();
1540 let mut req_builder = hyper::Request::builder()
1541 .method(hyper::Method::GET)
1542 .uri(url.as_str())
1543 .header(USER_AGENT, self.hub._user_agent.clone());
1544
1545 if let Some(token) = token.as_ref() {
1546 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1547 }
1548
1549 let request = req_builder
1550 .header(CONTENT_LENGTH, 0_u64)
1551 .body(common::to_body::<String>(None));
1552
1553 client.request(request.unwrap()).await
1554 };
1555
1556 match req_result {
1557 Err(err) => {
1558 if let common::Retry::After(d) = dlg.http_error(&err) {
1559 sleep(d).await;
1560 continue;
1561 }
1562 dlg.finished(false);
1563 return Err(common::Error::HttpError(err));
1564 }
1565 Ok(res) => {
1566 let (mut parts, body) = res.into_parts();
1567 let mut body = common::Body::new(body);
1568 if !parts.status.is_success() {
1569 let bytes = common::to_bytes(body).await.unwrap_or_default();
1570 let error = serde_json::from_str(&common::to_string(&bytes));
1571 let response = common::to_response(parts, bytes.into());
1572
1573 if let common::Retry::After(d) =
1574 dlg.http_failure(&response, error.as_ref().ok())
1575 {
1576 sleep(d).await;
1577 continue;
1578 }
1579
1580 dlg.finished(false);
1581
1582 return Err(match error {
1583 Ok(value) => common::Error::BadRequest(value),
1584 _ => common::Error::Failure(response),
1585 });
1586 }
1587 let response = {
1588 let bytes = common::to_bytes(body).await.unwrap_or_default();
1589 let encoded = common::to_string(&bytes);
1590 match serde_json::from_str(&encoded) {
1591 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1592 Err(error) => {
1593 dlg.response_json_decode_error(&encoded, &error);
1594 return Err(common::Error::JsonDecodeError(
1595 encoded.to_string(),
1596 error,
1597 ));
1598 }
1599 }
1600 };
1601
1602 dlg.finished(true);
1603 return Ok(response);
1604 }
1605 }
1606 }
1607 }
1608
1609 /// The resource that owns the locations collection, if applicable.
1610 ///
1611 /// Sets the *name* path property to the given value.
1612 ///
1613 /// Even though the property as already been set when instantiating this call,
1614 /// we provide this method for API completeness.
1615 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
1616 self._name = new_value.to_string();
1617 self
1618 }
1619 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
1620 ///
1621 /// Sets the *page token* query property to the given value.
1622 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
1623 self._page_token = Some(new_value.to_string());
1624 self
1625 }
1626 /// The maximum number of results to return. If not set, the service selects a default.
1627 ///
1628 /// Sets the *page size* query property to the given value.
1629 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
1630 self._page_size = Some(new_value);
1631 self
1632 }
1633 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
1634 ///
1635 /// Sets the *filter* query property to the given value.
1636 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
1637 self._filter = Some(new_value.to_string());
1638 self
1639 }
1640 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
1641 ///
1642 /// Append the given value to the *extra location types* query property.
1643 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
1644 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
1645 self._extra_location_types.push(new_value.to_string());
1646 self
1647 }
1648 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1649 /// while executing the actual API request.
1650 ///
1651 /// ````text
1652 /// It should be used to handle progress information, and to implement a certain level of resilience.
1653 /// ````
1654 ///
1655 /// Sets the *delegate* property to the given value.
1656 pub fn delegate(
1657 mut self,
1658 new_value: &'a mut dyn common::Delegate,
1659 ) -> ProjectLocationListCall<'a, C> {
1660 self._delegate = Some(new_value);
1661 self
1662 }
1663
1664 /// Set any additional parameter of the query string used in the request.
1665 /// It should be used to set parameters which are not yet available through their own
1666 /// setters.
1667 ///
1668 /// Please note that this method must not be used to set any of the known parameters
1669 /// which have their own setter method. If done anyway, the request will fail.
1670 ///
1671 /// # Additional Parameters
1672 ///
1673 /// * *$.xgafv* (query-string) - V1 error format.
1674 /// * *access_token* (query-string) - OAuth access token.
1675 /// * *alt* (query-string) - Data format for response.
1676 /// * *callback* (query-string) - JSONP
1677 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1678 /// * *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.
1679 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1680 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1681 /// * *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.
1682 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1683 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1684 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
1685 where
1686 T: AsRef<str>,
1687 {
1688 self._additional_params
1689 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1690 self
1691 }
1692
1693 /// Identifies the authorization scope for the method you are building.
1694 ///
1695 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1696 /// [`Scope::CloudPlatform`].
1697 ///
1698 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1699 /// tokens for more than one scope.
1700 ///
1701 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1702 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1703 /// sufficient, a read-write scope will do as well.
1704 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
1705 where
1706 St: AsRef<str>,
1707 {
1708 self._scopes.insert(String::from(scope.as_ref()));
1709 self
1710 }
1711 /// Identifies the authorization scope(s) for the method you are building.
1712 ///
1713 /// See [`Self::add_scope()`] for details.
1714 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
1715 where
1716 I: IntoIterator<Item = St>,
1717 St: AsRef<str>,
1718 {
1719 self._scopes
1720 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1721 self
1722 }
1723
1724 /// Removes all scopes, and no default scope will be used either.
1725 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1726 /// for details).
1727 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
1728 self._scopes.clear();
1729 self
1730 }
1731}
1732
1733/// Accesses a SecretVersion. This call returns the secret data. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
1734///
1735/// A builder for the *secrets.versions.access* method supported by a *project* resource.
1736/// It is not used directly, but through a [`ProjectMethods`] instance.
1737///
1738/// # Example
1739///
1740/// Instantiate a resource method builder
1741///
1742/// ```test_harness,no_run
1743/// # extern crate hyper;
1744/// # extern crate hyper_rustls;
1745/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
1746/// # async fn dox() {
1747/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1748///
1749/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1750/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1751/// # .with_native_roots()
1752/// # .unwrap()
1753/// # .https_only()
1754/// # .enable_http2()
1755/// # .build();
1756///
1757/// # let executor = hyper_util::rt::TokioExecutor::new();
1758/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1759/// # secret,
1760/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1761/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1762/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1763/// # ),
1764/// # ).build().await.unwrap();
1765///
1766/// # let client = hyper_util::client::legacy::Client::builder(
1767/// # hyper_util::rt::TokioExecutor::new()
1768/// # )
1769/// # .build(
1770/// # hyper_rustls::HttpsConnectorBuilder::new()
1771/// # .with_native_roots()
1772/// # .unwrap()
1773/// # .https_or_http()
1774/// # .enable_http2()
1775/// # .build()
1776/// # );
1777/// # let mut hub = SecretManager::new(client, auth);
1778/// // You can configure optional parameters by calling the respective setters at will, and
1779/// // execute the final call using `doit()`.
1780/// // Values shown here are possibly random and not representative !
1781/// let result = hub.projects().secrets_versions_access("name")
1782/// .doit().await;
1783/// # }
1784/// ```
1785pub struct ProjectSecretVersionAccesCall<'a, C>
1786where
1787 C: 'a,
1788{
1789 hub: &'a SecretManager<C>,
1790 _name: String,
1791 _delegate: Option<&'a mut dyn common::Delegate>,
1792 _additional_params: HashMap<String, String>,
1793 _scopes: BTreeSet<String>,
1794}
1795
1796impl<'a, C> common::CallBuilder for ProjectSecretVersionAccesCall<'a, C> {}
1797
1798impl<'a, C> ProjectSecretVersionAccesCall<'a, C>
1799where
1800 C: common::Connector,
1801{
1802 /// Perform the operation you have build so far.
1803 pub async fn doit(mut self) -> common::Result<(common::Response, AccessSecretVersionResponse)> {
1804 use std::borrow::Cow;
1805 use std::io::{Read, Seek};
1806
1807 use common::{url::Params, ToParts};
1808 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1809
1810 let mut dd = common::DefaultDelegate;
1811 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1812 dlg.begin(common::MethodInfo {
1813 id: "secretmanager.projects.secrets.versions.access",
1814 http_method: hyper::Method::GET,
1815 });
1816
1817 for &field in ["alt", "name"].iter() {
1818 if self._additional_params.contains_key(field) {
1819 dlg.finished(false);
1820 return Err(common::Error::FieldClash(field));
1821 }
1822 }
1823
1824 let mut params = Params::with_capacity(3 + self._additional_params.len());
1825 params.push("name", self._name);
1826
1827 params.extend(self._additional_params.iter());
1828
1829 params.push("alt", "json");
1830 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:access";
1831 if self._scopes.is_empty() {
1832 self._scopes
1833 .insert(Scope::CloudPlatform.as_ref().to_string());
1834 }
1835
1836 #[allow(clippy::single_element_loop)]
1837 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1838 url = params.uri_replacement(url, param_name, find_this, true);
1839 }
1840 {
1841 let to_remove = ["name"];
1842 params.remove_params(&to_remove);
1843 }
1844
1845 let url = params.parse_with_url(&url);
1846
1847 loop {
1848 let token = match self
1849 .hub
1850 .auth
1851 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1852 .await
1853 {
1854 Ok(token) => token,
1855 Err(e) => match dlg.token(e) {
1856 Ok(token) => token,
1857 Err(e) => {
1858 dlg.finished(false);
1859 return Err(common::Error::MissingToken(e));
1860 }
1861 },
1862 };
1863 let mut req_result = {
1864 let client = &self.hub.client;
1865 dlg.pre_request();
1866 let mut req_builder = hyper::Request::builder()
1867 .method(hyper::Method::GET)
1868 .uri(url.as_str())
1869 .header(USER_AGENT, self.hub._user_agent.clone());
1870
1871 if let Some(token) = token.as_ref() {
1872 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1873 }
1874
1875 let request = req_builder
1876 .header(CONTENT_LENGTH, 0_u64)
1877 .body(common::to_body::<String>(None));
1878
1879 client.request(request.unwrap()).await
1880 };
1881
1882 match req_result {
1883 Err(err) => {
1884 if let common::Retry::After(d) = dlg.http_error(&err) {
1885 sleep(d).await;
1886 continue;
1887 }
1888 dlg.finished(false);
1889 return Err(common::Error::HttpError(err));
1890 }
1891 Ok(res) => {
1892 let (mut parts, body) = res.into_parts();
1893 let mut body = common::Body::new(body);
1894 if !parts.status.is_success() {
1895 let bytes = common::to_bytes(body).await.unwrap_or_default();
1896 let error = serde_json::from_str(&common::to_string(&bytes));
1897 let response = common::to_response(parts, bytes.into());
1898
1899 if let common::Retry::After(d) =
1900 dlg.http_failure(&response, error.as_ref().ok())
1901 {
1902 sleep(d).await;
1903 continue;
1904 }
1905
1906 dlg.finished(false);
1907
1908 return Err(match error {
1909 Ok(value) => common::Error::BadRequest(value),
1910 _ => common::Error::Failure(response),
1911 });
1912 }
1913 let response = {
1914 let bytes = common::to_bytes(body).await.unwrap_or_default();
1915 let encoded = common::to_string(&bytes);
1916 match serde_json::from_str(&encoded) {
1917 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1918 Err(error) => {
1919 dlg.response_json_decode_error(&encoded, &error);
1920 return Err(common::Error::JsonDecodeError(
1921 encoded.to_string(),
1922 error,
1923 ));
1924 }
1925 }
1926 };
1927
1928 dlg.finished(true);
1929 return Ok(response);
1930 }
1931 }
1932 }
1933 }
1934
1935 /// Required. The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`.
1936 ///
1937 /// Sets the *name* path property to the given value.
1938 ///
1939 /// Even though the property as already been set when instantiating this call,
1940 /// we provide this method for API completeness.
1941 pub fn name(mut self, new_value: &str) -> ProjectSecretVersionAccesCall<'a, C> {
1942 self._name = new_value.to_string();
1943 self
1944 }
1945 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1946 /// while executing the actual API request.
1947 ///
1948 /// ````text
1949 /// It should be used to handle progress information, and to implement a certain level of resilience.
1950 /// ````
1951 ///
1952 /// Sets the *delegate* property to the given value.
1953 pub fn delegate(
1954 mut self,
1955 new_value: &'a mut dyn common::Delegate,
1956 ) -> ProjectSecretVersionAccesCall<'a, C> {
1957 self._delegate = Some(new_value);
1958 self
1959 }
1960
1961 /// Set any additional parameter of the query string used in the request.
1962 /// It should be used to set parameters which are not yet available through their own
1963 /// setters.
1964 ///
1965 /// Please note that this method must not be used to set any of the known parameters
1966 /// which have their own setter method. If done anyway, the request will fail.
1967 ///
1968 /// # Additional Parameters
1969 ///
1970 /// * *$.xgafv* (query-string) - V1 error format.
1971 /// * *access_token* (query-string) - OAuth access token.
1972 /// * *alt* (query-string) - Data format for response.
1973 /// * *callback* (query-string) - JSONP
1974 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1975 /// * *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.
1976 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1977 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1978 /// * *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.
1979 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1980 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1981 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionAccesCall<'a, C>
1982 where
1983 T: AsRef<str>,
1984 {
1985 self._additional_params
1986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1987 self
1988 }
1989
1990 /// Identifies the authorization scope for the method you are building.
1991 ///
1992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1993 /// [`Scope::CloudPlatform`].
1994 ///
1995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1996 /// tokens for more than one scope.
1997 ///
1998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2000 /// sufficient, a read-write scope will do as well.
2001 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionAccesCall<'a, C>
2002 where
2003 St: AsRef<str>,
2004 {
2005 self._scopes.insert(String::from(scope.as_ref()));
2006 self
2007 }
2008 /// Identifies the authorization scope(s) for the method you are building.
2009 ///
2010 /// See [`Self::add_scope()`] for details.
2011 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionAccesCall<'a, C>
2012 where
2013 I: IntoIterator<Item = St>,
2014 St: AsRef<str>,
2015 {
2016 self._scopes
2017 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2018 self
2019 }
2020
2021 /// Removes all scopes, and no default scope will be used either.
2022 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2023 /// for details).
2024 pub fn clear_scopes(mut self) -> ProjectSecretVersionAccesCall<'a, C> {
2025 self._scopes.clear();
2026 self
2027 }
2028}
2029
2030/// Destroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.
2031///
2032/// A builder for the *secrets.versions.destroy* method supported by a *project* resource.
2033/// It is not used directly, but through a [`ProjectMethods`] instance.
2034///
2035/// # Example
2036///
2037/// Instantiate a resource method builder
2038///
2039/// ```test_harness,no_run
2040/// # extern crate hyper;
2041/// # extern crate hyper_rustls;
2042/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
2043/// use secretmanager1_beta1::api::DestroySecretVersionRequest;
2044/// # async fn dox() {
2045/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2046///
2047/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2048/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2049/// # .with_native_roots()
2050/// # .unwrap()
2051/// # .https_only()
2052/// # .enable_http2()
2053/// # .build();
2054///
2055/// # let executor = hyper_util::rt::TokioExecutor::new();
2056/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2057/// # secret,
2058/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2059/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2060/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2061/// # ),
2062/// # ).build().await.unwrap();
2063///
2064/// # let client = hyper_util::client::legacy::Client::builder(
2065/// # hyper_util::rt::TokioExecutor::new()
2066/// # )
2067/// # .build(
2068/// # hyper_rustls::HttpsConnectorBuilder::new()
2069/// # .with_native_roots()
2070/// # .unwrap()
2071/// # .https_or_http()
2072/// # .enable_http2()
2073/// # .build()
2074/// # );
2075/// # let mut hub = SecretManager::new(client, auth);
2076/// // As the method needs a request, you would usually fill it with the desired information
2077/// // into the respective structure. Some of the parts shown here might not be applicable !
2078/// // Values shown here are possibly random and not representative !
2079/// let mut req = DestroySecretVersionRequest::default();
2080///
2081/// // You can configure optional parameters by calling the respective setters at will, and
2082/// // execute the final call using `doit()`.
2083/// // Values shown here are possibly random and not representative !
2084/// let result = hub.projects().secrets_versions_destroy(req, "name")
2085/// .doit().await;
2086/// # }
2087/// ```
2088pub struct ProjectSecretVersionDestroyCall<'a, C>
2089where
2090 C: 'a,
2091{
2092 hub: &'a SecretManager<C>,
2093 _request: DestroySecretVersionRequest,
2094 _name: String,
2095 _delegate: Option<&'a mut dyn common::Delegate>,
2096 _additional_params: HashMap<String, String>,
2097 _scopes: BTreeSet<String>,
2098}
2099
2100impl<'a, C> common::CallBuilder for ProjectSecretVersionDestroyCall<'a, C> {}
2101
2102impl<'a, C> ProjectSecretVersionDestroyCall<'a, C>
2103where
2104 C: common::Connector,
2105{
2106 /// Perform the operation you have build so far.
2107 pub async fn doit(mut self) -> common::Result<(common::Response, SecretVersion)> {
2108 use std::borrow::Cow;
2109 use std::io::{Read, Seek};
2110
2111 use common::{url::Params, ToParts};
2112 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2113
2114 let mut dd = common::DefaultDelegate;
2115 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2116 dlg.begin(common::MethodInfo {
2117 id: "secretmanager.projects.secrets.versions.destroy",
2118 http_method: hyper::Method::POST,
2119 });
2120
2121 for &field in ["alt", "name"].iter() {
2122 if self._additional_params.contains_key(field) {
2123 dlg.finished(false);
2124 return Err(common::Error::FieldClash(field));
2125 }
2126 }
2127
2128 let mut params = Params::with_capacity(4 + self._additional_params.len());
2129 params.push("name", self._name);
2130
2131 params.extend(self._additional_params.iter());
2132
2133 params.push("alt", "json");
2134 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:destroy";
2135 if self._scopes.is_empty() {
2136 self._scopes
2137 .insert(Scope::CloudPlatform.as_ref().to_string());
2138 }
2139
2140 #[allow(clippy::single_element_loop)]
2141 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2142 url = params.uri_replacement(url, param_name, find_this, true);
2143 }
2144 {
2145 let to_remove = ["name"];
2146 params.remove_params(&to_remove);
2147 }
2148
2149 let url = params.parse_with_url(&url);
2150
2151 let mut json_mime_type = mime::APPLICATION_JSON;
2152 let mut request_value_reader = {
2153 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2154 common::remove_json_null_values(&mut value);
2155 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2156 serde_json::to_writer(&mut dst, &value).unwrap();
2157 dst
2158 };
2159 let request_size = request_value_reader
2160 .seek(std::io::SeekFrom::End(0))
2161 .unwrap();
2162 request_value_reader
2163 .seek(std::io::SeekFrom::Start(0))
2164 .unwrap();
2165
2166 loop {
2167 let token = match self
2168 .hub
2169 .auth
2170 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2171 .await
2172 {
2173 Ok(token) => token,
2174 Err(e) => match dlg.token(e) {
2175 Ok(token) => token,
2176 Err(e) => {
2177 dlg.finished(false);
2178 return Err(common::Error::MissingToken(e));
2179 }
2180 },
2181 };
2182 request_value_reader
2183 .seek(std::io::SeekFrom::Start(0))
2184 .unwrap();
2185 let mut req_result = {
2186 let client = &self.hub.client;
2187 dlg.pre_request();
2188 let mut req_builder = hyper::Request::builder()
2189 .method(hyper::Method::POST)
2190 .uri(url.as_str())
2191 .header(USER_AGENT, self.hub._user_agent.clone());
2192
2193 if let Some(token) = token.as_ref() {
2194 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2195 }
2196
2197 let request = req_builder
2198 .header(CONTENT_TYPE, json_mime_type.to_string())
2199 .header(CONTENT_LENGTH, request_size as u64)
2200 .body(common::to_body(
2201 request_value_reader.get_ref().clone().into(),
2202 ));
2203
2204 client.request(request.unwrap()).await
2205 };
2206
2207 match req_result {
2208 Err(err) => {
2209 if let common::Retry::After(d) = dlg.http_error(&err) {
2210 sleep(d).await;
2211 continue;
2212 }
2213 dlg.finished(false);
2214 return Err(common::Error::HttpError(err));
2215 }
2216 Ok(res) => {
2217 let (mut parts, body) = res.into_parts();
2218 let mut body = common::Body::new(body);
2219 if !parts.status.is_success() {
2220 let bytes = common::to_bytes(body).await.unwrap_or_default();
2221 let error = serde_json::from_str(&common::to_string(&bytes));
2222 let response = common::to_response(parts, bytes.into());
2223
2224 if let common::Retry::After(d) =
2225 dlg.http_failure(&response, error.as_ref().ok())
2226 {
2227 sleep(d).await;
2228 continue;
2229 }
2230
2231 dlg.finished(false);
2232
2233 return Err(match error {
2234 Ok(value) => common::Error::BadRequest(value),
2235 _ => common::Error::Failure(response),
2236 });
2237 }
2238 let response = {
2239 let bytes = common::to_bytes(body).await.unwrap_or_default();
2240 let encoded = common::to_string(&bytes);
2241 match serde_json::from_str(&encoded) {
2242 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2243 Err(error) => {
2244 dlg.response_json_decode_error(&encoded, &error);
2245 return Err(common::Error::JsonDecodeError(
2246 encoded.to_string(),
2247 error,
2248 ));
2249 }
2250 }
2251 };
2252
2253 dlg.finished(true);
2254 return Ok(response);
2255 }
2256 }
2257 }
2258 }
2259
2260 ///
2261 /// Sets the *request* property to the given value.
2262 ///
2263 /// Even though the property as already been set when instantiating this call,
2264 /// we provide this method for API completeness.
2265 pub fn request(
2266 mut self,
2267 new_value: DestroySecretVersionRequest,
2268 ) -> ProjectSecretVersionDestroyCall<'a, C> {
2269 self._request = new_value;
2270 self
2271 }
2272 /// Required. The resource name of the SecretVersion to destroy in the format `projects/*/secrets/*/versions/*`.
2273 ///
2274 /// Sets the *name* path property to the given value.
2275 ///
2276 /// Even though the property as already been set when instantiating this call,
2277 /// we provide this method for API completeness.
2278 pub fn name(mut self, new_value: &str) -> ProjectSecretVersionDestroyCall<'a, C> {
2279 self._name = new_value.to_string();
2280 self
2281 }
2282 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2283 /// while executing the actual API request.
2284 ///
2285 /// ````text
2286 /// It should be used to handle progress information, and to implement a certain level of resilience.
2287 /// ````
2288 ///
2289 /// Sets the *delegate* property to the given value.
2290 pub fn delegate(
2291 mut self,
2292 new_value: &'a mut dyn common::Delegate,
2293 ) -> ProjectSecretVersionDestroyCall<'a, C> {
2294 self._delegate = Some(new_value);
2295 self
2296 }
2297
2298 /// Set any additional parameter of the query string used in the request.
2299 /// It should be used to set parameters which are not yet available through their own
2300 /// setters.
2301 ///
2302 /// Please note that this method must not be used to set any of the known parameters
2303 /// which have their own setter method. If done anyway, the request will fail.
2304 ///
2305 /// # Additional Parameters
2306 ///
2307 /// * *$.xgafv* (query-string) - V1 error format.
2308 /// * *access_token* (query-string) - OAuth access token.
2309 /// * *alt* (query-string) - Data format for response.
2310 /// * *callback* (query-string) - JSONP
2311 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2312 /// * *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.
2313 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2314 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2315 /// * *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.
2316 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2317 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2318 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionDestroyCall<'a, C>
2319 where
2320 T: AsRef<str>,
2321 {
2322 self._additional_params
2323 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2324 self
2325 }
2326
2327 /// Identifies the authorization scope for the method you are building.
2328 ///
2329 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2330 /// [`Scope::CloudPlatform`].
2331 ///
2332 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2333 /// tokens for more than one scope.
2334 ///
2335 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2336 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2337 /// sufficient, a read-write scope will do as well.
2338 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionDestroyCall<'a, C>
2339 where
2340 St: AsRef<str>,
2341 {
2342 self._scopes.insert(String::from(scope.as_ref()));
2343 self
2344 }
2345 /// Identifies the authorization scope(s) for the method you are building.
2346 ///
2347 /// See [`Self::add_scope()`] for details.
2348 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionDestroyCall<'a, C>
2349 where
2350 I: IntoIterator<Item = St>,
2351 St: AsRef<str>,
2352 {
2353 self._scopes
2354 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2355 self
2356 }
2357
2358 /// Removes all scopes, and no default scope will be used either.
2359 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2360 /// for details).
2361 pub fn clear_scopes(mut self) -> ProjectSecretVersionDestroyCall<'a, C> {
2362 self._scopes.clear();
2363 self
2364 }
2365}
2366
2367/// Disables a SecretVersion. Sets the state of the SecretVersion to DISABLED.
2368///
2369/// A builder for the *secrets.versions.disable* method supported by a *project* resource.
2370/// It is not used directly, but through a [`ProjectMethods`] instance.
2371///
2372/// # Example
2373///
2374/// Instantiate a resource method builder
2375///
2376/// ```test_harness,no_run
2377/// # extern crate hyper;
2378/// # extern crate hyper_rustls;
2379/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
2380/// use secretmanager1_beta1::api::DisableSecretVersionRequest;
2381/// # async fn dox() {
2382/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2383///
2384/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2385/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2386/// # .with_native_roots()
2387/// # .unwrap()
2388/// # .https_only()
2389/// # .enable_http2()
2390/// # .build();
2391///
2392/// # let executor = hyper_util::rt::TokioExecutor::new();
2393/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2394/// # secret,
2395/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2396/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2397/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2398/// # ),
2399/// # ).build().await.unwrap();
2400///
2401/// # let client = hyper_util::client::legacy::Client::builder(
2402/// # hyper_util::rt::TokioExecutor::new()
2403/// # )
2404/// # .build(
2405/// # hyper_rustls::HttpsConnectorBuilder::new()
2406/// # .with_native_roots()
2407/// # .unwrap()
2408/// # .https_or_http()
2409/// # .enable_http2()
2410/// # .build()
2411/// # );
2412/// # let mut hub = SecretManager::new(client, auth);
2413/// // As the method needs a request, you would usually fill it with the desired information
2414/// // into the respective structure. Some of the parts shown here might not be applicable !
2415/// // Values shown here are possibly random and not representative !
2416/// let mut req = DisableSecretVersionRequest::default();
2417///
2418/// // You can configure optional parameters by calling the respective setters at will, and
2419/// // execute the final call using `doit()`.
2420/// // Values shown here are possibly random and not representative !
2421/// let result = hub.projects().secrets_versions_disable(req, "name")
2422/// .doit().await;
2423/// # }
2424/// ```
2425pub struct ProjectSecretVersionDisableCall<'a, C>
2426where
2427 C: 'a,
2428{
2429 hub: &'a SecretManager<C>,
2430 _request: DisableSecretVersionRequest,
2431 _name: String,
2432 _delegate: Option<&'a mut dyn common::Delegate>,
2433 _additional_params: HashMap<String, String>,
2434 _scopes: BTreeSet<String>,
2435}
2436
2437impl<'a, C> common::CallBuilder for ProjectSecretVersionDisableCall<'a, C> {}
2438
2439impl<'a, C> ProjectSecretVersionDisableCall<'a, C>
2440where
2441 C: common::Connector,
2442{
2443 /// Perform the operation you have build so far.
2444 pub async fn doit(mut self) -> common::Result<(common::Response, SecretVersion)> {
2445 use std::borrow::Cow;
2446 use std::io::{Read, Seek};
2447
2448 use common::{url::Params, ToParts};
2449 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2450
2451 let mut dd = common::DefaultDelegate;
2452 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2453 dlg.begin(common::MethodInfo {
2454 id: "secretmanager.projects.secrets.versions.disable",
2455 http_method: hyper::Method::POST,
2456 });
2457
2458 for &field in ["alt", "name"].iter() {
2459 if self._additional_params.contains_key(field) {
2460 dlg.finished(false);
2461 return Err(common::Error::FieldClash(field));
2462 }
2463 }
2464
2465 let mut params = Params::with_capacity(4 + self._additional_params.len());
2466 params.push("name", self._name);
2467
2468 params.extend(self._additional_params.iter());
2469
2470 params.push("alt", "json");
2471 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:disable";
2472 if self._scopes.is_empty() {
2473 self._scopes
2474 .insert(Scope::CloudPlatform.as_ref().to_string());
2475 }
2476
2477 #[allow(clippy::single_element_loop)]
2478 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2479 url = params.uri_replacement(url, param_name, find_this, true);
2480 }
2481 {
2482 let to_remove = ["name"];
2483 params.remove_params(&to_remove);
2484 }
2485
2486 let url = params.parse_with_url(&url);
2487
2488 let mut json_mime_type = mime::APPLICATION_JSON;
2489 let mut request_value_reader = {
2490 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2491 common::remove_json_null_values(&mut value);
2492 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2493 serde_json::to_writer(&mut dst, &value).unwrap();
2494 dst
2495 };
2496 let request_size = request_value_reader
2497 .seek(std::io::SeekFrom::End(0))
2498 .unwrap();
2499 request_value_reader
2500 .seek(std::io::SeekFrom::Start(0))
2501 .unwrap();
2502
2503 loop {
2504 let token = match self
2505 .hub
2506 .auth
2507 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2508 .await
2509 {
2510 Ok(token) => token,
2511 Err(e) => match dlg.token(e) {
2512 Ok(token) => token,
2513 Err(e) => {
2514 dlg.finished(false);
2515 return Err(common::Error::MissingToken(e));
2516 }
2517 },
2518 };
2519 request_value_reader
2520 .seek(std::io::SeekFrom::Start(0))
2521 .unwrap();
2522 let mut req_result = {
2523 let client = &self.hub.client;
2524 dlg.pre_request();
2525 let mut req_builder = hyper::Request::builder()
2526 .method(hyper::Method::POST)
2527 .uri(url.as_str())
2528 .header(USER_AGENT, self.hub._user_agent.clone());
2529
2530 if let Some(token) = token.as_ref() {
2531 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2532 }
2533
2534 let request = req_builder
2535 .header(CONTENT_TYPE, json_mime_type.to_string())
2536 .header(CONTENT_LENGTH, request_size as u64)
2537 .body(common::to_body(
2538 request_value_reader.get_ref().clone().into(),
2539 ));
2540
2541 client.request(request.unwrap()).await
2542 };
2543
2544 match req_result {
2545 Err(err) => {
2546 if let common::Retry::After(d) = dlg.http_error(&err) {
2547 sleep(d).await;
2548 continue;
2549 }
2550 dlg.finished(false);
2551 return Err(common::Error::HttpError(err));
2552 }
2553 Ok(res) => {
2554 let (mut parts, body) = res.into_parts();
2555 let mut body = common::Body::new(body);
2556 if !parts.status.is_success() {
2557 let bytes = common::to_bytes(body).await.unwrap_or_default();
2558 let error = serde_json::from_str(&common::to_string(&bytes));
2559 let response = common::to_response(parts, bytes.into());
2560
2561 if let common::Retry::After(d) =
2562 dlg.http_failure(&response, error.as_ref().ok())
2563 {
2564 sleep(d).await;
2565 continue;
2566 }
2567
2568 dlg.finished(false);
2569
2570 return Err(match error {
2571 Ok(value) => common::Error::BadRequest(value),
2572 _ => common::Error::Failure(response),
2573 });
2574 }
2575 let response = {
2576 let bytes = common::to_bytes(body).await.unwrap_or_default();
2577 let encoded = common::to_string(&bytes);
2578 match serde_json::from_str(&encoded) {
2579 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2580 Err(error) => {
2581 dlg.response_json_decode_error(&encoded, &error);
2582 return Err(common::Error::JsonDecodeError(
2583 encoded.to_string(),
2584 error,
2585 ));
2586 }
2587 }
2588 };
2589
2590 dlg.finished(true);
2591 return Ok(response);
2592 }
2593 }
2594 }
2595 }
2596
2597 ///
2598 /// Sets the *request* property to the given value.
2599 ///
2600 /// Even though the property as already been set when instantiating this call,
2601 /// we provide this method for API completeness.
2602 pub fn request(
2603 mut self,
2604 new_value: DisableSecretVersionRequest,
2605 ) -> ProjectSecretVersionDisableCall<'a, C> {
2606 self._request = new_value;
2607 self
2608 }
2609 /// Required. The resource name of the SecretVersion to disable in the format `projects/*/secrets/*/versions/*`.
2610 ///
2611 /// Sets the *name* path property to the given value.
2612 ///
2613 /// Even though the property as already been set when instantiating this call,
2614 /// we provide this method for API completeness.
2615 pub fn name(mut self, new_value: &str) -> ProjectSecretVersionDisableCall<'a, C> {
2616 self._name = new_value.to_string();
2617 self
2618 }
2619 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2620 /// while executing the actual API request.
2621 ///
2622 /// ````text
2623 /// It should be used to handle progress information, and to implement a certain level of resilience.
2624 /// ````
2625 ///
2626 /// Sets the *delegate* property to the given value.
2627 pub fn delegate(
2628 mut self,
2629 new_value: &'a mut dyn common::Delegate,
2630 ) -> ProjectSecretVersionDisableCall<'a, C> {
2631 self._delegate = Some(new_value);
2632 self
2633 }
2634
2635 /// Set any additional parameter of the query string used in the request.
2636 /// It should be used to set parameters which are not yet available through their own
2637 /// setters.
2638 ///
2639 /// Please note that this method must not be used to set any of the known parameters
2640 /// which have their own setter method. If done anyway, the request will fail.
2641 ///
2642 /// # Additional Parameters
2643 ///
2644 /// * *$.xgafv* (query-string) - V1 error format.
2645 /// * *access_token* (query-string) - OAuth access token.
2646 /// * *alt* (query-string) - Data format for response.
2647 /// * *callback* (query-string) - JSONP
2648 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2649 /// * *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.
2650 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2651 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2652 /// * *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.
2653 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2654 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2655 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionDisableCall<'a, C>
2656 where
2657 T: AsRef<str>,
2658 {
2659 self._additional_params
2660 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2661 self
2662 }
2663
2664 /// Identifies the authorization scope for the method you are building.
2665 ///
2666 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2667 /// [`Scope::CloudPlatform`].
2668 ///
2669 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2670 /// tokens for more than one scope.
2671 ///
2672 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2673 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2674 /// sufficient, a read-write scope will do as well.
2675 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionDisableCall<'a, C>
2676 where
2677 St: AsRef<str>,
2678 {
2679 self._scopes.insert(String::from(scope.as_ref()));
2680 self
2681 }
2682 /// Identifies the authorization scope(s) for the method you are building.
2683 ///
2684 /// See [`Self::add_scope()`] for details.
2685 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionDisableCall<'a, C>
2686 where
2687 I: IntoIterator<Item = St>,
2688 St: AsRef<str>,
2689 {
2690 self._scopes
2691 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2692 self
2693 }
2694
2695 /// Removes all scopes, and no default scope will be used either.
2696 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2697 /// for details).
2698 pub fn clear_scopes(mut self) -> ProjectSecretVersionDisableCall<'a, C> {
2699 self._scopes.clear();
2700 self
2701 }
2702}
2703
2704/// Enables a SecretVersion. Sets the state of the SecretVersion to ENABLED.
2705///
2706/// A builder for the *secrets.versions.enable* method supported by a *project* resource.
2707/// It is not used directly, but through a [`ProjectMethods`] instance.
2708///
2709/// # Example
2710///
2711/// Instantiate a resource method builder
2712///
2713/// ```test_harness,no_run
2714/// # extern crate hyper;
2715/// # extern crate hyper_rustls;
2716/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
2717/// use secretmanager1_beta1::api::EnableSecretVersionRequest;
2718/// # async fn dox() {
2719/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2720///
2721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2722/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2723/// # .with_native_roots()
2724/// # .unwrap()
2725/// # .https_only()
2726/// # .enable_http2()
2727/// # .build();
2728///
2729/// # let executor = hyper_util::rt::TokioExecutor::new();
2730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2731/// # secret,
2732/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2733/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2734/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2735/// # ),
2736/// # ).build().await.unwrap();
2737///
2738/// # let client = hyper_util::client::legacy::Client::builder(
2739/// # hyper_util::rt::TokioExecutor::new()
2740/// # )
2741/// # .build(
2742/// # hyper_rustls::HttpsConnectorBuilder::new()
2743/// # .with_native_roots()
2744/// # .unwrap()
2745/// # .https_or_http()
2746/// # .enable_http2()
2747/// # .build()
2748/// # );
2749/// # let mut hub = SecretManager::new(client, auth);
2750/// // As the method needs a request, you would usually fill it with the desired information
2751/// // into the respective structure. Some of the parts shown here might not be applicable !
2752/// // Values shown here are possibly random and not representative !
2753/// let mut req = EnableSecretVersionRequest::default();
2754///
2755/// // You can configure optional parameters by calling the respective setters at will, and
2756/// // execute the final call using `doit()`.
2757/// // Values shown here are possibly random and not representative !
2758/// let result = hub.projects().secrets_versions_enable(req, "name")
2759/// .doit().await;
2760/// # }
2761/// ```
2762pub struct ProjectSecretVersionEnableCall<'a, C>
2763where
2764 C: 'a,
2765{
2766 hub: &'a SecretManager<C>,
2767 _request: EnableSecretVersionRequest,
2768 _name: String,
2769 _delegate: Option<&'a mut dyn common::Delegate>,
2770 _additional_params: HashMap<String, String>,
2771 _scopes: BTreeSet<String>,
2772}
2773
2774impl<'a, C> common::CallBuilder for ProjectSecretVersionEnableCall<'a, C> {}
2775
2776impl<'a, C> ProjectSecretVersionEnableCall<'a, C>
2777where
2778 C: common::Connector,
2779{
2780 /// Perform the operation you have build so far.
2781 pub async fn doit(mut self) -> common::Result<(common::Response, SecretVersion)> {
2782 use std::borrow::Cow;
2783 use std::io::{Read, Seek};
2784
2785 use common::{url::Params, ToParts};
2786 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2787
2788 let mut dd = common::DefaultDelegate;
2789 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2790 dlg.begin(common::MethodInfo {
2791 id: "secretmanager.projects.secrets.versions.enable",
2792 http_method: hyper::Method::POST,
2793 });
2794
2795 for &field in ["alt", "name"].iter() {
2796 if self._additional_params.contains_key(field) {
2797 dlg.finished(false);
2798 return Err(common::Error::FieldClash(field));
2799 }
2800 }
2801
2802 let mut params = Params::with_capacity(4 + self._additional_params.len());
2803 params.push("name", self._name);
2804
2805 params.extend(self._additional_params.iter());
2806
2807 params.push("alt", "json");
2808 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:enable";
2809 if self._scopes.is_empty() {
2810 self._scopes
2811 .insert(Scope::CloudPlatform.as_ref().to_string());
2812 }
2813
2814 #[allow(clippy::single_element_loop)]
2815 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2816 url = params.uri_replacement(url, param_name, find_this, true);
2817 }
2818 {
2819 let to_remove = ["name"];
2820 params.remove_params(&to_remove);
2821 }
2822
2823 let url = params.parse_with_url(&url);
2824
2825 let mut json_mime_type = mime::APPLICATION_JSON;
2826 let mut request_value_reader = {
2827 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2828 common::remove_json_null_values(&mut value);
2829 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2830 serde_json::to_writer(&mut dst, &value).unwrap();
2831 dst
2832 };
2833 let request_size = request_value_reader
2834 .seek(std::io::SeekFrom::End(0))
2835 .unwrap();
2836 request_value_reader
2837 .seek(std::io::SeekFrom::Start(0))
2838 .unwrap();
2839
2840 loop {
2841 let token = match self
2842 .hub
2843 .auth
2844 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2845 .await
2846 {
2847 Ok(token) => token,
2848 Err(e) => match dlg.token(e) {
2849 Ok(token) => token,
2850 Err(e) => {
2851 dlg.finished(false);
2852 return Err(common::Error::MissingToken(e));
2853 }
2854 },
2855 };
2856 request_value_reader
2857 .seek(std::io::SeekFrom::Start(0))
2858 .unwrap();
2859 let mut req_result = {
2860 let client = &self.hub.client;
2861 dlg.pre_request();
2862 let mut req_builder = hyper::Request::builder()
2863 .method(hyper::Method::POST)
2864 .uri(url.as_str())
2865 .header(USER_AGENT, self.hub._user_agent.clone());
2866
2867 if let Some(token) = token.as_ref() {
2868 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2869 }
2870
2871 let request = req_builder
2872 .header(CONTENT_TYPE, json_mime_type.to_string())
2873 .header(CONTENT_LENGTH, request_size as u64)
2874 .body(common::to_body(
2875 request_value_reader.get_ref().clone().into(),
2876 ));
2877
2878 client.request(request.unwrap()).await
2879 };
2880
2881 match req_result {
2882 Err(err) => {
2883 if let common::Retry::After(d) = dlg.http_error(&err) {
2884 sleep(d).await;
2885 continue;
2886 }
2887 dlg.finished(false);
2888 return Err(common::Error::HttpError(err));
2889 }
2890 Ok(res) => {
2891 let (mut parts, body) = res.into_parts();
2892 let mut body = common::Body::new(body);
2893 if !parts.status.is_success() {
2894 let bytes = common::to_bytes(body).await.unwrap_or_default();
2895 let error = serde_json::from_str(&common::to_string(&bytes));
2896 let response = common::to_response(parts, bytes.into());
2897
2898 if let common::Retry::After(d) =
2899 dlg.http_failure(&response, error.as_ref().ok())
2900 {
2901 sleep(d).await;
2902 continue;
2903 }
2904
2905 dlg.finished(false);
2906
2907 return Err(match error {
2908 Ok(value) => common::Error::BadRequest(value),
2909 _ => common::Error::Failure(response),
2910 });
2911 }
2912 let response = {
2913 let bytes = common::to_bytes(body).await.unwrap_or_default();
2914 let encoded = common::to_string(&bytes);
2915 match serde_json::from_str(&encoded) {
2916 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2917 Err(error) => {
2918 dlg.response_json_decode_error(&encoded, &error);
2919 return Err(common::Error::JsonDecodeError(
2920 encoded.to_string(),
2921 error,
2922 ));
2923 }
2924 }
2925 };
2926
2927 dlg.finished(true);
2928 return Ok(response);
2929 }
2930 }
2931 }
2932 }
2933
2934 ///
2935 /// Sets the *request* property to the given value.
2936 ///
2937 /// Even though the property as already been set when instantiating this call,
2938 /// we provide this method for API completeness.
2939 pub fn request(
2940 mut self,
2941 new_value: EnableSecretVersionRequest,
2942 ) -> ProjectSecretVersionEnableCall<'a, C> {
2943 self._request = new_value;
2944 self
2945 }
2946 /// Required. The resource name of the SecretVersion to enable in the format `projects/*/secrets/*/versions/*`.
2947 ///
2948 /// Sets the *name* path property to the given value.
2949 ///
2950 /// Even though the property as already been set when instantiating this call,
2951 /// we provide this method for API completeness.
2952 pub fn name(mut self, new_value: &str) -> ProjectSecretVersionEnableCall<'a, C> {
2953 self._name = new_value.to_string();
2954 self
2955 }
2956 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2957 /// while executing the actual API request.
2958 ///
2959 /// ````text
2960 /// It should be used to handle progress information, and to implement a certain level of resilience.
2961 /// ````
2962 ///
2963 /// Sets the *delegate* property to the given value.
2964 pub fn delegate(
2965 mut self,
2966 new_value: &'a mut dyn common::Delegate,
2967 ) -> ProjectSecretVersionEnableCall<'a, C> {
2968 self._delegate = Some(new_value);
2969 self
2970 }
2971
2972 /// Set any additional parameter of the query string used in the request.
2973 /// It should be used to set parameters which are not yet available through their own
2974 /// setters.
2975 ///
2976 /// Please note that this method must not be used to set any of the known parameters
2977 /// which have their own setter method. If done anyway, the request will fail.
2978 ///
2979 /// # Additional Parameters
2980 ///
2981 /// * *$.xgafv* (query-string) - V1 error format.
2982 /// * *access_token* (query-string) - OAuth access token.
2983 /// * *alt* (query-string) - Data format for response.
2984 /// * *callback* (query-string) - JSONP
2985 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2986 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2987 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2988 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2989 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2990 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2991 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2992 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionEnableCall<'a, C>
2993 where
2994 T: AsRef<str>,
2995 {
2996 self._additional_params
2997 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2998 self
2999 }
3000
3001 /// Identifies the authorization scope for the method you are building.
3002 ///
3003 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3004 /// [`Scope::CloudPlatform`].
3005 ///
3006 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3007 /// tokens for more than one scope.
3008 ///
3009 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3010 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3011 /// sufficient, a read-write scope will do as well.
3012 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionEnableCall<'a, C>
3013 where
3014 St: AsRef<str>,
3015 {
3016 self._scopes.insert(String::from(scope.as_ref()));
3017 self
3018 }
3019 /// Identifies the authorization scope(s) for the method you are building.
3020 ///
3021 /// See [`Self::add_scope()`] for details.
3022 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionEnableCall<'a, C>
3023 where
3024 I: IntoIterator<Item = St>,
3025 St: AsRef<str>,
3026 {
3027 self._scopes
3028 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3029 self
3030 }
3031
3032 /// Removes all scopes, and no default scope will be used either.
3033 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3034 /// for details).
3035 pub fn clear_scopes(mut self) -> ProjectSecretVersionEnableCall<'a, C> {
3036 self._scopes.clear();
3037 self
3038 }
3039}
3040
3041/// Gets metadata for a SecretVersion. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
3042///
3043/// A builder for the *secrets.versions.get* method supported by a *project* resource.
3044/// It is not used directly, but through a [`ProjectMethods`] instance.
3045///
3046/// # Example
3047///
3048/// Instantiate a resource method builder
3049///
3050/// ```test_harness,no_run
3051/// # extern crate hyper;
3052/// # extern crate hyper_rustls;
3053/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
3054/// # async fn dox() {
3055/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3056///
3057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3058/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3059/// # .with_native_roots()
3060/// # .unwrap()
3061/// # .https_only()
3062/// # .enable_http2()
3063/// # .build();
3064///
3065/// # let executor = hyper_util::rt::TokioExecutor::new();
3066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3067/// # secret,
3068/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3069/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3070/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3071/// # ),
3072/// # ).build().await.unwrap();
3073///
3074/// # let client = hyper_util::client::legacy::Client::builder(
3075/// # hyper_util::rt::TokioExecutor::new()
3076/// # )
3077/// # .build(
3078/// # hyper_rustls::HttpsConnectorBuilder::new()
3079/// # .with_native_roots()
3080/// # .unwrap()
3081/// # .https_or_http()
3082/// # .enable_http2()
3083/// # .build()
3084/// # );
3085/// # let mut hub = SecretManager::new(client, auth);
3086/// // You can configure optional parameters by calling the respective setters at will, and
3087/// // execute the final call using `doit()`.
3088/// // Values shown here are possibly random and not representative !
3089/// let result = hub.projects().secrets_versions_get("name")
3090/// .doit().await;
3091/// # }
3092/// ```
3093pub struct ProjectSecretVersionGetCall<'a, C>
3094where
3095 C: 'a,
3096{
3097 hub: &'a SecretManager<C>,
3098 _name: String,
3099 _delegate: Option<&'a mut dyn common::Delegate>,
3100 _additional_params: HashMap<String, String>,
3101 _scopes: BTreeSet<String>,
3102}
3103
3104impl<'a, C> common::CallBuilder for ProjectSecretVersionGetCall<'a, C> {}
3105
3106impl<'a, C> ProjectSecretVersionGetCall<'a, C>
3107where
3108 C: common::Connector,
3109{
3110 /// Perform the operation you have build so far.
3111 pub async fn doit(mut self) -> common::Result<(common::Response, SecretVersion)> {
3112 use std::borrow::Cow;
3113 use std::io::{Read, Seek};
3114
3115 use common::{url::Params, ToParts};
3116 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3117
3118 let mut dd = common::DefaultDelegate;
3119 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3120 dlg.begin(common::MethodInfo {
3121 id: "secretmanager.projects.secrets.versions.get",
3122 http_method: hyper::Method::GET,
3123 });
3124
3125 for &field in ["alt", "name"].iter() {
3126 if self._additional_params.contains_key(field) {
3127 dlg.finished(false);
3128 return Err(common::Error::FieldClash(field));
3129 }
3130 }
3131
3132 let mut params = Params::with_capacity(3 + self._additional_params.len());
3133 params.push("name", self._name);
3134
3135 params.extend(self._additional_params.iter());
3136
3137 params.push("alt", "json");
3138 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3139 if self._scopes.is_empty() {
3140 self._scopes
3141 .insert(Scope::CloudPlatform.as_ref().to_string());
3142 }
3143
3144 #[allow(clippy::single_element_loop)]
3145 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3146 url = params.uri_replacement(url, param_name, find_this, true);
3147 }
3148 {
3149 let to_remove = ["name"];
3150 params.remove_params(&to_remove);
3151 }
3152
3153 let url = params.parse_with_url(&url);
3154
3155 loop {
3156 let token = match self
3157 .hub
3158 .auth
3159 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3160 .await
3161 {
3162 Ok(token) => token,
3163 Err(e) => match dlg.token(e) {
3164 Ok(token) => token,
3165 Err(e) => {
3166 dlg.finished(false);
3167 return Err(common::Error::MissingToken(e));
3168 }
3169 },
3170 };
3171 let mut req_result = {
3172 let client = &self.hub.client;
3173 dlg.pre_request();
3174 let mut req_builder = hyper::Request::builder()
3175 .method(hyper::Method::GET)
3176 .uri(url.as_str())
3177 .header(USER_AGENT, self.hub._user_agent.clone());
3178
3179 if let Some(token) = token.as_ref() {
3180 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3181 }
3182
3183 let request = req_builder
3184 .header(CONTENT_LENGTH, 0_u64)
3185 .body(common::to_body::<String>(None));
3186
3187 client.request(request.unwrap()).await
3188 };
3189
3190 match req_result {
3191 Err(err) => {
3192 if let common::Retry::After(d) = dlg.http_error(&err) {
3193 sleep(d).await;
3194 continue;
3195 }
3196 dlg.finished(false);
3197 return Err(common::Error::HttpError(err));
3198 }
3199 Ok(res) => {
3200 let (mut parts, body) = res.into_parts();
3201 let mut body = common::Body::new(body);
3202 if !parts.status.is_success() {
3203 let bytes = common::to_bytes(body).await.unwrap_or_default();
3204 let error = serde_json::from_str(&common::to_string(&bytes));
3205 let response = common::to_response(parts, bytes.into());
3206
3207 if let common::Retry::After(d) =
3208 dlg.http_failure(&response, error.as_ref().ok())
3209 {
3210 sleep(d).await;
3211 continue;
3212 }
3213
3214 dlg.finished(false);
3215
3216 return Err(match error {
3217 Ok(value) => common::Error::BadRequest(value),
3218 _ => common::Error::Failure(response),
3219 });
3220 }
3221 let response = {
3222 let bytes = common::to_bytes(body).await.unwrap_or_default();
3223 let encoded = common::to_string(&bytes);
3224 match serde_json::from_str(&encoded) {
3225 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3226 Err(error) => {
3227 dlg.response_json_decode_error(&encoded, &error);
3228 return Err(common::Error::JsonDecodeError(
3229 encoded.to_string(),
3230 error,
3231 ));
3232 }
3233 }
3234 };
3235
3236 dlg.finished(true);
3237 return Ok(response);
3238 }
3239 }
3240 }
3241 }
3242
3243 /// Required. The resource name of the SecretVersion in the format `projects/*/secrets/*/versions/*`. `projects/*/secrets/*/versions/latest` is an alias to the `latest` SecretVersion.
3244 ///
3245 /// Sets the *name* path property to the given value.
3246 ///
3247 /// Even though the property as already been set when instantiating this call,
3248 /// we provide this method for API completeness.
3249 pub fn name(mut self, new_value: &str) -> ProjectSecretVersionGetCall<'a, C> {
3250 self._name = new_value.to_string();
3251 self
3252 }
3253 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3254 /// while executing the actual API request.
3255 ///
3256 /// ````text
3257 /// It should be used to handle progress information, and to implement a certain level of resilience.
3258 /// ````
3259 ///
3260 /// Sets the *delegate* property to the given value.
3261 pub fn delegate(
3262 mut self,
3263 new_value: &'a mut dyn common::Delegate,
3264 ) -> ProjectSecretVersionGetCall<'a, C> {
3265 self._delegate = Some(new_value);
3266 self
3267 }
3268
3269 /// Set any additional parameter of the query string used in the request.
3270 /// It should be used to set parameters which are not yet available through their own
3271 /// setters.
3272 ///
3273 /// Please note that this method must not be used to set any of the known parameters
3274 /// which have their own setter method. If done anyway, the request will fail.
3275 ///
3276 /// # Additional Parameters
3277 ///
3278 /// * *$.xgafv* (query-string) - V1 error format.
3279 /// * *access_token* (query-string) - OAuth access token.
3280 /// * *alt* (query-string) - Data format for response.
3281 /// * *callback* (query-string) - JSONP
3282 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3283 /// * *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.
3284 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3285 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3286 /// * *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.
3287 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3288 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3289 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionGetCall<'a, C>
3290 where
3291 T: AsRef<str>,
3292 {
3293 self._additional_params
3294 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3295 self
3296 }
3297
3298 /// Identifies the authorization scope for the method you are building.
3299 ///
3300 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3301 /// [`Scope::CloudPlatform`].
3302 ///
3303 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3304 /// tokens for more than one scope.
3305 ///
3306 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3307 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3308 /// sufficient, a read-write scope will do as well.
3309 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionGetCall<'a, C>
3310 where
3311 St: AsRef<str>,
3312 {
3313 self._scopes.insert(String::from(scope.as_ref()));
3314 self
3315 }
3316 /// Identifies the authorization scope(s) for the method you are building.
3317 ///
3318 /// See [`Self::add_scope()`] for details.
3319 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionGetCall<'a, C>
3320 where
3321 I: IntoIterator<Item = St>,
3322 St: AsRef<str>,
3323 {
3324 self._scopes
3325 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3326 self
3327 }
3328
3329 /// Removes all scopes, and no default scope will be used either.
3330 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3331 /// for details).
3332 pub fn clear_scopes(mut self) -> ProjectSecretVersionGetCall<'a, C> {
3333 self._scopes.clear();
3334 self
3335 }
3336}
3337
3338/// Lists SecretVersions. This call does not return secret data.
3339///
3340/// A builder for the *secrets.versions.list* method supported by a *project* resource.
3341/// It is not used directly, but through a [`ProjectMethods`] instance.
3342///
3343/// # Example
3344///
3345/// Instantiate a resource method builder
3346///
3347/// ```test_harness,no_run
3348/// # extern crate hyper;
3349/// # extern crate hyper_rustls;
3350/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
3351/// # async fn dox() {
3352/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3353///
3354/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3355/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3356/// # .with_native_roots()
3357/// # .unwrap()
3358/// # .https_only()
3359/// # .enable_http2()
3360/// # .build();
3361///
3362/// # let executor = hyper_util::rt::TokioExecutor::new();
3363/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3364/// # secret,
3365/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3366/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3367/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3368/// # ),
3369/// # ).build().await.unwrap();
3370///
3371/// # let client = hyper_util::client::legacy::Client::builder(
3372/// # hyper_util::rt::TokioExecutor::new()
3373/// # )
3374/// # .build(
3375/// # hyper_rustls::HttpsConnectorBuilder::new()
3376/// # .with_native_roots()
3377/// # .unwrap()
3378/// # .https_or_http()
3379/// # .enable_http2()
3380/// # .build()
3381/// # );
3382/// # let mut hub = SecretManager::new(client, auth);
3383/// // You can configure optional parameters by calling the respective setters at will, and
3384/// // execute the final call using `doit()`.
3385/// // Values shown here are possibly random and not representative !
3386/// let result = hub.projects().secrets_versions_list("parent")
3387/// .page_token("gubergren")
3388/// .page_size(-75)
3389/// .doit().await;
3390/// # }
3391/// ```
3392pub struct ProjectSecretVersionListCall<'a, C>
3393where
3394 C: 'a,
3395{
3396 hub: &'a SecretManager<C>,
3397 _parent: String,
3398 _page_token: Option<String>,
3399 _page_size: Option<i32>,
3400 _delegate: Option<&'a mut dyn common::Delegate>,
3401 _additional_params: HashMap<String, String>,
3402 _scopes: BTreeSet<String>,
3403}
3404
3405impl<'a, C> common::CallBuilder for ProjectSecretVersionListCall<'a, C> {}
3406
3407impl<'a, C> ProjectSecretVersionListCall<'a, C>
3408where
3409 C: common::Connector,
3410{
3411 /// Perform the operation you have build so far.
3412 pub async fn doit(mut self) -> common::Result<(common::Response, ListSecretVersionsResponse)> {
3413 use std::borrow::Cow;
3414 use std::io::{Read, Seek};
3415
3416 use common::{url::Params, ToParts};
3417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3418
3419 let mut dd = common::DefaultDelegate;
3420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3421 dlg.begin(common::MethodInfo {
3422 id: "secretmanager.projects.secrets.versions.list",
3423 http_method: hyper::Method::GET,
3424 });
3425
3426 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3427 if self._additional_params.contains_key(field) {
3428 dlg.finished(false);
3429 return Err(common::Error::FieldClash(field));
3430 }
3431 }
3432
3433 let mut params = Params::with_capacity(5 + self._additional_params.len());
3434 params.push("parent", self._parent);
3435 if let Some(value) = self._page_token.as_ref() {
3436 params.push("pageToken", value);
3437 }
3438 if let Some(value) = self._page_size.as_ref() {
3439 params.push("pageSize", value.to_string());
3440 }
3441
3442 params.extend(self._additional_params.iter());
3443
3444 params.push("alt", "json");
3445 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
3446 if self._scopes.is_empty() {
3447 self._scopes
3448 .insert(Scope::CloudPlatform.as_ref().to_string());
3449 }
3450
3451 #[allow(clippy::single_element_loop)]
3452 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3453 url = params.uri_replacement(url, param_name, find_this, true);
3454 }
3455 {
3456 let to_remove = ["parent"];
3457 params.remove_params(&to_remove);
3458 }
3459
3460 let url = params.parse_with_url(&url);
3461
3462 loop {
3463 let token = match self
3464 .hub
3465 .auth
3466 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3467 .await
3468 {
3469 Ok(token) => token,
3470 Err(e) => match dlg.token(e) {
3471 Ok(token) => token,
3472 Err(e) => {
3473 dlg.finished(false);
3474 return Err(common::Error::MissingToken(e));
3475 }
3476 },
3477 };
3478 let mut req_result = {
3479 let client = &self.hub.client;
3480 dlg.pre_request();
3481 let mut req_builder = hyper::Request::builder()
3482 .method(hyper::Method::GET)
3483 .uri(url.as_str())
3484 .header(USER_AGENT, self.hub._user_agent.clone());
3485
3486 if let Some(token) = token.as_ref() {
3487 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3488 }
3489
3490 let request = req_builder
3491 .header(CONTENT_LENGTH, 0_u64)
3492 .body(common::to_body::<String>(None));
3493
3494 client.request(request.unwrap()).await
3495 };
3496
3497 match req_result {
3498 Err(err) => {
3499 if let common::Retry::After(d) = dlg.http_error(&err) {
3500 sleep(d).await;
3501 continue;
3502 }
3503 dlg.finished(false);
3504 return Err(common::Error::HttpError(err));
3505 }
3506 Ok(res) => {
3507 let (mut parts, body) = res.into_parts();
3508 let mut body = common::Body::new(body);
3509 if !parts.status.is_success() {
3510 let bytes = common::to_bytes(body).await.unwrap_or_default();
3511 let error = serde_json::from_str(&common::to_string(&bytes));
3512 let response = common::to_response(parts, bytes.into());
3513
3514 if let common::Retry::After(d) =
3515 dlg.http_failure(&response, error.as_ref().ok())
3516 {
3517 sleep(d).await;
3518 continue;
3519 }
3520
3521 dlg.finished(false);
3522
3523 return Err(match error {
3524 Ok(value) => common::Error::BadRequest(value),
3525 _ => common::Error::Failure(response),
3526 });
3527 }
3528 let response = {
3529 let bytes = common::to_bytes(body).await.unwrap_or_default();
3530 let encoded = common::to_string(&bytes);
3531 match serde_json::from_str(&encoded) {
3532 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3533 Err(error) => {
3534 dlg.response_json_decode_error(&encoded, &error);
3535 return Err(common::Error::JsonDecodeError(
3536 encoded.to_string(),
3537 error,
3538 ));
3539 }
3540 }
3541 };
3542
3543 dlg.finished(true);
3544 return Ok(response);
3545 }
3546 }
3547 }
3548 }
3549
3550 /// Required. The resource name of the Secret associated with the SecretVersions to list, in the format `projects/*/secrets/*`.
3551 ///
3552 /// Sets the *parent* path property to the given value.
3553 ///
3554 /// Even though the property as already been set when instantiating this call,
3555 /// we provide this method for API completeness.
3556 pub fn parent(mut self, new_value: &str) -> ProjectSecretVersionListCall<'a, C> {
3557 self._parent = new_value.to_string();
3558 self
3559 }
3560 /// Optional. Pagination token, returned earlier via ListSecretVersionsResponse.next_page_token][].
3561 ///
3562 /// Sets the *page token* query property to the given value.
3563 pub fn page_token(mut self, new_value: &str) -> ProjectSecretVersionListCall<'a, C> {
3564 self._page_token = Some(new_value.to_string());
3565 self
3566 }
3567 /// Optional. The maximum number of results to be returned in a single page. If set to 0, the server decides the number of results to return. If the number is greater than 25000, it is capped at 25000.
3568 ///
3569 /// Sets the *page size* query property to the given value.
3570 pub fn page_size(mut self, new_value: i32) -> ProjectSecretVersionListCall<'a, C> {
3571 self._page_size = Some(new_value);
3572 self
3573 }
3574 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3575 /// while executing the actual API request.
3576 ///
3577 /// ````text
3578 /// It should be used to handle progress information, and to implement a certain level of resilience.
3579 /// ````
3580 ///
3581 /// Sets the *delegate* property to the given value.
3582 pub fn delegate(
3583 mut self,
3584 new_value: &'a mut dyn common::Delegate,
3585 ) -> ProjectSecretVersionListCall<'a, C> {
3586 self._delegate = Some(new_value);
3587 self
3588 }
3589
3590 /// Set any additional parameter of the query string used in the request.
3591 /// It should be used to set parameters which are not yet available through their own
3592 /// setters.
3593 ///
3594 /// Please note that this method must not be used to set any of the known parameters
3595 /// which have their own setter method. If done anyway, the request will fail.
3596 ///
3597 /// # Additional Parameters
3598 ///
3599 /// * *$.xgafv* (query-string) - V1 error format.
3600 /// * *access_token* (query-string) - OAuth access token.
3601 /// * *alt* (query-string) - Data format for response.
3602 /// * *callback* (query-string) - JSONP
3603 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3604 /// * *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.
3605 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3606 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3607 /// * *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.
3608 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3609 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3610 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretVersionListCall<'a, C>
3611 where
3612 T: AsRef<str>,
3613 {
3614 self._additional_params
3615 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3616 self
3617 }
3618
3619 /// Identifies the authorization scope for the method you are building.
3620 ///
3621 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3622 /// [`Scope::CloudPlatform`].
3623 ///
3624 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3625 /// tokens for more than one scope.
3626 ///
3627 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3628 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3629 /// sufficient, a read-write scope will do as well.
3630 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretVersionListCall<'a, C>
3631 where
3632 St: AsRef<str>,
3633 {
3634 self._scopes.insert(String::from(scope.as_ref()));
3635 self
3636 }
3637 /// Identifies the authorization scope(s) for the method you are building.
3638 ///
3639 /// See [`Self::add_scope()`] for details.
3640 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretVersionListCall<'a, C>
3641 where
3642 I: IntoIterator<Item = St>,
3643 St: AsRef<str>,
3644 {
3645 self._scopes
3646 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3647 self
3648 }
3649
3650 /// Removes all scopes, and no default scope will be used either.
3651 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3652 /// for details).
3653 pub fn clear_scopes(mut self) -> ProjectSecretVersionListCall<'a, C> {
3654 self._scopes.clear();
3655 self
3656 }
3657}
3658
3659/// Creates a new SecretVersion containing secret data and attaches it to an existing Secret.
3660///
3661/// A builder for the *secrets.addVersion* method supported by a *project* resource.
3662/// It is not used directly, but through a [`ProjectMethods`] instance.
3663///
3664/// # Example
3665///
3666/// Instantiate a resource method builder
3667///
3668/// ```test_harness,no_run
3669/// # extern crate hyper;
3670/// # extern crate hyper_rustls;
3671/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
3672/// use secretmanager1_beta1::api::AddSecretVersionRequest;
3673/// # async fn dox() {
3674/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3675///
3676/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3677/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3678/// # .with_native_roots()
3679/// # .unwrap()
3680/// # .https_only()
3681/// # .enable_http2()
3682/// # .build();
3683///
3684/// # let executor = hyper_util::rt::TokioExecutor::new();
3685/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3686/// # secret,
3687/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3688/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3689/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3690/// # ),
3691/// # ).build().await.unwrap();
3692///
3693/// # let client = hyper_util::client::legacy::Client::builder(
3694/// # hyper_util::rt::TokioExecutor::new()
3695/// # )
3696/// # .build(
3697/// # hyper_rustls::HttpsConnectorBuilder::new()
3698/// # .with_native_roots()
3699/// # .unwrap()
3700/// # .https_or_http()
3701/// # .enable_http2()
3702/// # .build()
3703/// # );
3704/// # let mut hub = SecretManager::new(client, auth);
3705/// // As the method needs a request, you would usually fill it with the desired information
3706/// // into the respective structure. Some of the parts shown here might not be applicable !
3707/// // Values shown here are possibly random and not representative !
3708/// let mut req = AddSecretVersionRequest::default();
3709///
3710/// // You can configure optional parameters by calling the respective setters at will, and
3711/// // execute the final call using `doit()`.
3712/// // Values shown here are possibly random and not representative !
3713/// let result = hub.projects().secrets_add_version(req, "parent")
3714/// .doit().await;
3715/// # }
3716/// ```
3717pub struct ProjectSecretAddVersionCall<'a, C>
3718where
3719 C: 'a,
3720{
3721 hub: &'a SecretManager<C>,
3722 _request: AddSecretVersionRequest,
3723 _parent: String,
3724 _delegate: Option<&'a mut dyn common::Delegate>,
3725 _additional_params: HashMap<String, String>,
3726 _scopes: BTreeSet<String>,
3727}
3728
3729impl<'a, C> common::CallBuilder for ProjectSecretAddVersionCall<'a, C> {}
3730
3731impl<'a, C> ProjectSecretAddVersionCall<'a, C>
3732where
3733 C: common::Connector,
3734{
3735 /// Perform the operation you have build so far.
3736 pub async fn doit(mut self) -> common::Result<(common::Response, SecretVersion)> {
3737 use std::borrow::Cow;
3738 use std::io::{Read, Seek};
3739
3740 use common::{url::Params, ToParts};
3741 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3742
3743 let mut dd = common::DefaultDelegate;
3744 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3745 dlg.begin(common::MethodInfo {
3746 id: "secretmanager.projects.secrets.addVersion",
3747 http_method: hyper::Method::POST,
3748 });
3749
3750 for &field in ["alt", "parent"].iter() {
3751 if self._additional_params.contains_key(field) {
3752 dlg.finished(false);
3753 return Err(common::Error::FieldClash(field));
3754 }
3755 }
3756
3757 let mut params = Params::with_capacity(4 + self._additional_params.len());
3758 params.push("parent", self._parent);
3759
3760 params.extend(self._additional_params.iter());
3761
3762 params.push("alt", "json");
3763 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:addVersion";
3764 if self._scopes.is_empty() {
3765 self._scopes
3766 .insert(Scope::CloudPlatform.as_ref().to_string());
3767 }
3768
3769 #[allow(clippy::single_element_loop)]
3770 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3771 url = params.uri_replacement(url, param_name, find_this, true);
3772 }
3773 {
3774 let to_remove = ["parent"];
3775 params.remove_params(&to_remove);
3776 }
3777
3778 let url = params.parse_with_url(&url);
3779
3780 let mut json_mime_type = mime::APPLICATION_JSON;
3781 let mut request_value_reader = {
3782 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3783 common::remove_json_null_values(&mut value);
3784 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3785 serde_json::to_writer(&mut dst, &value).unwrap();
3786 dst
3787 };
3788 let request_size = request_value_reader
3789 .seek(std::io::SeekFrom::End(0))
3790 .unwrap();
3791 request_value_reader
3792 .seek(std::io::SeekFrom::Start(0))
3793 .unwrap();
3794
3795 loop {
3796 let token = match self
3797 .hub
3798 .auth
3799 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3800 .await
3801 {
3802 Ok(token) => token,
3803 Err(e) => match dlg.token(e) {
3804 Ok(token) => token,
3805 Err(e) => {
3806 dlg.finished(false);
3807 return Err(common::Error::MissingToken(e));
3808 }
3809 },
3810 };
3811 request_value_reader
3812 .seek(std::io::SeekFrom::Start(0))
3813 .unwrap();
3814 let mut req_result = {
3815 let client = &self.hub.client;
3816 dlg.pre_request();
3817 let mut req_builder = hyper::Request::builder()
3818 .method(hyper::Method::POST)
3819 .uri(url.as_str())
3820 .header(USER_AGENT, self.hub._user_agent.clone());
3821
3822 if let Some(token) = token.as_ref() {
3823 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3824 }
3825
3826 let request = req_builder
3827 .header(CONTENT_TYPE, json_mime_type.to_string())
3828 .header(CONTENT_LENGTH, request_size as u64)
3829 .body(common::to_body(
3830 request_value_reader.get_ref().clone().into(),
3831 ));
3832
3833 client.request(request.unwrap()).await
3834 };
3835
3836 match req_result {
3837 Err(err) => {
3838 if let common::Retry::After(d) = dlg.http_error(&err) {
3839 sleep(d).await;
3840 continue;
3841 }
3842 dlg.finished(false);
3843 return Err(common::Error::HttpError(err));
3844 }
3845 Ok(res) => {
3846 let (mut parts, body) = res.into_parts();
3847 let mut body = common::Body::new(body);
3848 if !parts.status.is_success() {
3849 let bytes = common::to_bytes(body).await.unwrap_or_default();
3850 let error = serde_json::from_str(&common::to_string(&bytes));
3851 let response = common::to_response(parts, bytes.into());
3852
3853 if let common::Retry::After(d) =
3854 dlg.http_failure(&response, error.as_ref().ok())
3855 {
3856 sleep(d).await;
3857 continue;
3858 }
3859
3860 dlg.finished(false);
3861
3862 return Err(match error {
3863 Ok(value) => common::Error::BadRequest(value),
3864 _ => common::Error::Failure(response),
3865 });
3866 }
3867 let response = {
3868 let bytes = common::to_bytes(body).await.unwrap_or_default();
3869 let encoded = common::to_string(&bytes);
3870 match serde_json::from_str(&encoded) {
3871 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3872 Err(error) => {
3873 dlg.response_json_decode_error(&encoded, &error);
3874 return Err(common::Error::JsonDecodeError(
3875 encoded.to_string(),
3876 error,
3877 ));
3878 }
3879 }
3880 };
3881
3882 dlg.finished(true);
3883 return Ok(response);
3884 }
3885 }
3886 }
3887 }
3888
3889 ///
3890 /// Sets the *request* property to the given value.
3891 ///
3892 /// Even though the property as already been set when instantiating this call,
3893 /// we provide this method for API completeness.
3894 pub fn request(
3895 mut self,
3896 new_value: AddSecretVersionRequest,
3897 ) -> ProjectSecretAddVersionCall<'a, C> {
3898 self._request = new_value;
3899 self
3900 }
3901 /// Required. The resource name of the Secret to associate with the SecretVersion in the format `projects/*/secrets/*`.
3902 ///
3903 /// Sets the *parent* path property to the given value.
3904 ///
3905 /// Even though the property as already been set when instantiating this call,
3906 /// we provide this method for API completeness.
3907 pub fn parent(mut self, new_value: &str) -> ProjectSecretAddVersionCall<'a, C> {
3908 self._parent = new_value.to_string();
3909 self
3910 }
3911 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3912 /// while executing the actual API request.
3913 ///
3914 /// ````text
3915 /// It should be used to handle progress information, and to implement a certain level of resilience.
3916 /// ````
3917 ///
3918 /// Sets the *delegate* property to the given value.
3919 pub fn delegate(
3920 mut self,
3921 new_value: &'a mut dyn common::Delegate,
3922 ) -> ProjectSecretAddVersionCall<'a, C> {
3923 self._delegate = Some(new_value);
3924 self
3925 }
3926
3927 /// Set any additional parameter of the query string used in the request.
3928 /// It should be used to set parameters which are not yet available through their own
3929 /// setters.
3930 ///
3931 /// Please note that this method must not be used to set any of the known parameters
3932 /// which have their own setter method. If done anyway, the request will fail.
3933 ///
3934 /// # Additional Parameters
3935 ///
3936 /// * *$.xgafv* (query-string) - V1 error format.
3937 /// * *access_token* (query-string) - OAuth access token.
3938 /// * *alt* (query-string) - Data format for response.
3939 /// * *callback* (query-string) - JSONP
3940 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3941 /// * *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.
3942 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3943 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3944 /// * *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.
3945 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3946 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3947 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretAddVersionCall<'a, C>
3948 where
3949 T: AsRef<str>,
3950 {
3951 self._additional_params
3952 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3953 self
3954 }
3955
3956 /// Identifies the authorization scope for the method you are building.
3957 ///
3958 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3959 /// [`Scope::CloudPlatform`].
3960 ///
3961 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3962 /// tokens for more than one scope.
3963 ///
3964 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3965 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3966 /// sufficient, a read-write scope will do as well.
3967 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretAddVersionCall<'a, C>
3968 where
3969 St: AsRef<str>,
3970 {
3971 self._scopes.insert(String::from(scope.as_ref()));
3972 self
3973 }
3974 /// Identifies the authorization scope(s) for the method you are building.
3975 ///
3976 /// See [`Self::add_scope()`] for details.
3977 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretAddVersionCall<'a, C>
3978 where
3979 I: IntoIterator<Item = St>,
3980 St: AsRef<str>,
3981 {
3982 self._scopes
3983 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3984 self
3985 }
3986
3987 /// Removes all scopes, and no default scope will be used either.
3988 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3989 /// for details).
3990 pub fn clear_scopes(mut self) -> ProjectSecretAddVersionCall<'a, C> {
3991 self._scopes.clear();
3992 self
3993 }
3994}
3995
3996/// Creates a new Secret containing no SecretVersions.
3997///
3998/// A builder for the *secrets.create* method supported by a *project* resource.
3999/// It is not used directly, but through a [`ProjectMethods`] instance.
4000///
4001/// # Example
4002///
4003/// Instantiate a resource method builder
4004///
4005/// ```test_harness,no_run
4006/// # extern crate hyper;
4007/// # extern crate hyper_rustls;
4008/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
4009/// use secretmanager1_beta1::api::Secret;
4010/// # async fn dox() {
4011/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4012///
4013/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4014/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4015/// # .with_native_roots()
4016/// # .unwrap()
4017/// # .https_only()
4018/// # .enable_http2()
4019/// # .build();
4020///
4021/// # let executor = hyper_util::rt::TokioExecutor::new();
4022/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4023/// # secret,
4024/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4025/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4026/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4027/// # ),
4028/// # ).build().await.unwrap();
4029///
4030/// # let client = hyper_util::client::legacy::Client::builder(
4031/// # hyper_util::rt::TokioExecutor::new()
4032/// # )
4033/// # .build(
4034/// # hyper_rustls::HttpsConnectorBuilder::new()
4035/// # .with_native_roots()
4036/// # .unwrap()
4037/// # .https_or_http()
4038/// # .enable_http2()
4039/// # .build()
4040/// # );
4041/// # let mut hub = SecretManager::new(client, auth);
4042/// // As the method needs a request, you would usually fill it with the desired information
4043/// // into the respective structure. Some of the parts shown here might not be applicable !
4044/// // Values shown here are possibly random and not representative !
4045/// let mut req = Secret::default();
4046///
4047/// // You can configure optional parameters by calling the respective setters at will, and
4048/// // execute the final call using `doit()`.
4049/// // Values shown here are possibly random and not representative !
4050/// let result = hub.projects().secrets_create(req, "parent")
4051/// .secret_id("ipsum")
4052/// .doit().await;
4053/// # }
4054/// ```
4055pub struct ProjectSecretCreateCall<'a, C>
4056where
4057 C: 'a,
4058{
4059 hub: &'a SecretManager<C>,
4060 _request: Secret,
4061 _parent: String,
4062 _secret_id: Option<String>,
4063 _delegate: Option<&'a mut dyn common::Delegate>,
4064 _additional_params: HashMap<String, String>,
4065 _scopes: BTreeSet<String>,
4066}
4067
4068impl<'a, C> common::CallBuilder for ProjectSecretCreateCall<'a, C> {}
4069
4070impl<'a, C> ProjectSecretCreateCall<'a, C>
4071where
4072 C: common::Connector,
4073{
4074 /// Perform the operation you have build so far.
4075 pub async fn doit(mut self) -> common::Result<(common::Response, Secret)> {
4076 use std::borrow::Cow;
4077 use std::io::{Read, Seek};
4078
4079 use common::{url::Params, ToParts};
4080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4081
4082 let mut dd = common::DefaultDelegate;
4083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4084 dlg.begin(common::MethodInfo {
4085 id: "secretmanager.projects.secrets.create",
4086 http_method: hyper::Method::POST,
4087 });
4088
4089 for &field in ["alt", "parent", "secretId"].iter() {
4090 if self._additional_params.contains_key(field) {
4091 dlg.finished(false);
4092 return Err(common::Error::FieldClash(field));
4093 }
4094 }
4095
4096 let mut params = Params::with_capacity(5 + self._additional_params.len());
4097 params.push("parent", self._parent);
4098 if let Some(value) = self._secret_id.as_ref() {
4099 params.push("secretId", value);
4100 }
4101
4102 params.extend(self._additional_params.iter());
4103
4104 params.push("alt", "json");
4105 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/secrets";
4106 if self._scopes.is_empty() {
4107 self._scopes
4108 .insert(Scope::CloudPlatform.as_ref().to_string());
4109 }
4110
4111 #[allow(clippy::single_element_loop)]
4112 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4113 url = params.uri_replacement(url, param_name, find_this, true);
4114 }
4115 {
4116 let to_remove = ["parent"];
4117 params.remove_params(&to_remove);
4118 }
4119
4120 let url = params.parse_with_url(&url);
4121
4122 let mut json_mime_type = mime::APPLICATION_JSON;
4123 let mut request_value_reader = {
4124 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4125 common::remove_json_null_values(&mut value);
4126 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4127 serde_json::to_writer(&mut dst, &value).unwrap();
4128 dst
4129 };
4130 let request_size = request_value_reader
4131 .seek(std::io::SeekFrom::End(0))
4132 .unwrap();
4133 request_value_reader
4134 .seek(std::io::SeekFrom::Start(0))
4135 .unwrap();
4136
4137 loop {
4138 let token = match self
4139 .hub
4140 .auth
4141 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4142 .await
4143 {
4144 Ok(token) => token,
4145 Err(e) => match dlg.token(e) {
4146 Ok(token) => token,
4147 Err(e) => {
4148 dlg.finished(false);
4149 return Err(common::Error::MissingToken(e));
4150 }
4151 },
4152 };
4153 request_value_reader
4154 .seek(std::io::SeekFrom::Start(0))
4155 .unwrap();
4156 let mut req_result = {
4157 let client = &self.hub.client;
4158 dlg.pre_request();
4159 let mut req_builder = hyper::Request::builder()
4160 .method(hyper::Method::POST)
4161 .uri(url.as_str())
4162 .header(USER_AGENT, self.hub._user_agent.clone());
4163
4164 if let Some(token) = token.as_ref() {
4165 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4166 }
4167
4168 let request = req_builder
4169 .header(CONTENT_TYPE, json_mime_type.to_string())
4170 .header(CONTENT_LENGTH, request_size as u64)
4171 .body(common::to_body(
4172 request_value_reader.get_ref().clone().into(),
4173 ));
4174
4175 client.request(request.unwrap()).await
4176 };
4177
4178 match req_result {
4179 Err(err) => {
4180 if let common::Retry::After(d) = dlg.http_error(&err) {
4181 sleep(d).await;
4182 continue;
4183 }
4184 dlg.finished(false);
4185 return Err(common::Error::HttpError(err));
4186 }
4187 Ok(res) => {
4188 let (mut parts, body) = res.into_parts();
4189 let mut body = common::Body::new(body);
4190 if !parts.status.is_success() {
4191 let bytes = common::to_bytes(body).await.unwrap_or_default();
4192 let error = serde_json::from_str(&common::to_string(&bytes));
4193 let response = common::to_response(parts, bytes.into());
4194
4195 if let common::Retry::After(d) =
4196 dlg.http_failure(&response, error.as_ref().ok())
4197 {
4198 sleep(d).await;
4199 continue;
4200 }
4201
4202 dlg.finished(false);
4203
4204 return Err(match error {
4205 Ok(value) => common::Error::BadRequest(value),
4206 _ => common::Error::Failure(response),
4207 });
4208 }
4209 let response = {
4210 let bytes = common::to_bytes(body).await.unwrap_or_default();
4211 let encoded = common::to_string(&bytes);
4212 match serde_json::from_str(&encoded) {
4213 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4214 Err(error) => {
4215 dlg.response_json_decode_error(&encoded, &error);
4216 return Err(common::Error::JsonDecodeError(
4217 encoded.to_string(),
4218 error,
4219 ));
4220 }
4221 }
4222 };
4223
4224 dlg.finished(true);
4225 return Ok(response);
4226 }
4227 }
4228 }
4229 }
4230
4231 ///
4232 /// Sets the *request* property to the given value.
4233 ///
4234 /// Even though the property as already been set when instantiating this call,
4235 /// we provide this method for API completeness.
4236 pub fn request(mut self, new_value: Secret) -> ProjectSecretCreateCall<'a, C> {
4237 self._request = new_value;
4238 self
4239 }
4240 /// Required. The resource name of the project to associate with the Secret, in the format `projects/*`.
4241 ///
4242 /// Sets the *parent* path property to the given value.
4243 ///
4244 /// Even though the property as already been set when instantiating this call,
4245 /// we provide this method for API completeness.
4246 pub fn parent(mut self, new_value: &str) -> ProjectSecretCreateCall<'a, C> {
4247 self._parent = new_value.to_string();
4248 self
4249 }
4250 /// Required. This must be unique within the project. A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and underscore (`_`) characters.
4251 ///
4252 /// Sets the *secret id* query property to the given value.
4253 pub fn secret_id(mut self, new_value: &str) -> ProjectSecretCreateCall<'a, C> {
4254 self._secret_id = Some(new_value.to_string());
4255 self
4256 }
4257 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4258 /// while executing the actual API request.
4259 ///
4260 /// ````text
4261 /// It should be used to handle progress information, and to implement a certain level of resilience.
4262 /// ````
4263 ///
4264 /// Sets the *delegate* property to the given value.
4265 pub fn delegate(
4266 mut self,
4267 new_value: &'a mut dyn common::Delegate,
4268 ) -> ProjectSecretCreateCall<'a, C> {
4269 self._delegate = Some(new_value);
4270 self
4271 }
4272
4273 /// Set any additional parameter of the query string used in the request.
4274 /// It should be used to set parameters which are not yet available through their own
4275 /// setters.
4276 ///
4277 /// Please note that this method must not be used to set any of the known parameters
4278 /// which have their own setter method. If done anyway, the request will fail.
4279 ///
4280 /// # Additional Parameters
4281 ///
4282 /// * *$.xgafv* (query-string) - V1 error format.
4283 /// * *access_token* (query-string) - OAuth access token.
4284 /// * *alt* (query-string) - Data format for response.
4285 /// * *callback* (query-string) - JSONP
4286 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4287 /// * *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.
4288 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4289 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4290 /// * *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.
4291 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4292 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4293 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretCreateCall<'a, C>
4294 where
4295 T: AsRef<str>,
4296 {
4297 self._additional_params
4298 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4299 self
4300 }
4301
4302 /// Identifies the authorization scope for the method you are building.
4303 ///
4304 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4305 /// [`Scope::CloudPlatform`].
4306 ///
4307 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4308 /// tokens for more than one scope.
4309 ///
4310 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4311 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4312 /// sufficient, a read-write scope will do as well.
4313 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretCreateCall<'a, C>
4314 where
4315 St: AsRef<str>,
4316 {
4317 self._scopes.insert(String::from(scope.as_ref()));
4318 self
4319 }
4320 /// Identifies the authorization scope(s) for the method you are building.
4321 ///
4322 /// See [`Self::add_scope()`] for details.
4323 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretCreateCall<'a, C>
4324 where
4325 I: IntoIterator<Item = St>,
4326 St: AsRef<str>,
4327 {
4328 self._scopes
4329 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4330 self
4331 }
4332
4333 /// Removes all scopes, and no default scope will be used either.
4334 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4335 /// for details).
4336 pub fn clear_scopes(mut self) -> ProjectSecretCreateCall<'a, C> {
4337 self._scopes.clear();
4338 self
4339 }
4340}
4341
4342/// Deletes a Secret.
4343///
4344/// A builder for the *secrets.delete* method supported by a *project* resource.
4345/// It is not used directly, but through a [`ProjectMethods`] instance.
4346///
4347/// # Example
4348///
4349/// Instantiate a resource method builder
4350///
4351/// ```test_harness,no_run
4352/// # extern crate hyper;
4353/// # extern crate hyper_rustls;
4354/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
4355/// # async fn dox() {
4356/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4357///
4358/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4359/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4360/// # .with_native_roots()
4361/// # .unwrap()
4362/// # .https_only()
4363/// # .enable_http2()
4364/// # .build();
4365///
4366/// # let executor = hyper_util::rt::TokioExecutor::new();
4367/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4368/// # secret,
4369/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4370/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4371/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4372/// # ),
4373/// # ).build().await.unwrap();
4374///
4375/// # let client = hyper_util::client::legacy::Client::builder(
4376/// # hyper_util::rt::TokioExecutor::new()
4377/// # )
4378/// # .build(
4379/// # hyper_rustls::HttpsConnectorBuilder::new()
4380/// # .with_native_roots()
4381/// # .unwrap()
4382/// # .https_or_http()
4383/// # .enable_http2()
4384/// # .build()
4385/// # );
4386/// # let mut hub = SecretManager::new(client, auth);
4387/// // You can configure optional parameters by calling the respective setters at will, and
4388/// // execute the final call using `doit()`.
4389/// // Values shown here are possibly random and not representative !
4390/// let result = hub.projects().secrets_delete("name")
4391/// .doit().await;
4392/// # }
4393/// ```
4394pub struct ProjectSecretDeleteCall<'a, C>
4395where
4396 C: 'a,
4397{
4398 hub: &'a SecretManager<C>,
4399 _name: String,
4400 _delegate: Option<&'a mut dyn common::Delegate>,
4401 _additional_params: HashMap<String, String>,
4402 _scopes: BTreeSet<String>,
4403}
4404
4405impl<'a, C> common::CallBuilder for ProjectSecretDeleteCall<'a, C> {}
4406
4407impl<'a, C> ProjectSecretDeleteCall<'a, C>
4408where
4409 C: common::Connector,
4410{
4411 /// Perform the operation you have build so far.
4412 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4413 use std::borrow::Cow;
4414 use std::io::{Read, Seek};
4415
4416 use common::{url::Params, ToParts};
4417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4418
4419 let mut dd = common::DefaultDelegate;
4420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4421 dlg.begin(common::MethodInfo {
4422 id: "secretmanager.projects.secrets.delete",
4423 http_method: hyper::Method::DELETE,
4424 });
4425
4426 for &field in ["alt", "name"].iter() {
4427 if self._additional_params.contains_key(field) {
4428 dlg.finished(false);
4429 return Err(common::Error::FieldClash(field));
4430 }
4431 }
4432
4433 let mut params = Params::with_capacity(3 + self._additional_params.len());
4434 params.push("name", self._name);
4435
4436 params.extend(self._additional_params.iter());
4437
4438 params.push("alt", "json");
4439 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4440 if self._scopes.is_empty() {
4441 self._scopes
4442 .insert(Scope::CloudPlatform.as_ref().to_string());
4443 }
4444
4445 #[allow(clippy::single_element_loop)]
4446 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4447 url = params.uri_replacement(url, param_name, find_this, true);
4448 }
4449 {
4450 let to_remove = ["name"];
4451 params.remove_params(&to_remove);
4452 }
4453
4454 let url = params.parse_with_url(&url);
4455
4456 loop {
4457 let token = match self
4458 .hub
4459 .auth
4460 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4461 .await
4462 {
4463 Ok(token) => token,
4464 Err(e) => match dlg.token(e) {
4465 Ok(token) => token,
4466 Err(e) => {
4467 dlg.finished(false);
4468 return Err(common::Error::MissingToken(e));
4469 }
4470 },
4471 };
4472 let mut req_result = {
4473 let client = &self.hub.client;
4474 dlg.pre_request();
4475 let mut req_builder = hyper::Request::builder()
4476 .method(hyper::Method::DELETE)
4477 .uri(url.as_str())
4478 .header(USER_AGENT, self.hub._user_agent.clone());
4479
4480 if let Some(token) = token.as_ref() {
4481 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4482 }
4483
4484 let request = req_builder
4485 .header(CONTENT_LENGTH, 0_u64)
4486 .body(common::to_body::<String>(None));
4487
4488 client.request(request.unwrap()).await
4489 };
4490
4491 match req_result {
4492 Err(err) => {
4493 if let common::Retry::After(d) = dlg.http_error(&err) {
4494 sleep(d).await;
4495 continue;
4496 }
4497 dlg.finished(false);
4498 return Err(common::Error::HttpError(err));
4499 }
4500 Ok(res) => {
4501 let (mut parts, body) = res.into_parts();
4502 let mut body = common::Body::new(body);
4503 if !parts.status.is_success() {
4504 let bytes = common::to_bytes(body).await.unwrap_or_default();
4505 let error = serde_json::from_str(&common::to_string(&bytes));
4506 let response = common::to_response(parts, bytes.into());
4507
4508 if let common::Retry::After(d) =
4509 dlg.http_failure(&response, error.as_ref().ok())
4510 {
4511 sleep(d).await;
4512 continue;
4513 }
4514
4515 dlg.finished(false);
4516
4517 return Err(match error {
4518 Ok(value) => common::Error::BadRequest(value),
4519 _ => common::Error::Failure(response),
4520 });
4521 }
4522 let response = {
4523 let bytes = common::to_bytes(body).await.unwrap_or_default();
4524 let encoded = common::to_string(&bytes);
4525 match serde_json::from_str(&encoded) {
4526 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4527 Err(error) => {
4528 dlg.response_json_decode_error(&encoded, &error);
4529 return Err(common::Error::JsonDecodeError(
4530 encoded.to_string(),
4531 error,
4532 ));
4533 }
4534 }
4535 };
4536
4537 dlg.finished(true);
4538 return Ok(response);
4539 }
4540 }
4541 }
4542 }
4543
4544 /// Required. The resource name of the Secret to delete in the format `projects/*/secrets/*`.
4545 ///
4546 /// Sets the *name* path property to the given value.
4547 ///
4548 /// Even though the property as already been set when instantiating this call,
4549 /// we provide this method for API completeness.
4550 pub fn name(mut self, new_value: &str) -> ProjectSecretDeleteCall<'a, C> {
4551 self._name = new_value.to_string();
4552 self
4553 }
4554 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4555 /// while executing the actual API request.
4556 ///
4557 /// ````text
4558 /// It should be used to handle progress information, and to implement a certain level of resilience.
4559 /// ````
4560 ///
4561 /// Sets the *delegate* property to the given value.
4562 pub fn delegate(
4563 mut self,
4564 new_value: &'a mut dyn common::Delegate,
4565 ) -> ProjectSecretDeleteCall<'a, C> {
4566 self._delegate = Some(new_value);
4567 self
4568 }
4569
4570 /// Set any additional parameter of the query string used in the request.
4571 /// It should be used to set parameters which are not yet available through their own
4572 /// setters.
4573 ///
4574 /// Please note that this method must not be used to set any of the known parameters
4575 /// which have their own setter method. If done anyway, the request will fail.
4576 ///
4577 /// # Additional Parameters
4578 ///
4579 /// * *$.xgafv* (query-string) - V1 error format.
4580 /// * *access_token* (query-string) - OAuth access token.
4581 /// * *alt* (query-string) - Data format for response.
4582 /// * *callback* (query-string) - JSONP
4583 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4584 /// * *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.
4585 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4586 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4587 /// * *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.
4588 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4589 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4590 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretDeleteCall<'a, C>
4591 where
4592 T: AsRef<str>,
4593 {
4594 self._additional_params
4595 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4596 self
4597 }
4598
4599 /// Identifies the authorization scope for the method you are building.
4600 ///
4601 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4602 /// [`Scope::CloudPlatform`].
4603 ///
4604 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4605 /// tokens for more than one scope.
4606 ///
4607 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4608 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4609 /// sufficient, a read-write scope will do as well.
4610 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretDeleteCall<'a, C>
4611 where
4612 St: AsRef<str>,
4613 {
4614 self._scopes.insert(String::from(scope.as_ref()));
4615 self
4616 }
4617 /// Identifies the authorization scope(s) for the method you are building.
4618 ///
4619 /// See [`Self::add_scope()`] for details.
4620 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretDeleteCall<'a, C>
4621 where
4622 I: IntoIterator<Item = St>,
4623 St: AsRef<str>,
4624 {
4625 self._scopes
4626 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4627 self
4628 }
4629
4630 /// Removes all scopes, and no default scope will be used either.
4631 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4632 /// for details).
4633 pub fn clear_scopes(mut self) -> ProjectSecretDeleteCall<'a, C> {
4634 self._scopes.clear();
4635 self
4636 }
4637}
4638
4639/// Gets metadata for a given Secret.
4640///
4641/// A builder for the *secrets.get* method supported by a *project* resource.
4642/// It is not used directly, but through a [`ProjectMethods`] instance.
4643///
4644/// # Example
4645///
4646/// Instantiate a resource method builder
4647///
4648/// ```test_harness,no_run
4649/// # extern crate hyper;
4650/// # extern crate hyper_rustls;
4651/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
4652/// # async fn dox() {
4653/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4654///
4655/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4656/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4657/// # .with_native_roots()
4658/// # .unwrap()
4659/// # .https_only()
4660/// # .enable_http2()
4661/// # .build();
4662///
4663/// # let executor = hyper_util::rt::TokioExecutor::new();
4664/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4665/// # secret,
4666/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4667/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4668/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4669/// # ),
4670/// # ).build().await.unwrap();
4671///
4672/// # let client = hyper_util::client::legacy::Client::builder(
4673/// # hyper_util::rt::TokioExecutor::new()
4674/// # )
4675/// # .build(
4676/// # hyper_rustls::HttpsConnectorBuilder::new()
4677/// # .with_native_roots()
4678/// # .unwrap()
4679/// # .https_or_http()
4680/// # .enable_http2()
4681/// # .build()
4682/// # );
4683/// # let mut hub = SecretManager::new(client, auth);
4684/// // You can configure optional parameters by calling the respective setters at will, and
4685/// // execute the final call using `doit()`.
4686/// // Values shown here are possibly random and not representative !
4687/// let result = hub.projects().secrets_get("name")
4688/// .doit().await;
4689/// # }
4690/// ```
4691pub struct ProjectSecretGetCall<'a, C>
4692where
4693 C: 'a,
4694{
4695 hub: &'a SecretManager<C>,
4696 _name: String,
4697 _delegate: Option<&'a mut dyn common::Delegate>,
4698 _additional_params: HashMap<String, String>,
4699 _scopes: BTreeSet<String>,
4700}
4701
4702impl<'a, C> common::CallBuilder for ProjectSecretGetCall<'a, C> {}
4703
4704impl<'a, C> ProjectSecretGetCall<'a, C>
4705where
4706 C: common::Connector,
4707{
4708 /// Perform the operation you have build so far.
4709 pub async fn doit(mut self) -> common::Result<(common::Response, Secret)> {
4710 use std::borrow::Cow;
4711 use std::io::{Read, Seek};
4712
4713 use common::{url::Params, ToParts};
4714 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4715
4716 let mut dd = common::DefaultDelegate;
4717 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4718 dlg.begin(common::MethodInfo {
4719 id: "secretmanager.projects.secrets.get",
4720 http_method: hyper::Method::GET,
4721 });
4722
4723 for &field in ["alt", "name"].iter() {
4724 if self._additional_params.contains_key(field) {
4725 dlg.finished(false);
4726 return Err(common::Error::FieldClash(field));
4727 }
4728 }
4729
4730 let mut params = Params::with_capacity(3 + self._additional_params.len());
4731 params.push("name", self._name);
4732
4733 params.extend(self._additional_params.iter());
4734
4735 params.push("alt", "json");
4736 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4737 if self._scopes.is_empty() {
4738 self._scopes
4739 .insert(Scope::CloudPlatform.as_ref().to_string());
4740 }
4741
4742 #[allow(clippy::single_element_loop)]
4743 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4744 url = params.uri_replacement(url, param_name, find_this, true);
4745 }
4746 {
4747 let to_remove = ["name"];
4748 params.remove_params(&to_remove);
4749 }
4750
4751 let url = params.parse_with_url(&url);
4752
4753 loop {
4754 let token = match self
4755 .hub
4756 .auth
4757 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4758 .await
4759 {
4760 Ok(token) => token,
4761 Err(e) => match dlg.token(e) {
4762 Ok(token) => token,
4763 Err(e) => {
4764 dlg.finished(false);
4765 return Err(common::Error::MissingToken(e));
4766 }
4767 },
4768 };
4769 let mut req_result = {
4770 let client = &self.hub.client;
4771 dlg.pre_request();
4772 let mut req_builder = hyper::Request::builder()
4773 .method(hyper::Method::GET)
4774 .uri(url.as_str())
4775 .header(USER_AGENT, self.hub._user_agent.clone());
4776
4777 if let Some(token) = token.as_ref() {
4778 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4779 }
4780
4781 let request = req_builder
4782 .header(CONTENT_LENGTH, 0_u64)
4783 .body(common::to_body::<String>(None));
4784
4785 client.request(request.unwrap()).await
4786 };
4787
4788 match req_result {
4789 Err(err) => {
4790 if let common::Retry::After(d) = dlg.http_error(&err) {
4791 sleep(d).await;
4792 continue;
4793 }
4794 dlg.finished(false);
4795 return Err(common::Error::HttpError(err));
4796 }
4797 Ok(res) => {
4798 let (mut parts, body) = res.into_parts();
4799 let mut body = common::Body::new(body);
4800 if !parts.status.is_success() {
4801 let bytes = common::to_bytes(body).await.unwrap_or_default();
4802 let error = serde_json::from_str(&common::to_string(&bytes));
4803 let response = common::to_response(parts, bytes.into());
4804
4805 if let common::Retry::After(d) =
4806 dlg.http_failure(&response, error.as_ref().ok())
4807 {
4808 sleep(d).await;
4809 continue;
4810 }
4811
4812 dlg.finished(false);
4813
4814 return Err(match error {
4815 Ok(value) => common::Error::BadRequest(value),
4816 _ => common::Error::Failure(response),
4817 });
4818 }
4819 let response = {
4820 let bytes = common::to_bytes(body).await.unwrap_or_default();
4821 let encoded = common::to_string(&bytes);
4822 match serde_json::from_str(&encoded) {
4823 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4824 Err(error) => {
4825 dlg.response_json_decode_error(&encoded, &error);
4826 return Err(common::Error::JsonDecodeError(
4827 encoded.to_string(),
4828 error,
4829 ));
4830 }
4831 }
4832 };
4833
4834 dlg.finished(true);
4835 return Ok(response);
4836 }
4837 }
4838 }
4839 }
4840
4841 /// Required. The resource name of the Secret, in the format `projects/*/secrets/*`.
4842 ///
4843 /// Sets the *name* path property to the given value.
4844 ///
4845 /// Even though the property as already been set when instantiating this call,
4846 /// we provide this method for API completeness.
4847 pub fn name(mut self, new_value: &str) -> ProjectSecretGetCall<'a, C> {
4848 self._name = new_value.to_string();
4849 self
4850 }
4851 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4852 /// while executing the actual API request.
4853 ///
4854 /// ````text
4855 /// It should be used to handle progress information, and to implement a certain level of resilience.
4856 /// ````
4857 ///
4858 /// Sets the *delegate* property to the given value.
4859 pub fn delegate(
4860 mut self,
4861 new_value: &'a mut dyn common::Delegate,
4862 ) -> ProjectSecretGetCall<'a, C> {
4863 self._delegate = Some(new_value);
4864 self
4865 }
4866
4867 /// Set any additional parameter of the query string used in the request.
4868 /// It should be used to set parameters which are not yet available through their own
4869 /// setters.
4870 ///
4871 /// Please note that this method must not be used to set any of the known parameters
4872 /// which have their own setter method. If done anyway, the request will fail.
4873 ///
4874 /// # Additional Parameters
4875 ///
4876 /// * *$.xgafv* (query-string) - V1 error format.
4877 /// * *access_token* (query-string) - OAuth access token.
4878 /// * *alt* (query-string) - Data format for response.
4879 /// * *callback* (query-string) - JSONP
4880 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4881 /// * *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.
4882 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4883 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4884 /// * *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.
4885 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4886 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4887 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretGetCall<'a, C>
4888 where
4889 T: AsRef<str>,
4890 {
4891 self._additional_params
4892 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4893 self
4894 }
4895
4896 /// Identifies the authorization scope for the method you are building.
4897 ///
4898 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4899 /// [`Scope::CloudPlatform`].
4900 ///
4901 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4902 /// tokens for more than one scope.
4903 ///
4904 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4905 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4906 /// sufficient, a read-write scope will do as well.
4907 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretGetCall<'a, C>
4908 where
4909 St: AsRef<str>,
4910 {
4911 self._scopes.insert(String::from(scope.as_ref()));
4912 self
4913 }
4914 /// Identifies the authorization scope(s) for the method you are building.
4915 ///
4916 /// See [`Self::add_scope()`] for details.
4917 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretGetCall<'a, C>
4918 where
4919 I: IntoIterator<Item = St>,
4920 St: AsRef<str>,
4921 {
4922 self._scopes
4923 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4924 self
4925 }
4926
4927 /// Removes all scopes, and no default scope will be used either.
4928 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4929 /// for details).
4930 pub fn clear_scopes(mut self) -> ProjectSecretGetCall<'a, C> {
4931 self._scopes.clear();
4932 self
4933 }
4934}
4935
4936/// Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.
4937///
4938/// A builder for the *secrets.getIamPolicy* method supported by a *project* resource.
4939/// It is not used directly, but through a [`ProjectMethods`] instance.
4940///
4941/// # Example
4942///
4943/// Instantiate a resource method builder
4944///
4945/// ```test_harness,no_run
4946/// # extern crate hyper;
4947/// # extern crate hyper_rustls;
4948/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
4949/// # async fn dox() {
4950/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4951///
4952/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4953/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4954/// # .with_native_roots()
4955/// # .unwrap()
4956/// # .https_only()
4957/// # .enable_http2()
4958/// # .build();
4959///
4960/// # let executor = hyper_util::rt::TokioExecutor::new();
4961/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4962/// # secret,
4963/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4964/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4965/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4966/// # ),
4967/// # ).build().await.unwrap();
4968///
4969/// # let client = hyper_util::client::legacy::Client::builder(
4970/// # hyper_util::rt::TokioExecutor::new()
4971/// # )
4972/// # .build(
4973/// # hyper_rustls::HttpsConnectorBuilder::new()
4974/// # .with_native_roots()
4975/// # .unwrap()
4976/// # .https_or_http()
4977/// # .enable_http2()
4978/// # .build()
4979/// # );
4980/// # let mut hub = SecretManager::new(client, auth);
4981/// // You can configure optional parameters by calling the respective setters at will, and
4982/// // execute the final call using `doit()`.
4983/// // Values shown here are possibly random and not representative !
4984/// let result = hub.projects().secrets_get_iam_policy("resource")
4985/// .options_requested_policy_version(-50)
4986/// .doit().await;
4987/// # }
4988/// ```
4989pub struct ProjectSecretGetIamPolicyCall<'a, C>
4990where
4991 C: 'a,
4992{
4993 hub: &'a SecretManager<C>,
4994 _resource: String,
4995 _options_requested_policy_version: Option<i32>,
4996 _delegate: Option<&'a mut dyn common::Delegate>,
4997 _additional_params: HashMap<String, String>,
4998 _scopes: BTreeSet<String>,
4999}
5000
5001impl<'a, C> common::CallBuilder for ProjectSecretGetIamPolicyCall<'a, C> {}
5002
5003impl<'a, C> ProjectSecretGetIamPolicyCall<'a, C>
5004where
5005 C: common::Connector,
5006{
5007 /// Perform the operation you have build so far.
5008 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5009 use std::borrow::Cow;
5010 use std::io::{Read, Seek};
5011
5012 use common::{url::Params, ToParts};
5013 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5014
5015 let mut dd = common::DefaultDelegate;
5016 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5017 dlg.begin(common::MethodInfo {
5018 id: "secretmanager.projects.secrets.getIamPolicy",
5019 http_method: hyper::Method::GET,
5020 });
5021
5022 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
5023 if self._additional_params.contains_key(field) {
5024 dlg.finished(false);
5025 return Err(common::Error::FieldClash(field));
5026 }
5027 }
5028
5029 let mut params = Params::with_capacity(4 + self._additional_params.len());
5030 params.push("resource", self._resource);
5031 if let Some(value) = self._options_requested_policy_version.as_ref() {
5032 params.push("options.requestedPolicyVersion", value.to_string());
5033 }
5034
5035 params.extend(self._additional_params.iter());
5036
5037 params.push("alt", "json");
5038 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
5039 if self._scopes.is_empty() {
5040 self._scopes
5041 .insert(Scope::CloudPlatform.as_ref().to_string());
5042 }
5043
5044 #[allow(clippy::single_element_loop)]
5045 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5046 url = params.uri_replacement(url, param_name, find_this, true);
5047 }
5048 {
5049 let to_remove = ["resource"];
5050 params.remove_params(&to_remove);
5051 }
5052
5053 let url = params.parse_with_url(&url);
5054
5055 loop {
5056 let token = match self
5057 .hub
5058 .auth
5059 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5060 .await
5061 {
5062 Ok(token) => token,
5063 Err(e) => match dlg.token(e) {
5064 Ok(token) => token,
5065 Err(e) => {
5066 dlg.finished(false);
5067 return Err(common::Error::MissingToken(e));
5068 }
5069 },
5070 };
5071 let mut req_result = {
5072 let client = &self.hub.client;
5073 dlg.pre_request();
5074 let mut req_builder = hyper::Request::builder()
5075 .method(hyper::Method::GET)
5076 .uri(url.as_str())
5077 .header(USER_AGENT, self.hub._user_agent.clone());
5078
5079 if let Some(token) = token.as_ref() {
5080 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5081 }
5082
5083 let request = req_builder
5084 .header(CONTENT_LENGTH, 0_u64)
5085 .body(common::to_body::<String>(None));
5086
5087 client.request(request.unwrap()).await
5088 };
5089
5090 match req_result {
5091 Err(err) => {
5092 if let common::Retry::After(d) = dlg.http_error(&err) {
5093 sleep(d).await;
5094 continue;
5095 }
5096 dlg.finished(false);
5097 return Err(common::Error::HttpError(err));
5098 }
5099 Ok(res) => {
5100 let (mut parts, body) = res.into_parts();
5101 let mut body = common::Body::new(body);
5102 if !parts.status.is_success() {
5103 let bytes = common::to_bytes(body).await.unwrap_or_default();
5104 let error = serde_json::from_str(&common::to_string(&bytes));
5105 let response = common::to_response(parts, bytes.into());
5106
5107 if let common::Retry::After(d) =
5108 dlg.http_failure(&response, error.as_ref().ok())
5109 {
5110 sleep(d).await;
5111 continue;
5112 }
5113
5114 dlg.finished(false);
5115
5116 return Err(match error {
5117 Ok(value) => common::Error::BadRequest(value),
5118 _ => common::Error::Failure(response),
5119 });
5120 }
5121 let response = {
5122 let bytes = common::to_bytes(body).await.unwrap_or_default();
5123 let encoded = common::to_string(&bytes);
5124 match serde_json::from_str(&encoded) {
5125 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5126 Err(error) => {
5127 dlg.response_json_decode_error(&encoded, &error);
5128 return Err(common::Error::JsonDecodeError(
5129 encoded.to_string(),
5130 error,
5131 ));
5132 }
5133 }
5134 };
5135
5136 dlg.finished(true);
5137 return Ok(response);
5138 }
5139 }
5140 }
5141 }
5142
5143 /// 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.
5144 ///
5145 /// Sets the *resource* path property to the given value.
5146 ///
5147 /// Even though the property as already been set when instantiating this call,
5148 /// we provide this method for API completeness.
5149 pub fn resource(mut self, new_value: &str) -> ProjectSecretGetIamPolicyCall<'a, C> {
5150 self._resource = new_value.to_string();
5151 self
5152 }
5153 /// 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).
5154 ///
5155 /// Sets the *options.requested policy version* query property to the given value.
5156 pub fn options_requested_policy_version(
5157 mut self,
5158 new_value: i32,
5159 ) -> ProjectSecretGetIamPolicyCall<'a, C> {
5160 self._options_requested_policy_version = Some(new_value);
5161 self
5162 }
5163 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5164 /// while executing the actual API request.
5165 ///
5166 /// ````text
5167 /// It should be used to handle progress information, and to implement a certain level of resilience.
5168 /// ````
5169 ///
5170 /// Sets the *delegate* property to the given value.
5171 pub fn delegate(
5172 mut self,
5173 new_value: &'a mut dyn common::Delegate,
5174 ) -> ProjectSecretGetIamPolicyCall<'a, C> {
5175 self._delegate = Some(new_value);
5176 self
5177 }
5178
5179 /// Set any additional parameter of the query string used in the request.
5180 /// It should be used to set parameters which are not yet available through their own
5181 /// setters.
5182 ///
5183 /// Please note that this method must not be used to set any of the known parameters
5184 /// which have their own setter method. If done anyway, the request will fail.
5185 ///
5186 /// # Additional Parameters
5187 ///
5188 /// * *$.xgafv* (query-string) - V1 error format.
5189 /// * *access_token* (query-string) - OAuth access token.
5190 /// * *alt* (query-string) - Data format for response.
5191 /// * *callback* (query-string) - JSONP
5192 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5193 /// * *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.
5194 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5195 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5196 /// * *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.
5197 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5198 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5199 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretGetIamPolicyCall<'a, C>
5200 where
5201 T: AsRef<str>,
5202 {
5203 self._additional_params
5204 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5205 self
5206 }
5207
5208 /// Identifies the authorization scope for the method you are building.
5209 ///
5210 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5211 /// [`Scope::CloudPlatform`].
5212 ///
5213 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5214 /// tokens for more than one scope.
5215 ///
5216 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5217 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5218 /// sufficient, a read-write scope will do as well.
5219 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretGetIamPolicyCall<'a, C>
5220 where
5221 St: AsRef<str>,
5222 {
5223 self._scopes.insert(String::from(scope.as_ref()));
5224 self
5225 }
5226 /// Identifies the authorization scope(s) for the method you are building.
5227 ///
5228 /// See [`Self::add_scope()`] for details.
5229 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretGetIamPolicyCall<'a, C>
5230 where
5231 I: IntoIterator<Item = St>,
5232 St: AsRef<str>,
5233 {
5234 self._scopes
5235 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5236 self
5237 }
5238
5239 /// Removes all scopes, and no default scope will be used either.
5240 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5241 /// for details).
5242 pub fn clear_scopes(mut self) -> ProjectSecretGetIamPolicyCall<'a, C> {
5243 self._scopes.clear();
5244 self
5245 }
5246}
5247
5248/// Lists Secrets.
5249///
5250/// A builder for the *secrets.list* method supported by a *project* resource.
5251/// It is not used directly, but through a [`ProjectMethods`] instance.
5252///
5253/// # Example
5254///
5255/// Instantiate a resource method builder
5256///
5257/// ```test_harness,no_run
5258/// # extern crate hyper;
5259/// # extern crate hyper_rustls;
5260/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
5261/// # async fn dox() {
5262/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5263///
5264/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5265/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5266/// # .with_native_roots()
5267/// # .unwrap()
5268/// # .https_only()
5269/// # .enable_http2()
5270/// # .build();
5271///
5272/// # let executor = hyper_util::rt::TokioExecutor::new();
5273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5274/// # secret,
5275/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5276/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5277/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5278/// # ),
5279/// # ).build().await.unwrap();
5280///
5281/// # let client = hyper_util::client::legacy::Client::builder(
5282/// # hyper_util::rt::TokioExecutor::new()
5283/// # )
5284/// # .build(
5285/// # hyper_rustls::HttpsConnectorBuilder::new()
5286/// # .with_native_roots()
5287/// # .unwrap()
5288/// # .https_or_http()
5289/// # .enable_http2()
5290/// # .build()
5291/// # );
5292/// # let mut hub = SecretManager::new(client, auth);
5293/// // You can configure optional parameters by calling the respective setters at will, and
5294/// // execute the final call using `doit()`.
5295/// // Values shown here are possibly random and not representative !
5296/// let result = hub.projects().secrets_list("parent")
5297/// .page_token("ut")
5298/// .page_size(-12)
5299/// .doit().await;
5300/// # }
5301/// ```
5302pub struct ProjectSecretListCall<'a, C>
5303where
5304 C: 'a,
5305{
5306 hub: &'a SecretManager<C>,
5307 _parent: String,
5308 _page_token: Option<String>,
5309 _page_size: Option<i32>,
5310 _delegate: Option<&'a mut dyn common::Delegate>,
5311 _additional_params: HashMap<String, String>,
5312 _scopes: BTreeSet<String>,
5313}
5314
5315impl<'a, C> common::CallBuilder for ProjectSecretListCall<'a, C> {}
5316
5317impl<'a, C> ProjectSecretListCall<'a, C>
5318where
5319 C: common::Connector,
5320{
5321 /// Perform the operation you have build so far.
5322 pub async fn doit(mut self) -> common::Result<(common::Response, ListSecretsResponse)> {
5323 use std::borrow::Cow;
5324 use std::io::{Read, Seek};
5325
5326 use common::{url::Params, ToParts};
5327 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5328
5329 let mut dd = common::DefaultDelegate;
5330 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5331 dlg.begin(common::MethodInfo {
5332 id: "secretmanager.projects.secrets.list",
5333 http_method: hyper::Method::GET,
5334 });
5335
5336 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
5337 if self._additional_params.contains_key(field) {
5338 dlg.finished(false);
5339 return Err(common::Error::FieldClash(field));
5340 }
5341 }
5342
5343 let mut params = Params::with_capacity(5 + self._additional_params.len());
5344 params.push("parent", self._parent);
5345 if let Some(value) = self._page_token.as_ref() {
5346 params.push("pageToken", value);
5347 }
5348 if let Some(value) = self._page_size.as_ref() {
5349 params.push("pageSize", value.to_string());
5350 }
5351
5352 params.extend(self._additional_params.iter());
5353
5354 params.push("alt", "json");
5355 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/secrets";
5356 if self._scopes.is_empty() {
5357 self._scopes
5358 .insert(Scope::CloudPlatform.as_ref().to_string());
5359 }
5360
5361 #[allow(clippy::single_element_loop)]
5362 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5363 url = params.uri_replacement(url, param_name, find_this, true);
5364 }
5365 {
5366 let to_remove = ["parent"];
5367 params.remove_params(&to_remove);
5368 }
5369
5370 let url = params.parse_with_url(&url);
5371
5372 loop {
5373 let token = match self
5374 .hub
5375 .auth
5376 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5377 .await
5378 {
5379 Ok(token) => token,
5380 Err(e) => match dlg.token(e) {
5381 Ok(token) => token,
5382 Err(e) => {
5383 dlg.finished(false);
5384 return Err(common::Error::MissingToken(e));
5385 }
5386 },
5387 };
5388 let mut req_result = {
5389 let client = &self.hub.client;
5390 dlg.pre_request();
5391 let mut req_builder = hyper::Request::builder()
5392 .method(hyper::Method::GET)
5393 .uri(url.as_str())
5394 .header(USER_AGENT, self.hub._user_agent.clone());
5395
5396 if let Some(token) = token.as_ref() {
5397 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5398 }
5399
5400 let request = req_builder
5401 .header(CONTENT_LENGTH, 0_u64)
5402 .body(common::to_body::<String>(None));
5403
5404 client.request(request.unwrap()).await
5405 };
5406
5407 match req_result {
5408 Err(err) => {
5409 if let common::Retry::After(d) = dlg.http_error(&err) {
5410 sleep(d).await;
5411 continue;
5412 }
5413 dlg.finished(false);
5414 return Err(common::Error::HttpError(err));
5415 }
5416 Ok(res) => {
5417 let (mut parts, body) = res.into_parts();
5418 let mut body = common::Body::new(body);
5419 if !parts.status.is_success() {
5420 let bytes = common::to_bytes(body).await.unwrap_or_default();
5421 let error = serde_json::from_str(&common::to_string(&bytes));
5422 let response = common::to_response(parts, bytes.into());
5423
5424 if let common::Retry::After(d) =
5425 dlg.http_failure(&response, error.as_ref().ok())
5426 {
5427 sleep(d).await;
5428 continue;
5429 }
5430
5431 dlg.finished(false);
5432
5433 return Err(match error {
5434 Ok(value) => common::Error::BadRequest(value),
5435 _ => common::Error::Failure(response),
5436 });
5437 }
5438 let response = {
5439 let bytes = common::to_bytes(body).await.unwrap_or_default();
5440 let encoded = common::to_string(&bytes);
5441 match serde_json::from_str(&encoded) {
5442 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5443 Err(error) => {
5444 dlg.response_json_decode_error(&encoded, &error);
5445 return Err(common::Error::JsonDecodeError(
5446 encoded.to_string(),
5447 error,
5448 ));
5449 }
5450 }
5451 };
5452
5453 dlg.finished(true);
5454 return Ok(response);
5455 }
5456 }
5457 }
5458 }
5459
5460 /// Required. The resource name of the project associated with the Secrets, in the format `projects/*`.
5461 ///
5462 /// Sets the *parent* path property to the given value.
5463 ///
5464 /// Even though the property as already been set when instantiating this call,
5465 /// we provide this method for API completeness.
5466 pub fn parent(mut self, new_value: &str) -> ProjectSecretListCall<'a, C> {
5467 self._parent = new_value.to_string();
5468 self
5469 }
5470 /// Optional. Pagination token, returned earlier via ListSecretsResponse.next_page_token.
5471 ///
5472 /// Sets the *page token* query property to the given value.
5473 pub fn page_token(mut self, new_value: &str) -> ProjectSecretListCall<'a, C> {
5474 self._page_token = Some(new_value.to_string());
5475 self
5476 }
5477 /// Optional. The maximum number of results to be returned in a single page. If set to 0, the server decides the number of results to return. If the number is greater than 25000, it is capped at 25000.
5478 ///
5479 /// Sets the *page size* query property to the given value.
5480 pub fn page_size(mut self, new_value: i32) -> ProjectSecretListCall<'a, C> {
5481 self._page_size = Some(new_value);
5482 self
5483 }
5484 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5485 /// while executing the actual API request.
5486 ///
5487 /// ````text
5488 /// It should be used to handle progress information, and to implement a certain level of resilience.
5489 /// ````
5490 ///
5491 /// Sets the *delegate* property to the given value.
5492 pub fn delegate(
5493 mut self,
5494 new_value: &'a mut dyn common::Delegate,
5495 ) -> ProjectSecretListCall<'a, C> {
5496 self._delegate = Some(new_value);
5497 self
5498 }
5499
5500 /// Set any additional parameter of the query string used in the request.
5501 /// It should be used to set parameters which are not yet available through their own
5502 /// setters.
5503 ///
5504 /// Please note that this method must not be used to set any of the known parameters
5505 /// which have their own setter method. If done anyway, the request will fail.
5506 ///
5507 /// # Additional Parameters
5508 ///
5509 /// * *$.xgafv* (query-string) - V1 error format.
5510 /// * *access_token* (query-string) - OAuth access token.
5511 /// * *alt* (query-string) - Data format for response.
5512 /// * *callback* (query-string) - JSONP
5513 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5514 /// * *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.
5515 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5516 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5517 /// * *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.
5518 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5519 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5520 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretListCall<'a, C>
5521 where
5522 T: AsRef<str>,
5523 {
5524 self._additional_params
5525 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5526 self
5527 }
5528
5529 /// Identifies the authorization scope for the method you are building.
5530 ///
5531 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5532 /// [`Scope::CloudPlatform`].
5533 ///
5534 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5535 /// tokens for more than one scope.
5536 ///
5537 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5538 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5539 /// sufficient, a read-write scope will do as well.
5540 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretListCall<'a, C>
5541 where
5542 St: AsRef<str>,
5543 {
5544 self._scopes.insert(String::from(scope.as_ref()));
5545 self
5546 }
5547 /// Identifies the authorization scope(s) for the method you are building.
5548 ///
5549 /// See [`Self::add_scope()`] for details.
5550 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretListCall<'a, C>
5551 where
5552 I: IntoIterator<Item = St>,
5553 St: AsRef<str>,
5554 {
5555 self._scopes
5556 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5557 self
5558 }
5559
5560 /// Removes all scopes, and no default scope will be used either.
5561 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5562 /// for details).
5563 pub fn clear_scopes(mut self) -> ProjectSecretListCall<'a, C> {
5564 self._scopes.clear();
5565 self
5566 }
5567}
5568
5569/// Updates metadata of an existing Secret.
5570///
5571/// A builder for the *secrets.patch* method supported by a *project* resource.
5572/// It is not used directly, but through a [`ProjectMethods`] instance.
5573///
5574/// # Example
5575///
5576/// Instantiate a resource method builder
5577///
5578/// ```test_harness,no_run
5579/// # extern crate hyper;
5580/// # extern crate hyper_rustls;
5581/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
5582/// use secretmanager1_beta1::api::Secret;
5583/// # async fn dox() {
5584/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5585///
5586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5587/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5588/// # .with_native_roots()
5589/// # .unwrap()
5590/// # .https_only()
5591/// # .enable_http2()
5592/// # .build();
5593///
5594/// # let executor = hyper_util::rt::TokioExecutor::new();
5595/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5596/// # secret,
5597/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5598/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5599/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5600/// # ),
5601/// # ).build().await.unwrap();
5602///
5603/// # let client = hyper_util::client::legacy::Client::builder(
5604/// # hyper_util::rt::TokioExecutor::new()
5605/// # )
5606/// # .build(
5607/// # hyper_rustls::HttpsConnectorBuilder::new()
5608/// # .with_native_roots()
5609/// # .unwrap()
5610/// # .https_or_http()
5611/// # .enable_http2()
5612/// # .build()
5613/// # );
5614/// # let mut hub = SecretManager::new(client, auth);
5615/// // As the method needs a request, you would usually fill it with the desired information
5616/// // into the respective structure. Some of the parts shown here might not be applicable !
5617/// // Values shown here are possibly random and not representative !
5618/// let mut req = Secret::default();
5619///
5620/// // You can configure optional parameters by calling the respective setters at will, and
5621/// // execute the final call using `doit()`.
5622/// // Values shown here are possibly random and not representative !
5623/// let result = hub.projects().secrets_patch(req, "name")
5624/// .update_mask(FieldMask::new::<&str>(&[]))
5625/// .doit().await;
5626/// # }
5627/// ```
5628pub struct ProjectSecretPatchCall<'a, C>
5629where
5630 C: 'a,
5631{
5632 hub: &'a SecretManager<C>,
5633 _request: Secret,
5634 _name: String,
5635 _update_mask: Option<common::FieldMask>,
5636 _delegate: Option<&'a mut dyn common::Delegate>,
5637 _additional_params: HashMap<String, String>,
5638 _scopes: BTreeSet<String>,
5639}
5640
5641impl<'a, C> common::CallBuilder for ProjectSecretPatchCall<'a, C> {}
5642
5643impl<'a, C> ProjectSecretPatchCall<'a, C>
5644where
5645 C: common::Connector,
5646{
5647 /// Perform the operation you have build so far.
5648 pub async fn doit(mut self) -> common::Result<(common::Response, Secret)> {
5649 use std::borrow::Cow;
5650 use std::io::{Read, Seek};
5651
5652 use common::{url::Params, ToParts};
5653 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5654
5655 let mut dd = common::DefaultDelegate;
5656 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5657 dlg.begin(common::MethodInfo {
5658 id: "secretmanager.projects.secrets.patch",
5659 http_method: hyper::Method::PATCH,
5660 });
5661
5662 for &field in ["alt", "name", "updateMask"].iter() {
5663 if self._additional_params.contains_key(field) {
5664 dlg.finished(false);
5665 return Err(common::Error::FieldClash(field));
5666 }
5667 }
5668
5669 let mut params = Params::with_capacity(5 + self._additional_params.len());
5670 params.push("name", self._name);
5671 if let Some(value) = self._update_mask.as_ref() {
5672 params.push("updateMask", value.to_string());
5673 }
5674
5675 params.extend(self._additional_params.iter());
5676
5677 params.push("alt", "json");
5678 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5679 if self._scopes.is_empty() {
5680 self._scopes
5681 .insert(Scope::CloudPlatform.as_ref().to_string());
5682 }
5683
5684 #[allow(clippy::single_element_loop)]
5685 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5686 url = params.uri_replacement(url, param_name, find_this, true);
5687 }
5688 {
5689 let to_remove = ["name"];
5690 params.remove_params(&to_remove);
5691 }
5692
5693 let url = params.parse_with_url(&url);
5694
5695 let mut json_mime_type = mime::APPLICATION_JSON;
5696 let mut request_value_reader = {
5697 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5698 common::remove_json_null_values(&mut value);
5699 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5700 serde_json::to_writer(&mut dst, &value).unwrap();
5701 dst
5702 };
5703 let request_size = request_value_reader
5704 .seek(std::io::SeekFrom::End(0))
5705 .unwrap();
5706 request_value_reader
5707 .seek(std::io::SeekFrom::Start(0))
5708 .unwrap();
5709
5710 loop {
5711 let token = match self
5712 .hub
5713 .auth
5714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5715 .await
5716 {
5717 Ok(token) => token,
5718 Err(e) => match dlg.token(e) {
5719 Ok(token) => token,
5720 Err(e) => {
5721 dlg.finished(false);
5722 return Err(common::Error::MissingToken(e));
5723 }
5724 },
5725 };
5726 request_value_reader
5727 .seek(std::io::SeekFrom::Start(0))
5728 .unwrap();
5729 let mut req_result = {
5730 let client = &self.hub.client;
5731 dlg.pre_request();
5732 let mut req_builder = hyper::Request::builder()
5733 .method(hyper::Method::PATCH)
5734 .uri(url.as_str())
5735 .header(USER_AGENT, self.hub._user_agent.clone());
5736
5737 if let Some(token) = token.as_ref() {
5738 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5739 }
5740
5741 let request = req_builder
5742 .header(CONTENT_TYPE, json_mime_type.to_string())
5743 .header(CONTENT_LENGTH, request_size as u64)
5744 .body(common::to_body(
5745 request_value_reader.get_ref().clone().into(),
5746 ));
5747
5748 client.request(request.unwrap()).await
5749 };
5750
5751 match req_result {
5752 Err(err) => {
5753 if let common::Retry::After(d) = dlg.http_error(&err) {
5754 sleep(d).await;
5755 continue;
5756 }
5757 dlg.finished(false);
5758 return Err(common::Error::HttpError(err));
5759 }
5760 Ok(res) => {
5761 let (mut parts, body) = res.into_parts();
5762 let mut body = common::Body::new(body);
5763 if !parts.status.is_success() {
5764 let bytes = common::to_bytes(body).await.unwrap_or_default();
5765 let error = serde_json::from_str(&common::to_string(&bytes));
5766 let response = common::to_response(parts, bytes.into());
5767
5768 if let common::Retry::After(d) =
5769 dlg.http_failure(&response, error.as_ref().ok())
5770 {
5771 sleep(d).await;
5772 continue;
5773 }
5774
5775 dlg.finished(false);
5776
5777 return Err(match error {
5778 Ok(value) => common::Error::BadRequest(value),
5779 _ => common::Error::Failure(response),
5780 });
5781 }
5782 let response = {
5783 let bytes = common::to_bytes(body).await.unwrap_or_default();
5784 let encoded = common::to_string(&bytes);
5785 match serde_json::from_str(&encoded) {
5786 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5787 Err(error) => {
5788 dlg.response_json_decode_error(&encoded, &error);
5789 return Err(common::Error::JsonDecodeError(
5790 encoded.to_string(),
5791 error,
5792 ));
5793 }
5794 }
5795 };
5796
5797 dlg.finished(true);
5798 return Ok(response);
5799 }
5800 }
5801 }
5802 }
5803
5804 ///
5805 /// Sets the *request* property to the given value.
5806 ///
5807 /// Even though the property as already been set when instantiating this call,
5808 /// we provide this method for API completeness.
5809 pub fn request(mut self, new_value: Secret) -> ProjectSecretPatchCall<'a, C> {
5810 self._request = new_value;
5811 self
5812 }
5813 /// Output only. The resource name of the Secret in the format `projects/*/secrets/*`.
5814 ///
5815 /// Sets the *name* path property to the given value.
5816 ///
5817 /// Even though the property as already been set when instantiating this call,
5818 /// we provide this method for API completeness.
5819 pub fn name(mut self, new_value: &str) -> ProjectSecretPatchCall<'a, C> {
5820 self._name = new_value.to_string();
5821 self
5822 }
5823 /// Required. Specifies the fields to be updated.
5824 ///
5825 /// Sets the *update mask* query property to the given value.
5826 pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectSecretPatchCall<'a, C> {
5827 self._update_mask = Some(new_value);
5828 self
5829 }
5830 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5831 /// while executing the actual API request.
5832 ///
5833 /// ````text
5834 /// It should be used to handle progress information, and to implement a certain level of resilience.
5835 /// ````
5836 ///
5837 /// Sets the *delegate* property to the given value.
5838 pub fn delegate(
5839 mut self,
5840 new_value: &'a mut dyn common::Delegate,
5841 ) -> ProjectSecretPatchCall<'a, C> {
5842 self._delegate = Some(new_value);
5843 self
5844 }
5845
5846 /// Set any additional parameter of the query string used in the request.
5847 /// It should be used to set parameters which are not yet available through their own
5848 /// setters.
5849 ///
5850 /// Please note that this method must not be used to set any of the known parameters
5851 /// which have their own setter method. If done anyway, the request will fail.
5852 ///
5853 /// # Additional Parameters
5854 ///
5855 /// * *$.xgafv* (query-string) - V1 error format.
5856 /// * *access_token* (query-string) - OAuth access token.
5857 /// * *alt* (query-string) - Data format for response.
5858 /// * *callback* (query-string) - JSONP
5859 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5860 /// * *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.
5861 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5862 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5863 /// * *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.
5864 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5865 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5866 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretPatchCall<'a, C>
5867 where
5868 T: AsRef<str>,
5869 {
5870 self._additional_params
5871 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5872 self
5873 }
5874
5875 /// Identifies the authorization scope for the method you are building.
5876 ///
5877 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5878 /// [`Scope::CloudPlatform`].
5879 ///
5880 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5881 /// tokens for more than one scope.
5882 ///
5883 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5884 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5885 /// sufficient, a read-write scope will do as well.
5886 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretPatchCall<'a, C>
5887 where
5888 St: AsRef<str>,
5889 {
5890 self._scopes.insert(String::from(scope.as_ref()));
5891 self
5892 }
5893 /// Identifies the authorization scope(s) for the method you are building.
5894 ///
5895 /// See [`Self::add_scope()`] for details.
5896 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretPatchCall<'a, C>
5897 where
5898 I: IntoIterator<Item = St>,
5899 St: AsRef<str>,
5900 {
5901 self._scopes
5902 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5903 self
5904 }
5905
5906 /// Removes all scopes, and no default scope will be used either.
5907 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5908 /// for details).
5909 pub fn clear_scopes(mut self) -> ProjectSecretPatchCall<'a, C> {
5910 self._scopes.clear();
5911 self
5912 }
5913}
5914
5915/// Sets the access control policy on the specified secret. Replaces any existing policy. Permissions on SecretVersions are enforced according to the policy set on the associated Secret.
5916///
5917/// A builder for the *secrets.setIamPolicy* method supported by a *project* resource.
5918/// It is not used directly, but through a [`ProjectMethods`] instance.
5919///
5920/// # Example
5921///
5922/// Instantiate a resource method builder
5923///
5924/// ```test_harness,no_run
5925/// # extern crate hyper;
5926/// # extern crate hyper_rustls;
5927/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
5928/// use secretmanager1_beta1::api::SetIamPolicyRequest;
5929/// # async fn dox() {
5930/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5931///
5932/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5933/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5934/// # .with_native_roots()
5935/// # .unwrap()
5936/// # .https_only()
5937/// # .enable_http2()
5938/// # .build();
5939///
5940/// # let executor = hyper_util::rt::TokioExecutor::new();
5941/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5942/// # secret,
5943/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5944/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5945/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5946/// # ),
5947/// # ).build().await.unwrap();
5948///
5949/// # let client = hyper_util::client::legacy::Client::builder(
5950/// # hyper_util::rt::TokioExecutor::new()
5951/// # )
5952/// # .build(
5953/// # hyper_rustls::HttpsConnectorBuilder::new()
5954/// # .with_native_roots()
5955/// # .unwrap()
5956/// # .https_or_http()
5957/// # .enable_http2()
5958/// # .build()
5959/// # );
5960/// # let mut hub = SecretManager::new(client, auth);
5961/// // As the method needs a request, you would usually fill it with the desired information
5962/// // into the respective structure. Some of the parts shown here might not be applicable !
5963/// // Values shown here are possibly random and not representative !
5964/// let mut req = SetIamPolicyRequest::default();
5965///
5966/// // You can configure optional parameters by calling the respective setters at will, and
5967/// // execute the final call using `doit()`.
5968/// // Values shown here are possibly random and not representative !
5969/// let result = hub.projects().secrets_set_iam_policy(req, "resource")
5970/// .doit().await;
5971/// # }
5972/// ```
5973pub struct ProjectSecretSetIamPolicyCall<'a, C>
5974where
5975 C: 'a,
5976{
5977 hub: &'a SecretManager<C>,
5978 _request: SetIamPolicyRequest,
5979 _resource: String,
5980 _delegate: Option<&'a mut dyn common::Delegate>,
5981 _additional_params: HashMap<String, String>,
5982 _scopes: BTreeSet<String>,
5983}
5984
5985impl<'a, C> common::CallBuilder for ProjectSecretSetIamPolicyCall<'a, C> {}
5986
5987impl<'a, C> ProjectSecretSetIamPolicyCall<'a, C>
5988where
5989 C: common::Connector,
5990{
5991 /// Perform the operation you have build so far.
5992 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5993 use std::borrow::Cow;
5994 use std::io::{Read, Seek};
5995
5996 use common::{url::Params, ToParts};
5997 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5998
5999 let mut dd = common::DefaultDelegate;
6000 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6001 dlg.begin(common::MethodInfo {
6002 id: "secretmanager.projects.secrets.setIamPolicy",
6003 http_method: hyper::Method::POST,
6004 });
6005
6006 for &field in ["alt", "resource"].iter() {
6007 if self._additional_params.contains_key(field) {
6008 dlg.finished(false);
6009 return Err(common::Error::FieldClash(field));
6010 }
6011 }
6012
6013 let mut params = Params::with_capacity(4 + self._additional_params.len());
6014 params.push("resource", self._resource);
6015
6016 params.extend(self._additional_params.iter());
6017
6018 params.push("alt", "json");
6019 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
6020 if self._scopes.is_empty() {
6021 self._scopes
6022 .insert(Scope::CloudPlatform.as_ref().to_string());
6023 }
6024
6025 #[allow(clippy::single_element_loop)]
6026 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6027 url = params.uri_replacement(url, param_name, find_this, true);
6028 }
6029 {
6030 let to_remove = ["resource"];
6031 params.remove_params(&to_remove);
6032 }
6033
6034 let url = params.parse_with_url(&url);
6035
6036 let mut json_mime_type = mime::APPLICATION_JSON;
6037 let mut request_value_reader = {
6038 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6039 common::remove_json_null_values(&mut value);
6040 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6041 serde_json::to_writer(&mut dst, &value).unwrap();
6042 dst
6043 };
6044 let request_size = request_value_reader
6045 .seek(std::io::SeekFrom::End(0))
6046 .unwrap();
6047 request_value_reader
6048 .seek(std::io::SeekFrom::Start(0))
6049 .unwrap();
6050
6051 loop {
6052 let token = match self
6053 .hub
6054 .auth
6055 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6056 .await
6057 {
6058 Ok(token) => token,
6059 Err(e) => match dlg.token(e) {
6060 Ok(token) => token,
6061 Err(e) => {
6062 dlg.finished(false);
6063 return Err(common::Error::MissingToken(e));
6064 }
6065 },
6066 };
6067 request_value_reader
6068 .seek(std::io::SeekFrom::Start(0))
6069 .unwrap();
6070 let mut req_result = {
6071 let client = &self.hub.client;
6072 dlg.pre_request();
6073 let mut req_builder = hyper::Request::builder()
6074 .method(hyper::Method::POST)
6075 .uri(url.as_str())
6076 .header(USER_AGENT, self.hub._user_agent.clone());
6077
6078 if let Some(token) = token.as_ref() {
6079 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6080 }
6081
6082 let request = req_builder
6083 .header(CONTENT_TYPE, json_mime_type.to_string())
6084 .header(CONTENT_LENGTH, request_size as u64)
6085 .body(common::to_body(
6086 request_value_reader.get_ref().clone().into(),
6087 ));
6088
6089 client.request(request.unwrap()).await
6090 };
6091
6092 match req_result {
6093 Err(err) => {
6094 if let common::Retry::After(d) = dlg.http_error(&err) {
6095 sleep(d).await;
6096 continue;
6097 }
6098 dlg.finished(false);
6099 return Err(common::Error::HttpError(err));
6100 }
6101 Ok(res) => {
6102 let (mut parts, body) = res.into_parts();
6103 let mut body = common::Body::new(body);
6104 if !parts.status.is_success() {
6105 let bytes = common::to_bytes(body).await.unwrap_or_default();
6106 let error = serde_json::from_str(&common::to_string(&bytes));
6107 let response = common::to_response(parts, bytes.into());
6108
6109 if let common::Retry::After(d) =
6110 dlg.http_failure(&response, error.as_ref().ok())
6111 {
6112 sleep(d).await;
6113 continue;
6114 }
6115
6116 dlg.finished(false);
6117
6118 return Err(match error {
6119 Ok(value) => common::Error::BadRequest(value),
6120 _ => common::Error::Failure(response),
6121 });
6122 }
6123 let response = {
6124 let bytes = common::to_bytes(body).await.unwrap_or_default();
6125 let encoded = common::to_string(&bytes);
6126 match serde_json::from_str(&encoded) {
6127 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6128 Err(error) => {
6129 dlg.response_json_decode_error(&encoded, &error);
6130 return Err(common::Error::JsonDecodeError(
6131 encoded.to_string(),
6132 error,
6133 ));
6134 }
6135 }
6136 };
6137
6138 dlg.finished(true);
6139 return Ok(response);
6140 }
6141 }
6142 }
6143 }
6144
6145 ///
6146 /// Sets the *request* property to the given value.
6147 ///
6148 /// Even though the property as already been set when instantiating this call,
6149 /// we provide this method for API completeness.
6150 pub fn request(
6151 mut self,
6152 new_value: SetIamPolicyRequest,
6153 ) -> ProjectSecretSetIamPolicyCall<'a, C> {
6154 self._request = new_value;
6155 self
6156 }
6157 /// 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.
6158 ///
6159 /// Sets the *resource* path property to the given value.
6160 ///
6161 /// Even though the property as already been set when instantiating this call,
6162 /// we provide this method for API completeness.
6163 pub fn resource(mut self, new_value: &str) -> ProjectSecretSetIamPolicyCall<'a, C> {
6164 self._resource = new_value.to_string();
6165 self
6166 }
6167 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6168 /// while executing the actual API request.
6169 ///
6170 /// ````text
6171 /// It should be used to handle progress information, and to implement a certain level of resilience.
6172 /// ````
6173 ///
6174 /// Sets the *delegate* property to the given value.
6175 pub fn delegate(
6176 mut self,
6177 new_value: &'a mut dyn common::Delegate,
6178 ) -> ProjectSecretSetIamPolicyCall<'a, C> {
6179 self._delegate = Some(new_value);
6180 self
6181 }
6182
6183 /// Set any additional parameter of the query string used in the request.
6184 /// It should be used to set parameters which are not yet available through their own
6185 /// setters.
6186 ///
6187 /// Please note that this method must not be used to set any of the known parameters
6188 /// which have their own setter method. If done anyway, the request will fail.
6189 ///
6190 /// # Additional Parameters
6191 ///
6192 /// * *$.xgafv* (query-string) - V1 error format.
6193 /// * *access_token* (query-string) - OAuth access token.
6194 /// * *alt* (query-string) - Data format for response.
6195 /// * *callback* (query-string) - JSONP
6196 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6197 /// * *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.
6198 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6199 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6200 /// * *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.
6201 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6202 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6203 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretSetIamPolicyCall<'a, C>
6204 where
6205 T: AsRef<str>,
6206 {
6207 self._additional_params
6208 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6209 self
6210 }
6211
6212 /// Identifies the authorization scope for the method you are building.
6213 ///
6214 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6215 /// [`Scope::CloudPlatform`].
6216 ///
6217 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6218 /// tokens for more than one scope.
6219 ///
6220 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6221 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6222 /// sufficient, a read-write scope will do as well.
6223 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretSetIamPolicyCall<'a, C>
6224 where
6225 St: AsRef<str>,
6226 {
6227 self._scopes.insert(String::from(scope.as_ref()));
6228 self
6229 }
6230 /// Identifies the authorization scope(s) for the method you are building.
6231 ///
6232 /// See [`Self::add_scope()`] for details.
6233 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretSetIamPolicyCall<'a, C>
6234 where
6235 I: IntoIterator<Item = St>,
6236 St: AsRef<str>,
6237 {
6238 self._scopes
6239 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6240 self
6241 }
6242
6243 /// Removes all scopes, and no default scope will be used either.
6244 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6245 /// for details).
6246 pub fn clear_scopes(mut self) -> ProjectSecretSetIamPolicyCall<'a, C> {
6247 self._scopes.clear();
6248 self
6249 }
6250}
6251
6252/// Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns 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.
6253///
6254/// A builder for the *secrets.testIamPermissions* method supported by a *project* resource.
6255/// It is not used directly, but through a [`ProjectMethods`] instance.
6256///
6257/// # Example
6258///
6259/// Instantiate a resource method builder
6260///
6261/// ```test_harness,no_run
6262/// # extern crate hyper;
6263/// # extern crate hyper_rustls;
6264/// # extern crate google_secretmanager1_beta1 as secretmanager1_beta1;
6265/// use secretmanager1_beta1::api::TestIamPermissionsRequest;
6266/// # async fn dox() {
6267/// # use secretmanager1_beta1::{SecretManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6268///
6269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6270/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6271/// # .with_native_roots()
6272/// # .unwrap()
6273/// # .https_only()
6274/// # .enable_http2()
6275/// # .build();
6276///
6277/// # let executor = hyper_util::rt::TokioExecutor::new();
6278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6279/// # secret,
6280/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6281/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6282/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6283/// # ),
6284/// # ).build().await.unwrap();
6285///
6286/// # let client = hyper_util::client::legacy::Client::builder(
6287/// # hyper_util::rt::TokioExecutor::new()
6288/// # )
6289/// # .build(
6290/// # hyper_rustls::HttpsConnectorBuilder::new()
6291/// # .with_native_roots()
6292/// # .unwrap()
6293/// # .https_or_http()
6294/// # .enable_http2()
6295/// # .build()
6296/// # );
6297/// # let mut hub = SecretManager::new(client, auth);
6298/// // As the method needs a request, you would usually fill it with the desired information
6299/// // into the respective structure. Some of the parts shown here might not be applicable !
6300/// // Values shown here are possibly random and not representative !
6301/// let mut req = TestIamPermissionsRequest::default();
6302///
6303/// // You can configure optional parameters by calling the respective setters at will, and
6304/// // execute the final call using `doit()`.
6305/// // Values shown here are possibly random and not representative !
6306/// let result = hub.projects().secrets_test_iam_permissions(req, "resource")
6307/// .doit().await;
6308/// # }
6309/// ```
6310pub struct ProjectSecretTestIamPermissionCall<'a, C>
6311where
6312 C: 'a,
6313{
6314 hub: &'a SecretManager<C>,
6315 _request: TestIamPermissionsRequest,
6316 _resource: String,
6317 _delegate: Option<&'a mut dyn common::Delegate>,
6318 _additional_params: HashMap<String, String>,
6319 _scopes: BTreeSet<String>,
6320}
6321
6322impl<'a, C> common::CallBuilder for ProjectSecretTestIamPermissionCall<'a, C> {}
6323
6324impl<'a, C> ProjectSecretTestIamPermissionCall<'a, C>
6325where
6326 C: common::Connector,
6327{
6328 /// Perform the operation you have build so far.
6329 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6330 use std::borrow::Cow;
6331 use std::io::{Read, Seek};
6332
6333 use common::{url::Params, ToParts};
6334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6335
6336 let mut dd = common::DefaultDelegate;
6337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6338 dlg.begin(common::MethodInfo {
6339 id: "secretmanager.projects.secrets.testIamPermissions",
6340 http_method: hyper::Method::POST,
6341 });
6342
6343 for &field in ["alt", "resource"].iter() {
6344 if self._additional_params.contains_key(field) {
6345 dlg.finished(false);
6346 return Err(common::Error::FieldClash(field));
6347 }
6348 }
6349
6350 let mut params = Params::with_capacity(4 + self._additional_params.len());
6351 params.push("resource", self._resource);
6352
6353 params.extend(self._additional_params.iter());
6354
6355 params.push("alt", "json");
6356 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
6357 if self._scopes.is_empty() {
6358 self._scopes
6359 .insert(Scope::CloudPlatform.as_ref().to_string());
6360 }
6361
6362 #[allow(clippy::single_element_loop)]
6363 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6364 url = params.uri_replacement(url, param_name, find_this, true);
6365 }
6366 {
6367 let to_remove = ["resource"];
6368 params.remove_params(&to_remove);
6369 }
6370
6371 let url = params.parse_with_url(&url);
6372
6373 let mut json_mime_type = mime::APPLICATION_JSON;
6374 let mut request_value_reader = {
6375 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6376 common::remove_json_null_values(&mut value);
6377 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6378 serde_json::to_writer(&mut dst, &value).unwrap();
6379 dst
6380 };
6381 let request_size = request_value_reader
6382 .seek(std::io::SeekFrom::End(0))
6383 .unwrap();
6384 request_value_reader
6385 .seek(std::io::SeekFrom::Start(0))
6386 .unwrap();
6387
6388 loop {
6389 let token = match self
6390 .hub
6391 .auth
6392 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6393 .await
6394 {
6395 Ok(token) => token,
6396 Err(e) => match dlg.token(e) {
6397 Ok(token) => token,
6398 Err(e) => {
6399 dlg.finished(false);
6400 return Err(common::Error::MissingToken(e));
6401 }
6402 },
6403 };
6404 request_value_reader
6405 .seek(std::io::SeekFrom::Start(0))
6406 .unwrap();
6407 let mut req_result = {
6408 let client = &self.hub.client;
6409 dlg.pre_request();
6410 let mut req_builder = hyper::Request::builder()
6411 .method(hyper::Method::POST)
6412 .uri(url.as_str())
6413 .header(USER_AGENT, self.hub._user_agent.clone());
6414
6415 if let Some(token) = token.as_ref() {
6416 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6417 }
6418
6419 let request = req_builder
6420 .header(CONTENT_TYPE, json_mime_type.to_string())
6421 .header(CONTENT_LENGTH, request_size as u64)
6422 .body(common::to_body(
6423 request_value_reader.get_ref().clone().into(),
6424 ));
6425
6426 client.request(request.unwrap()).await
6427 };
6428
6429 match req_result {
6430 Err(err) => {
6431 if let common::Retry::After(d) = dlg.http_error(&err) {
6432 sleep(d).await;
6433 continue;
6434 }
6435 dlg.finished(false);
6436 return Err(common::Error::HttpError(err));
6437 }
6438 Ok(res) => {
6439 let (mut parts, body) = res.into_parts();
6440 let mut body = common::Body::new(body);
6441 if !parts.status.is_success() {
6442 let bytes = common::to_bytes(body).await.unwrap_or_default();
6443 let error = serde_json::from_str(&common::to_string(&bytes));
6444 let response = common::to_response(parts, bytes.into());
6445
6446 if let common::Retry::After(d) =
6447 dlg.http_failure(&response, error.as_ref().ok())
6448 {
6449 sleep(d).await;
6450 continue;
6451 }
6452
6453 dlg.finished(false);
6454
6455 return Err(match error {
6456 Ok(value) => common::Error::BadRequest(value),
6457 _ => common::Error::Failure(response),
6458 });
6459 }
6460 let response = {
6461 let bytes = common::to_bytes(body).await.unwrap_or_default();
6462 let encoded = common::to_string(&bytes);
6463 match serde_json::from_str(&encoded) {
6464 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6465 Err(error) => {
6466 dlg.response_json_decode_error(&encoded, &error);
6467 return Err(common::Error::JsonDecodeError(
6468 encoded.to_string(),
6469 error,
6470 ));
6471 }
6472 }
6473 };
6474
6475 dlg.finished(true);
6476 return Ok(response);
6477 }
6478 }
6479 }
6480 }
6481
6482 ///
6483 /// Sets the *request* property to the given value.
6484 ///
6485 /// Even though the property as already been set when instantiating this call,
6486 /// we provide this method for API completeness.
6487 pub fn request(
6488 mut self,
6489 new_value: TestIamPermissionsRequest,
6490 ) -> ProjectSecretTestIamPermissionCall<'a, C> {
6491 self._request = new_value;
6492 self
6493 }
6494 /// 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.
6495 ///
6496 /// Sets the *resource* path property to the given value.
6497 ///
6498 /// Even though the property as already been set when instantiating this call,
6499 /// we provide this method for API completeness.
6500 pub fn resource(mut self, new_value: &str) -> ProjectSecretTestIamPermissionCall<'a, C> {
6501 self._resource = new_value.to_string();
6502 self
6503 }
6504 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6505 /// while executing the actual API request.
6506 ///
6507 /// ````text
6508 /// It should be used to handle progress information, and to implement a certain level of resilience.
6509 /// ````
6510 ///
6511 /// Sets the *delegate* property to the given value.
6512 pub fn delegate(
6513 mut self,
6514 new_value: &'a mut dyn common::Delegate,
6515 ) -> ProjectSecretTestIamPermissionCall<'a, C> {
6516 self._delegate = Some(new_value);
6517 self
6518 }
6519
6520 /// Set any additional parameter of the query string used in the request.
6521 /// It should be used to set parameters which are not yet available through their own
6522 /// setters.
6523 ///
6524 /// Please note that this method must not be used to set any of the known parameters
6525 /// which have their own setter method. If done anyway, the request will fail.
6526 ///
6527 /// # Additional Parameters
6528 ///
6529 /// * *$.xgafv* (query-string) - V1 error format.
6530 /// * *access_token* (query-string) - OAuth access token.
6531 /// * *alt* (query-string) - Data format for response.
6532 /// * *callback* (query-string) - JSONP
6533 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6534 /// * *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.
6535 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6536 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6537 /// * *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.
6538 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6539 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6540 pub fn param<T>(mut self, name: T, value: T) -> ProjectSecretTestIamPermissionCall<'a, C>
6541 where
6542 T: AsRef<str>,
6543 {
6544 self._additional_params
6545 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6546 self
6547 }
6548
6549 /// Identifies the authorization scope for the method you are building.
6550 ///
6551 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6552 /// [`Scope::CloudPlatform`].
6553 ///
6554 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6555 /// tokens for more than one scope.
6556 ///
6557 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6558 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6559 /// sufficient, a read-write scope will do as well.
6560 pub fn add_scope<St>(mut self, scope: St) -> ProjectSecretTestIamPermissionCall<'a, C>
6561 where
6562 St: AsRef<str>,
6563 {
6564 self._scopes.insert(String::from(scope.as_ref()));
6565 self
6566 }
6567 /// Identifies the authorization scope(s) for the method you are building.
6568 ///
6569 /// See [`Self::add_scope()`] for details.
6570 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSecretTestIamPermissionCall<'a, C>
6571 where
6572 I: IntoIterator<Item = St>,
6573 St: AsRef<str>,
6574 {
6575 self._scopes
6576 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6577 self
6578 }
6579
6580 /// Removes all scopes, and no default scope will be used either.
6581 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6582 /// for details).
6583 pub fn clear_scopes(mut self) -> ProjectSecretTestIamPermissionCall<'a, C> {
6584 self._scopes.clear();
6585 self
6586 }
6587}