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