google_privateca1/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 as privateca1;
49/// use privateca1::{Result, Error};
50/// # async fn dox() {
51/// use privateca1::{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_ca_pools_certificate_authorities_delete("name")
93/// .skip_grace_period(true)
94/// .request_id("invidunt")
95/// .ignore_dependent_resources(true)
96/// .ignore_active_certificates(true)
97/// .doit().await;
98///
99/// match result {
100/// Err(e) => match e {
101/// // The Error enum provides details about what exactly happened.
102/// // You can also just use its `Debug`, `Display` or `Error` traits
103/// Error::HttpError(_)
104/// |Error::Io(_)
105/// |Error::MissingAPIKey
106/// |Error::MissingToken(_)
107/// |Error::Cancelled
108/// |Error::UploadSizeLimitExceeded(_, _)
109/// |Error::Failure(_)
110/// |Error::BadRequest(_)
111/// |Error::FieldClash(_)
112/// |Error::JsonDecodeError(_, _) => println!("{}", e),
113/// },
114/// Ok(res) => println!("Success: {:?}", res),
115/// }
116/// # }
117/// ```
118#[derive(Clone)]
119pub struct CertificateAuthorityService<C> {
120 pub client: common::Client<C>,
121 pub auth: Box<dyn common::GetToken>,
122 _user_agent: String,
123 _base_url: String,
124 _root_url: String,
125}
126
127impl<C> common::Hub for CertificateAuthorityService<C> {}
128
129impl<'a, C> CertificateAuthorityService<C> {
130 pub fn new<A: 'static + common::GetToken>(
131 client: common::Client<C>,
132 auth: A,
133 ) -> CertificateAuthorityService<C> {
134 CertificateAuthorityService {
135 client,
136 auth: Box::new(auth),
137 _user_agent: "google-api-rust-client/7.0.0".to_string(),
138 _base_url: "https://privateca.googleapis.com/".to_string(),
139 _root_url: "https://privateca.googleapis.com/".to_string(),
140 }
141 }
142
143 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
144 ProjectMethods { hub: self }
145 }
146
147 /// Set the user-agent header field to use in all requests to the server.
148 /// It defaults to `google-api-rust-client/7.0.0`.
149 ///
150 /// Returns the previously set user-agent.
151 pub fn user_agent(&mut self, agent_name: String) -> String {
152 std::mem::replace(&mut self._user_agent, agent_name)
153 }
154
155 /// Set the base url to use in all requests to the server.
156 /// It defaults to `https://privateca.googleapis.com/`.
157 ///
158 /// Returns the previously set base url.
159 pub fn base_url(&mut self, new_base_url: String) -> String {
160 std::mem::replace(&mut self._base_url, new_base_url)
161 }
162
163 /// Set the root url to use in all requests to the server.
164 /// It defaults to `https://privateca.googleapis.com/`.
165 ///
166 /// Returns the previously set root url.
167 pub fn root_url(&mut self, new_root_url: String) -> String {
168 std::mem::replace(&mut self._root_url, new_root_url)
169 }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// URLs where a CertificateAuthority will publish content.
176///
177/// This type is not used in any activity, and only used as *part* of another schema.
178///
179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
180#[serde_with::serde_as]
181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
182pub struct AccessUrls {
183 /// The URL where this CertificateAuthority's CA certificate is published. This will only be set for CAs that have been activated.
184 #[serde(rename = "caCertificateAccessUrl")]
185 pub ca_certificate_access_url: Option<String>,
186 /// The URLs where this CertificateAuthority's CRLs are published. This will only be set for CAs that have been activated.
187 #[serde(rename = "crlAccessUrls")]
188 pub crl_access_urls: Option<Vec<String>>,
189}
190
191impl common::Part for AccessUrls {}
192
193/// Request message for CertificateAuthorityService.ActivateCertificateAuthority.
194///
195/// # Activities
196///
197/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
198/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
199///
200/// * [locations ca pools certificate authorities activate projects](ProjectLocationCaPoolCertificateAuthorityActivateCall) (request)
201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
202#[serde_with::serde_as]
203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
204pub struct ActivateCertificateAuthorityRequest {
205 /// Required. The signed CA certificate issued from FetchCertificateAuthorityCsrResponse.pem_csr.
206 #[serde(rename = "pemCaCertificate")]
207 pub pem_ca_certificate: Option<String>,
208 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
209 #[serde(rename = "requestId")]
210 pub request_id: Option<String>,
211 /// Required. Must include information about the issuer of 'pem_ca_certificate', and any further issuers until the self-signed CA.
212 #[serde(rename = "subordinateConfig")]
213 pub subordinate_config: Option<SubordinateConfig>,
214}
215
216impl common::RequestValue for ActivateCertificateAuthorityRequest {}
217
218/// Describes a "type" of key that may be used in a Certificate issued from a CaPool. Note that a single AllowedKeyType may refer to either a fully-qualified key algorithm, such as RSA 4096, or a family of key algorithms, such as any RSA key.
219///
220/// This type is not used in any activity, and only used as *part* of another schema.
221///
222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
223#[serde_with::serde_as]
224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
225pub struct AllowedKeyType {
226 /// Represents an allowed Elliptic Curve key type.
227 #[serde(rename = "ellipticCurve")]
228 pub elliptic_curve: Option<EcKeyType>,
229 /// Represents an allowed RSA key type.
230 pub rsa: Option<RsaKeyType>,
231}
232
233impl common::Part for AllowedKeyType {}
234
235/// AttributeTypeAndValue specifies an attribute type and value. It can use either a OID or enum value to specify the attribute type.
236///
237/// This type is not used in any activity, and only used as *part* of another schema.
238///
239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
240#[serde_with::serde_as]
241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
242pub struct AttributeTypeAndValue {
243 /// Object ID for an attribute type of an attribute and value pair.
244 #[serde(rename = "objectId")]
245 pub object_id: Option<ObjectId>,
246 /// The attribute type of the attribute and value pair.
247 #[serde(rename = "type")]
248 pub type_: Option<String>,
249 /// The value for the attribute type.
250 pub value: Option<String>,
251}
252
253impl common::Part for AttributeTypeAndValue {}
254
255/// 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.
256///
257/// This type is not used in any activity, and only used as *part* of another schema.
258///
259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
260#[serde_with::serde_as]
261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
262pub struct AuditConfig {
263 /// The configuration for logging of each type of permission.
264 #[serde(rename = "auditLogConfigs")]
265 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
266 /// 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.
267 pub service: Option<String>,
268}
269
270impl common::Part for AuditConfig {}
271
272/// 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.
273///
274/// This type is not used in any activity, and only used as *part* of another schema.
275///
276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
277#[serde_with::serde_as]
278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
279pub struct AuditLogConfig {
280 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
281 #[serde(rename = "exemptedMembers")]
282 pub exempted_members: Option<Vec<String>>,
283 /// The log type that this config enables.
284 #[serde(rename = "logType")]
285 pub log_type: Option<String>,
286}
287
288impl common::Part for AuditLogConfig {}
289
290/// Associates `members`, or principals, with a `role`.
291///
292/// This type is not used in any activity, and only used as *part* of another schema.
293///
294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
295#[serde_with::serde_as]
296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
297pub struct Binding {
298 /// 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).
299 pub condition: Option<Expr>,
300 /// 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`.
301 pub members: Option<Vec<String>>,
302 /// 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).
303 pub role: Option<String>,
304}
305
306impl common::Part for Binding {}
307
308/// Describes the X.509 basic constraints extension, per [RFC 5280 section 4.2.1.9](https://tools.ietf.org/html/rfc5280#section-4.2.1.9)
309///
310/// This type is not used in any activity, and only used as *part* of another schema.
311///
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct CaOptions {
316 /// Optional. Refers to the "CA" boolean field in the X.509 extension. When this value is missing, the basic constraints extension will be omitted from the certificate.
317 #[serde(rename = "isCa")]
318 pub is_ca: Option<bool>,
319 /// Optional. Refers to the path length constraint field in the X.509 extension. For a CA certificate, this value describes the depth of subordinate CA certificates that are allowed. If this value is less than 0, the request will fail. If this value is missing, the max path length will be omitted from the certificate.
320 #[serde(rename = "maxIssuerPathLength")]
321 pub max_issuer_path_length: Option<i32>,
322}
323
324impl common::Part for CaOptions {}
325
326/// A CaPool represents a group of CertificateAuthorities that form a trust anchor. A CaPool can be used to manage issuance policies for one or more CertificateAuthority resources and to rotate CA certificates in and out of the trust anchor.
327///
328/// # Activities
329///
330/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
331/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
332///
333/// * [locations ca pools create projects](ProjectLocationCaPoolCreateCall) (request)
334/// * [locations ca pools get projects](ProjectLocationCaPoolGetCall) (response)
335/// * [locations ca pools patch projects](ProjectLocationCaPoolPatchCall) (request)
336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
337#[serde_with::serde_as]
338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
339pub struct CaPool {
340 /// Optional. When EncryptionSpec is provided, the Subject, SubjectAltNames, and the PEM-encoded certificate fields will be encrypted at rest.
341 #[serde(rename = "encryptionSpec")]
342 pub encryption_spec: Option<EncryptionSpec>,
343 /// Optional. The IssuancePolicy to control how Certificates will be issued from this CaPool.
344 #[serde(rename = "issuancePolicy")]
345 pub issuance_policy: Option<IssuancePolicy>,
346 /// Optional. Labels with user-defined metadata.
347 pub labels: Option<HashMap<String, String>>,
348 /// Identifier. The resource name for this CaPool in the format `projects/*/locations/*/caPools/*`.
349 pub name: Option<String>,
350 /// Optional. The PublishingOptions to follow when issuing Certificates from any CertificateAuthority in this CaPool.
351 #[serde(rename = "publishingOptions")]
352 pub publishing_options: Option<PublishingOptions>,
353 /// Required. Immutable. The Tier of this CaPool.
354 pub tier: Option<String>,
355}
356
357impl common::RequestValue for CaPool {}
358impl common::ResponseResult for CaPool {}
359
360/// The request message for Operations.CancelOperation.
361///
362/// # Activities
363///
364/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
365/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
366///
367/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct CancelOperationRequest {
372 _never_set: Option<bool>,
373}
374
375impl common::RequestValue for CancelOperationRequest {}
376
377/// There is no detailed description.
378///
379/// This type is not used in any activity, and only used as *part* of another schema.
380///
381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
382#[serde_with::serde_as]
383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
384pub struct CertChain {
385 /// The certificates that form the CA chain, from leaf to root order.
386 pub certificates: Option<Vec<String>>,
387}
388
389impl common::Part for CertChain {}
390
391/// A Certificate corresponds to a signed X.509 certificate issued by a CertificateAuthority.
392///
393/// # Activities
394///
395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
397///
398/// * [locations ca pools certificates create projects](ProjectLocationCaPoolCertificateCreateCall) (request|response)
399/// * [locations ca pools certificates get projects](ProjectLocationCaPoolCertificateGetCall) (response)
400/// * [locations ca pools certificates patch projects](ProjectLocationCaPoolCertificatePatchCall) (request|response)
401/// * [locations ca pools certificates revoke projects](ProjectLocationCaPoolCertificateRevokeCall) (response)
402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
403#[serde_with::serde_as]
404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
405pub struct Certificate {
406 /// Output only. A structured description of the issued X.509 certificate.
407 #[serde(rename = "certificateDescription")]
408 pub certificate_description: Option<CertificateDescription>,
409 /// Immutable. The resource name for a CertificateTemplate used to issue this certificate, in the format `projects/*/locations/*/certificateTemplates/*`. If this is specified, the caller must have the necessary permission to use this template. If this is omitted, no template will be used. This template must be in the same location as the Certificate.
410 #[serde(rename = "certificateTemplate")]
411 pub certificate_template: Option<String>,
412 /// Immutable. A description of the certificate and key that does not require X.509 or ASN.1.
413 pub config: Option<CertificateConfig>,
414 /// Output only. The time at which this Certificate was created.
415 #[serde(rename = "createTime")]
416 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
417 /// Output only. The resource name of the issuing CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
418 #[serde(rename = "issuerCertificateAuthority")]
419 pub issuer_certificate_authority: Option<String>,
420 /// Optional. Labels with user-defined metadata.
421 pub labels: Option<HashMap<String, String>>,
422 /// Required. Immutable. The desired lifetime of a certificate. Used to create the "not_before_time" and "not_after_time" fields inside an X.509 certificate. Note that the lifetime may be truncated if it would extend past the life of any certificate authority in the issuing chain.
423 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
424 pub lifetime: Option<chrono::Duration>,
425 /// Identifier. The resource name for this Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
426 pub name: Option<String>,
427 /// Output only. The pem-encoded, signed X.509 certificate.
428 #[serde(rename = "pemCertificate")]
429 pub pem_certificate: Option<String>,
430 /// Output only. The chain that may be used to verify the X.509 certificate. Expected to be in issuer-to-root order according to RFC 5246.
431 #[serde(rename = "pemCertificateChain")]
432 pub pem_certificate_chain: Option<Vec<String>>,
433 /// Immutable. A pem-encoded X.509 certificate signing request (CSR).
434 #[serde(rename = "pemCsr")]
435 pub pem_csr: Option<String>,
436 /// Output only. Details regarding the revocation of this Certificate. This Certificate is considered revoked if and only if this field is present.
437 #[serde(rename = "revocationDetails")]
438 pub revocation_details: Option<RevocationDetails>,
439 /// Immutable. Specifies how the Certificate's identity fields are to be decided. If this is omitted, the `DEFAULT` subject mode will be used.
440 #[serde(rename = "subjectMode")]
441 pub subject_mode: Option<String>,
442 /// Output only. The time at which this Certificate was updated.
443 #[serde(rename = "updateTime")]
444 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
445}
446
447impl common::RequestValue for Certificate {}
448impl common::ResponseResult for Certificate {}
449
450/// A CertificateAuthority represents an individual Certificate Authority. A CertificateAuthority can be used to create Certificates.
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 ca pools certificate authorities create projects](ProjectLocationCaPoolCertificateAuthorityCreateCall) (request)
458/// * [locations ca pools certificate authorities get projects](ProjectLocationCaPoolCertificateAuthorityGetCall) (response)
459/// * [locations ca pools certificate authorities patch projects](ProjectLocationCaPoolCertificateAuthorityPatchCall) (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 CertificateAuthority {
464 /// Output only. URLs for accessing content published by this CA, such as the CA certificate and CRLs.
465 #[serde(rename = "accessUrls")]
466 pub access_urls: Option<AccessUrls>,
467 /// Output only. A structured description of this CertificateAuthority's CA certificate and its issuers. Ordered as self-to-root.
468 #[serde(rename = "caCertificateDescriptions")]
469 pub ca_certificate_descriptions: Option<Vec<CertificateDescription>>,
470 /// Required. Immutable. The config used to create a self-signed X.509 certificate or CSR.
471 pub config: Option<CertificateConfig>,
472 /// Output only. The time at which this CertificateAuthority was created.
473 #[serde(rename = "createTime")]
474 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
475 /// Output only. The time at which this CertificateAuthority was soft deleted, if it is in the DELETED state.
476 #[serde(rename = "deleteTime")]
477 pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
478 /// Output only. The time at which this CertificateAuthority will be permanently purged, if it is in the DELETED state.
479 #[serde(rename = "expireTime")]
480 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
481 /// Immutable. The name of a Cloud Storage bucket where this CertificateAuthority will publish content, such as the CA certificate and CRLs. This must be a bucket name, without any prefixes (such as `gs://`) or suffixes (such as `.googleapis.com`). For example, to use a bucket named `my-bucket`, you would simply specify `my-bucket`. If not specified, a managed bucket will be created.
482 #[serde(rename = "gcsBucket")]
483 pub gcs_bucket: Option<String>,
484 /// Required. Immutable. Used when issuing certificates for this CertificateAuthority. If this CertificateAuthority is a self-signed CertificateAuthority, this key is also used to sign the self-signed CA certificate. Otherwise, it is used to sign a CSR.
485 #[serde(rename = "keySpec")]
486 pub key_spec: Option<KeyVersionSpec>,
487 /// Optional. Labels with user-defined metadata.
488 pub labels: Option<HashMap<String, String>>,
489 /// Required. Immutable. The desired lifetime of the CA certificate. Used to create the "not_before_time" and "not_after_time" fields inside an X.509 certificate.
490 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
491 pub lifetime: Option<chrono::Duration>,
492 /// Identifier. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
493 pub name: Option<String>,
494 /// Output only. This CertificateAuthority's certificate chain, including the current CertificateAuthority's certificate. Ordered such that the root issuer is the final element (consistent with RFC 5246). For a self-signed CA, this will only list the current CertificateAuthority's certificate.
495 #[serde(rename = "pemCaCertificates")]
496 pub pem_ca_certificates: Option<Vec<String>>,
497 /// Output only. Reserved for future use.
498 #[serde(rename = "satisfiesPzi")]
499 pub satisfies_pzi: Option<bool>,
500 /// Output only. Reserved for future use.
501 #[serde(rename = "satisfiesPzs")]
502 pub satisfies_pzs: Option<bool>,
503 /// Output only. The State for this CertificateAuthority.
504 pub state: Option<String>,
505 /// Optional. If this is a subordinate CertificateAuthority, this field will be set with the subordinate configuration, which describes its issuers. This may be updated, but this CertificateAuthority must continue to validate.
506 #[serde(rename = "subordinateConfig")]
507 pub subordinate_config: Option<SubordinateConfig>,
508 /// Output only. The CaPool.Tier of the CaPool that includes this CertificateAuthority.
509 pub tier: Option<String>,
510 /// Required. Immutable. The Type of this CertificateAuthority.
511 #[serde(rename = "type")]
512 pub type_: Option<String>,
513 /// Output only. The time at which this CertificateAuthority was last updated.
514 #[serde(rename = "updateTime")]
515 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
516 /// Optional. User-defined URLs for CA certificate and CRLs. The service does not publish content to these URLs. It is up to the user to mirror content to these URLs.
517 #[serde(rename = "userDefinedAccessUrls")]
518 pub user_defined_access_urls: Option<UserDefinedAccessUrls>,
519}
520
521impl common::RequestValue for CertificateAuthority {}
522impl common::ResponseResult for CertificateAuthority {}
523
524/// A CertificateConfig describes an X.509 certificate or CSR that is to be created, as an alternative to using ASN.1.
525///
526/// This type is not used in any activity, and only used as *part* of another schema.
527///
528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
529#[serde_with::serde_as]
530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
531pub struct CertificateConfig {
532 /// Optional. The public key that corresponds to this config. This is, for example, used when issuing Certificates, but not when creating a self-signed CertificateAuthority or CertificateAuthority CSR.
533 #[serde(rename = "publicKey")]
534 pub public_key: Option<PublicKey>,
535 /// Required. Specifies some of the values in a certificate that are related to the subject.
536 #[serde(rename = "subjectConfig")]
537 pub subject_config: Option<SubjectConfig>,
538 /// Optional. When specified this provides a custom SKI to be used in the certificate. This should only be used to maintain a SKI of an existing CA originally created outside CA service, which was not generated using method (1) described in RFC 5280 section 4.2.1.2.
539 #[serde(rename = "subjectKeyId")]
540 pub subject_key_id: Option<CertificateConfigKeyId>,
541 /// Required. Describes how some of the technical X.509 fields in a certificate should be populated.
542 #[serde(rename = "x509Config")]
543 pub x509_config: Option<X509Parameters>,
544}
545
546impl common::Part for CertificateConfig {}
547
548/// A KeyId identifies a specific public key, usually by hashing the public key.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct CertificateConfigKeyId {
556 /// Required. The value of this KeyId encoded in lowercase hexadecimal. This is most likely the 160 bit SHA-1 hash of the public key.
557 #[serde(rename = "keyId")]
558 pub key_id: Option<String>,
559}
560
561impl common::Part for CertificateConfigKeyId {}
562
563/// A CertificateDescription describes an X.509 certificate or CSR that has been issued, as an alternative to using ASN.1 / X.509.
564///
565/// This type is not used in any activity, and only used as *part* of another schema.
566///
567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
568#[serde_with::serde_as]
569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
570pub struct CertificateDescription {
571 /// Describes lists of issuer CA certificate URLs that appear in the "Authority Information Access" extension in the certificate.
572 #[serde(rename = "aiaIssuingCertificateUrls")]
573 pub aia_issuing_certificate_urls: Option<Vec<String>>,
574 /// Identifies the subject_key_id of the parent certificate, per https://tools.ietf.org/html/rfc5280#section-4.2.1.1
575 #[serde(rename = "authorityKeyId")]
576 pub authority_key_id: Option<KeyId>,
577 /// The hash of the x.509 certificate.
578 #[serde(rename = "certFingerprint")]
579 pub cert_fingerprint: Option<CertificateFingerprint>,
580 /// Describes a list of locations to obtain CRL information, i.e. the DistributionPoint.fullName described by https://tools.ietf.org/html/rfc5280#section-4.2.1.13
581 #[serde(rename = "crlDistributionPoints")]
582 pub crl_distribution_points: Option<Vec<String>>,
583 /// The public key that corresponds to an issued certificate.
584 #[serde(rename = "publicKey")]
585 pub public_key: Option<PublicKey>,
586 /// Describes some of the values in a certificate that are related to the subject and lifetime.
587 #[serde(rename = "subjectDescription")]
588 pub subject_description: Option<SubjectDescription>,
589 /// Provides a means of identifiying certificates that contain a particular public key, per https://tools.ietf.org/html/rfc5280#section-4.2.1.2.
590 #[serde(rename = "subjectKeyId")]
591 pub subject_key_id: Option<KeyId>,
592 /// The hash of the pre-signed certificate, which will be signed by the CA. Corresponds to the TBS Certificate in https://tools.ietf.org/html/rfc5280#section-4.1.2. The field will always be populated.
593 #[serde(rename = "tbsCertificateDigest")]
594 pub tbs_certificate_digest: Option<String>,
595 /// Describes some of the technical X.509 fields in a certificate.
596 #[serde(rename = "x509Description")]
597 pub x509_description: Option<X509Parameters>,
598}
599
600impl common::Part for CertificateDescription {}
601
602/// Describes a set of X.509 extensions that may be part of some certificate issuance controls.
603///
604/// This type is not used in any activity, and only used as *part* of another schema.
605///
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct CertificateExtensionConstraints {
610 /// Optional. A set of ObjectIds identifying custom X.509 extensions. Will be combined with known_extensions to determine the full set of X.509 extensions.
611 #[serde(rename = "additionalExtensions")]
612 pub additional_extensions: Option<Vec<ObjectId>>,
613 /// Optional. A set of named X.509 extensions. Will be combined with additional_extensions to determine the full set of X.509 extensions.
614 #[serde(rename = "knownExtensions")]
615 pub known_extensions: Option<Vec<String>>,
616}
617
618impl common::Part for CertificateExtensionConstraints {}
619
620/// A group of fingerprints for the x509 certificate.
621///
622/// This type is not used in any activity, and only used as *part* of another schema.
623///
624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
625#[serde_with::serde_as]
626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
627pub struct CertificateFingerprint {
628 /// The SHA 256 hash, encoded in hexadecimal, of the DER x509 certificate.
629 #[serde(rename = "sha256Hash")]
630 pub sha256_hash: Option<String>,
631}
632
633impl common::Part for CertificateFingerprint {}
634
635/// Describes constraints on a Certificate's Subject and SubjectAltNames.
636///
637/// This type is not used in any activity, and only used as *part* of another schema.
638///
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct CertificateIdentityConstraints {
643 /// Required. If this is true, the SubjectAltNames extension may be copied from a certificate request into the signed certificate. Otherwise, the requested SubjectAltNames will be discarded.
644 #[serde(rename = "allowSubjectAltNamesPassthrough")]
645 pub allow_subject_alt_names_passthrough: Option<bool>,
646 /// Required. If this is true, the Subject field may be copied from a certificate request into the signed certificate. Otherwise, the requested Subject will be discarded.
647 #[serde(rename = "allowSubjectPassthrough")]
648 pub allow_subject_passthrough: Option<bool>,
649 /// Optional. A CEL expression that may be used to validate the resolved X.509 Subject and/or Subject Alternative Name before a certificate is signed. To see the full allowed syntax and some examples, see https://cloud.google.com/certificate-authority-service/docs/using-cel
650 #[serde(rename = "celExpression")]
651 pub cel_expression: Option<Expr>,
652}
653
654impl common::Part for CertificateIdentityConstraints {}
655
656/// A CertificateRevocationList corresponds to a signed X.509 certificate Revocation List (CRL). A CRL contains the serial numbers of certificates that should no longer be trusted.
657///
658/// # Activities
659///
660/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
661/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
662///
663/// * [locations ca pools certificate authorities certificate revocation lists get projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall) (response)
664/// * [locations ca pools certificate authorities certificate revocation lists patch projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall) (request)
665#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
666#[serde_with::serde_as]
667#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
668pub struct CertificateRevocationList {
669 /// Output only. The location where 'pem_crl' can be accessed.
670 #[serde(rename = "accessUrl")]
671 pub access_url: Option<String>,
672 /// Output only. The time at which this CertificateRevocationList was created.
673 #[serde(rename = "createTime")]
674 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
675 /// Optional. Labels with user-defined metadata.
676 pub labels: Option<HashMap<String, String>>,
677 /// Identifier. The resource name for this CertificateRevocationList in the format `projects/*/locations/*/caPools/*certificateAuthorities/*/ certificateRevocationLists/*`.
678 pub name: Option<String>,
679 /// Output only. The PEM-encoded X.509 CRL.
680 #[serde(rename = "pemCrl")]
681 pub pem_crl: Option<String>,
682 /// Output only. The revision ID of this CertificateRevocationList. A new revision is committed whenever a new CRL is published. The format is an 8-character hexadecimal string.
683 #[serde(rename = "revisionId")]
684 pub revision_id: Option<String>,
685 /// Output only. The revoked serial numbers that appear in pem_crl.
686 #[serde(rename = "revokedCertificates")]
687 pub revoked_certificates: Option<Vec<RevokedCertificate>>,
688 /// Output only. The CRL sequence number that appears in pem_crl.
689 #[serde(rename = "sequenceNumber")]
690 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
691 pub sequence_number: Option<i64>,
692 /// Output only. The State for this CertificateRevocationList.
693 pub state: Option<String>,
694 /// Output only. The time at which this CertificateRevocationList was updated.
695 #[serde(rename = "updateTime")]
696 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
697}
698
699impl common::RequestValue for CertificateRevocationList {}
700impl common::ResponseResult for CertificateRevocationList {}
701
702/// A CertificateTemplate refers to a managed template for certificate issuance.
703///
704/// # Activities
705///
706/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
707/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
708///
709/// * [locations certificate templates create projects](ProjectLocationCertificateTemplateCreateCall) (request)
710/// * [locations certificate templates get projects](ProjectLocationCertificateTemplateGetCall) (response)
711/// * [locations certificate templates patch projects](ProjectLocationCertificateTemplatePatchCall) (request)
712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
713#[serde_with::serde_as]
714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
715pub struct CertificateTemplate {
716 /// Output only. The time at which this CertificateTemplate was created.
717 #[serde(rename = "createTime")]
718 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
719 /// Optional. A human-readable description of scenarios this template is intended for.
720 pub description: Option<String>,
721 /// Optional. Describes constraints on identities that may be appear in Certificates issued using this template. If this is omitted, then this template will not add restrictions on a certificate's identity.
722 #[serde(rename = "identityConstraints")]
723 pub identity_constraints: Option<CertificateIdentityConstraints>,
724 /// Optional. Labels with user-defined metadata.
725 pub labels: Option<HashMap<String, String>>,
726 /// Optional. The maximum lifetime allowed for issued Certificates that use this template. If the issuing CaPool resource's IssuancePolicy specifies a maximum_lifetime the minimum of the two durations will be the maximum lifetime for issued Certificates. Note that if the issuing CertificateAuthority expires before a Certificate's requested maximum_lifetime, the effective lifetime will be explicitly truncated to match it.
727 #[serde(rename = "maximumLifetime")]
728 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
729 pub maximum_lifetime: Option<chrono::Duration>,
730 /// Identifier. The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`.
731 pub name: Option<String>,
732 /// Optional. Describes the set of X.509 extensions that may appear in a Certificate issued using this CertificateTemplate. If a certificate request sets extensions that don't appear in the passthrough_extensions, those extensions will be dropped. If the issuing CaPool's IssuancePolicy defines baseline_values that don't appear here, the certificate issuance request will fail. If this is omitted, then this template will not add restrictions on a certificate's X.509 extensions. These constraints do not apply to X.509 extensions set in this CertificateTemplate's predefined_values.
733 #[serde(rename = "passthroughExtensions")]
734 pub passthrough_extensions: Option<CertificateExtensionConstraints>,
735 /// Optional. A set of X.509 values that will be applied to all issued certificates that use this template. If the certificate request includes conflicting values for the same properties, they will be overwritten by the values defined here. If the issuing CaPool's IssuancePolicy defines conflicting baseline_values for the same properties, the certificate issuance request will fail.
736 #[serde(rename = "predefinedValues")]
737 pub predefined_values: Option<X509Parameters>,
738 /// Output only. The time at which this CertificateTemplate was updated.
739 #[serde(rename = "updateTime")]
740 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
741}
742
743impl common::RequestValue for CertificateTemplate {}
744impl common::ResponseResult for CertificateTemplate {}
745
746/// Request message for CertificateAuthorityService.DisableCertificateAuthority.
747///
748/// # Activities
749///
750/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
751/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
752///
753/// * [locations ca pools certificate authorities disable projects](ProjectLocationCaPoolCertificateAuthorityDisableCall) (request)
754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
755#[serde_with::serde_as]
756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
757pub struct DisableCertificateAuthorityRequest {
758 /// Optional. This field allows this CA to be disabled even if it's being depended on by another resource. However, doing so may result in unintended and unrecoverable effects on any dependent resources since the CA will no longer be able to issue certificates.
759 #[serde(rename = "ignoreDependentResources")]
760 pub ignore_dependent_resources: Option<bool>,
761 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
762 #[serde(rename = "requestId")]
763 pub request_id: Option<String>,
764}
765
766impl common::RequestValue for DisableCertificateAuthorityRequest {}
767
768/// Describes an Elliptic Curve key that may be used in a Certificate issued from a CaPool.
769///
770/// This type is not used in any activity, and only used as *part* of another schema.
771///
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct EcKeyType {
776 /// Optional. A signature algorithm that must be used. If this is omitted, any EC-based signature algorithm will be allowed.
777 #[serde(rename = "signatureAlgorithm")]
778 pub signature_algorithm: Option<String>,
779}
780
781impl common::Part for EcKeyType {}
782
783/// 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); }
784///
785/// # Activities
786///
787/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
788/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
789///
790/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
791/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
793#[serde_with::serde_as]
794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
795pub struct Empty {
796 _never_set: Option<bool>,
797}
798
799impl common::ResponseResult for Empty {}
800
801/// Request message for CertificateAuthorityService.EnableCertificateAuthority.
802///
803/// # Activities
804///
805/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
806/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
807///
808/// * [locations ca pools certificate authorities enable projects](ProjectLocationCaPoolCertificateAuthorityEnableCall) (request)
809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
810#[serde_with::serde_as]
811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
812pub struct EnableCertificateAuthorityRequest {
813 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
814 #[serde(rename = "requestId")]
815 pub request_id: Option<String>,
816}
817
818impl common::RequestValue for EnableCertificateAuthorityRequest {}
819
820/// The configuration used for encrypting data at rest.
821///
822/// This type is not used in any activity, and only used as *part* of another schema.
823///
824#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
825#[serde_with::serde_as]
826#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
827pub struct EncryptionSpec {
828 /// The resource name for a Cloud KMS key in the format `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
829 #[serde(rename = "cloudKmsKey")]
830 pub cloud_kms_key: Option<String>,
831}
832
833impl common::Part for EncryptionSpec {}
834
835/// 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.
836///
837/// This type is not used in any activity, and only used as *part* of another schema.
838///
839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
840#[serde_with::serde_as]
841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
842pub struct Expr {
843 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
844 pub description: Option<String>,
845 /// Textual representation of an expression in Common Expression Language syntax.
846 pub expression: Option<String>,
847 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
848 pub location: Option<String>,
849 /// 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.
850 pub title: Option<String>,
851}
852
853impl common::Part for Expr {}
854
855/// KeyUsage.ExtendedKeyUsageOptions has fields that correspond to certain common OIDs that could be specified as an extended key usage value.
856///
857/// This type is not used in any activity, and only used as *part* of another schema.
858///
859#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
860#[serde_with::serde_as]
861#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
862pub struct ExtendedKeyUsageOptions {
863 /// Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW client authentication", though regularly used for non-WWW TLS.
864 #[serde(rename = "clientAuth")]
865 pub client_auth: Option<bool>,
866 /// Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of downloadable executable code client authentication".
867 #[serde(rename = "codeSigning")]
868 pub code_signing: Option<bool>,
869 /// Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email protection".
870 #[serde(rename = "emailProtection")]
871 pub email_protection: Option<bool>,
872 /// Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing OCSP responses".
873 #[serde(rename = "ocspSigning")]
874 pub ocsp_signing: Option<bool>,
875 /// Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW server authentication", though regularly used for non-WWW TLS.
876 #[serde(rename = "serverAuth")]
877 pub server_auth: Option<bool>,
878 /// Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding the hash of an object to a time".
879 #[serde(rename = "timeStamping")]
880 pub time_stamping: Option<bool>,
881}
882
883impl common::Part for ExtendedKeyUsageOptions {}
884
885/// Request message for CertificateAuthorityService.FetchCaCerts.
886///
887/// # Activities
888///
889/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
890/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
891///
892/// * [locations ca pools fetch ca certs projects](ProjectLocationCaPoolFetchCaCertCall) (request)
893#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
894#[serde_with::serde_as]
895#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
896pub struct FetchCaCertsRequest {
897 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
898 #[serde(rename = "requestId")]
899 pub request_id: Option<String>,
900}
901
902impl common::RequestValue for FetchCaCertsRequest {}
903
904/// Response message for CertificateAuthorityService.FetchCaCerts.
905///
906/// # Activities
907///
908/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
909/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
910///
911/// * [locations ca pools fetch ca certs projects](ProjectLocationCaPoolFetchCaCertCall) (response)
912#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
913#[serde_with::serde_as]
914#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
915pub struct FetchCaCertsResponse {
916 /// The PEM encoded CA certificate chains of all certificate authorities in this CaPool in the ENABLED, DISABLED, or STAGED states.
917 #[serde(rename = "caCerts")]
918 pub ca_certs: Option<Vec<CertChain>>,
919}
920
921impl common::ResponseResult for FetchCaCertsResponse {}
922
923/// Response message for CertificateAuthorityService.FetchCertificateAuthorityCsr.
924///
925/// # Activities
926///
927/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
928/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
929///
930/// * [locations ca pools certificate authorities fetch projects](ProjectLocationCaPoolCertificateAuthorityFetchCall) (response)
931#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
932#[serde_with::serde_as]
933#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
934pub struct FetchCertificateAuthorityCsrResponse {
935 /// Output only. The PEM-encoded signed certificate signing request (CSR).
936 #[serde(rename = "pemCsr")]
937 pub pem_csr: Option<String>,
938}
939
940impl common::ResponseResult for FetchCertificateAuthorityCsrResponse {}
941
942/// IssuanceModes specifies the allowed ways in which Certificates may be requested from this CaPool.
943///
944/// This type is not used in any activity, and only used as *part* of another schema.
945///
946#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
947#[serde_with::serde_as]
948#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
949pub struct IssuanceModes {
950 /// Optional. When true, allows callers to create Certificates by specifying a CertificateConfig.
951 #[serde(rename = "allowConfigBasedIssuance")]
952 pub allow_config_based_issuance: Option<bool>,
953 /// Optional. When true, allows callers to create Certificates by specifying a CSR.
954 #[serde(rename = "allowCsrBasedIssuance")]
955 pub allow_csr_based_issuance: Option<bool>,
956}
957
958impl common::Part for IssuanceModes {}
959
960/// Defines controls over all certificate issuance within a CaPool.
961///
962/// This type is not used in any activity, and only used as *part* of another schema.
963///
964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
965#[serde_with::serde_as]
966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
967pub struct IssuancePolicy {
968 /// Optional. If specified, then only methods allowed in the IssuanceModes may be used to issue Certificates.
969 #[serde(rename = "allowedIssuanceModes")]
970 pub allowed_issuance_modes: Option<IssuanceModes>,
971 /// Optional. If any AllowedKeyType is specified, then the certificate request's public key must match one of the key types listed here. Otherwise, any key may be used.
972 #[serde(rename = "allowedKeyTypes")]
973 pub allowed_key_types: Option<Vec<AllowedKeyType>>,
974 /// Optional. The duration to backdate all certificates issued from this CaPool. If not set, the certificates will be issued with a not_before_time of the issuance time (i.e. the current time). If set, the certificates will be issued with a not_before_time of the issuance time minus the backdate_duration. The not_after_time will be adjusted to preserve the requested lifetime. The backdate_duration must be less than or equal to 48 hours.
975 #[serde(rename = "backdateDuration")]
976 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
977 pub backdate_duration: Option<chrono::Duration>,
978 /// Optional. A set of X.509 values that will be applied to all certificates issued through this CaPool. If a certificate request includes conflicting values for the same properties, they will be overwritten by the values defined here. If a certificate request uses a CertificateTemplate that defines conflicting predefined_values for the same properties, the certificate issuance request will fail.
979 #[serde(rename = "baselineValues")]
980 pub baseline_values: Option<X509Parameters>,
981 /// Optional. Describes constraints on identities that may appear in Certificates issued through this CaPool. If this is omitted, then this CaPool will not add restrictions on a certificate's identity.
982 #[serde(rename = "identityConstraints")]
983 pub identity_constraints: Option<CertificateIdentityConstraints>,
984 /// Optional. The maximum lifetime allowed for issued Certificates. Note that if the issuing CertificateAuthority expires before a Certificate resource's requested maximum_lifetime, the effective lifetime will be explicitly truncated to match it.
985 #[serde(rename = "maximumLifetime")]
986 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
987 pub maximum_lifetime: Option<chrono::Duration>,
988 /// Optional. Describes the set of X.509 extensions that may appear in a Certificate issued through this CaPool. If a certificate request sets extensions that don't appear in the passthrough_extensions, those extensions will be dropped. If a certificate request uses a CertificateTemplate with predefined_values that don't appear here, the certificate issuance request will fail. If this is omitted, then this CaPool will not add restrictions on a certificate's X.509 extensions. These constraints do not apply to X.509 extensions set in this CaPool's baseline_values.
989 #[serde(rename = "passthroughExtensions")]
990 pub passthrough_extensions: Option<CertificateExtensionConstraints>,
991}
992
993impl common::Part for IssuancePolicy {}
994
995/// A KeyId identifies a specific public key, usually by hashing the public key.
996///
997/// This type is not used in any activity, and only used as *part* of another schema.
998///
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct KeyId {
1003 /// Optional. The value of this KeyId encoded in lowercase hexadecimal. This is most likely the 160 bit SHA-1 hash of the public key.
1004 #[serde(rename = "keyId")]
1005 pub key_id: Option<String>,
1006}
1007
1008impl common::Part for KeyId {}
1009
1010/// A KeyUsage describes key usage values that may appear in an X.509 certificate.
1011///
1012/// This type is not used in any activity, and only used as *part* of another schema.
1013///
1014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1015#[serde_with::serde_as]
1016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1017pub struct KeyUsage {
1018 /// Describes high-level ways in which a key may be used.
1019 #[serde(rename = "baseKeyUsage")]
1020 pub base_key_usage: Option<KeyUsageOptions>,
1021 /// Detailed scenarios in which a key may be used.
1022 #[serde(rename = "extendedKeyUsage")]
1023 pub extended_key_usage: Option<ExtendedKeyUsageOptions>,
1024 /// Used to describe extended key usages that are not listed in the KeyUsage.ExtendedKeyUsageOptions message.
1025 #[serde(rename = "unknownExtendedKeyUsages")]
1026 pub unknown_extended_key_usages: Option<Vec<ObjectId>>,
1027}
1028
1029impl common::Part for KeyUsage {}
1030
1031/// KeyUsage.KeyUsageOptions corresponds to the key usage values described in https://tools.ietf.org/html/rfc5280#section-4.2.1.3.
1032///
1033/// This type is not used in any activity, and only used as *part* of another schema.
1034///
1035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1036#[serde_with::serde_as]
1037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1038pub struct KeyUsageOptions {
1039 /// The key may be used to sign certificates.
1040 #[serde(rename = "certSign")]
1041 pub cert_sign: Option<bool>,
1042 /// The key may be used for cryptographic commitments. Note that this may also be referred to as "non-repudiation".
1043 #[serde(rename = "contentCommitment")]
1044 pub content_commitment: Option<bool>,
1045 /// The key may be used sign certificate revocation lists.
1046 #[serde(rename = "crlSign")]
1047 pub crl_sign: Option<bool>,
1048 /// The key may be used to encipher data.
1049 #[serde(rename = "dataEncipherment")]
1050 pub data_encipherment: Option<bool>,
1051 /// The key may be used to decipher only.
1052 #[serde(rename = "decipherOnly")]
1053 pub decipher_only: Option<bool>,
1054 /// The key may be used for digital signatures.
1055 #[serde(rename = "digitalSignature")]
1056 pub digital_signature: Option<bool>,
1057 /// The key may be used to encipher only.
1058 #[serde(rename = "encipherOnly")]
1059 pub encipher_only: Option<bool>,
1060 /// The key may be used in a key agreement protocol.
1061 #[serde(rename = "keyAgreement")]
1062 pub key_agreement: Option<bool>,
1063 /// The key may be used to encipher other keys.
1064 #[serde(rename = "keyEncipherment")]
1065 pub key_encipherment: Option<bool>,
1066}
1067
1068impl common::Part for KeyUsageOptions {}
1069
1070/// A Cloud KMS key configuration that a CertificateAuthority will use.
1071///
1072/// This type is not used in any activity, and only used as *part* of another schema.
1073///
1074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1075#[serde_with::serde_as]
1076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1077pub struct KeyVersionSpec {
1078 /// The algorithm to use for creating a managed Cloud KMS key for a for a simplified experience. All managed keys will be have their ProtectionLevel as `HSM`.
1079 pub algorithm: Option<String>,
1080 /// The resource name for an existing Cloud KMS CryptoKeyVersion in the format `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. This option enables full flexibility in the key's capabilities and properties.
1081 #[serde(rename = "cloudKmsKeyVersion")]
1082 pub cloud_kms_key_version: Option<String>,
1083}
1084
1085impl common::Part for KeyVersionSpec {}
1086
1087/// Response message for CertificateAuthorityService.ListCaPools.
1088///
1089/// # Activities
1090///
1091/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1092/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1093///
1094/// * [locations ca pools list projects](ProjectLocationCaPoolListCall) (response)
1095#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1096#[serde_with::serde_as]
1097#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1098pub struct ListCaPoolsResponse {
1099 /// The list of CaPools.
1100 #[serde(rename = "caPools")]
1101 pub ca_pools: Option<Vec<CaPool>>,
1102 /// A token to retrieve next page of results. Pass this value in ListCertificateAuthoritiesRequest.page_token to retrieve the next page of results.
1103 #[serde(rename = "nextPageToken")]
1104 pub next_page_token: Option<String>,
1105 /// A list of locations (e.g. "us-west1") that could not be reached.
1106 pub unreachable: Option<Vec<String>>,
1107}
1108
1109impl common::ResponseResult for ListCaPoolsResponse {}
1110
1111/// Response message for CertificateAuthorityService.ListCertificateAuthorities.
1112///
1113/// # Activities
1114///
1115/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1116/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1117///
1118/// * [locations ca pools certificate authorities list projects](ProjectLocationCaPoolCertificateAuthorityListCall) (response)
1119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1120#[serde_with::serde_as]
1121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1122pub struct ListCertificateAuthoritiesResponse {
1123 /// The list of CertificateAuthorities.
1124 #[serde(rename = "certificateAuthorities")]
1125 pub certificate_authorities: Option<Vec<CertificateAuthority>>,
1126 /// A token to retrieve next page of results. Pass this value in ListCertificateAuthoritiesRequest.page_token to retrieve the next page of results.
1127 #[serde(rename = "nextPageToken")]
1128 pub next_page_token: Option<String>,
1129 /// A list of locations (e.g. "us-west1") that could not be reached.
1130 pub unreachable: Option<Vec<String>>,
1131}
1132
1133impl common::ResponseResult for ListCertificateAuthoritiesResponse {}
1134
1135/// Response message for CertificateAuthorityService.ListCertificateRevocationLists.
1136///
1137/// # Activities
1138///
1139/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1140/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1141///
1142/// * [locations ca pools certificate authorities certificate revocation lists list projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall) (response)
1143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1144#[serde_with::serde_as]
1145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1146pub struct ListCertificateRevocationListsResponse {
1147 /// The list of CertificateRevocationLists.
1148 #[serde(rename = "certificateRevocationLists")]
1149 pub certificate_revocation_lists: Option<Vec<CertificateRevocationList>>,
1150 /// A token to retrieve next page of results. Pass this value in ListCertificateRevocationListsRequest.page_token to retrieve the next page of results.
1151 #[serde(rename = "nextPageToken")]
1152 pub next_page_token: Option<String>,
1153 /// A list of locations (e.g. "us-west1") that could not be reached.
1154 pub unreachable: Option<Vec<String>>,
1155}
1156
1157impl common::ResponseResult for ListCertificateRevocationListsResponse {}
1158
1159/// Response message for CertificateAuthorityService.ListCertificateTemplates.
1160///
1161/// # Activities
1162///
1163/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1164/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1165///
1166/// * [locations certificate templates list projects](ProjectLocationCertificateTemplateListCall) (response)
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct ListCertificateTemplatesResponse {
1171 /// The list of CertificateTemplates.
1172 #[serde(rename = "certificateTemplates")]
1173 pub certificate_templates: Option<Vec<CertificateTemplate>>,
1174 /// A token to retrieve next page of results. Pass this value in ListCertificateTemplatesRequest.page_token to retrieve the next page of results.
1175 #[serde(rename = "nextPageToken")]
1176 pub next_page_token: Option<String>,
1177 /// A list of locations (e.g. "us-west1") that could not be reached.
1178 pub unreachable: Option<Vec<String>>,
1179}
1180
1181impl common::ResponseResult for ListCertificateTemplatesResponse {}
1182
1183/// Response message for CertificateAuthorityService.ListCertificates.
1184///
1185/// # Activities
1186///
1187/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1188/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1189///
1190/// * [locations ca pools certificates list projects](ProjectLocationCaPoolCertificateListCall) (response)
1191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1192#[serde_with::serde_as]
1193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1194pub struct ListCertificatesResponse {
1195 /// The list of Certificates.
1196 pub certificates: Option<Vec<Certificate>>,
1197 /// A token to retrieve next page of results. Pass this value in ListCertificatesRequest.page_token to retrieve the next page of results.
1198 #[serde(rename = "nextPageToken")]
1199 pub next_page_token: Option<String>,
1200 /// A list of locations (e.g. "us-west1") that could not be reached.
1201 pub unreachable: Option<Vec<String>>,
1202}
1203
1204impl common::ResponseResult for ListCertificatesResponse {}
1205
1206/// The response message for Locations.ListLocations.
1207///
1208/// # Activities
1209///
1210/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1211/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1212///
1213/// * [locations list projects](ProjectLocationListCall) (response)
1214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1215#[serde_with::serde_as]
1216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1217pub struct ListLocationsResponse {
1218 /// A list of locations that matches the specified filter in the request.
1219 pub locations: Option<Vec<Location>>,
1220 /// The standard List next-page token.
1221 #[serde(rename = "nextPageToken")]
1222 pub next_page_token: Option<String>,
1223}
1224
1225impl common::ResponseResult for ListLocationsResponse {}
1226
1227/// The response message for Operations.ListOperations.
1228///
1229/// # Activities
1230///
1231/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1232/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1233///
1234/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1236#[serde_with::serde_as]
1237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1238pub struct ListOperationsResponse {
1239 /// The standard List next-page token.
1240 #[serde(rename = "nextPageToken")]
1241 pub next_page_token: Option<String>,
1242 /// A list of operations that matches the specified filter in the request.
1243 pub operations: Option<Vec<Operation>>,
1244 /// 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.
1245 pub unreachable: Option<Vec<String>>,
1246}
1247
1248impl common::ResponseResult for ListOperationsResponse {}
1249
1250/// A resource that represents a Google Cloud location.
1251///
1252/// # Activities
1253///
1254/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1255/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1256///
1257/// * [locations get projects](ProjectLocationGetCall) (response)
1258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1259#[serde_with::serde_as]
1260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1261pub struct Location {
1262 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1263 #[serde(rename = "displayName")]
1264 pub display_name: Option<String>,
1265 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1266 pub labels: Option<HashMap<String, String>>,
1267 /// The canonical id for this location. For example: `"us-east1"`.
1268 #[serde(rename = "locationId")]
1269 pub location_id: Option<String>,
1270 /// Service-specific metadata. For example the available capacity at the given location.
1271 pub metadata: Option<HashMap<String, serde_json::Value>>,
1272 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1273 pub name: Option<String>,
1274}
1275
1276impl common::ResponseResult for Location {}
1277
1278/// Describes the X.509 name constraints extension, per https://tools.ietf.org/html/rfc5280#section-4.2.1.10
1279///
1280/// This type is not used in any activity, and only used as *part* of another schema.
1281///
1282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1283#[serde_with::serde_as]
1284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1285pub struct NameConstraints {
1286 /// Indicates whether or not the name constraints are marked critical.
1287 pub critical: Option<bool>,
1288 /// Contains excluded DNS names. Any DNS name that can be constructed by simply adding zero or more labels to the left-hand side of the name satisfies the name constraint. For example, `example.com`, `www.example.com`, `www.sub.example.com` would satisfy `example.com` while `example1.com` does not.
1289 #[serde(rename = "excludedDnsNames")]
1290 pub excluded_dns_names: Option<Vec<String>>,
1291 /// Contains the excluded email addresses. The value can be a particular email address, a hostname to indicate all email addresses on that host or a domain with a leading period (e.g. `.example.com`) to indicate all email addresses in that domain.
1292 #[serde(rename = "excludedEmailAddresses")]
1293 pub excluded_email_addresses: Option<Vec<String>>,
1294 /// Contains the excluded IP ranges. For IPv4 addresses, the ranges are expressed using CIDR notation as specified in RFC 4632. For IPv6 addresses, the ranges are expressed in similar encoding as IPv4 addresses.
1295 #[serde(rename = "excludedIpRanges")]
1296 pub excluded_ip_ranges: Option<Vec<String>>,
1297 /// Contains the excluded URIs that apply to the host part of the name. The value can be a hostname or a domain with a leading period (like `.example.com`)
1298 #[serde(rename = "excludedUris")]
1299 pub excluded_uris: Option<Vec<String>>,
1300 /// Contains permitted DNS names. Any DNS name that can be constructed by simply adding zero or more labels to the left-hand side of the name satisfies the name constraint. For example, `example.com`, `www.example.com`, `www.sub.example.com` would satisfy `example.com` while `example1.com` does not.
1301 #[serde(rename = "permittedDnsNames")]
1302 pub permitted_dns_names: Option<Vec<String>>,
1303 /// Contains the permitted email addresses. The value can be a particular email address, a hostname to indicate all email addresses on that host or a domain with a leading period (e.g. `.example.com`) to indicate all email addresses in that domain.
1304 #[serde(rename = "permittedEmailAddresses")]
1305 pub permitted_email_addresses: Option<Vec<String>>,
1306 /// Contains the permitted IP ranges. For IPv4 addresses, the ranges are expressed using CIDR notation as specified in RFC 4632. For IPv6 addresses, the ranges are expressed in similar encoding as IPv4 addresses.
1307 #[serde(rename = "permittedIpRanges")]
1308 pub permitted_ip_ranges: Option<Vec<String>>,
1309 /// Contains the permitted URIs that apply to the host part of the name. The value can be a hostname or a domain with a leading period (like `.example.com`)
1310 #[serde(rename = "permittedUris")]
1311 pub permitted_uris: Option<Vec<String>>,
1312}
1313
1314impl common::Part for NameConstraints {}
1315
1316/// An ObjectId specifies an object identifier (OID). These provide context and describe types in ASN.1 messages.
1317///
1318/// This type is not used in any activity, and only used as *part* of another schema.
1319///
1320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1321#[serde_with::serde_as]
1322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1323pub struct ObjectId {
1324 /// Required. The parts of an OID path. The most significant parts of the path come first.
1325 #[serde(rename = "objectIdPath")]
1326 pub object_id_path: Option<Vec<i32>>,
1327}
1328
1329impl common::Part for ObjectId {}
1330
1331/// This resource represents a long-running operation that is the result of a network API call.
1332///
1333/// # Activities
1334///
1335/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1336/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1337///
1338/// * [locations ca pools certificate authorities certificate revocation lists patch projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall) (response)
1339/// * [locations ca pools certificate authorities activate projects](ProjectLocationCaPoolCertificateAuthorityActivateCall) (response)
1340/// * [locations ca pools certificate authorities create projects](ProjectLocationCaPoolCertificateAuthorityCreateCall) (response)
1341/// * [locations ca pools certificate authorities delete projects](ProjectLocationCaPoolCertificateAuthorityDeleteCall) (response)
1342/// * [locations ca pools certificate authorities disable projects](ProjectLocationCaPoolCertificateAuthorityDisableCall) (response)
1343/// * [locations ca pools certificate authorities enable projects](ProjectLocationCaPoolCertificateAuthorityEnableCall) (response)
1344/// * [locations ca pools certificate authorities patch projects](ProjectLocationCaPoolCertificateAuthorityPatchCall) (response)
1345/// * [locations ca pools certificate authorities undelete projects](ProjectLocationCaPoolCertificateAuthorityUndeleteCall) (response)
1346/// * [locations ca pools create projects](ProjectLocationCaPoolCreateCall) (response)
1347/// * [locations ca pools delete projects](ProjectLocationCaPoolDeleteCall) (response)
1348/// * [locations ca pools patch projects](ProjectLocationCaPoolPatchCall) (response)
1349/// * [locations certificate templates create projects](ProjectLocationCertificateTemplateCreateCall) (response)
1350/// * [locations certificate templates delete projects](ProjectLocationCertificateTemplateDeleteCall) (response)
1351/// * [locations certificate templates patch projects](ProjectLocationCertificateTemplatePatchCall) (response)
1352/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1354#[serde_with::serde_as]
1355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1356pub struct Operation {
1357 /// 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.
1358 pub done: Option<bool>,
1359 /// The error result of the operation in case of failure or cancellation.
1360 pub error: Option<Status>,
1361 /// 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.
1362 pub metadata: Option<HashMap<String, serde_json::Value>>,
1363 /// 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}`.
1364 pub name: Option<String>,
1365 /// 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`.
1366 pub response: Option<HashMap<String, serde_json::Value>>,
1367}
1368
1369impl common::ResponseResult for Operation {}
1370
1371/// 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/).
1372///
1373/// # Activities
1374///
1375/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1376/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1377///
1378/// * [locations ca pools certificate authorities certificate revocation lists get iam policy projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall) (response)
1379/// * [locations ca pools certificate authorities certificate revocation lists set iam policy projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall) (response)
1380/// * [locations ca pools get iam policy projects](ProjectLocationCaPoolGetIamPolicyCall) (response)
1381/// * [locations ca pools set iam policy projects](ProjectLocationCaPoolSetIamPolicyCall) (response)
1382/// * [locations certificate templates get iam policy projects](ProjectLocationCertificateTemplateGetIamPolicyCall) (response)
1383/// * [locations certificate templates set iam policy projects](ProjectLocationCertificateTemplateSetIamPolicyCall) (response)
1384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1385#[serde_with::serde_as]
1386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1387pub struct Policy {
1388 /// Specifies cloud audit logging configuration for this policy.
1389 #[serde(rename = "auditConfigs")]
1390 pub audit_configs: Option<Vec<AuditConfig>>,
1391 /// 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`.
1392 pub bindings: Option<Vec<Binding>>,
1393 /// `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.
1394 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1395 pub etag: Option<Vec<u8>>,
1396 /// 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).
1397 pub version: Option<i32>,
1398}
1399
1400impl common::ResponseResult for Policy {}
1401
1402/// A PublicKey describes a public key.
1403///
1404/// This type is not used in any activity, and only used as *part* of another schema.
1405///
1406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1407#[serde_with::serde_as]
1408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1409pub struct PublicKey {
1410 /// Required. The format of the public key.
1411 pub format: Option<String>,
1412 /// Required. A public key. The padding and encoding must match with the `KeyFormat` value specified for the `format` field.
1413 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1414 pub key: Option<Vec<u8>>,
1415}
1416
1417impl common::Part for PublicKey {}
1418
1419/// Options relating to the publication of each CertificateAuthority's CA certificate and CRLs and their inclusion as extensions in issued Certificates. The options set here apply to certificates issued by any CertificateAuthority in the CaPool.
1420///
1421/// This type is not used in any activity, and only used as *part* of another schema.
1422///
1423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1424#[serde_with::serde_as]
1425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1426pub struct PublishingOptions {
1427 /// Optional. Specifies the encoding format of each CertificateAuthority resource's CA certificate and CRLs. If this is omitted, CA certificates and CRLs will be published in PEM.
1428 #[serde(rename = "encodingFormat")]
1429 pub encoding_format: Option<String>,
1430 /// Optional. When true, publishes each CertificateAuthority's CA certificate and includes its URL in the "Authority Information Access" X.509 extension in all issued Certificates. If this is false, the CA certificate will not be published and the corresponding X.509 extension will not be written in issued certificates.
1431 #[serde(rename = "publishCaCert")]
1432 pub publish_ca_cert: Option<bool>,
1433 /// Optional. When true, publishes each CertificateAuthority's CRL and includes its URL in the "CRL Distribution Points" X.509 extension in all issued Certificates. If this is false, CRLs will not be published and the corresponding X.509 extension will not be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are also rebuilt shortly after a certificate is revoked.
1434 #[serde(rename = "publishCrl")]
1435 pub publish_crl: Option<bool>,
1436}
1437
1438impl common::Part for PublishingOptions {}
1439
1440/// RelativeDistinguishedName specifies a relative distinguished name which will be used to build a distinguished name.
1441///
1442/// This type is not used in any activity, and only used as *part* of another schema.
1443///
1444#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1445#[serde_with::serde_as]
1446#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1447pub struct RelativeDistinguishedName {
1448 /// Attributes describes the attribute value assertions in the RDN.
1449 pub attributes: Option<Vec<AttributeTypeAndValue>>,
1450}
1451
1452impl common::Part for RelativeDistinguishedName {}
1453
1454/// Describes fields that are relavent to the revocation of a Certificate.
1455///
1456/// This type is not used in any activity, and only used as *part* of another schema.
1457///
1458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1459#[serde_with::serde_as]
1460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1461pub struct RevocationDetails {
1462 /// Indicates why a Certificate was revoked.
1463 #[serde(rename = "revocationState")]
1464 pub revocation_state: Option<String>,
1465 /// The time at which this Certificate was revoked.
1466 #[serde(rename = "revocationTime")]
1467 pub revocation_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1468}
1469
1470impl common::Part for RevocationDetails {}
1471
1472/// Request message for CertificateAuthorityService.RevokeCertificate.
1473///
1474/// # Activities
1475///
1476/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1477/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1478///
1479/// * [locations ca pools certificates revoke projects](ProjectLocationCaPoolCertificateRevokeCall) (request)
1480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1481#[serde_with::serde_as]
1482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1483pub struct RevokeCertificateRequest {
1484 /// Required. The RevocationReason for revoking this certificate.
1485 pub reason: Option<String>,
1486 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
1487 #[serde(rename = "requestId")]
1488 pub request_id: Option<String>,
1489}
1490
1491impl common::RequestValue for RevokeCertificateRequest {}
1492
1493/// Describes a revoked Certificate.
1494///
1495/// This type is not used in any activity, and only used as *part* of another schema.
1496///
1497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1498#[serde_with::serde_as]
1499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1500pub struct RevokedCertificate {
1501 /// The resource name for the Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
1502 pub certificate: Option<String>,
1503 /// The serial number of the Certificate.
1504 #[serde(rename = "hexSerialNumber")]
1505 pub hex_serial_number: Option<String>,
1506 /// The reason the Certificate was revoked.
1507 #[serde(rename = "revocationReason")]
1508 pub revocation_reason: Option<String>,
1509}
1510
1511impl common::Part for RevokedCertificate {}
1512
1513/// Describes an RSA key that may be used in a Certificate issued from a CaPool.
1514///
1515/// This type is not used in any activity, and only used as *part* of another schema.
1516///
1517#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1518#[serde_with::serde_as]
1519#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1520pub struct RsaKeyType {
1521 /// Optional. The maximum allowed RSA modulus size (inclusive), in bits. If this is not set, or if set to zero, the service will not enforce an explicit upper bound on RSA modulus sizes.
1522 #[serde(rename = "maxModulusSize")]
1523 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1524 pub max_modulus_size: Option<i64>,
1525 /// Optional. The minimum allowed RSA modulus size (inclusive), in bits. If this is not set, or if set to zero, the service-level min RSA modulus size will continue to apply.
1526 #[serde(rename = "minModulusSize")]
1527 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1528 pub min_modulus_size: Option<i64>,
1529}
1530
1531impl common::Part for RsaKeyType {}
1532
1533/// Request message for `SetIamPolicy` method.
1534///
1535/// # Activities
1536///
1537/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1538/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1539///
1540/// * [locations ca pools certificate authorities certificate revocation lists set iam policy projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall) (request)
1541/// * [locations ca pools set iam policy projects](ProjectLocationCaPoolSetIamPolicyCall) (request)
1542/// * [locations certificate templates set iam policy projects](ProjectLocationCertificateTemplateSetIamPolicyCall) (request)
1543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1544#[serde_with::serde_as]
1545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1546pub struct SetIamPolicyRequest {
1547 /// 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.
1548 pub policy: Option<Policy>,
1549 /// 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"`
1550 #[serde(rename = "updateMask")]
1551 pub update_mask: Option<common::FieldMask>,
1552}
1553
1554impl common::RequestValue for SetIamPolicyRequest {}
1555
1556/// 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).
1557///
1558/// This type is not used in any activity, and only used as *part* of another schema.
1559///
1560#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1561#[serde_with::serde_as]
1562#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1563pub struct Status {
1564 /// The status code, which should be an enum value of google.rpc.Code.
1565 pub code: Option<i32>,
1566 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1567 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1568 /// 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.
1569 pub message: Option<String>,
1570}
1571
1572impl common::Part for Status {}
1573
1574/// Subject describes parts of a distinguished name that, in turn, describes the subject of the certificate.
1575///
1576/// This type is not used in any activity, and only used as *part* of another schema.
1577///
1578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1579#[serde_with::serde_as]
1580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1581pub struct Subject {
1582 /// The "common name" of the subject.
1583 #[serde(rename = "commonName")]
1584 pub common_name: Option<String>,
1585 /// The country code of the subject.
1586 #[serde(rename = "countryCode")]
1587 pub country_code: Option<String>,
1588 /// The locality or city of the subject.
1589 pub locality: Option<String>,
1590 /// The organization of the subject.
1591 pub organization: Option<String>,
1592 /// The organizational_unit of the subject.
1593 #[serde(rename = "organizationalUnit")]
1594 pub organizational_unit: Option<String>,
1595 /// The postal code of the subject.
1596 #[serde(rename = "postalCode")]
1597 pub postal_code: Option<String>,
1598 /// The province, territory, or regional state of the subject.
1599 pub province: Option<String>,
1600 /// This field can be used in place of the named subject fields.
1601 #[serde(rename = "rdnSequence")]
1602 pub rdn_sequence: Option<Vec<RelativeDistinguishedName>>,
1603 /// The street address of the subject.
1604 #[serde(rename = "streetAddress")]
1605 pub street_address: Option<String>,
1606}
1607
1608impl common::Part for Subject {}
1609
1610/// SubjectAltNames corresponds to a more modern way of listing what the asserted identity is in a certificate (i.e., compared to the "common name" in the distinguished name).
1611///
1612/// This type is not used in any activity, and only used as *part* of another schema.
1613///
1614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1615#[serde_with::serde_as]
1616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1617pub struct SubjectAltNames {
1618 /// Contains additional subject alternative name values. For each custom_san, the `value` field must contain an ASN.1 encoded UTF8String.
1619 #[serde(rename = "customSans")]
1620 pub custom_sans: Option<Vec<X509Extension>>,
1621 /// Contains only valid, fully-qualified host names.
1622 #[serde(rename = "dnsNames")]
1623 pub dns_names: Option<Vec<String>>,
1624 /// Contains only valid RFC 2822 E-mail addresses.
1625 #[serde(rename = "emailAddresses")]
1626 pub email_addresses: Option<Vec<String>>,
1627 /// Contains only valid 32-bit IPv4 addresses or RFC 4291 IPv6 addresses.
1628 #[serde(rename = "ipAddresses")]
1629 pub ip_addresses: Option<Vec<String>>,
1630 /// Contains only valid RFC 3986 URIs.
1631 pub uris: Option<Vec<String>>,
1632}
1633
1634impl common::Part for SubjectAltNames {}
1635
1636/// These values are used to create the distinguished name and subject alternative name fields in an X.509 certificate.
1637///
1638/// This type is not used in any activity, and only used as *part* of another schema.
1639///
1640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1641#[serde_with::serde_as]
1642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1643pub struct SubjectConfig {
1644 /// Optional. Contains distinguished name fields such as the common name, location and organization.
1645 pub subject: Option<Subject>,
1646 /// Optional. The subject alternative name fields.
1647 #[serde(rename = "subjectAltName")]
1648 pub subject_alt_name: Option<SubjectAltNames>,
1649}
1650
1651impl common::Part for SubjectConfig {}
1652
1653/// These values describe fields in an issued X.509 certificate such as the distinguished name, subject alternative names, serial number, and lifetime.
1654///
1655/// This type is not used in any activity, and only used as *part* of another schema.
1656///
1657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1658#[serde_with::serde_as]
1659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1660pub struct SubjectDescription {
1661 /// The serial number encoded in lowercase hexadecimal.
1662 #[serde(rename = "hexSerialNumber")]
1663 pub hex_serial_number: Option<String>,
1664 /// For convenience, the actual lifetime of an issued certificate.
1665 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1666 pub lifetime: Option<chrono::Duration>,
1667 /// The time after which the certificate is expired. Per RFC 5280, the validity period for a certificate is the period of time from not_before_time through not_after_time, inclusive. Corresponds to 'not_before_time' + 'lifetime' - 1 second.
1668 #[serde(rename = "notAfterTime")]
1669 pub not_after_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1670 /// The time at which the certificate becomes valid.
1671 #[serde(rename = "notBeforeTime")]
1672 pub not_before_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1673 /// Contains distinguished name fields such as the common name, location and / organization.
1674 pub subject: Option<Subject>,
1675 /// The subject alternative name fields.
1676 #[serde(rename = "subjectAltName")]
1677 pub subject_alt_name: Option<SubjectAltNames>,
1678}
1679
1680impl common::Part for SubjectDescription {}
1681
1682/// Describes a subordinate CA's issuers. This is either a resource name to a known issuing CertificateAuthority, or a PEM issuer certificate chain.
1683///
1684/// This type is not used in any activity, and only used as *part* of another schema.
1685///
1686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1687#[serde_with::serde_as]
1688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1689pub struct SubordinateConfig {
1690 /// Required. This can refer to a CertificateAuthority that was used to create a subordinate CertificateAuthority. This field is used for information and usability purposes only. The resource name is in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
1691 #[serde(rename = "certificateAuthority")]
1692 pub certificate_authority: Option<String>,
1693 /// Required. Contains the PEM certificate chain for the issuers of this CertificateAuthority, but not pem certificate for this CA itself.
1694 #[serde(rename = "pemIssuerChain")]
1695 pub pem_issuer_chain: Option<SubordinateConfigChain>,
1696}
1697
1698impl common::Part for SubordinateConfig {}
1699
1700/// This message describes a subordinate CA's issuer certificate chain. This wrapper exists for compatibility reasons.
1701///
1702/// This type is not used in any activity, and only used as *part* of another schema.
1703///
1704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1705#[serde_with::serde_as]
1706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1707pub struct SubordinateConfigChain {
1708 /// Required. Expected to be in leaf-to-root order according to RFC 5246.
1709 #[serde(rename = "pemCertificates")]
1710 pub pem_certificates: Option<Vec<String>>,
1711}
1712
1713impl common::Part for SubordinateConfigChain {}
1714
1715/// Request message for `TestIamPermissions` method.
1716///
1717/// # Activities
1718///
1719/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1720/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1721///
1722/// * [locations ca pools certificate authorities certificate revocation lists test iam permissions projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall) (request)
1723/// * [locations ca pools test iam permissions projects](ProjectLocationCaPoolTestIamPermissionCall) (request)
1724/// * [locations certificate templates test iam permissions projects](ProjectLocationCertificateTemplateTestIamPermissionCall) (request)
1725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1726#[serde_with::serde_as]
1727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1728pub struct TestIamPermissionsRequest {
1729 /// 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).
1730 pub permissions: Option<Vec<String>>,
1731}
1732
1733impl common::RequestValue for TestIamPermissionsRequest {}
1734
1735/// Response message for `TestIamPermissions` method.
1736///
1737/// # Activities
1738///
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741///
1742/// * [locations ca pools certificate authorities certificate revocation lists test iam permissions projects](ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall) (response)
1743/// * [locations ca pools test iam permissions projects](ProjectLocationCaPoolTestIamPermissionCall) (response)
1744/// * [locations certificate templates test iam permissions projects](ProjectLocationCertificateTemplateTestIamPermissionCall) (response)
1745#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1746#[serde_with::serde_as]
1747#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1748pub struct TestIamPermissionsResponse {
1749 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1750 pub permissions: Option<Vec<String>>,
1751}
1752
1753impl common::ResponseResult for TestIamPermissionsResponse {}
1754
1755/// Request message for CertificateAuthorityService.UndeleteCertificateAuthority.
1756///
1757/// # Activities
1758///
1759/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1760/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1761///
1762/// * [locations ca pools certificate authorities undelete projects](ProjectLocationCaPoolCertificateAuthorityUndeleteCall) (request)
1763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1764#[serde_with::serde_as]
1765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1766pub struct UndeleteCertificateAuthorityRequest {
1767 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
1768 #[serde(rename = "requestId")]
1769 pub request_id: Option<String>,
1770}
1771
1772impl common::RequestValue for UndeleteCertificateAuthorityRequest {}
1773
1774/// User-defined URLs for accessing content published by this CertificateAuthority.
1775///
1776/// This type is not used in any activity, and only used as *part* of another schema.
1777///
1778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1779#[serde_with::serde_as]
1780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1781pub struct UserDefinedAccessUrls {
1782 /// Optional. A list of URLs where the issuer CA certificate may be downloaded, which appears in the "Authority Information Access" extension in the certificate. If specified, the default Cloud Storage URLs will be omitted.
1783 #[serde(rename = "aiaIssuingCertificateUrls")]
1784 pub aia_issuing_certificate_urls: Option<Vec<String>>,
1785 /// Optional. A list of URLs where to obtain CRL information, i.e. the DistributionPoint.fullName described by https://tools.ietf.org/html/rfc5280#section-4.2.1.13. If specified, the default Cloud Storage URLs will be omitted.
1786 #[serde(rename = "crlAccessUrls")]
1787 pub crl_access_urls: Option<Vec<String>>,
1788}
1789
1790impl common::Part for UserDefinedAccessUrls {}
1791
1792/// An X509Extension specifies an X.509 extension, which may be used in different parts of X.509 objects like certificates, CSRs, and CRLs.
1793///
1794/// This type is not used in any activity, and only used as *part* of another schema.
1795///
1796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1797#[serde_with::serde_as]
1798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1799pub struct X509Extension {
1800 /// Optional. Indicates whether or not this extension is critical (i.e., if the client does not know how to handle this extension, the client should consider this to be an error).
1801 pub critical: Option<bool>,
1802 /// Required. The OID for this X.509 extension.
1803 #[serde(rename = "objectId")]
1804 pub object_id: Option<ObjectId>,
1805 /// Required. The value of this X.509 extension.
1806 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1807 pub value: Option<Vec<u8>>,
1808}
1809
1810impl common::Part for X509Extension {}
1811
1812/// An X509Parameters is used to describe certain fields of an X.509 certificate, such as the key usage fields, fields specific to CA certificates, certificate policy extensions and custom extensions.
1813///
1814/// This type is not used in any activity, and only used as *part* of another schema.
1815///
1816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1817#[serde_with::serde_as]
1818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1819pub struct X509Parameters {
1820 /// Optional. Describes custom X.509 extensions.
1821 #[serde(rename = "additionalExtensions")]
1822 pub additional_extensions: Option<Vec<X509Extension>>,
1823 /// Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses that appear in the "Authority Information Access" extension in the certificate.
1824 #[serde(rename = "aiaOcspServers")]
1825 pub aia_ocsp_servers: Option<Vec<String>>,
1826 /// Optional. Describes options in this X509Parameters that are relevant in a CA certificate. If not specified, a default basic constraints extension with `is_ca=false` will be added for leaf certificates.
1827 #[serde(rename = "caOptions")]
1828 pub ca_options: Option<CaOptions>,
1829 /// Optional. Indicates the intended use for keys that correspond to a certificate.
1830 #[serde(rename = "keyUsage")]
1831 pub key_usage: Option<KeyUsage>,
1832 /// Optional. Describes the X.509 name constraints extension.
1833 #[serde(rename = "nameConstraints")]
1834 pub name_constraints: Option<NameConstraints>,
1835 /// Optional. Describes the X.509 certificate policy object identifiers, per https://tools.ietf.org/html/rfc5280#section-4.2.1.4.
1836 #[serde(rename = "policyIds")]
1837 pub policy_ids: Option<Vec<ObjectId>>,
1838}
1839
1840impl common::Part for X509Parameters {}
1841
1842// ###################
1843// MethodBuilders ###
1844// #################
1845
1846/// A builder providing access to all methods supported on *project* resources.
1847/// It is not used directly, but through the [`CertificateAuthorityService`] hub.
1848///
1849/// # Example
1850///
1851/// Instantiate a resource builder
1852///
1853/// ```test_harness,no_run
1854/// extern crate hyper;
1855/// extern crate hyper_rustls;
1856/// extern crate google_privateca1 as privateca1;
1857///
1858/// # async fn dox() {
1859/// use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1860///
1861/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1862/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1863/// .with_native_roots()
1864/// .unwrap()
1865/// .https_only()
1866/// .enable_http2()
1867/// .build();
1868///
1869/// let executor = hyper_util::rt::TokioExecutor::new();
1870/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1871/// secret,
1872/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1873/// yup_oauth2::client::CustomHyperClientBuilder::from(
1874/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1875/// ),
1876/// ).build().await.unwrap();
1877///
1878/// let client = hyper_util::client::legacy::Client::builder(
1879/// hyper_util::rt::TokioExecutor::new()
1880/// )
1881/// .build(
1882/// hyper_rustls::HttpsConnectorBuilder::new()
1883/// .with_native_roots()
1884/// .unwrap()
1885/// .https_or_http()
1886/// .enable_http2()
1887/// .build()
1888/// );
1889/// let mut hub = CertificateAuthorityService::new(client, auth);
1890/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1891/// // like `locations_ca_pools_certificate_authorities_activate(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_get(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_get_iam_policy(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_list(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_patch(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_set_iam_policy(...)`, `locations_ca_pools_certificate_authorities_certificate_revocation_lists_test_iam_permissions(...)`, `locations_ca_pools_certificate_authorities_create(...)`, `locations_ca_pools_certificate_authorities_delete(...)`, `locations_ca_pools_certificate_authorities_disable(...)`, `locations_ca_pools_certificate_authorities_enable(...)`, `locations_ca_pools_certificate_authorities_fetch(...)`, `locations_ca_pools_certificate_authorities_get(...)`, `locations_ca_pools_certificate_authorities_list(...)`, `locations_ca_pools_certificate_authorities_patch(...)`, `locations_ca_pools_certificate_authorities_undelete(...)`, `locations_ca_pools_certificates_create(...)`, `locations_ca_pools_certificates_get(...)`, `locations_ca_pools_certificates_list(...)`, `locations_ca_pools_certificates_patch(...)`, `locations_ca_pools_certificates_revoke(...)`, `locations_ca_pools_create(...)`, `locations_ca_pools_delete(...)`, `locations_ca_pools_fetch_ca_certs(...)`, `locations_ca_pools_get(...)`, `locations_ca_pools_get_iam_policy(...)`, `locations_ca_pools_list(...)`, `locations_ca_pools_patch(...)`, `locations_ca_pools_set_iam_policy(...)`, `locations_ca_pools_test_iam_permissions(...)`, `locations_certificate_templates_create(...)`, `locations_certificate_templates_delete(...)`, `locations_certificate_templates_get(...)`, `locations_certificate_templates_get_iam_policy(...)`, `locations_certificate_templates_list(...)`, `locations_certificate_templates_patch(...)`, `locations_certificate_templates_set_iam_policy(...)`, `locations_certificate_templates_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
1892/// // to build up your call.
1893/// let rb = hub.projects();
1894/// # }
1895/// ```
1896pub struct ProjectMethods<'a, C>
1897where
1898 C: 'a,
1899{
1900 hub: &'a CertificateAuthorityService<C>,
1901}
1902
1903impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1904
1905impl<'a, C> ProjectMethods<'a, C> {
1906 /// Create a builder to help you perform the following task:
1907 ///
1908 /// Returns a CertificateRevocationList.
1909 ///
1910 /// # Arguments
1911 ///
1912 /// * `name` - Required. The name of the CertificateRevocationList to get.
1913 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_get(
1914 &self,
1915 name: &str,
1916 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C> {
1917 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall {
1918 hub: self.hub,
1919 _name: name.to_string(),
1920 _delegate: Default::default(),
1921 _additional_params: Default::default(),
1922 _scopes: Default::default(),
1923 }
1924 }
1925
1926 /// Create a builder to help you perform the following task:
1927 ///
1928 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1929 ///
1930 /// # Arguments
1931 ///
1932 /// * `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.
1933 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_get_iam_policy(
1934 &self,
1935 resource: &str,
1936 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
1937 {
1938 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall {
1939 hub: self.hub,
1940 _resource: resource.to_string(),
1941 _options_requested_policy_version: Default::default(),
1942 _delegate: Default::default(),
1943 _additional_params: Default::default(),
1944 _scopes: Default::default(),
1945 }
1946 }
1947
1948 /// Create a builder to help you perform the following task:
1949 ///
1950 /// Lists CertificateRevocationLists.
1951 ///
1952 /// # Arguments
1953 ///
1954 /// * `parent` - Required. The resource name of the location associated with the CertificateRevocationLists, in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
1955 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_list(
1956 &self,
1957 parent: &str,
1958 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
1959 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall {
1960 hub: self.hub,
1961 _parent: parent.to_string(),
1962 _page_token: Default::default(),
1963 _page_size: Default::default(),
1964 _order_by: Default::default(),
1965 _filter: Default::default(),
1966 _delegate: Default::default(),
1967 _additional_params: Default::default(),
1968 _scopes: Default::default(),
1969 }
1970 }
1971
1972 /// Create a builder to help you perform the following task:
1973 ///
1974 /// Update a CertificateRevocationList.
1975 ///
1976 /// # Arguments
1977 ///
1978 /// * `request` - No description provided.
1979 /// * `name` - Identifier. The resource name for this CertificateRevocationList in the format `projects/*/locations/*/caPools/*certificateAuthorities/*/ certificateRevocationLists/*`.
1980 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_patch(
1981 &self,
1982 request: CertificateRevocationList,
1983 name: &str,
1984 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
1985 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall {
1986 hub: self.hub,
1987 _request: request,
1988 _name: name.to_string(),
1989 _update_mask: Default::default(),
1990 _request_id: Default::default(),
1991 _delegate: Default::default(),
1992 _additional_params: Default::default(),
1993 _scopes: Default::default(),
1994 }
1995 }
1996
1997 /// Create a builder to help you perform the following task:
1998 ///
1999 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2000 ///
2001 /// # Arguments
2002 ///
2003 /// * `request` - No description provided.
2004 /// * `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.
2005 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_set_iam_policy(
2006 &self,
2007 request: SetIamPolicyRequest,
2008 resource: &str,
2009 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
2010 {
2011 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall {
2012 hub: self.hub,
2013 _request: request,
2014 _resource: resource.to_string(),
2015 _delegate: Default::default(),
2016 _additional_params: Default::default(),
2017 _scopes: Default::default(),
2018 }
2019 }
2020
2021 /// Create a builder to help you perform the following task:
2022 ///
2023 /// 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.
2024 ///
2025 /// # Arguments
2026 ///
2027 /// * `request` - No description provided.
2028 /// * `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.
2029 pub fn locations_ca_pools_certificate_authorities_certificate_revocation_lists_test_iam_permissions(
2030 &self,
2031 request: TestIamPermissionsRequest,
2032 resource: &str,
2033 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
2034 'a,
2035 C,
2036 > {
2037 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall {
2038 hub: self.hub,
2039 _request: request,
2040 _resource: resource.to_string(),
2041 _delegate: Default::default(),
2042 _additional_params: Default::default(),
2043 _scopes: Default::default(),
2044 }
2045 }
2046
2047 /// Create a builder to help you perform the following task:
2048 ///
2049 /// Activate a CertificateAuthority that is in state AWAITING_USER_ACTIVATION and is of type SUBORDINATE. After the parent Certificate Authority signs a certificate signing request from FetchCertificateAuthorityCsr, this method can complete the activation process.
2050 ///
2051 /// # Arguments
2052 ///
2053 /// * `request` - No description provided.
2054 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2055 pub fn locations_ca_pools_certificate_authorities_activate(
2056 &self,
2057 request: ActivateCertificateAuthorityRequest,
2058 name: &str,
2059 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {
2060 ProjectLocationCaPoolCertificateAuthorityActivateCall {
2061 hub: self.hub,
2062 _request: request,
2063 _name: name.to_string(),
2064 _delegate: Default::default(),
2065 _additional_params: Default::default(),
2066 _scopes: Default::default(),
2067 }
2068 }
2069
2070 /// Create a builder to help you perform the following task:
2071 ///
2072 /// Create a new CertificateAuthority in a given Project and Location.
2073 ///
2074 /// # Arguments
2075 ///
2076 /// * `request` - No description provided.
2077 /// * `parent` - Required. The resource name of the CaPool associated with the CertificateAuthorities, in the format `projects/*/locations/*/caPools/*`.
2078 pub fn locations_ca_pools_certificate_authorities_create(
2079 &self,
2080 request: CertificateAuthority,
2081 parent: &str,
2082 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
2083 ProjectLocationCaPoolCertificateAuthorityCreateCall {
2084 hub: self.hub,
2085 _request: request,
2086 _parent: parent.to_string(),
2087 _request_id: Default::default(),
2088 _certificate_authority_id: Default::default(),
2089 _delegate: Default::default(),
2090 _additional_params: Default::default(),
2091 _scopes: Default::default(),
2092 }
2093 }
2094
2095 /// Create a builder to help you perform the following task:
2096 ///
2097 /// Delete a CertificateAuthority.
2098 ///
2099 /// # Arguments
2100 ///
2101 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2102 pub fn locations_ca_pools_certificate_authorities_delete(
2103 &self,
2104 name: &str,
2105 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
2106 ProjectLocationCaPoolCertificateAuthorityDeleteCall {
2107 hub: self.hub,
2108 _name: name.to_string(),
2109 _skip_grace_period: Default::default(),
2110 _request_id: Default::default(),
2111 _ignore_dependent_resources: Default::default(),
2112 _ignore_active_certificates: Default::default(),
2113 _delegate: Default::default(),
2114 _additional_params: Default::default(),
2115 _scopes: Default::default(),
2116 }
2117 }
2118
2119 /// Create a builder to help you perform the following task:
2120 ///
2121 /// Disable a CertificateAuthority.
2122 ///
2123 /// # Arguments
2124 ///
2125 /// * `request` - No description provided.
2126 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2127 pub fn locations_ca_pools_certificate_authorities_disable(
2128 &self,
2129 request: DisableCertificateAuthorityRequest,
2130 name: &str,
2131 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {
2132 ProjectLocationCaPoolCertificateAuthorityDisableCall {
2133 hub: self.hub,
2134 _request: request,
2135 _name: name.to_string(),
2136 _delegate: Default::default(),
2137 _additional_params: Default::default(),
2138 _scopes: Default::default(),
2139 }
2140 }
2141
2142 /// Create a builder to help you perform the following task:
2143 ///
2144 /// Enable a CertificateAuthority.
2145 ///
2146 /// # Arguments
2147 ///
2148 /// * `request` - No description provided.
2149 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2150 pub fn locations_ca_pools_certificate_authorities_enable(
2151 &self,
2152 request: EnableCertificateAuthorityRequest,
2153 name: &str,
2154 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {
2155 ProjectLocationCaPoolCertificateAuthorityEnableCall {
2156 hub: self.hub,
2157 _request: request,
2158 _name: name.to_string(),
2159 _delegate: Default::default(),
2160 _additional_params: Default::default(),
2161 _scopes: Default::default(),
2162 }
2163 }
2164
2165 /// Create a builder to help you perform the following task:
2166 ///
2167 /// Fetch a certificate signing request (CSR) from a CertificateAuthority that is in state AWAITING_USER_ACTIVATION and is of type SUBORDINATE. The CSR must then be signed by the desired parent Certificate Authority, which could be another CertificateAuthority resource, or could be an on-prem certificate authority. See also ActivateCertificateAuthority.
2168 ///
2169 /// # Arguments
2170 ///
2171 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2172 pub fn locations_ca_pools_certificate_authorities_fetch(
2173 &self,
2174 name: &str,
2175 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C> {
2176 ProjectLocationCaPoolCertificateAuthorityFetchCall {
2177 hub: self.hub,
2178 _name: name.to_string(),
2179 _delegate: Default::default(),
2180 _additional_params: Default::default(),
2181 _scopes: Default::default(),
2182 }
2183 }
2184
2185 /// Create a builder to help you perform the following task:
2186 ///
2187 /// Returns a CertificateAuthority.
2188 ///
2189 /// # Arguments
2190 ///
2191 /// * `name` - Required. The name of the CertificateAuthority to get.
2192 pub fn locations_ca_pools_certificate_authorities_get(
2193 &self,
2194 name: &str,
2195 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C> {
2196 ProjectLocationCaPoolCertificateAuthorityGetCall {
2197 hub: self.hub,
2198 _name: name.to_string(),
2199 _delegate: Default::default(),
2200 _additional_params: Default::default(),
2201 _scopes: Default::default(),
2202 }
2203 }
2204
2205 /// Create a builder to help you perform the following task:
2206 ///
2207 /// Lists CertificateAuthorities.
2208 ///
2209 /// # Arguments
2210 ///
2211 /// * `parent` - Required. The resource name of the CaPool associated with the CertificateAuthorities, in the format `projects/*/locations/*/caPools/*`.
2212 pub fn locations_ca_pools_certificate_authorities_list(
2213 &self,
2214 parent: &str,
2215 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
2216 ProjectLocationCaPoolCertificateAuthorityListCall {
2217 hub: self.hub,
2218 _parent: parent.to_string(),
2219 _page_token: Default::default(),
2220 _page_size: Default::default(),
2221 _order_by: Default::default(),
2222 _filter: Default::default(),
2223 _delegate: Default::default(),
2224 _additional_params: Default::default(),
2225 _scopes: Default::default(),
2226 }
2227 }
2228
2229 /// Create a builder to help you perform the following task:
2230 ///
2231 /// Update a CertificateAuthority.
2232 ///
2233 /// # Arguments
2234 ///
2235 /// * `request` - No description provided.
2236 /// * `name` - Identifier. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2237 pub fn locations_ca_pools_certificate_authorities_patch(
2238 &self,
2239 request: CertificateAuthority,
2240 name: &str,
2241 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
2242 ProjectLocationCaPoolCertificateAuthorityPatchCall {
2243 hub: self.hub,
2244 _request: request,
2245 _name: name.to_string(),
2246 _update_mask: Default::default(),
2247 _request_id: Default::default(),
2248 _delegate: Default::default(),
2249 _additional_params: Default::default(),
2250 _scopes: Default::default(),
2251 }
2252 }
2253
2254 /// Create a builder to help you perform the following task:
2255 ///
2256 /// Undelete a CertificateAuthority that has been deleted.
2257 ///
2258 /// # Arguments
2259 ///
2260 /// * `request` - No description provided.
2261 /// * `name` - Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
2262 pub fn locations_ca_pools_certificate_authorities_undelete(
2263 &self,
2264 request: UndeleteCertificateAuthorityRequest,
2265 name: &str,
2266 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {
2267 ProjectLocationCaPoolCertificateAuthorityUndeleteCall {
2268 hub: self.hub,
2269 _request: request,
2270 _name: name.to_string(),
2271 _delegate: Default::default(),
2272 _additional_params: Default::default(),
2273 _scopes: Default::default(),
2274 }
2275 }
2276
2277 /// Create a builder to help you perform the following task:
2278 ///
2279 /// Create a new Certificate in a given Project, Location from a particular CaPool.
2280 ///
2281 /// # Arguments
2282 ///
2283 /// * `request` - No description provided.
2284 /// * `parent` - Required. The resource name of the CaPool associated with the Certificate, in the format `projects/*/locations/*/caPools/*`.
2285 pub fn locations_ca_pools_certificates_create(
2286 &self,
2287 request: Certificate,
2288 parent: &str,
2289 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
2290 ProjectLocationCaPoolCertificateCreateCall {
2291 hub: self.hub,
2292 _request: request,
2293 _parent: parent.to_string(),
2294 _validate_only: Default::default(),
2295 _request_id: Default::default(),
2296 _issuing_certificate_authority_id: Default::default(),
2297 _certificate_id: Default::default(),
2298 _delegate: Default::default(),
2299 _additional_params: Default::default(),
2300 _scopes: Default::default(),
2301 }
2302 }
2303
2304 /// Create a builder to help you perform the following task:
2305 ///
2306 /// Returns a Certificate.
2307 ///
2308 /// # Arguments
2309 ///
2310 /// * `name` - Required. The name of the Certificate to get.
2311 pub fn locations_ca_pools_certificates_get(
2312 &self,
2313 name: &str,
2314 ) -> ProjectLocationCaPoolCertificateGetCall<'a, C> {
2315 ProjectLocationCaPoolCertificateGetCall {
2316 hub: self.hub,
2317 _name: name.to_string(),
2318 _delegate: Default::default(),
2319 _additional_params: Default::default(),
2320 _scopes: Default::default(),
2321 }
2322 }
2323
2324 /// Create a builder to help you perform the following task:
2325 ///
2326 /// Lists Certificates.
2327 ///
2328 /// # Arguments
2329 ///
2330 /// * `parent` - Required. The resource name of the location associated with the Certificates, in the format `projects/*/locations/*/caPools/*`.
2331 pub fn locations_ca_pools_certificates_list(
2332 &self,
2333 parent: &str,
2334 ) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
2335 ProjectLocationCaPoolCertificateListCall {
2336 hub: self.hub,
2337 _parent: parent.to_string(),
2338 _page_token: Default::default(),
2339 _page_size: Default::default(),
2340 _order_by: Default::default(),
2341 _filter: Default::default(),
2342 _delegate: Default::default(),
2343 _additional_params: Default::default(),
2344 _scopes: Default::default(),
2345 }
2346 }
2347
2348 /// Create a builder to help you perform the following task:
2349 ///
2350 /// Update a Certificate. Currently, the only field you can update is the labels field.
2351 ///
2352 /// # Arguments
2353 ///
2354 /// * `request` - No description provided.
2355 /// * `name` - Identifier. The resource name for this Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
2356 pub fn locations_ca_pools_certificates_patch(
2357 &self,
2358 request: Certificate,
2359 name: &str,
2360 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
2361 ProjectLocationCaPoolCertificatePatchCall {
2362 hub: self.hub,
2363 _request: request,
2364 _name: name.to_string(),
2365 _update_mask: Default::default(),
2366 _request_id: Default::default(),
2367 _delegate: Default::default(),
2368 _additional_params: Default::default(),
2369 _scopes: Default::default(),
2370 }
2371 }
2372
2373 /// Create a builder to help you perform the following task:
2374 ///
2375 /// Revoke a Certificate.
2376 ///
2377 /// # Arguments
2378 ///
2379 /// * `request` - No description provided.
2380 /// * `name` - Required. The resource name for this Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
2381 pub fn locations_ca_pools_certificates_revoke(
2382 &self,
2383 request: RevokeCertificateRequest,
2384 name: &str,
2385 ) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C> {
2386 ProjectLocationCaPoolCertificateRevokeCall {
2387 hub: self.hub,
2388 _request: request,
2389 _name: name.to_string(),
2390 _delegate: Default::default(),
2391 _additional_params: Default::default(),
2392 _scopes: Default::default(),
2393 }
2394 }
2395
2396 /// Create a builder to help you perform the following task:
2397 ///
2398 /// Create a CaPool.
2399 ///
2400 /// # Arguments
2401 ///
2402 /// * `request` - No description provided.
2403 /// * `parent` - Required. The resource name of the location associated with the CaPool, in the format `projects/*/locations/*`.
2404 pub fn locations_ca_pools_create(
2405 &self,
2406 request: CaPool,
2407 parent: &str,
2408 ) -> ProjectLocationCaPoolCreateCall<'a, C> {
2409 ProjectLocationCaPoolCreateCall {
2410 hub: self.hub,
2411 _request: request,
2412 _parent: parent.to_string(),
2413 _request_id: Default::default(),
2414 _ca_pool_id: Default::default(),
2415 _delegate: Default::default(),
2416 _additional_params: Default::default(),
2417 _scopes: Default::default(),
2418 }
2419 }
2420
2421 /// Create a builder to help you perform the following task:
2422 ///
2423 /// Delete a CaPool.
2424 ///
2425 /// # Arguments
2426 ///
2427 /// * `name` - Required. The resource name for this CaPool in the format `projects/*/locations/*/caPools/*`.
2428 pub fn locations_ca_pools_delete(&self, name: &str) -> ProjectLocationCaPoolDeleteCall<'a, C> {
2429 ProjectLocationCaPoolDeleteCall {
2430 hub: self.hub,
2431 _name: name.to_string(),
2432 _request_id: Default::default(),
2433 _ignore_dependent_resources: Default::default(),
2434 _delegate: Default::default(),
2435 _additional_params: Default::default(),
2436 _scopes: Default::default(),
2437 }
2438 }
2439
2440 /// Create a builder to help you perform the following task:
2441 ///
2442 /// FetchCaCerts returns the current trust anchor for the CaPool. This will include CA certificate chains for all certificate authorities in the ENABLED, DISABLED, or STAGED states.
2443 ///
2444 /// # Arguments
2445 ///
2446 /// * `request` - No description provided.
2447 /// * `caPool` - Required. The resource name for the CaPool in the format `projects/*/locations/*/caPools/*`.
2448 pub fn locations_ca_pools_fetch_ca_certs(
2449 &self,
2450 request: FetchCaCertsRequest,
2451 ca_pool: &str,
2452 ) -> ProjectLocationCaPoolFetchCaCertCall<'a, C> {
2453 ProjectLocationCaPoolFetchCaCertCall {
2454 hub: self.hub,
2455 _request: request,
2456 _ca_pool: ca_pool.to_string(),
2457 _delegate: Default::default(),
2458 _additional_params: Default::default(),
2459 _scopes: Default::default(),
2460 }
2461 }
2462
2463 /// Create a builder to help you perform the following task:
2464 ///
2465 /// Returns a CaPool.
2466 ///
2467 /// # Arguments
2468 ///
2469 /// * `name` - Required. The name of the CaPool to get.
2470 pub fn locations_ca_pools_get(&self, name: &str) -> ProjectLocationCaPoolGetCall<'a, C> {
2471 ProjectLocationCaPoolGetCall {
2472 hub: self.hub,
2473 _name: name.to_string(),
2474 _delegate: Default::default(),
2475 _additional_params: Default::default(),
2476 _scopes: Default::default(),
2477 }
2478 }
2479
2480 /// Create a builder to help you perform the following task:
2481 ///
2482 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2483 ///
2484 /// # Arguments
2485 ///
2486 /// * `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.
2487 pub fn locations_ca_pools_get_iam_policy(
2488 &self,
2489 resource: &str,
2490 ) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C> {
2491 ProjectLocationCaPoolGetIamPolicyCall {
2492 hub: self.hub,
2493 _resource: resource.to_string(),
2494 _options_requested_policy_version: Default::default(),
2495 _delegate: Default::default(),
2496 _additional_params: Default::default(),
2497 _scopes: Default::default(),
2498 }
2499 }
2500
2501 /// Create a builder to help you perform the following task:
2502 ///
2503 /// Lists CaPools.
2504 ///
2505 /// # Arguments
2506 ///
2507 /// * `parent` - Required. The resource name of the location associated with the CaPools, in the format `projects/*/locations/*`.
2508 pub fn locations_ca_pools_list(&self, parent: &str) -> ProjectLocationCaPoolListCall<'a, C> {
2509 ProjectLocationCaPoolListCall {
2510 hub: self.hub,
2511 _parent: parent.to_string(),
2512 _page_token: Default::default(),
2513 _page_size: Default::default(),
2514 _order_by: Default::default(),
2515 _filter: Default::default(),
2516 _delegate: Default::default(),
2517 _additional_params: Default::default(),
2518 _scopes: Default::default(),
2519 }
2520 }
2521
2522 /// Create a builder to help you perform the following task:
2523 ///
2524 /// Update a CaPool.
2525 ///
2526 /// # Arguments
2527 ///
2528 /// * `request` - No description provided.
2529 /// * `name` - Identifier. The resource name for this CaPool in the format `projects/*/locations/*/caPools/*`.
2530 pub fn locations_ca_pools_patch(
2531 &self,
2532 request: CaPool,
2533 name: &str,
2534 ) -> ProjectLocationCaPoolPatchCall<'a, C> {
2535 ProjectLocationCaPoolPatchCall {
2536 hub: self.hub,
2537 _request: request,
2538 _name: name.to_string(),
2539 _update_mask: Default::default(),
2540 _request_id: Default::default(),
2541 _delegate: Default::default(),
2542 _additional_params: Default::default(),
2543 _scopes: Default::default(),
2544 }
2545 }
2546
2547 /// Create a builder to help you perform the following task:
2548 ///
2549 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2550 ///
2551 /// # Arguments
2552 ///
2553 /// * `request` - No description provided.
2554 /// * `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.
2555 pub fn locations_ca_pools_set_iam_policy(
2556 &self,
2557 request: SetIamPolicyRequest,
2558 resource: &str,
2559 ) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C> {
2560 ProjectLocationCaPoolSetIamPolicyCall {
2561 hub: self.hub,
2562 _request: request,
2563 _resource: resource.to_string(),
2564 _delegate: Default::default(),
2565 _additional_params: Default::default(),
2566 _scopes: Default::default(),
2567 }
2568 }
2569
2570 /// Create a builder to help you perform the following task:
2571 ///
2572 /// 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.
2573 ///
2574 /// # Arguments
2575 ///
2576 /// * `request` - No description provided.
2577 /// * `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.
2578 pub fn locations_ca_pools_test_iam_permissions(
2579 &self,
2580 request: TestIamPermissionsRequest,
2581 resource: &str,
2582 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C> {
2583 ProjectLocationCaPoolTestIamPermissionCall {
2584 hub: self.hub,
2585 _request: request,
2586 _resource: resource.to_string(),
2587 _delegate: Default::default(),
2588 _additional_params: Default::default(),
2589 _scopes: Default::default(),
2590 }
2591 }
2592
2593 /// Create a builder to help you perform the following task:
2594 ///
2595 /// Create a new CertificateTemplate in a given Project and Location.
2596 ///
2597 /// # Arguments
2598 ///
2599 /// * `request` - No description provided.
2600 /// * `parent` - Required. The resource name of the location associated with the CertificateTemplate, in the format `projects/*/locations/*`.
2601 pub fn locations_certificate_templates_create(
2602 &self,
2603 request: CertificateTemplate,
2604 parent: &str,
2605 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
2606 ProjectLocationCertificateTemplateCreateCall {
2607 hub: self.hub,
2608 _request: request,
2609 _parent: parent.to_string(),
2610 _request_id: Default::default(),
2611 _certificate_template_id: Default::default(),
2612 _delegate: Default::default(),
2613 _additional_params: Default::default(),
2614 _scopes: Default::default(),
2615 }
2616 }
2617
2618 /// Create a builder to help you perform the following task:
2619 ///
2620 /// DeleteCertificateTemplate deletes a CertificateTemplate.
2621 ///
2622 /// # Arguments
2623 ///
2624 /// * `name` - Required. The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`.
2625 pub fn locations_certificate_templates_delete(
2626 &self,
2627 name: &str,
2628 ) -> ProjectLocationCertificateTemplateDeleteCall<'a, C> {
2629 ProjectLocationCertificateTemplateDeleteCall {
2630 hub: self.hub,
2631 _name: name.to_string(),
2632 _request_id: Default::default(),
2633 _delegate: Default::default(),
2634 _additional_params: Default::default(),
2635 _scopes: Default::default(),
2636 }
2637 }
2638
2639 /// Create a builder to help you perform the following task:
2640 ///
2641 /// Returns a CertificateTemplate.
2642 ///
2643 /// # Arguments
2644 ///
2645 /// * `name` - Required. The name of the CertificateTemplate to get.
2646 pub fn locations_certificate_templates_get(
2647 &self,
2648 name: &str,
2649 ) -> ProjectLocationCertificateTemplateGetCall<'a, C> {
2650 ProjectLocationCertificateTemplateGetCall {
2651 hub: self.hub,
2652 _name: name.to_string(),
2653 _delegate: Default::default(),
2654 _additional_params: Default::default(),
2655 _scopes: Default::default(),
2656 }
2657 }
2658
2659 /// Create a builder to help you perform the following task:
2660 ///
2661 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2662 ///
2663 /// # Arguments
2664 ///
2665 /// * `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.
2666 pub fn locations_certificate_templates_get_iam_policy(
2667 &self,
2668 resource: &str,
2669 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {
2670 ProjectLocationCertificateTemplateGetIamPolicyCall {
2671 hub: self.hub,
2672 _resource: resource.to_string(),
2673 _options_requested_policy_version: Default::default(),
2674 _delegate: Default::default(),
2675 _additional_params: Default::default(),
2676 _scopes: Default::default(),
2677 }
2678 }
2679
2680 /// Create a builder to help you perform the following task:
2681 ///
2682 /// Lists CertificateTemplates.
2683 ///
2684 /// # Arguments
2685 ///
2686 /// * `parent` - Required. The resource name of the location associated with the CertificateTemplates, in the format `projects/*/locations/*`.
2687 pub fn locations_certificate_templates_list(
2688 &self,
2689 parent: &str,
2690 ) -> ProjectLocationCertificateTemplateListCall<'a, C> {
2691 ProjectLocationCertificateTemplateListCall {
2692 hub: self.hub,
2693 _parent: parent.to_string(),
2694 _page_token: Default::default(),
2695 _page_size: Default::default(),
2696 _order_by: Default::default(),
2697 _filter: Default::default(),
2698 _delegate: Default::default(),
2699 _additional_params: Default::default(),
2700 _scopes: Default::default(),
2701 }
2702 }
2703
2704 /// Create a builder to help you perform the following task:
2705 ///
2706 /// Update a CertificateTemplate.
2707 ///
2708 /// # Arguments
2709 ///
2710 /// * `request` - No description provided.
2711 /// * `name` - Identifier. The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`.
2712 pub fn locations_certificate_templates_patch(
2713 &self,
2714 request: CertificateTemplate,
2715 name: &str,
2716 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
2717 ProjectLocationCertificateTemplatePatchCall {
2718 hub: self.hub,
2719 _request: request,
2720 _name: name.to_string(),
2721 _update_mask: Default::default(),
2722 _request_id: Default::default(),
2723 _delegate: Default::default(),
2724 _additional_params: Default::default(),
2725 _scopes: Default::default(),
2726 }
2727 }
2728
2729 /// Create a builder to help you perform the following task:
2730 ///
2731 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2732 ///
2733 /// # Arguments
2734 ///
2735 /// * `request` - No description provided.
2736 /// * `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.
2737 pub fn locations_certificate_templates_set_iam_policy(
2738 &self,
2739 request: SetIamPolicyRequest,
2740 resource: &str,
2741 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {
2742 ProjectLocationCertificateTemplateSetIamPolicyCall {
2743 hub: self.hub,
2744 _request: request,
2745 _resource: resource.to_string(),
2746 _delegate: Default::default(),
2747 _additional_params: Default::default(),
2748 _scopes: Default::default(),
2749 }
2750 }
2751
2752 /// Create a builder to help you perform the following task:
2753 ///
2754 /// 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.
2755 ///
2756 /// # Arguments
2757 ///
2758 /// * `request` - No description provided.
2759 /// * `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.
2760 pub fn locations_certificate_templates_test_iam_permissions(
2761 &self,
2762 request: TestIamPermissionsRequest,
2763 resource: &str,
2764 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {
2765 ProjectLocationCertificateTemplateTestIamPermissionCall {
2766 hub: self.hub,
2767 _request: request,
2768 _resource: resource.to_string(),
2769 _delegate: Default::default(),
2770 _additional_params: Default::default(),
2771 _scopes: Default::default(),
2772 }
2773 }
2774
2775 /// Create a builder to help you perform the following task:
2776 ///
2777 /// 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`.
2778 ///
2779 /// # Arguments
2780 ///
2781 /// * `request` - No description provided.
2782 /// * `name` - The name of the operation resource to be cancelled.
2783 pub fn locations_operations_cancel(
2784 &self,
2785 request: CancelOperationRequest,
2786 name: &str,
2787 ) -> ProjectLocationOperationCancelCall<'a, C> {
2788 ProjectLocationOperationCancelCall {
2789 hub: self.hub,
2790 _request: request,
2791 _name: name.to_string(),
2792 _delegate: Default::default(),
2793 _additional_params: Default::default(),
2794 _scopes: Default::default(),
2795 }
2796 }
2797
2798 /// Create a builder to help you perform the following task:
2799 ///
2800 /// 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`.
2801 ///
2802 /// # Arguments
2803 ///
2804 /// * `name` - The name of the operation resource to be deleted.
2805 pub fn locations_operations_delete(
2806 &self,
2807 name: &str,
2808 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2809 ProjectLocationOperationDeleteCall {
2810 hub: self.hub,
2811 _name: name.to_string(),
2812 _delegate: Default::default(),
2813 _additional_params: Default::default(),
2814 _scopes: Default::default(),
2815 }
2816 }
2817
2818 /// Create a builder to help you perform the following task:
2819 ///
2820 /// 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.
2821 ///
2822 /// # Arguments
2823 ///
2824 /// * `name` - The name of the operation resource.
2825 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2826 ProjectLocationOperationGetCall {
2827 hub: self.hub,
2828 _name: name.to_string(),
2829 _delegate: Default::default(),
2830 _additional_params: Default::default(),
2831 _scopes: Default::default(),
2832 }
2833 }
2834
2835 /// Create a builder to help you perform the following task:
2836 ///
2837 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2838 ///
2839 /// # Arguments
2840 ///
2841 /// * `name` - The name of the operation's parent resource.
2842 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2843 ProjectLocationOperationListCall {
2844 hub: self.hub,
2845 _name: name.to_string(),
2846 _return_partial_success: Default::default(),
2847 _page_token: Default::default(),
2848 _page_size: Default::default(),
2849 _filter: Default::default(),
2850 _delegate: Default::default(),
2851 _additional_params: Default::default(),
2852 _scopes: Default::default(),
2853 }
2854 }
2855
2856 /// Create a builder to help you perform the following task:
2857 ///
2858 /// Gets information about a location.
2859 ///
2860 /// # Arguments
2861 ///
2862 /// * `name` - Resource name for the location.
2863 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2864 ProjectLocationGetCall {
2865 hub: self.hub,
2866 _name: name.to_string(),
2867 _delegate: Default::default(),
2868 _additional_params: Default::default(),
2869 _scopes: Default::default(),
2870 }
2871 }
2872
2873 /// Create a builder to help you perform the following task:
2874 ///
2875 /// Lists information about the supported locations for this service.
2876 ///
2877 /// # Arguments
2878 ///
2879 /// * `name` - The resource that owns the locations collection, if applicable.
2880 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2881 ProjectLocationListCall {
2882 hub: self.hub,
2883 _name: name.to_string(),
2884 _page_token: Default::default(),
2885 _page_size: Default::default(),
2886 _filter: Default::default(),
2887 _extra_location_types: Default::default(),
2888 _delegate: Default::default(),
2889 _additional_params: Default::default(),
2890 _scopes: Default::default(),
2891 }
2892 }
2893}
2894
2895// ###################
2896// CallBuilders ###
2897// #################
2898
2899/// Returns a CertificateRevocationList.
2900///
2901/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.get* method supported by a *project* resource.
2902/// It is not used directly, but through a [`ProjectMethods`] instance.
2903///
2904/// # Example
2905///
2906/// Instantiate a resource method builder
2907///
2908/// ```test_harness,no_run
2909/// # extern crate hyper;
2910/// # extern crate hyper_rustls;
2911/// # extern crate google_privateca1 as privateca1;
2912/// # async fn dox() {
2913/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2914///
2915/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2916/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2917/// # .with_native_roots()
2918/// # .unwrap()
2919/// # .https_only()
2920/// # .enable_http2()
2921/// # .build();
2922///
2923/// # let executor = hyper_util::rt::TokioExecutor::new();
2924/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2925/// # secret,
2926/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2927/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2928/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2929/// # ),
2930/// # ).build().await.unwrap();
2931///
2932/// # let client = hyper_util::client::legacy::Client::builder(
2933/// # hyper_util::rt::TokioExecutor::new()
2934/// # )
2935/// # .build(
2936/// # hyper_rustls::HttpsConnectorBuilder::new()
2937/// # .with_native_roots()
2938/// # .unwrap()
2939/// # .https_or_http()
2940/// # .enable_http2()
2941/// # .build()
2942/// # );
2943/// # let mut hub = CertificateAuthorityService::new(client, auth);
2944/// // You can configure optional parameters by calling the respective setters at will, and
2945/// // execute the final call using `doit()`.
2946/// // Values shown here are possibly random and not representative !
2947/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_get("name")
2948/// .doit().await;
2949/// # }
2950/// ```
2951pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
2952where
2953 C: 'a,
2954{
2955 hub: &'a CertificateAuthorityService<C>,
2956 _name: String,
2957 _delegate: Option<&'a mut dyn common::Delegate>,
2958 _additional_params: HashMap<String, String>,
2959 _scopes: BTreeSet<String>,
2960}
2961
2962impl<'a, C> common::CallBuilder
2963 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
2964{
2965}
2966
2967impl<'a, C> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
2968where
2969 C: common::Connector,
2970{
2971 /// Perform the operation you have build so far.
2972 pub async fn doit(mut self) -> common::Result<(common::Response, CertificateRevocationList)> {
2973 use std::borrow::Cow;
2974 use std::io::{Read, Seek};
2975
2976 use common::{url::Params, ToParts};
2977 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2978
2979 let mut dd = common::DefaultDelegate;
2980 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2981 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.get",
2982 http_method: hyper::Method::GET });
2983
2984 for &field in ["alt", "name"].iter() {
2985 if self._additional_params.contains_key(field) {
2986 dlg.finished(false);
2987 return Err(common::Error::FieldClash(field));
2988 }
2989 }
2990
2991 let mut params = Params::with_capacity(3 + self._additional_params.len());
2992 params.push("name", self._name);
2993
2994 params.extend(self._additional_params.iter());
2995
2996 params.push("alt", "json");
2997 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2998 if self._scopes.is_empty() {
2999 self._scopes
3000 .insert(Scope::CloudPlatform.as_ref().to_string());
3001 }
3002
3003 #[allow(clippy::single_element_loop)]
3004 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3005 url = params.uri_replacement(url, param_name, find_this, true);
3006 }
3007 {
3008 let to_remove = ["name"];
3009 params.remove_params(&to_remove);
3010 }
3011
3012 let url = params.parse_with_url(&url);
3013
3014 loop {
3015 let token = match self
3016 .hub
3017 .auth
3018 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3019 .await
3020 {
3021 Ok(token) => token,
3022 Err(e) => match dlg.token(e) {
3023 Ok(token) => token,
3024 Err(e) => {
3025 dlg.finished(false);
3026 return Err(common::Error::MissingToken(e));
3027 }
3028 },
3029 };
3030 let mut req_result = {
3031 let client = &self.hub.client;
3032 dlg.pre_request();
3033 let mut req_builder = hyper::Request::builder()
3034 .method(hyper::Method::GET)
3035 .uri(url.as_str())
3036 .header(USER_AGENT, self.hub._user_agent.clone());
3037
3038 if let Some(token) = token.as_ref() {
3039 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3040 }
3041
3042 let request = req_builder
3043 .header(CONTENT_LENGTH, 0_u64)
3044 .body(common::to_body::<String>(None));
3045
3046 client.request(request.unwrap()).await
3047 };
3048
3049 match req_result {
3050 Err(err) => {
3051 if let common::Retry::After(d) = dlg.http_error(&err) {
3052 sleep(d).await;
3053 continue;
3054 }
3055 dlg.finished(false);
3056 return Err(common::Error::HttpError(err));
3057 }
3058 Ok(res) => {
3059 let (mut parts, body) = res.into_parts();
3060 let mut body = common::Body::new(body);
3061 if !parts.status.is_success() {
3062 let bytes = common::to_bytes(body).await.unwrap_or_default();
3063 let error = serde_json::from_str(&common::to_string(&bytes));
3064 let response = common::to_response(parts, bytes.into());
3065
3066 if let common::Retry::After(d) =
3067 dlg.http_failure(&response, error.as_ref().ok())
3068 {
3069 sleep(d).await;
3070 continue;
3071 }
3072
3073 dlg.finished(false);
3074
3075 return Err(match error {
3076 Ok(value) => common::Error::BadRequest(value),
3077 _ => common::Error::Failure(response),
3078 });
3079 }
3080 let response = {
3081 let bytes = common::to_bytes(body).await.unwrap_or_default();
3082 let encoded = common::to_string(&bytes);
3083 match serde_json::from_str(&encoded) {
3084 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3085 Err(error) => {
3086 dlg.response_json_decode_error(&encoded, &error);
3087 return Err(common::Error::JsonDecodeError(
3088 encoded.to_string(),
3089 error,
3090 ));
3091 }
3092 }
3093 };
3094
3095 dlg.finished(true);
3096 return Ok(response);
3097 }
3098 }
3099 }
3100 }
3101
3102 /// Required. The name of the CertificateRevocationList to get.
3103 ///
3104 /// Sets the *name* path property to the given value.
3105 ///
3106 /// Even though the property as already been set when instantiating this call,
3107 /// we provide this method for API completeness.
3108 pub fn name(
3109 mut self,
3110 new_value: &str,
3111 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C> {
3112 self._name = new_value.to_string();
3113 self
3114 }
3115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3116 /// while executing the actual API request.
3117 ///
3118 /// ````text
3119 /// It should be used to handle progress information, and to implement a certain level of resilience.
3120 /// ````
3121 ///
3122 /// Sets the *delegate* property to the given value.
3123 pub fn delegate(
3124 mut self,
3125 new_value: &'a mut dyn common::Delegate,
3126 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C> {
3127 self._delegate = Some(new_value);
3128 self
3129 }
3130
3131 /// Set any additional parameter of the query string used in the request.
3132 /// It should be used to set parameters which are not yet available through their own
3133 /// setters.
3134 ///
3135 /// Please note that this method must not be used to set any of the known parameters
3136 /// which have their own setter method. If done anyway, the request will fail.
3137 ///
3138 /// # Additional Parameters
3139 ///
3140 /// * *$.xgafv* (query-string) - V1 error format.
3141 /// * *access_token* (query-string) - OAuth access token.
3142 /// * *alt* (query-string) - Data format for response.
3143 /// * *callback* (query-string) - JSONP
3144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3145 /// * *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.
3146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3148 /// * *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.
3149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3151 pub fn param<T>(
3152 mut self,
3153 name: T,
3154 value: T,
3155 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
3156 where
3157 T: AsRef<str>,
3158 {
3159 self._additional_params
3160 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3161 self
3162 }
3163
3164 /// Identifies the authorization scope for the method you are building.
3165 ///
3166 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3167 /// [`Scope::CloudPlatform`].
3168 ///
3169 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3170 /// tokens for more than one scope.
3171 ///
3172 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3173 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3174 /// sufficient, a read-write scope will do as well.
3175 pub fn add_scope<St>(
3176 mut self,
3177 scope: St,
3178 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
3179 where
3180 St: AsRef<str>,
3181 {
3182 self._scopes.insert(String::from(scope.as_ref()));
3183 self
3184 }
3185 /// Identifies the authorization scope(s) for the method you are building.
3186 ///
3187 /// See [`Self::add_scope()`] for details.
3188 pub fn add_scopes<I, St>(
3189 mut self,
3190 scopes: I,
3191 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C>
3192 where
3193 I: IntoIterator<Item = St>,
3194 St: AsRef<str>,
3195 {
3196 self._scopes
3197 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3198 self
3199 }
3200
3201 /// Removes all scopes, and no default scope will be used either.
3202 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3203 /// for details).
3204 pub fn clear_scopes(
3205 mut self,
3206 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetCall<'a, C> {
3207 self._scopes.clear();
3208 self
3209 }
3210}
3211
3212/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3213///
3214/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.getIamPolicy* method supported by a *project* resource.
3215/// It is not used directly, but through a [`ProjectMethods`] instance.
3216///
3217/// # Example
3218///
3219/// Instantiate a resource method builder
3220///
3221/// ```test_harness,no_run
3222/// # extern crate hyper;
3223/// # extern crate hyper_rustls;
3224/// # extern crate google_privateca1 as privateca1;
3225/// # async fn dox() {
3226/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3227///
3228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3229/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3230/// # .with_native_roots()
3231/// # .unwrap()
3232/// # .https_only()
3233/// # .enable_http2()
3234/// # .build();
3235///
3236/// # let executor = hyper_util::rt::TokioExecutor::new();
3237/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3238/// # secret,
3239/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3240/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3241/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3242/// # ),
3243/// # ).build().await.unwrap();
3244///
3245/// # let client = hyper_util::client::legacy::Client::builder(
3246/// # hyper_util::rt::TokioExecutor::new()
3247/// # )
3248/// # .build(
3249/// # hyper_rustls::HttpsConnectorBuilder::new()
3250/// # .with_native_roots()
3251/// # .unwrap()
3252/// # .https_or_http()
3253/// # .enable_http2()
3254/// # .build()
3255/// # );
3256/// # let mut hub = CertificateAuthorityService::new(client, auth);
3257/// // You can configure optional parameters by calling the respective setters at will, and
3258/// // execute the final call using `doit()`.
3259/// // Values shown here are possibly random and not representative !
3260/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_get_iam_policy("resource")
3261/// .options_requested_policy_version(-12)
3262/// .doit().await;
3263/// # }
3264/// ```
3265pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3266where
3267 C: 'a,
3268{
3269 hub: &'a CertificateAuthorityService<C>,
3270 _resource: String,
3271 _options_requested_policy_version: Option<i32>,
3272 _delegate: Option<&'a mut dyn common::Delegate>,
3273 _additional_params: HashMap<String, String>,
3274 _scopes: BTreeSet<String>,
3275}
3276
3277impl<'a, C> common::CallBuilder
3278 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3279{
3280}
3281
3282impl<'a, C>
3283 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3284where
3285 C: common::Connector,
3286{
3287 /// Perform the operation you have build so far.
3288 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3289 use std::borrow::Cow;
3290 use std::io::{Read, Seek};
3291
3292 use common::{url::Params, ToParts};
3293 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3294
3295 let mut dd = common::DefaultDelegate;
3296 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3297 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.getIamPolicy",
3298 http_method: hyper::Method::GET });
3299
3300 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3301 if self._additional_params.contains_key(field) {
3302 dlg.finished(false);
3303 return Err(common::Error::FieldClash(field));
3304 }
3305 }
3306
3307 let mut params = Params::with_capacity(4 + self._additional_params.len());
3308 params.push("resource", self._resource);
3309 if let Some(value) = self._options_requested_policy_version.as_ref() {
3310 params.push("options.requestedPolicyVersion", value.to_string());
3311 }
3312
3313 params.extend(self._additional_params.iter());
3314
3315 params.push("alt", "json");
3316 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
3317 if self._scopes.is_empty() {
3318 self._scopes
3319 .insert(Scope::CloudPlatform.as_ref().to_string());
3320 }
3321
3322 #[allow(clippy::single_element_loop)]
3323 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3324 url = params.uri_replacement(url, param_name, find_this, true);
3325 }
3326 {
3327 let to_remove = ["resource"];
3328 params.remove_params(&to_remove);
3329 }
3330
3331 let url = params.parse_with_url(&url);
3332
3333 loop {
3334 let token = match self
3335 .hub
3336 .auth
3337 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3338 .await
3339 {
3340 Ok(token) => token,
3341 Err(e) => match dlg.token(e) {
3342 Ok(token) => token,
3343 Err(e) => {
3344 dlg.finished(false);
3345 return Err(common::Error::MissingToken(e));
3346 }
3347 },
3348 };
3349 let mut req_result = {
3350 let client = &self.hub.client;
3351 dlg.pre_request();
3352 let mut req_builder = hyper::Request::builder()
3353 .method(hyper::Method::GET)
3354 .uri(url.as_str())
3355 .header(USER_AGENT, self.hub._user_agent.clone());
3356
3357 if let Some(token) = token.as_ref() {
3358 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3359 }
3360
3361 let request = req_builder
3362 .header(CONTENT_LENGTH, 0_u64)
3363 .body(common::to_body::<String>(None));
3364
3365 client.request(request.unwrap()).await
3366 };
3367
3368 match req_result {
3369 Err(err) => {
3370 if let common::Retry::After(d) = dlg.http_error(&err) {
3371 sleep(d).await;
3372 continue;
3373 }
3374 dlg.finished(false);
3375 return Err(common::Error::HttpError(err));
3376 }
3377 Ok(res) => {
3378 let (mut parts, body) = res.into_parts();
3379 let mut body = common::Body::new(body);
3380 if !parts.status.is_success() {
3381 let bytes = common::to_bytes(body).await.unwrap_or_default();
3382 let error = serde_json::from_str(&common::to_string(&bytes));
3383 let response = common::to_response(parts, bytes.into());
3384
3385 if let common::Retry::After(d) =
3386 dlg.http_failure(&response, error.as_ref().ok())
3387 {
3388 sleep(d).await;
3389 continue;
3390 }
3391
3392 dlg.finished(false);
3393
3394 return Err(match error {
3395 Ok(value) => common::Error::BadRequest(value),
3396 _ => common::Error::Failure(response),
3397 });
3398 }
3399 let response = {
3400 let bytes = common::to_bytes(body).await.unwrap_or_default();
3401 let encoded = common::to_string(&bytes);
3402 match serde_json::from_str(&encoded) {
3403 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3404 Err(error) => {
3405 dlg.response_json_decode_error(&encoded, &error);
3406 return Err(common::Error::JsonDecodeError(
3407 encoded.to_string(),
3408 error,
3409 ));
3410 }
3411 }
3412 };
3413
3414 dlg.finished(true);
3415 return Ok(response);
3416 }
3417 }
3418 }
3419 }
3420
3421 /// 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.
3422 ///
3423 /// Sets the *resource* path property to the given value.
3424 ///
3425 /// Even though the property as already been set when instantiating this call,
3426 /// we provide this method for API completeness.
3427 pub fn resource(
3428 mut self,
3429 new_value: &str,
3430 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3431 {
3432 self._resource = new_value.to_string();
3433 self
3434 }
3435 /// 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).
3436 ///
3437 /// Sets the *options.requested policy version* query property to the given value.
3438 pub fn options_requested_policy_version(
3439 mut self,
3440 new_value: i32,
3441 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3442 {
3443 self._options_requested_policy_version = Some(new_value);
3444 self
3445 }
3446 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3447 /// while executing the actual API request.
3448 ///
3449 /// ````text
3450 /// It should be used to handle progress information, and to implement a certain level of resilience.
3451 /// ````
3452 ///
3453 /// Sets the *delegate* property to the given value.
3454 pub fn delegate(
3455 mut self,
3456 new_value: &'a mut dyn common::Delegate,
3457 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3458 {
3459 self._delegate = Some(new_value);
3460 self
3461 }
3462
3463 /// Set any additional parameter of the query string used in the request.
3464 /// It should be used to set parameters which are not yet available through their own
3465 /// setters.
3466 ///
3467 /// Please note that this method must not be used to set any of the known parameters
3468 /// which have their own setter method. If done anyway, the request will fail.
3469 ///
3470 /// # Additional Parameters
3471 ///
3472 /// * *$.xgafv* (query-string) - V1 error format.
3473 /// * *access_token* (query-string) - OAuth access token.
3474 /// * *alt* (query-string) - Data format for response.
3475 /// * *callback* (query-string) - JSONP
3476 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3477 /// * *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.
3478 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3479 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3480 /// * *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.
3481 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3482 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3483 pub fn param<T>(
3484 mut self,
3485 name: T,
3486 value: T,
3487 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3488 where
3489 T: AsRef<str>,
3490 {
3491 self._additional_params
3492 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3493 self
3494 }
3495
3496 /// Identifies the authorization scope for the method you are building.
3497 ///
3498 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3499 /// [`Scope::CloudPlatform`].
3500 ///
3501 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3502 /// tokens for more than one scope.
3503 ///
3504 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3505 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3506 /// sufficient, a read-write scope will do as well.
3507 pub fn add_scope<St>(
3508 mut self,
3509 scope: St,
3510 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3511 where
3512 St: AsRef<str>,
3513 {
3514 self._scopes.insert(String::from(scope.as_ref()));
3515 self
3516 }
3517 /// Identifies the authorization scope(s) for the method you are building.
3518 ///
3519 /// See [`Self::add_scope()`] for details.
3520 pub fn add_scopes<I, St>(
3521 mut self,
3522 scopes: I,
3523 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3524 where
3525 I: IntoIterator<Item = St>,
3526 St: AsRef<str>,
3527 {
3528 self._scopes
3529 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3530 self
3531 }
3532
3533 /// Removes all scopes, and no default scope will be used either.
3534 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3535 /// for details).
3536 pub fn clear_scopes(
3537 mut self,
3538 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListGetIamPolicyCall<'a, C>
3539 {
3540 self._scopes.clear();
3541 self
3542 }
3543}
3544
3545/// Lists CertificateRevocationLists.
3546///
3547/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.list* method supported by a *project* resource.
3548/// It is not used directly, but through a [`ProjectMethods`] instance.
3549///
3550/// # Example
3551///
3552/// Instantiate a resource method builder
3553///
3554/// ```test_harness,no_run
3555/// # extern crate hyper;
3556/// # extern crate hyper_rustls;
3557/// # extern crate google_privateca1 as privateca1;
3558/// # async fn dox() {
3559/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3560///
3561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3562/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3563/// # .with_native_roots()
3564/// # .unwrap()
3565/// # .https_only()
3566/// # .enable_http2()
3567/// # .build();
3568///
3569/// # let executor = hyper_util::rt::TokioExecutor::new();
3570/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3571/// # secret,
3572/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3573/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3574/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3575/// # ),
3576/// # ).build().await.unwrap();
3577///
3578/// # let client = hyper_util::client::legacy::Client::builder(
3579/// # hyper_util::rt::TokioExecutor::new()
3580/// # )
3581/// # .build(
3582/// # hyper_rustls::HttpsConnectorBuilder::new()
3583/// # .with_native_roots()
3584/// # .unwrap()
3585/// # .https_or_http()
3586/// # .enable_http2()
3587/// # .build()
3588/// # );
3589/// # let mut hub = CertificateAuthorityService::new(client, auth);
3590/// // You can configure optional parameters by calling the respective setters at will, and
3591/// // execute the final call using `doit()`.
3592/// // Values shown here are possibly random and not representative !
3593/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_list("parent")
3594/// .page_token("est")
3595/// .page_size(-50)
3596/// .order_by("ipsum")
3597/// .filter("est")
3598/// .doit().await;
3599/// # }
3600/// ```
3601pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3602where
3603 C: 'a,
3604{
3605 hub: &'a CertificateAuthorityService<C>,
3606 _parent: String,
3607 _page_token: Option<String>,
3608 _page_size: Option<i32>,
3609 _order_by: Option<String>,
3610 _filter: Option<String>,
3611 _delegate: Option<&'a mut dyn common::Delegate>,
3612 _additional_params: HashMap<String, String>,
3613 _scopes: BTreeSet<String>,
3614}
3615
3616impl<'a, C> common::CallBuilder
3617 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3618{
3619}
3620
3621impl<'a, C> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3622where
3623 C: common::Connector,
3624{
3625 /// Perform the operation you have build so far.
3626 pub async fn doit(
3627 mut self,
3628 ) -> common::Result<(common::Response, ListCertificateRevocationListsResponse)> {
3629 use std::borrow::Cow;
3630 use std::io::{Read, Seek};
3631
3632 use common::{url::Params, ToParts};
3633 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3634
3635 let mut dd = common::DefaultDelegate;
3636 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3637 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.list",
3638 http_method: hyper::Method::GET });
3639
3640 for &field in [
3641 "alt",
3642 "parent",
3643 "pageToken",
3644 "pageSize",
3645 "orderBy",
3646 "filter",
3647 ]
3648 .iter()
3649 {
3650 if self._additional_params.contains_key(field) {
3651 dlg.finished(false);
3652 return Err(common::Error::FieldClash(field));
3653 }
3654 }
3655
3656 let mut params = Params::with_capacity(7 + self._additional_params.len());
3657 params.push("parent", self._parent);
3658 if let Some(value) = self._page_token.as_ref() {
3659 params.push("pageToken", value);
3660 }
3661 if let Some(value) = self._page_size.as_ref() {
3662 params.push("pageSize", value.to_string());
3663 }
3664 if let Some(value) = self._order_by.as_ref() {
3665 params.push("orderBy", value);
3666 }
3667 if let Some(value) = self._filter.as_ref() {
3668 params.push("filter", value);
3669 }
3670
3671 params.extend(self._additional_params.iter());
3672
3673 params.push("alt", "json");
3674 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificateRevocationLists";
3675 if self._scopes.is_empty() {
3676 self._scopes
3677 .insert(Scope::CloudPlatform.as_ref().to_string());
3678 }
3679
3680 #[allow(clippy::single_element_loop)]
3681 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3682 url = params.uri_replacement(url, param_name, find_this, true);
3683 }
3684 {
3685 let to_remove = ["parent"];
3686 params.remove_params(&to_remove);
3687 }
3688
3689 let url = params.parse_with_url(&url);
3690
3691 loop {
3692 let token = match self
3693 .hub
3694 .auth
3695 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3696 .await
3697 {
3698 Ok(token) => token,
3699 Err(e) => match dlg.token(e) {
3700 Ok(token) => token,
3701 Err(e) => {
3702 dlg.finished(false);
3703 return Err(common::Error::MissingToken(e));
3704 }
3705 },
3706 };
3707 let mut req_result = {
3708 let client = &self.hub.client;
3709 dlg.pre_request();
3710 let mut req_builder = hyper::Request::builder()
3711 .method(hyper::Method::GET)
3712 .uri(url.as_str())
3713 .header(USER_AGENT, self.hub._user_agent.clone());
3714
3715 if let Some(token) = token.as_ref() {
3716 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3717 }
3718
3719 let request = req_builder
3720 .header(CONTENT_LENGTH, 0_u64)
3721 .body(common::to_body::<String>(None));
3722
3723 client.request(request.unwrap()).await
3724 };
3725
3726 match req_result {
3727 Err(err) => {
3728 if let common::Retry::After(d) = dlg.http_error(&err) {
3729 sleep(d).await;
3730 continue;
3731 }
3732 dlg.finished(false);
3733 return Err(common::Error::HttpError(err));
3734 }
3735 Ok(res) => {
3736 let (mut parts, body) = res.into_parts();
3737 let mut body = common::Body::new(body);
3738 if !parts.status.is_success() {
3739 let bytes = common::to_bytes(body).await.unwrap_or_default();
3740 let error = serde_json::from_str(&common::to_string(&bytes));
3741 let response = common::to_response(parts, bytes.into());
3742
3743 if let common::Retry::After(d) =
3744 dlg.http_failure(&response, error.as_ref().ok())
3745 {
3746 sleep(d).await;
3747 continue;
3748 }
3749
3750 dlg.finished(false);
3751
3752 return Err(match error {
3753 Ok(value) => common::Error::BadRequest(value),
3754 _ => common::Error::Failure(response),
3755 });
3756 }
3757 let response = {
3758 let bytes = common::to_bytes(body).await.unwrap_or_default();
3759 let encoded = common::to_string(&bytes);
3760 match serde_json::from_str(&encoded) {
3761 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3762 Err(error) => {
3763 dlg.response_json_decode_error(&encoded, &error);
3764 return Err(common::Error::JsonDecodeError(
3765 encoded.to_string(),
3766 error,
3767 ));
3768 }
3769 }
3770 };
3771
3772 dlg.finished(true);
3773 return Ok(response);
3774 }
3775 }
3776 }
3777 }
3778
3779 /// Required. The resource name of the location associated with the CertificateRevocationLists, in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
3780 ///
3781 /// Sets the *parent* path property to the given value.
3782 ///
3783 /// Even though the property as already been set when instantiating this call,
3784 /// we provide this method for API completeness.
3785 pub fn parent(
3786 mut self,
3787 new_value: &str,
3788 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3789 self._parent = new_value.to_string();
3790 self
3791 }
3792 /// Optional. Pagination token, returned earlier via ListCertificateRevocationListsResponse.next_page_token.
3793 ///
3794 /// Sets the *page token* query property to the given value.
3795 pub fn page_token(
3796 mut self,
3797 new_value: &str,
3798 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3799 self._page_token = Some(new_value.to_string());
3800 self
3801 }
3802 /// Optional. Limit on the number of CertificateRevocationLists to include in the response. Further CertificateRevocationLists can subsequently be obtained by including the ListCertificateRevocationListsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
3803 ///
3804 /// Sets the *page size* query property to the given value.
3805 pub fn page_size(
3806 mut self,
3807 new_value: i32,
3808 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3809 self._page_size = Some(new_value);
3810 self
3811 }
3812 /// Optional. Specify how the results should be sorted.
3813 ///
3814 /// Sets the *order by* query property to the given value.
3815 pub fn order_by(
3816 mut self,
3817 new_value: &str,
3818 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3819 self._order_by = Some(new_value.to_string());
3820 self
3821 }
3822 /// Optional. Only include resources that match the filter in the response.
3823 ///
3824 /// Sets the *filter* query property to the given value.
3825 pub fn filter(
3826 mut self,
3827 new_value: &str,
3828 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3829 self._filter = Some(new_value.to_string());
3830 self
3831 }
3832 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3833 /// while executing the actual API request.
3834 ///
3835 /// ````text
3836 /// It should be used to handle progress information, and to implement a certain level of resilience.
3837 /// ````
3838 ///
3839 /// Sets the *delegate* property to the given value.
3840 pub fn delegate(
3841 mut self,
3842 new_value: &'a mut dyn common::Delegate,
3843 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3844 self._delegate = Some(new_value);
3845 self
3846 }
3847
3848 /// Set any additional parameter of the query string used in the request.
3849 /// It should be used to set parameters which are not yet available through their own
3850 /// setters.
3851 ///
3852 /// Please note that this method must not be used to set any of the known parameters
3853 /// which have their own setter method. If done anyway, the request will fail.
3854 ///
3855 /// # Additional Parameters
3856 ///
3857 /// * *$.xgafv* (query-string) - V1 error format.
3858 /// * *access_token* (query-string) - OAuth access token.
3859 /// * *alt* (query-string) - Data format for response.
3860 /// * *callback* (query-string) - JSONP
3861 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3862 /// * *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.
3863 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3864 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3865 /// * *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.
3866 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3867 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3868 pub fn param<T>(
3869 mut self,
3870 name: T,
3871 value: T,
3872 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3873 where
3874 T: AsRef<str>,
3875 {
3876 self._additional_params
3877 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3878 self
3879 }
3880
3881 /// Identifies the authorization scope for the method you are building.
3882 ///
3883 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3884 /// [`Scope::CloudPlatform`].
3885 ///
3886 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3887 /// tokens for more than one scope.
3888 ///
3889 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3890 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3891 /// sufficient, a read-write scope will do as well.
3892 pub fn add_scope<St>(
3893 mut self,
3894 scope: St,
3895 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3896 where
3897 St: AsRef<str>,
3898 {
3899 self._scopes.insert(String::from(scope.as_ref()));
3900 self
3901 }
3902 /// Identifies the authorization scope(s) for the method you are building.
3903 ///
3904 /// See [`Self::add_scope()`] for details.
3905 pub fn add_scopes<I, St>(
3906 mut self,
3907 scopes: I,
3908 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C>
3909 where
3910 I: IntoIterator<Item = St>,
3911 St: AsRef<str>,
3912 {
3913 self._scopes
3914 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3915 self
3916 }
3917
3918 /// Removes all scopes, and no default scope will be used either.
3919 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3920 /// for details).
3921 pub fn clear_scopes(
3922 mut self,
3923 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListListCall<'a, C> {
3924 self._scopes.clear();
3925 self
3926 }
3927}
3928
3929/// Update a CertificateRevocationList.
3930///
3931/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.patch* method supported by a *project* resource.
3932/// It is not used directly, but through a [`ProjectMethods`] instance.
3933///
3934/// # Example
3935///
3936/// Instantiate a resource method builder
3937///
3938/// ```test_harness,no_run
3939/// # extern crate hyper;
3940/// # extern crate hyper_rustls;
3941/// # extern crate google_privateca1 as privateca1;
3942/// use privateca1::api::CertificateRevocationList;
3943/// # async fn dox() {
3944/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3945///
3946/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3947/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3948/// # .with_native_roots()
3949/// # .unwrap()
3950/// # .https_only()
3951/// # .enable_http2()
3952/// # .build();
3953///
3954/// # let executor = hyper_util::rt::TokioExecutor::new();
3955/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3956/// # secret,
3957/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3958/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3959/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3960/// # ),
3961/// # ).build().await.unwrap();
3962///
3963/// # let client = hyper_util::client::legacy::Client::builder(
3964/// # hyper_util::rt::TokioExecutor::new()
3965/// # )
3966/// # .build(
3967/// # hyper_rustls::HttpsConnectorBuilder::new()
3968/// # .with_native_roots()
3969/// # .unwrap()
3970/// # .https_or_http()
3971/// # .enable_http2()
3972/// # .build()
3973/// # );
3974/// # let mut hub = CertificateAuthorityService::new(client, auth);
3975/// // As the method needs a request, you would usually fill it with the desired information
3976/// // into the respective structure. Some of the parts shown here might not be applicable !
3977/// // Values shown here are possibly random and not representative !
3978/// let mut req = CertificateRevocationList::default();
3979///
3980/// // You can configure optional parameters by calling the respective setters at will, and
3981/// // execute the final call using `doit()`.
3982/// // Values shown here are possibly random and not representative !
3983/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_patch(req, "name")
3984/// .update_mask(FieldMask::new::<&str>(&[]))
3985/// .request_id("ea")
3986/// .doit().await;
3987/// # }
3988/// ```
3989pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
3990where
3991 C: 'a,
3992{
3993 hub: &'a CertificateAuthorityService<C>,
3994 _request: CertificateRevocationList,
3995 _name: String,
3996 _update_mask: Option<common::FieldMask>,
3997 _request_id: Option<String>,
3998 _delegate: Option<&'a mut dyn common::Delegate>,
3999 _additional_params: HashMap<String, String>,
4000 _scopes: BTreeSet<String>,
4001}
4002
4003impl<'a, C> common::CallBuilder
4004 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
4005{
4006}
4007
4008impl<'a, C> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
4009where
4010 C: common::Connector,
4011{
4012 /// Perform the operation you have build so far.
4013 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4014 use std::borrow::Cow;
4015 use std::io::{Read, Seek};
4016
4017 use common::{url::Params, ToParts};
4018 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4019
4020 let mut dd = common::DefaultDelegate;
4021 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4022 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.patch",
4023 http_method: hyper::Method::PATCH });
4024
4025 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
4026 if self._additional_params.contains_key(field) {
4027 dlg.finished(false);
4028 return Err(common::Error::FieldClash(field));
4029 }
4030 }
4031
4032 let mut params = Params::with_capacity(6 + self._additional_params.len());
4033 params.push("name", self._name);
4034 if let Some(value) = self._update_mask.as_ref() {
4035 params.push("updateMask", value.to_string());
4036 }
4037 if let Some(value) = self._request_id.as_ref() {
4038 params.push("requestId", value);
4039 }
4040
4041 params.extend(self._additional_params.iter());
4042
4043 params.push("alt", "json");
4044 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4045 if self._scopes.is_empty() {
4046 self._scopes
4047 .insert(Scope::CloudPlatform.as_ref().to_string());
4048 }
4049
4050 #[allow(clippy::single_element_loop)]
4051 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4052 url = params.uri_replacement(url, param_name, find_this, true);
4053 }
4054 {
4055 let to_remove = ["name"];
4056 params.remove_params(&to_remove);
4057 }
4058
4059 let url = params.parse_with_url(&url);
4060
4061 let mut json_mime_type = mime::APPLICATION_JSON;
4062 let mut request_value_reader = {
4063 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4064 common::remove_json_null_values(&mut value);
4065 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4066 serde_json::to_writer(&mut dst, &value).unwrap();
4067 dst
4068 };
4069 let request_size = request_value_reader
4070 .seek(std::io::SeekFrom::End(0))
4071 .unwrap();
4072 request_value_reader
4073 .seek(std::io::SeekFrom::Start(0))
4074 .unwrap();
4075
4076 loop {
4077 let token = match self
4078 .hub
4079 .auth
4080 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4081 .await
4082 {
4083 Ok(token) => token,
4084 Err(e) => match dlg.token(e) {
4085 Ok(token) => token,
4086 Err(e) => {
4087 dlg.finished(false);
4088 return Err(common::Error::MissingToken(e));
4089 }
4090 },
4091 };
4092 request_value_reader
4093 .seek(std::io::SeekFrom::Start(0))
4094 .unwrap();
4095 let mut req_result = {
4096 let client = &self.hub.client;
4097 dlg.pre_request();
4098 let mut req_builder = hyper::Request::builder()
4099 .method(hyper::Method::PATCH)
4100 .uri(url.as_str())
4101 .header(USER_AGENT, self.hub._user_agent.clone());
4102
4103 if let Some(token) = token.as_ref() {
4104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4105 }
4106
4107 let request = req_builder
4108 .header(CONTENT_TYPE, json_mime_type.to_string())
4109 .header(CONTENT_LENGTH, request_size as u64)
4110 .body(common::to_body(
4111 request_value_reader.get_ref().clone().into(),
4112 ));
4113
4114 client.request(request.unwrap()).await
4115 };
4116
4117 match req_result {
4118 Err(err) => {
4119 if let common::Retry::After(d) = dlg.http_error(&err) {
4120 sleep(d).await;
4121 continue;
4122 }
4123 dlg.finished(false);
4124 return Err(common::Error::HttpError(err));
4125 }
4126 Ok(res) => {
4127 let (mut parts, body) = res.into_parts();
4128 let mut body = common::Body::new(body);
4129 if !parts.status.is_success() {
4130 let bytes = common::to_bytes(body).await.unwrap_or_default();
4131 let error = serde_json::from_str(&common::to_string(&bytes));
4132 let response = common::to_response(parts, bytes.into());
4133
4134 if let common::Retry::After(d) =
4135 dlg.http_failure(&response, error.as_ref().ok())
4136 {
4137 sleep(d).await;
4138 continue;
4139 }
4140
4141 dlg.finished(false);
4142
4143 return Err(match error {
4144 Ok(value) => common::Error::BadRequest(value),
4145 _ => common::Error::Failure(response),
4146 });
4147 }
4148 let response = {
4149 let bytes = common::to_bytes(body).await.unwrap_or_default();
4150 let encoded = common::to_string(&bytes);
4151 match serde_json::from_str(&encoded) {
4152 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4153 Err(error) => {
4154 dlg.response_json_decode_error(&encoded, &error);
4155 return Err(common::Error::JsonDecodeError(
4156 encoded.to_string(),
4157 error,
4158 ));
4159 }
4160 }
4161 };
4162
4163 dlg.finished(true);
4164 return Ok(response);
4165 }
4166 }
4167 }
4168 }
4169
4170 ///
4171 /// Sets the *request* property to the given value.
4172 ///
4173 /// Even though the property as already been set when instantiating this call,
4174 /// we provide this method for API completeness.
4175 pub fn request(
4176 mut self,
4177 new_value: CertificateRevocationList,
4178 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4179 self._request = new_value;
4180 self
4181 }
4182 /// Identifier. The resource name for this CertificateRevocationList in the format `projects/*/locations/*/caPools/*certificateAuthorities/*/ certificateRevocationLists/*`.
4183 ///
4184 /// Sets the *name* path property to the given value.
4185 ///
4186 /// Even though the property as already been set when instantiating this call,
4187 /// we provide this method for API completeness.
4188 pub fn name(
4189 mut self,
4190 new_value: &str,
4191 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4192 self._name = new_value.to_string();
4193 self
4194 }
4195 /// Required. A list of fields to be updated in this request.
4196 ///
4197 /// Sets the *update mask* query property to the given value.
4198 pub fn update_mask(
4199 mut self,
4200 new_value: common::FieldMask,
4201 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4202 self._update_mask = Some(new_value);
4203 self
4204 }
4205 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4206 ///
4207 /// Sets the *request id* query property to the given value.
4208 pub fn request_id(
4209 mut self,
4210 new_value: &str,
4211 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4212 self._request_id = Some(new_value.to_string());
4213 self
4214 }
4215 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4216 /// while executing the actual API request.
4217 ///
4218 /// ````text
4219 /// It should be used to handle progress information, and to implement a certain level of resilience.
4220 /// ````
4221 ///
4222 /// Sets the *delegate* property to the given value.
4223 pub fn delegate(
4224 mut self,
4225 new_value: &'a mut dyn common::Delegate,
4226 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4227 self._delegate = Some(new_value);
4228 self
4229 }
4230
4231 /// Set any additional parameter of the query string used in the request.
4232 /// It should be used to set parameters which are not yet available through their own
4233 /// setters.
4234 ///
4235 /// Please note that this method must not be used to set any of the known parameters
4236 /// which have their own setter method. If done anyway, the request will fail.
4237 ///
4238 /// # Additional Parameters
4239 ///
4240 /// * *$.xgafv* (query-string) - V1 error format.
4241 /// * *access_token* (query-string) - OAuth access token.
4242 /// * *alt* (query-string) - Data format for response.
4243 /// * *callback* (query-string) - JSONP
4244 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4245 /// * *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.
4246 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4247 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4248 /// * *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.
4249 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4250 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4251 pub fn param<T>(
4252 mut self,
4253 name: T,
4254 value: T,
4255 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
4256 where
4257 T: AsRef<str>,
4258 {
4259 self._additional_params
4260 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4261 self
4262 }
4263
4264 /// Identifies the authorization scope for the method you are building.
4265 ///
4266 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4267 /// [`Scope::CloudPlatform`].
4268 ///
4269 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4270 /// tokens for more than one scope.
4271 ///
4272 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4273 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4274 /// sufficient, a read-write scope will do as well.
4275 pub fn add_scope<St>(
4276 mut self,
4277 scope: St,
4278 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
4279 where
4280 St: AsRef<str>,
4281 {
4282 self._scopes.insert(String::from(scope.as_ref()));
4283 self
4284 }
4285 /// Identifies the authorization scope(s) for the method you are building.
4286 ///
4287 /// See [`Self::add_scope()`] for details.
4288 pub fn add_scopes<I, St>(
4289 mut self,
4290 scopes: I,
4291 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C>
4292 where
4293 I: IntoIterator<Item = St>,
4294 St: AsRef<str>,
4295 {
4296 self._scopes
4297 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4298 self
4299 }
4300
4301 /// Removes all scopes, and no default scope will be used either.
4302 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4303 /// for details).
4304 pub fn clear_scopes(
4305 mut self,
4306 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListPatchCall<'a, C> {
4307 self._scopes.clear();
4308 self
4309 }
4310}
4311
4312/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4313///
4314/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.setIamPolicy* method supported by a *project* resource.
4315/// It is not used directly, but through a [`ProjectMethods`] instance.
4316///
4317/// # Example
4318///
4319/// Instantiate a resource method builder
4320///
4321/// ```test_harness,no_run
4322/// # extern crate hyper;
4323/// # extern crate hyper_rustls;
4324/// # extern crate google_privateca1 as privateca1;
4325/// use privateca1::api::SetIamPolicyRequest;
4326/// # async fn dox() {
4327/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4328///
4329/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4330/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4331/// # .with_native_roots()
4332/// # .unwrap()
4333/// # .https_only()
4334/// # .enable_http2()
4335/// # .build();
4336///
4337/// # let executor = hyper_util::rt::TokioExecutor::new();
4338/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4339/// # secret,
4340/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4341/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4342/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4343/// # ),
4344/// # ).build().await.unwrap();
4345///
4346/// # let client = hyper_util::client::legacy::Client::builder(
4347/// # hyper_util::rt::TokioExecutor::new()
4348/// # )
4349/// # .build(
4350/// # hyper_rustls::HttpsConnectorBuilder::new()
4351/// # .with_native_roots()
4352/// # .unwrap()
4353/// # .https_or_http()
4354/// # .enable_http2()
4355/// # .build()
4356/// # );
4357/// # let mut hub = CertificateAuthorityService::new(client, auth);
4358/// // As the method needs a request, you would usually fill it with the desired information
4359/// // into the respective structure. Some of the parts shown here might not be applicable !
4360/// // Values shown here are possibly random and not representative !
4361/// let mut req = SetIamPolicyRequest::default();
4362///
4363/// // You can configure optional parameters by calling the respective setters at will, and
4364/// // execute the final call using `doit()`.
4365/// // Values shown here are possibly random and not representative !
4366/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_set_iam_policy(req, "resource")
4367/// .doit().await;
4368/// # }
4369/// ```
4370pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4371where
4372 C: 'a,
4373{
4374 hub: &'a CertificateAuthorityService<C>,
4375 _request: SetIamPolicyRequest,
4376 _resource: String,
4377 _delegate: Option<&'a mut dyn common::Delegate>,
4378 _additional_params: HashMap<String, String>,
4379 _scopes: BTreeSet<String>,
4380}
4381
4382impl<'a, C> common::CallBuilder
4383 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4384{
4385}
4386
4387impl<'a, C>
4388 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4389where
4390 C: common::Connector,
4391{
4392 /// Perform the operation you have build so far.
4393 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4394 use std::borrow::Cow;
4395 use std::io::{Read, Seek};
4396
4397 use common::{url::Params, ToParts};
4398 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4399
4400 let mut dd = common::DefaultDelegate;
4401 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4402 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.setIamPolicy",
4403 http_method: hyper::Method::POST });
4404
4405 for &field in ["alt", "resource"].iter() {
4406 if self._additional_params.contains_key(field) {
4407 dlg.finished(false);
4408 return Err(common::Error::FieldClash(field));
4409 }
4410 }
4411
4412 let mut params = Params::with_capacity(4 + self._additional_params.len());
4413 params.push("resource", self._resource);
4414
4415 params.extend(self._additional_params.iter());
4416
4417 params.push("alt", "json");
4418 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4419 if self._scopes.is_empty() {
4420 self._scopes
4421 .insert(Scope::CloudPlatform.as_ref().to_string());
4422 }
4423
4424 #[allow(clippy::single_element_loop)]
4425 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4426 url = params.uri_replacement(url, param_name, find_this, true);
4427 }
4428 {
4429 let to_remove = ["resource"];
4430 params.remove_params(&to_remove);
4431 }
4432
4433 let url = params.parse_with_url(&url);
4434
4435 let mut json_mime_type = mime::APPLICATION_JSON;
4436 let mut request_value_reader = {
4437 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4438 common::remove_json_null_values(&mut value);
4439 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4440 serde_json::to_writer(&mut dst, &value).unwrap();
4441 dst
4442 };
4443 let request_size = request_value_reader
4444 .seek(std::io::SeekFrom::End(0))
4445 .unwrap();
4446 request_value_reader
4447 .seek(std::io::SeekFrom::Start(0))
4448 .unwrap();
4449
4450 loop {
4451 let token = match self
4452 .hub
4453 .auth
4454 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4455 .await
4456 {
4457 Ok(token) => token,
4458 Err(e) => match dlg.token(e) {
4459 Ok(token) => token,
4460 Err(e) => {
4461 dlg.finished(false);
4462 return Err(common::Error::MissingToken(e));
4463 }
4464 },
4465 };
4466 request_value_reader
4467 .seek(std::io::SeekFrom::Start(0))
4468 .unwrap();
4469 let mut req_result = {
4470 let client = &self.hub.client;
4471 dlg.pre_request();
4472 let mut req_builder = hyper::Request::builder()
4473 .method(hyper::Method::POST)
4474 .uri(url.as_str())
4475 .header(USER_AGENT, self.hub._user_agent.clone());
4476
4477 if let Some(token) = token.as_ref() {
4478 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4479 }
4480
4481 let request = req_builder
4482 .header(CONTENT_TYPE, json_mime_type.to_string())
4483 .header(CONTENT_LENGTH, request_size as u64)
4484 .body(common::to_body(
4485 request_value_reader.get_ref().clone().into(),
4486 ));
4487
4488 client.request(request.unwrap()).await
4489 };
4490
4491 match req_result {
4492 Err(err) => {
4493 if let common::Retry::After(d) = dlg.http_error(&err) {
4494 sleep(d).await;
4495 continue;
4496 }
4497 dlg.finished(false);
4498 return Err(common::Error::HttpError(err));
4499 }
4500 Ok(res) => {
4501 let (mut parts, body) = res.into_parts();
4502 let mut body = common::Body::new(body);
4503 if !parts.status.is_success() {
4504 let bytes = common::to_bytes(body).await.unwrap_or_default();
4505 let error = serde_json::from_str(&common::to_string(&bytes));
4506 let response = common::to_response(parts, bytes.into());
4507
4508 if let common::Retry::After(d) =
4509 dlg.http_failure(&response, error.as_ref().ok())
4510 {
4511 sleep(d).await;
4512 continue;
4513 }
4514
4515 dlg.finished(false);
4516
4517 return Err(match error {
4518 Ok(value) => common::Error::BadRequest(value),
4519 _ => common::Error::Failure(response),
4520 });
4521 }
4522 let response = {
4523 let bytes = common::to_bytes(body).await.unwrap_or_default();
4524 let encoded = common::to_string(&bytes);
4525 match serde_json::from_str(&encoded) {
4526 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4527 Err(error) => {
4528 dlg.response_json_decode_error(&encoded, &error);
4529 return Err(common::Error::JsonDecodeError(
4530 encoded.to_string(),
4531 error,
4532 ));
4533 }
4534 }
4535 };
4536
4537 dlg.finished(true);
4538 return Ok(response);
4539 }
4540 }
4541 }
4542 }
4543
4544 ///
4545 /// Sets the *request* property to the given value.
4546 ///
4547 /// Even though the property as already been set when instantiating this call,
4548 /// we provide this method for API completeness.
4549 pub fn request(
4550 mut self,
4551 new_value: SetIamPolicyRequest,
4552 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4553 {
4554 self._request = new_value;
4555 self
4556 }
4557 /// 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.
4558 ///
4559 /// Sets the *resource* path property to the given value.
4560 ///
4561 /// Even though the property as already been set when instantiating this call,
4562 /// we provide this method for API completeness.
4563 pub fn resource(
4564 mut self,
4565 new_value: &str,
4566 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4567 {
4568 self._resource = new_value.to_string();
4569 self
4570 }
4571 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4572 /// while executing the actual API request.
4573 ///
4574 /// ````text
4575 /// It should be used to handle progress information, and to implement a certain level of resilience.
4576 /// ````
4577 ///
4578 /// Sets the *delegate* property to the given value.
4579 pub fn delegate(
4580 mut self,
4581 new_value: &'a mut dyn common::Delegate,
4582 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4583 {
4584 self._delegate = Some(new_value);
4585 self
4586 }
4587
4588 /// Set any additional parameter of the query string used in the request.
4589 /// It should be used to set parameters which are not yet available through their own
4590 /// setters.
4591 ///
4592 /// Please note that this method must not be used to set any of the known parameters
4593 /// which have their own setter method. If done anyway, the request will fail.
4594 ///
4595 /// # Additional Parameters
4596 ///
4597 /// * *$.xgafv* (query-string) - V1 error format.
4598 /// * *access_token* (query-string) - OAuth access token.
4599 /// * *alt* (query-string) - Data format for response.
4600 /// * *callback* (query-string) - JSONP
4601 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4602 /// * *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.
4603 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4604 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4605 /// * *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.
4606 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4607 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4608 pub fn param<T>(
4609 mut self,
4610 name: T,
4611 value: T,
4612 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4613 where
4614 T: AsRef<str>,
4615 {
4616 self._additional_params
4617 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4618 self
4619 }
4620
4621 /// Identifies the authorization scope for the method you are building.
4622 ///
4623 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4624 /// [`Scope::CloudPlatform`].
4625 ///
4626 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4627 /// tokens for more than one scope.
4628 ///
4629 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4630 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4631 /// sufficient, a read-write scope will do as well.
4632 pub fn add_scope<St>(
4633 mut self,
4634 scope: St,
4635 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4636 where
4637 St: AsRef<str>,
4638 {
4639 self._scopes.insert(String::from(scope.as_ref()));
4640 self
4641 }
4642 /// Identifies the authorization scope(s) for the method you are building.
4643 ///
4644 /// See [`Self::add_scope()`] for details.
4645 pub fn add_scopes<I, St>(
4646 mut self,
4647 scopes: I,
4648 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4649 where
4650 I: IntoIterator<Item = St>,
4651 St: AsRef<str>,
4652 {
4653 self._scopes
4654 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4655 self
4656 }
4657
4658 /// Removes all scopes, and no default scope will be used either.
4659 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4660 /// for details).
4661 pub fn clear_scopes(
4662 mut self,
4663 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListSetIamPolicyCall<'a, C>
4664 {
4665 self._scopes.clear();
4666 self
4667 }
4668}
4669
4670/// 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.
4671///
4672/// A builder for the *locations.caPools.certificateAuthorities.certificateRevocationLists.testIamPermissions* method supported by a *project* resource.
4673/// It is not used directly, but through a [`ProjectMethods`] instance.
4674///
4675/// # Example
4676///
4677/// Instantiate a resource method builder
4678///
4679/// ```test_harness,no_run
4680/// # extern crate hyper;
4681/// # extern crate hyper_rustls;
4682/// # extern crate google_privateca1 as privateca1;
4683/// use privateca1::api::TestIamPermissionsRequest;
4684/// # async fn dox() {
4685/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4686///
4687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4688/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4689/// # .with_native_roots()
4690/// # .unwrap()
4691/// # .https_only()
4692/// # .enable_http2()
4693/// # .build();
4694///
4695/// # let executor = hyper_util::rt::TokioExecutor::new();
4696/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4697/// # secret,
4698/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4699/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4700/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4701/// # ),
4702/// # ).build().await.unwrap();
4703///
4704/// # let client = hyper_util::client::legacy::Client::builder(
4705/// # hyper_util::rt::TokioExecutor::new()
4706/// # )
4707/// # .build(
4708/// # hyper_rustls::HttpsConnectorBuilder::new()
4709/// # .with_native_roots()
4710/// # .unwrap()
4711/// # .https_or_http()
4712/// # .enable_http2()
4713/// # .build()
4714/// # );
4715/// # let mut hub = CertificateAuthorityService::new(client, auth);
4716/// // As the method needs a request, you would usually fill it with the desired information
4717/// // into the respective structure. Some of the parts shown here might not be applicable !
4718/// // Values shown here are possibly random and not representative !
4719/// let mut req = TestIamPermissionsRequest::default();
4720///
4721/// // You can configure optional parameters by calling the respective setters at will, and
4722/// // execute the final call using `doit()`.
4723/// // Values shown here are possibly random and not representative !
4724/// let result = hub.projects().locations_ca_pools_certificate_authorities_certificate_revocation_lists_test_iam_permissions(req, "resource")
4725/// .doit().await;
4726/// # }
4727/// ```
4728pub struct ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4729 'a,
4730 C,
4731> where
4732 C: 'a,
4733{
4734 hub: &'a CertificateAuthorityService<C>,
4735 _request: TestIamPermissionsRequest,
4736 _resource: String,
4737 _delegate: Option<&'a mut dyn common::Delegate>,
4738 _additional_params: HashMap<String, String>,
4739 _scopes: BTreeSet<String>,
4740}
4741
4742impl<'a, C> common::CallBuilder
4743 for ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4744 'a,
4745 C,
4746 >
4747{
4748}
4749
4750impl<'a, C>
4751 ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<'a, C>
4752where
4753 C: common::Connector,
4754{
4755 /// Perform the operation you have build so far.
4756 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
4757 use std::borrow::Cow;
4758 use std::io::{Read, Seek};
4759
4760 use common::{url::Params, ToParts};
4761 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4762
4763 let mut dd = common::DefaultDelegate;
4764 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4765 dlg.begin(common::MethodInfo { id: "privateca.projects.locations.caPools.certificateAuthorities.certificateRevocationLists.testIamPermissions",
4766 http_method: hyper::Method::POST });
4767
4768 for &field in ["alt", "resource"].iter() {
4769 if self._additional_params.contains_key(field) {
4770 dlg.finished(false);
4771 return Err(common::Error::FieldClash(field));
4772 }
4773 }
4774
4775 let mut params = Params::with_capacity(4 + self._additional_params.len());
4776 params.push("resource", self._resource);
4777
4778 params.extend(self._additional_params.iter());
4779
4780 params.push("alt", "json");
4781 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
4782 if self._scopes.is_empty() {
4783 self._scopes
4784 .insert(Scope::CloudPlatform.as_ref().to_string());
4785 }
4786
4787 #[allow(clippy::single_element_loop)]
4788 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4789 url = params.uri_replacement(url, param_name, find_this, true);
4790 }
4791 {
4792 let to_remove = ["resource"];
4793 params.remove_params(&to_remove);
4794 }
4795
4796 let url = params.parse_with_url(&url);
4797
4798 let mut json_mime_type = mime::APPLICATION_JSON;
4799 let mut request_value_reader = {
4800 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4801 common::remove_json_null_values(&mut value);
4802 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4803 serde_json::to_writer(&mut dst, &value).unwrap();
4804 dst
4805 };
4806 let request_size = request_value_reader
4807 .seek(std::io::SeekFrom::End(0))
4808 .unwrap();
4809 request_value_reader
4810 .seek(std::io::SeekFrom::Start(0))
4811 .unwrap();
4812
4813 loop {
4814 let token = match self
4815 .hub
4816 .auth
4817 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4818 .await
4819 {
4820 Ok(token) => token,
4821 Err(e) => match dlg.token(e) {
4822 Ok(token) => token,
4823 Err(e) => {
4824 dlg.finished(false);
4825 return Err(common::Error::MissingToken(e));
4826 }
4827 },
4828 };
4829 request_value_reader
4830 .seek(std::io::SeekFrom::Start(0))
4831 .unwrap();
4832 let mut req_result = {
4833 let client = &self.hub.client;
4834 dlg.pre_request();
4835 let mut req_builder = hyper::Request::builder()
4836 .method(hyper::Method::POST)
4837 .uri(url.as_str())
4838 .header(USER_AGENT, self.hub._user_agent.clone());
4839
4840 if let Some(token) = token.as_ref() {
4841 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4842 }
4843
4844 let request = req_builder
4845 .header(CONTENT_TYPE, json_mime_type.to_string())
4846 .header(CONTENT_LENGTH, request_size as u64)
4847 .body(common::to_body(
4848 request_value_reader.get_ref().clone().into(),
4849 ));
4850
4851 client.request(request.unwrap()).await
4852 };
4853
4854 match req_result {
4855 Err(err) => {
4856 if let common::Retry::After(d) = dlg.http_error(&err) {
4857 sleep(d).await;
4858 continue;
4859 }
4860 dlg.finished(false);
4861 return Err(common::Error::HttpError(err));
4862 }
4863 Ok(res) => {
4864 let (mut parts, body) = res.into_parts();
4865 let mut body = common::Body::new(body);
4866 if !parts.status.is_success() {
4867 let bytes = common::to_bytes(body).await.unwrap_or_default();
4868 let error = serde_json::from_str(&common::to_string(&bytes));
4869 let response = common::to_response(parts, bytes.into());
4870
4871 if let common::Retry::After(d) =
4872 dlg.http_failure(&response, error.as_ref().ok())
4873 {
4874 sleep(d).await;
4875 continue;
4876 }
4877
4878 dlg.finished(false);
4879
4880 return Err(match error {
4881 Ok(value) => common::Error::BadRequest(value),
4882 _ => common::Error::Failure(response),
4883 });
4884 }
4885 let response = {
4886 let bytes = common::to_bytes(body).await.unwrap_or_default();
4887 let encoded = common::to_string(&bytes);
4888 match serde_json::from_str(&encoded) {
4889 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4890 Err(error) => {
4891 dlg.response_json_decode_error(&encoded, &error);
4892 return Err(common::Error::JsonDecodeError(
4893 encoded.to_string(),
4894 error,
4895 ));
4896 }
4897 }
4898 };
4899
4900 dlg.finished(true);
4901 return Ok(response);
4902 }
4903 }
4904 }
4905 }
4906
4907 ///
4908 /// Sets the *request* property to the given value.
4909 ///
4910 /// Even though the property as already been set when instantiating this call,
4911 /// we provide this method for API completeness.
4912 pub fn request(
4913 mut self,
4914 new_value: TestIamPermissionsRequest,
4915 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4916 'a,
4917 C,
4918 > {
4919 self._request = new_value;
4920 self
4921 }
4922 /// 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.
4923 ///
4924 /// Sets the *resource* path property to the given value.
4925 ///
4926 /// Even though the property as already been set when instantiating this call,
4927 /// we provide this method for API completeness.
4928 pub fn resource(
4929 mut self,
4930 new_value: &str,
4931 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4932 'a,
4933 C,
4934 > {
4935 self._resource = new_value.to_string();
4936 self
4937 }
4938 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4939 /// while executing the actual API request.
4940 ///
4941 /// ````text
4942 /// It should be used to handle progress information, and to implement a certain level of resilience.
4943 /// ````
4944 ///
4945 /// Sets the *delegate* property to the given value.
4946 pub fn delegate(
4947 mut self,
4948 new_value: &'a mut dyn common::Delegate,
4949 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4950 'a,
4951 C,
4952 > {
4953 self._delegate = Some(new_value);
4954 self
4955 }
4956
4957 /// Set any additional parameter of the query string used in the request.
4958 /// It should be used to set parameters which are not yet available through their own
4959 /// setters.
4960 ///
4961 /// Please note that this method must not be used to set any of the known parameters
4962 /// which have their own setter method. If done anyway, the request will fail.
4963 ///
4964 /// # Additional Parameters
4965 ///
4966 /// * *$.xgafv* (query-string) - V1 error format.
4967 /// * *access_token* (query-string) - OAuth access token.
4968 /// * *alt* (query-string) - Data format for response.
4969 /// * *callback* (query-string) - JSONP
4970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4971 /// * *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.
4972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4974 /// * *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.
4975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4977 pub fn param<T>(
4978 mut self,
4979 name: T,
4980 value: T,
4981 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
4982 'a,
4983 C,
4984 >
4985 where
4986 T: AsRef<str>,
4987 {
4988 self._additional_params
4989 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4990 self
4991 }
4992
4993 /// Identifies the authorization scope for the method you are building.
4994 ///
4995 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4996 /// [`Scope::CloudPlatform`].
4997 ///
4998 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4999 /// tokens for more than one scope.
5000 ///
5001 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5002 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5003 /// sufficient, a read-write scope will do as well.
5004 pub fn add_scope<St>(
5005 mut self,
5006 scope: St,
5007 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
5008 'a,
5009 C,
5010 >
5011 where
5012 St: AsRef<str>,
5013 {
5014 self._scopes.insert(String::from(scope.as_ref()));
5015 self
5016 }
5017 /// Identifies the authorization scope(s) for the method you are building.
5018 ///
5019 /// See [`Self::add_scope()`] for details.
5020 pub fn add_scopes<I, St>(
5021 mut self,
5022 scopes: I,
5023 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
5024 'a,
5025 C,
5026 >
5027 where
5028 I: IntoIterator<Item = St>,
5029 St: AsRef<str>,
5030 {
5031 self._scopes
5032 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5033 self
5034 }
5035
5036 /// Removes all scopes, and no default scope will be used either.
5037 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5038 /// for details).
5039 pub fn clear_scopes(
5040 mut self,
5041 ) -> ProjectLocationCaPoolCertificateAuthorityCertificateRevocationListTestIamPermissionCall<
5042 'a,
5043 C,
5044 > {
5045 self._scopes.clear();
5046 self
5047 }
5048}
5049
5050/// Activate a CertificateAuthority that is in state AWAITING_USER_ACTIVATION and is of type SUBORDINATE. After the parent Certificate Authority signs a certificate signing request from FetchCertificateAuthorityCsr, this method can complete the activation process.
5051///
5052/// A builder for the *locations.caPools.certificateAuthorities.activate* method supported by a *project* resource.
5053/// It is not used directly, but through a [`ProjectMethods`] instance.
5054///
5055/// # Example
5056///
5057/// Instantiate a resource method builder
5058///
5059/// ```test_harness,no_run
5060/// # extern crate hyper;
5061/// # extern crate hyper_rustls;
5062/// # extern crate google_privateca1 as privateca1;
5063/// use privateca1::api::ActivateCertificateAuthorityRequest;
5064/// # async fn dox() {
5065/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5066///
5067/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5068/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5069/// # .with_native_roots()
5070/// # .unwrap()
5071/// # .https_only()
5072/// # .enable_http2()
5073/// # .build();
5074///
5075/// # let executor = hyper_util::rt::TokioExecutor::new();
5076/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5077/// # secret,
5078/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5079/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5080/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5081/// # ),
5082/// # ).build().await.unwrap();
5083///
5084/// # let client = hyper_util::client::legacy::Client::builder(
5085/// # hyper_util::rt::TokioExecutor::new()
5086/// # )
5087/// # .build(
5088/// # hyper_rustls::HttpsConnectorBuilder::new()
5089/// # .with_native_roots()
5090/// # .unwrap()
5091/// # .https_or_http()
5092/// # .enable_http2()
5093/// # .build()
5094/// # );
5095/// # let mut hub = CertificateAuthorityService::new(client, auth);
5096/// // As the method needs a request, you would usually fill it with the desired information
5097/// // into the respective structure. Some of the parts shown here might not be applicable !
5098/// // Values shown here are possibly random and not representative !
5099/// let mut req = ActivateCertificateAuthorityRequest::default();
5100///
5101/// // You can configure optional parameters by calling the respective setters at will, and
5102/// // execute the final call using `doit()`.
5103/// // Values shown here are possibly random and not representative !
5104/// let result = hub.projects().locations_ca_pools_certificate_authorities_activate(req, "name")
5105/// .doit().await;
5106/// # }
5107/// ```
5108pub struct ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C>
5109where
5110 C: 'a,
5111{
5112 hub: &'a CertificateAuthorityService<C>,
5113 _request: ActivateCertificateAuthorityRequest,
5114 _name: String,
5115 _delegate: Option<&'a mut dyn common::Delegate>,
5116 _additional_params: HashMap<String, String>,
5117 _scopes: BTreeSet<String>,
5118}
5119
5120impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {}
5121
5122impl<'a, C> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C>
5123where
5124 C: common::Connector,
5125{
5126 /// Perform the operation you have build so far.
5127 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5128 use std::borrow::Cow;
5129 use std::io::{Read, Seek};
5130
5131 use common::{url::Params, ToParts};
5132 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5133
5134 let mut dd = common::DefaultDelegate;
5135 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5136 dlg.begin(common::MethodInfo {
5137 id: "privateca.projects.locations.caPools.certificateAuthorities.activate",
5138 http_method: hyper::Method::POST,
5139 });
5140
5141 for &field in ["alt", "name"].iter() {
5142 if self._additional_params.contains_key(field) {
5143 dlg.finished(false);
5144 return Err(common::Error::FieldClash(field));
5145 }
5146 }
5147
5148 let mut params = Params::with_capacity(4 + self._additional_params.len());
5149 params.push("name", self._name);
5150
5151 params.extend(self._additional_params.iter());
5152
5153 params.push("alt", "json");
5154 let mut url = self.hub._base_url.clone() + "v1/{+name}:activate";
5155 if self._scopes.is_empty() {
5156 self._scopes
5157 .insert(Scope::CloudPlatform.as_ref().to_string());
5158 }
5159
5160 #[allow(clippy::single_element_loop)]
5161 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5162 url = params.uri_replacement(url, param_name, find_this, true);
5163 }
5164 {
5165 let to_remove = ["name"];
5166 params.remove_params(&to_remove);
5167 }
5168
5169 let url = params.parse_with_url(&url);
5170
5171 let mut json_mime_type = mime::APPLICATION_JSON;
5172 let mut request_value_reader = {
5173 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5174 common::remove_json_null_values(&mut value);
5175 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5176 serde_json::to_writer(&mut dst, &value).unwrap();
5177 dst
5178 };
5179 let request_size = request_value_reader
5180 .seek(std::io::SeekFrom::End(0))
5181 .unwrap();
5182 request_value_reader
5183 .seek(std::io::SeekFrom::Start(0))
5184 .unwrap();
5185
5186 loop {
5187 let token = match self
5188 .hub
5189 .auth
5190 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5191 .await
5192 {
5193 Ok(token) => token,
5194 Err(e) => match dlg.token(e) {
5195 Ok(token) => token,
5196 Err(e) => {
5197 dlg.finished(false);
5198 return Err(common::Error::MissingToken(e));
5199 }
5200 },
5201 };
5202 request_value_reader
5203 .seek(std::io::SeekFrom::Start(0))
5204 .unwrap();
5205 let mut req_result = {
5206 let client = &self.hub.client;
5207 dlg.pre_request();
5208 let mut req_builder = hyper::Request::builder()
5209 .method(hyper::Method::POST)
5210 .uri(url.as_str())
5211 .header(USER_AGENT, self.hub._user_agent.clone());
5212
5213 if let Some(token) = token.as_ref() {
5214 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5215 }
5216
5217 let request = req_builder
5218 .header(CONTENT_TYPE, json_mime_type.to_string())
5219 .header(CONTENT_LENGTH, request_size as u64)
5220 .body(common::to_body(
5221 request_value_reader.get_ref().clone().into(),
5222 ));
5223
5224 client.request(request.unwrap()).await
5225 };
5226
5227 match req_result {
5228 Err(err) => {
5229 if let common::Retry::After(d) = dlg.http_error(&err) {
5230 sleep(d).await;
5231 continue;
5232 }
5233 dlg.finished(false);
5234 return Err(common::Error::HttpError(err));
5235 }
5236 Ok(res) => {
5237 let (mut parts, body) = res.into_parts();
5238 let mut body = common::Body::new(body);
5239 if !parts.status.is_success() {
5240 let bytes = common::to_bytes(body).await.unwrap_or_default();
5241 let error = serde_json::from_str(&common::to_string(&bytes));
5242 let response = common::to_response(parts, bytes.into());
5243
5244 if let common::Retry::After(d) =
5245 dlg.http_failure(&response, error.as_ref().ok())
5246 {
5247 sleep(d).await;
5248 continue;
5249 }
5250
5251 dlg.finished(false);
5252
5253 return Err(match error {
5254 Ok(value) => common::Error::BadRequest(value),
5255 _ => common::Error::Failure(response),
5256 });
5257 }
5258 let response = {
5259 let bytes = common::to_bytes(body).await.unwrap_or_default();
5260 let encoded = common::to_string(&bytes);
5261 match serde_json::from_str(&encoded) {
5262 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5263 Err(error) => {
5264 dlg.response_json_decode_error(&encoded, &error);
5265 return Err(common::Error::JsonDecodeError(
5266 encoded.to_string(),
5267 error,
5268 ));
5269 }
5270 }
5271 };
5272
5273 dlg.finished(true);
5274 return Ok(response);
5275 }
5276 }
5277 }
5278 }
5279
5280 ///
5281 /// Sets the *request* property to the given value.
5282 ///
5283 /// Even though the property as already been set when instantiating this call,
5284 /// we provide this method for API completeness.
5285 pub fn request(
5286 mut self,
5287 new_value: ActivateCertificateAuthorityRequest,
5288 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {
5289 self._request = new_value;
5290 self
5291 }
5292 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
5293 ///
5294 /// Sets the *name* path property to the given value.
5295 ///
5296 /// Even though the property as already been set when instantiating this call,
5297 /// we provide this method for API completeness.
5298 pub fn name(
5299 mut self,
5300 new_value: &str,
5301 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {
5302 self._name = new_value.to_string();
5303 self
5304 }
5305 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5306 /// while executing the actual API request.
5307 ///
5308 /// ````text
5309 /// It should be used to handle progress information, and to implement a certain level of resilience.
5310 /// ````
5311 ///
5312 /// Sets the *delegate* property to the given value.
5313 pub fn delegate(
5314 mut self,
5315 new_value: &'a mut dyn common::Delegate,
5316 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {
5317 self._delegate = Some(new_value);
5318 self
5319 }
5320
5321 /// Set any additional parameter of the query string used in the request.
5322 /// It should be used to set parameters which are not yet available through their own
5323 /// setters.
5324 ///
5325 /// Please note that this method must not be used to set any of the known parameters
5326 /// which have their own setter method. If done anyway, the request will fail.
5327 ///
5328 /// # Additional Parameters
5329 ///
5330 /// * *$.xgafv* (query-string) - V1 error format.
5331 /// * *access_token* (query-string) - OAuth access token.
5332 /// * *alt* (query-string) - Data format for response.
5333 /// * *callback* (query-string) - JSONP
5334 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5335 /// * *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.
5336 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5337 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5338 /// * *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.
5339 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5340 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5341 pub fn param<T>(
5342 mut self,
5343 name: T,
5344 value: T,
5345 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C>
5346 where
5347 T: AsRef<str>,
5348 {
5349 self._additional_params
5350 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5351 self
5352 }
5353
5354 /// Identifies the authorization scope for the method you are building.
5355 ///
5356 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5357 /// [`Scope::CloudPlatform`].
5358 ///
5359 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5360 /// tokens for more than one scope.
5361 ///
5362 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5363 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5364 /// sufficient, a read-write scope will do as well.
5365 pub fn add_scope<St>(
5366 mut self,
5367 scope: St,
5368 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C>
5369 where
5370 St: AsRef<str>,
5371 {
5372 self._scopes.insert(String::from(scope.as_ref()));
5373 self
5374 }
5375 /// Identifies the authorization scope(s) for the method you are building.
5376 ///
5377 /// See [`Self::add_scope()`] for details.
5378 pub fn add_scopes<I, St>(
5379 mut self,
5380 scopes: I,
5381 ) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C>
5382 where
5383 I: IntoIterator<Item = St>,
5384 St: AsRef<str>,
5385 {
5386 self._scopes
5387 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5388 self
5389 }
5390
5391 /// Removes all scopes, and no default scope will be used either.
5392 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5393 /// for details).
5394 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityActivateCall<'a, C> {
5395 self._scopes.clear();
5396 self
5397 }
5398}
5399
5400/// Create a new CertificateAuthority in a given Project and Location.
5401///
5402/// A builder for the *locations.caPools.certificateAuthorities.create* method supported by a *project* resource.
5403/// It is not used directly, but through a [`ProjectMethods`] instance.
5404///
5405/// # Example
5406///
5407/// Instantiate a resource method builder
5408///
5409/// ```test_harness,no_run
5410/// # extern crate hyper;
5411/// # extern crate hyper_rustls;
5412/// # extern crate google_privateca1 as privateca1;
5413/// use privateca1::api::CertificateAuthority;
5414/// # async fn dox() {
5415/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5416///
5417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5419/// # .with_native_roots()
5420/// # .unwrap()
5421/// # .https_only()
5422/// # .enable_http2()
5423/// # .build();
5424///
5425/// # let executor = hyper_util::rt::TokioExecutor::new();
5426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5427/// # secret,
5428/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5429/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5430/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5431/// # ),
5432/// # ).build().await.unwrap();
5433///
5434/// # let client = hyper_util::client::legacy::Client::builder(
5435/// # hyper_util::rt::TokioExecutor::new()
5436/// # )
5437/// # .build(
5438/// # hyper_rustls::HttpsConnectorBuilder::new()
5439/// # .with_native_roots()
5440/// # .unwrap()
5441/// # .https_or_http()
5442/// # .enable_http2()
5443/// # .build()
5444/// # );
5445/// # let mut hub = CertificateAuthorityService::new(client, auth);
5446/// // As the method needs a request, you would usually fill it with the desired information
5447/// // into the respective structure. Some of the parts shown here might not be applicable !
5448/// // Values shown here are possibly random and not representative !
5449/// let mut req = CertificateAuthority::default();
5450///
5451/// // You can configure optional parameters by calling the respective setters at will, and
5452/// // execute the final call using `doit()`.
5453/// // Values shown here are possibly random and not representative !
5454/// let result = hub.projects().locations_ca_pools_certificate_authorities_create(req, "parent")
5455/// .request_id("sed")
5456/// .certificate_authority_id("duo")
5457/// .doit().await;
5458/// # }
5459/// ```
5460pub struct ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C>
5461where
5462 C: 'a,
5463{
5464 hub: &'a CertificateAuthorityService<C>,
5465 _request: CertificateAuthority,
5466 _parent: String,
5467 _request_id: Option<String>,
5468 _certificate_authority_id: Option<String>,
5469 _delegate: Option<&'a mut dyn common::Delegate>,
5470 _additional_params: HashMap<String, String>,
5471 _scopes: BTreeSet<String>,
5472}
5473
5474impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {}
5475
5476impl<'a, C> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C>
5477where
5478 C: common::Connector,
5479{
5480 /// Perform the operation you have build so far.
5481 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5482 use std::borrow::Cow;
5483 use std::io::{Read, Seek};
5484
5485 use common::{url::Params, ToParts};
5486 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5487
5488 let mut dd = common::DefaultDelegate;
5489 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5490 dlg.begin(common::MethodInfo {
5491 id: "privateca.projects.locations.caPools.certificateAuthorities.create",
5492 http_method: hyper::Method::POST,
5493 });
5494
5495 for &field in ["alt", "parent", "requestId", "certificateAuthorityId"].iter() {
5496 if self._additional_params.contains_key(field) {
5497 dlg.finished(false);
5498 return Err(common::Error::FieldClash(field));
5499 }
5500 }
5501
5502 let mut params = Params::with_capacity(6 + self._additional_params.len());
5503 params.push("parent", self._parent);
5504 if let Some(value) = self._request_id.as_ref() {
5505 params.push("requestId", value);
5506 }
5507 if let Some(value) = self._certificate_authority_id.as_ref() {
5508 params.push("certificateAuthorityId", value);
5509 }
5510
5511 params.extend(self._additional_params.iter());
5512
5513 params.push("alt", "json");
5514 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificateAuthorities";
5515 if self._scopes.is_empty() {
5516 self._scopes
5517 .insert(Scope::CloudPlatform.as_ref().to_string());
5518 }
5519
5520 #[allow(clippy::single_element_loop)]
5521 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5522 url = params.uri_replacement(url, param_name, find_this, true);
5523 }
5524 {
5525 let to_remove = ["parent"];
5526 params.remove_params(&to_remove);
5527 }
5528
5529 let url = params.parse_with_url(&url);
5530
5531 let mut json_mime_type = mime::APPLICATION_JSON;
5532 let mut request_value_reader = {
5533 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5534 common::remove_json_null_values(&mut value);
5535 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5536 serde_json::to_writer(&mut dst, &value).unwrap();
5537 dst
5538 };
5539 let request_size = request_value_reader
5540 .seek(std::io::SeekFrom::End(0))
5541 .unwrap();
5542 request_value_reader
5543 .seek(std::io::SeekFrom::Start(0))
5544 .unwrap();
5545
5546 loop {
5547 let token = match self
5548 .hub
5549 .auth
5550 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5551 .await
5552 {
5553 Ok(token) => token,
5554 Err(e) => match dlg.token(e) {
5555 Ok(token) => token,
5556 Err(e) => {
5557 dlg.finished(false);
5558 return Err(common::Error::MissingToken(e));
5559 }
5560 },
5561 };
5562 request_value_reader
5563 .seek(std::io::SeekFrom::Start(0))
5564 .unwrap();
5565 let mut req_result = {
5566 let client = &self.hub.client;
5567 dlg.pre_request();
5568 let mut req_builder = hyper::Request::builder()
5569 .method(hyper::Method::POST)
5570 .uri(url.as_str())
5571 .header(USER_AGENT, self.hub._user_agent.clone());
5572
5573 if let Some(token) = token.as_ref() {
5574 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5575 }
5576
5577 let request = req_builder
5578 .header(CONTENT_TYPE, json_mime_type.to_string())
5579 .header(CONTENT_LENGTH, request_size as u64)
5580 .body(common::to_body(
5581 request_value_reader.get_ref().clone().into(),
5582 ));
5583
5584 client.request(request.unwrap()).await
5585 };
5586
5587 match req_result {
5588 Err(err) => {
5589 if let common::Retry::After(d) = dlg.http_error(&err) {
5590 sleep(d).await;
5591 continue;
5592 }
5593 dlg.finished(false);
5594 return Err(common::Error::HttpError(err));
5595 }
5596 Ok(res) => {
5597 let (mut parts, body) = res.into_parts();
5598 let mut body = common::Body::new(body);
5599 if !parts.status.is_success() {
5600 let bytes = common::to_bytes(body).await.unwrap_or_default();
5601 let error = serde_json::from_str(&common::to_string(&bytes));
5602 let response = common::to_response(parts, bytes.into());
5603
5604 if let common::Retry::After(d) =
5605 dlg.http_failure(&response, error.as_ref().ok())
5606 {
5607 sleep(d).await;
5608 continue;
5609 }
5610
5611 dlg.finished(false);
5612
5613 return Err(match error {
5614 Ok(value) => common::Error::BadRequest(value),
5615 _ => common::Error::Failure(response),
5616 });
5617 }
5618 let response = {
5619 let bytes = common::to_bytes(body).await.unwrap_or_default();
5620 let encoded = common::to_string(&bytes);
5621 match serde_json::from_str(&encoded) {
5622 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5623 Err(error) => {
5624 dlg.response_json_decode_error(&encoded, &error);
5625 return Err(common::Error::JsonDecodeError(
5626 encoded.to_string(),
5627 error,
5628 ));
5629 }
5630 }
5631 };
5632
5633 dlg.finished(true);
5634 return Ok(response);
5635 }
5636 }
5637 }
5638 }
5639
5640 ///
5641 /// Sets the *request* property to the given value.
5642 ///
5643 /// Even though the property as already been set when instantiating this call,
5644 /// we provide this method for API completeness.
5645 pub fn request(
5646 mut self,
5647 new_value: CertificateAuthority,
5648 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5649 self._request = new_value;
5650 self
5651 }
5652 /// Required. The resource name of the CaPool associated with the CertificateAuthorities, in the format `projects/*/locations/*/caPools/*`.
5653 ///
5654 /// Sets the *parent* path property to the given value.
5655 ///
5656 /// Even though the property as already been set when instantiating this call,
5657 /// we provide this method for API completeness.
5658 pub fn parent(
5659 mut self,
5660 new_value: &str,
5661 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5662 self._parent = new_value.to_string();
5663 self
5664 }
5665 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
5666 ///
5667 /// Sets the *request id* query property to the given value.
5668 pub fn request_id(
5669 mut self,
5670 new_value: &str,
5671 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5672 self._request_id = Some(new_value.to_string());
5673 self
5674 }
5675 /// Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`
5676 ///
5677 /// Sets the *certificate authority id* query property to the given value.
5678 pub fn certificate_authority_id(
5679 mut self,
5680 new_value: &str,
5681 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5682 self._certificate_authority_id = Some(new_value.to_string());
5683 self
5684 }
5685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5686 /// while executing the actual API request.
5687 ///
5688 /// ````text
5689 /// It should be used to handle progress information, and to implement a certain level of resilience.
5690 /// ````
5691 ///
5692 /// Sets the *delegate* property to the given value.
5693 pub fn delegate(
5694 mut self,
5695 new_value: &'a mut dyn common::Delegate,
5696 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5697 self._delegate = Some(new_value);
5698 self
5699 }
5700
5701 /// Set any additional parameter of the query string used in the request.
5702 /// It should be used to set parameters which are not yet available through their own
5703 /// setters.
5704 ///
5705 /// Please note that this method must not be used to set any of the known parameters
5706 /// which have their own setter method. If done anyway, the request will fail.
5707 ///
5708 /// # Additional Parameters
5709 ///
5710 /// * *$.xgafv* (query-string) - V1 error format.
5711 /// * *access_token* (query-string) - OAuth access token.
5712 /// * *alt* (query-string) - Data format for response.
5713 /// * *callback* (query-string) - JSONP
5714 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5715 /// * *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.
5716 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5717 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5718 /// * *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.
5719 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5720 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5721 pub fn param<T>(
5722 mut self,
5723 name: T,
5724 value: T,
5725 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C>
5726 where
5727 T: AsRef<str>,
5728 {
5729 self._additional_params
5730 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5731 self
5732 }
5733
5734 /// Identifies the authorization scope for the method you are building.
5735 ///
5736 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5737 /// [`Scope::CloudPlatform`].
5738 ///
5739 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5740 /// tokens for more than one scope.
5741 ///
5742 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5743 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5744 /// sufficient, a read-write scope will do as well.
5745 pub fn add_scope<St>(
5746 mut self,
5747 scope: St,
5748 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C>
5749 where
5750 St: AsRef<str>,
5751 {
5752 self._scopes.insert(String::from(scope.as_ref()));
5753 self
5754 }
5755 /// Identifies the authorization scope(s) for the method you are building.
5756 ///
5757 /// See [`Self::add_scope()`] for details.
5758 pub fn add_scopes<I, St>(
5759 mut self,
5760 scopes: I,
5761 ) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C>
5762 where
5763 I: IntoIterator<Item = St>,
5764 St: AsRef<str>,
5765 {
5766 self._scopes
5767 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5768 self
5769 }
5770
5771 /// Removes all scopes, and no default scope will be used either.
5772 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5773 /// for details).
5774 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityCreateCall<'a, C> {
5775 self._scopes.clear();
5776 self
5777 }
5778}
5779
5780/// Delete a CertificateAuthority.
5781///
5782/// A builder for the *locations.caPools.certificateAuthorities.delete* method supported by a *project* resource.
5783/// It is not used directly, but through a [`ProjectMethods`] instance.
5784///
5785/// # Example
5786///
5787/// Instantiate a resource method builder
5788///
5789/// ```test_harness,no_run
5790/// # extern crate hyper;
5791/// # extern crate hyper_rustls;
5792/// # extern crate google_privateca1 as privateca1;
5793/// # async fn dox() {
5794/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5795///
5796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5797/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5798/// # .with_native_roots()
5799/// # .unwrap()
5800/// # .https_only()
5801/// # .enable_http2()
5802/// # .build();
5803///
5804/// # let executor = hyper_util::rt::TokioExecutor::new();
5805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5806/// # secret,
5807/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5808/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5809/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5810/// # ),
5811/// # ).build().await.unwrap();
5812///
5813/// # let client = hyper_util::client::legacy::Client::builder(
5814/// # hyper_util::rt::TokioExecutor::new()
5815/// # )
5816/// # .build(
5817/// # hyper_rustls::HttpsConnectorBuilder::new()
5818/// # .with_native_roots()
5819/// # .unwrap()
5820/// # .https_or_http()
5821/// # .enable_http2()
5822/// # .build()
5823/// # );
5824/// # let mut hub = CertificateAuthorityService::new(client, auth);
5825/// // You can configure optional parameters by calling the respective setters at will, and
5826/// // execute the final call using `doit()`.
5827/// // Values shown here are possibly random and not representative !
5828/// let result = hub.projects().locations_ca_pools_certificate_authorities_delete("name")
5829/// .skip_grace_period(true)
5830/// .request_id("Stet")
5831/// .ignore_dependent_resources(true)
5832/// .ignore_active_certificates(true)
5833/// .doit().await;
5834/// # }
5835/// ```
5836pub struct ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C>
5837where
5838 C: 'a,
5839{
5840 hub: &'a CertificateAuthorityService<C>,
5841 _name: String,
5842 _skip_grace_period: Option<bool>,
5843 _request_id: Option<String>,
5844 _ignore_dependent_resources: Option<bool>,
5845 _ignore_active_certificates: Option<bool>,
5846 _delegate: Option<&'a mut dyn common::Delegate>,
5847 _additional_params: HashMap<String, String>,
5848 _scopes: BTreeSet<String>,
5849}
5850
5851impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {}
5852
5853impl<'a, C> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C>
5854where
5855 C: common::Connector,
5856{
5857 /// Perform the operation you have build so far.
5858 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5859 use std::borrow::Cow;
5860 use std::io::{Read, Seek};
5861
5862 use common::{url::Params, ToParts};
5863 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5864
5865 let mut dd = common::DefaultDelegate;
5866 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5867 dlg.begin(common::MethodInfo {
5868 id: "privateca.projects.locations.caPools.certificateAuthorities.delete",
5869 http_method: hyper::Method::DELETE,
5870 });
5871
5872 for &field in [
5873 "alt",
5874 "name",
5875 "skipGracePeriod",
5876 "requestId",
5877 "ignoreDependentResources",
5878 "ignoreActiveCertificates",
5879 ]
5880 .iter()
5881 {
5882 if self._additional_params.contains_key(field) {
5883 dlg.finished(false);
5884 return Err(common::Error::FieldClash(field));
5885 }
5886 }
5887
5888 let mut params = Params::with_capacity(7 + self._additional_params.len());
5889 params.push("name", self._name);
5890 if let Some(value) = self._skip_grace_period.as_ref() {
5891 params.push("skipGracePeriod", value.to_string());
5892 }
5893 if let Some(value) = self._request_id.as_ref() {
5894 params.push("requestId", value);
5895 }
5896 if let Some(value) = self._ignore_dependent_resources.as_ref() {
5897 params.push("ignoreDependentResources", value.to_string());
5898 }
5899 if let Some(value) = self._ignore_active_certificates.as_ref() {
5900 params.push("ignoreActiveCertificates", value.to_string());
5901 }
5902
5903 params.extend(self._additional_params.iter());
5904
5905 params.push("alt", "json");
5906 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5907 if self._scopes.is_empty() {
5908 self._scopes
5909 .insert(Scope::CloudPlatform.as_ref().to_string());
5910 }
5911
5912 #[allow(clippy::single_element_loop)]
5913 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5914 url = params.uri_replacement(url, param_name, find_this, true);
5915 }
5916 {
5917 let to_remove = ["name"];
5918 params.remove_params(&to_remove);
5919 }
5920
5921 let url = params.parse_with_url(&url);
5922
5923 loop {
5924 let token = match self
5925 .hub
5926 .auth
5927 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5928 .await
5929 {
5930 Ok(token) => token,
5931 Err(e) => match dlg.token(e) {
5932 Ok(token) => token,
5933 Err(e) => {
5934 dlg.finished(false);
5935 return Err(common::Error::MissingToken(e));
5936 }
5937 },
5938 };
5939 let mut req_result = {
5940 let client = &self.hub.client;
5941 dlg.pre_request();
5942 let mut req_builder = hyper::Request::builder()
5943 .method(hyper::Method::DELETE)
5944 .uri(url.as_str())
5945 .header(USER_AGENT, self.hub._user_agent.clone());
5946
5947 if let Some(token) = token.as_ref() {
5948 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5949 }
5950
5951 let request = req_builder
5952 .header(CONTENT_LENGTH, 0_u64)
5953 .body(common::to_body::<String>(None));
5954
5955 client.request(request.unwrap()).await
5956 };
5957
5958 match req_result {
5959 Err(err) => {
5960 if let common::Retry::After(d) = dlg.http_error(&err) {
5961 sleep(d).await;
5962 continue;
5963 }
5964 dlg.finished(false);
5965 return Err(common::Error::HttpError(err));
5966 }
5967 Ok(res) => {
5968 let (mut parts, body) = res.into_parts();
5969 let mut body = common::Body::new(body);
5970 if !parts.status.is_success() {
5971 let bytes = common::to_bytes(body).await.unwrap_or_default();
5972 let error = serde_json::from_str(&common::to_string(&bytes));
5973 let response = common::to_response(parts, bytes.into());
5974
5975 if let common::Retry::After(d) =
5976 dlg.http_failure(&response, error.as_ref().ok())
5977 {
5978 sleep(d).await;
5979 continue;
5980 }
5981
5982 dlg.finished(false);
5983
5984 return Err(match error {
5985 Ok(value) => common::Error::BadRequest(value),
5986 _ => common::Error::Failure(response),
5987 });
5988 }
5989 let response = {
5990 let bytes = common::to_bytes(body).await.unwrap_or_default();
5991 let encoded = common::to_string(&bytes);
5992 match serde_json::from_str(&encoded) {
5993 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5994 Err(error) => {
5995 dlg.response_json_decode_error(&encoded, &error);
5996 return Err(common::Error::JsonDecodeError(
5997 encoded.to_string(),
5998 error,
5999 ));
6000 }
6001 }
6002 };
6003
6004 dlg.finished(true);
6005 return Ok(response);
6006 }
6007 }
6008 }
6009 }
6010
6011 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
6012 ///
6013 /// Sets the *name* path property to the given value.
6014 ///
6015 /// Even though the property as already been set when instantiating this call,
6016 /// we provide this method for API completeness.
6017 pub fn name(
6018 mut self,
6019 new_value: &str,
6020 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6021 self._name = new_value.to_string();
6022 self
6023 }
6024 /// Optional. If this flag is set, the Certificate Authority will be deleted as soon as possible without a 30-day grace period where undeletion would have been allowed. If you proceed, there will be no way to recover this CA.
6025 ///
6026 /// Sets the *skip grace period* query property to the given value.
6027 pub fn skip_grace_period(
6028 mut self,
6029 new_value: bool,
6030 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6031 self._skip_grace_period = Some(new_value);
6032 self
6033 }
6034 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
6035 ///
6036 /// Sets the *request id* query property to the given value.
6037 pub fn request_id(
6038 mut self,
6039 new_value: &str,
6040 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6041 self._request_id = Some(new_value.to_string());
6042 self
6043 }
6044 /// Optional. This field allows this CA to be deleted even if it's being depended on by another resource. However, doing so may result in unintended and unrecoverable effects on any dependent resources since the CA will no longer be able to issue certificates.
6045 ///
6046 /// Sets the *ignore dependent resources* query property to the given value.
6047 pub fn ignore_dependent_resources(
6048 mut self,
6049 new_value: bool,
6050 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6051 self._ignore_dependent_resources = Some(new_value);
6052 self
6053 }
6054 /// Optional. This field allows the CA to be deleted even if the CA has active certs. Active certs include both unrevoked and unexpired certs.
6055 ///
6056 /// Sets the *ignore active certificates* query property to the given value.
6057 pub fn ignore_active_certificates(
6058 mut self,
6059 new_value: bool,
6060 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6061 self._ignore_active_certificates = Some(new_value);
6062 self
6063 }
6064 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6065 /// while executing the actual API request.
6066 ///
6067 /// ````text
6068 /// It should be used to handle progress information, and to implement a certain level of resilience.
6069 /// ````
6070 ///
6071 /// Sets the *delegate* property to the given value.
6072 pub fn delegate(
6073 mut self,
6074 new_value: &'a mut dyn common::Delegate,
6075 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6076 self._delegate = Some(new_value);
6077 self
6078 }
6079
6080 /// Set any additional parameter of the query string used in the request.
6081 /// It should be used to set parameters which are not yet available through their own
6082 /// setters.
6083 ///
6084 /// Please note that this method must not be used to set any of the known parameters
6085 /// which have their own setter method. If done anyway, the request will fail.
6086 ///
6087 /// # Additional Parameters
6088 ///
6089 /// * *$.xgafv* (query-string) - V1 error format.
6090 /// * *access_token* (query-string) - OAuth access token.
6091 /// * *alt* (query-string) - Data format for response.
6092 /// * *callback* (query-string) - JSONP
6093 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6094 /// * *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.
6095 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6096 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6097 /// * *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.
6098 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6099 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6100 pub fn param<T>(
6101 mut self,
6102 name: T,
6103 value: T,
6104 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C>
6105 where
6106 T: AsRef<str>,
6107 {
6108 self._additional_params
6109 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6110 self
6111 }
6112
6113 /// Identifies the authorization scope for the method you are building.
6114 ///
6115 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6116 /// [`Scope::CloudPlatform`].
6117 ///
6118 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6119 /// tokens for more than one scope.
6120 ///
6121 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6122 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6123 /// sufficient, a read-write scope will do as well.
6124 pub fn add_scope<St>(
6125 mut self,
6126 scope: St,
6127 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C>
6128 where
6129 St: AsRef<str>,
6130 {
6131 self._scopes.insert(String::from(scope.as_ref()));
6132 self
6133 }
6134 /// Identifies the authorization scope(s) for the method you are building.
6135 ///
6136 /// See [`Self::add_scope()`] for details.
6137 pub fn add_scopes<I, St>(
6138 mut self,
6139 scopes: I,
6140 ) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C>
6141 where
6142 I: IntoIterator<Item = St>,
6143 St: AsRef<str>,
6144 {
6145 self._scopes
6146 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6147 self
6148 }
6149
6150 /// Removes all scopes, and no default scope will be used either.
6151 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6152 /// for details).
6153 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityDeleteCall<'a, C> {
6154 self._scopes.clear();
6155 self
6156 }
6157}
6158
6159/// Disable a CertificateAuthority.
6160///
6161/// A builder for the *locations.caPools.certificateAuthorities.disable* method supported by a *project* resource.
6162/// It is not used directly, but through a [`ProjectMethods`] instance.
6163///
6164/// # Example
6165///
6166/// Instantiate a resource method builder
6167///
6168/// ```test_harness,no_run
6169/// # extern crate hyper;
6170/// # extern crate hyper_rustls;
6171/// # extern crate google_privateca1 as privateca1;
6172/// use privateca1::api::DisableCertificateAuthorityRequest;
6173/// # async fn dox() {
6174/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6175///
6176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6177/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6178/// # .with_native_roots()
6179/// # .unwrap()
6180/// # .https_only()
6181/// # .enable_http2()
6182/// # .build();
6183///
6184/// # let executor = hyper_util::rt::TokioExecutor::new();
6185/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6186/// # secret,
6187/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6188/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6189/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6190/// # ),
6191/// # ).build().await.unwrap();
6192///
6193/// # let client = hyper_util::client::legacy::Client::builder(
6194/// # hyper_util::rt::TokioExecutor::new()
6195/// # )
6196/// # .build(
6197/// # hyper_rustls::HttpsConnectorBuilder::new()
6198/// # .with_native_roots()
6199/// # .unwrap()
6200/// # .https_or_http()
6201/// # .enable_http2()
6202/// # .build()
6203/// # );
6204/// # let mut hub = CertificateAuthorityService::new(client, auth);
6205/// // As the method needs a request, you would usually fill it with the desired information
6206/// // into the respective structure. Some of the parts shown here might not be applicable !
6207/// // Values shown here are possibly random and not representative !
6208/// let mut req = DisableCertificateAuthorityRequest::default();
6209///
6210/// // You can configure optional parameters by calling the respective setters at will, and
6211/// // execute the final call using `doit()`.
6212/// // Values shown here are possibly random and not representative !
6213/// let result = hub.projects().locations_ca_pools_certificate_authorities_disable(req, "name")
6214/// .doit().await;
6215/// # }
6216/// ```
6217pub struct ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C>
6218where
6219 C: 'a,
6220{
6221 hub: &'a CertificateAuthorityService<C>,
6222 _request: DisableCertificateAuthorityRequest,
6223 _name: String,
6224 _delegate: Option<&'a mut dyn common::Delegate>,
6225 _additional_params: HashMap<String, String>,
6226 _scopes: BTreeSet<String>,
6227}
6228
6229impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {}
6230
6231impl<'a, C> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C>
6232where
6233 C: common::Connector,
6234{
6235 /// Perform the operation you have build so far.
6236 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6237 use std::borrow::Cow;
6238 use std::io::{Read, Seek};
6239
6240 use common::{url::Params, ToParts};
6241 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6242
6243 let mut dd = common::DefaultDelegate;
6244 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6245 dlg.begin(common::MethodInfo {
6246 id: "privateca.projects.locations.caPools.certificateAuthorities.disable",
6247 http_method: hyper::Method::POST,
6248 });
6249
6250 for &field in ["alt", "name"].iter() {
6251 if self._additional_params.contains_key(field) {
6252 dlg.finished(false);
6253 return Err(common::Error::FieldClash(field));
6254 }
6255 }
6256
6257 let mut params = Params::with_capacity(4 + self._additional_params.len());
6258 params.push("name", self._name);
6259
6260 params.extend(self._additional_params.iter());
6261
6262 params.push("alt", "json");
6263 let mut url = self.hub._base_url.clone() + "v1/{+name}:disable";
6264 if self._scopes.is_empty() {
6265 self._scopes
6266 .insert(Scope::CloudPlatform.as_ref().to_string());
6267 }
6268
6269 #[allow(clippy::single_element_loop)]
6270 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6271 url = params.uri_replacement(url, param_name, find_this, true);
6272 }
6273 {
6274 let to_remove = ["name"];
6275 params.remove_params(&to_remove);
6276 }
6277
6278 let url = params.parse_with_url(&url);
6279
6280 let mut json_mime_type = mime::APPLICATION_JSON;
6281 let mut request_value_reader = {
6282 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6283 common::remove_json_null_values(&mut value);
6284 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6285 serde_json::to_writer(&mut dst, &value).unwrap();
6286 dst
6287 };
6288 let request_size = request_value_reader
6289 .seek(std::io::SeekFrom::End(0))
6290 .unwrap();
6291 request_value_reader
6292 .seek(std::io::SeekFrom::Start(0))
6293 .unwrap();
6294
6295 loop {
6296 let token = match self
6297 .hub
6298 .auth
6299 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6300 .await
6301 {
6302 Ok(token) => token,
6303 Err(e) => match dlg.token(e) {
6304 Ok(token) => token,
6305 Err(e) => {
6306 dlg.finished(false);
6307 return Err(common::Error::MissingToken(e));
6308 }
6309 },
6310 };
6311 request_value_reader
6312 .seek(std::io::SeekFrom::Start(0))
6313 .unwrap();
6314 let mut req_result = {
6315 let client = &self.hub.client;
6316 dlg.pre_request();
6317 let mut req_builder = hyper::Request::builder()
6318 .method(hyper::Method::POST)
6319 .uri(url.as_str())
6320 .header(USER_AGENT, self.hub._user_agent.clone());
6321
6322 if let Some(token) = token.as_ref() {
6323 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6324 }
6325
6326 let request = req_builder
6327 .header(CONTENT_TYPE, json_mime_type.to_string())
6328 .header(CONTENT_LENGTH, request_size as u64)
6329 .body(common::to_body(
6330 request_value_reader.get_ref().clone().into(),
6331 ));
6332
6333 client.request(request.unwrap()).await
6334 };
6335
6336 match req_result {
6337 Err(err) => {
6338 if let common::Retry::After(d) = dlg.http_error(&err) {
6339 sleep(d).await;
6340 continue;
6341 }
6342 dlg.finished(false);
6343 return Err(common::Error::HttpError(err));
6344 }
6345 Ok(res) => {
6346 let (mut parts, body) = res.into_parts();
6347 let mut body = common::Body::new(body);
6348 if !parts.status.is_success() {
6349 let bytes = common::to_bytes(body).await.unwrap_or_default();
6350 let error = serde_json::from_str(&common::to_string(&bytes));
6351 let response = common::to_response(parts, bytes.into());
6352
6353 if let common::Retry::After(d) =
6354 dlg.http_failure(&response, error.as_ref().ok())
6355 {
6356 sleep(d).await;
6357 continue;
6358 }
6359
6360 dlg.finished(false);
6361
6362 return Err(match error {
6363 Ok(value) => common::Error::BadRequest(value),
6364 _ => common::Error::Failure(response),
6365 });
6366 }
6367 let response = {
6368 let bytes = common::to_bytes(body).await.unwrap_or_default();
6369 let encoded = common::to_string(&bytes);
6370 match serde_json::from_str(&encoded) {
6371 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6372 Err(error) => {
6373 dlg.response_json_decode_error(&encoded, &error);
6374 return Err(common::Error::JsonDecodeError(
6375 encoded.to_string(),
6376 error,
6377 ));
6378 }
6379 }
6380 };
6381
6382 dlg.finished(true);
6383 return Ok(response);
6384 }
6385 }
6386 }
6387 }
6388
6389 ///
6390 /// Sets the *request* property to the given value.
6391 ///
6392 /// Even though the property as already been set when instantiating this call,
6393 /// we provide this method for API completeness.
6394 pub fn request(
6395 mut self,
6396 new_value: DisableCertificateAuthorityRequest,
6397 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {
6398 self._request = new_value;
6399 self
6400 }
6401 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
6402 ///
6403 /// Sets the *name* path property to the given value.
6404 ///
6405 /// Even though the property as already been set when instantiating this call,
6406 /// we provide this method for API completeness.
6407 pub fn name(
6408 mut self,
6409 new_value: &str,
6410 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {
6411 self._name = new_value.to_string();
6412 self
6413 }
6414 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6415 /// while executing the actual API request.
6416 ///
6417 /// ````text
6418 /// It should be used to handle progress information, and to implement a certain level of resilience.
6419 /// ````
6420 ///
6421 /// Sets the *delegate* property to the given value.
6422 pub fn delegate(
6423 mut self,
6424 new_value: &'a mut dyn common::Delegate,
6425 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {
6426 self._delegate = Some(new_value);
6427 self
6428 }
6429
6430 /// Set any additional parameter of the query string used in the request.
6431 /// It should be used to set parameters which are not yet available through their own
6432 /// setters.
6433 ///
6434 /// Please note that this method must not be used to set any of the known parameters
6435 /// which have their own setter method. If done anyway, the request will fail.
6436 ///
6437 /// # Additional Parameters
6438 ///
6439 /// * *$.xgafv* (query-string) - V1 error format.
6440 /// * *access_token* (query-string) - OAuth access token.
6441 /// * *alt* (query-string) - Data format for response.
6442 /// * *callback* (query-string) - JSONP
6443 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6444 /// * *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.
6445 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6446 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6447 /// * *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.
6448 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6449 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6450 pub fn param<T>(
6451 mut self,
6452 name: T,
6453 value: T,
6454 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C>
6455 where
6456 T: AsRef<str>,
6457 {
6458 self._additional_params
6459 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6460 self
6461 }
6462
6463 /// Identifies the authorization scope for the method you are building.
6464 ///
6465 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6466 /// [`Scope::CloudPlatform`].
6467 ///
6468 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6469 /// tokens for more than one scope.
6470 ///
6471 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6472 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6473 /// sufficient, a read-write scope will do as well.
6474 pub fn add_scope<St>(
6475 mut self,
6476 scope: St,
6477 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C>
6478 where
6479 St: AsRef<str>,
6480 {
6481 self._scopes.insert(String::from(scope.as_ref()));
6482 self
6483 }
6484 /// Identifies the authorization scope(s) for the method you are building.
6485 ///
6486 /// See [`Self::add_scope()`] for details.
6487 pub fn add_scopes<I, St>(
6488 mut self,
6489 scopes: I,
6490 ) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C>
6491 where
6492 I: IntoIterator<Item = St>,
6493 St: AsRef<str>,
6494 {
6495 self._scopes
6496 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6497 self
6498 }
6499
6500 /// Removes all scopes, and no default scope will be used either.
6501 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6502 /// for details).
6503 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityDisableCall<'a, C> {
6504 self._scopes.clear();
6505 self
6506 }
6507}
6508
6509/// Enable a CertificateAuthority.
6510///
6511/// A builder for the *locations.caPools.certificateAuthorities.enable* method supported by a *project* resource.
6512/// It is not used directly, but through a [`ProjectMethods`] instance.
6513///
6514/// # Example
6515///
6516/// Instantiate a resource method builder
6517///
6518/// ```test_harness,no_run
6519/// # extern crate hyper;
6520/// # extern crate hyper_rustls;
6521/// # extern crate google_privateca1 as privateca1;
6522/// use privateca1::api::EnableCertificateAuthorityRequest;
6523/// # async fn dox() {
6524/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6525///
6526/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6527/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6528/// # .with_native_roots()
6529/// # .unwrap()
6530/// # .https_only()
6531/// # .enable_http2()
6532/// # .build();
6533///
6534/// # let executor = hyper_util::rt::TokioExecutor::new();
6535/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6536/// # secret,
6537/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6538/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6539/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6540/// # ),
6541/// # ).build().await.unwrap();
6542///
6543/// # let client = hyper_util::client::legacy::Client::builder(
6544/// # hyper_util::rt::TokioExecutor::new()
6545/// # )
6546/// # .build(
6547/// # hyper_rustls::HttpsConnectorBuilder::new()
6548/// # .with_native_roots()
6549/// # .unwrap()
6550/// # .https_or_http()
6551/// # .enable_http2()
6552/// # .build()
6553/// # );
6554/// # let mut hub = CertificateAuthorityService::new(client, auth);
6555/// // As the method needs a request, you would usually fill it with the desired information
6556/// // into the respective structure. Some of the parts shown here might not be applicable !
6557/// // Values shown here are possibly random and not representative !
6558/// let mut req = EnableCertificateAuthorityRequest::default();
6559///
6560/// // You can configure optional parameters by calling the respective setters at will, and
6561/// // execute the final call using `doit()`.
6562/// // Values shown here are possibly random and not representative !
6563/// let result = hub.projects().locations_ca_pools_certificate_authorities_enable(req, "name")
6564/// .doit().await;
6565/// # }
6566/// ```
6567pub struct ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C>
6568where
6569 C: 'a,
6570{
6571 hub: &'a CertificateAuthorityService<C>,
6572 _request: EnableCertificateAuthorityRequest,
6573 _name: String,
6574 _delegate: Option<&'a mut dyn common::Delegate>,
6575 _additional_params: HashMap<String, String>,
6576 _scopes: BTreeSet<String>,
6577}
6578
6579impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {}
6580
6581impl<'a, C> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C>
6582where
6583 C: common::Connector,
6584{
6585 /// Perform the operation you have build so far.
6586 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6587 use std::borrow::Cow;
6588 use std::io::{Read, Seek};
6589
6590 use common::{url::Params, ToParts};
6591 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6592
6593 let mut dd = common::DefaultDelegate;
6594 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6595 dlg.begin(common::MethodInfo {
6596 id: "privateca.projects.locations.caPools.certificateAuthorities.enable",
6597 http_method: hyper::Method::POST,
6598 });
6599
6600 for &field in ["alt", "name"].iter() {
6601 if self._additional_params.contains_key(field) {
6602 dlg.finished(false);
6603 return Err(common::Error::FieldClash(field));
6604 }
6605 }
6606
6607 let mut params = Params::with_capacity(4 + self._additional_params.len());
6608 params.push("name", self._name);
6609
6610 params.extend(self._additional_params.iter());
6611
6612 params.push("alt", "json");
6613 let mut url = self.hub._base_url.clone() + "v1/{+name}:enable";
6614 if self._scopes.is_empty() {
6615 self._scopes
6616 .insert(Scope::CloudPlatform.as_ref().to_string());
6617 }
6618
6619 #[allow(clippy::single_element_loop)]
6620 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6621 url = params.uri_replacement(url, param_name, find_this, true);
6622 }
6623 {
6624 let to_remove = ["name"];
6625 params.remove_params(&to_remove);
6626 }
6627
6628 let url = params.parse_with_url(&url);
6629
6630 let mut json_mime_type = mime::APPLICATION_JSON;
6631 let mut request_value_reader = {
6632 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6633 common::remove_json_null_values(&mut value);
6634 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6635 serde_json::to_writer(&mut dst, &value).unwrap();
6636 dst
6637 };
6638 let request_size = request_value_reader
6639 .seek(std::io::SeekFrom::End(0))
6640 .unwrap();
6641 request_value_reader
6642 .seek(std::io::SeekFrom::Start(0))
6643 .unwrap();
6644
6645 loop {
6646 let token = match self
6647 .hub
6648 .auth
6649 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6650 .await
6651 {
6652 Ok(token) => token,
6653 Err(e) => match dlg.token(e) {
6654 Ok(token) => token,
6655 Err(e) => {
6656 dlg.finished(false);
6657 return Err(common::Error::MissingToken(e));
6658 }
6659 },
6660 };
6661 request_value_reader
6662 .seek(std::io::SeekFrom::Start(0))
6663 .unwrap();
6664 let mut req_result = {
6665 let client = &self.hub.client;
6666 dlg.pre_request();
6667 let mut req_builder = hyper::Request::builder()
6668 .method(hyper::Method::POST)
6669 .uri(url.as_str())
6670 .header(USER_AGENT, self.hub._user_agent.clone());
6671
6672 if let Some(token) = token.as_ref() {
6673 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6674 }
6675
6676 let request = req_builder
6677 .header(CONTENT_TYPE, json_mime_type.to_string())
6678 .header(CONTENT_LENGTH, request_size as u64)
6679 .body(common::to_body(
6680 request_value_reader.get_ref().clone().into(),
6681 ));
6682
6683 client.request(request.unwrap()).await
6684 };
6685
6686 match req_result {
6687 Err(err) => {
6688 if let common::Retry::After(d) = dlg.http_error(&err) {
6689 sleep(d).await;
6690 continue;
6691 }
6692 dlg.finished(false);
6693 return Err(common::Error::HttpError(err));
6694 }
6695 Ok(res) => {
6696 let (mut parts, body) = res.into_parts();
6697 let mut body = common::Body::new(body);
6698 if !parts.status.is_success() {
6699 let bytes = common::to_bytes(body).await.unwrap_or_default();
6700 let error = serde_json::from_str(&common::to_string(&bytes));
6701 let response = common::to_response(parts, bytes.into());
6702
6703 if let common::Retry::After(d) =
6704 dlg.http_failure(&response, error.as_ref().ok())
6705 {
6706 sleep(d).await;
6707 continue;
6708 }
6709
6710 dlg.finished(false);
6711
6712 return Err(match error {
6713 Ok(value) => common::Error::BadRequest(value),
6714 _ => common::Error::Failure(response),
6715 });
6716 }
6717 let response = {
6718 let bytes = common::to_bytes(body).await.unwrap_or_default();
6719 let encoded = common::to_string(&bytes);
6720 match serde_json::from_str(&encoded) {
6721 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6722 Err(error) => {
6723 dlg.response_json_decode_error(&encoded, &error);
6724 return Err(common::Error::JsonDecodeError(
6725 encoded.to_string(),
6726 error,
6727 ));
6728 }
6729 }
6730 };
6731
6732 dlg.finished(true);
6733 return Ok(response);
6734 }
6735 }
6736 }
6737 }
6738
6739 ///
6740 /// Sets the *request* property to the given value.
6741 ///
6742 /// Even though the property as already been set when instantiating this call,
6743 /// we provide this method for API completeness.
6744 pub fn request(
6745 mut self,
6746 new_value: EnableCertificateAuthorityRequest,
6747 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {
6748 self._request = new_value;
6749 self
6750 }
6751 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
6752 ///
6753 /// Sets the *name* path property to the given value.
6754 ///
6755 /// Even though the property as already been set when instantiating this call,
6756 /// we provide this method for API completeness.
6757 pub fn name(
6758 mut self,
6759 new_value: &str,
6760 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {
6761 self._name = new_value.to_string();
6762 self
6763 }
6764 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6765 /// while executing the actual API request.
6766 ///
6767 /// ````text
6768 /// It should be used to handle progress information, and to implement a certain level of resilience.
6769 /// ````
6770 ///
6771 /// Sets the *delegate* property to the given value.
6772 pub fn delegate(
6773 mut self,
6774 new_value: &'a mut dyn common::Delegate,
6775 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {
6776 self._delegate = Some(new_value);
6777 self
6778 }
6779
6780 /// Set any additional parameter of the query string used in the request.
6781 /// It should be used to set parameters which are not yet available through their own
6782 /// setters.
6783 ///
6784 /// Please note that this method must not be used to set any of the known parameters
6785 /// which have their own setter method. If done anyway, the request will fail.
6786 ///
6787 /// # Additional Parameters
6788 ///
6789 /// * *$.xgafv* (query-string) - V1 error format.
6790 /// * *access_token* (query-string) - OAuth access token.
6791 /// * *alt* (query-string) - Data format for response.
6792 /// * *callback* (query-string) - JSONP
6793 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6794 /// * *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.
6795 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6796 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6797 /// * *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.
6798 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6799 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6800 pub fn param<T>(
6801 mut self,
6802 name: T,
6803 value: T,
6804 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C>
6805 where
6806 T: AsRef<str>,
6807 {
6808 self._additional_params
6809 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6810 self
6811 }
6812
6813 /// Identifies the authorization scope for the method you are building.
6814 ///
6815 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6816 /// [`Scope::CloudPlatform`].
6817 ///
6818 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6819 /// tokens for more than one scope.
6820 ///
6821 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6822 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6823 /// sufficient, a read-write scope will do as well.
6824 pub fn add_scope<St>(
6825 mut self,
6826 scope: St,
6827 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C>
6828 where
6829 St: AsRef<str>,
6830 {
6831 self._scopes.insert(String::from(scope.as_ref()));
6832 self
6833 }
6834 /// Identifies the authorization scope(s) for the method you are building.
6835 ///
6836 /// See [`Self::add_scope()`] for details.
6837 pub fn add_scopes<I, St>(
6838 mut self,
6839 scopes: I,
6840 ) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C>
6841 where
6842 I: IntoIterator<Item = St>,
6843 St: AsRef<str>,
6844 {
6845 self._scopes
6846 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6847 self
6848 }
6849
6850 /// Removes all scopes, and no default scope will be used either.
6851 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6852 /// for details).
6853 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityEnableCall<'a, C> {
6854 self._scopes.clear();
6855 self
6856 }
6857}
6858
6859/// Fetch a certificate signing request (CSR) from a CertificateAuthority that is in state AWAITING_USER_ACTIVATION and is of type SUBORDINATE. The CSR must then be signed by the desired parent Certificate Authority, which could be another CertificateAuthority resource, or could be an on-prem certificate authority. See also ActivateCertificateAuthority.
6860///
6861/// A builder for the *locations.caPools.certificateAuthorities.fetch* method supported by a *project* resource.
6862/// It is not used directly, but through a [`ProjectMethods`] instance.
6863///
6864/// # Example
6865///
6866/// Instantiate a resource method builder
6867///
6868/// ```test_harness,no_run
6869/// # extern crate hyper;
6870/// # extern crate hyper_rustls;
6871/// # extern crate google_privateca1 as privateca1;
6872/// # async fn dox() {
6873/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6874///
6875/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6876/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6877/// # .with_native_roots()
6878/// # .unwrap()
6879/// # .https_only()
6880/// # .enable_http2()
6881/// # .build();
6882///
6883/// # let executor = hyper_util::rt::TokioExecutor::new();
6884/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6885/// # secret,
6886/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6887/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6888/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6889/// # ),
6890/// # ).build().await.unwrap();
6891///
6892/// # let client = hyper_util::client::legacy::Client::builder(
6893/// # hyper_util::rt::TokioExecutor::new()
6894/// # )
6895/// # .build(
6896/// # hyper_rustls::HttpsConnectorBuilder::new()
6897/// # .with_native_roots()
6898/// # .unwrap()
6899/// # .https_or_http()
6900/// # .enable_http2()
6901/// # .build()
6902/// # );
6903/// # let mut hub = CertificateAuthorityService::new(client, auth);
6904/// // You can configure optional parameters by calling the respective setters at will, and
6905/// // execute the final call using `doit()`.
6906/// // Values shown here are possibly random and not representative !
6907/// let result = hub.projects().locations_ca_pools_certificate_authorities_fetch("name")
6908/// .doit().await;
6909/// # }
6910/// ```
6911pub struct ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C>
6912where
6913 C: 'a,
6914{
6915 hub: &'a CertificateAuthorityService<C>,
6916 _name: String,
6917 _delegate: Option<&'a mut dyn common::Delegate>,
6918 _additional_params: HashMap<String, String>,
6919 _scopes: BTreeSet<String>,
6920}
6921
6922impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C> {}
6923
6924impl<'a, C> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C>
6925where
6926 C: common::Connector,
6927{
6928 /// Perform the operation you have build so far.
6929 pub async fn doit(
6930 mut self,
6931 ) -> common::Result<(common::Response, FetchCertificateAuthorityCsrResponse)> {
6932 use std::borrow::Cow;
6933 use std::io::{Read, Seek};
6934
6935 use common::{url::Params, ToParts};
6936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6937
6938 let mut dd = common::DefaultDelegate;
6939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6940 dlg.begin(common::MethodInfo {
6941 id: "privateca.projects.locations.caPools.certificateAuthorities.fetch",
6942 http_method: hyper::Method::GET,
6943 });
6944
6945 for &field in ["alt", "name"].iter() {
6946 if self._additional_params.contains_key(field) {
6947 dlg.finished(false);
6948 return Err(common::Error::FieldClash(field));
6949 }
6950 }
6951
6952 let mut params = Params::with_capacity(3 + self._additional_params.len());
6953 params.push("name", self._name);
6954
6955 params.extend(self._additional_params.iter());
6956
6957 params.push("alt", "json");
6958 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetch";
6959 if self._scopes.is_empty() {
6960 self._scopes
6961 .insert(Scope::CloudPlatform.as_ref().to_string());
6962 }
6963
6964 #[allow(clippy::single_element_loop)]
6965 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6966 url = params.uri_replacement(url, param_name, find_this, true);
6967 }
6968 {
6969 let to_remove = ["name"];
6970 params.remove_params(&to_remove);
6971 }
6972
6973 let url = params.parse_with_url(&url);
6974
6975 loop {
6976 let token = match self
6977 .hub
6978 .auth
6979 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6980 .await
6981 {
6982 Ok(token) => token,
6983 Err(e) => match dlg.token(e) {
6984 Ok(token) => token,
6985 Err(e) => {
6986 dlg.finished(false);
6987 return Err(common::Error::MissingToken(e));
6988 }
6989 },
6990 };
6991 let mut req_result = {
6992 let client = &self.hub.client;
6993 dlg.pre_request();
6994 let mut req_builder = hyper::Request::builder()
6995 .method(hyper::Method::GET)
6996 .uri(url.as_str())
6997 .header(USER_AGENT, self.hub._user_agent.clone());
6998
6999 if let Some(token) = token.as_ref() {
7000 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7001 }
7002
7003 let request = req_builder
7004 .header(CONTENT_LENGTH, 0_u64)
7005 .body(common::to_body::<String>(None));
7006
7007 client.request(request.unwrap()).await
7008 };
7009
7010 match req_result {
7011 Err(err) => {
7012 if let common::Retry::After(d) = dlg.http_error(&err) {
7013 sleep(d).await;
7014 continue;
7015 }
7016 dlg.finished(false);
7017 return Err(common::Error::HttpError(err));
7018 }
7019 Ok(res) => {
7020 let (mut parts, body) = res.into_parts();
7021 let mut body = common::Body::new(body);
7022 if !parts.status.is_success() {
7023 let bytes = common::to_bytes(body).await.unwrap_or_default();
7024 let error = serde_json::from_str(&common::to_string(&bytes));
7025 let response = common::to_response(parts, bytes.into());
7026
7027 if let common::Retry::After(d) =
7028 dlg.http_failure(&response, error.as_ref().ok())
7029 {
7030 sleep(d).await;
7031 continue;
7032 }
7033
7034 dlg.finished(false);
7035
7036 return Err(match error {
7037 Ok(value) => common::Error::BadRequest(value),
7038 _ => common::Error::Failure(response),
7039 });
7040 }
7041 let response = {
7042 let bytes = common::to_bytes(body).await.unwrap_or_default();
7043 let encoded = common::to_string(&bytes);
7044 match serde_json::from_str(&encoded) {
7045 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7046 Err(error) => {
7047 dlg.response_json_decode_error(&encoded, &error);
7048 return Err(common::Error::JsonDecodeError(
7049 encoded.to_string(),
7050 error,
7051 ));
7052 }
7053 }
7054 };
7055
7056 dlg.finished(true);
7057 return Ok(response);
7058 }
7059 }
7060 }
7061 }
7062
7063 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
7064 ///
7065 /// Sets the *name* path property to the given value.
7066 ///
7067 /// Even though the property as already been set when instantiating this call,
7068 /// we provide this method for API completeness.
7069 pub fn name(
7070 mut self,
7071 new_value: &str,
7072 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C> {
7073 self._name = new_value.to_string();
7074 self
7075 }
7076 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7077 /// while executing the actual API request.
7078 ///
7079 /// ````text
7080 /// It should be used to handle progress information, and to implement a certain level of resilience.
7081 /// ````
7082 ///
7083 /// Sets the *delegate* property to the given value.
7084 pub fn delegate(
7085 mut self,
7086 new_value: &'a mut dyn common::Delegate,
7087 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C> {
7088 self._delegate = Some(new_value);
7089 self
7090 }
7091
7092 /// Set any additional parameter of the query string used in the request.
7093 /// It should be used to set parameters which are not yet available through their own
7094 /// setters.
7095 ///
7096 /// Please note that this method must not be used to set any of the known parameters
7097 /// which have their own setter method. If done anyway, the request will fail.
7098 ///
7099 /// # Additional Parameters
7100 ///
7101 /// * *$.xgafv* (query-string) - V1 error format.
7102 /// * *access_token* (query-string) - OAuth access token.
7103 /// * *alt* (query-string) - Data format for response.
7104 /// * *callback* (query-string) - JSONP
7105 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7106 /// * *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.
7107 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7108 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7109 /// * *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.
7110 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7111 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7112 pub fn param<T>(
7113 mut self,
7114 name: T,
7115 value: T,
7116 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C>
7117 where
7118 T: AsRef<str>,
7119 {
7120 self._additional_params
7121 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7122 self
7123 }
7124
7125 /// Identifies the authorization scope for the method you are building.
7126 ///
7127 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7128 /// [`Scope::CloudPlatform`].
7129 ///
7130 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7131 /// tokens for more than one scope.
7132 ///
7133 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7134 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7135 /// sufficient, a read-write scope will do as well.
7136 pub fn add_scope<St>(
7137 mut self,
7138 scope: St,
7139 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C>
7140 where
7141 St: AsRef<str>,
7142 {
7143 self._scopes.insert(String::from(scope.as_ref()));
7144 self
7145 }
7146 /// Identifies the authorization scope(s) for the method you are building.
7147 ///
7148 /// See [`Self::add_scope()`] for details.
7149 pub fn add_scopes<I, St>(
7150 mut self,
7151 scopes: I,
7152 ) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C>
7153 where
7154 I: IntoIterator<Item = St>,
7155 St: AsRef<str>,
7156 {
7157 self._scopes
7158 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7159 self
7160 }
7161
7162 /// Removes all scopes, and no default scope will be used either.
7163 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7164 /// for details).
7165 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityFetchCall<'a, C> {
7166 self._scopes.clear();
7167 self
7168 }
7169}
7170
7171/// Returns a CertificateAuthority.
7172///
7173/// A builder for the *locations.caPools.certificateAuthorities.get* method supported by a *project* resource.
7174/// It is not used directly, but through a [`ProjectMethods`] instance.
7175///
7176/// # Example
7177///
7178/// Instantiate a resource method builder
7179///
7180/// ```test_harness,no_run
7181/// # extern crate hyper;
7182/// # extern crate hyper_rustls;
7183/// # extern crate google_privateca1 as privateca1;
7184/// # async fn dox() {
7185/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7186///
7187/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7188/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7189/// # .with_native_roots()
7190/// # .unwrap()
7191/// # .https_only()
7192/// # .enable_http2()
7193/// # .build();
7194///
7195/// # let executor = hyper_util::rt::TokioExecutor::new();
7196/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7197/// # secret,
7198/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7199/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7200/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7201/// # ),
7202/// # ).build().await.unwrap();
7203///
7204/// # let client = hyper_util::client::legacy::Client::builder(
7205/// # hyper_util::rt::TokioExecutor::new()
7206/// # )
7207/// # .build(
7208/// # hyper_rustls::HttpsConnectorBuilder::new()
7209/// # .with_native_roots()
7210/// # .unwrap()
7211/// # .https_or_http()
7212/// # .enable_http2()
7213/// # .build()
7214/// # );
7215/// # let mut hub = CertificateAuthorityService::new(client, auth);
7216/// // You can configure optional parameters by calling the respective setters at will, and
7217/// // execute the final call using `doit()`.
7218/// // Values shown here are possibly random and not representative !
7219/// let result = hub.projects().locations_ca_pools_certificate_authorities_get("name")
7220/// .doit().await;
7221/// # }
7222/// ```
7223pub struct ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C>
7224where
7225 C: 'a,
7226{
7227 hub: &'a CertificateAuthorityService<C>,
7228 _name: String,
7229 _delegate: Option<&'a mut dyn common::Delegate>,
7230 _additional_params: HashMap<String, String>,
7231 _scopes: BTreeSet<String>,
7232}
7233
7234impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C> {}
7235
7236impl<'a, C> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C>
7237where
7238 C: common::Connector,
7239{
7240 /// Perform the operation you have build so far.
7241 pub async fn doit(mut self) -> common::Result<(common::Response, CertificateAuthority)> {
7242 use std::borrow::Cow;
7243 use std::io::{Read, Seek};
7244
7245 use common::{url::Params, ToParts};
7246 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7247
7248 let mut dd = common::DefaultDelegate;
7249 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7250 dlg.begin(common::MethodInfo {
7251 id: "privateca.projects.locations.caPools.certificateAuthorities.get",
7252 http_method: hyper::Method::GET,
7253 });
7254
7255 for &field in ["alt", "name"].iter() {
7256 if self._additional_params.contains_key(field) {
7257 dlg.finished(false);
7258 return Err(common::Error::FieldClash(field));
7259 }
7260 }
7261
7262 let mut params = Params::with_capacity(3 + self._additional_params.len());
7263 params.push("name", self._name);
7264
7265 params.extend(self._additional_params.iter());
7266
7267 params.push("alt", "json");
7268 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7269 if self._scopes.is_empty() {
7270 self._scopes
7271 .insert(Scope::CloudPlatform.as_ref().to_string());
7272 }
7273
7274 #[allow(clippy::single_element_loop)]
7275 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7276 url = params.uri_replacement(url, param_name, find_this, true);
7277 }
7278 {
7279 let to_remove = ["name"];
7280 params.remove_params(&to_remove);
7281 }
7282
7283 let url = params.parse_with_url(&url);
7284
7285 loop {
7286 let token = match self
7287 .hub
7288 .auth
7289 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7290 .await
7291 {
7292 Ok(token) => token,
7293 Err(e) => match dlg.token(e) {
7294 Ok(token) => token,
7295 Err(e) => {
7296 dlg.finished(false);
7297 return Err(common::Error::MissingToken(e));
7298 }
7299 },
7300 };
7301 let mut req_result = {
7302 let client = &self.hub.client;
7303 dlg.pre_request();
7304 let mut req_builder = hyper::Request::builder()
7305 .method(hyper::Method::GET)
7306 .uri(url.as_str())
7307 .header(USER_AGENT, self.hub._user_agent.clone());
7308
7309 if let Some(token) = token.as_ref() {
7310 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7311 }
7312
7313 let request = req_builder
7314 .header(CONTENT_LENGTH, 0_u64)
7315 .body(common::to_body::<String>(None));
7316
7317 client.request(request.unwrap()).await
7318 };
7319
7320 match req_result {
7321 Err(err) => {
7322 if let common::Retry::After(d) = dlg.http_error(&err) {
7323 sleep(d).await;
7324 continue;
7325 }
7326 dlg.finished(false);
7327 return Err(common::Error::HttpError(err));
7328 }
7329 Ok(res) => {
7330 let (mut parts, body) = res.into_parts();
7331 let mut body = common::Body::new(body);
7332 if !parts.status.is_success() {
7333 let bytes = common::to_bytes(body).await.unwrap_or_default();
7334 let error = serde_json::from_str(&common::to_string(&bytes));
7335 let response = common::to_response(parts, bytes.into());
7336
7337 if let common::Retry::After(d) =
7338 dlg.http_failure(&response, error.as_ref().ok())
7339 {
7340 sleep(d).await;
7341 continue;
7342 }
7343
7344 dlg.finished(false);
7345
7346 return Err(match error {
7347 Ok(value) => common::Error::BadRequest(value),
7348 _ => common::Error::Failure(response),
7349 });
7350 }
7351 let response = {
7352 let bytes = common::to_bytes(body).await.unwrap_or_default();
7353 let encoded = common::to_string(&bytes);
7354 match serde_json::from_str(&encoded) {
7355 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7356 Err(error) => {
7357 dlg.response_json_decode_error(&encoded, &error);
7358 return Err(common::Error::JsonDecodeError(
7359 encoded.to_string(),
7360 error,
7361 ));
7362 }
7363 }
7364 };
7365
7366 dlg.finished(true);
7367 return Ok(response);
7368 }
7369 }
7370 }
7371 }
7372
7373 /// Required. The name of the CertificateAuthority to get.
7374 ///
7375 /// Sets the *name* path property to the given value.
7376 ///
7377 /// Even though the property as already been set when instantiating this call,
7378 /// we provide this method for API completeness.
7379 pub fn name(
7380 mut self,
7381 new_value: &str,
7382 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C> {
7383 self._name = new_value.to_string();
7384 self
7385 }
7386 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7387 /// while executing the actual API request.
7388 ///
7389 /// ````text
7390 /// It should be used to handle progress information, and to implement a certain level of resilience.
7391 /// ````
7392 ///
7393 /// Sets the *delegate* property to the given value.
7394 pub fn delegate(
7395 mut self,
7396 new_value: &'a mut dyn common::Delegate,
7397 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C> {
7398 self._delegate = Some(new_value);
7399 self
7400 }
7401
7402 /// Set any additional parameter of the query string used in the request.
7403 /// It should be used to set parameters which are not yet available through their own
7404 /// setters.
7405 ///
7406 /// Please note that this method must not be used to set any of the known parameters
7407 /// which have their own setter method. If done anyway, the request will fail.
7408 ///
7409 /// # Additional Parameters
7410 ///
7411 /// * *$.xgafv* (query-string) - V1 error format.
7412 /// * *access_token* (query-string) - OAuth access token.
7413 /// * *alt* (query-string) - Data format for response.
7414 /// * *callback* (query-string) - JSONP
7415 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7416 /// * *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.
7417 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7418 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7419 /// * *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.
7420 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7421 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7422 pub fn param<T>(
7423 mut self,
7424 name: T,
7425 value: T,
7426 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C>
7427 where
7428 T: AsRef<str>,
7429 {
7430 self._additional_params
7431 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7432 self
7433 }
7434
7435 /// Identifies the authorization scope for the method you are building.
7436 ///
7437 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7438 /// [`Scope::CloudPlatform`].
7439 ///
7440 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7441 /// tokens for more than one scope.
7442 ///
7443 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7444 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7445 /// sufficient, a read-write scope will do as well.
7446 pub fn add_scope<St>(
7447 mut self,
7448 scope: St,
7449 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C>
7450 where
7451 St: AsRef<str>,
7452 {
7453 self._scopes.insert(String::from(scope.as_ref()));
7454 self
7455 }
7456 /// Identifies the authorization scope(s) for the method you are building.
7457 ///
7458 /// See [`Self::add_scope()`] for details.
7459 pub fn add_scopes<I, St>(
7460 mut self,
7461 scopes: I,
7462 ) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C>
7463 where
7464 I: IntoIterator<Item = St>,
7465 St: AsRef<str>,
7466 {
7467 self._scopes
7468 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7469 self
7470 }
7471
7472 /// Removes all scopes, and no default scope will be used either.
7473 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7474 /// for details).
7475 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityGetCall<'a, C> {
7476 self._scopes.clear();
7477 self
7478 }
7479}
7480
7481/// Lists CertificateAuthorities.
7482///
7483/// A builder for the *locations.caPools.certificateAuthorities.list* method supported by a *project* resource.
7484/// It is not used directly, but through a [`ProjectMethods`] instance.
7485///
7486/// # Example
7487///
7488/// Instantiate a resource method builder
7489///
7490/// ```test_harness,no_run
7491/// # extern crate hyper;
7492/// # extern crate hyper_rustls;
7493/// # extern crate google_privateca1 as privateca1;
7494/// # async fn dox() {
7495/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7496///
7497/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7498/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7499/// # .with_native_roots()
7500/// # .unwrap()
7501/// # .https_only()
7502/// # .enable_http2()
7503/// # .build();
7504///
7505/// # let executor = hyper_util::rt::TokioExecutor::new();
7506/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7507/// # secret,
7508/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7509/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7510/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7511/// # ),
7512/// # ).build().await.unwrap();
7513///
7514/// # let client = hyper_util::client::legacy::Client::builder(
7515/// # hyper_util::rt::TokioExecutor::new()
7516/// # )
7517/// # .build(
7518/// # hyper_rustls::HttpsConnectorBuilder::new()
7519/// # .with_native_roots()
7520/// # .unwrap()
7521/// # .https_or_http()
7522/// # .enable_http2()
7523/// # .build()
7524/// # );
7525/// # let mut hub = CertificateAuthorityService::new(client, auth);
7526/// // You can configure optional parameters by calling the respective setters at will, and
7527/// // execute the final call using `doit()`.
7528/// // Values shown here are possibly random and not representative !
7529/// let result = hub.projects().locations_ca_pools_certificate_authorities_list("parent")
7530/// .page_token("et")
7531/// .page_size(-28)
7532/// .order_by("amet.")
7533/// .filter("consetetur")
7534/// .doit().await;
7535/// # }
7536/// ```
7537pub struct ProjectLocationCaPoolCertificateAuthorityListCall<'a, C>
7538where
7539 C: 'a,
7540{
7541 hub: &'a CertificateAuthorityService<C>,
7542 _parent: String,
7543 _page_token: Option<String>,
7544 _page_size: Option<i32>,
7545 _order_by: Option<String>,
7546 _filter: Option<String>,
7547 _delegate: Option<&'a mut dyn common::Delegate>,
7548 _additional_params: HashMap<String, String>,
7549 _scopes: BTreeSet<String>,
7550}
7551
7552impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {}
7553
7554impl<'a, C> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C>
7555where
7556 C: common::Connector,
7557{
7558 /// Perform the operation you have build so far.
7559 pub async fn doit(
7560 mut self,
7561 ) -> common::Result<(common::Response, ListCertificateAuthoritiesResponse)> {
7562 use std::borrow::Cow;
7563 use std::io::{Read, Seek};
7564
7565 use common::{url::Params, ToParts};
7566 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7567
7568 let mut dd = common::DefaultDelegate;
7569 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7570 dlg.begin(common::MethodInfo {
7571 id: "privateca.projects.locations.caPools.certificateAuthorities.list",
7572 http_method: hyper::Method::GET,
7573 });
7574
7575 for &field in [
7576 "alt",
7577 "parent",
7578 "pageToken",
7579 "pageSize",
7580 "orderBy",
7581 "filter",
7582 ]
7583 .iter()
7584 {
7585 if self._additional_params.contains_key(field) {
7586 dlg.finished(false);
7587 return Err(common::Error::FieldClash(field));
7588 }
7589 }
7590
7591 let mut params = Params::with_capacity(7 + self._additional_params.len());
7592 params.push("parent", self._parent);
7593 if let Some(value) = self._page_token.as_ref() {
7594 params.push("pageToken", value);
7595 }
7596 if let Some(value) = self._page_size.as_ref() {
7597 params.push("pageSize", value.to_string());
7598 }
7599 if let Some(value) = self._order_by.as_ref() {
7600 params.push("orderBy", value);
7601 }
7602 if let Some(value) = self._filter.as_ref() {
7603 params.push("filter", value);
7604 }
7605
7606 params.extend(self._additional_params.iter());
7607
7608 params.push("alt", "json");
7609 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificateAuthorities";
7610 if self._scopes.is_empty() {
7611 self._scopes
7612 .insert(Scope::CloudPlatform.as_ref().to_string());
7613 }
7614
7615 #[allow(clippy::single_element_loop)]
7616 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7617 url = params.uri_replacement(url, param_name, find_this, true);
7618 }
7619 {
7620 let to_remove = ["parent"];
7621 params.remove_params(&to_remove);
7622 }
7623
7624 let url = params.parse_with_url(&url);
7625
7626 loop {
7627 let token = match self
7628 .hub
7629 .auth
7630 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7631 .await
7632 {
7633 Ok(token) => token,
7634 Err(e) => match dlg.token(e) {
7635 Ok(token) => token,
7636 Err(e) => {
7637 dlg.finished(false);
7638 return Err(common::Error::MissingToken(e));
7639 }
7640 },
7641 };
7642 let mut req_result = {
7643 let client = &self.hub.client;
7644 dlg.pre_request();
7645 let mut req_builder = hyper::Request::builder()
7646 .method(hyper::Method::GET)
7647 .uri(url.as_str())
7648 .header(USER_AGENT, self.hub._user_agent.clone());
7649
7650 if let Some(token) = token.as_ref() {
7651 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7652 }
7653
7654 let request = req_builder
7655 .header(CONTENT_LENGTH, 0_u64)
7656 .body(common::to_body::<String>(None));
7657
7658 client.request(request.unwrap()).await
7659 };
7660
7661 match req_result {
7662 Err(err) => {
7663 if let common::Retry::After(d) = dlg.http_error(&err) {
7664 sleep(d).await;
7665 continue;
7666 }
7667 dlg.finished(false);
7668 return Err(common::Error::HttpError(err));
7669 }
7670 Ok(res) => {
7671 let (mut parts, body) = res.into_parts();
7672 let mut body = common::Body::new(body);
7673 if !parts.status.is_success() {
7674 let bytes = common::to_bytes(body).await.unwrap_or_default();
7675 let error = serde_json::from_str(&common::to_string(&bytes));
7676 let response = common::to_response(parts, bytes.into());
7677
7678 if let common::Retry::After(d) =
7679 dlg.http_failure(&response, error.as_ref().ok())
7680 {
7681 sleep(d).await;
7682 continue;
7683 }
7684
7685 dlg.finished(false);
7686
7687 return Err(match error {
7688 Ok(value) => common::Error::BadRequest(value),
7689 _ => common::Error::Failure(response),
7690 });
7691 }
7692 let response = {
7693 let bytes = common::to_bytes(body).await.unwrap_or_default();
7694 let encoded = common::to_string(&bytes);
7695 match serde_json::from_str(&encoded) {
7696 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7697 Err(error) => {
7698 dlg.response_json_decode_error(&encoded, &error);
7699 return Err(common::Error::JsonDecodeError(
7700 encoded.to_string(),
7701 error,
7702 ));
7703 }
7704 }
7705 };
7706
7707 dlg.finished(true);
7708 return Ok(response);
7709 }
7710 }
7711 }
7712 }
7713
7714 /// Required. The resource name of the CaPool associated with the CertificateAuthorities, in the format `projects/*/locations/*/caPools/*`.
7715 ///
7716 /// Sets the *parent* path property to the given value.
7717 ///
7718 /// Even though the property as already been set when instantiating this call,
7719 /// we provide this method for API completeness.
7720 pub fn parent(
7721 mut self,
7722 new_value: &str,
7723 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7724 self._parent = new_value.to_string();
7725 self
7726 }
7727 /// Optional. Pagination token, returned earlier via ListCertificateAuthoritiesResponse.next_page_token.
7728 ///
7729 /// Sets the *page token* query property to the given value.
7730 pub fn page_token(
7731 mut self,
7732 new_value: &str,
7733 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7734 self._page_token = Some(new_value.to_string());
7735 self
7736 }
7737 /// Optional. Limit on the number of CertificateAuthorities to include in the response. Further CertificateAuthorities can subsequently be obtained by including the ListCertificateAuthoritiesResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
7738 ///
7739 /// Sets the *page size* query property to the given value.
7740 pub fn page_size(
7741 mut self,
7742 new_value: i32,
7743 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7744 self._page_size = Some(new_value);
7745 self
7746 }
7747 /// Optional. Specify how the results should be sorted.
7748 ///
7749 /// Sets the *order by* query property to the given value.
7750 pub fn order_by(
7751 mut self,
7752 new_value: &str,
7753 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7754 self._order_by = Some(new_value.to_string());
7755 self
7756 }
7757 /// Optional. Only include resources that match the filter in the response.
7758 ///
7759 /// Sets the *filter* query property to the given value.
7760 pub fn filter(
7761 mut self,
7762 new_value: &str,
7763 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7764 self._filter = Some(new_value.to_string());
7765 self
7766 }
7767 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7768 /// while executing the actual API request.
7769 ///
7770 /// ````text
7771 /// It should be used to handle progress information, and to implement a certain level of resilience.
7772 /// ````
7773 ///
7774 /// Sets the *delegate* property to the given value.
7775 pub fn delegate(
7776 mut self,
7777 new_value: &'a mut dyn common::Delegate,
7778 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7779 self._delegate = Some(new_value);
7780 self
7781 }
7782
7783 /// Set any additional parameter of the query string used in the request.
7784 /// It should be used to set parameters which are not yet available through their own
7785 /// setters.
7786 ///
7787 /// Please note that this method must not be used to set any of the known parameters
7788 /// which have their own setter method. If done anyway, the request will fail.
7789 ///
7790 /// # Additional Parameters
7791 ///
7792 /// * *$.xgafv* (query-string) - V1 error format.
7793 /// * *access_token* (query-string) - OAuth access token.
7794 /// * *alt* (query-string) - Data format for response.
7795 /// * *callback* (query-string) - JSONP
7796 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7797 /// * *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.
7798 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7799 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7800 /// * *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.
7801 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7802 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7803 pub fn param<T>(
7804 mut self,
7805 name: T,
7806 value: T,
7807 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C>
7808 where
7809 T: AsRef<str>,
7810 {
7811 self._additional_params
7812 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7813 self
7814 }
7815
7816 /// Identifies the authorization scope for the method you are building.
7817 ///
7818 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7819 /// [`Scope::CloudPlatform`].
7820 ///
7821 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7822 /// tokens for more than one scope.
7823 ///
7824 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7825 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7826 /// sufficient, a read-write scope will do as well.
7827 pub fn add_scope<St>(
7828 mut self,
7829 scope: St,
7830 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C>
7831 where
7832 St: AsRef<str>,
7833 {
7834 self._scopes.insert(String::from(scope.as_ref()));
7835 self
7836 }
7837 /// Identifies the authorization scope(s) for the method you are building.
7838 ///
7839 /// See [`Self::add_scope()`] for details.
7840 pub fn add_scopes<I, St>(
7841 mut self,
7842 scopes: I,
7843 ) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C>
7844 where
7845 I: IntoIterator<Item = St>,
7846 St: AsRef<str>,
7847 {
7848 self._scopes
7849 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7850 self
7851 }
7852
7853 /// Removes all scopes, and no default scope will be used either.
7854 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7855 /// for details).
7856 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityListCall<'a, C> {
7857 self._scopes.clear();
7858 self
7859 }
7860}
7861
7862/// Update a CertificateAuthority.
7863///
7864/// A builder for the *locations.caPools.certificateAuthorities.patch* method supported by a *project* resource.
7865/// It is not used directly, but through a [`ProjectMethods`] instance.
7866///
7867/// # Example
7868///
7869/// Instantiate a resource method builder
7870///
7871/// ```test_harness,no_run
7872/// # extern crate hyper;
7873/// # extern crate hyper_rustls;
7874/// # extern crate google_privateca1 as privateca1;
7875/// use privateca1::api::CertificateAuthority;
7876/// # async fn dox() {
7877/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7878///
7879/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7880/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7881/// # .with_native_roots()
7882/// # .unwrap()
7883/// # .https_only()
7884/// # .enable_http2()
7885/// # .build();
7886///
7887/// # let executor = hyper_util::rt::TokioExecutor::new();
7888/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7889/// # secret,
7890/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7891/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7892/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7893/// # ),
7894/// # ).build().await.unwrap();
7895///
7896/// # let client = hyper_util::client::legacy::Client::builder(
7897/// # hyper_util::rt::TokioExecutor::new()
7898/// # )
7899/// # .build(
7900/// # hyper_rustls::HttpsConnectorBuilder::new()
7901/// # .with_native_roots()
7902/// # .unwrap()
7903/// # .https_or_http()
7904/// # .enable_http2()
7905/// # .build()
7906/// # );
7907/// # let mut hub = CertificateAuthorityService::new(client, auth);
7908/// // As the method needs a request, you would usually fill it with the desired information
7909/// // into the respective structure. Some of the parts shown here might not be applicable !
7910/// // Values shown here are possibly random and not representative !
7911/// let mut req = CertificateAuthority::default();
7912///
7913/// // You can configure optional parameters by calling the respective setters at will, and
7914/// // execute the final call using `doit()`.
7915/// // Values shown here are possibly random and not representative !
7916/// let result = hub.projects().locations_ca_pools_certificate_authorities_patch(req, "name")
7917/// .update_mask(FieldMask::new::<&str>(&[]))
7918/// .request_id("dolor")
7919/// .doit().await;
7920/// # }
7921/// ```
7922pub struct ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C>
7923where
7924 C: 'a,
7925{
7926 hub: &'a CertificateAuthorityService<C>,
7927 _request: CertificateAuthority,
7928 _name: String,
7929 _update_mask: Option<common::FieldMask>,
7930 _request_id: Option<String>,
7931 _delegate: Option<&'a mut dyn common::Delegate>,
7932 _additional_params: HashMap<String, String>,
7933 _scopes: BTreeSet<String>,
7934}
7935
7936impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {}
7937
7938impl<'a, C> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C>
7939where
7940 C: common::Connector,
7941{
7942 /// Perform the operation you have build so far.
7943 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7944 use std::borrow::Cow;
7945 use std::io::{Read, Seek};
7946
7947 use common::{url::Params, ToParts};
7948 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7949
7950 let mut dd = common::DefaultDelegate;
7951 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7952 dlg.begin(common::MethodInfo {
7953 id: "privateca.projects.locations.caPools.certificateAuthorities.patch",
7954 http_method: hyper::Method::PATCH,
7955 });
7956
7957 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
7958 if self._additional_params.contains_key(field) {
7959 dlg.finished(false);
7960 return Err(common::Error::FieldClash(field));
7961 }
7962 }
7963
7964 let mut params = Params::with_capacity(6 + self._additional_params.len());
7965 params.push("name", self._name);
7966 if let Some(value) = self._update_mask.as_ref() {
7967 params.push("updateMask", value.to_string());
7968 }
7969 if let Some(value) = self._request_id.as_ref() {
7970 params.push("requestId", value);
7971 }
7972
7973 params.extend(self._additional_params.iter());
7974
7975 params.push("alt", "json");
7976 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7977 if self._scopes.is_empty() {
7978 self._scopes
7979 .insert(Scope::CloudPlatform.as_ref().to_string());
7980 }
7981
7982 #[allow(clippy::single_element_loop)]
7983 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7984 url = params.uri_replacement(url, param_name, find_this, true);
7985 }
7986 {
7987 let to_remove = ["name"];
7988 params.remove_params(&to_remove);
7989 }
7990
7991 let url = params.parse_with_url(&url);
7992
7993 let mut json_mime_type = mime::APPLICATION_JSON;
7994 let mut request_value_reader = {
7995 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7996 common::remove_json_null_values(&mut value);
7997 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7998 serde_json::to_writer(&mut dst, &value).unwrap();
7999 dst
8000 };
8001 let request_size = request_value_reader
8002 .seek(std::io::SeekFrom::End(0))
8003 .unwrap();
8004 request_value_reader
8005 .seek(std::io::SeekFrom::Start(0))
8006 .unwrap();
8007
8008 loop {
8009 let token = match self
8010 .hub
8011 .auth
8012 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8013 .await
8014 {
8015 Ok(token) => token,
8016 Err(e) => match dlg.token(e) {
8017 Ok(token) => token,
8018 Err(e) => {
8019 dlg.finished(false);
8020 return Err(common::Error::MissingToken(e));
8021 }
8022 },
8023 };
8024 request_value_reader
8025 .seek(std::io::SeekFrom::Start(0))
8026 .unwrap();
8027 let mut req_result = {
8028 let client = &self.hub.client;
8029 dlg.pre_request();
8030 let mut req_builder = hyper::Request::builder()
8031 .method(hyper::Method::PATCH)
8032 .uri(url.as_str())
8033 .header(USER_AGENT, self.hub._user_agent.clone());
8034
8035 if let Some(token) = token.as_ref() {
8036 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8037 }
8038
8039 let request = req_builder
8040 .header(CONTENT_TYPE, json_mime_type.to_string())
8041 .header(CONTENT_LENGTH, request_size as u64)
8042 .body(common::to_body(
8043 request_value_reader.get_ref().clone().into(),
8044 ));
8045
8046 client.request(request.unwrap()).await
8047 };
8048
8049 match req_result {
8050 Err(err) => {
8051 if let common::Retry::After(d) = dlg.http_error(&err) {
8052 sleep(d).await;
8053 continue;
8054 }
8055 dlg.finished(false);
8056 return Err(common::Error::HttpError(err));
8057 }
8058 Ok(res) => {
8059 let (mut parts, body) = res.into_parts();
8060 let mut body = common::Body::new(body);
8061 if !parts.status.is_success() {
8062 let bytes = common::to_bytes(body).await.unwrap_or_default();
8063 let error = serde_json::from_str(&common::to_string(&bytes));
8064 let response = common::to_response(parts, bytes.into());
8065
8066 if let common::Retry::After(d) =
8067 dlg.http_failure(&response, error.as_ref().ok())
8068 {
8069 sleep(d).await;
8070 continue;
8071 }
8072
8073 dlg.finished(false);
8074
8075 return Err(match error {
8076 Ok(value) => common::Error::BadRequest(value),
8077 _ => common::Error::Failure(response),
8078 });
8079 }
8080 let response = {
8081 let bytes = common::to_bytes(body).await.unwrap_or_default();
8082 let encoded = common::to_string(&bytes);
8083 match serde_json::from_str(&encoded) {
8084 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8085 Err(error) => {
8086 dlg.response_json_decode_error(&encoded, &error);
8087 return Err(common::Error::JsonDecodeError(
8088 encoded.to_string(),
8089 error,
8090 ));
8091 }
8092 }
8093 };
8094
8095 dlg.finished(true);
8096 return Ok(response);
8097 }
8098 }
8099 }
8100 }
8101
8102 ///
8103 /// Sets the *request* property to the given value.
8104 ///
8105 /// Even though the property as already been set when instantiating this call,
8106 /// we provide this method for API completeness.
8107 pub fn request(
8108 mut self,
8109 new_value: CertificateAuthority,
8110 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8111 self._request = new_value;
8112 self
8113 }
8114 /// Identifier. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
8115 ///
8116 /// Sets the *name* path property to the given value.
8117 ///
8118 /// Even though the property as already been set when instantiating this call,
8119 /// we provide this method for API completeness.
8120 pub fn name(
8121 mut self,
8122 new_value: &str,
8123 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8124 self._name = new_value.to_string();
8125 self
8126 }
8127 /// Required. A list of fields to be updated in this request.
8128 ///
8129 /// Sets the *update mask* query property to the given value.
8130 pub fn update_mask(
8131 mut self,
8132 new_value: common::FieldMask,
8133 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8134 self._update_mask = Some(new_value);
8135 self
8136 }
8137 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
8138 ///
8139 /// Sets the *request id* query property to the given value.
8140 pub fn request_id(
8141 mut self,
8142 new_value: &str,
8143 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8144 self._request_id = Some(new_value.to_string());
8145 self
8146 }
8147 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8148 /// while executing the actual API request.
8149 ///
8150 /// ````text
8151 /// It should be used to handle progress information, and to implement a certain level of resilience.
8152 /// ````
8153 ///
8154 /// Sets the *delegate* property to the given value.
8155 pub fn delegate(
8156 mut self,
8157 new_value: &'a mut dyn common::Delegate,
8158 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8159 self._delegate = Some(new_value);
8160 self
8161 }
8162
8163 /// Set any additional parameter of the query string used in the request.
8164 /// It should be used to set parameters which are not yet available through their own
8165 /// setters.
8166 ///
8167 /// Please note that this method must not be used to set any of the known parameters
8168 /// which have their own setter method. If done anyway, the request will fail.
8169 ///
8170 /// # Additional Parameters
8171 ///
8172 /// * *$.xgafv* (query-string) - V1 error format.
8173 /// * *access_token* (query-string) - OAuth access token.
8174 /// * *alt* (query-string) - Data format for response.
8175 /// * *callback* (query-string) - JSONP
8176 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8177 /// * *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.
8178 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8179 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8180 /// * *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.
8181 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8182 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8183 pub fn param<T>(
8184 mut self,
8185 name: T,
8186 value: T,
8187 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C>
8188 where
8189 T: AsRef<str>,
8190 {
8191 self._additional_params
8192 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8193 self
8194 }
8195
8196 /// Identifies the authorization scope for the method you are building.
8197 ///
8198 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8199 /// [`Scope::CloudPlatform`].
8200 ///
8201 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8202 /// tokens for more than one scope.
8203 ///
8204 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8205 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8206 /// sufficient, a read-write scope will do as well.
8207 pub fn add_scope<St>(
8208 mut self,
8209 scope: St,
8210 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C>
8211 where
8212 St: AsRef<str>,
8213 {
8214 self._scopes.insert(String::from(scope.as_ref()));
8215 self
8216 }
8217 /// Identifies the authorization scope(s) for the method you are building.
8218 ///
8219 /// See [`Self::add_scope()`] for details.
8220 pub fn add_scopes<I, St>(
8221 mut self,
8222 scopes: I,
8223 ) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C>
8224 where
8225 I: IntoIterator<Item = St>,
8226 St: AsRef<str>,
8227 {
8228 self._scopes
8229 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8230 self
8231 }
8232
8233 /// Removes all scopes, and no default scope will be used either.
8234 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8235 /// for details).
8236 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityPatchCall<'a, C> {
8237 self._scopes.clear();
8238 self
8239 }
8240}
8241
8242/// Undelete a CertificateAuthority that has been deleted.
8243///
8244/// A builder for the *locations.caPools.certificateAuthorities.undelete* method supported by a *project* resource.
8245/// It is not used directly, but through a [`ProjectMethods`] instance.
8246///
8247/// # Example
8248///
8249/// Instantiate a resource method builder
8250///
8251/// ```test_harness,no_run
8252/// # extern crate hyper;
8253/// # extern crate hyper_rustls;
8254/// # extern crate google_privateca1 as privateca1;
8255/// use privateca1::api::UndeleteCertificateAuthorityRequest;
8256/// # async fn dox() {
8257/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8258///
8259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8260/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8261/// # .with_native_roots()
8262/// # .unwrap()
8263/// # .https_only()
8264/// # .enable_http2()
8265/// # .build();
8266///
8267/// # let executor = hyper_util::rt::TokioExecutor::new();
8268/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8269/// # secret,
8270/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8271/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8272/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8273/// # ),
8274/// # ).build().await.unwrap();
8275///
8276/// # let client = hyper_util::client::legacy::Client::builder(
8277/// # hyper_util::rt::TokioExecutor::new()
8278/// # )
8279/// # .build(
8280/// # hyper_rustls::HttpsConnectorBuilder::new()
8281/// # .with_native_roots()
8282/// # .unwrap()
8283/// # .https_or_http()
8284/// # .enable_http2()
8285/// # .build()
8286/// # );
8287/// # let mut hub = CertificateAuthorityService::new(client, auth);
8288/// // As the method needs a request, you would usually fill it with the desired information
8289/// // into the respective structure. Some of the parts shown here might not be applicable !
8290/// // Values shown here are possibly random and not representative !
8291/// let mut req = UndeleteCertificateAuthorityRequest::default();
8292///
8293/// // You can configure optional parameters by calling the respective setters at will, and
8294/// // execute the final call using `doit()`.
8295/// // Values shown here are possibly random and not representative !
8296/// let result = hub.projects().locations_ca_pools_certificate_authorities_undelete(req, "name")
8297/// .doit().await;
8298/// # }
8299/// ```
8300pub struct ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C>
8301where
8302 C: 'a,
8303{
8304 hub: &'a CertificateAuthorityService<C>,
8305 _request: UndeleteCertificateAuthorityRequest,
8306 _name: String,
8307 _delegate: Option<&'a mut dyn common::Delegate>,
8308 _additional_params: HashMap<String, String>,
8309 _scopes: BTreeSet<String>,
8310}
8311
8312impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {}
8313
8314impl<'a, C> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C>
8315where
8316 C: common::Connector,
8317{
8318 /// Perform the operation you have build so far.
8319 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8320 use std::borrow::Cow;
8321 use std::io::{Read, Seek};
8322
8323 use common::{url::Params, ToParts};
8324 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8325
8326 let mut dd = common::DefaultDelegate;
8327 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8328 dlg.begin(common::MethodInfo {
8329 id: "privateca.projects.locations.caPools.certificateAuthorities.undelete",
8330 http_method: hyper::Method::POST,
8331 });
8332
8333 for &field in ["alt", "name"].iter() {
8334 if self._additional_params.contains_key(field) {
8335 dlg.finished(false);
8336 return Err(common::Error::FieldClash(field));
8337 }
8338 }
8339
8340 let mut params = Params::with_capacity(4 + self._additional_params.len());
8341 params.push("name", self._name);
8342
8343 params.extend(self._additional_params.iter());
8344
8345 params.push("alt", "json");
8346 let mut url = self.hub._base_url.clone() + "v1/{+name}:undelete";
8347 if self._scopes.is_empty() {
8348 self._scopes
8349 .insert(Scope::CloudPlatform.as_ref().to_string());
8350 }
8351
8352 #[allow(clippy::single_element_loop)]
8353 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8354 url = params.uri_replacement(url, param_name, find_this, true);
8355 }
8356 {
8357 let to_remove = ["name"];
8358 params.remove_params(&to_remove);
8359 }
8360
8361 let url = params.parse_with_url(&url);
8362
8363 let mut json_mime_type = mime::APPLICATION_JSON;
8364 let mut request_value_reader = {
8365 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8366 common::remove_json_null_values(&mut value);
8367 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8368 serde_json::to_writer(&mut dst, &value).unwrap();
8369 dst
8370 };
8371 let request_size = request_value_reader
8372 .seek(std::io::SeekFrom::End(0))
8373 .unwrap();
8374 request_value_reader
8375 .seek(std::io::SeekFrom::Start(0))
8376 .unwrap();
8377
8378 loop {
8379 let token = match self
8380 .hub
8381 .auth
8382 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8383 .await
8384 {
8385 Ok(token) => token,
8386 Err(e) => match dlg.token(e) {
8387 Ok(token) => token,
8388 Err(e) => {
8389 dlg.finished(false);
8390 return Err(common::Error::MissingToken(e));
8391 }
8392 },
8393 };
8394 request_value_reader
8395 .seek(std::io::SeekFrom::Start(0))
8396 .unwrap();
8397 let mut req_result = {
8398 let client = &self.hub.client;
8399 dlg.pre_request();
8400 let mut req_builder = hyper::Request::builder()
8401 .method(hyper::Method::POST)
8402 .uri(url.as_str())
8403 .header(USER_AGENT, self.hub._user_agent.clone());
8404
8405 if let Some(token) = token.as_ref() {
8406 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8407 }
8408
8409 let request = req_builder
8410 .header(CONTENT_TYPE, json_mime_type.to_string())
8411 .header(CONTENT_LENGTH, request_size as u64)
8412 .body(common::to_body(
8413 request_value_reader.get_ref().clone().into(),
8414 ));
8415
8416 client.request(request.unwrap()).await
8417 };
8418
8419 match req_result {
8420 Err(err) => {
8421 if let common::Retry::After(d) = dlg.http_error(&err) {
8422 sleep(d).await;
8423 continue;
8424 }
8425 dlg.finished(false);
8426 return Err(common::Error::HttpError(err));
8427 }
8428 Ok(res) => {
8429 let (mut parts, body) = res.into_parts();
8430 let mut body = common::Body::new(body);
8431 if !parts.status.is_success() {
8432 let bytes = common::to_bytes(body).await.unwrap_or_default();
8433 let error = serde_json::from_str(&common::to_string(&bytes));
8434 let response = common::to_response(parts, bytes.into());
8435
8436 if let common::Retry::After(d) =
8437 dlg.http_failure(&response, error.as_ref().ok())
8438 {
8439 sleep(d).await;
8440 continue;
8441 }
8442
8443 dlg.finished(false);
8444
8445 return Err(match error {
8446 Ok(value) => common::Error::BadRequest(value),
8447 _ => common::Error::Failure(response),
8448 });
8449 }
8450 let response = {
8451 let bytes = common::to_bytes(body).await.unwrap_or_default();
8452 let encoded = common::to_string(&bytes);
8453 match serde_json::from_str(&encoded) {
8454 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8455 Err(error) => {
8456 dlg.response_json_decode_error(&encoded, &error);
8457 return Err(common::Error::JsonDecodeError(
8458 encoded.to_string(),
8459 error,
8460 ));
8461 }
8462 }
8463 };
8464
8465 dlg.finished(true);
8466 return Ok(response);
8467 }
8468 }
8469 }
8470 }
8471
8472 ///
8473 /// Sets the *request* property to the given value.
8474 ///
8475 /// Even though the property as already been set when instantiating this call,
8476 /// we provide this method for API completeness.
8477 pub fn request(
8478 mut self,
8479 new_value: UndeleteCertificateAuthorityRequest,
8480 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {
8481 self._request = new_value;
8482 self
8483 }
8484 /// Required. The resource name for this CertificateAuthority in the format `projects/*/locations/*/caPools/*/certificateAuthorities/*`.
8485 ///
8486 /// Sets the *name* path property to the given value.
8487 ///
8488 /// Even though the property as already been set when instantiating this call,
8489 /// we provide this method for API completeness.
8490 pub fn name(
8491 mut self,
8492 new_value: &str,
8493 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {
8494 self._name = new_value.to_string();
8495 self
8496 }
8497 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8498 /// while executing the actual API request.
8499 ///
8500 /// ````text
8501 /// It should be used to handle progress information, and to implement a certain level of resilience.
8502 /// ````
8503 ///
8504 /// Sets the *delegate* property to the given value.
8505 pub fn delegate(
8506 mut self,
8507 new_value: &'a mut dyn common::Delegate,
8508 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {
8509 self._delegate = Some(new_value);
8510 self
8511 }
8512
8513 /// Set any additional parameter of the query string used in the request.
8514 /// It should be used to set parameters which are not yet available through their own
8515 /// setters.
8516 ///
8517 /// Please note that this method must not be used to set any of the known parameters
8518 /// which have their own setter method. If done anyway, the request will fail.
8519 ///
8520 /// # Additional Parameters
8521 ///
8522 /// * *$.xgafv* (query-string) - V1 error format.
8523 /// * *access_token* (query-string) - OAuth access token.
8524 /// * *alt* (query-string) - Data format for response.
8525 /// * *callback* (query-string) - JSONP
8526 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8527 /// * *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.
8528 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8529 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8530 /// * *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.
8531 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8532 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8533 pub fn param<T>(
8534 mut self,
8535 name: T,
8536 value: T,
8537 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C>
8538 where
8539 T: AsRef<str>,
8540 {
8541 self._additional_params
8542 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8543 self
8544 }
8545
8546 /// Identifies the authorization scope for the method you are building.
8547 ///
8548 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8549 /// [`Scope::CloudPlatform`].
8550 ///
8551 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8552 /// tokens for more than one scope.
8553 ///
8554 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8555 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8556 /// sufficient, a read-write scope will do as well.
8557 pub fn add_scope<St>(
8558 mut self,
8559 scope: St,
8560 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C>
8561 where
8562 St: AsRef<str>,
8563 {
8564 self._scopes.insert(String::from(scope.as_ref()));
8565 self
8566 }
8567 /// Identifies the authorization scope(s) for the method you are building.
8568 ///
8569 /// See [`Self::add_scope()`] for details.
8570 pub fn add_scopes<I, St>(
8571 mut self,
8572 scopes: I,
8573 ) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C>
8574 where
8575 I: IntoIterator<Item = St>,
8576 St: AsRef<str>,
8577 {
8578 self._scopes
8579 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8580 self
8581 }
8582
8583 /// Removes all scopes, and no default scope will be used either.
8584 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8585 /// for details).
8586 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateAuthorityUndeleteCall<'a, C> {
8587 self._scopes.clear();
8588 self
8589 }
8590}
8591
8592/// Create a new Certificate in a given Project, Location from a particular CaPool.
8593///
8594/// A builder for the *locations.caPools.certificates.create* method supported by a *project* resource.
8595/// It is not used directly, but through a [`ProjectMethods`] instance.
8596///
8597/// # Example
8598///
8599/// Instantiate a resource method builder
8600///
8601/// ```test_harness,no_run
8602/// # extern crate hyper;
8603/// # extern crate hyper_rustls;
8604/// # extern crate google_privateca1 as privateca1;
8605/// use privateca1::api::Certificate;
8606/// # async fn dox() {
8607/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8608///
8609/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8610/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8611/// # .with_native_roots()
8612/// # .unwrap()
8613/// # .https_only()
8614/// # .enable_http2()
8615/// # .build();
8616///
8617/// # let executor = hyper_util::rt::TokioExecutor::new();
8618/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8619/// # secret,
8620/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8621/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8622/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8623/// # ),
8624/// # ).build().await.unwrap();
8625///
8626/// # let client = hyper_util::client::legacy::Client::builder(
8627/// # hyper_util::rt::TokioExecutor::new()
8628/// # )
8629/// # .build(
8630/// # hyper_rustls::HttpsConnectorBuilder::new()
8631/// # .with_native_roots()
8632/// # .unwrap()
8633/// # .https_or_http()
8634/// # .enable_http2()
8635/// # .build()
8636/// # );
8637/// # let mut hub = CertificateAuthorityService::new(client, auth);
8638/// // As the method needs a request, you would usually fill it with the desired information
8639/// // into the respective structure. Some of the parts shown here might not be applicable !
8640/// // Values shown here are possibly random and not representative !
8641/// let mut req = Certificate::default();
8642///
8643/// // You can configure optional parameters by calling the respective setters at will, and
8644/// // execute the final call using `doit()`.
8645/// // Values shown here are possibly random and not representative !
8646/// let result = hub.projects().locations_ca_pools_certificates_create(req, "parent")
8647/// .validate_only(false)
8648/// .request_id("Stet")
8649/// .issuing_certificate_authority_id("dolor")
8650/// .certificate_id("duo")
8651/// .doit().await;
8652/// # }
8653/// ```
8654pub struct ProjectLocationCaPoolCertificateCreateCall<'a, C>
8655where
8656 C: 'a,
8657{
8658 hub: &'a CertificateAuthorityService<C>,
8659 _request: Certificate,
8660 _parent: String,
8661 _validate_only: Option<bool>,
8662 _request_id: Option<String>,
8663 _issuing_certificate_authority_id: Option<String>,
8664 _certificate_id: Option<String>,
8665 _delegate: Option<&'a mut dyn common::Delegate>,
8666 _additional_params: HashMap<String, String>,
8667 _scopes: BTreeSet<String>,
8668}
8669
8670impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateCreateCall<'a, C> {}
8671
8672impl<'a, C> ProjectLocationCaPoolCertificateCreateCall<'a, C>
8673where
8674 C: common::Connector,
8675{
8676 /// Perform the operation you have build so far.
8677 pub async fn doit(mut self) -> common::Result<(common::Response, Certificate)> {
8678 use std::borrow::Cow;
8679 use std::io::{Read, Seek};
8680
8681 use common::{url::Params, ToParts};
8682 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8683
8684 let mut dd = common::DefaultDelegate;
8685 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8686 dlg.begin(common::MethodInfo {
8687 id: "privateca.projects.locations.caPools.certificates.create",
8688 http_method: hyper::Method::POST,
8689 });
8690
8691 for &field in [
8692 "alt",
8693 "parent",
8694 "validateOnly",
8695 "requestId",
8696 "issuingCertificateAuthorityId",
8697 "certificateId",
8698 ]
8699 .iter()
8700 {
8701 if self._additional_params.contains_key(field) {
8702 dlg.finished(false);
8703 return Err(common::Error::FieldClash(field));
8704 }
8705 }
8706
8707 let mut params = Params::with_capacity(8 + self._additional_params.len());
8708 params.push("parent", self._parent);
8709 if let Some(value) = self._validate_only.as_ref() {
8710 params.push("validateOnly", value.to_string());
8711 }
8712 if let Some(value) = self._request_id.as_ref() {
8713 params.push("requestId", value);
8714 }
8715 if let Some(value) = self._issuing_certificate_authority_id.as_ref() {
8716 params.push("issuingCertificateAuthorityId", value);
8717 }
8718 if let Some(value) = self._certificate_id.as_ref() {
8719 params.push("certificateId", value);
8720 }
8721
8722 params.extend(self._additional_params.iter());
8723
8724 params.push("alt", "json");
8725 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificates";
8726 if self._scopes.is_empty() {
8727 self._scopes
8728 .insert(Scope::CloudPlatform.as_ref().to_string());
8729 }
8730
8731 #[allow(clippy::single_element_loop)]
8732 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8733 url = params.uri_replacement(url, param_name, find_this, true);
8734 }
8735 {
8736 let to_remove = ["parent"];
8737 params.remove_params(&to_remove);
8738 }
8739
8740 let url = params.parse_with_url(&url);
8741
8742 let mut json_mime_type = mime::APPLICATION_JSON;
8743 let mut request_value_reader = {
8744 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8745 common::remove_json_null_values(&mut value);
8746 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8747 serde_json::to_writer(&mut dst, &value).unwrap();
8748 dst
8749 };
8750 let request_size = request_value_reader
8751 .seek(std::io::SeekFrom::End(0))
8752 .unwrap();
8753 request_value_reader
8754 .seek(std::io::SeekFrom::Start(0))
8755 .unwrap();
8756
8757 loop {
8758 let token = match self
8759 .hub
8760 .auth
8761 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8762 .await
8763 {
8764 Ok(token) => token,
8765 Err(e) => match dlg.token(e) {
8766 Ok(token) => token,
8767 Err(e) => {
8768 dlg.finished(false);
8769 return Err(common::Error::MissingToken(e));
8770 }
8771 },
8772 };
8773 request_value_reader
8774 .seek(std::io::SeekFrom::Start(0))
8775 .unwrap();
8776 let mut req_result = {
8777 let client = &self.hub.client;
8778 dlg.pre_request();
8779 let mut req_builder = hyper::Request::builder()
8780 .method(hyper::Method::POST)
8781 .uri(url.as_str())
8782 .header(USER_AGENT, self.hub._user_agent.clone());
8783
8784 if let Some(token) = token.as_ref() {
8785 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8786 }
8787
8788 let request = req_builder
8789 .header(CONTENT_TYPE, json_mime_type.to_string())
8790 .header(CONTENT_LENGTH, request_size as u64)
8791 .body(common::to_body(
8792 request_value_reader.get_ref().clone().into(),
8793 ));
8794
8795 client.request(request.unwrap()).await
8796 };
8797
8798 match req_result {
8799 Err(err) => {
8800 if let common::Retry::After(d) = dlg.http_error(&err) {
8801 sleep(d).await;
8802 continue;
8803 }
8804 dlg.finished(false);
8805 return Err(common::Error::HttpError(err));
8806 }
8807 Ok(res) => {
8808 let (mut parts, body) = res.into_parts();
8809 let mut body = common::Body::new(body);
8810 if !parts.status.is_success() {
8811 let bytes = common::to_bytes(body).await.unwrap_or_default();
8812 let error = serde_json::from_str(&common::to_string(&bytes));
8813 let response = common::to_response(parts, bytes.into());
8814
8815 if let common::Retry::After(d) =
8816 dlg.http_failure(&response, error.as_ref().ok())
8817 {
8818 sleep(d).await;
8819 continue;
8820 }
8821
8822 dlg.finished(false);
8823
8824 return Err(match error {
8825 Ok(value) => common::Error::BadRequest(value),
8826 _ => common::Error::Failure(response),
8827 });
8828 }
8829 let response = {
8830 let bytes = common::to_bytes(body).await.unwrap_or_default();
8831 let encoded = common::to_string(&bytes);
8832 match serde_json::from_str(&encoded) {
8833 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8834 Err(error) => {
8835 dlg.response_json_decode_error(&encoded, &error);
8836 return Err(common::Error::JsonDecodeError(
8837 encoded.to_string(),
8838 error,
8839 ));
8840 }
8841 }
8842 };
8843
8844 dlg.finished(true);
8845 return Ok(response);
8846 }
8847 }
8848 }
8849 }
8850
8851 ///
8852 /// Sets the *request* property to the given value.
8853 ///
8854 /// Even though the property as already been set when instantiating this call,
8855 /// we provide this method for API completeness.
8856 pub fn request(
8857 mut self,
8858 new_value: Certificate,
8859 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8860 self._request = new_value;
8861 self
8862 }
8863 /// Required. The resource name of the CaPool associated with the Certificate, in the format `projects/*/locations/*/caPools/*`.
8864 ///
8865 /// Sets the *parent* path property to the given value.
8866 ///
8867 /// Even though the property as already been set when instantiating this call,
8868 /// we provide this method for API completeness.
8869 pub fn parent(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8870 self._parent = new_value.to_string();
8871 self
8872 }
8873 /// Optional. If this is true, no Certificate resource will be persisted regardless of the CaPool's tier, and the returned Certificate will not contain the pem_certificate field.
8874 ///
8875 /// Sets the *validate only* query property to the given value.
8876 pub fn validate_only(
8877 mut self,
8878 new_value: bool,
8879 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8880 self._validate_only = Some(new_value);
8881 self
8882 }
8883 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
8884 ///
8885 /// Sets the *request id* query property to the given value.
8886 pub fn request_id(
8887 mut self,
8888 new_value: &str,
8889 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8890 self._request_id = Some(new_value.to_string());
8891 self
8892 }
8893 /// Optional. The resource ID of the CertificateAuthority that should issue the certificate. This optional field will ignore the load-balancing scheme of the Pool and directly issue the certificate from the CA with the specified ID, contained in the same CaPool referenced by `parent`. Per-CA quota rules apply. If left empty, a CertificateAuthority will be chosen from the CaPool by the service. For example, to issue a Certificate from a Certificate Authority with resource name "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", you can set the parent to "projects/my-project/locations/us-central1/caPools/my-pool" and the issuing_certificate_authority_id to "my-ca".
8894 ///
8895 /// Sets the *issuing certificate authority id* query property to the given value.
8896 pub fn issuing_certificate_authority_id(
8897 mut self,
8898 new_value: &str,
8899 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8900 self._issuing_certificate_authority_id = Some(new_value.to_string());
8901 self
8902 }
8903 /// Optional. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`. This field is required when using a CertificateAuthority in the Enterprise CertificateAuthority.tier, but is optional and its value is ignored otherwise.
8904 ///
8905 /// Sets the *certificate id* query property to the given value.
8906 pub fn certificate_id(
8907 mut self,
8908 new_value: &str,
8909 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8910 self._certificate_id = Some(new_value.to_string());
8911 self
8912 }
8913 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8914 /// while executing the actual API request.
8915 ///
8916 /// ````text
8917 /// It should be used to handle progress information, and to implement a certain level of resilience.
8918 /// ````
8919 ///
8920 /// Sets the *delegate* property to the given value.
8921 pub fn delegate(
8922 mut self,
8923 new_value: &'a mut dyn common::Delegate,
8924 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
8925 self._delegate = Some(new_value);
8926 self
8927 }
8928
8929 /// Set any additional parameter of the query string used in the request.
8930 /// It should be used to set parameters which are not yet available through their own
8931 /// setters.
8932 ///
8933 /// Please note that this method must not be used to set any of the known parameters
8934 /// which have their own setter method. If done anyway, the request will fail.
8935 ///
8936 /// # Additional Parameters
8937 ///
8938 /// * *$.xgafv* (query-string) - V1 error format.
8939 /// * *access_token* (query-string) - OAuth access token.
8940 /// * *alt* (query-string) - Data format for response.
8941 /// * *callback* (query-string) - JSONP
8942 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8943 /// * *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.
8944 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8945 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8946 /// * *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.
8947 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8948 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8949 pub fn param<T>(
8950 mut self,
8951 name: T,
8952 value: T,
8953 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C>
8954 where
8955 T: AsRef<str>,
8956 {
8957 self._additional_params
8958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8959 self
8960 }
8961
8962 /// Identifies the authorization scope for the method you are building.
8963 ///
8964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8965 /// [`Scope::CloudPlatform`].
8966 ///
8967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8968 /// tokens for more than one scope.
8969 ///
8970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8972 /// sufficient, a read-write scope will do as well.
8973 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCertificateCreateCall<'a, C>
8974 where
8975 St: AsRef<str>,
8976 {
8977 self._scopes.insert(String::from(scope.as_ref()));
8978 self
8979 }
8980 /// Identifies the authorization scope(s) for the method you are building.
8981 ///
8982 /// See [`Self::add_scope()`] for details.
8983 pub fn add_scopes<I, St>(
8984 mut self,
8985 scopes: I,
8986 ) -> ProjectLocationCaPoolCertificateCreateCall<'a, C>
8987 where
8988 I: IntoIterator<Item = St>,
8989 St: AsRef<str>,
8990 {
8991 self._scopes
8992 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8993 self
8994 }
8995
8996 /// Removes all scopes, and no default scope will be used either.
8997 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8998 /// for details).
8999 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateCreateCall<'a, C> {
9000 self._scopes.clear();
9001 self
9002 }
9003}
9004
9005/// Returns a Certificate.
9006///
9007/// A builder for the *locations.caPools.certificates.get* method supported by a *project* resource.
9008/// It is not used directly, but through a [`ProjectMethods`] instance.
9009///
9010/// # Example
9011///
9012/// Instantiate a resource method builder
9013///
9014/// ```test_harness,no_run
9015/// # extern crate hyper;
9016/// # extern crate hyper_rustls;
9017/// # extern crate google_privateca1 as privateca1;
9018/// # async fn dox() {
9019/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9020///
9021/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9022/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9023/// # .with_native_roots()
9024/// # .unwrap()
9025/// # .https_only()
9026/// # .enable_http2()
9027/// # .build();
9028///
9029/// # let executor = hyper_util::rt::TokioExecutor::new();
9030/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9031/// # secret,
9032/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9033/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9034/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9035/// # ),
9036/// # ).build().await.unwrap();
9037///
9038/// # let client = hyper_util::client::legacy::Client::builder(
9039/// # hyper_util::rt::TokioExecutor::new()
9040/// # )
9041/// # .build(
9042/// # hyper_rustls::HttpsConnectorBuilder::new()
9043/// # .with_native_roots()
9044/// # .unwrap()
9045/// # .https_or_http()
9046/// # .enable_http2()
9047/// # .build()
9048/// # );
9049/// # let mut hub = CertificateAuthorityService::new(client, auth);
9050/// // You can configure optional parameters by calling the respective setters at will, and
9051/// // execute the final call using `doit()`.
9052/// // Values shown here are possibly random and not representative !
9053/// let result = hub.projects().locations_ca_pools_certificates_get("name")
9054/// .doit().await;
9055/// # }
9056/// ```
9057pub struct ProjectLocationCaPoolCertificateGetCall<'a, C>
9058where
9059 C: 'a,
9060{
9061 hub: &'a CertificateAuthorityService<C>,
9062 _name: String,
9063 _delegate: Option<&'a mut dyn common::Delegate>,
9064 _additional_params: HashMap<String, String>,
9065 _scopes: BTreeSet<String>,
9066}
9067
9068impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateGetCall<'a, C> {}
9069
9070impl<'a, C> ProjectLocationCaPoolCertificateGetCall<'a, C>
9071where
9072 C: common::Connector,
9073{
9074 /// Perform the operation you have build so far.
9075 pub async fn doit(mut self) -> common::Result<(common::Response, Certificate)> {
9076 use std::borrow::Cow;
9077 use std::io::{Read, Seek};
9078
9079 use common::{url::Params, ToParts};
9080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9081
9082 let mut dd = common::DefaultDelegate;
9083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9084 dlg.begin(common::MethodInfo {
9085 id: "privateca.projects.locations.caPools.certificates.get",
9086 http_method: hyper::Method::GET,
9087 });
9088
9089 for &field in ["alt", "name"].iter() {
9090 if self._additional_params.contains_key(field) {
9091 dlg.finished(false);
9092 return Err(common::Error::FieldClash(field));
9093 }
9094 }
9095
9096 let mut params = Params::with_capacity(3 + self._additional_params.len());
9097 params.push("name", self._name);
9098
9099 params.extend(self._additional_params.iter());
9100
9101 params.push("alt", "json");
9102 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9103 if self._scopes.is_empty() {
9104 self._scopes
9105 .insert(Scope::CloudPlatform.as_ref().to_string());
9106 }
9107
9108 #[allow(clippy::single_element_loop)]
9109 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9110 url = params.uri_replacement(url, param_name, find_this, true);
9111 }
9112 {
9113 let to_remove = ["name"];
9114 params.remove_params(&to_remove);
9115 }
9116
9117 let url = params.parse_with_url(&url);
9118
9119 loop {
9120 let token = match self
9121 .hub
9122 .auth
9123 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9124 .await
9125 {
9126 Ok(token) => token,
9127 Err(e) => match dlg.token(e) {
9128 Ok(token) => token,
9129 Err(e) => {
9130 dlg.finished(false);
9131 return Err(common::Error::MissingToken(e));
9132 }
9133 },
9134 };
9135 let mut req_result = {
9136 let client = &self.hub.client;
9137 dlg.pre_request();
9138 let mut req_builder = hyper::Request::builder()
9139 .method(hyper::Method::GET)
9140 .uri(url.as_str())
9141 .header(USER_AGENT, self.hub._user_agent.clone());
9142
9143 if let Some(token) = token.as_ref() {
9144 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9145 }
9146
9147 let request = req_builder
9148 .header(CONTENT_LENGTH, 0_u64)
9149 .body(common::to_body::<String>(None));
9150
9151 client.request(request.unwrap()).await
9152 };
9153
9154 match req_result {
9155 Err(err) => {
9156 if let common::Retry::After(d) = dlg.http_error(&err) {
9157 sleep(d).await;
9158 continue;
9159 }
9160 dlg.finished(false);
9161 return Err(common::Error::HttpError(err));
9162 }
9163 Ok(res) => {
9164 let (mut parts, body) = res.into_parts();
9165 let mut body = common::Body::new(body);
9166 if !parts.status.is_success() {
9167 let bytes = common::to_bytes(body).await.unwrap_or_default();
9168 let error = serde_json::from_str(&common::to_string(&bytes));
9169 let response = common::to_response(parts, bytes.into());
9170
9171 if let common::Retry::After(d) =
9172 dlg.http_failure(&response, error.as_ref().ok())
9173 {
9174 sleep(d).await;
9175 continue;
9176 }
9177
9178 dlg.finished(false);
9179
9180 return Err(match error {
9181 Ok(value) => common::Error::BadRequest(value),
9182 _ => common::Error::Failure(response),
9183 });
9184 }
9185 let response = {
9186 let bytes = common::to_bytes(body).await.unwrap_or_default();
9187 let encoded = common::to_string(&bytes);
9188 match serde_json::from_str(&encoded) {
9189 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9190 Err(error) => {
9191 dlg.response_json_decode_error(&encoded, &error);
9192 return Err(common::Error::JsonDecodeError(
9193 encoded.to_string(),
9194 error,
9195 ));
9196 }
9197 }
9198 };
9199
9200 dlg.finished(true);
9201 return Ok(response);
9202 }
9203 }
9204 }
9205 }
9206
9207 /// Required. The name of the Certificate to get.
9208 ///
9209 /// Sets the *name* path property to the given value.
9210 ///
9211 /// Even though the property as already been set when instantiating this call,
9212 /// we provide this method for API completeness.
9213 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateGetCall<'a, C> {
9214 self._name = new_value.to_string();
9215 self
9216 }
9217 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9218 /// while executing the actual API request.
9219 ///
9220 /// ````text
9221 /// It should be used to handle progress information, and to implement a certain level of resilience.
9222 /// ````
9223 ///
9224 /// Sets the *delegate* property to the given value.
9225 pub fn delegate(
9226 mut self,
9227 new_value: &'a mut dyn common::Delegate,
9228 ) -> ProjectLocationCaPoolCertificateGetCall<'a, C> {
9229 self._delegate = Some(new_value);
9230 self
9231 }
9232
9233 /// Set any additional parameter of the query string used in the request.
9234 /// It should be used to set parameters which are not yet available through their own
9235 /// setters.
9236 ///
9237 /// Please note that this method must not be used to set any of the known parameters
9238 /// which have their own setter method. If done anyway, the request will fail.
9239 ///
9240 /// # Additional Parameters
9241 ///
9242 /// * *$.xgafv* (query-string) - V1 error format.
9243 /// * *access_token* (query-string) - OAuth access token.
9244 /// * *alt* (query-string) - Data format for response.
9245 /// * *callback* (query-string) - JSONP
9246 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9247 /// * *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.
9248 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9249 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9250 /// * *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.
9251 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9252 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9253 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolCertificateGetCall<'a, C>
9254 where
9255 T: AsRef<str>,
9256 {
9257 self._additional_params
9258 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9259 self
9260 }
9261
9262 /// Identifies the authorization scope for the method you are building.
9263 ///
9264 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9265 /// [`Scope::CloudPlatform`].
9266 ///
9267 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9268 /// tokens for more than one scope.
9269 ///
9270 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9271 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9272 /// sufficient, a read-write scope will do as well.
9273 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCertificateGetCall<'a, C>
9274 where
9275 St: AsRef<str>,
9276 {
9277 self._scopes.insert(String::from(scope.as_ref()));
9278 self
9279 }
9280 /// Identifies the authorization scope(s) for the method you are building.
9281 ///
9282 /// See [`Self::add_scope()`] for details.
9283 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolCertificateGetCall<'a, C>
9284 where
9285 I: IntoIterator<Item = St>,
9286 St: AsRef<str>,
9287 {
9288 self._scopes
9289 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9290 self
9291 }
9292
9293 /// Removes all scopes, and no default scope will be used either.
9294 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9295 /// for details).
9296 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateGetCall<'a, C> {
9297 self._scopes.clear();
9298 self
9299 }
9300}
9301
9302/// Lists Certificates.
9303///
9304/// A builder for the *locations.caPools.certificates.list* method supported by a *project* resource.
9305/// It is not used directly, but through a [`ProjectMethods`] instance.
9306///
9307/// # Example
9308///
9309/// Instantiate a resource method builder
9310///
9311/// ```test_harness,no_run
9312/// # extern crate hyper;
9313/// # extern crate hyper_rustls;
9314/// # extern crate google_privateca1 as privateca1;
9315/// # async fn dox() {
9316/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9317///
9318/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9319/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9320/// # .with_native_roots()
9321/// # .unwrap()
9322/// # .https_only()
9323/// # .enable_http2()
9324/// # .build();
9325///
9326/// # let executor = hyper_util::rt::TokioExecutor::new();
9327/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9328/// # secret,
9329/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9330/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9331/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9332/// # ),
9333/// # ).build().await.unwrap();
9334///
9335/// # let client = hyper_util::client::legacy::Client::builder(
9336/// # hyper_util::rt::TokioExecutor::new()
9337/// # )
9338/// # .build(
9339/// # hyper_rustls::HttpsConnectorBuilder::new()
9340/// # .with_native_roots()
9341/// # .unwrap()
9342/// # .https_or_http()
9343/// # .enable_http2()
9344/// # .build()
9345/// # );
9346/// # let mut hub = CertificateAuthorityService::new(client, auth);
9347/// // You can configure optional parameters by calling the respective setters at will, and
9348/// // execute the final call using `doit()`.
9349/// // Values shown here are possibly random and not representative !
9350/// let result = hub.projects().locations_ca_pools_certificates_list("parent")
9351/// .page_token("invidunt")
9352/// .page_size(-65)
9353/// .order_by("vero")
9354/// .filter("elitr")
9355/// .doit().await;
9356/// # }
9357/// ```
9358pub struct ProjectLocationCaPoolCertificateListCall<'a, C>
9359where
9360 C: 'a,
9361{
9362 hub: &'a CertificateAuthorityService<C>,
9363 _parent: String,
9364 _page_token: Option<String>,
9365 _page_size: Option<i32>,
9366 _order_by: Option<String>,
9367 _filter: Option<String>,
9368 _delegate: Option<&'a mut dyn common::Delegate>,
9369 _additional_params: HashMap<String, String>,
9370 _scopes: BTreeSet<String>,
9371}
9372
9373impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateListCall<'a, C> {}
9374
9375impl<'a, C> ProjectLocationCaPoolCertificateListCall<'a, C>
9376where
9377 C: common::Connector,
9378{
9379 /// Perform the operation you have build so far.
9380 pub async fn doit(mut self) -> common::Result<(common::Response, ListCertificatesResponse)> {
9381 use std::borrow::Cow;
9382 use std::io::{Read, Seek};
9383
9384 use common::{url::Params, ToParts};
9385 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9386
9387 let mut dd = common::DefaultDelegate;
9388 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9389 dlg.begin(common::MethodInfo {
9390 id: "privateca.projects.locations.caPools.certificates.list",
9391 http_method: hyper::Method::GET,
9392 });
9393
9394 for &field in [
9395 "alt",
9396 "parent",
9397 "pageToken",
9398 "pageSize",
9399 "orderBy",
9400 "filter",
9401 ]
9402 .iter()
9403 {
9404 if self._additional_params.contains_key(field) {
9405 dlg.finished(false);
9406 return Err(common::Error::FieldClash(field));
9407 }
9408 }
9409
9410 let mut params = Params::with_capacity(7 + self._additional_params.len());
9411 params.push("parent", self._parent);
9412 if let Some(value) = self._page_token.as_ref() {
9413 params.push("pageToken", value);
9414 }
9415 if let Some(value) = self._page_size.as_ref() {
9416 params.push("pageSize", value.to_string());
9417 }
9418 if let Some(value) = self._order_by.as_ref() {
9419 params.push("orderBy", value);
9420 }
9421 if let Some(value) = self._filter.as_ref() {
9422 params.push("filter", value);
9423 }
9424
9425 params.extend(self._additional_params.iter());
9426
9427 params.push("alt", "json");
9428 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificates";
9429 if self._scopes.is_empty() {
9430 self._scopes
9431 .insert(Scope::CloudPlatform.as_ref().to_string());
9432 }
9433
9434 #[allow(clippy::single_element_loop)]
9435 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9436 url = params.uri_replacement(url, param_name, find_this, true);
9437 }
9438 {
9439 let to_remove = ["parent"];
9440 params.remove_params(&to_remove);
9441 }
9442
9443 let url = params.parse_with_url(&url);
9444
9445 loop {
9446 let token = match self
9447 .hub
9448 .auth
9449 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9450 .await
9451 {
9452 Ok(token) => token,
9453 Err(e) => match dlg.token(e) {
9454 Ok(token) => token,
9455 Err(e) => {
9456 dlg.finished(false);
9457 return Err(common::Error::MissingToken(e));
9458 }
9459 },
9460 };
9461 let mut req_result = {
9462 let client = &self.hub.client;
9463 dlg.pre_request();
9464 let mut req_builder = hyper::Request::builder()
9465 .method(hyper::Method::GET)
9466 .uri(url.as_str())
9467 .header(USER_AGENT, self.hub._user_agent.clone());
9468
9469 if let Some(token) = token.as_ref() {
9470 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9471 }
9472
9473 let request = req_builder
9474 .header(CONTENT_LENGTH, 0_u64)
9475 .body(common::to_body::<String>(None));
9476
9477 client.request(request.unwrap()).await
9478 };
9479
9480 match req_result {
9481 Err(err) => {
9482 if let common::Retry::After(d) = dlg.http_error(&err) {
9483 sleep(d).await;
9484 continue;
9485 }
9486 dlg.finished(false);
9487 return Err(common::Error::HttpError(err));
9488 }
9489 Ok(res) => {
9490 let (mut parts, body) = res.into_parts();
9491 let mut body = common::Body::new(body);
9492 if !parts.status.is_success() {
9493 let bytes = common::to_bytes(body).await.unwrap_or_default();
9494 let error = serde_json::from_str(&common::to_string(&bytes));
9495 let response = common::to_response(parts, bytes.into());
9496
9497 if let common::Retry::After(d) =
9498 dlg.http_failure(&response, error.as_ref().ok())
9499 {
9500 sleep(d).await;
9501 continue;
9502 }
9503
9504 dlg.finished(false);
9505
9506 return Err(match error {
9507 Ok(value) => common::Error::BadRequest(value),
9508 _ => common::Error::Failure(response),
9509 });
9510 }
9511 let response = {
9512 let bytes = common::to_bytes(body).await.unwrap_or_default();
9513 let encoded = common::to_string(&bytes);
9514 match serde_json::from_str(&encoded) {
9515 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9516 Err(error) => {
9517 dlg.response_json_decode_error(&encoded, &error);
9518 return Err(common::Error::JsonDecodeError(
9519 encoded.to_string(),
9520 error,
9521 ));
9522 }
9523 }
9524 };
9525
9526 dlg.finished(true);
9527 return Ok(response);
9528 }
9529 }
9530 }
9531 }
9532
9533 /// Required. The resource name of the location associated with the Certificates, in the format `projects/*/locations/*/caPools/*`.
9534 ///
9535 /// Sets the *parent* path property to the given value.
9536 ///
9537 /// Even though the property as already been set when instantiating this call,
9538 /// we provide this method for API completeness.
9539 pub fn parent(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9540 self._parent = new_value.to_string();
9541 self
9542 }
9543 /// Optional. Pagination token, returned earlier via ListCertificatesResponse.next_page_token.
9544 ///
9545 /// Sets the *page token* query property to the given value.
9546 pub fn page_token(
9547 mut self,
9548 new_value: &str,
9549 ) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9550 self._page_token = Some(new_value.to_string());
9551 self
9552 }
9553 /// Optional. Limit on the number of Certificates to include in the response. Further Certificates can subsequently be obtained by including the ListCertificatesResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
9554 ///
9555 /// Sets the *page size* query property to the given value.
9556 pub fn page_size(mut self, new_value: i32) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9557 self._page_size = Some(new_value);
9558 self
9559 }
9560 /// Optional. Specify how the results should be sorted. For details on supported fields and syntax, see [Certificates Sorting documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#sorting_support).
9561 ///
9562 /// Sets the *order by* query property to the given value.
9563 pub fn order_by(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9564 self._order_by = Some(new_value.to_string());
9565 self
9566 }
9567 /// Optional. Only include resources that match the filter in the response. For details on supported filters and syntax, see [Certificates Filtering documentation](https://cloud.google.com/certificate-authority-service/docs/sorting-filtering-certificates#filtering_support).
9568 ///
9569 /// Sets the *filter* query property to the given value.
9570 pub fn filter(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9571 self._filter = Some(new_value.to_string());
9572 self
9573 }
9574 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9575 /// while executing the actual API request.
9576 ///
9577 /// ````text
9578 /// It should be used to handle progress information, and to implement a certain level of resilience.
9579 /// ````
9580 ///
9581 /// Sets the *delegate* property to the given value.
9582 pub fn delegate(
9583 mut self,
9584 new_value: &'a mut dyn common::Delegate,
9585 ) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9586 self._delegate = Some(new_value);
9587 self
9588 }
9589
9590 /// Set any additional parameter of the query string used in the request.
9591 /// It should be used to set parameters which are not yet available through their own
9592 /// setters.
9593 ///
9594 /// Please note that this method must not be used to set any of the known parameters
9595 /// which have their own setter method. If done anyway, the request will fail.
9596 ///
9597 /// # Additional Parameters
9598 ///
9599 /// * *$.xgafv* (query-string) - V1 error format.
9600 /// * *access_token* (query-string) - OAuth access token.
9601 /// * *alt* (query-string) - Data format for response.
9602 /// * *callback* (query-string) - JSONP
9603 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9604 /// * *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.
9605 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9606 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9607 /// * *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.
9608 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9609 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9610 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolCertificateListCall<'a, C>
9611 where
9612 T: AsRef<str>,
9613 {
9614 self._additional_params
9615 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9616 self
9617 }
9618
9619 /// Identifies the authorization scope for the method you are building.
9620 ///
9621 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9622 /// [`Scope::CloudPlatform`].
9623 ///
9624 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9625 /// tokens for more than one scope.
9626 ///
9627 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9628 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9629 /// sufficient, a read-write scope will do as well.
9630 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCertificateListCall<'a, C>
9631 where
9632 St: AsRef<str>,
9633 {
9634 self._scopes.insert(String::from(scope.as_ref()));
9635 self
9636 }
9637 /// Identifies the authorization scope(s) for the method you are building.
9638 ///
9639 /// See [`Self::add_scope()`] for details.
9640 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolCertificateListCall<'a, C>
9641 where
9642 I: IntoIterator<Item = St>,
9643 St: AsRef<str>,
9644 {
9645 self._scopes
9646 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9647 self
9648 }
9649
9650 /// Removes all scopes, and no default scope will be used either.
9651 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9652 /// for details).
9653 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateListCall<'a, C> {
9654 self._scopes.clear();
9655 self
9656 }
9657}
9658
9659/// Update a Certificate. Currently, the only field you can update is the labels field.
9660///
9661/// A builder for the *locations.caPools.certificates.patch* method supported by a *project* resource.
9662/// It is not used directly, but through a [`ProjectMethods`] instance.
9663///
9664/// # Example
9665///
9666/// Instantiate a resource method builder
9667///
9668/// ```test_harness,no_run
9669/// # extern crate hyper;
9670/// # extern crate hyper_rustls;
9671/// # extern crate google_privateca1 as privateca1;
9672/// use privateca1::api::Certificate;
9673/// # async fn dox() {
9674/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9675///
9676/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9677/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9678/// # .with_native_roots()
9679/// # .unwrap()
9680/// # .https_only()
9681/// # .enable_http2()
9682/// # .build();
9683///
9684/// # let executor = hyper_util::rt::TokioExecutor::new();
9685/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9686/// # secret,
9687/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9688/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9689/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9690/// # ),
9691/// # ).build().await.unwrap();
9692///
9693/// # let client = hyper_util::client::legacy::Client::builder(
9694/// # hyper_util::rt::TokioExecutor::new()
9695/// # )
9696/// # .build(
9697/// # hyper_rustls::HttpsConnectorBuilder::new()
9698/// # .with_native_roots()
9699/// # .unwrap()
9700/// # .https_or_http()
9701/// # .enable_http2()
9702/// # .build()
9703/// # );
9704/// # let mut hub = CertificateAuthorityService::new(client, auth);
9705/// // As the method needs a request, you would usually fill it with the desired information
9706/// // into the respective structure. Some of the parts shown here might not be applicable !
9707/// // Values shown here are possibly random and not representative !
9708/// let mut req = Certificate::default();
9709///
9710/// // You can configure optional parameters by calling the respective setters at will, and
9711/// // execute the final call using `doit()`.
9712/// // Values shown here are possibly random and not representative !
9713/// let result = hub.projects().locations_ca_pools_certificates_patch(req, "name")
9714/// .update_mask(FieldMask::new::<&str>(&[]))
9715/// .request_id("diam")
9716/// .doit().await;
9717/// # }
9718/// ```
9719pub struct ProjectLocationCaPoolCertificatePatchCall<'a, C>
9720where
9721 C: 'a,
9722{
9723 hub: &'a CertificateAuthorityService<C>,
9724 _request: Certificate,
9725 _name: String,
9726 _update_mask: Option<common::FieldMask>,
9727 _request_id: Option<String>,
9728 _delegate: Option<&'a mut dyn common::Delegate>,
9729 _additional_params: HashMap<String, String>,
9730 _scopes: BTreeSet<String>,
9731}
9732
9733impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificatePatchCall<'a, C> {}
9734
9735impl<'a, C> ProjectLocationCaPoolCertificatePatchCall<'a, C>
9736where
9737 C: common::Connector,
9738{
9739 /// Perform the operation you have build so far.
9740 pub async fn doit(mut self) -> common::Result<(common::Response, Certificate)> {
9741 use std::borrow::Cow;
9742 use std::io::{Read, Seek};
9743
9744 use common::{url::Params, ToParts};
9745 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9746
9747 let mut dd = common::DefaultDelegate;
9748 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9749 dlg.begin(common::MethodInfo {
9750 id: "privateca.projects.locations.caPools.certificates.patch",
9751 http_method: hyper::Method::PATCH,
9752 });
9753
9754 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
9755 if self._additional_params.contains_key(field) {
9756 dlg.finished(false);
9757 return Err(common::Error::FieldClash(field));
9758 }
9759 }
9760
9761 let mut params = Params::with_capacity(6 + self._additional_params.len());
9762 params.push("name", self._name);
9763 if let Some(value) = self._update_mask.as_ref() {
9764 params.push("updateMask", value.to_string());
9765 }
9766 if let Some(value) = self._request_id.as_ref() {
9767 params.push("requestId", value);
9768 }
9769
9770 params.extend(self._additional_params.iter());
9771
9772 params.push("alt", "json");
9773 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9774 if self._scopes.is_empty() {
9775 self._scopes
9776 .insert(Scope::CloudPlatform.as_ref().to_string());
9777 }
9778
9779 #[allow(clippy::single_element_loop)]
9780 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9781 url = params.uri_replacement(url, param_name, find_this, true);
9782 }
9783 {
9784 let to_remove = ["name"];
9785 params.remove_params(&to_remove);
9786 }
9787
9788 let url = params.parse_with_url(&url);
9789
9790 let mut json_mime_type = mime::APPLICATION_JSON;
9791 let mut request_value_reader = {
9792 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9793 common::remove_json_null_values(&mut value);
9794 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9795 serde_json::to_writer(&mut dst, &value).unwrap();
9796 dst
9797 };
9798 let request_size = request_value_reader
9799 .seek(std::io::SeekFrom::End(0))
9800 .unwrap();
9801 request_value_reader
9802 .seek(std::io::SeekFrom::Start(0))
9803 .unwrap();
9804
9805 loop {
9806 let token = match self
9807 .hub
9808 .auth
9809 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9810 .await
9811 {
9812 Ok(token) => token,
9813 Err(e) => match dlg.token(e) {
9814 Ok(token) => token,
9815 Err(e) => {
9816 dlg.finished(false);
9817 return Err(common::Error::MissingToken(e));
9818 }
9819 },
9820 };
9821 request_value_reader
9822 .seek(std::io::SeekFrom::Start(0))
9823 .unwrap();
9824 let mut req_result = {
9825 let client = &self.hub.client;
9826 dlg.pre_request();
9827 let mut req_builder = hyper::Request::builder()
9828 .method(hyper::Method::PATCH)
9829 .uri(url.as_str())
9830 .header(USER_AGENT, self.hub._user_agent.clone());
9831
9832 if let Some(token) = token.as_ref() {
9833 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9834 }
9835
9836 let request = req_builder
9837 .header(CONTENT_TYPE, json_mime_type.to_string())
9838 .header(CONTENT_LENGTH, request_size as u64)
9839 .body(common::to_body(
9840 request_value_reader.get_ref().clone().into(),
9841 ));
9842
9843 client.request(request.unwrap()).await
9844 };
9845
9846 match req_result {
9847 Err(err) => {
9848 if let common::Retry::After(d) = dlg.http_error(&err) {
9849 sleep(d).await;
9850 continue;
9851 }
9852 dlg.finished(false);
9853 return Err(common::Error::HttpError(err));
9854 }
9855 Ok(res) => {
9856 let (mut parts, body) = res.into_parts();
9857 let mut body = common::Body::new(body);
9858 if !parts.status.is_success() {
9859 let bytes = common::to_bytes(body).await.unwrap_or_default();
9860 let error = serde_json::from_str(&common::to_string(&bytes));
9861 let response = common::to_response(parts, bytes.into());
9862
9863 if let common::Retry::After(d) =
9864 dlg.http_failure(&response, error.as_ref().ok())
9865 {
9866 sleep(d).await;
9867 continue;
9868 }
9869
9870 dlg.finished(false);
9871
9872 return Err(match error {
9873 Ok(value) => common::Error::BadRequest(value),
9874 _ => common::Error::Failure(response),
9875 });
9876 }
9877 let response = {
9878 let bytes = common::to_bytes(body).await.unwrap_or_default();
9879 let encoded = common::to_string(&bytes);
9880 match serde_json::from_str(&encoded) {
9881 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9882 Err(error) => {
9883 dlg.response_json_decode_error(&encoded, &error);
9884 return Err(common::Error::JsonDecodeError(
9885 encoded.to_string(),
9886 error,
9887 ));
9888 }
9889 }
9890 };
9891
9892 dlg.finished(true);
9893 return Ok(response);
9894 }
9895 }
9896 }
9897 }
9898
9899 ///
9900 /// Sets the *request* property to the given value.
9901 ///
9902 /// Even though the property as already been set when instantiating this call,
9903 /// we provide this method for API completeness.
9904 pub fn request(
9905 mut self,
9906 new_value: Certificate,
9907 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
9908 self._request = new_value;
9909 self
9910 }
9911 /// Identifier. The resource name for this Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
9912 ///
9913 /// Sets the *name* path property to the given value.
9914 ///
9915 /// Even though the property as already been set when instantiating this call,
9916 /// we provide this method for API completeness.
9917 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
9918 self._name = new_value.to_string();
9919 self
9920 }
9921 /// Required. A list of fields to be updated in this request.
9922 ///
9923 /// Sets the *update mask* query property to the given value.
9924 pub fn update_mask(
9925 mut self,
9926 new_value: common::FieldMask,
9927 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
9928 self._update_mask = Some(new_value);
9929 self
9930 }
9931 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
9932 ///
9933 /// Sets the *request id* query property to the given value.
9934 pub fn request_id(
9935 mut self,
9936 new_value: &str,
9937 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
9938 self._request_id = Some(new_value.to_string());
9939 self
9940 }
9941 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9942 /// while executing the actual API request.
9943 ///
9944 /// ````text
9945 /// It should be used to handle progress information, and to implement a certain level of resilience.
9946 /// ````
9947 ///
9948 /// Sets the *delegate* property to the given value.
9949 pub fn delegate(
9950 mut self,
9951 new_value: &'a mut dyn common::Delegate,
9952 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
9953 self._delegate = Some(new_value);
9954 self
9955 }
9956
9957 /// Set any additional parameter of the query string used in the request.
9958 /// It should be used to set parameters which are not yet available through their own
9959 /// setters.
9960 ///
9961 /// Please note that this method must not be used to set any of the known parameters
9962 /// which have their own setter method. If done anyway, the request will fail.
9963 ///
9964 /// # Additional Parameters
9965 ///
9966 /// * *$.xgafv* (query-string) - V1 error format.
9967 /// * *access_token* (query-string) - OAuth access token.
9968 /// * *alt* (query-string) - Data format for response.
9969 /// * *callback* (query-string) - JSONP
9970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9971 /// * *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.
9972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9974 /// * *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.
9975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9977 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolCertificatePatchCall<'a, C>
9978 where
9979 T: AsRef<str>,
9980 {
9981 self._additional_params
9982 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9983 self
9984 }
9985
9986 /// Identifies the authorization scope for the method you are building.
9987 ///
9988 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9989 /// [`Scope::CloudPlatform`].
9990 ///
9991 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9992 /// tokens for more than one scope.
9993 ///
9994 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9995 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9996 /// sufficient, a read-write scope will do as well.
9997 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCertificatePatchCall<'a, C>
9998 where
9999 St: AsRef<str>,
10000 {
10001 self._scopes.insert(String::from(scope.as_ref()));
10002 self
10003 }
10004 /// Identifies the authorization scope(s) for the method you are building.
10005 ///
10006 /// See [`Self::add_scope()`] for details.
10007 pub fn add_scopes<I, St>(
10008 mut self,
10009 scopes: I,
10010 ) -> ProjectLocationCaPoolCertificatePatchCall<'a, C>
10011 where
10012 I: IntoIterator<Item = St>,
10013 St: AsRef<str>,
10014 {
10015 self._scopes
10016 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10017 self
10018 }
10019
10020 /// Removes all scopes, and no default scope will be used either.
10021 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10022 /// for details).
10023 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificatePatchCall<'a, C> {
10024 self._scopes.clear();
10025 self
10026 }
10027}
10028
10029/// Revoke a Certificate.
10030///
10031/// A builder for the *locations.caPools.certificates.revoke* method supported by a *project* resource.
10032/// It is not used directly, but through a [`ProjectMethods`] instance.
10033///
10034/// # Example
10035///
10036/// Instantiate a resource method builder
10037///
10038/// ```test_harness,no_run
10039/// # extern crate hyper;
10040/// # extern crate hyper_rustls;
10041/// # extern crate google_privateca1 as privateca1;
10042/// use privateca1::api::RevokeCertificateRequest;
10043/// # async fn dox() {
10044/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10045///
10046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10047/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10048/// # .with_native_roots()
10049/// # .unwrap()
10050/// # .https_only()
10051/// # .enable_http2()
10052/// # .build();
10053///
10054/// # let executor = hyper_util::rt::TokioExecutor::new();
10055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10056/// # secret,
10057/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10058/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10059/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10060/// # ),
10061/// # ).build().await.unwrap();
10062///
10063/// # let client = hyper_util::client::legacy::Client::builder(
10064/// # hyper_util::rt::TokioExecutor::new()
10065/// # )
10066/// # .build(
10067/// # hyper_rustls::HttpsConnectorBuilder::new()
10068/// # .with_native_roots()
10069/// # .unwrap()
10070/// # .https_or_http()
10071/// # .enable_http2()
10072/// # .build()
10073/// # );
10074/// # let mut hub = CertificateAuthorityService::new(client, auth);
10075/// // As the method needs a request, you would usually fill it with the desired information
10076/// // into the respective structure. Some of the parts shown here might not be applicable !
10077/// // Values shown here are possibly random and not representative !
10078/// let mut req = RevokeCertificateRequest::default();
10079///
10080/// // You can configure optional parameters by calling the respective setters at will, and
10081/// // execute the final call using `doit()`.
10082/// // Values shown here are possibly random and not representative !
10083/// let result = hub.projects().locations_ca_pools_certificates_revoke(req, "name")
10084/// .doit().await;
10085/// # }
10086/// ```
10087pub struct ProjectLocationCaPoolCertificateRevokeCall<'a, C>
10088where
10089 C: 'a,
10090{
10091 hub: &'a CertificateAuthorityService<C>,
10092 _request: RevokeCertificateRequest,
10093 _name: String,
10094 _delegate: Option<&'a mut dyn common::Delegate>,
10095 _additional_params: HashMap<String, String>,
10096 _scopes: BTreeSet<String>,
10097}
10098
10099impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCertificateRevokeCall<'a, C> {}
10100
10101impl<'a, C> ProjectLocationCaPoolCertificateRevokeCall<'a, C>
10102where
10103 C: common::Connector,
10104{
10105 /// Perform the operation you have build so far.
10106 pub async fn doit(mut self) -> common::Result<(common::Response, Certificate)> {
10107 use std::borrow::Cow;
10108 use std::io::{Read, Seek};
10109
10110 use common::{url::Params, ToParts};
10111 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10112
10113 let mut dd = common::DefaultDelegate;
10114 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10115 dlg.begin(common::MethodInfo {
10116 id: "privateca.projects.locations.caPools.certificates.revoke",
10117 http_method: hyper::Method::POST,
10118 });
10119
10120 for &field in ["alt", "name"].iter() {
10121 if self._additional_params.contains_key(field) {
10122 dlg.finished(false);
10123 return Err(common::Error::FieldClash(field));
10124 }
10125 }
10126
10127 let mut params = Params::with_capacity(4 + self._additional_params.len());
10128 params.push("name", self._name);
10129
10130 params.extend(self._additional_params.iter());
10131
10132 params.push("alt", "json");
10133 let mut url = self.hub._base_url.clone() + "v1/{+name}:revoke";
10134 if self._scopes.is_empty() {
10135 self._scopes
10136 .insert(Scope::CloudPlatform.as_ref().to_string());
10137 }
10138
10139 #[allow(clippy::single_element_loop)]
10140 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10141 url = params.uri_replacement(url, param_name, find_this, true);
10142 }
10143 {
10144 let to_remove = ["name"];
10145 params.remove_params(&to_remove);
10146 }
10147
10148 let url = params.parse_with_url(&url);
10149
10150 let mut json_mime_type = mime::APPLICATION_JSON;
10151 let mut request_value_reader = {
10152 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10153 common::remove_json_null_values(&mut value);
10154 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10155 serde_json::to_writer(&mut dst, &value).unwrap();
10156 dst
10157 };
10158 let request_size = request_value_reader
10159 .seek(std::io::SeekFrom::End(0))
10160 .unwrap();
10161 request_value_reader
10162 .seek(std::io::SeekFrom::Start(0))
10163 .unwrap();
10164
10165 loop {
10166 let token = match self
10167 .hub
10168 .auth
10169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10170 .await
10171 {
10172 Ok(token) => token,
10173 Err(e) => match dlg.token(e) {
10174 Ok(token) => token,
10175 Err(e) => {
10176 dlg.finished(false);
10177 return Err(common::Error::MissingToken(e));
10178 }
10179 },
10180 };
10181 request_value_reader
10182 .seek(std::io::SeekFrom::Start(0))
10183 .unwrap();
10184 let mut req_result = {
10185 let client = &self.hub.client;
10186 dlg.pre_request();
10187 let mut req_builder = hyper::Request::builder()
10188 .method(hyper::Method::POST)
10189 .uri(url.as_str())
10190 .header(USER_AGENT, self.hub._user_agent.clone());
10191
10192 if let Some(token) = token.as_ref() {
10193 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10194 }
10195
10196 let request = req_builder
10197 .header(CONTENT_TYPE, json_mime_type.to_string())
10198 .header(CONTENT_LENGTH, request_size as u64)
10199 .body(common::to_body(
10200 request_value_reader.get_ref().clone().into(),
10201 ));
10202
10203 client.request(request.unwrap()).await
10204 };
10205
10206 match req_result {
10207 Err(err) => {
10208 if let common::Retry::After(d) = dlg.http_error(&err) {
10209 sleep(d).await;
10210 continue;
10211 }
10212 dlg.finished(false);
10213 return Err(common::Error::HttpError(err));
10214 }
10215 Ok(res) => {
10216 let (mut parts, body) = res.into_parts();
10217 let mut body = common::Body::new(body);
10218 if !parts.status.is_success() {
10219 let bytes = common::to_bytes(body).await.unwrap_or_default();
10220 let error = serde_json::from_str(&common::to_string(&bytes));
10221 let response = common::to_response(parts, bytes.into());
10222
10223 if let common::Retry::After(d) =
10224 dlg.http_failure(&response, error.as_ref().ok())
10225 {
10226 sleep(d).await;
10227 continue;
10228 }
10229
10230 dlg.finished(false);
10231
10232 return Err(match error {
10233 Ok(value) => common::Error::BadRequest(value),
10234 _ => common::Error::Failure(response),
10235 });
10236 }
10237 let response = {
10238 let bytes = common::to_bytes(body).await.unwrap_or_default();
10239 let encoded = common::to_string(&bytes);
10240 match serde_json::from_str(&encoded) {
10241 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10242 Err(error) => {
10243 dlg.response_json_decode_error(&encoded, &error);
10244 return Err(common::Error::JsonDecodeError(
10245 encoded.to_string(),
10246 error,
10247 ));
10248 }
10249 }
10250 };
10251
10252 dlg.finished(true);
10253 return Ok(response);
10254 }
10255 }
10256 }
10257 }
10258
10259 ///
10260 /// Sets the *request* property to the given value.
10261 ///
10262 /// Even though the property as already been set when instantiating this call,
10263 /// we provide this method for API completeness.
10264 pub fn request(
10265 mut self,
10266 new_value: RevokeCertificateRequest,
10267 ) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C> {
10268 self._request = new_value;
10269 self
10270 }
10271 /// Required. The resource name for this Certificate in the format `projects/*/locations/*/caPools/*/certificates/*`.
10272 ///
10273 /// Sets the *name* path property to the given value.
10274 ///
10275 /// Even though the property as already been set when instantiating this call,
10276 /// we provide this method for API completeness.
10277 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C> {
10278 self._name = new_value.to_string();
10279 self
10280 }
10281 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10282 /// while executing the actual API request.
10283 ///
10284 /// ````text
10285 /// It should be used to handle progress information, and to implement a certain level of resilience.
10286 /// ````
10287 ///
10288 /// Sets the *delegate* property to the given value.
10289 pub fn delegate(
10290 mut self,
10291 new_value: &'a mut dyn common::Delegate,
10292 ) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C> {
10293 self._delegate = Some(new_value);
10294 self
10295 }
10296
10297 /// Set any additional parameter of the query string used in the request.
10298 /// It should be used to set parameters which are not yet available through their own
10299 /// setters.
10300 ///
10301 /// Please note that this method must not be used to set any of the known parameters
10302 /// which have their own setter method. If done anyway, the request will fail.
10303 ///
10304 /// # Additional Parameters
10305 ///
10306 /// * *$.xgafv* (query-string) - V1 error format.
10307 /// * *access_token* (query-string) - OAuth access token.
10308 /// * *alt* (query-string) - Data format for response.
10309 /// * *callback* (query-string) - JSONP
10310 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10311 /// * *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.
10312 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10313 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10314 /// * *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.
10315 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10316 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10317 pub fn param<T>(
10318 mut self,
10319 name: T,
10320 value: T,
10321 ) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C>
10322 where
10323 T: AsRef<str>,
10324 {
10325 self._additional_params
10326 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10327 self
10328 }
10329
10330 /// Identifies the authorization scope for the method you are building.
10331 ///
10332 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10333 /// [`Scope::CloudPlatform`].
10334 ///
10335 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10336 /// tokens for more than one scope.
10337 ///
10338 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10339 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10340 /// sufficient, a read-write scope will do as well.
10341 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C>
10342 where
10343 St: AsRef<str>,
10344 {
10345 self._scopes.insert(String::from(scope.as_ref()));
10346 self
10347 }
10348 /// Identifies the authorization scope(s) for the method you are building.
10349 ///
10350 /// See [`Self::add_scope()`] for details.
10351 pub fn add_scopes<I, St>(
10352 mut self,
10353 scopes: I,
10354 ) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C>
10355 where
10356 I: IntoIterator<Item = St>,
10357 St: AsRef<str>,
10358 {
10359 self._scopes
10360 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10361 self
10362 }
10363
10364 /// Removes all scopes, and no default scope will be used either.
10365 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10366 /// for details).
10367 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCertificateRevokeCall<'a, C> {
10368 self._scopes.clear();
10369 self
10370 }
10371}
10372
10373/// Create a CaPool.
10374///
10375/// A builder for the *locations.caPools.create* method supported by a *project* resource.
10376/// It is not used directly, but through a [`ProjectMethods`] instance.
10377///
10378/// # Example
10379///
10380/// Instantiate a resource method builder
10381///
10382/// ```test_harness,no_run
10383/// # extern crate hyper;
10384/// # extern crate hyper_rustls;
10385/// # extern crate google_privateca1 as privateca1;
10386/// use privateca1::api::CaPool;
10387/// # async fn dox() {
10388/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10389///
10390/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10391/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10392/// # .with_native_roots()
10393/// # .unwrap()
10394/// # .https_only()
10395/// # .enable_http2()
10396/// # .build();
10397///
10398/// # let executor = hyper_util::rt::TokioExecutor::new();
10399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10400/// # secret,
10401/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10402/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10403/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10404/// # ),
10405/// # ).build().await.unwrap();
10406///
10407/// # let client = hyper_util::client::legacy::Client::builder(
10408/// # hyper_util::rt::TokioExecutor::new()
10409/// # )
10410/// # .build(
10411/// # hyper_rustls::HttpsConnectorBuilder::new()
10412/// # .with_native_roots()
10413/// # .unwrap()
10414/// # .https_or_http()
10415/// # .enable_http2()
10416/// # .build()
10417/// # );
10418/// # let mut hub = CertificateAuthorityService::new(client, auth);
10419/// // As the method needs a request, you would usually fill it with the desired information
10420/// // into the respective structure. Some of the parts shown here might not be applicable !
10421/// // Values shown here are possibly random and not representative !
10422/// let mut req = CaPool::default();
10423///
10424/// // You can configure optional parameters by calling the respective setters at will, and
10425/// // execute the final call using `doit()`.
10426/// // Values shown here are possibly random and not representative !
10427/// let result = hub.projects().locations_ca_pools_create(req, "parent")
10428/// .request_id("accusam")
10429/// .ca_pool_id("takimata")
10430/// .doit().await;
10431/// # }
10432/// ```
10433pub struct ProjectLocationCaPoolCreateCall<'a, C>
10434where
10435 C: 'a,
10436{
10437 hub: &'a CertificateAuthorityService<C>,
10438 _request: CaPool,
10439 _parent: String,
10440 _request_id: Option<String>,
10441 _ca_pool_id: Option<String>,
10442 _delegate: Option<&'a mut dyn common::Delegate>,
10443 _additional_params: HashMap<String, String>,
10444 _scopes: BTreeSet<String>,
10445}
10446
10447impl<'a, C> common::CallBuilder for ProjectLocationCaPoolCreateCall<'a, C> {}
10448
10449impl<'a, C> ProjectLocationCaPoolCreateCall<'a, C>
10450where
10451 C: common::Connector,
10452{
10453 /// Perform the operation you have build so far.
10454 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10455 use std::borrow::Cow;
10456 use std::io::{Read, Seek};
10457
10458 use common::{url::Params, ToParts};
10459 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10460
10461 let mut dd = common::DefaultDelegate;
10462 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10463 dlg.begin(common::MethodInfo {
10464 id: "privateca.projects.locations.caPools.create",
10465 http_method: hyper::Method::POST,
10466 });
10467
10468 for &field in ["alt", "parent", "requestId", "caPoolId"].iter() {
10469 if self._additional_params.contains_key(field) {
10470 dlg.finished(false);
10471 return Err(common::Error::FieldClash(field));
10472 }
10473 }
10474
10475 let mut params = Params::with_capacity(6 + self._additional_params.len());
10476 params.push("parent", self._parent);
10477 if let Some(value) = self._request_id.as_ref() {
10478 params.push("requestId", value);
10479 }
10480 if let Some(value) = self._ca_pool_id.as_ref() {
10481 params.push("caPoolId", value);
10482 }
10483
10484 params.extend(self._additional_params.iter());
10485
10486 params.push("alt", "json");
10487 let mut url = self.hub._base_url.clone() + "v1/{+parent}/caPools";
10488 if self._scopes.is_empty() {
10489 self._scopes
10490 .insert(Scope::CloudPlatform.as_ref().to_string());
10491 }
10492
10493 #[allow(clippy::single_element_loop)]
10494 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10495 url = params.uri_replacement(url, param_name, find_this, true);
10496 }
10497 {
10498 let to_remove = ["parent"];
10499 params.remove_params(&to_remove);
10500 }
10501
10502 let url = params.parse_with_url(&url);
10503
10504 let mut json_mime_type = mime::APPLICATION_JSON;
10505 let mut request_value_reader = {
10506 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10507 common::remove_json_null_values(&mut value);
10508 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10509 serde_json::to_writer(&mut dst, &value).unwrap();
10510 dst
10511 };
10512 let request_size = request_value_reader
10513 .seek(std::io::SeekFrom::End(0))
10514 .unwrap();
10515 request_value_reader
10516 .seek(std::io::SeekFrom::Start(0))
10517 .unwrap();
10518
10519 loop {
10520 let token = match self
10521 .hub
10522 .auth
10523 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10524 .await
10525 {
10526 Ok(token) => token,
10527 Err(e) => match dlg.token(e) {
10528 Ok(token) => token,
10529 Err(e) => {
10530 dlg.finished(false);
10531 return Err(common::Error::MissingToken(e));
10532 }
10533 },
10534 };
10535 request_value_reader
10536 .seek(std::io::SeekFrom::Start(0))
10537 .unwrap();
10538 let mut req_result = {
10539 let client = &self.hub.client;
10540 dlg.pre_request();
10541 let mut req_builder = hyper::Request::builder()
10542 .method(hyper::Method::POST)
10543 .uri(url.as_str())
10544 .header(USER_AGENT, self.hub._user_agent.clone());
10545
10546 if let Some(token) = token.as_ref() {
10547 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10548 }
10549
10550 let request = req_builder
10551 .header(CONTENT_TYPE, json_mime_type.to_string())
10552 .header(CONTENT_LENGTH, request_size as u64)
10553 .body(common::to_body(
10554 request_value_reader.get_ref().clone().into(),
10555 ));
10556
10557 client.request(request.unwrap()).await
10558 };
10559
10560 match req_result {
10561 Err(err) => {
10562 if let common::Retry::After(d) = dlg.http_error(&err) {
10563 sleep(d).await;
10564 continue;
10565 }
10566 dlg.finished(false);
10567 return Err(common::Error::HttpError(err));
10568 }
10569 Ok(res) => {
10570 let (mut parts, body) = res.into_parts();
10571 let mut body = common::Body::new(body);
10572 if !parts.status.is_success() {
10573 let bytes = common::to_bytes(body).await.unwrap_or_default();
10574 let error = serde_json::from_str(&common::to_string(&bytes));
10575 let response = common::to_response(parts, bytes.into());
10576
10577 if let common::Retry::After(d) =
10578 dlg.http_failure(&response, error.as_ref().ok())
10579 {
10580 sleep(d).await;
10581 continue;
10582 }
10583
10584 dlg.finished(false);
10585
10586 return Err(match error {
10587 Ok(value) => common::Error::BadRequest(value),
10588 _ => common::Error::Failure(response),
10589 });
10590 }
10591 let response = {
10592 let bytes = common::to_bytes(body).await.unwrap_or_default();
10593 let encoded = common::to_string(&bytes);
10594 match serde_json::from_str(&encoded) {
10595 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10596 Err(error) => {
10597 dlg.response_json_decode_error(&encoded, &error);
10598 return Err(common::Error::JsonDecodeError(
10599 encoded.to_string(),
10600 error,
10601 ));
10602 }
10603 }
10604 };
10605
10606 dlg.finished(true);
10607 return Ok(response);
10608 }
10609 }
10610 }
10611 }
10612
10613 ///
10614 /// Sets the *request* property to the given value.
10615 ///
10616 /// Even though the property as already been set when instantiating this call,
10617 /// we provide this method for API completeness.
10618 pub fn request(mut self, new_value: CaPool) -> ProjectLocationCaPoolCreateCall<'a, C> {
10619 self._request = new_value;
10620 self
10621 }
10622 /// Required. The resource name of the location associated with the CaPool, in the format `projects/*/locations/*`.
10623 ///
10624 /// Sets the *parent* path property to the given value.
10625 ///
10626 /// Even though the property as already been set when instantiating this call,
10627 /// we provide this method for API completeness.
10628 pub fn parent(mut self, new_value: &str) -> ProjectLocationCaPoolCreateCall<'a, C> {
10629 self._parent = new_value.to_string();
10630 self
10631 }
10632 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
10633 ///
10634 /// Sets the *request id* query property to the given value.
10635 pub fn request_id(mut self, new_value: &str) -> ProjectLocationCaPoolCreateCall<'a, C> {
10636 self._request_id = Some(new_value.to_string());
10637 self
10638 }
10639 /// Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`
10640 ///
10641 /// Sets the *ca pool id* query property to the given value.
10642 pub fn ca_pool_id(mut self, new_value: &str) -> ProjectLocationCaPoolCreateCall<'a, C> {
10643 self._ca_pool_id = Some(new_value.to_string());
10644 self
10645 }
10646 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10647 /// while executing the actual API request.
10648 ///
10649 /// ````text
10650 /// It should be used to handle progress information, and to implement a certain level of resilience.
10651 /// ````
10652 ///
10653 /// Sets the *delegate* property to the given value.
10654 pub fn delegate(
10655 mut self,
10656 new_value: &'a mut dyn common::Delegate,
10657 ) -> ProjectLocationCaPoolCreateCall<'a, C> {
10658 self._delegate = Some(new_value);
10659 self
10660 }
10661
10662 /// Set any additional parameter of the query string used in the request.
10663 /// It should be used to set parameters which are not yet available through their own
10664 /// setters.
10665 ///
10666 /// Please note that this method must not be used to set any of the known parameters
10667 /// which have their own setter method. If done anyway, the request will fail.
10668 ///
10669 /// # Additional Parameters
10670 ///
10671 /// * *$.xgafv* (query-string) - V1 error format.
10672 /// * *access_token* (query-string) - OAuth access token.
10673 /// * *alt* (query-string) - Data format for response.
10674 /// * *callback* (query-string) - JSONP
10675 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10676 /// * *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.
10677 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10678 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10679 /// * *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.
10680 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10681 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10682 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolCreateCall<'a, C>
10683 where
10684 T: AsRef<str>,
10685 {
10686 self._additional_params
10687 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10688 self
10689 }
10690
10691 /// Identifies the authorization scope for the method you are building.
10692 ///
10693 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10694 /// [`Scope::CloudPlatform`].
10695 ///
10696 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10697 /// tokens for more than one scope.
10698 ///
10699 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10700 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10701 /// sufficient, a read-write scope will do as well.
10702 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolCreateCall<'a, C>
10703 where
10704 St: AsRef<str>,
10705 {
10706 self._scopes.insert(String::from(scope.as_ref()));
10707 self
10708 }
10709 /// Identifies the authorization scope(s) for the method you are building.
10710 ///
10711 /// See [`Self::add_scope()`] for details.
10712 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolCreateCall<'a, C>
10713 where
10714 I: IntoIterator<Item = St>,
10715 St: AsRef<str>,
10716 {
10717 self._scopes
10718 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10719 self
10720 }
10721
10722 /// Removes all scopes, and no default scope will be used either.
10723 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10724 /// for details).
10725 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolCreateCall<'a, C> {
10726 self._scopes.clear();
10727 self
10728 }
10729}
10730
10731/// Delete a CaPool.
10732///
10733/// A builder for the *locations.caPools.delete* method supported by a *project* resource.
10734/// It is not used directly, but through a [`ProjectMethods`] instance.
10735///
10736/// # Example
10737///
10738/// Instantiate a resource method builder
10739///
10740/// ```test_harness,no_run
10741/// # extern crate hyper;
10742/// # extern crate hyper_rustls;
10743/// # extern crate google_privateca1 as privateca1;
10744/// # async fn dox() {
10745/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10746///
10747/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10748/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10749/// # .with_native_roots()
10750/// # .unwrap()
10751/// # .https_only()
10752/// # .enable_http2()
10753/// # .build();
10754///
10755/// # let executor = hyper_util::rt::TokioExecutor::new();
10756/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10757/// # secret,
10758/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10759/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10760/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10761/// # ),
10762/// # ).build().await.unwrap();
10763///
10764/// # let client = hyper_util::client::legacy::Client::builder(
10765/// # hyper_util::rt::TokioExecutor::new()
10766/// # )
10767/// # .build(
10768/// # hyper_rustls::HttpsConnectorBuilder::new()
10769/// # .with_native_roots()
10770/// # .unwrap()
10771/// # .https_or_http()
10772/// # .enable_http2()
10773/// # .build()
10774/// # );
10775/// # let mut hub = CertificateAuthorityService::new(client, auth);
10776/// // You can configure optional parameters by calling the respective setters at will, and
10777/// // execute the final call using `doit()`.
10778/// // Values shown here are possibly random and not representative !
10779/// let result = hub.projects().locations_ca_pools_delete("name")
10780/// .request_id("voluptua.")
10781/// .ignore_dependent_resources(false)
10782/// .doit().await;
10783/// # }
10784/// ```
10785pub struct ProjectLocationCaPoolDeleteCall<'a, C>
10786where
10787 C: 'a,
10788{
10789 hub: &'a CertificateAuthorityService<C>,
10790 _name: String,
10791 _request_id: Option<String>,
10792 _ignore_dependent_resources: Option<bool>,
10793 _delegate: Option<&'a mut dyn common::Delegate>,
10794 _additional_params: HashMap<String, String>,
10795 _scopes: BTreeSet<String>,
10796}
10797
10798impl<'a, C> common::CallBuilder for ProjectLocationCaPoolDeleteCall<'a, C> {}
10799
10800impl<'a, C> ProjectLocationCaPoolDeleteCall<'a, C>
10801where
10802 C: common::Connector,
10803{
10804 /// Perform the operation you have build so far.
10805 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10806 use std::borrow::Cow;
10807 use std::io::{Read, Seek};
10808
10809 use common::{url::Params, ToParts};
10810 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10811
10812 let mut dd = common::DefaultDelegate;
10813 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10814 dlg.begin(common::MethodInfo {
10815 id: "privateca.projects.locations.caPools.delete",
10816 http_method: hyper::Method::DELETE,
10817 });
10818
10819 for &field in ["alt", "name", "requestId", "ignoreDependentResources"].iter() {
10820 if self._additional_params.contains_key(field) {
10821 dlg.finished(false);
10822 return Err(common::Error::FieldClash(field));
10823 }
10824 }
10825
10826 let mut params = Params::with_capacity(5 + self._additional_params.len());
10827 params.push("name", self._name);
10828 if let Some(value) = self._request_id.as_ref() {
10829 params.push("requestId", value);
10830 }
10831 if let Some(value) = self._ignore_dependent_resources.as_ref() {
10832 params.push("ignoreDependentResources", value.to_string());
10833 }
10834
10835 params.extend(self._additional_params.iter());
10836
10837 params.push("alt", "json");
10838 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10839 if self._scopes.is_empty() {
10840 self._scopes
10841 .insert(Scope::CloudPlatform.as_ref().to_string());
10842 }
10843
10844 #[allow(clippy::single_element_loop)]
10845 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10846 url = params.uri_replacement(url, param_name, find_this, true);
10847 }
10848 {
10849 let to_remove = ["name"];
10850 params.remove_params(&to_remove);
10851 }
10852
10853 let url = params.parse_with_url(&url);
10854
10855 loop {
10856 let token = match self
10857 .hub
10858 .auth
10859 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10860 .await
10861 {
10862 Ok(token) => token,
10863 Err(e) => match dlg.token(e) {
10864 Ok(token) => token,
10865 Err(e) => {
10866 dlg.finished(false);
10867 return Err(common::Error::MissingToken(e));
10868 }
10869 },
10870 };
10871 let mut req_result = {
10872 let client = &self.hub.client;
10873 dlg.pre_request();
10874 let mut req_builder = hyper::Request::builder()
10875 .method(hyper::Method::DELETE)
10876 .uri(url.as_str())
10877 .header(USER_AGENT, self.hub._user_agent.clone());
10878
10879 if let Some(token) = token.as_ref() {
10880 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10881 }
10882
10883 let request = req_builder
10884 .header(CONTENT_LENGTH, 0_u64)
10885 .body(common::to_body::<String>(None));
10886
10887 client.request(request.unwrap()).await
10888 };
10889
10890 match req_result {
10891 Err(err) => {
10892 if let common::Retry::After(d) = dlg.http_error(&err) {
10893 sleep(d).await;
10894 continue;
10895 }
10896 dlg.finished(false);
10897 return Err(common::Error::HttpError(err));
10898 }
10899 Ok(res) => {
10900 let (mut parts, body) = res.into_parts();
10901 let mut body = common::Body::new(body);
10902 if !parts.status.is_success() {
10903 let bytes = common::to_bytes(body).await.unwrap_or_default();
10904 let error = serde_json::from_str(&common::to_string(&bytes));
10905 let response = common::to_response(parts, bytes.into());
10906
10907 if let common::Retry::After(d) =
10908 dlg.http_failure(&response, error.as_ref().ok())
10909 {
10910 sleep(d).await;
10911 continue;
10912 }
10913
10914 dlg.finished(false);
10915
10916 return Err(match error {
10917 Ok(value) => common::Error::BadRequest(value),
10918 _ => common::Error::Failure(response),
10919 });
10920 }
10921 let response = {
10922 let bytes = common::to_bytes(body).await.unwrap_or_default();
10923 let encoded = common::to_string(&bytes);
10924 match serde_json::from_str(&encoded) {
10925 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10926 Err(error) => {
10927 dlg.response_json_decode_error(&encoded, &error);
10928 return Err(common::Error::JsonDecodeError(
10929 encoded.to_string(),
10930 error,
10931 ));
10932 }
10933 }
10934 };
10935
10936 dlg.finished(true);
10937 return Ok(response);
10938 }
10939 }
10940 }
10941 }
10942
10943 /// Required. The resource name for this CaPool in the format `projects/*/locations/*/caPools/*`.
10944 ///
10945 /// Sets the *name* path property to the given value.
10946 ///
10947 /// Even though the property as already been set when instantiating this call,
10948 /// we provide this method for API completeness.
10949 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolDeleteCall<'a, C> {
10950 self._name = new_value.to_string();
10951 self
10952 }
10953 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
10954 ///
10955 /// Sets the *request id* query property to the given value.
10956 pub fn request_id(mut self, new_value: &str) -> ProjectLocationCaPoolDeleteCall<'a, C> {
10957 self._request_id = Some(new_value.to_string());
10958 self
10959 }
10960 /// Optional. This field allows this pool to be deleted even if it's being depended on by another resource. However, doing so may result in unintended and unrecoverable effects on any dependent resources since the pool will no longer be able to issue certificates.
10961 ///
10962 /// Sets the *ignore dependent resources* query property to the given value.
10963 pub fn ignore_dependent_resources(
10964 mut self,
10965 new_value: bool,
10966 ) -> ProjectLocationCaPoolDeleteCall<'a, C> {
10967 self._ignore_dependent_resources = Some(new_value);
10968 self
10969 }
10970 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10971 /// while executing the actual API request.
10972 ///
10973 /// ````text
10974 /// It should be used to handle progress information, and to implement a certain level of resilience.
10975 /// ````
10976 ///
10977 /// Sets the *delegate* property to the given value.
10978 pub fn delegate(
10979 mut self,
10980 new_value: &'a mut dyn common::Delegate,
10981 ) -> ProjectLocationCaPoolDeleteCall<'a, C> {
10982 self._delegate = Some(new_value);
10983 self
10984 }
10985
10986 /// Set any additional parameter of the query string used in the request.
10987 /// It should be used to set parameters which are not yet available through their own
10988 /// setters.
10989 ///
10990 /// Please note that this method must not be used to set any of the known parameters
10991 /// which have their own setter method. If done anyway, the request will fail.
10992 ///
10993 /// # Additional Parameters
10994 ///
10995 /// * *$.xgafv* (query-string) - V1 error format.
10996 /// * *access_token* (query-string) - OAuth access token.
10997 /// * *alt* (query-string) - Data format for response.
10998 /// * *callback* (query-string) - JSONP
10999 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11000 /// * *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.
11001 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11002 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11003 /// * *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.
11004 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11005 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11006 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolDeleteCall<'a, C>
11007 where
11008 T: AsRef<str>,
11009 {
11010 self._additional_params
11011 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11012 self
11013 }
11014
11015 /// Identifies the authorization scope for the method you are building.
11016 ///
11017 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11018 /// [`Scope::CloudPlatform`].
11019 ///
11020 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11021 /// tokens for more than one scope.
11022 ///
11023 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11024 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11025 /// sufficient, a read-write scope will do as well.
11026 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolDeleteCall<'a, C>
11027 where
11028 St: AsRef<str>,
11029 {
11030 self._scopes.insert(String::from(scope.as_ref()));
11031 self
11032 }
11033 /// Identifies the authorization scope(s) for the method you are building.
11034 ///
11035 /// See [`Self::add_scope()`] for details.
11036 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolDeleteCall<'a, C>
11037 where
11038 I: IntoIterator<Item = St>,
11039 St: AsRef<str>,
11040 {
11041 self._scopes
11042 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11043 self
11044 }
11045
11046 /// Removes all scopes, and no default scope will be used either.
11047 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11048 /// for details).
11049 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolDeleteCall<'a, C> {
11050 self._scopes.clear();
11051 self
11052 }
11053}
11054
11055/// FetchCaCerts returns the current trust anchor for the CaPool. This will include CA certificate chains for all certificate authorities in the ENABLED, DISABLED, or STAGED states.
11056///
11057/// A builder for the *locations.caPools.fetchCaCerts* method supported by a *project* resource.
11058/// It is not used directly, but through a [`ProjectMethods`] instance.
11059///
11060/// # Example
11061///
11062/// Instantiate a resource method builder
11063///
11064/// ```test_harness,no_run
11065/// # extern crate hyper;
11066/// # extern crate hyper_rustls;
11067/// # extern crate google_privateca1 as privateca1;
11068/// use privateca1::api::FetchCaCertsRequest;
11069/// # async fn dox() {
11070/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11071///
11072/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11073/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11074/// # .with_native_roots()
11075/// # .unwrap()
11076/// # .https_only()
11077/// # .enable_http2()
11078/// # .build();
11079///
11080/// # let executor = hyper_util::rt::TokioExecutor::new();
11081/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11082/// # secret,
11083/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11084/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11085/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11086/// # ),
11087/// # ).build().await.unwrap();
11088///
11089/// # let client = hyper_util::client::legacy::Client::builder(
11090/// # hyper_util::rt::TokioExecutor::new()
11091/// # )
11092/// # .build(
11093/// # hyper_rustls::HttpsConnectorBuilder::new()
11094/// # .with_native_roots()
11095/// # .unwrap()
11096/// # .https_or_http()
11097/// # .enable_http2()
11098/// # .build()
11099/// # );
11100/// # let mut hub = CertificateAuthorityService::new(client, auth);
11101/// // As the method needs a request, you would usually fill it with the desired information
11102/// // into the respective structure. Some of the parts shown here might not be applicable !
11103/// // Values shown here are possibly random and not representative !
11104/// let mut req = FetchCaCertsRequest::default();
11105///
11106/// // You can configure optional parameters by calling the respective setters at will, and
11107/// // execute the final call using `doit()`.
11108/// // Values shown here are possibly random and not representative !
11109/// let result = hub.projects().locations_ca_pools_fetch_ca_certs(req, "caPool")
11110/// .doit().await;
11111/// # }
11112/// ```
11113pub struct ProjectLocationCaPoolFetchCaCertCall<'a, C>
11114where
11115 C: 'a,
11116{
11117 hub: &'a CertificateAuthorityService<C>,
11118 _request: FetchCaCertsRequest,
11119 _ca_pool: String,
11120 _delegate: Option<&'a mut dyn common::Delegate>,
11121 _additional_params: HashMap<String, String>,
11122 _scopes: BTreeSet<String>,
11123}
11124
11125impl<'a, C> common::CallBuilder for ProjectLocationCaPoolFetchCaCertCall<'a, C> {}
11126
11127impl<'a, C> ProjectLocationCaPoolFetchCaCertCall<'a, C>
11128where
11129 C: common::Connector,
11130{
11131 /// Perform the operation you have build so far.
11132 pub async fn doit(mut self) -> common::Result<(common::Response, FetchCaCertsResponse)> {
11133 use std::borrow::Cow;
11134 use std::io::{Read, Seek};
11135
11136 use common::{url::Params, ToParts};
11137 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11138
11139 let mut dd = common::DefaultDelegate;
11140 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11141 dlg.begin(common::MethodInfo {
11142 id: "privateca.projects.locations.caPools.fetchCaCerts",
11143 http_method: hyper::Method::POST,
11144 });
11145
11146 for &field in ["alt", "caPool"].iter() {
11147 if self._additional_params.contains_key(field) {
11148 dlg.finished(false);
11149 return Err(common::Error::FieldClash(field));
11150 }
11151 }
11152
11153 let mut params = Params::with_capacity(4 + self._additional_params.len());
11154 params.push("caPool", self._ca_pool);
11155
11156 params.extend(self._additional_params.iter());
11157
11158 params.push("alt", "json");
11159 let mut url = self.hub._base_url.clone() + "v1/{+caPool}:fetchCaCerts";
11160 if self._scopes.is_empty() {
11161 self._scopes
11162 .insert(Scope::CloudPlatform.as_ref().to_string());
11163 }
11164
11165 #[allow(clippy::single_element_loop)]
11166 for &(find_this, param_name) in [("{+caPool}", "caPool")].iter() {
11167 url = params.uri_replacement(url, param_name, find_this, true);
11168 }
11169 {
11170 let to_remove = ["caPool"];
11171 params.remove_params(&to_remove);
11172 }
11173
11174 let url = params.parse_with_url(&url);
11175
11176 let mut json_mime_type = mime::APPLICATION_JSON;
11177 let mut request_value_reader = {
11178 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11179 common::remove_json_null_values(&mut value);
11180 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11181 serde_json::to_writer(&mut dst, &value).unwrap();
11182 dst
11183 };
11184 let request_size = request_value_reader
11185 .seek(std::io::SeekFrom::End(0))
11186 .unwrap();
11187 request_value_reader
11188 .seek(std::io::SeekFrom::Start(0))
11189 .unwrap();
11190
11191 loop {
11192 let token = match self
11193 .hub
11194 .auth
11195 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11196 .await
11197 {
11198 Ok(token) => token,
11199 Err(e) => match dlg.token(e) {
11200 Ok(token) => token,
11201 Err(e) => {
11202 dlg.finished(false);
11203 return Err(common::Error::MissingToken(e));
11204 }
11205 },
11206 };
11207 request_value_reader
11208 .seek(std::io::SeekFrom::Start(0))
11209 .unwrap();
11210 let mut req_result = {
11211 let client = &self.hub.client;
11212 dlg.pre_request();
11213 let mut req_builder = hyper::Request::builder()
11214 .method(hyper::Method::POST)
11215 .uri(url.as_str())
11216 .header(USER_AGENT, self.hub._user_agent.clone());
11217
11218 if let Some(token) = token.as_ref() {
11219 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11220 }
11221
11222 let request = req_builder
11223 .header(CONTENT_TYPE, json_mime_type.to_string())
11224 .header(CONTENT_LENGTH, request_size as u64)
11225 .body(common::to_body(
11226 request_value_reader.get_ref().clone().into(),
11227 ));
11228
11229 client.request(request.unwrap()).await
11230 };
11231
11232 match req_result {
11233 Err(err) => {
11234 if let common::Retry::After(d) = dlg.http_error(&err) {
11235 sleep(d).await;
11236 continue;
11237 }
11238 dlg.finished(false);
11239 return Err(common::Error::HttpError(err));
11240 }
11241 Ok(res) => {
11242 let (mut parts, body) = res.into_parts();
11243 let mut body = common::Body::new(body);
11244 if !parts.status.is_success() {
11245 let bytes = common::to_bytes(body).await.unwrap_or_default();
11246 let error = serde_json::from_str(&common::to_string(&bytes));
11247 let response = common::to_response(parts, bytes.into());
11248
11249 if let common::Retry::After(d) =
11250 dlg.http_failure(&response, error.as_ref().ok())
11251 {
11252 sleep(d).await;
11253 continue;
11254 }
11255
11256 dlg.finished(false);
11257
11258 return Err(match error {
11259 Ok(value) => common::Error::BadRequest(value),
11260 _ => common::Error::Failure(response),
11261 });
11262 }
11263 let response = {
11264 let bytes = common::to_bytes(body).await.unwrap_or_default();
11265 let encoded = common::to_string(&bytes);
11266 match serde_json::from_str(&encoded) {
11267 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11268 Err(error) => {
11269 dlg.response_json_decode_error(&encoded, &error);
11270 return Err(common::Error::JsonDecodeError(
11271 encoded.to_string(),
11272 error,
11273 ));
11274 }
11275 }
11276 };
11277
11278 dlg.finished(true);
11279 return Ok(response);
11280 }
11281 }
11282 }
11283 }
11284
11285 ///
11286 /// Sets the *request* property to the given value.
11287 ///
11288 /// Even though the property as already been set when instantiating this call,
11289 /// we provide this method for API completeness.
11290 pub fn request(
11291 mut self,
11292 new_value: FetchCaCertsRequest,
11293 ) -> ProjectLocationCaPoolFetchCaCertCall<'a, C> {
11294 self._request = new_value;
11295 self
11296 }
11297 /// Required. The resource name for the CaPool in the format `projects/*/locations/*/caPools/*`.
11298 ///
11299 /// Sets the *ca pool* path property to the given value.
11300 ///
11301 /// Even though the property as already been set when instantiating this call,
11302 /// we provide this method for API completeness.
11303 pub fn ca_pool(mut self, new_value: &str) -> ProjectLocationCaPoolFetchCaCertCall<'a, C> {
11304 self._ca_pool = new_value.to_string();
11305 self
11306 }
11307 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11308 /// while executing the actual API request.
11309 ///
11310 /// ````text
11311 /// It should be used to handle progress information, and to implement a certain level of resilience.
11312 /// ````
11313 ///
11314 /// Sets the *delegate* property to the given value.
11315 pub fn delegate(
11316 mut self,
11317 new_value: &'a mut dyn common::Delegate,
11318 ) -> ProjectLocationCaPoolFetchCaCertCall<'a, C> {
11319 self._delegate = Some(new_value);
11320 self
11321 }
11322
11323 /// Set any additional parameter of the query string used in the request.
11324 /// It should be used to set parameters which are not yet available through their own
11325 /// setters.
11326 ///
11327 /// Please note that this method must not be used to set any of the known parameters
11328 /// which have their own setter method. If done anyway, the request will fail.
11329 ///
11330 /// # Additional Parameters
11331 ///
11332 /// * *$.xgafv* (query-string) - V1 error format.
11333 /// * *access_token* (query-string) - OAuth access token.
11334 /// * *alt* (query-string) - Data format for response.
11335 /// * *callback* (query-string) - JSONP
11336 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11337 /// * *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.
11338 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11339 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11340 /// * *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.
11341 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11342 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11343 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolFetchCaCertCall<'a, C>
11344 where
11345 T: AsRef<str>,
11346 {
11347 self._additional_params
11348 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11349 self
11350 }
11351
11352 /// Identifies the authorization scope for the method you are building.
11353 ///
11354 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11355 /// [`Scope::CloudPlatform`].
11356 ///
11357 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11358 /// tokens for more than one scope.
11359 ///
11360 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11361 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11362 /// sufficient, a read-write scope will do as well.
11363 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolFetchCaCertCall<'a, C>
11364 where
11365 St: AsRef<str>,
11366 {
11367 self._scopes.insert(String::from(scope.as_ref()));
11368 self
11369 }
11370 /// Identifies the authorization scope(s) for the method you are building.
11371 ///
11372 /// See [`Self::add_scope()`] for details.
11373 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolFetchCaCertCall<'a, C>
11374 where
11375 I: IntoIterator<Item = St>,
11376 St: AsRef<str>,
11377 {
11378 self._scopes
11379 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11380 self
11381 }
11382
11383 /// Removes all scopes, and no default scope will be used either.
11384 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11385 /// for details).
11386 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolFetchCaCertCall<'a, C> {
11387 self._scopes.clear();
11388 self
11389 }
11390}
11391
11392/// Returns a CaPool.
11393///
11394/// A builder for the *locations.caPools.get* method supported by a *project* resource.
11395/// It is not used directly, but through a [`ProjectMethods`] instance.
11396///
11397/// # Example
11398///
11399/// Instantiate a resource method builder
11400///
11401/// ```test_harness,no_run
11402/// # extern crate hyper;
11403/// # extern crate hyper_rustls;
11404/// # extern crate google_privateca1 as privateca1;
11405/// # async fn dox() {
11406/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11407///
11408/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11409/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11410/// # .with_native_roots()
11411/// # .unwrap()
11412/// # .https_only()
11413/// # .enable_http2()
11414/// # .build();
11415///
11416/// # let executor = hyper_util::rt::TokioExecutor::new();
11417/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11418/// # secret,
11419/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11420/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11421/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11422/// # ),
11423/// # ).build().await.unwrap();
11424///
11425/// # let client = hyper_util::client::legacy::Client::builder(
11426/// # hyper_util::rt::TokioExecutor::new()
11427/// # )
11428/// # .build(
11429/// # hyper_rustls::HttpsConnectorBuilder::new()
11430/// # .with_native_roots()
11431/// # .unwrap()
11432/// # .https_or_http()
11433/// # .enable_http2()
11434/// # .build()
11435/// # );
11436/// # let mut hub = CertificateAuthorityService::new(client, auth);
11437/// // You can configure optional parameters by calling the respective setters at will, and
11438/// // execute the final call using `doit()`.
11439/// // Values shown here are possibly random and not representative !
11440/// let result = hub.projects().locations_ca_pools_get("name")
11441/// .doit().await;
11442/// # }
11443/// ```
11444pub struct ProjectLocationCaPoolGetCall<'a, C>
11445where
11446 C: 'a,
11447{
11448 hub: &'a CertificateAuthorityService<C>,
11449 _name: String,
11450 _delegate: Option<&'a mut dyn common::Delegate>,
11451 _additional_params: HashMap<String, String>,
11452 _scopes: BTreeSet<String>,
11453}
11454
11455impl<'a, C> common::CallBuilder for ProjectLocationCaPoolGetCall<'a, C> {}
11456
11457impl<'a, C> ProjectLocationCaPoolGetCall<'a, C>
11458where
11459 C: common::Connector,
11460{
11461 /// Perform the operation you have build so far.
11462 pub async fn doit(mut self) -> common::Result<(common::Response, CaPool)> {
11463 use std::borrow::Cow;
11464 use std::io::{Read, Seek};
11465
11466 use common::{url::Params, ToParts};
11467 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11468
11469 let mut dd = common::DefaultDelegate;
11470 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11471 dlg.begin(common::MethodInfo {
11472 id: "privateca.projects.locations.caPools.get",
11473 http_method: hyper::Method::GET,
11474 });
11475
11476 for &field in ["alt", "name"].iter() {
11477 if self._additional_params.contains_key(field) {
11478 dlg.finished(false);
11479 return Err(common::Error::FieldClash(field));
11480 }
11481 }
11482
11483 let mut params = Params::with_capacity(3 + self._additional_params.len());
11484 params.push("name", self._name);
11485
11486 params.extend(self._additional_params.iter());
11487
11488 params.push("alt", "json");
11489 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11490 if self._scopes.is_empty() {
11491 self._scopes
11492 .insert(Scope::CloudPlatform.as_ref().to_string());
11493 }
11494
11495 #[allow(clippy::single_element_loop)]
11496 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11497 url = params.uri_replacement(url, param_name, find_this, true);
11498 }
11499 {
11500 let to_remove = ["name"];
11501 params.remove_params(&to_remove);
11502 }
11503
11504 let url = params.parse_with_url(&url);
11505
11506 loop {
11507 let token = match self
11508 .hub
11509 .auth
11510 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11511 .await
11512 {
11513 Ok(token) => token,
11514 Err(e) => match dlg.token(e) {
11515 Ok(token) => token,
11516 Err(e) => {
11517 dlg.finished(false);
11518 return Err(common::Error::MissingToken(e));
11519 }
11520 },
11521 };
11522 let mut req_result = {
11523 let client = &self.hub.client;
11524 dlg.pre_request();
11525 let mut req_builder = hyper::Request::builder()
11526 .method(hyper::Method::GET)
11527 .uri(url.as_str())
11528 .header(USER_AGENT, self.hub._user_agent.clone());
11529
11530 if let Some(token) = token.as_ref() {
11531 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11532 }
11533
11534 let request = req_builder
11535 .header(CONTENT_LENGTH, 0_u64)
11536 .body(common::to_body::<String>(None));
11537
11538 client.request(request.unwrap()).await
11539 };
11540
11541 match req_result {
11542 Err(err) => {
11543 if let common::Retry::After(d) = dlg.http_error(&err) {
11544 sleep(d).await;
11545 continue;
11546 }
11547 dlg.finished(false);
11548 return Err(common::Error::HttpError(err));
11549 }
11550 Ok(res) => {
11551 let (mut parts, body) = res.into_parts();
11552 let mut body = common::Body::new(body);
11553 if !parts.status.is_success() {
11554 let bytes = common::to_bytes(body).await.unwrap_or_default();
11555 let error = serde_json::from_str(&common::to_string(&bytes));
11556 let response = common::to_response(parts, bytes.into());
11557
11558 if let common::Retry::After(d) =
11559 dlg.http_failure(&response, error.as_ref().ok())
11560 {
11561 sleep(d).await;
11562 continue;
11563 }
11564
11565 dlg.finished(false);
11566
11567 return Err(match error {
11568 Ok(value) => common::Error::BadRequest(value),
11569 _ => common::Error::Failure(response),
11570 });
11571 }
11572 let response = {
11573 let bytes = common::to_bytes(body).await.unwrap_or_default();
11574 let encoded = common::to_string(&bytes);
11575 match serde_json::from_str(&encoded) {
11576 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11577 Err(error) => {
11578 dlg.response_json_decode_error(&encoded, &error);
11579 return Err(common::Error::JsonDecodeError(
11580 encoded.to_string(),
11581 error,
11582 ));
11583 }
11584 }
11585 };
11586
11587 dlg.finished(true);
11588 return Ok(response);
11589 }
11590 }
11591 }
11592 }
11593
11594 /// Required. The name of the CaPool to get.
11595 ///
11596 /// Sets the *name* path property to the given value.
11597 ///
11598 /// Even though the property as already been set when instantiating this call,
11599 /// we provide this method for API completeness.
11600 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolGetCall<'a, C> {
11601 self._name = new_value.to_string();
11602 self
11603 }
11604 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11605 /// while executing the actual API request.
11606 ///
11607 /// ````text
11608 /// It should be used to handle progress information, and to implement a certain level of resilience.
11609 /// ````
11610 ///
11611 /// Sets the *delegate* property to the given value.
11612 pub fn delegate(
11613 mut self,
11614 new_value: &'a mut dyn common::Delegate,
11615 ) -> ProjectLocationCaPoolGetCall<'a, C> {
11616 self._delegate = Some(new_value);
11617 self
11618 }
11619
11620 /// Set any additional parameter of the query string used in the request.
11621 /// It should be used to set parameters which are not yet available through their own
11622 /// setters.
11623 ///
11624 /// Please note that this method must not be used to set any of the known parameters
11625 /// which have their own setter method. If done anyway, the request will fail.
11626 ///
11627 /// # Additional Parameters
11628 ///
11629 /// * *$.xgafv* (query-string) - V1 error format.
11630 /// * *access_token* (query-string) - OAuth access token.
11631 /// * *alt* (query-string) - Data format for response.
11632 /// * *callback* (query-string) - JSONP
11633 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11634 /// * *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.
11635 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11636 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11637 /// * *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.
11638 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11639 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11640 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolGetCall<'a, C>
11641 where
11642 T: AsRef<str>,
11643 {
11644 self._additional_params
11645 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11646 self
11647 }
11648
11649 /// Identifies the authorization scope for the method you are building.
11650 ///
11651 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11652 /// [`Scope::CloudPlatform`].
11653 ///
11654 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11655 /// tokens for more than one scope.
11656 ///
11657 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11658 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11659 /// sufficient, a read-write scope will do as well.
11660 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolGetCall<'a, C>
11661 where
11662 St: AsRef<str>,
11663 {
11664 self._scopes.insert(String::from(scope.as_ref()));
11665 self
11666 }
11667 /// Identifies the authorization scope(s) for the method you are building.
11668 ///
11669 /// See [`Self::add_scope()`] for details.
11670 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolGetCall<'a, C>
11671 where
11672 I: IntoIterator<Item = St>,
11673 St: AsRef<str>,
11674 {
11675 self._scopes
11676 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11677 self
11678 }
11679
11680 /// Removes all scopes, and no default scope will be used either.
11681 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11682 /// for details).
11683 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolGetCall<'a, C> {
11684 self._scopes.clear();
11685 self
11686 }
11687}
11688
11689/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
11690///
11691/// A builder for the *locations.caPools.getIamPolicy* method supported by a *project* resource.
11692/// It is not used directly, but through a [`ProjectMethods`] instance.
11693///
11694/// # Example
11695///
11696/// Instantiate a resource method builder
11697///
11698/// ```test_harness,no_run
11699/// # extern crate hyper;
11700/// # extern crate hyper_rustls;
11701/// # extern crate google_privateca1 as privateca1;
11702/// # async fn dox() {
11703/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11704///
11705/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11706/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11707/// # .with_native_roots()
11708/// # .unwrap()
11709/// # .https_only()
11710/// # .enable_http2()
11711/// # .build();
11712///
11713/// # let executor = hyper_util::rt::TokioExecutor::new();
11714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11715/// # secret,
11716/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11717/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11718/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11719/// # ),
11720/// # ).build().await.unwrap();
11721///
11722/// # let client = hyper_util::client::legacy::Client::builder(
11723/// # hyper_util::rt::TokioExecutor::new()
11724/// # )
11725/// # .build(
11726/// # hyper_rustls::HttpsConnectorBuilder::new()
11727/// # .with_native_roots()
11728/// # .unwrap()
11729/// # .https_or_http()
11730/// # .enable_http2()
11731/// # .build()
11732/// # );
11733/// # let mut hub = CertificateAuthorityService::new(client, auth);
11734/// // You can configure optional parameters by calling the respective setters at will, and
11735/// // execute the final call using `doit()`.
11736/// // Values shown here are possibly random and not representative !
11737/// let result = hub.projects().locations_ca_pools_get_iam_policy("resource")
11738/// .options_requested_policy_version(-30)
11739/// .doit().await;
11740/// # }
11741/// ```
11742pub struct ProjectLocationCaPoolGetIamPolicyCall<'a, C>
11743where
11744 C: 'a,
11745{
11746 hub: &'a CertificateAuthorityService<C>,
11747 _resource: String,
11748 _options_requested_policy_version: Option<i32>,
11749 _delegate: Option<&'a mut dyn common::Delegate>,
11750 _additional_params: HashMap<String, String>,
11751 _scopes: BTreeSet<String>,
11752}
11753
11754impl<'a, C> common::CallBuilder for ProjectLocationCaPoolGetIamPolicyCall<'a, C> {}
11755
11756impl<'a, C> ProjectLocationCaPoolGetIamPolicyCall<'a, C>
11757where
11758 C: common::Connector,
11759{
11760 /// Perform the operation you have build so far.
11761 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11762 use std::borrow::Cow;
11763 use std::io::{Read, Seek};
11764
11765 use common::{url::Params, ToParts};
11766 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11767
11768 let mut dd = common::DefaultDelegate;
11769 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11770 dlg.begin(common::MethodInfo {
11771 id: "privateca.projects.locations.caPools.getIamPolicy",
11772 http_method: hyper::Method::GET,
11773 });
11774
11775 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
11776 if self._additional_params.contains_key(field) {
11777 dlg.finished(false);
11778 return Err(common::Error::FieldClash(field));
11779 }
11780 }
11781
11782 let mut params = Params::with_capacity(4 + self._additional_params.len());
11783 params.push("resource", self._resource);
11784 if let Some(value) = self._options_requested_policy_version.as_ref() {
11785 params.push("options.requestedPolicyVersion", value.to_string());
11786 }
11787
11788 params.extend(self._additional_params.iter());
11789
11790 params.push("alt", "json");
11791 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
11792 if self._scopes.is_empty() {
11793 self._scopes
11794 .insert(Scope::CloudPlatform.as_ref().to_string());
11795 }
11796
11797 #[allow(clippy::single_element_loop)]
11798 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11799 url = params.uri_replacement(url, param_name, find_this, true);
11800 }
11801 {
11802 let to_remove = ["resource"];
11803 params.remove_params(&to_remove);
11804 }
11805
11806 let url = params.parse_with_url(&url);
11807
11808 loop {
11809 let token = match self
11810 .hub
11811 .auth
11812 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11813 .await
11814 {
11815 Ok(token) => token,
11816 Err(e) => match dlg.token(e) {
11817 Ok(token) => token,
11818 Err(e) => {
11819 dlg.finished(false);
11820 return Err(common::Error::MissingToken(e));
11821 }
11822 },
11823 };
11824 let mut req_result = {
11825 let client = &self.hub.client;
11826 dlg.pre_request();
11827 let mut req_builder = hyper::Request::builder()
11828 .method(hyper::Method::GET)
11829 .uri(url.as_str())
11830 .header(USER_AGENT, self.hub._user_agent.clone());
11831
11832 if let Some(token) = token.as_ref() {
11833 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11834 }
11835
11836 let request = req_builder
11837 .header(CONTENT_LENGTH, 0_u64)
11838 .body(common::to_body::<String>(None));
11839
11840 client.request(request.unwrap()).await
11841 };
11842
11843 match req_result {
11844 Err(err) => {
11845 if let common::Retry::After(d) = dlg.http_error(&err) {
11846 sleep(d).await;
11847 continue;
11848 }
11849 dlg.finished(false);
11850 return Err(common::Error::HttpError(err));
11851 }
11852 Ok(res) => {
11853 let (mut parts, body) = res.into_parts();
11854 let mut body = common::Body::new(body);
11855 if !parts.status.is_success() {
11856 let bytes = common::to_bytes(body).await.unwrap_or_default();
11857 let error = serde_json::from_str(&common::to_string(&bytes));
11858 let response = common::to_response(parts, bytes.into());
11859
11860 if let common::Retry::After(d) =
11861 dlg.http_failure(&response, error.as_ref().ok())
11862 {
11863 sleep(d).await;
11864 continue;
11865 }
11866
11867 dlg.finished(false);
11868
11869 return Err(match error {
11870 Ok(value) => common::Error::BadRequest(value),
11871 _ => common::Error::Failure(response),
11872 });
11873 }
11874 let response = {
11875 let bytes = common::to_bytes(body).await.unwrap_or_default();
11876 let encoded = common::to_string(&bytes);
11877 match serde_json::from_str(&encoded) {
11878 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11879 Err(error) => {
11880 dlg.response_json_decode_error(&encoded, &error);
11881 return Err(common::Error::JsonDecodeError(
11882 encoded.to_string(),
11883 error,
11884 ));
11885 }
11886 }
11887 };
11888
11889 dlg.finished(true);
11890 return Ok(response);
11891 }
11892 }
11893 }
11894 }
11895
11896 /// 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.
11897 ///
11898 /// Sets the *resource* path property to the given value.
11899 ///
11900 /// Even though the property as already been set when instantiating this call,
11901 /// we provide this method for API completeness.
11902 pub fn resource(mut self, new_value: &str) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C> {
11903 self._resource = new_value.to_string();
11904 self
11905 }
11906 /// 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).
11907 ///
11908 /// Sets the *options.requested policy version* query property to the given value.
11909 pub fn options_requested_policy_version(
11910 mut self,
11911 new_value: i32,
11912 ) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C> {
11913 self._options_requested_policy_version = Some(new_value);
11914 self
11915 }
11916 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11917 /// while executing the actual API request.
11918 ///
11919 /// ````text
11920 /// It should be used to handle progress information, and to implement a certain level of resilience.
11921 /// ````
11922 ///
11923 /// Sets the *delegate* property to the given value.
11924 pub fn delegate(
11925 mut self,
11926 new_value: &'a mut dyn common::Delegate,
11927 ) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C> {
11928 self._delegate = Some(new_value);
11929 self
11930 }
11931
11932 /// Set any additional parameter of the query string used in the request.
11933 /// It should be used to set parameters which are not yet available through their own
11934 /// setters.
11935 ///
11936 /// Please note that this method must not be used to set any of the known parameters
11937 /// which have their own setter method. If done anyway, the request will fail.
11938 ///
11939 /// # Additional Parameters
11940 ///
11941 /// * *$.xgafv* (query-string) - V1 error format.
11942 /// * *access_token* (query-string) - OAuth access token.
11943 /// * *alt* (query-string) - Data format for response.
11944 /// * *callback* (query-string) - JSONP
11945 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11946 /// * *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.
11947 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11948 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11949 /// * *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.
11950 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11951 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11952 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C>
11953 where
11954 T: AsRef<str>,
11955 {
11956 self._additional_params
11957 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11958 self
11959 }
11960
11961 /// Identifies the authorization scope for the method you are building.
11962 ///
11963 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11964 /// [`Scope::CloudPlatform`].
11965 ///
11966 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11967 /// tokens for more than one scope.
11968 ///
11969 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11970 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11971 /// sufficient, a read-write scope will do as well.
11972 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C>
11973 where
11974 St: AsRef<str>,
11975 {
11976 self._scopes.insert(String::from(scope.as_ref()));
11977 self
11978 }
11979 /// Identifies the authorization scope(s) for the method you are building.
11980 ///
11981 /// See [`Self::add_scope()`] for details.
11982 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C>
11983 where
11984 I: IntoIterator<Item = St>,
11985 St: AsRef<str>,
11986 {
11987 self._scopes
11988 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11989 self
11990 }
11991
11992 /// Removes all scopes, and no default scope will be used either.
11993 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11994 /// for details).
11995 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolGetIamPolicyCall<'a, C> {
11996 self._scopes.clear();
11997 self
11998 }
11999}
12000
12001/// Lists CaPools.
12002///
12003/// A builder for the *locations.caPools.list* method supported by a *project* resource.
12004/// It is not used directly, but through a [`ProjectMethods`] instance.
12005///
12006/// # Example
12007///
12008/// Instantiate a resource method builder
12009///
12010/// ```test_harness,no_run
12011/// # extern crate hyper;
12012/// # extern crate hyper_rustls;
12013/// # extern crate google_privateca1 as privateca1;
12014/// # async fn dox() {
12015/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12016///
12017/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12018/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12019/// # .with_native_roots()
12020/// # .unwrap()
12021/// # .https_only()
12022/// # .enable_http2()
12023/// # .build();
12024///
12025/// # let executor = hyper_util::rt::TokioExecutor::new();
12026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12027/// # secret,
12028/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12029/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12030/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12031/// # ),
12032/// # ).build().await.unwrap();
12033///
12034/// # let client = hyper_util::client::legacy::Client::builder(
12035/// # hyper_util::rt::TokioExecutor::new()
12036/// # )
12037/// # .build(
12038/// # hyper_rustls::HttpsConnectorBuilder::new()
12039/// # .with_native_roots()
12040/// # .unwrap()
12041/// # .https_or_http()
12042/// # .enable_http2()
12043/// # .build()
12044/// # );
12045/// # let mut hub = CertificateAuthorityService::new(client, auth);
12046/// // You can configure optional parameters by calling the respective setters at will, and
12047/// // execute the final call using `doit()`.
12048/// // Values shown here are possibly random and not representative !
12049/// let result = hub.projects().locations_ca_pools_list("parent")
12050/// .page_token("dolores")
12051/// .page_size(-62)
12052/// .order_by("et")
12053/// .filter("accusam")
12054/// .doit().await;
12055/// # }
12056/// ```
12057pub struct ProjectLocationCaPoolListCall<'a, C>
12058where
12059 C: 'a,
12060{
12061 hub: &'a CertificateAuthorityService<C>,
12062 _parent: String,
12063 _page_token: Option<String>,
12064 _page_size: Option<i32>,
12065 _order_by: Option<String>,
12066 _filter: Option<String>,
12067 _delegate: Option<&'a mut dyn common::Delegate>,
12068 _additional_params: HashMap<String, String>,
12069 _scopes: BTreeSet<String>,
12070}
12071
12072impl<'a, C> common::CallBuilder for ProjectLocationCaPoolListCall<'a, C> {}
12073
12074impl<'a, C> ProjectLocationCaPoolListCall<'a, C>
12075where
12076 C: common::Connector,
12077{
12078 /// Perform the operation you have build so far.
12079 pub async fn doit(mut self) -> common::Result<(common::Response, ListCaPoolsResponse)> {
12080 use std::borrow::Cow;
12081 use std::io::{Read, Seek};
12082
12083 use common::{url::Params, ToParts};
12084 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12085
12086 let mut dd = common::DefaultDelegate;
12087 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12088 dlg.begin(common::MethodInfo {
12089 id: "privateca.projects.locations.caPools.list",
12090 http_method: hyper::Method::GET,
12091 });
12092
12093 for &field in [
12094 "alt",
12095 "parent",
12096 "pageToken",
12097 "pageSize",
12098 "orderBy",
12099 "filter",
12100 ]
12101 .iter()
12102 {
12103 if self._additional_params.contains_key(field) {
12104 dlg.finished(false);
12105 return Err(common::Error::FieldClash(field));
12106 }
12107 }
12108
12109 let mut params = Params::with_capacity(7 + self._additional_params.len());
12110 params.push("parent", self._parent);
12111 if let Some(value) = self._page_token.as_ref() {
12112 params.push("pageToken", value);
12113 }
12114 if let Some(value) = self._page_size.as_ref() {
12115 params.push("pageSize", value.to_string());
12116 }
12117 if let Some(value) = self._order_by.as_ref() {
12118 params.push("orderBy", value);
12119 }
12120 if let Some(value) = self._filter.as_ref() {
12121 params.push("filter", value);
12122 }
12123
12124 params.extend(self._additional_params.iter());
12125
12126 params.push("alt", "json");
12127 let mut url = self.hub._base_url.clone() + "v1/{+parent}/caPools";
12128 if self._scopes.is_empty() {
12129 self._scopes
12130 .insert(Scope::CloudPlatform.as_ref().to_string());
12131 }
12132
12133 #[allow(clippy::single_element_loop)]
12134 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12135 url = params.uri_replacement(url, param_name, find_this, true);
12136 }
12137 {
12138 let to_remove = ["parent"];
12139 params.remove_params(&to_remove);
12140 }
12141
12142 let url = params.parse_with_url(&url);
12143
12144 loop {
12145 let token = match self
12146 .hub
12147 .auth
12148 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12149 .await
12150 {
12151 Ok(token) => token,
12152 Err(e) => match dlg.token(e) {
12153 Ok(token) => token,
12154 Err(e) => {
12155 dlg.finished(false);
12156 return Err(common::Error::MissingToken(e));
12157 }
12158 },
12159 };
12160 let mut req_result = {
12161 let client = &self.hub.client;
12162 dlg.pre_request();
12163 let mut req_builder = hyper::Request::builder()
12164 .method(hyper::Method::GET)
12165 .uri(url.as_str())
12166 .header(USER_AGENT, self.hub._user_agent.clone());
12167
12168 if let Some(token) = token.as_ref() {
12169 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12170 }
12171
12172 let request = req_builder
12173 .header(CONTENT_LENGTH, 0_u64)
12174 .body(common::to_body::<String>(None));
12175
12176 client.request(request.unwrap()).await
12177 };
12178
12179 match req_result {
12180 Err(err) => {
12181 if let common::Retry::After(d) = dlg.http_error(&err) {
12182 sleep(d).await;
12183 continue;
12184 }
12185 dlg.finished(false);
12186 return Err(common::Error::HttpError(err));
12187 }
12188 Ok(res) => {
12189 let (mut parts, body) = res.into_parts();
12190 let mut body = common::Body::new(body);
12191 if !parts.status.is_success() {
12192 let bytes = common::to_bytes(body).await.unwrap_or_default();
12193 let error = serde_json::from_str(&common::to_string(&bytes));
12194 let response = common::to_response(parts, bytes.into());
12195
12196 if let common::Retry::After(d) =
12197 dlg.http_failure(&response, error.as_ref().ok())
12198 {
12199 sleep(d).await;
12200 continue;
12201 }
12202
12203 dlg.finished(false);
12204
12205 return Err(match error {
12206 Ok(value) => common::Error::BadRequest(value),
12207 _ => common::Error::Failure(response),
12208 });
12209 }
12210 let response = {
12211 let bytes = common::to_bytes(body).await.unwrap_or_default();
12212 let encoded = common::to_string(&bytes);
12213 match serde_json::from_str(&encoded) {
12214 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12215 Err(error) => {
12216 dlg.response_json_decode_error(&encoded, &error);
12217 return Err(common::Error::JsonDecodeError(
12218 encoded.to_string(),
12219 error,
12220 ));
12221 }
12222 }
12223 };
12224
12225 dlg.finished(true);
12226 return Ok(response);
12227 }
12228 }
12229 }
12230 }
12231
12232 /// Required. The resource name of the location associated with the CaPools, in the format `projects/*/locations/*`.
12233 ///
12234 /// Sets the *parent* path property to the given value.
12235 ///
12236 /// Even though the property as already been set when instantiating this call,
12237 /// we provide this method for API completeness.
12238 pub fn parent(mut self, new_value: &str) -> ProjectLocationCaPoolListCall<'a, C> {
12239 self._parent = new_value.to_string();
12240 self
12241 }
12242 /// Optional. Pagination token, returned earlier via ListCaPoolsResponse.next_page_token.
12243 ///
12244 /// Sets the *page token* query property to the given value.
12245 pub fn page_token(mut self, new_value: &str) -> ProjectLocationCaPoolListCall<'a, C> {
12246 self._page_token = Some(new_value.to_string());
12247 self
12248 }
12249 /// Optional. Limit on the number of CaPools to include in the response. Further CaPools can subsequently be obtained by including the ListCaPoolsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
12250 ///
12251 /// Sets the *page size* query property to the given value.
12252 pub fn page_size(mut self, new_value: i32) -> ProjectLocationCaPoolListCall<'a, C> {
12253 self._page_size = Some(new_value);
12254 self
12255 }
12256 /// Optional. Specify how the results should be sorted.
12257 ///
12258 /// Sets the *order by* query property to the given value.
12259 pub fn order_by(mut self, new_value: &str) -> ProjectLocationCaPoolListCall<'a, C> {
12260 self._order_by = Some(new_value.to_string());
12261 self
12262 }
12263 /// Optional. Only include resources that match the filter in the response.
12264 ///
12265 /// Sets the *filter* query property to the given value.
12266 pub fn filter(mut self, new_value: &str) -> ProjectLocationCaPoolListCall<'a, C> {
12267 self._filter = Some(new_value.to_string());
12268 self
12269 }
12270 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12271 /// while executing the actual API request.
12272 ///
12273 /// ````text
12274 /// It should be used to handle progress information, and to implement a certain level of resilience.
12275 /// ````
12276 ///
12277 /// Sets the *delegate* property to the given value.
12278 pub fn delegate(
12279 mut self,
12280 new_value: &'a mut dyn common::Delegate,
12281 ) -> ProjectLocationCaPoolListCall<'a, C> {
12282 self._delegate = Some(new_value);
12283 self
12284 }
12285
12286 /// Set any additional parameter of the query string used in the request.
12287 /// It should be used to set parameters which are not yet available through their own
12288 /// setters.
12289 ///
12290 /// Please note that this method must not be used to set any of the known parameters
12291 /// which have their own setter method. If done anyway, the request will fail.
12292 ///
12293 /// # Additional Parameters
12294 ///
12295 /// * *$.xgafv* (query-string) - V1 error format.
12296 /// * *access_token* (query-string) - OAuth access token.
12297 /// * *alt* (query-string) - Data format for response.
12298 /// * *callback* (query-string) - JSONP
12299 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12300 /// * *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.
12301 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12302 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12303 /// * *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.
12304 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12305 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12306 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolListCall<'a, C>
12307 where
12308 T: AsRef<str>,
12309 {
12310 self._additional_params
12311 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12312 self
12313 }
12314
12315 /// Identifies the authorization scope for the method you are building.
12316 ///
12317 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12318 /// [`Scope::CloudPlatform`].
12319 ///
12320 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12321 /// tokens for more than one scope.
12322 ///
12323 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12324 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12325 /// sufficient, a read-write scope will do as well.
12326 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolListCall<'a, C>
12327 where
12328 St: AsRef<str>,
12329 {
12330 self._scopes.insert(String::from(scope.as_ref()));
12331 self
12332 }
12333 /// Identifies the authorization scope(s) for the method you are building.
12334 ///
12335 /// See [`Self::add_scope()`] for details.
12336 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolListCall<'a, C>
12337 where
12338 I: IntoIterator<Item = St>,
12339 St: AsRef<str>,
12340 {
12341 self._scopes
12342 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12343 self
12344 }
12345
12346 /// Removes all scopes, and no default scope will be used either.
12347 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12348 /// for details).
12349 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolListCall<'a, C> {
12350 self._scopes.clear();
12351 self
12352 }
12353}
12354
12355/// Update a CaPool.
12356///
12357/// A builder for the *locations.caPools.patch* method supported by a *project* resource.
12358/// It is not used directly, but through a [`ProjectMethods`] instance.
12359///
12360/// # Example
12361///
12362/// Instantiate a resource method builder
12363///
12364/// ```test_harness,no_run
12365/// # extern crate hyper;
12366/// # extern crate hyper_rustls;
12367/// # extern crate google_privateca1 as privateca1;
12368/// use privateca1::api::CaPool;
12369/// # async fn dox() {
12370/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12371///
12372/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12373/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12374/// # .with_native_roots()
12375/// # .unwrap()
12376/// # .https_only()
12377/// # .enable_http2()
12378/// # .build();
12379///
12380/// # let executor = hyper_util::rt::TokioExecutor::new();
12381/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12382/// # secret,
12383/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12384/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12385/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12386/// # ),
12387/// # ).build().await.unwrap();
12388///
12389/// # let client = hyper_util::client::legacy::Client::builder(
12390/// # hyper_util::rt::TokioExecutor::new()
12391/// # )
12392/// # .build(
12393/// # hyper_rustls::HttpsConnectorBuilder::new()
12394/// # .with_native_roots()
12395/// # .unwrap()
12396/// # .https_or_http()
12397/// # .enable_http2()
12398/// # .build()
12399/// # );
12400/// # let mut hub = CertificateAuthorityService::new(client, auth);
12401/// // As the method needs a request, you would usually fill it with the desired information
12402/// // into the respective structure. Some of the parts shown here might not be applicable !
12403/// // Values shown here are possibly random and not representative !
12404/// let mut req = CaPool::default();
12405///
12406/// // You can configure optional parameters by calling the respective setters at will, and
12407/// // execute the final call using `doit()`.
12408/// // Values shown here are possibly random and not representative !
12409/// let result = hub.projects().locations_ca_pools_patch(req, "name")
12410/// .update_mask(FieldMask::new::<&str>(&[]))
12411/// .request_id("dolore")
12412/// .doit().await;
12413/// # }
12414/// ```
12415pub struct ProjectLocationCaPoolPatchCall<'a, C>
12416where
12417 C: 'a,
12418{
12419 hub: &'a CertificateAuthorityService<C>,
12420 _request: CaPool,
12421 _name: String,
12422 _update_mask: Option<common::FieldMask>,
12423 _request_id: Option<String>,
12424 _delegate: Option<&'a mut dyn common::Delegate>,
12425 _additional_params: HashMap<String, String>,
12426 _scopes: BTreeSet<String>,
12427}
12428
12429impl<'a, C> common::CallBuilder for ProjectLocationCaPoolPatchCall<'a, C> {}
12430
12431impl<'a, C> ProjectLocationCaPoolPatchCall<'a, C>
12432where
12433 C: common::Connector,
12434{
12435 /// Perform the operation you have build so far.
12436 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12437 use std::borrow::Cow;
12438 use std::io::{Read, Seek};
12439
12440 use common::{url::Params, ToParts};
12441 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12442
12443 let mut dd = common::DefaultDelegate;
12444 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12445 dlg.begin(common::MethodInfo {
12446 id: "privateca.projects.locations.caPools.patch",
12447 http_method: hyper::Method::PATCH,
12448 });
12449
12450 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
12451 if self._additional_params.contains_key(field) {
12452 dlg.finished(false);
12453 return Err(common::Error::FieldClash(field));
12454 }
12455 }
12456
12457 let mut params = Params::with_capacity(6 + self._additional_params.len());
12458 params.push("name", self._name);
12459 if let Some(value) = self._update_mask.as_ref() {
12460 params.push("updateMask", value.to_string());
12461 }
12462 if let Some(value) = self._request_id.as_ref() {
12463 params.push("requestId", value);
12464 }
12465
12466 params.extend(self._additional_params.iter());
12467
12468 params.push("alt", "json");
12469 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12470 if self._scopes.is_empty() {
12471 self._scopes
12472 .insert(Scope::CloudPlatform.as_ref().to_string());
12473 }
12474
12475 #[allow(clippy::single_element_loop)]
12476 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12477 url = params.uri_replacement(url, param_name, find_this, true);
12478 }
12479 {
12480 let to_remove = ["name"];
12481 params.remove_params(&to_remove);
12482 }
12483
12484 let url = params.parse_with_url(&url);
12485
12486 let mut json_mime_type = mime::APPLICATION_JSON;
12487 let mut request_value_reader = {
12488 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12489 common::remove_json_null_values(&mut value);
12490 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12491 serde_json::to_writer(&mut dst, &value).unwrap();
12492 dst
12493 };
12494 let request_size = request_value_reader
12495 .seek(std::io::SeekFrom::End(0))
12496 .unwrap();
12497 request_value_reader
12498 .seek(std::io::SeekFrom::Start(0))
12499 .unwrap();
12500
12501 loop {
12502 let token = match self
12503 .hub
12504 .auth
12505 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12506 .await
12507 {
12508 Ok(token) => token,
12509 Err(e) => match dlg.token(e) {
12510 Ok(token) => token,
12511 Err(e) => {
12512 dlg.finished(false);
12513 return Err(common::Error::MissingToken(e));
12514 }
12515 },
12516 };
12517 request_value_reader
12518 .seek(std::io::SeekFrom::Start(0))
12519 .unwrap();
12520 let mut req_result = {
12521 let client = &self.hub.client;
12522 dlg.pre_request();
12523 let mut req_builder = hyper::Request::builder()
12524 .method(hyper::Method::PATCH)
12525 .uri(url.as_str())
12526 .header(USER_AGENT, self.hub._user_agent.clone());
12527
12528 if let Some(token) = token.as_ref() {
12529 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12530 }
12531
12532 let request = req_builder
12533 .header(CONTENT_TYPE, json_mime_type.to_string())
12534 .header(CONTENT_LENGTH, request_size as u64)
12535 .body(common::to_body(
12536 request_value_reader.get_ref().clone().into(),
12537 ));
12538
12539 client.request(request.unwrap()).await
12540 };
12541
12542 match req_result {
12543 Err(err) => {
12544 if let common::Retry::After(d) = dlg.http_error(&err) {
12545 sleep(d).await;
12546 continue;
12547 }
12548 dlg.finished(false);
12549 return Err(common::Error::HttpError(err));
12550 }
12551 Ok(res) => {
12552 let (mut parts, body) = res.into_parts();
12553 let mut body = common::Body::new(body);
12554 if !parts.status.is_success() {
12555 let bytes = common::to_bytes(body).await.unwrap_or_default();
12556 let error = serde_json::from_str(&common::to_string(&bytes));
12557 let response = common::to_response(parts, bytes.into());
12558
12559 if let common::Retry::After(d) =
12560 dlg.http_failure(&response, error.as_ref().ok())
12561 {
12562 sleep(d).await;
12563 continue;
12564 }
12565
12566 dlg.finished(false);
12567
12568 return Err(match error {
12569 Ok(value) => common::Error::BadRequest(value),
12570 _ => common::Error::Failure(response),
12571 });
12572 }
12573 let response = {
12574 let bytes = common::to_bytes(body).await.unwrap_or_default();
12575 let encoded = common::to_string(&bytes);
12576 match serde_json::from_str(&encoded) {
12577 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12578 Err(error) => {
12579 dlg.response_json_decode_error(&encoded, &error);
12580 return Err(common::Error::JsonDecodeError(
12581 encoded.to_string(),
12582 error,
12583 ));
12584 }
12585 }
12586 };
12587
12588 dlg.finished(true);
12589 return Ok(response);
12590 }
12591 }
12592 }
12593 }
12594
12595 ///
12596 /// Sets the *request* property to the given value.
12597 ///
12598 /// Even though the property as already been set when instantiating this call,
12599 /// we provide this method for API completeness.
12600 pub fn request(mut self, new_value: CaPool) -> ProjectLocationCaPoolPatchCall<'a, C> {
12601 self._request = new_value;
12602 self
12603 }
12604 /// Identifier. The resource name for this CaPool in the format `projects/*/locations/*/caPools/*`.
12605 ///
12606 /// Sets the *name* path property to the given value.
12607 ///
12608 /// Even though the property as already been set when instantiating this call,
12609 /// we provide this method for API completeness.
12610 pub fn name(mut self, new_value: &str) -> ProjectLocationCaPoolPatchCall<'a, C> {
12611 self._name = new_value.to_string();
12612 self
12613 }
12614 /// Required. A list of fields to be updated in this request.
12615 ///
12616 /// Sets the *update mask* query property to the given value.
12617 pub fn update_mask(
12618 mut self,
12619 new_value: common::FieldMask,
12620 ) -> ProjectLocationCaPoolPatchCall<'a, C> {
12621 self._update_mask = Some(new_value);
12622 self
12623 }
12624 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
12625 ///
12626 /// Sets the *request id* query property to the given value.
12627 pub fn request_id(mut self, new_value: &str) -> ProjectLocationCaPoolPatchCall<'a, C> {
12628 self._request_id = Some(new_value.to_string());
12629 self
12630 }
12631 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12632 /// while executing the actual API request.
12633 ///
12634 /// ````text
12635 /// It should be used to handle progress information, and to implement a certain level of resilience.
12636 /// ````
12637 ///
12638 /// Sets the *delegate* property to the given value.
12639 pub fn delegate(
12640 mut self,
12641 new_value: &'a mut dyn common::Delegate,
12642 ) -> ProjectLocationCaPoolPatchCall<'a, C> {
12643 self._delegate = Some(new_value);
12644 self
12645 }
12646
12647 /// Set any additional parameter of the query string used in the request.
12648 /// It should be used to set parameters which are not yet available through their own
12649 /// setters.
12650 ///
12651 /// Please note that this method must not be used to set any of the known parameters
12652 /// which have their own setter method. If done anyway, the request will fail.
12653 ///
12654 /// # Additional Parameters
12655 ///
12656 /// * *$.xgafv* (query-string) - V1 error format.
12657 /// * *access_token* (query-string) - OAuth access token.
12658 /// * *alt* (query-string) - Data format for response.
12659 /// * *callback* (query-string) - JSONP
12660 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12661 /// * *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.
12662 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12663 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12664 /// * *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.
12665 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12666 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12667 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolPatchCall<'a, C>
12668 where
12669 T: AsRef<str>,
12670 {
12671 self._additional_params
12672 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12673 self
12674 }
12675
12676 /// Identifies the authorization scope for the method you are building.
12677 ///
12678 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12679 /// [`Scope::CloudPlatform`].
12680 ///
12681 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12682 /// tokens for more than one scope.
12683 ///
12684 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12685 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12686 /// sufficient, a read-write scope will do as well.
12687 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolPatchCall<'a, C>
12688 where
12689 St: AsRef<str>,
12690 {
12691 self._scopes.insert(String::from(scope.as_ref()));
12692 self
12693 }
12694 /// Identifies the authorization scope(s) for the method you are building.
12695 ///
12696 /// See [`Self::add_scope()`] for details.
12697 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolPatchCall<'a, C>
12698 where
12699 I: IntoIterator<Item = St>,
12700 St: AsRef<str>,
12701 {
12702 self._scopes
12703 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12704 self
12705 }
12706
12707 /// Removes all scopes, and no default scope will be used either.
12708 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12709 /// for details).
12710 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolPatchCall<'a, C> {
12711 self._scopes.clear();
12712 self
12713 }
12714}
12715
12716/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
12717///
12718/// A builder for the *locations.caPools.setIamPolicy* method supported by a *project* resource.
12719/// It is not used directly, but through a [`ProjectMethods`] instance.
12720///
12721/// # Example
12722///
12723/// Instantiate a resource method builder
12724///
12725/// ```test_harness,no_run
12726/// # extern crate hyper;
12727/// # extern crate hyper_rustls;
12728/// # extern crate google_privateca1 as privateca1;
12729/// use privateca1::api::SetIamPolicyRequest;
12730/// # async fn dox() {
12731/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12732///
12733/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12734/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12735/// # .with_native_roots()
12736/// # .unwrap()
12737/// # .https_only()
12738/// # .enable_http2()
12739/// # .build();
12740///
12741/// # let executor = hyper_util::rt::TokioExecutor::new();
12742/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12743/// # secret,
12744/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12745/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12746/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12747/// # ),
12748/// # ).build().await.unwrap();
12749///
12750/// # let client = hyper_util::client::legacy::Client::builder(
12751/// # hyper_util::rt::TokioExecutor::new()
12752/// # )
12753/// # .build(
12754/// # hyper_rustls::HttpsConnectorBuilder::new()
12755/// # .with_native_roots()
12756/// # .unwrap()
12757/// # .https_or_http()
12758/// # .enable_http2()
12759/// # .build()
12760/// # );
12761/// # let mut hub = CertificateAuthorityService::new(client, auth);
12762/// // As the method needs a request, you would usually fill it with the desired information
12763/// // into the respective structure. Some of the parts shown here might not be applicable !
12764/// // Values shown here are possibly random and not representative !
12765/// let mut req = SetIamPolicyRequest::default();
12766///
12767/// // You can configure optional parameters by calling the respective setters at will, and
12768/// // execute the final call using `doit()`.
12769/// // Values shown here are possibly random and not representative !
12770/// let result = hub.projects().locations_ca_pools_set_iam_policy(req, "resource")
12771/// .doit().await;
12772/// # }
12773/// ```
12774pub struct ProjectLocationCaPoolSetIamPolicyCall<'a, C>
12775where
12776 C: 'a,
12777{
12778 hub: &'a CertificateAuthorityService<C>,
12779 _request: SetIamPolicyRequest,
12780 _resource: String,
12781 _delegate: Option<&'a mut dyn common::Delegate>,
12782 _additional_params: HashMap<String, String>,
12783 _scopes: BTreeSet<String>,
12784}
12785
12786impl<'a, C> common::CallBuilder for ProjectLocationCaPoolSetIamPolicyCall<'a, C> {}
12787
12788impl<'a, C> ProjectLocationCaPoolSetIamPolicyCall<'a, C>
12789where
12790 C: common::Connector,
12791{
12792 /// Perform the operation you have build so far.
12793 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12794 use std::borrow::Cow;
12795 use std::io::{Read, Seek};
12796
12797 use common::{url::Params, ToParts};
12798 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12799
12800 let mut dd = common::DefaultDelegate;
12801 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12802 dlg.begin(common::MethodInfo {
12803 id: "privateca.projects.locations.caPools.setIamPolicy",
12804 http_method: hyper::Method::POST,
12805 });
12806
12807 for &field in ["alt", "resource"].iter() {
12808 if self._additional_params.contains_key(field) {
12809 dlg.finished(false);
12810 return Err(common::Error::FieldClash(field));
12811 }
12812 }
12813
12814 let mut params = Params::with_capacity(4 + self._additional_params.len());
12815 params.push("resource", self._resource);
12816
12817 params.extend(self._additional_params.iter());
12818
12819 params.push("alt", "json");
12820 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
12821 if self._scopes.is_empty() {
12822 self._scopes
12823 .insert(Scope::CloudPlatform.as_ref().to_string());
12824 }
12825
12826 #[allow(clippy::single_element_loop)]
12827 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12828 url = params.uri_replacement(url, param_name, find_this, true);
12829 }
12830 {
12831 let to_remove = ["resource"];
12832 params.remove_params(&to_remove);
12833 }
12834
12835 let url = params.parse_with_url(&url);
12836
12837 let mut json_mime_type = mime::APPLICATION_JSON;
12838 let mut request_value_reader = {
12839 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12840 common::remove_json_null_values(&mut value);
12841 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12842 serde_json::to_writer(&mut dst, &value).unwrap();
12843 dst
12844 };
12845 let request_size = request_value_reader
12846 .seek(std::io::SeekFrom::End(0))
12847 .unwrap();
12848 request_value_reader
12849 .seek(std::io::SeekFrom::Start(0))
12850 .unwrap();
12851
12852 loop {
12853 let token = match self
12854 .hub
12855 .auth
12856 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12857 .await
12858 {
12859 Ok(token) => token,
12860 Err(e) => match dlg.token(e) {
12861 Ok(token) => token,
12862 Err(e) => {
12863 dlg.finished(false);
12864 return Err(common::Error::MissingToken(e));
12865 }
12866 },
12867 };
12868 request_value_reader
12869 .seek(std::io::SeekFrom::Start(0))
12870 .unwrap();
12871 let mut req_result = {
12872 let client = &self.hub.client;
12873 dlg.pre_request();
12874 let mut req_builder = hyper::Request::builder()
12875 .method(hyper::Method::POST)
12876 .uri(url.as_str())
12877 .header(USER_AGENT, self.hub._user_agent.clone());
12878
12879 if let Some(token) = token.as_ref() {
12880 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12881 }
12882
12883 let request = req_builder
12884 .header(CONTENT_TYPE, json_mime_type.to_string())
12885 .header(CONTENT_LENGTH, request_size as u64)
12886 .body(common::to_body(
12887 request_value_reader.get_ref().clone().into(),
12888 ));
12889
12890 client.request(request.unwrap()).await
12891 };
12892
12893 match req_result {
12894 Err(err) => {
12895 if let common::Retry::After(d) = dlg.http_error(&err) {
12896 sleep(d).await;
12897 continue;
12898 }
12899 dlg.finished(false);
12900 return Err(common::Error::HttpError(err));
12901 }
12902 Ok(res) => {
12903 let (mut parts, body) = res.into_parts();
12904 let mut body = common::Body::new(body);
12905 if !parts.status.is_success() {
12906 let bytes = common::to_bytes(body).await.unwrap_or_default();
12907 let error = serde_json::from_str(&common::to_string(&bytes));
12908 let response = common::to_response(parts, bytes.into());
12909
12910 if let common::Retry::After(d) =
12911 dlg.http_failure(&response, error.as_ref().ok())
12912 {
12913 sleep(d).await;
12914 continue;
12915 }
12916
12917 dlg.finished(false);
12918
12919 return Err(match error {
12920 Ok(value) => common::Error::BadRequest(value),
12921 _ => common::Error::Failure(response),
12922 });
12923 }
12924 let response = {
12925 let bytes = common::to_bytes(body).await.unwrap_or_default();
12926 let encoded = common::to_string(&bytes);
12927 match serde_json::from_str(&encoded) {
12928 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12929 Err(error) => {
12930 dlg.response_json_decode_error(&encoded, &error);
12931 return Err(common::Error::JsonDecodeError(
12932 encoded.to_string(),
12933 error,
12934 ));
12935 }
12936 }
12937 };
12938
12939 dlg.finished(true);
12940 return Ok(response);
12941 }
12942 }
12943 }
12944 }
12945
12946 ///
12947 /// Sets the *request* property to the given value.
12948 ///
12949 /// Even though the property as already been set when instantiating this call,
12950 /// we provide this method for API completeness.
12951 pub fn request(
12952 mut self,
12953 new_value: SetIamPolicyRequest,
12954 ) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C> {
12955 self._request = new_value;
12956 self
12957 }
12958 /// 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.
12959 ///
12960 /// Sets the *resource* path property to the given value.
12961 ///
12962 /// Even though the property as already been set when instantiating this call,
12963 /// we provide this method for API completeness.
12964 pub fn resource(mut self, new_value: &str) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C> {
12965 self._resource = new_value.to_string();
12966 self
12967 }
12968 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12969 /// while executing the actual API request.
12970 ///
12971 /// ````text
12972 /// It should be used to handle progress information, and to implement a certain level of resilience.
12973 /// ````
12974 ///
12975 /// Sets the *delegate* property to the given value.
12976 pub fn delegate(
12977 mut self,
12978 new_value: &'a mut dyn common::Delegate,
12979 ) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C> {
12980 self._delegate = Some(new_value);
12981 self
12982 }
12983
12984 /// Set any additional parameter of the query string used in the request.
12985 /// It should be used to set parameters which are not yet available through their own
12986 /// setters.
12987 ///
12988 /// Please note that this method must not be used to set any of the known parameters
12989 /// which have their own setter method. If done anyway, the request will fail.
12990 ///
12991 /// # Additional Parameters
12992 ///
12993 /// * *$.xgafv* (query-string) - V1 error format.
12994 /// * *access_token* (query-string) - OAuth access token.
12995 /// * *alt* (query-string) - Data format for response.
12996 /// * *callback* (query-string) - JSONP
12997 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12998 /// * *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.
12999 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13000 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13001 /// * *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.
13002 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13003 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13004 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C>
13005 where
13006 T: AsRef<str>,
13007 {
13008 self._additional_params
13009 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13010 self
13011 }
13012
13013 /// Identifies the authorization scope for the method you are building.
13014 ///
13015 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13016 /// [`Scope::CloudPlatform`].
13017 ///
13018 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13019 /// tokens for more than one scope.
13020 ///
13021 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13022 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13023 /// sufficient, a read-write scope will do as well.
13024 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C>
13025 where
13026 St: AsRef<str>,
13027 {
13028 self._scopes.insert(String::from(scope.as_ref()));
13029 self
13030 }
13031 /// Identifies the authorization scope(s) for the method you are building.
13032 ///
13033 /// See [`Self::add_scope()`] for details.
13034 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C>
13035 where
13036 I: IntoIterator<Item = St>,
13037 St: AsRef<str>,
13038 {
13039 self._scopes
13040 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13041 self
13042 }
13043
13044 /// Removes all scopes, and no default scope will be used either.
13045 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13046 /// for details).
13047 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolSetIamPolicyCall<'a, C> {
13048 self._scopes.clear();
13049 self
13050 }
13051}
13052
13053/// 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.
13054///
13055/// A builder for the *locations.caPools.testIamPermissions* method supported by a *project* resource.
13056/// It is not used directly, but through a [`ProjectMethods`] instance.
13057///
13058/// # Example
13059///
13060/// Instantiate a resource method builder
13061///
13062/// ```test_harness,no_run
13063/// # extern crate hyper;
13064/// # extern crate hyper_rustls;
13065/// # extern crate google_privateca1 as privateca1;
13066/// use privateca1::api::TestIamPermissionsRequest;
13067/// # async fn dox() {
13068/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13069///
13070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13071/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13072/// # .with_native_roots()
13073/// # .unwrap()
13074/// # .https_only()
13075/// # .enable_http2()
13076/// # .build();
13077///
13078/// # let executor = hyper_util::rt::TokioExecutor::new();
13079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13080/// # secret,
13081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13082/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13083/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13084/// # ),
13085/// # ).build().await.unwrap();
13086///
13087/// # let client = hyper_util::client::legacy::Client::builder(
13088/// # hyper_util::rt::TokioExecutor::new()
13089/// # )
13090/// # .build(
13091/// # hyper_rustls::HttpsConnectorBuilder::new()
13092/// # .with_native_roots()
13093/// # .unwrap()
13094/// # .https_or_http()
13095/// # .enable_http2()
13096/// # .build()
13097/// # );
13098/// # let mut hub = CertificateAuthorityService::new(client, auth);
13099/// // As the method needs a request, you would usually fill it with the desired information
13100/// // into the respective structure. Some of the parts shown here might not be applicable !
13101/// // Values shown here are possibly random and not representative !
13102/// let mut req = TestIamPermissionsRequest::default();
13103///
13104/// // You can configure optional parameters by calling the respective setters at will, and
13105/// // execute the final call using `doit()`.
13106/// // Values shown here are possibly random and not representative !
13107/// let result = hub.projects().locations_ca_pools_test_iam_permissions(req, "resource")
13108/// .doit().await;
13109/// # }
13110/// ```
13111pub struct ProjectLocationCaPoolTestIamPermissionCall<'a, C>
13112where
13113 C: 'a,
13114{
13115 hub: &'a CertificateAuthorityService<C>,
13116 _request: TestIamPermissionsRequest,
13117 _resource: String,
13118 _delegate: Option<&'a mut dyn common::Delegate>,
13119 _additional_params: HashMap<String, String>,
13120 _scopes: BTreeSet<String>,
13121}
13122
13123impl<'a, C> common::CallBuilder for ProjectLocationCaPoolTestIamPermissionCall<'a, C> {}
13124
13125impl<'a, C> ProjectLocationCaPoolTestIamPermissionCall<'a, C>
13126where
13127 C: common::Connector,
13128{
13129 /// Perform the operation you have build so far.
13130 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
13131 use std::borrow::Cow;
13132 use std::io::{Read, Seek};
13133
13134 use common::{url::Params, ToParts};
13135 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13136
13137 let mut dd = common::DefaultDelegate;
13138 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13139 dlg.begin(common::MethodInfo {
13140 id: "privateca.projects.locations.caPools.testIamPermissions",
13141 http_method: hyper::Method::POST,
13142 });
13143
13144 for &field in ["alt", "resource"].iter() {
13145 if self._additional_params.contains_key(field) {
13146 dlg.finished(false);
13147 return Err(common::Error::FieldClash(field));
13148 }
13149 }
13150
13151 let mut params = Params::with_capacity(4 + self._additional_params.len());
13152 params.push("resource", self._resource);
13153
13154 params.extend(self._additional_params.iter());
13155
13156 params.push("alt", "json");
13157 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
13158 if self._scopes.is_empty() {
13159 self._scopes
13160 .insert(Scope::CloudPlatform.as_ref().to_string());
13161 }
13162
13163 #[allow(clippy::single_element_loop)]
13164 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13165 url = params.uri_replacement(url, param_name, find_this, true);
13166 }
13167 {
13168 let to_remove = ["resource"];
13169 params.remove_params(&to_remove);
13170 }
13171
13172 let url = params.parse_with_url(&url);
13173
13174 let mut json_mime_type = mime::APPLICATION_JSON;
13175 let mut request_value_reader = {
13176 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13177 common::remove_json_null_values(&mut value);
13178 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13179 serde_json::to_writer(&mut dst, &value).unwrap();
13180 dst
13181 };
13182 let request_size = request_value_reader
13183 .seek(std::io::SeekFrom::End(0))
13184 .unwrap();
13185 request_value_reader
13186 .seek(std::io::SeekFrom::Start(0))
13187 .unwrap();
13188
13189 loop {
13190 let token = match self
13191 .hub
13192 .auth
13193 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13194 .await
13195 {
13196 Ok(token) => token,
13197 Err(e) => match dlg.token(e) {
13198 Ok(token) => token,
13199 Err(e) => {
13200 dlg.finished(false);
13201 return Err(common::Error::MissingToken(e));
13202 }
13203 },
13204 };
13205 request_value_reader
13206 .seek(std::io::SeekFrom::Start(0))
13207 .unwrap();
13208 let mut req_result = {
13209 let client = &self.hub.client;
13210 dlg.pre_request();
13211 let mut req_builder = hyper::Request::builder()
13212 .method(hyper::Method::POST)
13213 .uri(url.as_str())
13214 .header(USER_AGENT, self.hub._user_agent.clone());
13215
13216 if let Some(token) = token.as_ref() {
13217 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13218 }
13219
13220 let request = req_builder
13221 .header(CONTENT_TYPE, json_mime_type.to_string())
13222 .header(CONTENT_LENGTH, request_size as u64)
13223 .body(common::to_body(
13224 request_value_reader.get_ref().clone().into(),
13225 ));
13226
13227 client.request(request.unwrap()).await
13228 };
13229
13230 match req_result {
13231 Err(err) => {
13232 if let common::Retry::After(d) = dlg.http_error(&err) {
13233 sleep(d).await;
13234 continue;
13235 }
13236 dlg.finished(false);
13237 return Err(common::Error::HttpError(err));
13238 }
13239 Ok(res) => {
13240 let (mut parts, body) = res.into_parts();
13241 let mut body = common::Body::new(body);
13242 if !parts.status.is_success() {
13243 let bytes = common::to_bytes(body).await.unwrap_or_default();
13244 let error = serde_json::from_str(&common::to_string(&bytes));
13245 let response = common::to_response(parts, bytes.into());
13246
13247 if let common::Retry::After(d) =
13248 dlg.http_failure(&response, error.as_ref().ok())
13249 {
13250 sleep(d).await;
13251 continue;
13252 }
13253
13254 dlg.finished(false);
13255
13256 return Err(match error {
13257 Ok(value) => common::Error::BadRequest(value),
13258 _ => common::Error::Failure(response),
13259 });
13260 }
13261 let response = {
13262 let bytes = common::to_bytes(body).await.unwrap_or_default();
13263 let encoded = common::to_string(&bytes);
13264 match serde_json::from_str(&encoded) {
13265 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13266 Err(error) => {
13267 dlg.response_json_decode_error(&encoded, &error);
13268 return Err(common::Error::JsonDecodeError(
13269 encoded.to_string(),
13270 error,
13271 ));
13272 }
13273 }
13274 };
13275
13276 dlg.finished(true);
13277 return Ok(response);
13278 }
13279 }
13280 }
13281 }
13282
13283 ///
13284 /// Sets the *request* property to the given value.
13285 ///
13286 /// Even though the property as already been set when instantiating this call,
13287 /// we provide this method for API completeness.
13288 pub fn request(
13289 mut self,
13290 new_value: TestIamPermissionsRequest,
13291 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C> {
13292 self._request = new_value;
13293 self
13294 }
13295 /// 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.
13296 ///
13297 /// Sets the *resource* path property to the given value.
13298 ///
13299 /// Even though the property as already been set when instantiating this call,
13300 /// we provide this method for API completeness.
13301 pub fn resource(
13302 mut self,
13303 new_value: &str,
13304 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C> {
13305 self._resource = new_value.to_string();
13306 self
13307 }
13308 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13309 /// while executing the actual API request.
13310 ///
13311 /// ````text
13312 /// It should be used to handle progress information, and to implement a certain level of resilience.
13313 /// ````
13314 ///
13315 /// Sets the *delegate* property to the given value.
13316 pub fn delegate(
13317 mut self,
13318 new_value: &'a mut dyn common::Delegate,
13319 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C> {
13320 self._delegate = Some(new_value);
13321 self
13322 }
13323
13324 /// Set any additional parameter of the query string used in the request.
13325 /// It should be used to set parameters which are not yet available through their own
13326 /// setters.
13327 ///
13328 /// Please note that this method must not be used to set any of the known parameters
13329 /// which have their own setter method. If done anyway, the request will fail.
13330 ///
13331 /// # Additional Parameters
13332 ///
13333 /// * *$.xgafv* (query-string) - V1 error format.
13334 /// * *access_token* (query-string) - OAuth access token.
13335 /// * *alt* (query-string) - Data format for response.
13336 /// * *callback* (query-string) - JSONP
13337 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13338 /// * *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.
13339 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13340 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13341 /// * *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.
13342 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13343 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13344 pub fn param<T>(
13345 mut self,
13346 name: T,
13347 value: T,
13348 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C>
13349 where
13350 T: AsRef<str>,
13351 {
13352 self._additional_params
13353 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13354 self
13355 }
13356
13357 /// Identifies the authorization scope for the method you are building.
13358 ///
13359 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13360 /// [`Scope::CloudPlatform`].
13361 ///
13362 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13363 /// tokens for more than one scope.
13364 ///
13365 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13366 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13367 /// sufficient, a read-write scope will do as well.
13368 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C>
13369 where
13370 St: AsRef<str>,
13371 {
13372 self._scopes.insert(String::from(scope.as_ref()));
13373 self
13374 }
13375 /// Identifies the authorization scope(s) for the method you are building.
13376 ///
13377 /// See [`Self::add_scope()`] for details.
13378 pub fn add_scopes<I, St>(
13379 mut self,
13380 scopes: I,
13381 ) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C>
13382 where
13383 I: IntoIterator<Item = St>,
13384 St: AsRef<str>,
13385 {
13386 self._scopes
13387 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13388 self
13389 }
13390
13391 /// Removes all scopes, and no default scope will be used either.
13392 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13393 /// for details).
13394 pub fn clear_scopes(mut self) -> ProjectLocationCaPoolTestIamPermissionCall<'a, C> {
13395 self._scopes.clear();
13396 self
13397 }
13398}
13399
13400/// Create a new CertificateTemplate in a given Project and Location.
13401///
13402/// A builder for the *locations.certificateTemplates.create* method supported by a *project* resource.
13403/// It is not used directly, but through a [`ProjectMethods`] instance.
13404///
13405/// # Example
13406///
13407/// Instantiate a resource method builder
13408///
13409/// ```test_harness,no_run
13410/// # extern crate hyper;
13411/// # extern crate hyper_rustls;
13412/// # extern crate google_privateca1 as privateca1;
13413/// use privateca1::api::CertificateTemplate;
13414/// # async fn dox() {
13415/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13416///
13417/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13418/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13419/// # .with_native_roots()
13420/// # .unwrap()
13421/// # .https_only()
13422/// # .enable_http2()
13423/// # .build();
13424///
13425/// # let executor = hyper_util::rt::TokioExecutor::new();
13426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13427/// # secret,
13428/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13429/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13430/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13431/// # ),
13432/// # ).build().await.unwrap();
13433///
13434/// # let client = hyper_util::client::legacy::Client::builder(
13435/// # hyper_util::rt::TokioExecutor::new()
13436/// # )
13437/// # .build(
13438/// # hyper_rustls::HttpsConnectorBuilder::new()
13439/// # .with_native_roots()
13440/// # .unwrap()
13441/// # .https_or_http()
13442/// # .enable_http2()
13443/// # .build()
13444/// # );
13445/// # let mut hub = CertificateAuthorityService::new(client, auth);
13446/// // As the method needs a request, you would usually fill it with the desired information
13447/// // into the respective structure. Some of the parts shown here might not be applicable !
13448/// // Values shown here are possibly random and not representative !
13449/// let mut req = CertificateTemplate::default();
13450///
13451/// // You can configure optional parameters by calling the respective setters at will, and
13452/// // execute the final call using `doit()`.
13453/// // Values shown here are possibly random and not representative !
13454/// let result = hub.projects().locations_certificate_templates_create(req, "parent")
13455/// .request_id("amet.")
13456/// .certificate_template_id("ea")
13457/// .doit().await;
13458/// # }
13459/// ```
13460pub struct ProjectLocationCertificateTemplateCreateCall<'a, C>
13461where
13462 C: 'a,
13463{
13464 hub: &'a CertificateAuthorityService<C>,
13465 _request: CertificateTemplate,
13466 _parent: String,
13467 _request_id: Option<String>,
13468 _certificate_template_id: Option<String>,
13469 _delegate: Option<&'a mut dyn common::Delegate>,
13470 _additional_params: HashMap<String, String>,
13471 _scopes: BTreeSet<String>,
13472}
13473
13474impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateCreateCall<'a, C> {}
13475
13476impl<'a, C> ProjectLocationCertificateTemplateCreateCall<'a, C>
13477where
13478 C: common::Connector,
13479{
13480 /// Perform the operation you have build so far.
13481 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13482 use std::borrow::Cow;
13483 use std::io::{Read, Seek};
13484
13485 use common::{url::Params, ToParts};
13486 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13487
13488 let mut dd = common::DefaultDelegate;
13489 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13490 dlg.begin(common::MethodInfo {
13491 id: "privateca.projects.locations.certificateTemplates.create",
13492 http_method: hyper::Method::POST,
13493 });
13494
13495 for &field in ["alt", "parent", "requestId", "certificateTemplateId"].iter() {
13496 if self._additional_params.contains_key(field) {
13497 dlg.finished(false);
13498 return Err(common::Error::FieldClash(field));
13499 }
13500 }
13501
13502 let mut params = Params::with_capacity(6 + self._additional_params.len());
13503 params.push("parent", self._parent);
13504 if let Some(value) = self._request_id.as_ref() {
13505 params.push("requestId", value);
13506 }
13507 if let Some(value) = self._certificate_template_id.as_ref() {
13508 params.push("certificateTemplateId", value);
13509 }
13510
13511 params.extend(self._additional_params.iter());
13512
13513 params.push("alt", "json");
13514 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificateTemplates";
13515 if self._scopes.is_empty() {
13516 self._scopes
13517 .insert(Scope::CloudPlatform.as_ref().to_string());
13518 }
13519
13520 #[allow(clippy::single_element_loop)]
13521 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13522 url = params.uri_replacement(url, param_name, find_this, true);
13523 }
13524 {
13525 let to_remove = ["parent"];
13526 params.remove_params(&to_remove);
13527 }
13528
13529 let url = params.parse_with_url(&url);
13530
13531 let mut json_mime_type = mime::APPLICATION_JSON;
13532 let mut request_value_reader = {
13533 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13534 common::remove_json_null_values(&mut value);
13535 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13536 serde_json::to_writer(&mut dst, &value).unwrap();
13537 dst
13538 };
13539 let request_size = request_value_reader
13540 .seek(std::io::SeekFrom::End(0))
13541 .unwrap();
13542 request_value_reader
13543 .seek(std::io::SeekFrom::Start(0))
13544 .unwrap();
13545
13546 loop {
13547 let token = match self
13548 .hub
13549 .auth
13550 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13551 .await
13552 {
13553 Ok(token) => token,
13554 Err(e) => match dlg.token(e) {
13555 Ok(token) => token,
13556 Err(e) => {
13557 dlg.finished(false);
13558 return Err(common::Error::MissingToken(e));
13559 }
13560 },
13561 };
13562 request_value_reader
13563 .seek(std::io::SeekFrom::Start(0))
13564 .unwrap();
13565 let mut req_result = {
13566 let client = &self.hub.client;
13567 dlg.pre_request();
13568 let mut req_builder = hyper::Request::builder()
13569 .method(hyper::Method::POST)
13570 .uri(url.as_str())
13571 .header(USER_AGENT, self.hub._user_agent.clone());
13572
13573 if let Some(token) = token.as_ref() {
13574 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13575 }
13576
13577 let request = req_builder
13578 .header(CONTENT_TYPE, json_mime_type.to_string())
13579 .header(CONTENT_LENGTH, request_size as u64)
13580 .body(common::to_body(
13581 request_value_reader.get_ref().clone().into(),
13582 ));
13583
13584 client.request(request.unwrap()).await
13585 };
13586
13587 match req_result {
13588 Err(err) => {
13589 if let common::Retry::After(d) = dlg.http_error(&err) {
13590 sleep(d).await;
13591 continue;
13592 }
13593 dlg.finished(false);
13594 return Err(common::Error::HttpError(err));
13595 }
13596 Ok(res) => {
13597 let (mut parts, body) = res.into_parts();
13598 let mut body = common::Body::new(body);
13599 if !parts.status.is_success() {
13600 let bytes = common::to_bytes(body).await.unwrap_or_default();
13601 let error = serde_json::from_str(&common::to_string(&bytes));
13602 let response = common::to_response(parts, bytes.into());
13603
13604 if let common::Retry::After(d) =
13605 dlg.http_failure(&response, error.as_ref().ok())
13606 {
13607 sleep(d).await;
13608 continue;
13609 }
13610
13611 dlg.finished(false);
13612
13613 return Err(match error {
13614 Ok(value) => common::Error::BadRequest(value),
13615 _ => common::Error::Failure(response),
13616 });
13617 }
13618 let response = {
13619 let bytes = common::to_bytes(body).await.unwrap_or_default();
13620 let encoded = common::to_string(&bytes);
13621 match serde_json::from_str(&encoded) {
13622 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13623 Err(error) => {
13624 dlg.response_json_decode_error(&encoded, &error);
13625 return Err(common::Error::JsonDecodeError(
13626 encoded.to_string(),
13627 error,
13628 ));
13629 }
13630 }
13631 };
13632
13633 dlg.finished(true);
13634 return Ok(response);
13635 }
13636 }
13637 }
13638 }
13639
13640 ///
13641 /// Sets the *request* property to the given value.
13642 ///
13643 /// Even though the property as already been set when instantiating this call,
13644 /// we provide this method for API completeness.
13645 pub fn request(
13646 mut self,
13647 new_value: CertificateTemplate,
13648 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13649 self._request = new_value;
13650 self
13651 }
13652 /// Required. The resource name of the location associated with the CertificateTemplate, in the format `projects/*/locations/*`.
13653 ///
13654 /// Sets the *parent* path property to the given value.
13655 ///
13656 /// Even though the property as already been set when instantiating this call,
13657 /// we provide this method for API completeness.
13658 pub fn parent(
13659 mut self,
13660 new_value: &str,
13661 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13662 self._parent = new_value.to_string();
13663 self
13664 }
13665 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
13666 ///
13667 /// Sets the *request id* query property to the given value.
13668 pub fn request_id(
13669 mut self,
13670 new_value: &str,
13671 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13672 self._request_id = Some(new_value.to_string());
13673 self
13674 }
13675 /// Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}`
13676 ///
13677 /// Sets the *certificate template id* query property to the given value.
13678 pub fn certificate_template_id(
13679 mut self,
13680 new_value: &str,
13681 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13682 self._certificate_template_id = Some(new_value.to_string());
13683 self
13684 }
13685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13686 /// while executing the actual API request.
13687 ///
13688 /// ````text
13689 /// It should be used to handle progress information, and to implement a certain level of resilience.
13690 /// ````
13691 ///
13692 /// Sets the *delegate* property to the given value.
13693 pub fn delegate(
13694 mut self,
13695 new_value: &'a mut dyn common::Delegate,
13696 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13697 self._delegate = Some(new_value);
13698 self
13699 }
13700
13701 /// Set any additional parameter of the query string used in the request.
13702 /// It should be used to set parameters which are not yet available through their own
13703 /// setters.
13704 ///
13705 /// Please note that this method must not be used to set any of the known parameters
13706 /// which have their own setter method. If done anyway, the request will fail.
13707 ///
13708 /// # Additional Parameters
13709 ///
13710 /// * *$.xgafv* (query-string) - V1 error format.
13711 /// * *access_token* (query-string) - OAuth access token.
13712 /// * *alt* (query-string) - Data format for response.
13713 /// * *callback* (query-string) - JSONP
13714 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13715 /// * *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.
13716 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13717 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13718 /// * *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.
13719 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13720 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13721 pub fn param<T>(
13722 mut self,
13723 name: T,
13724 value: T,
13725 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C>
13726 where
13727 T: AsRef<str>,
13728 {
13729 self._additional_params
13730 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13731 self
13732 }
13733
13734 /// Identifies the authorization scope for the method you are building.
13735 ///
13736 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13737 /// [`Scope::CloudPlatform`].
13738 ///
13739 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13740 /// tokens for more than one scope.
13741 ///
13742 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13743 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13744 /// sufficient, a read-write scope will do as well.
13745 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCertificateTemplateCreateCall<'a, C>
13746 where
13747 St: AsRef<str>,
13748 {
13749 self._scopes.insert(String::from(scope.as_ref()));
13750 self
13751 }
13752 /// Identifies the authorization scope(s) for the method you are building.
13753 ///
13754 /// See [`Self::add_scope()`] for details.
13755 pub fn add_scopes<I, St>(
13756 mut self,
13757 scopes: I,
13758 ) -> ProjectLocationCertificateTemplateCreateCall<'a, C>
13759 where
13760 I: IntoIterator<Item = St>,
13761 St: AsRef<str>,
13762 {
13763 self._scopes
13764 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13765 self
13766 }
13767
13768 /// Removes all scopes, and no default scope will be used either.
13769 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13770 /// for details).
13771 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateCreateCall<'a, C> {
13772 self._scopes.clear();
13773 self
13774 }
13775}
13776
13777/// DeleteCertificateTemplate deletes a CertificateTemplate.
13778///
13779/// A builder for the *locations.certificateTemplates.delete* method supported by a *project* resource.
13780/// It is not used directly, but through a [`ProjectMethods`] instance.
13781///
13782/// # Example
13783///
13784/// Instantiate a resource method builder
13785///
13786/// ```test_harness,no_run
13787/// # extern crate hyper;
13788/// # extern crate hyper_rustls;
13789/// # extern crate google_privateca1 as privateca1;
13790/// # async fn dox() {
13791/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13792///
13793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13794/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13795/// # .with_native_roots()
13796/// # .unwrap()
13797/// # .https_only()
13798/// # .enable_http2()
13799/// # .build();
13800///
13801/// # let executor = hyper_util::rt::TokioExecutor::new();
13802/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13803/// # secret,
13804/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13805/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13806/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13807/// # ),
13808/// # ).build().await.unwrap();
13809///
13810/// # let client = hyper_util::client::legacy::Client::builder(
13811/// # hyper_util::rt::TokioExecutor::new()
13812/// # )
13813/// # .build(
13814/// # hyper_rustls::HttpsConnectorBuilder::new()
13815/// # .with_native_roots()
13816/// # .unwrap()
13817/// # .https_or_http()
13818/// # .enable_http2()
13819/// # .build()
13820/// # );
13821/// # let mut hub = CertificateAuthorityService::new(client, auth);
13822/// // You can configure optional parameters by calling the respective setters at will, and
13823/// // execute the final call using `doit()`.
13824/// // Values shown here are possibly random and not representative !
13825/// let result = hub.projects().locations_certificate_templates_delete("name")
13826/// .request_id("Lorem")
13827/// .doit().await;
13828/// # }
13829/// ```
13830pub struct ProjectLocationCertificateTemplateDeleteCall<'a, C>
13831where
13832 C: 'a,
13833{
13834 hub: &'a CertificateAuthorityService<C>,
13835 _name: String,
13836 _request_id: Option<String>,
13837 _delegate: Option<&'a mut dyn common::Delegate>,
13838 _additional_params: HashMap<String, String>,
13839 _scopes: BTreeSet<String>,
13840}
13841
13842impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateDeleteCall<'a, C> {}
13843
13844impl<'a, C> ProjectLocationCertificateTemplateDeleteCall<'a, C>
13845where
13846 C: common::Connector,
13847{
13848 /// Perform the operation you have build so far.
13849 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13850 use std::borrow::Cow;
13851 use std::io::{Read, Seek};
13852
13853 use common::{url::Params, ToParts};
13854 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13855
13856 let mut dd = common::DefaultDelegate;
13857 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13858 dlg.begin(common::MethodInfo {
13859 id: "privateca.projects.locations.certificateTemplates.delete",
13860 http_method: hyper::Method::DELETE,
13861 });
13862
13863 for &field in ["alt", "name", "requestId"].iter() {
13864 if self._additional_params.contains_key(field) {
13865 dlg.finished(false);
13866 return Err(common::Error::FieldClash(field));
13867 }
13868 }
13869
13870 let mut params = Params::with_capacity(4 + self._additional_params.len());
13871 params.push("name", self._name);
13872 if let Some(value) = self._request_id.as_ref() {
13873 params.push("requestId", value);
13874 }
13875
13876 params.extend(self._additional_params.iter());
13877
13878 params.push("alt", "json");
13879 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13880 if self._scopes.is_empty() {
13881 self._scopes
13882 .insert(Scope::CloudPlatform.as_ref().to_string());
13883 }
13884
13885 #[allow(clippy::single_element_loop)]
13886 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13887 url = params.uri_replacement(url, param_name, find_this, true);
13888 }
13889 {
13890 let to_remove = ["name"];
13891 params.remove_params(&to_remove);
13892 }
13893
13894 let url = params.parse_with_url(&url);
13895
13896 loop {
13897 let token = match self
13898 .hub
13899 .auth
13900 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13901 .await
13902 {
13903 Ok(token) => token,
13904 Err(e) => match dlg.token(e) {
13905 Ok(token) => token,
13906 Err(e) => {
13907 dlg.finished(false);
13908 return Err(common::Error::MissingToken(e));
13909 }
13910 },
13911 };
13912 let mut req_result = {
13913 let client = &self.hub.client;
13914 dlg.pre_request();
13915 let mut req_builder = hyper::Request::builder()
13916 .method(hyper::Method::DELETE)
13917 .uri(url.as_str())
13918 .header(USER_AGENT, self.hub._user_agent.clone());
13919
13920 if let Some(token) = token.as_ref() {
13921 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13922 }
13923
13924 let request = req_builder
13925 .header(CONTENT_LENGTH, 0_u64)
13926 .body(common::to_body::<String>(None));
13927
13928 client.request(request.unwrap()).await
13929 };
13930
13931 match req_result {
13932 Err(err) => {
13933 if let common::Retry::After(d) = dlg.http_error(&err) {
13934 sleep(d).await;
13935 continue;
13936 }
13937 dlg.finished(false);
13938 return Err(common::Error::HttpError(err));
13939 }
13940 Ok(res) => {
13941 let (mut parts, body) = res.into_parts();
13942 let mut body = common::Body::new(body);
13943 if !parts.status.is_success() {
13944 let bytes = common::to_bytes(body).await.unwrap_or_default();
13945 let error = serde_json::from_str(&common::to_string(&bytes));
13946 let response = common::to_response(parts, bytes.into());
13947
13948 if let common::Retry::After(d) =
13949 dlg.http_failure(&response, error.as_ref().ok())
13950 {
13951 sleep(d).await;
13952 continue;
13953 }
13954
13955 dlg.finished(false);
13956
13957 return Err(match error {
13958 Ok(value) => common::Error::BadRequest(value),
13959 _ => common::Error::Failure(response),
13960 });
13961 }
13962 let response = {
13963 let bytes = common::to_bytes(body).await.unwrap_or_default();
13964 let encoded = common::to_string(&bytes);
13965 match serde_json::from_str(&encoded) {
13966 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13967 Err(error) => {
13968 dlg.response_json_decode_error(&encoded, &error);
13969 return Err(common::Error::JsonDecodeError(
13970 encoded.to_string(),
13971 error,
13972 ));
13973 }
13974 }
13975 };
13976
13977 dlg.finished(true);
13978 return Ok(response);
13979 }
13980 }
13981 }
13982 }
13983
13984 /// Required. The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`.
13985 ///
13986 /// Sets the *name* path property to the given value.
13987 ///
13988 /// Even though the property as already been set when instantiating this call,
13989 /// we provide this method for API completeness.
13990 pub fn name(mut self, new_value: &str) -> ProjectLocationCertificateTemplateDeleteCall<'a, C> {
13991 self._name = new_value.to_string();
13992 self
13993 }
13994 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
13995 ///
13996 /// Sets the *request id* query property to the given value.
13997 pub fn request_id(
13998 mut self,
13999 new_value: &str,
14000 ) -> ProjectLocationCertificateTemplateDeleteCall<'a, C> {
14001 self._request_id = Some(new_value.to_string());
14002 self
14003 }
14004 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14005 /// while executing the actual API request.
14006 ///
14007 /// ````text
14008 /// It should be used to handle progress information, and to implement a certain level of resilience.
14009 /// ````
14010 ///
14011 /// Sets the *delegate* property to the given value.
14012 pub fn delegate(
14013 mut self,
14014 new_value: &'a mut dyn common::Delegate,
14015 ) -> ProjectLocationCertificateTemplateDeleteCall<'a, C> {
14016 self._delegate = Some(new_value);
14017 self
14018 }
14019
14020 /// Set any additional parameter of the query string used in the request.
14021 /// It should be used to set parameters which are not yet available through their own
14022 /// setters.
14023 ///
14024 /// Please note that this method must not be used to set any of the known parameters
14025 /// which have their own setter method. If done anyway, the request will fail.
14026 ///
14027 /// # Additional Parameters
14028 ///
14029 /// * *$.xgafv* (query-string) - V1 error format.
14030 /// * *access_token* (query-string) - OAuth access token.
14031 /// * *alt* (query-string) - Data format for response.
14032 /// * *callback* (query-string) - JSONP
14033 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14034 /// * *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.
14035 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14036 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14037 /// * *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.
14038 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14039 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14040 pub fn param<T>(
14041 mut self,
14042 name: T,
14043 value: T,
14044 ) -> ProjectLocationCertificateTemplateDeleteCall<'a, C>
14045 where
14046 T: AsRef<str>,
14047 {
14048 self._additional_params
14049 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14050 self
14051 }
14052
14053 /// Identifies the authorization scope for the method you are building.
14054 ///
14055 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14056 /// [`Scope::CloudPlatform`].
14057 ///
14058 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14059 /// tokens for more than one scope.
14060 ///
14061 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14062 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14063 /// sufficient, a read-write scope will do as well.
14064 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCertificateTemplateDeleteCall<'a, C>
14065 where
14066 St: AsRef<str>,
14067 {
14068 self._scopes.insert(String::from(scope.as_ref()));
14069 self
14070 }
14071 /// Identifies the authorization scope(s) for the method you are building.
14072 ///
14073 /// See [`Self::add_scope()`] for details.
14074 pub fn add_scopes<I, St>(
14075 mut self,
14076 scopes: I,
14077 ) -> ProjectLocationCertificateTemplateDeleteCall<'a, C>
14078 where
14079 I: IntoIterator<Item = St>,
14080 St: AsRef<str>,
14081 {
14082 self._scopes
14083 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14084 self
14085 }
14086
14087 /// Removes all scopes, and no default scope will be used either.
14088 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14089 /// for details).
14090 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateDeleteCall<'a, C> {
14091 self._scopes.clear();
14092 self
14093 }
14094}
14095
14096/// Returns a CertificateTemplate.
14097///
14098/// A builder for the *locations.certificateTemplates.get* method supported by a *project* resource.
14099/// It is not used directly, but through a [`ProjectMethods`] instance.
14100///
14101/// # Example
14102///
14103/// Instantiate a resource method builder
14104///
14105/// ```test_harness,no_run
14106/// # extern crate hyper;
14107/// # extern crate hyper_rustls;
14108/// # extern crate google_privateca1 as privateca1;
14109/// # async fn dox() {
14110/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14111///
14112/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14113/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14114/// # .with_native_roots()
14115/// # .unwrap()
14116/// # .https_only()
14117/// # .enable_http2()
14118/// # .build();
14119///
14120/// # let executor = hyper_util::rt::TokioExecutor::new();
14121/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14122/// # secret,
14123/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14124/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14125/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14126/// # ),
14127/// # ).build().await.unwrap();
14128///
14129/// # let client = hyper_util::client::legacy::Client::builder(
14130/// # hyper_util::rt::TokioExecutor::new()
14131/// # )
14132/// # .build(
14133/// # hyper_rustls::HttpsConnectorBuilder::new()
14134/// # .with_native_roots()
14135/// # .unwrap()
14136/// # .https_or_http()
14137/// # .enable_http2()
14138/// # .build()
14139/// # );
14140/// # let mut hub = CertificateAuthorityService::new(client, auth);
14141/// // You can configure optional parameters by calling the respective setters at will, and
14142/// // execute the final call using `doit()`.
14143/// // Values shown here are possibly random and not representative !
14144/// let result = hub.projects().locations_certificate_templates_get("name")
14145/// .doit().await;
14146/// # }
14147/// ```
14148pub struct ProjectLocationCertificateTemplateGetCall<'a, C>
14149where
14150 C: 'a,
14151{
14152 hub: &'a CertificateAuthorityService<C>,
14153 _name: String,
14154 _delegate: Option<&'a mut dyn common::Delegate>,
14155 _additional_params: HashMap<String, String>,
14156 _scopes: BTreeSet<String>,
14157}
14158
14159impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateGetCall<'a, C> {}
14160
14161impl<'a, C> ProjectLocationCertificateTemplateGetCall<'a, C>
14162where
14163 C: common::Connector,
14164{
14165 /// Perform the operation you have build so far.
14166 pub async fn doit(mut self) -> common::Result<(common::Response, CertificateTemplate)> {
14167 use std::borrow::Cow;
14168 use std::io::{Read, Seek};
14169
14170 use common::{url::Params, ToParts};
14171 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14172
14173 let mut dd = common::DefaultDelegate;
14174 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14175 dlg.begin(common::MethodInfo {
14176 id: "privateca.projects.locations.certificateTemplates.get",
14177 http_method: hyper::Method::GET,
14178 });
14179
14180 for &field in ["alt", "name"].iter() {
14181 if self._additional_params.contains_key(field) {
14182 dlg.finished(false);
14183 return Err(common::Error::FieldClash(field));
14184 }
14185 }
14186
14187 let mut params = Params::with_capacity(3 + self._additional_params.len());
14188 params.push("name", self._name);
14189
14190 params.extend(self._additional_params.iter());
14191
14192 params.push("alt", "json");
14193 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14194 if self._scopes.is_empty() {
14195 self._scopes
14196 .insert(Scope::CloudPlatform.as_ref().to_string());
14197 }
14198
14199 #[allow(clippy::single_element_loop)]
14200 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14201 url = params.uri_replacement(url, param_name, find_this, true);
14202 }
14203 {
14204 let to_remove = ["name"];
14205 params.remove_params(&to_remove);
14206 }
14207
14208 let url = params.parse_with_url(&url);
14209
14210 loop {
14211 let token = match self
14212 .hub
14213 .auth
14214 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14215 .await
14216 {
14217 Ok(token) => token,
14218 Err(e) => match dlg.token(e) {
14219 Ok(token) => token,
14220 Err(e) => {
14221 dlg.finished(false);
14222 return Err(common::Error::MissingToken(e));
14223 }
14224 },
14225 };
14226 let mut req_result = {
14227 let client = &self.hub.client;
14228 dlg.pre_request();
14229 let mut req_builder = hyper::Request::builder()
14230 .method(hyper::Method::GET)
14231 .uri(url.as_str())
14232 .header(USER_AGENT, self.hub._user_agent.clone());
14233
14234 if let Some(token) = token.as_ref() {
14235 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14236 }
14237
14238 let request = req_builder
14239 .header(CONTENT_LENGTH, 0_u64)
14240 .body(common::to_body::<String>(None));
14241
14242 client.request(request.unwrap()).await
14243 };
14244
14245 match req_result {
14246 Err(err) => {
14247 if let common::Retry::After(d) = dlg.http_error(&err) {
14248 sleep(d).await;
14249 continue;
14250 }
14251 dlg.finished(false);
14252 return Err(common::Error::HttpError(err));
14253 }
14254 Ok(res) => {
14255 let (mut parts, body) = res.into_parts();
14256 let mut body = common::Body::new(body);
14257 if !parts.status.is_success() {
14258 let bytes = common::to_bytes(body).await.unwrap_or_default();
14259 let error = serde_json::from_str(&common::to_string(&bytes));
14260 let response = common::to_response(parts, bytes.into());
14261
14262 if let common::Retry::After(d) =
14263 dlg.http_failure(&response, error.as_ref().ok())
14264 {
14265 sleep(d).await;
14266 continue;
14267 }
14268
14269 dlg.finished(false);
14270
14271 return Err(match error {
14272 Ok(value) => common::Error::BadRequest(value),
14273 _ => common::Error::Failure(response),
14274 });
14275 }
14276 let response = {
14277 let bytes = common::to_bytes(body).await.unwrap_or_default();
14278 let encoded = common::to_string(&bytes);
14279 match serde_json::from_str(&encoded) {
14280 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14281 Err(error) => {
14282 dlg.response_json_decode_error(&encoded, &error);
14283 return Err(common::Error::JsonDecodeError(
14284 encoded.to_string(),
14285 error,
14286 ));
14287 }
14288 }
14289 };
14290
14291 dlg.finished(true);
14292 return Ok(response);
14293 }
14294 }
14295 }
14296 }
14297
14298 /// Required. The name of the CertificateTemplate to get.
14299 ///
14300 /// Sets the *name* path property to the given value.
14301 ///
14302 /// Even though the property as already been set when instantiating this call,
14303 /// we provide this method for API completeness.
14304 pub fn name(mut self, new_value: &str) -> ProjectLocationCertificateTemplateGetCall<'a, C> {
14305 self._name = new_value.to_string();
14306 self
14307 }
14308 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14309 /// while executing the actual API request.
14310 ///
14311 /// ````text
14312 /// It should be used to handle progress information, and to implement a certain level of resilience.
14313 /// ````
14314 ///
14315 /// Sets the *delegate* property to the given value.
14316 pub fn delegate(
14317 mut self,
14318 new_value: &'a mut dyn common::Delegate,
14319 ) -> ProjectLocationCertificateTemplateGetCall<'a, C> {
14320 self._delegate = Some(new_value);
14321 self
14322 }
14323
14324 /// Set any additional parameter of the query string used in the request.
14325 /// It should be used to set parameters which are not yet available through their own
14326 /// setters.
14327 ///
14328 /// Please note that this method must not be used to set any of the known parameters
14329 /// which have their own setter method. If done anyway, the request will fail.
14330 ///
14331 /// # Additional Parameters
14332 ///
14333 /// * *$.xgafv* (query-string) - V1 error format.
14334 /// * *access_token* (query-string) - OAuth access token.
14335 /// * *alt* (query-string) - Data format for response.
14336 /// * *callback* (query-string) - JSONP
14337 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14338 /// * *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.
14339 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14340 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14341 /// * *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.
14342 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14343 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14344 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCertificateTemplateGetCall<'a, C>
14345 where
14346 T: AsRef<str>,
14347 {
14348 self._additional_params
14349 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14350 self
14351 }
14352
14353 /// Identifies the authorization scope for the method you are building.
14354 ///
14355 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14356 /// [`Scope::CloudPlatform`].
14357 ///
14358 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14359 /// tokens for more than one scope.
14360 ///
14361 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14362 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14363 /// sufficient, a read-write scope will do as well.
14364 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCertificateTemplateGetCall<'a, C>
14365 where
14366 St: AsRef<str>,
14367 {
14368 self._scopes.insert(String::from(scope.as_ref()));
14369 self
14370 }
14371 /// Identifies the authorization scope(s) for the method you are building.
14372 ///
14373 /// See [`Self::add_scope()`] for details.
14374 pub fn add_scopes<I, St>(
14375 mut self,
14376 scopes: I,
14377 ) -> ProjectLocationCertificateTemplateGetCall<'a, C>
14378 where
14379 I: IntoIterator<Item = St>,
14380 St: AsRef<str>,
14381 {
14382 self._scopes
14383 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14384 self
14385 }
14386
14387 /// Removes all scopes, and no default scope will be used either.
14388 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14389 /// for details).
14390 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateGetCall<'a, C> {
14391 self._scopes.clear();
14392 self
14393 }
14394}
14395
14396/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
14397///
14398/// A builder for the *locations.certificateTemplates.getIamPolicy* method supported by a *project* resource.
14399/// It is not used directly, but through a [`ProjectMethods`] instance.
14400///
14401/// # Example
14402///
14403/// Instantiate a resource method builder
14404///
14405/// ```test_harness,no_run
14406/// # extern crate hyper;
14407/// # extern crate hyper_rustls;
14408/// # extern crate google_privateca1 as privateca1;
14409/// # async fn dox() {
14410/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14411///
14412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14413/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14414/// # .with_native_roots()
14415/// # .unwrap()
14416/// # .https_only()
14417/// # .enable_http2()
14418/// # .build();
14419///
14420/// # let executor = hyper_util::rt::TokioExecutor::new();
14421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14422/// # secret,
14423/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14424/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14425/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14426/// # ),
14427/// # ).build().await.unwrap();
14428///
14429/// # let client = hyper_util::client::legacy::Client::builder(
14430/// # hyper_util::rt::TokioExecutor::new()
14431/// # )
14432/// # .build(
14433/// # hyper_rustls::HttpsConnectorBuilder::new()
14434/// # .with_native_roots()
14435/// # .unwrap()
14436/// # .https_or_http()
14437/// # .enable_http2()
14438/// # .build()
14439/// # );
14440/// # let mut hub = CertificateAuthorityService::new(client, auth);
14441/// // You can configure optional parameters by calling the respective setters at will, and
14442/// // execute the final call using `doit()`.
14443/// // Values shown here are possibly random and not representative !
14444/// let result = hub.projects().locations_certificate_templates_get_iam_policy("resource")
14445/// .options_requested_policy_version(-7)
14446/// .doit().await;
14447/// # }
14448/// ```
14449pub struct ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C>
14450where
14451 C: 'a,
14452{
14453 hub: &'a CertificateAuthorityService<C>,
14454 _resource: String,
14455 _options_requested_policy_version: Option<i32>,
14456 _delegate: Option<&'a mut dyn common::Delegate>,
14457 _additional_params: HashMap<String, String>,
14458 _scopes: BTreeSet<String>,
14459}
14460
14461impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {}
14462
14463impl<'a, C> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C>
14464where
14465 C: common::Connector,
14466{
14467 /// Perform the operation you have build so far.
14468 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14469 use std::borrow::Cow;
14470 use std::io::{Read, Seek};
14471
14472 use common::{url::Params, ToParts};
14473 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14474
14475 let mut dd = common::DefaultDelegate;
14476 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14477 dlg.begin(common::MethodInfo {
14478 id: "privateca.projects.locations.certificateTemplates.getIamPolicy",
14479 http_method: hyper::Method::GET,
14480 });
14481
14482 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
14483 if self._additional_params.contains_key(field) {
14484 dlg.finished(false);
14485 return Err(common::Error::FieldClash(field));
14486 }
14487 }
14488
14489 let mut params = Params::with_capacity(4 + self._additional_params.len());
14490 params.push("resource", self._resource);
14491 if let Some(value) = self._options_requested_policy_version.as_ref() {
14492 params.push("options.requestedPolicyVersion", value.to_string());
14493 }
14494
14495 params.extend(self._additional_params.iter());
14496
14497 params.push("alt", "json");
14498 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
14499 if self._scopes.is_empty() {
14500 self._scopes
14501 .insert(Scope::CloudPlatform.as_ref().to_string());
14502 }
14503
14504 #[allow(clippy::single_element_loop)]
14505 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14506 url = params.uri_replacement(url, param_name, find_this, true);
14507 }
14508 {
14509 let to_remove = ["resource"];
14510 params.remove_params(&to_remove);
14511 }
14512
14513 let url = params.parse_with_url(&url);
14514
14515 loop {
14516 let token = match self
14517 .hub
14518 .auth
14519 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14520 .await
14521 {
14522 Ok(token) => token,
14523 Err(e) => match dlg.token(e) {
14524 Ok(token) => token,
14525 Err(e) => {
14526 dlg.finished(false);
14527 return Err(common::Error::MissingToken(e));
14528 }
14529 },
14530 };
14531 let mut req_result = {
14532 let client = &self.hub.client;
14533 dlg.pre_request();
14534 let mut req_builder = hyper::Request::builder()
14535 .method(hyper::Method::GET)
14536 .uri(url.as_str())
14537 .header(USER_AGENT, self.hub._user_agent.clone());
14538
14539 if let Some(token) = token.as_ref() {
14540 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14541 }
14542
14543 let request = req_builder
14544 .header(CONTENT_LENGTH, 0_u64)
14545 .body(common::to_body::<String>(None));
14546
14547 client.request(request.unwrap()).await
14548 };
14549
14550 match req_result {
14551 Err(err) => {
14552 if let common::Retry::After(d) = dlg.http_error(&err) {
14553 sleep(d).await;
14554 continue;
14555 }
14556 dlg.finished(false);
14557 return Err(common::Error::HttpError(err));
14558 }
14559 Ok(res) => {
14560 let (mut parts, body) = res.into_parts();
14561 let mut body = common::Body::new(body);
14562 if !parts.status.is_success() {
14563 let bytes = common::to_bytes(body).await.unwrap_or_default();
14564 let error = serde_json::from_str(&common::to_string(&bytes));
14565 let response = common::to_response(parts, bytes.into());
14566
14567 if let common::Retry::After(d) =
14568 dlg.http_failure(&response, error.as_ref().ok())
14569 {
14570 sleep(d).await;
14571 continue;
14572 }
14573
14574 dlg.finished(false);
14575
14576 return Err(match error {
14577 Ok(value) => common::Error::BadRequest(value),
14578 _ => common::Error::Failure(response),
14579 });
14580 }
14581 let response = {
14582 let bytes = common::to_bytes(body).await.unwrap_or_default();
14583 let encoded = common::to_string(&bytes);
14584 match serde_json::from_str(&encoded) {
14585 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14586 Err(error) => {
14587 dlg.response_json_decode_error(&encoded, &error);
14588 return Err(common::Error::JsonDecodeError(
14589 encoded.to_string(),
14590 error,
14591 ));
14592 }
14593 }
14594 };
14595
14596 dlg.finished(true);
14597 return Ok(response);
14598 }
14599 }
14600 }
14601 }
14602
14603 /// 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.
14604 ///
14605 /// Sets the *resource* path property to the given value.
14606 ///
14607 /// Even though the property as already been set when instantiating this call,
14608 /// we provide this method for API completeness.
14609 pub fn resource(
14610 mut self,
14611 new_value: &str,
14612 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {
14613 self._resource = new_value.to_string();
14614 self
14615 }
14616 /// 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).
14617 ///
14618 /// Sets the *options.requested policy version* query property to the given value.
14619 pub fn options_requested_policy_version(
14620 mut self,
14621 new_value: i32,
14622 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {
14623 self._options_requested_policy_version = Some(new_value);
14624 self
14625 }
14626 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14627 /// while executing the actual API request.
14628 ///
14629 /// ````text
14630 /// It should be used to handle progress information, and to implement a certain level of resilience.
14631 /// ````
14632 ///
14633 /// Sets the *delegate* property to the given value.
14634 pub fn delegate(
14635 mut self,
14636 new_value: &'a mut dyn common::Delegate,
14637 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {
14638 self._delegate = Some(new_value);
14639 self
14640 }
14641
14642 /// Set any additional parameter of the query string used in the request.
14643 /// It should be used to set parameters which are not yet available through their own
14644 /// setters.
14645 ///
14646 /// Please note that this method must not be used to set any of the known parameters
14647 /// which have their own setter method. If done anyway, the request will fail.
14648 ///
14649 /// # Additional Parameters
14650 ///
14651 /// * *$.xgafv* (query-string) - V1 error format.
14652 /// * *access_token* (query-string) - OAuth access token.
14653 /// * *alt* (query-string) - Data format for response.
14654 /// * *callback* (query-string) - JSONP
14655 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14656 /// * *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.
14657 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14658 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14659 /// * *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.
14660 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14661 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14662 pub fn param<T>(
14663 mut self,
14664 name: T,
14665 value: T,
14666 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C>
14667 where
14668 T: AsRef<str>,
14669 {
14670 self._additional_params
14671 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14672 self
14673 }
14674
14675 /// Identifies the authorization scope for the method you are building.
14676 ///
14677 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14678 /// [`Scope::CloudPlatform`].
14679 ///
14680 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14681 /// tokens for more than one scope.
14682 ///
14683 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14684 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14685 /// sufficient, a read-write scope will do as well.
14686 pub fn add_scope<St>(
14687 mut self,
14688 scope: St,
14689 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C>
14690 where
14691 St: AsRef<str>,
14692 {
14693 self._scopes.insert(String::from(scope.as_ref()));
14694 self
14695 }
14696 /// Identifies the authorization scope(s) for the method you are building.
14697 ///
14698 /// See [`Self::add_scope()`] for details.
14699 pub fn add_scopes<I, St>(
14700 mut self,
14701 scopes: I,
14702 ) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C>
14703 where
14704 I: IntoIterator<Item = St>,
14705 St: AsRef<str>,
14706 {
14707 self._scopes
14708 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14709 self
14710 }
14711
14712 /// Removes all scopes, and no default scope will be used either.
14713 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14714 /// for details).
14715 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateGetIamPolicyCall<'a, C> {
14716 self._scopes.clear();
14717 self
14718 }
14719}
14720
14721/// Lists CertificateTemplates.
14722///
14723/// A builder for the *locations.certificateTemplates.list* method supported by a *project* resource.
14724/// It is not used directly, but through a [`ProjectMethods`] instance.
14725///
14726/// # Example
14727///
14728/// Instantiate a resource method builder
14729///
14730/// ```test_harness,no_run
14731/// # extern crate hyper;
14732/// # extern crate hyper_rustls;
14733/// # extern crate google_privateca1 as privateca1;
14734/// # async fn dox() {
14735/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14736///
14737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14738/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14739/// # .with_native_roots()
14740/// # .unwrap()
14741/// # .https_only()
14742/// # .enable_http2()
14743/// # .build();
14744///
14745/// # let executor = hyper_util::rt::TokioExecutor::new();
14746/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14747/// # secret,
14748/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14749/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14750/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14751/// # ),
14752/// # ).build().await.unwrap();
14753///
14754/// # let client = hyper_util::client::legacy::Client::builder(
14755/// # hyper_util::rt::TokioExecutor::new()
14756/// # )
14757/// # .build(
14758/// # hyper_rustls::HttpsConnectorBuilder::new()
14759/// # .with_native_roots()
14760/// # .unwrap()
14761/// # .https_or_http()
14762/// # .enable_http2()
14763/// # .build()
14764/// # );
14765/// # let mut hub = CertificateAuthorityService::new(client, auth);
14766/// // You can configure optional parameters by calling the respective setters at will, and
14767/// // execute the final call using `doit()`.
14768/// // Values shown here are possibly random and not representative !
14769/// let result = hub.projects().locations_certificate_templates_list("parent")
14770/// .page_token("sed")
14771/// .page_size(-98)
14772/// .order_by("et")
14773/// .filter("tempor")
14774/// .doit().await;
14775/// # }
14776/// ```
14777pub struct ProjectLocationCertificateTemplateListCall<'a, C>
14778where
14779 C: 'a,
14780{
14781 hub: &'a CertificateAuthorityService<C>,
14782 _parent: String,
14783 _page_token: Option<String>,
14784 _page_size: Option<i32>,
14785 _order_by: Option<String>,
14786 _filter: Option<String>,
14787 _delegate: Option<&'a mut dyn common::Delegate>,
14788 _additional_params: HashMap<String, String>,
14789 _scopes: BTreeSet<String>,
14790}
14791
14792impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateListCall<'a, C> {}
14793
14794impl<'a, C> ProjectLocationCertificateTemplateListCall<'a, C>
14795where
14796 C: common::Connector,
14797{
14798 /// Perform the operation you have build so far.
14799 pub async fn doit(
14800 mut self,
14801 ) -> common::Result<(common::Response, ListCertificateTemplatesResponse)> {
14802 use std::borrow::Cow;
14803 use std::io::{Read, Seek};
14804
14805 use common::{url::Params, ToParts};
14806 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14807
14808 let mut dd = common::DefaultDelegate;
14809 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14810 dlg.begin(common::MethodInfo {
14811 id: "privateca.projects.locations.certificateTemplates.list",
14812 http_method: hyper::Method::GET,
14813 });
14814
14815 for &field in [
14816 "alt",
14817 "parent",
14818 "pageToken",
14819 "pageSize",
14820 "orderBy",
14821 "filter",
14822 ]
14823 .iter()
14824 {
14825 if self._additional_params.contains_key(field) {
14826 dlg.finished(false);
14827 return Err(common::Error::FieldClash(field));
14828 }
14829 }
14830
14831 let mut params = Params::with_capacity(7 + self._additional_params.len());
14832 params.push("parent", self._parent);
14833 if let Some(value) = self._page_token.as_ref() {
14834 params.push("pageToken", value);
14835 }
14836 if let Some(value) = self._page_size.as_ref() {
14837 params.push("pageSize", value.to_string());
14838 }
14839 if let Some(value) = self._order_by.as_ref() {
14840 params.push("orderBy", value);
14841 }
14842 if let Some(value) = self._filter.as_ref() {
14843 params.push("filter", value);
14844 }
14845
14846 params.extend(self._additional_params.iter());
14847
14848 params.push("alt", "json");
14849 let mut url = self.hub._base_url.clone() + "v1/{+parent}/certificateTemplates";
14850 if self._scopes.is_empty() {
14851 self._scopes
14852 .insert(Scope::CloudPlatform.as_ref().to_string());
14853 }
14854
14855 #[allow(clippy::single_element_loop)]
14856 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14857 url = params.uri_replacement(url, param_name, find_this, true);
14858 }
14859 {
14860 let to_remove = ["parent"];
14861 params.remove_params(&to_remove);
14862 }
14863
14864 let url = params.parse_with_url(&url);
14865
14866 loop {
14867 let token = match self
14868 .hub
14869 .auth
14870 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14871 .await
14872 {
14873 Ok(token) => token,
14874 Err(e) => match dlg.token(e) {
14875 Ok(token) => token,
14876 Err(e) => {
14877 dlg.finished(false);
14878 return Err(common::Error::MissingToken(e));
14879 }
14880 },
14881 };
14882 let mut req_result = {
14883 let client = &self.hub.client;
14884 dlg.pre_request();
14885 let mut req_builder = hyper::Request::builder()
14886 .method(hyper::Method::GET)
14887 .uri(url.as_str())
14888 .header(USER_AGENT, self.hub._user_agent.clone());
14889
14890 if let Some(token) = token.as_ref() {
14891 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14892 }
14893
14894 let request = req_builder
14895 .header(CONTENT_LENGTH, 0_u64)
14896 .body(common::to_body::<String>(None));
14897
14898 client.request(request.unwrap()).await
14899 };
14900
14901 match req_result {
14902 Err(err) => {
14903 if let common::Retry::After(d) = dlg.http_error(&err) {
14904 sleep(d).await;
14905 continue;
14906 }
14907 dlg.finished(false);
14908 return Err(common::Error::HttpError(err));
14909 }
14910 Ok(res) => {
14911 let (mut parts, body) = res.into_parts();
14912 let mut body = common::Body::new(body);
14913 if !parts.status.is_success() {
14914 let bytes = common::to_bytes(body).await.unwrap_or_default();
14915 let error = serde_json::from_str(&common::to_string(&bytes));
14916 let response = common::to_response(parts, bytes.into());
14917
14918 if let common::Retry::After(d) =
14919 dlg.http_failure(&response, error.as_ref().ok())
14920 {
14921 sleep(d).await;
14922 continue;
14923 }
14924
14925 dlg.finished(false);
14926
14927 return Err(match error {
14928 Ok(value) => common::Error::BadRequest(value),
14929 _ => common::Error::Failure(response),
14930 });
14931 }
14932 let response = {
14933 let bytes = common::to_bytes(body).await.unwrap_or_default();
14934 let encoded = common::to_string(&bytes);
14935 match serde_json::from_str(&encoded) {
14936 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14937 Err(error) => {
14938 dlg.response_json_decode_error(&encoded, &error);
14939 return Err(common::Error::JsonDecodeError(
14940 encoded.to_string(),
14941 error,
14942 ));
14943 }
14944 }
14945 };
14946
14947 dlg.finished(true);
14948 return Ok(response);
14949 }
14950 }
14951 }
14952 }
14953
14954 /// Required. The resource name of the location associated with the CertificateTemplates, in the format `projects/*/locations/*`.
14955 ///
14956 /// Sets the *parent* path property to the given value.
14957 ///
14958 /// Even though the property as already been set when instantiating this call,
14959 /// we provide this method for API completeness.
14960 pub fn parent(mut self, new_value: &str) -> ProjectLocationCertificateTemplateListCall<'a, C> {
14961 self._parent = new_value.to_string();
14962 self
14963 }
14964 /// Optional. Pagination token, returned earlier via ListCertificateTemplatesResponse.next_page_token.
14965 ///
14966 /// Sets the *page token* query property to the given value.
14967 pub fn page_token(
14968 mut self,
14969 new_value: &str,
14970 ) -> ProjectLocationCertificateTemplateListCall<'a, C> {
14971 self._page_token = Some(new_value.to_string());
14972 self
14973 }
14974 /// Optional. Limit on the number of CertificateTemplates to include in the response. Further CertificateTemplates can subsequently be obtained by including the ListCertificateTemplatesResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
14975 ///
14976 /// Sets the *page size* query property to the given value.
14977 pub fn page_size(
14978 mut self,
14979 new_value: i32,
14980 ) -> ProjectLocationCertificateTemplateListCall<'a, C> {
14981 self._page_size = Some(new_value);
14982 self
14983 }
14984 /// Optional. Specify how the results should be sorted.
14985 ///
14986 /// Sets the *order by* query property to the given value.
14987 pub fn order_by(
14988 mut self,
14989 new_value: &str,
14990 ) -> ProjectLocationCertificateTemplateListCall<'a, C> {
14991 self._order_by = Some(new_value.to_string());
14992 self
14993 }
14994 /// Optional. Only include resources that match the filter in the response.
14995 ///
14996 /// Sets the *filter* query property to the given value.
14997 pub fn filter(mut self, new_value: &str) -> ProjectLocationCertificateTemplateListCall<'a, C> {
14998 self._filter = Some(new_value.to_string());
14999 self
15000 }
15001 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15002 /// while executing the actual API request.
15003 ///
15004 /// ````text
15005 /// It should be used to handle progress information, and to implement a certain level of resilience.
15006 /// ````
15007 ///
15008 /// Sets the *delegate* property to the given value.
15009 pub fn delegate(
15010 mut self,
15011 new_value: &'a mut dyn common::Delegate,
15012 ) -> ProjectLocationCertificateTemplateListCall<'a, C> {
15013 self._delegate = Some(new_value);
15014 self
15015 }
15016
15017 /// Set any additional parameter of the query string used in the request.
15018 /// It should be used to set parameters which are not yet available through their own
15019 /// setters.
15020 ///
15021 /// Please note that this method must not be used to set any of the known parameters
15022 /// which have their own setter method. If done anyway, the request will fail.
15023 ///
15024 /// # Additional Parameters
15025 ///
15026 /// * *$.xgafv* (query-string) - V1 error format.
15027 /// * *access_token* (query-string) - OAuth access token.
15028 /// * *alt* (query-string) - Data format for response.
15029 /// * *callback* (query-string) - JSONP
15030 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15031 /// * *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.
15032 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15033 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15034 /// * *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.
15035 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15036 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15037 pub fn param<T>(
15038 mut self,
15039 name: T,
15040 value: T,
15041 ) -> ProjectLocationCertificateTemplateListCall<'a, C>
15042 where
15043 T: AsRef<str>,
15044 {
15045 self._additional_params
15046 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15047 self
15048 }
15049
15050 /// Identifies the authorization scope for the method you are building.
15051 ///
15052 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15053 /// [`Scope::CloudPlatform`].
15054 ///
15055 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15056 /// tokens for more than one scope.
15057 ///
15058 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15059 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15060 /// sufficient, a read-write scope will do as well.
15061 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCertificateTemplateListCall<'a, C>
15062 where
15063 St: AsRef<str>,
15064 {
15065 self._scopes.insert(String::from(scope.as_ref()));
15066 self
15067 }
15068 /// Identifies the authorization scope(s) for the method you are building.
15069 ///
15070 /// See [`Self::add_scope()`] for details.
15071 pub fn add_scopes<I, St>(
15072 mut self,
15073 scopes: I,
15074 ) -> ProjectLocationCertificateTemplateListCall<'a, C>
15075 where
15076 I: IntoIterator<Item = St>,
15077 St: AsRef<str>,
15078 {
15079 self._scopes
15080 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15081 self
15082 }
15083
15084 /// Removes all scopes, and no default scope will be used either.
15085 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15086 /// for details).
15087 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateListCall<'a, C> {
15088 self._scopes.clear();
15089 self
15090 }
15091}
15092
15093/// Update a CertificateTemplate.
15094///
15095/// A builder for the *locations.certificateTemplates.patch* method supported by a *project* resource.
15096/// It is not used directly, but through a [`ProjectMethods`] instance.
15097///
15098/// # Example
15099///
15100/// Instantiate a resource method builder
15101///
15102/// ```test_harness,no_run
15103/// # extern crate hyper;
15104/// # extern crate hyper_rustls;
15105/// # extern crate google_privateca1 as privateca1;
15106/// use privateca1::api::CertificateTemplate;
15107/// # async fn dox() {
15108/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15109///
15110/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15111/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15112/// # .with_native_roots()
15113/// # .unwrap()
15114/// # .https_only()
15115/// # .enable_http2()
15116/// # .build();
15117///
15118/// # let executor = hyper_util::rt::TokioExecutor::new();
15119/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15120/// # secret,
15121/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15122/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15123/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15124/// # ),
15125/// # ).build().await.unwrap();
15126///
15127/// # let client = hyper_util::client::legacy::Client::builder(
15128/// # hyper_util::rt::TokioExecutor::new()
15129/// # )
15130/// # .build(
15131/// # hyper_rustls::HttpsConnectorBuilder::new()
15132/// # .with_native_roots()
15133/// # .unwrap()
15134/// # .https_or_http()
15135/// # .enable_http2()
15136/// # .build()
15137/// # );
15138/// # let mut hub = CertificateAuthorityService::new(client, auth);
15139/// // As the method needs a request, you would usually fill it with the desired information
15140/// // into the respective structure. Some of the parts shown here might not be applicable !
15141/// // Values shown here are possibly random and not representative !
15142/// let mut req = CertificateTemplate::default();
15143///
15144/// // You can configure optional parameters by calling the respective setters at will, and
15145/// // execute the final call using `doit()`.
15146/// // Values shown here are possibly random and not representative !
15147/// let result = hub.projects().locations_certificate_templates_patch(req, "name")
15148/// .update_mask(FieldMask::new::<&str>(&[]))
15149/// .request_id("ipsum")
15150/// .doit().await;
15151/// # }
15152/// ```
15153pub struct ProjectLocationCertificateTemplatePatchCall<'a, C>
15154where
15155 C: 'a,
15156{
15157 hub: &'a CertificateAuthorityService<C>,
15158 _request: CertificateTemplate,
15159 _name: String,
15160 _update_mask: Option<common::FieldMask>,
15161 _request_id: Option<String>,
15162 _delegate: Option<&'a mut dyn common::Delegate>,
15163 _additional_params: HashMap<String, String>,
15164 _scopes: BTreeSet<String>,
15165}
15166
15167impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplatePatchCall<'a, C> {}
15168
15169impl<'a, C> ProjectLocationCertificateTemplatePatchCall<'a, C>
15170where
15171 C: common::Connector,
15172{
15173 /// Perform the operation you have build so far.
15174 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15175 use std::borrow::Cow;
15176 use std::io::{Read, Seek};
15177
15178 use common::{url::Params, ToParts};
15179 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15180
15181 let mut dd = common::DefaultDelegate;
15182 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15183 dlg.begin(common::MethodInfo {
15184 id: "privateca.projects.locations.certificateTemplates.patch",
15185 http_method: hyper::Method::PATCH,
15186 });
15187
15188 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
15189 if self._additional_params.contains_key(field) {
15190 dlg.finished(false);
15191 return Err(common::Error::FieldClash(field));
15192 }
15193 }
15194
15195 let mut params = Params::with_capacity(6 + self._additional_params.len());
15196 params.push("name", self._name);
15197 if let Some(value) = self._update_mask.as_ref() {
15198 params.push("updateMask", value.to_string());
15199 }
15200 if let Some(value) = self._request_id.as_ref() {
15201 params.push("requestId", value);
15202 }
15203
15204 params.extend(self._additional_params.iter());
15205
15206 params.push("alt", "json");
15207 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15208 if self._scopes.is_empty() {
15209 self._scopes
15210 .insert(Scope::CloudPlatform.as_ref().to_string());
15211 }
15212
15213 #[allow(clippy::single_element_loop)]
15214 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15215 url = params.uri_replacement(url, param_name, find_this, true);
15216 }
15217 {
15218 let to_remove = ["name"];
15219 params.remove_params(&to_remove);
15220 }
15221
15222 let url = params.parse_with_url(&url);
15223
15224 let mut json_mime_type = mime::APPLICATION_JSON;
15225 let mut request_value_reader = {
15226 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15227 common::remove_json_null_values(&mut value);
15228 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15229 serde_json::to_writer(&mut dst, &value).unwrap();
15230 dst
15231 };
15232 let request_size = request_value_reader
15233 .seek(std::io::SeekFrom::End(0))
15234 .unwrap();
15235 request_value_reader
15236 .seek(std::io::SeekFrom::Start(0))
15237 .unwrap();
15238
15239 loop {
15240 let token = match self
15241 .hub
15242 .auth
15243 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15244 .await
15245 {
15246 Ok(token) => token,
15247 Err(e) => match dlg.token(e) {
15248 Ok(token) => token,
15249 Err(e) => {
15250 dlg.finished(false);
15251 return Err(common::Error::MissingToken(e));
15252 }
15253 },
15254 };
15255 request_value_reader
15256 .seek(std::io::SeekFrom::Start(0))
15257 .unwrap();
15258 let mut req_result = {
15259 let client = &self.hub.client;
15260 dlg.pre_request();
15261 let mut req_builder = hyper::Request::builder()
15262 .method(hyper::Method::PATCH)
15263 .uri(url.as_str())
15264 .header(USER_AGENT, self.hub._user_agent.clone());
15265
15266 if let Some(token) = token.as_ref() {
15267 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15268 }
15269
15270 let request = req_builder
15271 .header(CONTENT_TYPE, json_mime_type.to_string())
15272 .header(CONTENT_LENGTH, request_size as u64)
15273 .body(common::to_body(
15274 request_value_reader.get_ref().clone().into(),
15275 ));
15276
15277 client.request(request.unwrap()).await
15278 };
15279
15280 match req_result {
15281 Err(err) => {
15282 if let common::Retry::After(d) = dlg.http_error(&err) {
15283 sleep(d).await;
15284 continue;
15285 }
15286 dlg.finished(false);
15287 return Err(common::Error::HttpError(err));
15288 }
15289 Ok(res) => {
15290 let (mut parts, body) = res.into_parts();
15291 let mut body = common::Body::new(body);
15292 if !parts.status.is_success() {
15293 let bytes = common::to_bytes(body).await.unwrap_or_default();
15294 let error = serde_json::from_str(&common::to_string(&bytes));
15295 let response = common::to_response(parts, bytes.into());
15296
15297 if let common::Retry::After(d) =
15298 dlg.http_failure(&response, error.as_ref().ok())
15299 {
15300 sleep(d).await;
15301 continue;
15302 }
15303
15304 dlg.finished(false);
15305
15306 return Err(match error {
15307 Ok(value) => common::Error::BadRequest(value),
15308 _ => common::Error::Failure(response),
15309 });
15310 }
15311 let response = {
15312 let bytes = common::to_bytes(body).await.unwrap_or_default();
15313 let encoded = common::to_string(&bytes);
15314 match serde_json::from_str(&encoded) {
15315 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15316 Err(error) => {
15317 dlg.response_json_decode_error(&encoded, &error);
15318 return Err(common::Error::JsonDecodeError(
15319 encoded.to_string(),
15320 error,
15321 ));
15322 }
15323 }
15324 };
15325
15326 dlg.finished(true);
15327 return Ok(response);
15328 }
15329 }
15330 }
15331 }
15332
15333 ///
15334 /// Sets the *request* property to the given value.
15335 ///
15336 /// Even though the property as already been set when instantiating this call,
15337 /// we provide this method for API completeness.
15338 pub fn request(
15339 mut self,
15340 new_value: CertificateTemplate,
15341 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15342 self._request = new_value;
15343 self
15344 }
15345 /// Identifier. The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`.
15346 ///
15347 /// Sets the *name* path property to the given value.
15348 ///
15349 /// Even though the property as already been set when instantiating this call,
15350 /// we provide this method for API completeness.
15351 pub fn name(mut self, new_value: &str) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15352 self._name = new_value.to_string();
15353 self
15354 }
15355 /// Required. A list of fields to be updated in this request.
15356 ///
15357 /// Sets the *update mask* query property to the given value.
15358 pub fn update_mask(
15359 mut self,
15360 new_value: common::FieldMask,
15361 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15362 self._update_mask = Some(new_value);
15363 self
15364 }
15365 /// Optional. An ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
15366 ///
15367 /// Sets the *request id* query property to the given value.
15368 pub fn request_id(
15369 mut self,
15370 new_value: &str,
15371 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15372 self._request_id = Some(new_value.to_string());
15373 self
15374 }
15375 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15376 /// while executing the actual API request.
15377 ///
15378 /// ````text
15379 /// It should be used to handle progress information, and to implement a certain level of resilience.
15380 /// ````
15381 ///
15382 /// Sets the *delegate* property to the given value.
15383 pub fn delegate(
15384 mut self,
15385 new_value: &'a mut dyn common::Delegate,
15386 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15387 self._delegate = Some(new_value);
15388 self
15389 }
15390
15391 /// Set any additional parameter of the query string used in the request.
15392 /// It should be used to set parameters which are not yet available through their own
15393 /// setters.
15394 ///
15395 /// Please note that this method must not be used to set any of the known parameters
15396 /// which have their own setter method. If done anyway, the request will fail.
15397 ///
15398 /// # Additional Parameters
15399 ///
15400 /// * *$.xgafv* (query-string) - V1 error format.
15401 /// * *access_token* (query-string) - OAuth access token.
15402 /// * *alt* (query-string) - Data format for response.
15403 /// * *callback* (query-string) - JSONP
15404 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15405 /// * *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.
15406 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15407 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15408 /// * *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.
15409 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15410 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15411 pub fn param<T>(
15412 mut self,
15413 name: T,
15414 value: T,
15415 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C>
15416 where
15417 T: AsRef<str>,
15418 {
15419 self._additional_params
15420 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15421 self
15422 }
15423
15424 /// Identifies the authorization scope for the method you are building.
15425 ///
15426 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15427 /// [`Scope::CloudPlatform`].
15428 ///
15429 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15430 /// tokens for more than one scope.
15431 ///
15432 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15433 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15434 /// sufficient, a read-write scope will do as well.
15435 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCertificateTemplatePatchCall<'a, C>
15436 where
15437 St: AsRef<str>,
15438 {
15439 self._scopes.insert(String::from(scope.as_ref()));
15440 self
15441 }
15442 /// Identifies the authorization scope(s) for the method you are building.
15443 ///
15444 /// See [`Self::add_scope()`] for details.
15445 pub fn add_scopes<I, St>(
15446 mut self,
15447 scopes: I,
15448 ) -> ProjectLocationCertificateTemplatePatchCall<'a, C>
15449 where
15450 I: IntoIterator<Item = St>,
15451 St: AsRef<str>,
15452 {
15453 self._scopes
15454 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15455 self
15456 }
15457
15458 /// Removes all scopes, and no default scope will be used either.
15459 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15460 /// for details).
15461 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplatePatchCall<'a, C> {
15462 self._scopes.clear();
15463 self
15464 }
15465}
15466
15467/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
15468///
15469/// A builder for the *locations.certificateTemplates.setIamPolicy* method supported by a *project* resource.
15470/// It is not used directly, but through a [`ProjectMethods`] instance.
15471///
15472/// # Example
15473///
15474/// Instantiate a resource method builder
15475///
15476/// ```test_harness,no_run
15477/// # extern crate hyper;
15478/// # extern crate hyper_rustls;
15479/// # extern crate google_privateca1 as privateca1;
15480/// use privateca1::api::SetIamPolicyRequest;
15481/// # async fn dox() {
15482/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15483///
15484/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15485/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15486/// # .with_native_roots()
15487/// # .unwrap()
15488/// # .https_only()
15489/// # .enable_http2()
15490/// # .build();
15491///
15492/// # let executor = hyper_util::rt::TokioExecutor::new();
15493/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15494/// # secret,
15495/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15496/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15497/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15498/// # ),
15499/// # ).build().await.unwrap();
15500///
15501/// # let client = hyper_util::client::legacy::Client::builder(
15502/// # hyper_util::rt::TokioExecutor::new()
15503/// # )
15504/// # .build(
15505/// # hyper_rustls::HttpsConnectorBuilder::new()
15506/// # .with_native_roots()
15507/// # .unwrap()
15508/// # .https_or_http()
15509/// # .enable_http2()
15510/// # .build()
15511/// # );
15512/// # let mut hub = CertificateAuthorityService::new(client, auth);
15513/// // As the method needs a request, you would usually fill it with the desired information
15514/// // into the respective structure. Some of the parts shown here might not be applicable !
15515/// // Values shown here are possibly random and not representative !
15516/// let mut req = SetIamPolicyRequest::default();
15517///
15518/// // You can configure optional parameters by calling the respective setters at will, and
15519/// // execute the final call using `doit()`.
15520/// // Values shown here are possibly random and not representative !
15521/// let result = hub.projects().locations_certificate_templates_set_iam_policy(req, "resource")
15522/// .doit().await;
15523/// # }
15524/// ```
15525pub struct ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C>
15526where
15527 C: 'a,
15528{
15529 hub: &'a CertificateAuthorityService<C>,
15530 _request: SetIamPolicyRequest,
15531 _resource: String,
15532 _delegate: Option<&'a mut dyn common::Delegate>,
15533 _additional_params: HashMap<String, String>,
15534 _scopes: BTreeSet<String>,
15535}
15536
15537impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {}
15538
15539impl<'a, C> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C>
15540where
15541 C: common::Connector,
15542{
15543 /// Perform the operation you have build so far.
15544 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15545 use std::borrow::Cow;
15546 use std::io::{Read, Seek};
15547
15548 use common::{url::Params, ToParts};
15549 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15550
15551 let mut dd = common::DefaultDelegate;
15552 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15553 dlg.begin(common::MethodInfo {
15554 id: "privateca.projects.locations.certificateTemplates.setIamPolicy",
15555 http_method: hyper::Method::POST,
15556 });
15557
15558 for &field in ["alt", "resource"].iter() {
15559 if self._additional_params.contains_key(field) {
15560 dlg.finished(false);
15561 return Err(common::Error::FieldClash(field));
15562 }
15563 }
15564
15565 let mut params = Params::with_capacity(4 + self._additional_params.len());
15566 params.push("resource", self._resource);
15567
15568 params.extend(self._additional_params.iter());
15569
15570 params.push("alt", "json");
15571 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
15572 if self._scopes.is_empty() {
15573 self._scopes
15574 .insert(Scope::CloudPlatform.as_ref().to_string());
15575 }
15576
15577 #[allow(clippy::single_element_loop)]
15578 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15579 url = params.uri_replacement(url, param_name, find_this, true);
15580 }
15581 {
15582 let to_remove = ["resource"];
15583 params.remove_params(&to_remove);
15584 }
15585
15586 let url = params.parse_with_url(&url);
15587
15588 let mut json_mime_type = mime::APPLICATION_JSON;
15589 let mut request_value_reader = {
15590 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15591 common::remove_json_null_values(&mut value);
15592 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15593 serde_json::to_writer(&mut dst, &value).unwrap();
15594 dst
15595 };
15596 let request_size = request_value_reader
15597 .seek(std::io::SeekFrom::End(0))
15598 .unwrap();
15599 request_value_reader
15600 .seek(std::io::SeekFrom::Start(0))
15601 .unwrap();
15602
15603 loop {
15604 let token = match self
15605 .hub
15606 .auth
15607 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15608 .await
15609 {
15610 Ok(token) => token,
15611 Err(e) => match dlg.token(e) {
15612 Ok(token) => token,
15613 Err(e) => {
15614 dlg.finished(false);
15615 return Err(common::Error::MissingToken(e));
15616 }
15617 },
15618 };
15619 request_value_reader
15620 .seek(std::io::SeekFrom::Start(0))
15621 .unwrap();
15622 let mut req_result = {
15623 let client = &self.hub.client;
15624 dlg.pre_request();
15625 let mut req_builder = hyper::Request::builder()
15626 .method(hyper::Method::POST)
15627 .uri(url.as_str())
15628 .header(USER_AGENT, self.hub._user_agent.clone());
15629
15630 if let Some(token) = token.as_ref() {
15631 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15632 }
15633
15634 let request = req_builder
15635 .header(CONTENT_TYPE, json_mime_type.to_string())
15636 .header(CONTENT_LENGTH, request_size as u64)
15637 .body(common::to_body(
15638 request_value_reader.get_ref().clone().into(),
15639 ));
15640
15641 client.request(request.unwrap()).await
15642 };
15643
15644 match req_result {
15645 Err(err) => {
15646 if let common::Retry::After(d) = dlg.http_error(&err) {
15647 sleep(d).await;
15648 continue;
15649 }
15650 dlg.finished(false);
15651 return Err(common::Error::HttpError(err));
15652 }
15653 Ok(res) => {
15654 let (mut parts, body) = res.into_parts();
15655 let mut body = common::Body::new(body);
15656 if !parts.status.is_success() {
15657 let bytes = common::to_bytes(body).await.unwrap_or_default();
15658 let error = serde_json::from_str(&common::to_string(&bytes));
15659 let response = common::to_response(parts, bytes.into());
15660
15661 if let common::Retry::After(d) =
15662 dlg.http_failure(&response, error.as_ref().ok())
15663 {
15664 sleep(d).await;
15665 continue;
15666 }
15667
15668 dlg.finished(false);
15669
15670 return Err(match error {
15671 Ok(value) => common::Error::BadRequest(value),
15672 _ => common::Error::Failure(response),
15673 });
15674 }
15675 let response = {
15676 let bytes = common::to_bytes(body).await.unwrap_or_default();
15677 let encoded = common::to_string(&bytes);
15678 match serde_json::from_str(&encoded) {
15679 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15680 Err(error) => {
15681 dlg.response_json_decode_error(&encoded, &error);
15682 return Err(common::Error::JsonDecodeError(
15683 encoded.to_string(),
15684 error,
15685 ));
15686 }
15687 }
15688 };
15689
15690 dlg.finished(true);
15691 return Ok(response);
15692 }
15693 }
15694 }
15695 }
15696
15697 ///
15698 /// Sets the *request* property to the given value.
15699 ///
15700 /// Even though the property as already been set when instantiating this call,
15701 /// we provide this method for API completeness.
15702 pub fn request(
15703 mut self,
15704 new_value: SetIamPolicyRequest,
15705 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {
15706 self._request = new_value;
15707 self
15708 }
15709 /// 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.
15710 ///
15711 /// Sets the *resource* path property to the given value.
15712 ///
15713 /// Even though the property as already been set when instantiating this call,
15714 /// we provide this method for API completeness.
15715 pub fn resource(
15716 mut self,
15717 new_value: &str,
15718 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {
15719 self._resource = new_value.to_string();
15720 self
15721 }
15722 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15723 /// while executing the actual API request.
15724 ///
15725 /// ````text
15726 /// It should be used to handle progress information, and to implement a certain level of resilience.
15727 /// ````
15728 ///
15729 /// Sets the *delegate* property to the given value.
15730 pub fn delegate(
15731 mut self,
15732 new_value: &'a mut dyn common::Delegate,
15733 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {
15734 self._delegate = Some(new_value);
15735 self
15736 }
15737
15738 /// Set any additional parameter of the query string used in the request.
15739 /// It should be used to set parameters which are not yet available through their own
15740 /// setters.
15741 ///
15742 /// Please note that this method must not be used to set any of the known parameters
15743 /// which have their own setter method. If done anyway, the request will fail.
15744 ///
15745 /// # Additional Parameters
15746 ///
15747 /// * *$.xgafv* (query-string) - V1 error format.
15748 /// * *access_token* (query-string) - OAuth access token.
15749 /// * *alt* (query-string) - Data format for response.
15750 /// * *callback* (query-string) - JSONP
15751 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15752 /// * *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.
15753 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15754 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15755 /// * *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.
15756 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15757 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15758 pub fn param<T>(
15759 mut self,
15760 name: T,
15761 value: T,
15762 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C>
15763 where
15764 T: AsRef<str>,
15765 {
15766 self._additional_params
15767 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15768 self
15769 }
15770
15771 /// Identifies the authorization scope for the method you are building.
15772 ///
15773 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15774 /// [`Scope::CloudPlatform`].
15775 ///
15776 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15777 /// tokens for more than one scope.
15778 ///
15779 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15780 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15781 /// sufficient, a read-write scope will do as well.
15782 pub fn add_scope<St>(
15783 mut self,
15784 scope: St,
15785 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C>
15786 where
15787 St: AsRef<str>,
15788 {
15789 self._scopes.insert(String::from(scope.as_ref()));
15790 self
15791 }
15792 /// Identifies the authorization scope(s) for the method you are building.
15793 ///
15794 /// See [`Self::add_scope()`] for details.
15795 pub fn add_scopes<I, St>(
15796 mut self,
15797 scopes: I,
15798 ) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C>
15799 where
15800 I: IntoIterator<Item = St>,
15801 St: AsRef<str>,
15802 {
15803 self._scopes
15804 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15805 self
15806 }
15807
15808 /// Removes all scopes, and no default scope will be used either.
15809 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15810 /// for details).
15811 pub fn clear_scopes(mut self) -> ProjectLocationCertificateTemplateSetIamPolicyCall<'a, C> {
15812 self._scopes.clear();
15813 self
15814 }
15815}
15816
15817/// 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.
15818///
15819/// A builder for the *locations.certificateTemplates.testIamPermissions* method supported by a *project* resource.
15820/// It is not used directly, but through a [`ProjectMethods`] instance.
15821///
15822/// # Example
15823///
15824/// Instantiate a resource method builder
15825///
15826/// ```test_harness,no_run
15827/// # extern crate hyper;
15828/// # extern crate hyper_rustls;
15829/// # extern crate google_privateca1 as privateca1;
15830/// use privateca1::api::TestIamPermissionsRequest;
15831/// # async fn dox() {
15832/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15833///
15834/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15835/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15836/// # .with_native_roots()
15837/// # .unwrap()
15838/// # .https_only()
15839/// # .enable_http2()
15840/// # .build();
15841///
15842/// # let executor = hyper_util::rt::TokioExecutor::new();
15843/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15844/// # secret,
15845/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15846/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15847/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15848/// # ),
15849/// # ).build().await.unwrap();
15850///
15851/// # let client = hyper_util::client::legacy::Client::builder(
15852/// # hyper_util::rt::TokioExecutor::new()
15853/// # )
15854/// # .build(
15855/// # hyper_rustls::HttpsConnectorBuilder::new()
15856/// # .with_native_roots()
15857/// # .unwrap()
15858/// # .https_or_http()
15859/// # .enable_http2()
15860/// # .build()
15861/// # );
15862/// # let mut hub = CertificateAuthorityService::new(client, auth);
15863/// // As the method needs a request, you would usually fill it with the desired information
15864/// // into the respective structure. Some of the parts shown here might not be applicable !
15865/// // Values shown here are possibly random and not representative !
15866/// let mut req = TestIamPermissionsRequest::default();
15867///
15868/// // You can configure optional parameters by calling the respective setters at will, and
15869/// // execute the final call using `doit()`.
15870/// // Values shown here are possibly random and not representative !
15871/// let result = hub.projects().locations_certificate_templates_test_iam_permissions(req, "resource")
15872/// .doit().await;
15873/// # }
15874/// ```
15875pub struct ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C>
15876where
15877 C: 'a,
15878{
15879 hub: &'a CertificateAuthorityService<C>,
15880 _request: TestIamPermissionsRequest,
15881 _resource: String,
15882 _delegate: Option<&'a mut dyn common::Delegate>,
15883 _additional_params: HashMap<String, String>,
15884 _scopes: BTreeSet<String>,
15885}
15886
15887impl<'a, C> common::CallBuilder for ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {}
15888
15889impl<'a, C> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C>
15890where
15891 C: common::Connector,
15892{
15893 /// Perform the operation you have build so far.
15894 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
15895 use std::borrow::Cow;
15896 use std::io::{Read, Seek};
15897
15898 use common::{url::Params, ToParts};
15899 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15900
15901 let mut dd = common::DefaultDelegate;
15902 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15903 dlg.begin(common::MethodInfo {
15904 id: "privateca.projects.locations.certificateTemplates.testIamPermissions",
15905 http_method: hyper::Method::POST,
15906 });
15907
15908 for &field in ["alt", "resource"].iter() {
15909 if self._additional_params.contains_key(field) {
15910 dlg.finished(false);
15911 return Err(common::Error::FieldClash(field));
15912 }
15913 }
15914
15915 let mut params = Params::with_capacity(4 + self._additional_params.len());
15916 params.push("resource", self._resource);
15917
15918 params.extend(self._additional_params.iter());
15919
15920 params.push("alt", "json");
15921 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
15922 if self._scopes.is_empty() {
15923 self._scopes
15924 .insert(Scope::CloudPlatform.as_ref().to_string());
15925 }
15926
15927 #[allow(clippy::single_element_loop)]
15928 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15929 url = params.uri_replacement(url, param_name, find_this, true);
15930 }
15931 {
15932 let to_remove = ["resource"];
15933 params.remove_params(&to_remove);
15934 }
15935
15936 let url = params.parse_with_url(&url);
15937
15938 let mut json_mime_type = mime::APPLICATION_JSON;
15939 let mut request_value_reader = {
15940 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15941 common::remove_json_null_values(&mut value);
15942 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15943 serde_json::to_writer(&mut dst, &value).unwrap();
15944 dst
15945 };
15946 let request_size = request_value_reader
15947 .seek(std::io::SeekFrom::End(0))
15948 .unwrap();
15949 request_value_reader
15950 .seek(std::io::SeekFrom::Start(0))
15951 .unwrap();
15952
15953 loop {
15954 let token = match self
15955 .hub
15956 .auth
15957 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15958 .await
15959 {
15960 Ok(token) => token,
15961 Err(e) => match dlg.token(e) {
15962 Ok(token) => token,
15963 Err(e) => {
15964 dlg.finished(false);
15965 return Err(common::Error::MissingToken(e));
15966 }
15967 },
15968 };
15969 request_value_reader
15970 .seek(std::io::SeekFrom::Start(0))
15971 .unwrap();
15972 let mut req_result = {
15973 let client = &self.hub.client;
15974 dlg.pre_request();
15975 let mut req_builder = hyper::Request::builder()
15976 .method(hyper::Method::POST)
15977 .uri(url.as_str())
15978 .header(USER_AGENT, self.hub._user_agent.clone());
15979
15980 if let Some(token) = token.as_ref() {
15981 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15982 }
15983
15984 let request = req_builder
15985 .header(CONTENT_TYPE, json_mime_type.to_string())
15986 .header(CONTENT_LENGTH, request_size as u64)
15987 .body(common::to_body(
15988 request_value_reader.get_ref().clone().into(),
15989 ));
15990
15991 client.request(request.unwrap()).await
15992 };
15993
15994 match req_result {
15995 Err(err) => {
15996 if let common::Retry::After(d) = dlg.http_error(&err) {
15997 sleep(d).await;
15998 continue;
15999 }
16000 dlg.finished(false);
16001 return Err(common::Error::HttpError(err));
16002 }
16003 Ok(res) => {
16004 let (mut parts, body) = res.into_parts();
16005 let mut body = common::Body::new(body);
16006 if !parts.status.is_success() {
16007 let bytes = common::to_bytes(body).await.unwrap_or_default();
16008 let error = serde_json::from_str(&common::to_string(&bytes));
16009 let response = common::to_response(parts, bytes.into());
16010
16011 if let common::Retry::After(d) =
16012 dlg.http_failure(&response, error.as_ref().ok())
16013 {
16014 sleep(d).await;
16015 continue;
16016 }
16017
16018 dlg.finished(false);
16019
16020 return Err(match error {
16021 Ok(value) => common::Error::BadRequest(value),
16022 _ => common::Error::Failure(response),
16023 });
16024 }
16025 let response = {
16026 let bytes = common::to_bytes(body).await.unwrap_or_default();
16027 let encoded = common::to_string(&bytes);
16028 match serde_json::from_str(&encoded) {
16029 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16030 Err(error) => {
16031 dlg.response_json_decode_error(&encoded, &error);
16032 return Err(common::Error::JsonDecodeError(
16033 encoded.to_string(),
16034 error,
16035 ));
16036 }
16037 }
16038 };
16039
16040 dlg.finished(true);
16041 return Ok(response);
16042 }
16043 }
16044 }
16045 }
16046
16047 ///
16048 /// Sets the *request* property to the given value.
16049 ///
16050 /// Even though the property as already been set when instantiating this call,
16051 /// we provide this method for API completeness.
16052 pub fn request(
16053 mut self,
16054 new_value: TestIamPermissionsRequest,
16055 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {
16056 self._request = new_value;
16057 self
16058 }
16059 /// 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.
16060 ///
16061 /// Sets the *resource* path property to the given value.
16062 ///
16063 /// Even though the property as already been set when instantiating this call,
16064 /// we provide this method for API completeness.
16065 pub fn resource(
16066 mut self,
16067 new_value: &str,
16068 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {
16069 self._resource = new_value.to_string();
16070 self
16071 }
16072 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16073 /// while executing the actual API request.
16074 ///
16075 /// ````text
16076 /// It should be used to handle progress information, and to implement a certain level of resilience.
16077 /// ````
16078 ///
16079 /// Sets the *delegate* property to the given value.
16080 pub fn delegate(
16081 mut self,
16082 new_value: &'a mut dyn common::Delegate,
16083 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {
16084 self._delegate = Some(new_value);
16085 self
16086 }
16087
16088 /// Set any additional parameter of the query string used in the request.
16089 /// It should be used to set parameters which are not yet available through their own
16090 /// setters.
16091 ///
16092 /// Please note that this method must not be used to set any of the known parameters
16093 /// which have their own setter method. If done anyway, the request will fail.
16094 ///
16095 /// # Additional Parameters
16096 ///
16097 /// * *$.xgafv* (query-string) - V1 error format.
16098 /// * *access_token* (query-string) - OAuth access token.
16099 /// * *alt* (query-string) - Data format for response.
16100 /// * *callback* (query-string) - JSONP
16101 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16102 /// * *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.
16103 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16104 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16105 /// * *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.
16106 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16107 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16108 pub fn param<T>(
16109 mut self,
16110 name: T,
16111 value: T,
16112 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C>
16113 where
16114 T: AsRef<str>,
16115 {
16116 self._additional_params
16117 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16118 self
16119 }
16120
16121 /// Identifies the authorization scope for the method you are building.
16122 ///
16123 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16124 /// [`Scope::CloudPlatform`].
16125 ///
16126 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16127 /// tokens for more than one scope.
16128 ///
16129 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16130 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16131 /// sufficient, a read-write scope will do as well.
16132 pub fn add_scope<St>(
16133 mut self,
16134 scope: St,
16135 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C>
16136 where
16137 St: AsRef<str>,
16138 {
16139 self._scopes.insert(String::from(scope.as_ref()));
16140 self
16141 }
16142 /// Identifies the authorization scope(s) for the method you are building.
16143 ///
16144 /// See [`Self::add_scope()`] for details.
16145 pub fn add_scopes<I, St>(
16146 mut self,
16147 scopes: I,
16148 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C>
16149 where
16150 I: IntoIterator<Item = St>,
16151 St: AsRef<str>,
16152 {
16153 self._scopes
16154 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16155 self
16156 }
16157
16158 /// Removes all scopes, and no default scope will be used either.
16159 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16160 /// for details).
16161 pub fn clear_scopes(
16162 mut self,
16163 ) -> ProjectLocationCertificateTemplateTestIamPermissionCall<'a, C> {
16164 self._scopes.clear();
16165 self
16166 }
16167}
16168
16169/// 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`.
16170///
16171/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
16172/// It is not used directly, but through a [`ProjectMethods`] instance.
16173///
16174/// # Example
16175///
16176/// Instantiate a resource method builder
16177///
16178/// ```test_harness,no_run
16179/// # extern crate hyper;
16180/// # extern crate hyper_rustls;
16181/// # extern crate google_privateca1 as privateca1;
16182/// use privateca1::api::CancelOperationRequest;
16183/// # async fn dox() {
16184/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16185///
16186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16188/// # .with_native_roots()
16189/// # .unwrap()
16190/// # .https_only()
16191/// # .enable_http2()
16192/// # .build();
16193///
16194/// # let executor = hyper_util::rt::TokioExecutor::new();
16195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16196/// # secret,
16197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16200/// # ),
16201/// # ).build().await.unwrap();
16202///
16203/// # let client = hyper_util::client::legacy::Client::builder(
16204/// # hyper_util::rt::TokioExecutor::new()
16205/// # )
16206/// # .build(
16207/// # hyper_rustls::HttpsConnectorBuilder::new()
16208/// # .with_native_roots()
16209/// # .unwrap()
16210/// # .https_or_http()
16211/// # .enable_http2()
16212/// # .build()
16213/// # );
16214/// # let mut hub = CertificateAuthorityService::new(client, auth);
16215/// // As the method needs a request, you would usually fill it with the desired information
16216/// // into the respective structure. Some of the parts shown here might not be applicable !
16217/// // Values shown here are possibly random and not representative !
16218/// let mut req = CancelOperationRequest::default();
16219///
16220/// // You can configure optional parameters by calling the respective setters at will, and
16221/// // execute the final call using `doit()`.
16222/// // Values shown here are possibly random and not representative !
16223/// let result = hub.projects().locations_operations_cancel(req, "name")
16224/// .doit().await;
16225/// # }
16226/// ```
16227pub struct ProjectLocationOperationCancelCall<'a, C>
16228where
16229 C: 'a,
16230{
16231 hub: &'a CertificateAuthorityService<C>,
16232 _request: CancelOperationRequest,
16233 _name: String,
16234 _delegate: Option<&'a mut dyn common::Delegate>,
16235 _additional_params: HashMap<String, String>,
16236 _scopes: BTreeSet<String>,
16237}
16238
16239impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
16240
16241impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
16242where
16243 C: common::Connector,
16244{
16245 /// Perform the operation you have build so far.
16246 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16247 use std::borrow::Cow;
16248 use std::io::{Read, Seek};
16249
16250 use common::{url::Params, ToParts};
16251 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16252
16253 let mut dd = common::DefaultDelegate;
16254 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16255 dlg.begin(common::MethodInfo {
16256 id: "privateca.projects.locations.operations.cancel",
16257 http_method: hyper::Method::POST,
16258 });
16259
16260 for &field in ["alt", "name"].iter() {
16261 if self._additional_params.contains_key(field) {
16262 dlg.finished(false);
16263 return Err(common::Error::FieldClash(field));
16264 }
16265 }
16266
16267 let mut params = Params::with_capacity(4 + self._additional_params.len());
16268 params.push("name", self._name);
16269
16270 params.extend(self._additional_params.iter());
16271
16272 params.push("alt", "json");
16273 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
16274 if self._scopes.is_empty() {
16275 self._scopes
16276 .insert(Scope::CloudPlatform.as_ref().to_string());
16277 }
16278
16279 #[allow(clippy::single_element_loop)]
16280 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16281 url = params.uri_replacement(url, param_name, find_this, true);
16282 }
16283 {
16284 let to_remove = ["name"];
16285 params.remove_params(&to_remove);
16286 }
16287
16288 let url = params.parse_with_url(&url);
16289
16290 let mut json_mime_type = mime::APPLICATION_JSON;
16291 let mut request_value_reader = {
16292 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16293 common::remove_json_null_values(&mut value);
16294 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16295 serde_json::to_writer(&mut dst, &value).unwrap();
16296 dst
16297 };
16298 let request_size = request_value_reader
16299 .seek(std::io::SeekFrom::End(0))
16300 .unwrap();
16301 request_value_reader
16302 .seek(std::io::SeekFrom::Start(0))
16303 .unwrap();
16304
16305 loop {
16306 let token = match self
16307 .hub
16308 .auth
16309 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16310 .await
16311 {
16312 Ok(token) => token,
16313 Err(e) => match dlg.token(e) {
16314 Ok(token) => token,
16315 Err(e) => {
16316 dlg.finished(false);
16317 return Err(common::Error::MissingToken(e));
16318 }
16319 },
16320 };
16321 request_value_reader
16322 .seek(std::io::SeekFrom::Start(0))
16323 .unwrap();
16324 let mut req_result = {
16325 let client = &self.hub.client;
16326 dlg.pre_request();
16327 let mut req_builder = hyper::Request::builder()
16328 .method(hyper::Method::POST)
16329 .uri(url.as_str())
16330 .header(USER_AGENT, self.hub._user_agent.clone());
16331
16332 if let Some(token) = token.as_ref() {
16333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16334 }
16335
16336 let request = req_builder
16337 .header(CONTENT_TYPE, json_mime_type.to_string())
16338 .header(CONTENT_LENGTH, request_size as u64)
16339 .body(common::to_body(
16340 request_value_reader.get_ref().clone().into(),
16341 ));
16342
16343 client.request(request.unwrap()).await
16344 };
16345
16346 match req_result {
16347 Err(err) => {
16348 if let common::Retry::After(d) = dlg.http_error(&err) {
16349 sleep(d).await;
16350 continue;
16351 }
16352 dlg.finished(false);
16353 return Err(common::Error::HttpError(err));
16354 }
16355 Ok(res) => {
16356 let (mut parts, body) = res.into_parts();
16357 let mut body = common::Body::new(body);
16358 if !parts.status.is_success() {
16359 let bytes = common::to_bytes(body).await.unwrap_or_default();
16360 let error = serde_json::from_str(&common::to_string(&bytes));
16361 let response = common::to_response(parts, bytes.into());
16362
16363 if let common::Retry::After(d) =
16364 dlg.http_failure(&response, error.as_ref().ok())
16365 {
16366 sleep(d).await;
16367 continue;
16368 }
16369
16370 dlg.finished(false);
16371
16372 return Err(match error {
16373 Ok(value) => common::Error::BadRequest(value),
16374 _ => common::Error::Failure(response),
16375 });
16376 }
16377 let response = {
16378 let bytes = common::to_bytes(body).await.unwrap_or_default();
16379 let encoded = common::to_string(&bytes);
16380 match serde_json::from_str(&encoded) {
16381 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16382 Err(error) => {
16383 dlg.response_json_decode_error(&encoded, &error);
16384 return Err(common::Error::JsonDecodeError(
16385 encoded.to_string(),
16386 error,
16387 ));
16388 }
16389 }
16390 };
16391
16392 dlg.finished(true);
16393 return Ok(response);
16394 }
16395 }
16396 }
16397 }
16398
16399 ///
16400 /// Sets the *request* property to the given value.
16401 ///
16402 /// Even though the property as already been set when instantiating this call,
16403 /// we provide this method for API completeness.
16404 pub fn request(
16405 mut self,
16406 new_value: CancelOperationRequest,
16407 ) -> ProjectLocationOperationCancelCall<'a, C> {
16408 self._request = new_value;
16409 self
16410 }
16411 /// The name of the operation resource to be cancelled.
16412 ///
16413 /// Sets the *name* path property to the given value.
16414 ///
16415 /// Even though the property as already been set when instantiating this call,
16416 /// we provide this method for API completeness.
16417 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
16418 self._name = new_value.to_string();
16419 self
16420 }
16421 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16422 /// while executing the actual API request.
16423 ///
16424 /// ````text
16425 /// It should be used to handle progress information, and to implement a certain level of resilience.
16426 /// ````
16427 ///
16428 /// Sets the *delegate* property to the given value.
16429 pub fn delegate(
16430 mut self,
16431 new_value: &'a mut dyn common::Delegate,
16432 ) -> ProjectLocationOperationCancelCall<'a, C> {
16433 self._delegate = Some(new_value);
16434 self
16435 }
16436
16437 /// Set any additional parameter of the query string used in the request.
16438 /// It should be used to set parameters which are not yet available through their own
16439 /// setters.
16440 ///
16441 /// Please note that this method must not be used to set any of the known parameters
16442 /// which have their own setter method. If done anyway, the request will fail.
16443 ///
16444 /// # Additional Parameters
16445 ///
16446 /// * *$.xgafv* (query-string) - V1 error format.
16447 /// * *access_token* (query-string) - OAuth access token.
16448 /// * *alt* (query-string) - Data format for response.
16449 /// * *callback* (query-string) - JSONP
16450 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16451 /// * *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.
16452 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16453 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16454 /// * *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.
16455 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16456 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16457 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
16458 where
16459 T: AsRef<str>,
16460 {
16461 self._additional_params
16462 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16463 self
16464 }
16465
16466 /// Identifies the authorization scope for the method you are building.
16467 ///
16468 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16469 /// [`Scope::CloudPlatform`].
16470 ///
16471 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16472 /// tokens for more than one scope.
16473 ///
16474 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16475 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16476 /// sufficient, a read-write scope will do as well.
16477 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
16478 where
16479 St: AsRef<str>,
16480 {
16481 self._scopes.insert(String::from(scope.as_ref()));
16482 self
16483 }
16484 /// Identifies the authorization scope(s) for the method you are building.
16485 ///
16486 /// See [`Self::add_scope()`] for details.
16487 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
16488 where
16489 I: IntoIterator<Item = St>,
16490 St: AsRef<str>,
16491 {
16492 self._scopes
16493 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16494 self
16495 }
16496
16497 /// Removes all scopes, and no default scope will be used either.
16498 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16499 /// for details).
16500 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
16501 self._scopes.clear();
16502 self
16503 }
16504}
16505
16506/// 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`.
16507///
16508/// A builder for the *locations.operations.delete* method supported by a *project* resource.
16509/// It is not used directly, but through a [`ProjectMethods`] instance.
16510///
16511/// # Example
16512///
16513/// Instantiate a resource method builder
16514///
16515/// ```test_harness,no_run
16516/// # extern crate hyper;
16517/// # extern crate hyper_rustls;
16518/// # extern crate google_privateca1 as privateca1;
16519/// # async fn dox() {
16520/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16521///
16522/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16523/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16524/// # .with_native_roots()
16525/// # .unwrap()
16526/// # .https_only()
16527/// # .enable_http2()
16528/// # .build();
16529///
16530/// # let executor = hyper_util::rt::TokioExecutor::new();
16531/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16532/// # secret,
16533/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16534/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16535/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16536/// # ),
16537/// # ).build().await.unwrap();
16538///
16539/// # let client = hyper_util::client::legacy::Client::builder(
16540/// # hyper_util::rt::TokioExecutor::new()
16541/// # )
16542/// # .build(
16543/// # hyper_rustls::HttpsConnectorBuilder::new()
16544/// # .with_native_roots()
16545/// # .unwrap()
16546/// # .https_or_http()
16547/// # .enable_http2()
16548/// # .build()
16549/// # );
16550/// # let mut hub = CertificateAuthorityService::new(client, auth);
16551/// // You can configure optional parameters by calling the respective setters at will, and
16552/// // execute the final call using `doit()`.
16553/// // Values shown here are possibly random and not representative !
16554/// let result = hub.projects().locations_operations_delete("name")
16555/// .doit().await;
16556/// # }
16557/// ```
16558pub struct ProjectLocationOperationDeleteCall<'a, C>
16559where
16560 C: 'a,
16561{
16562 hub: &'a CertificateAuthorityService<C>,
16563 _name: String,
16564 _delegate: Option<&'a mut dyn common::Delegate>,
16565 _additional_params: HashMap<String, String>,
16566 _scopes: BTreeSet<String>,
16567}
16568
16569impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
16570
16571impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
16572where
16573 C: common::Connector,
16574{
16575 /// Perform the operation you have build so far.
16576 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16577 use std::borrow::Cow;
16578 use std::io::{Read, Seek};
16579
16580 use common::{url::Params, ToParts};
16581 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16582
16583 let mut dd = common::DefaultDelegate;
16584 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16585 dlg.begin(common::MethodInfo {
16586 id: "privateca.projects.locations.operations.delete",
16587 http_method: hyper::Method::DELETE,
16588 });
16589
16590 for &field in ["alt", "name"].iter() {
16591 if self._additional_params.contains_key(field) {
16592 dlg.finished(false);
16593 return Err(common::Error::FieldClash(field));
16594 }
16595 }
16596
16597 let mut params = Params::with_capacity(3 + self._additional_params.len());
16598 params.push("name", self._name);
16599
16600 params.extend(self._additional_params.iter());
16601
16602 params.push("alt", "json");
16603 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16604 if self._scopes.is_empty() {
16605 self._scopes
16606 .insert(Scope::CloudPlatform.as_ref().to_string());
16607 }
16608
16609 #[allow(clippy::single_element_loop)]
16610 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16611 url = params.uri_replacement(url, param_name, find_this, true);
16612 }
16613 {
16614 let to_remove = ["name"];
16615 params.remove_params(&to_remove);
16616 }
16617
16618 let url = params.parse_with_url(&url);
16619
16620 loop {
16621 let token = match self
16622 .hub
16623 .auth
16624 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16625 .await
16626 {
16627 Ok(token) => token,
16628 Err(e) => match dlg.token(e) {
16629 Ok(token) => token,
16630 Err(e) => {
16631 dlg.finished(false);
16632 return Err(common::Error::MissingToken(e));
16633 }
16634 },
16635 };
16636 let mut req_result = {
16637 let client = &self.hub.client;
16638 dlg.pre_request();
16639 let mut req_builder = hyper::Request::builder()
16640 .method(hyper::Method::DELETE)
16641 .uri(url.as_str())
16642 .header(USER_AGENT, self.hub._user_agent.clone());
16643
16644 if let Some(token) = token.as_ref() {
16645 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16646 }
16647
16648 let request = req_builder
16649 .header(CONTENT_LENGTH, 0_u64)
16650 .body(common::to_body::<String>(None));
16651
16652 client.request(request.unwrap()).await
16653 };
16654
16655 match req_result {
16656 Err(err) => {
16657 if let common::Retry::After(d) = dlg.http_error(&err) {
16658 sleep(d).await;
16659 continue;
16660 }
16661 dlg.finished(false);
16662 return Err(common::Error::HttpError(err));
16663 }
16664 Ok(res) => {
16665 let (mut parts, body) = res.into_parts();
16666 let mut body = common::Body::new(body);
16667 if !parts.status.is_success() {
16668 let bytes = common::to_bytes(body).await.unwrap_or_default();
16669 let error = serde_json::from_str(&common::to_string(&bytes));
16670 let response = common::to_response(parts, bytes.into());
16671
16672 if let common::Retry::After(d) =
16673 dlg.http_failure(&response, error.as_ref().ok())
16674 {
16675 sleep(d).await;
16676 continue;
16677 }
16678
16679 dlg.finished(false);
16680
16681 return Err(match error {
16682 Ok(value) => common::Error::BadRequest(value),
16683 _ => common::Error::Failure(response),
16684 });
16685 }
16686 let response = {
16687 let bytes = common::to_bytes(body).await.unwrap_or_default();
16688 let encoded = common::to_string(&bytes);
16689 match serde_json::from_str(&encoded) {
16690 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16691 Err(error) => {
16692 dlg.response_json_decode_error(&encoded, &error);
16693 return Err(common::Error::JsonDecodeError(
16694 encoded.to_string(),
16695 error,
16696 ));
16697 }
16698 }
16699 };
16700
16701 dlg.finished(true);
16702 return Ok(response);
16703 }
16704 }
16705 }
16706 }
16707
16708 /// The name of the operation resource to be deleted.
16709 ///
16710 /// Sets the *name* path property to the given value.
16711 ///
16712 /// Even though the property as already been set when instantiating this call,
16713 /// we provide this method for API completeness.
16714 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
16715 self._name = new_value.to_string();
16716 self
16717 }
16718 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16719 /// while executing the actual API request.
16720 ///
16721 /// ````text
16722 /// It should be used to handle progress information, and to implement a certain level of resilience.
16723 /// ````
16724 ///
16725 /// Sets the *delegate* property to the given value.
16726 pub fn delegate(
16727 mut self,
16728 new_value: &'a mut dyn common::Delegate,
16729 ) -> ProjectLocationOperationDeleteCall<'a, C> {
16730 self._delegate = Some(new_value);
16731 self
16732 }
16733
16734 /// Set any additional parameter of the query string used in the request.
16735 /// It should be used to set parameters which are not yet available through their own
16736 /// setters.
16737 ///
16738 /// Please note that this method must not be used to set any of the known parameters
16739 /// which have their own setter method. If done anyway, the request will fail.
16740 ///
16741 /// # Additional Parameters
16742 ///
16743 /// * *$.xgafv* (query-string) - V1 error format.
16744 /// * *access_token* (query-string) - OAuth access token.
16745 /// * *alt* (query-string) - Data format for response.
16746 /// * *callback* (query-string) - JSONP
16747 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16748 /// * *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.
16749 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16750 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16751 /// * *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.
16752 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16753 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16754 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
16755 where
16756 T: AsRef<str>,
16757 {
16758 self._additional_params
16759 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16760 self
16761 }
16762
16763 /// Identifies the authorization scope for the method you are building.
16764 ///
16765 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16766 /// [`Scope::CloudPlatform`].
16767 ///
16768 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16769 /// tokens for more than one scope.
16770 ///
16771 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16772 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16773 /// sufficient, a read-write scope will do as well.
16774 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
16775 where
16776 St: AsRef<str>,
16777 {
16778 self._scopes.insert(String::from(scope.as_ref()));
16779 self
16780 }
16781 /// Identifies the authorization scope(s) for the method you are building.
16782 ///
16783 /// See [`Self::add_scope()`] for details.
16784 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
16785 where
16786 I: IntoIterator<Item = St>,
16787 St: AsRef<str>,
16788 {
16789 self._scopes
16790 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16791 self
16792 }
16793
16794 /// Removes all scopes, and no default scope will be used either.
16795 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16796 /// for details).
16797 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
16798 self._scopes.clear();
16799 self
16800 }
16801}
16802
16803/// 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.
16804///
16805/// A builder for the *locations.operations.get* method supported by a *project* resource.
16806/// It is not used directly, but through a [`ProjectMethods`] instance.
16807///
16808/// # Example
16809///
16810/// Instantiate a resource method builder
16811///
16812/// ```test_harness,no_run
16813/// # extern crate hyper;
16814/// # extern crate hyper_rustls;
16815/// # extern crate google_privateca1 as privateca1;
16816/// # async fn dox() {
16817/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16818///
16819/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16820/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16821/// # .with_native_roots()
16822/// # .unwrap()
16823/// # .https_only()
16824/// # .enable_http2()
16825/// # .build();
16826///
16827/// # let executor = hyper_util::rt::TokioExecutor::new();
16828/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16829/// # secret,
16830/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16831/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16832/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16833/// # ),
16834/// # ).build().await.unwrap();
16835///
16836/// # let client = hyper_util::client::legacy::Client::builder(
16837/// # hyper_util::rt::TokioExecutor::new()
16838/// # )
16839/// # .build(
16840/// # hyper_rustls::HttpsConnectorBuilder::new()
16841/// # .with_native_roots()
16842/// # .unwrap()
16843/// # .https_or_http()
16844/// # .enable_http2()
16845/// # .build()
16846/// # );
16847/// # let mut hub = CertificateAuthorityService::new(client, auth);
16848/// // You can configure optional parameters by calling the respective setters at will, and
16849/// // execute the final call using `doit()`.
16850/// // Values shown here are possibly random and not representative !
16851/// let result = hub.projects().locations_operations_get("name")
16852/// .doit().await;
16853/// # }
16854/// ```
16855pub struct ProjectLocationOperationGetCall<'a, C>
16856where
16857 C: 'a,
16858{
16859 hub: &'a CertificateAuthorityService<C>,
16860 _name: String,
16861 _delegate: Option<&'a mut dyn common::Delegate>,
16862 _additional_params: HashMap<String, String>,
16863 _scopes: BTreeSet<String>,
16864}
16865
16866impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
16867
16868impl<'a, C> ProjectLocationOperationGetCall<'a, C>
16869where
16870 C: common::Connector,
16871{
16872 /// Perform the operation you have build so far.
16873 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16874 use std::borrow::Cow;
16875 use std::io::{Read, Seek};
16876
16877 use common::{url::Params, ToParts};
16878 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16879
16880 let mut dd = common::DefaultDelegate;
16881 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16882 dlg.begin(common::MethodInfo {
16883 id: "privateca.projects.locations.operations.get",
16884 http_method: hyper::Method::GET,
16885 });
16886
16887 for &field in ["alt", "name"].iter() {
16888 if self._additional_params.contains_key(field) {
16889 dlg.finished(false);
16890 return Err(common::Error::FieldClash(field));
16891 }
16892 }
16893
16894 let mut params = Params::with_capacity(3 + self._additional_params.len());
16895 params.push("name", self._name);
16896
16897 params.extend(self._additional_params.iter());
16898
16899 params.push("alt", "json");
16900 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16901 if self._scopes.is_empty() {
16902 self._scopes
16903 .insert(Scope::CloudPlatform.as_ref().to_string());
16904 }
16905
16906 #[allow(clippy::single_element_loop)]
16907 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16908 url = params.uri_replacement(url, param_name, find_this, true);
16909 }
16910 {
16911 let to_remove = ["name"];
16912 params.remove_params(&to_remove);
16913 }
16914
16915 let url = params.parse_with_url(&url);
16916
16917 loop {
16918 let token = match self
16919 .hub
16920 .auth
16921 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16922 .await
16923 {
16924 Ok(token) => token,
16925 Err(e) => match dlg.token(e) {
16926 Ok(token) => token,
16927 Err(e) => {
16928 dlg.finished(false);
16929 return Err(common::Error::MissingToken(e));
16930 }
16931 },
16932 };
16933 let mut req_result = {
16934 let client = &self.hub.client;
16935 dlg.pre_request();
16936 let mut req_builder = hyper::Request::builder()
16937 .method(hyper::Method::GET)
16938 .uri(url.as_str())
16939 .header(USER_AGENT, self.hub._user_agent.clone());
16940
16941 if let Some(token) = token.as_ref() {
16942 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16943 }
16944
16945 let request = req_builder
16946 .header(CONTENT_LENGTH, 0_u64)
16947 .body(common::to_body::<String>(None));
16948
16949 client.request(request.unwrap()).await
16950 };
16951
16952 match req_result {
16953 Err(err) => {
16954 if let common::Retry::After(d) = dlg.http_error(&err) {
16955 sleep(d).await;
16956 continue;
16957 }
16958 dlg.finished(false);
16959 return Err(common::Error::HttpError(err));
16960 }
16961 Ok(res) => {
16962 let (mut parts, body) = res.into_parts();
16963 let mut body = common::Body::new(body);
16964 if !parts.status.is_success() {
16965 let bytes = common::to_bytes(body).await.unwrap_or_default();
16966 let error = serde_json::from_str(&common::to_string(&bytes));
16967 let response = common::to_response(parts, bytes.into());
16968
16969 if let common::Retry::After(d) =
16970 dlg.http_failure(&response, error.as_ref().ok())
16971 {
16972 sleep(d).await;
16973 continue;
16974 }
16975
16976 dlg.finished(false);
16977
16978 return Err(match error {
16979 Ok(value) => common::Error::BadRequest(value),
16980 _ => common::Error::Failure(response),
16981 });
16982 }
16983 let response = {
16984 let bytes = common::to_bytes(body).await.unwrap_or_default();
16985 let encoded = common::to_string(&bytes);
16986 match serde_json::from_str(&encoded) {
16987 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16988 Err(error) => {
16989 dlg.response_json_decode_error(&encoded, &error);
16990 return Err(common::Error::JsonDecodeError(
16991 encoded.to_string(),
16992 error,
16993 ));
16994 }
16995 }
16996 };
16997
16998 dlg.finished(true);
16999 return Ok(response);
17000 }
17001 }
17002 }
17003 }
17004
17005 /// The name of the operation resource.
17006 ///
17007 /// Sets the *name* path property to the given value.
17008 ///
17009 /// Even though the property as already been set when instantiating this call,
17010 /// we provide this method for API completeness.
17011 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
17012 self._name = new_value.to_string();
17013 self
17014 }
17015 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17016 /// while executing the actual API request.
17017 ///
17018 /// ````text
17019 /// It should be used to handle progress information, and to implement a certain level of resilience.
17020 /// ````
17021 ///
17022 /// Sets the *delegate* property to the given value.
17023 pub fn delegate(
17024 mut self,
17025 new_value: &'a mut dyn common::Delegate,
17026 ) -> ProjectLocationOperationGetCall<'a, C> {
17027 self._delegate = Some(new_value);
17028 self
17029 }
17030
17031 /// Set any additional parameter of the query string used in the request.
17032 /// It should be used to set parameters which are not yet available through their own
17033 /// setters.
17034 ///
17035 /// Please note that this method must not be used to set any of the known parameters
17036 /// which have their own setter method. If done anyway, the request will fail.
17037 ///
17038 /// # Additional Parameters
17039 ///
17040 /// * *$.xgafv* (query-string) - V1 error format.
17041 /// * *access_token* (query-string) - OAuth access token.
17042 /// * *alt* (query-string) - Data format for response.
17043 /// * *callback* (query-string) - JSONP
17044 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17045 /// * *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.
17046 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17047 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17048 /// * *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.
17049 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17050 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17051 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
17052 where
17053 T: AsRef<str>,
17054 {
17055 self._additional_params
17056 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17057 self
17058 }
17059
17060 /// Identifies the authorization scope for the method you are building.
17061 ///
17062 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17063 /// [`Scope::CloudPlatform`].
17064 ///
17065 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17066 /// tokens for more than one scope.
17067 ///
17068 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17069 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17070 /// sufficient, a read-write scope will do as well.
17071 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
17072 where
17073 St: AsRef<str>,
17074 {
17075 self._scopes.insert(String::from(scope.as_ref()));
17076 self
17077 }
17078 /// Identifies the authorization scope(s) for the method you are building.
17079 ///
17080 /// See [`Self::add_scope()`] for details.
17081 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
17082 where
17083 I: IntoIterator<Item = St>,
17084 St: AsRef<str>,
17085 {
17086 self._scopes
17087 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17088 self
17089 }
17090
17091 /// Removes all scopes, and no default scope will be used either.
17092 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17093 /// for details).
17094 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
17095 self._scopes.clear();
17096 self
17097 }
17098}
17099
17100/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
17101///
17102/// A builder for the *locations.operations.list* method supported by a *project* resource.
17103/// It is not used directly, but through a [`ProjectMethods`] instance.
17104///
17105/// # Example
17106///
17107/// Instantiate a resource method builder
17108///
17109/// ```test_harness,no_run
17110/// # extern crate hyper;
17111/// # extern crate hyper_rustls;
17112/// # extern crate google_privateca1 as privateca1;
17113/// # async fn dox() {
17114/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17115///
17116/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17117/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17118/// # .with_native_roots()
17119/// # .unwrap()
17120/// # .https_only()
17121/// # .enable_http2()
17122/// # .build();
17123///
17124/// # let executor = hyper_util::rt::TokioExecutor::new();
17125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17126/// # secret,
17127/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17128/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17129/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17130/// # ),
17131/// # ).build().await.unwrap();
17132///
17133/// # let client = hyper_util::client::legacy::Client::builder(
17134/// # hyper_util::rt::TokioExecutor::new()
17135/// # )
17136/// # .build(
17137/// # hyper_rustls::HttpsConnectorBuilder::new()
17138/// # .with_native_roots()
17139/// # .unwrap()
17140/// # .https_or_http()
17141/// # .enable_http2()
17142/// # .build()
17143/// # );
17144/// # let mut hub = CertificateAuthorityService::new(client, auth);
17145/// // You can configure optional parameters by calling the respective setters at will, and
17146/// // execute the final call using `doit()`.
17147/// // Values shown here are possibly random and not representative !
17148/// let result = hub.projects().locations_operations_list("name")
17149/// .return_partial_success(true)
17150/// .page_token("et")
17151/// .page_size(-93)
17152/// .filter("no")
17153/// .doit().await;
17154/// # }
17155/// ```
17156pub struct ProjectLocationOperationListCall<'a, C>
17157where
17158 C: 'a,
17159{
17160 hub: &'a CertificateAuthorityService<C>,
17161 _name: String,
17162 _return_partial_success: Option<bool>,
17163 _page_token: Option<String>,
17164 _page_size: Option<i32>,
17165 _filter: Option<String>,
17166 _delegate: Option<&'a mut dyn common::Delegate>,
17167 _additional_params: HashMap<String, String>,
17168 _scopes: BTreeSet<String>,
17169}
17170
17171impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
17172
17173impl<'a, C> ProjectLocationOperationListCall<'a, C>
17174where
17175 C: common::Connector,
17176{
17177 /// Perform the operation you have build so far.
17178 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
17179 use std::borrow::Cow;
17180 use std::io::{Read, Seek};
17181
17182 use common::{url::Params, ToParts};
17183 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17184
17185 let mut dd = common::DefaultDelegate;
17186 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17187 dlg.begin(common::MethodInfo {
17188 id: "privateca.projects.locations.operations.list",
17189 http_method: hyper::Method::GET,
17190 });
17191
17192 for &field in [
17193 "alt",
17194 "name",
17195 "returnPartialSuccess",
17196 "pageToken",
17197 "pageSize",
17198 "filter",
17199 ]
17200 .iter()
17201 {
17202 if self._additional_params.contains_key(field) {
17203 dlg.finished(false);
17204 return Err(common::Error::FieldClash(field));
17205 }
17206 }
17207
17208 let mut params = Params::with_capacity(7 + self._additional_params.len());
17209 params.push("name", self._name);
17210 if let Some(value) = self._return_partial_success.as_ref() {
17211 params.push("returnPartialSuccess", value.to_string());
17212 }
17213 if let Some(value) = self._page_token.as_ref() {
17214 params.push("pageToken", value);
17215 }
17216 if let Some(value) = self._page_size.as_ref() {
17217 params.push("pageSize", value.to_string());
17218 }
17219 if let Some(value) = self._filter.as_ref() {
17220 params.push("filter", value);
17221 }
17222
17223 params.extend(self._additional_params.iter());
17224
17225 params.push("alt", "json");
17226 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
17227 if self._scopes.is_empty() {
17228 self._scopes
17229 .insert(Scope::CloudPlatform.as_ref().to_string());
17230 }
17231
17232 #[allow(clippy::single_element_loop)]
17233 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17234 url = params.uri_replacement(url, param_name, find_this, true);
17235 }
17236 {
17237 let to_remove = ["name"];
17238 params.remove_params(&to_remove);
17239 }
17240
17241 let url = params.parse_with_url(&url);
17242
17243 loop {
17244 let token = match self
17245 .hub
17246 .auth
17247 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17248 .await
17249 {
17250 Ok(token) => token,
17251 Err(e) => match dlg.token(e) {
17252 Ok(token) => token,
17253 Err(e) => {
17254 dlg.finished(false);
17255 return Err(common::Error::MissingToken(e));
17256 }
17257 },
17258 };
17259 let mut req_result = {
17260 let client = &self.hub.client;
17261 dlg.pre_request();
17262 let mut req_builder = hyper::Request::builder()
17263 .method(hyper::Method::GET)
17264 .uri(url.as_str())
17265 .header(USER_AGENT, self.hub._user_agent.clone());
17266
17267 if let Some(token) = token.as_ref() {
17268 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17269 }
17270
17271 let request = req_builder
17272 .header(CONTENT_LENGTH, 0_u64)
17273 .body(common::to_body::<String>(None));
17274
17275 client.request(request.unwrap()).await
17276 };
17277
17278 match req_result {
17279 Err(err) => {
17280 if let common::Retry::After(d) = dlg.http_error(&err) {
17281 sleep(d).await;
17282 continue;
17283 }
17284 dlg.finished(false);
17285 return Err(common::Error::HttpError(err));
17286 }
17287 Ok(res) => {
17288 let (mut parts, body) = res.into_parts();
17289 let mut body = common::Body::new(body);
17290 if !parts.status.is_success() {
17291 let bytes = common::to_bytes(body).await.unwrap_or_default();
17292 let error = serde_json::from_str(&common::to_string(&bytes));
17293 let response = common::to_response(parts, bytes.into());
17294
17295 if let common::Retry::After(d) =
17296 dlg.http_failure(&response, error.as_ref().ok())
17297 {
17298 sleep(d).await;
17299 continue;
17300 }
17301
17302 dlg.finished(false);
17303
17304 return Err(match error {
17305 Ok(value) => common::Error::BadRequest(value),
17306 _ => common::Error::Failure(response),
17307 });
17308 }
17309 let response = {
17310 let bytes = common::to_bytes(body).await.unwrap_or_default();
17311 let encoded = common::to_string(&bytes);
17312 match serde_json::from_str(&encoded) {
17313 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17314 Err(error) => {
17315 dlg.response_json_decode_error(&encoded, &error);
17316 return Err(common::Error::JsonDecodeError(
17317 encoded.to_string(),
17318 error,
17319 ));
17320 }
17321 }
17322 };
17323
17324 dlg.finished(true);
17325 return Ok(response);
17326 }
17327 }
17328 }
17329 }
17330
17331 /// The name of the operation's parent resource.
17332 ///
17333 /// Sets the *name* path property to the given value.
17334 ///
17335 /// Even though the property as already been set when instantiating this call,
17336 /// we provide this method for API completeness.
17337 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17338 self._name = new_value.to_string();
17339 self
17340 }
17341 /// 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.
17342 ///
17343 /// Sets the *return partial success* query property to the given value.
17344 pub fn return_partial_success(
17345 mut self,
17346 new_value: bool,
17347 ) -> ProjectLocationOperationListCall<'a, C> {
17348 self._return_partial_success = Some(new_value);
17349 self
17350 }
17351 /// The standard list page token.
17352 ///
17353 /// Sets the *page token* query property to the given value.
17354 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17355 self._page_token = Some(new_value.to_string());
17356 self
17357 }
17358 /// The standard list page size.
17359 ///
17360 /// Sets the *page size* query property to the given value.
17361 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
17362 self._page_size = Some(new_value);
17363 self
17364 }
17365 /// The standard list filter.
17366 ///
17367 /// Sets the *filter* query property to the given value.
17368 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
17369 self._filter = Some(new_value.to_string());
17370 self
17371 }
17372 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17373 /// while executing the actual API request.
17374 ///
17375 /// ````text
17376 /// It should be used to handle progress information, and to implement a certain level of resilience.
17377 /// ````
17378 ///
17379 /// Sets the *delegate* property to the given value.
17380 pub fn delegate(
17381 mut self,
17382 new_value: &'a mut dyn common::Delegate,
17383 ) -> ProjectLocationOperationListCall<'a, C> {
17384 self._delegate = Some(new_value);
17385 self
17386 }
17387
17388 /// Set any additional parameter of the query string used in the request.
17389 /// It should be used to set parameters which are not yet available through their own
17390 /// setters.
17391 ///
17392 /// Please note that this method must not be used to set any of the known parameters
17393 /// which have their own setter method. If done anyway, the request will fail.
17394 ///
17395 /// # Additional Parameters
17396 ///
17397 /// * *$.xgafv* (query-string) - V1 error format.
17398 /// * *access_token* (query-string) - OAuth access token.
17399 /// * *alt* (query-string) - Data format for response.
17400 /// * *callback* (query-string) - JSONP
17401 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17402 /// * *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.
17403 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17404 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17405 /// * *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.
17406 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17407 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17408 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
17409 where
17410 T: AsRef<str>,
17411 {
17412 self._additional_params
17413 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17414 self
17415 }
17416
17417 /// Identifies the authorization scope for the method you are building.
17418 ///
17419 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17420 /// [`Scope::CloudPlatform`].
17421 ///
17422 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17423 /// tokens for more than one scope.
17424 ///
17425 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17426 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17427 /// sufficient, a read-write scope will do as well.
17428 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
17429 where
17430 St: AsRef<str>,
17431 {
17432 self._scopes.insert(String::from(scope.as_ref()));
17433 self
17434 }
17435 /// Identifies the authorization scope(s) for the method you are building.
17436 ///
17437 /// See [`Self::add_scope()`] for details.
17438 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
17439 where
17440 I: IntoIterator<Item = St>,
17441 St: AsRef<str>,
17442 {
17443 self._scopes
17444 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17445 self
17446 }
17447
17448 /// Removes all scopes, and no default scope will be used either.
17449 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17450 /// for details).
17451 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
17452 self._scopes.clear();
17453 self
17454 }
17455}
17456
17457/// Gets information about a location.
17458///
17459/// A builder for the *locations.get* method supported by a *project* resource.
17460/// It is not used directly, but through a [`ProjectMethods`] instance.
17461///
17462/// # Example
17463///
17464/// Instantiate a resource method builder
17465///
17466/// ```test_harness,no_run
17467/// # extern crate hyper;
17468/// # extern crate hyper_rustls;
17469/// # extern crate google_privateca1 as privateca1;
17470/// # async fn dox() {
17471/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17472///
17473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17475/// # .with_native_roots()
17476/// # .unwrap()
17477/// # .https_only()
17478/// # .enable_http2()
17479/// # .build();
17480///
17481/// # let executor = hyper_util::rt::TokioExecutor::new();
17482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17483/// # secret,
17484/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17485/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17486/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17487/// # ),
17488/// # ).build().await.unwrap();
17489///
17490/// # let client = hyper_util::client::legacy::Client::builder(
17491/// # hyper_util::rt::TokioExecutor::new()
17492/// # )
17493/// # .build(
17494/// # hyper_rustls::HttpsConnectorBuilder::new()
17495/// # .with_native_roots()
17496/// # .unwrap()
17497/// # .https_or_http()
17498/// # .enable_http2()
17499/// # .build()
17500/// # );
17501/// # let mut hub = CertificateAuthorityService::new(client, auth);
17502/// // You can configure optional parameters by calling the respective setters at will, and
17503/// // execute the final call using `doit()`.
17504/// // Values shown here are possibly random and not representative !
17505/// let result = hub.projects().locations_get("name")
17506/// .doit().await;
17507/// # }
17508/// ```
17509pub struct ProjectLocationGetCall<'a, C>
17510where
17511 C: 'a,
17512{
17513 hub: &'a CertificateAuthorityService<C>,
17514 _name: String,
17515 _delegate: Option<&'a mut dyn common::Delegate>,
17516 _additional_params: HashMap<String, String>,
17517 _scopes: BTreeSet<String>,
17518}
17519
17520impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
17521
17522impl<'a, C> ProjectLocationGetCall<'a, C>
17523where
17524 C: common::Connector,
17525{
17526 /// Perform the operation you have build so far.
17527 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
17528 use std::borrow::Cow;
17529 use std::io::{Read, Seek};
17530
17531 use common::{url::Params, ToParts};
17532 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17533
17534 let mut dd = common::DefaultDelegate;
17535 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17536 dlg.begin(common::MethodInfo {
17537 id: "privateca.projects.locations.get",
17538 http_method: hyper::Method::GET,
17539 });
17540
17541 for &field in ["alt", "name"].iter() {
17542 if self._additional_params.contains_key(field) {
17543 dlg.finished(false);
17544 return Err(common::Error::FieldClash(field));
17545 }
17546 }
17547
17548 let mut params = Params::with_capacity(3 + self._additional_params.len());
17549 params.push("name", self._name);
17550
17551 params.extend(self._additional_params.iter());
17552
17553 params.push("alt", "json");
17554 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17555 if self._scopes.is_empty() {
17556 self._scopes
17557 .insert(Scope::CloudPlatform.as_ref().to_string());
17558 }
17559
17560 #[allow(clippy::single_element_loop)]
17561 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17562 url = params.uri_replacement(url, param_name, find_this, true);
17563 }
17564 {
17565 let to_remove = ["name"];
17566 params.remove_params(&to_remove);
17567 }
17568
17569 let url = params.parse_with_url(&url);
17570
17571 loop {
17572 let token = match self
17573 .hub
17574 .auth
17575 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17576 .await
17577 {
17578 Ok(token) => token,
17579 Err(e) => match dlg.token(e) {
17580 Ok(token) => token,
17581 Err(e) => {
17582 dlg.finished(false);
17583 return Err(common::Error::MissingToken(e));
17584 }
17585 },
17586 };
17587 let mut req_result = {
17588 let client = &self.hub.client;
17589 dlg.pre_request();
17590 let mut req_builder = hyper::Request::builder()
17591 .method(hyper::Method::GET)
17592 .uri(url.as_str())
17593 .header(USER_AGENT, self.hub._user_agent.clone());
17594
17595 if let Some(token) = token.as_ref() {
17596 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17597 }
17598
17599 let request = req_builder
17600 .header(CONTENT_LENGTH, 0_u64)
17601 .body(common::to_body::<String>(None));
17602
17603 client.request(request.unwrap()).await
17604 };
17605
17606 match req_result {
17607 Err(err) => {
17608 if let common::Retry::After(d) = dlg.http_error(&err) {
17609 sleep(d).await;
17610 continue;
17611 }
17612 dlg.finished(false);
17613 return Err(common::Error::HttpError(err));
17614 }
17615 Ok(res) => {
17616 let (mut parts, body) = res.into_parts();
17617 let mut body = common::Body::new(body);
17618 if !parts.status.is_success() {
17619 let bytes = common::to_bytes(body).await.unwrap_or_default();
17620 let error = serde_json::from_str(&common::to_string(&bytes));
17621 let response = common::to_response(parts, bytes.into());
17622
17623 if let common::Retry::After(d) =
17624 dlg.http_failure(&response, error.as_ref().ok())
17625 {
17626 sleep(d).await;
17627 continue;
17628 }
17629
17630 dlg.finished(false);
17631
17632 return Err(match error {
17633 Ok(value) => common::Error::BadRequest(value),
17634 _ => common::Error::Failure(response),
17635 });
17636 }
17637 let response = {
17638 let bytes = common::to_bytes(body).await.unwrap_or_default();
17639 let encoded = common::to_string(&bytes);
17640 match serde_json::from_str(&encoded) {
17641 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17642 Err(error) => {
17643 dlg.response_json_decode_error(&encoded, &error);
17644 return Err(common::Error::JsonDecodeError(
17645 encoded.to_string(),
17646 error,
17647 ));
17648 }
17649 }
17650 };
17651
17652 dlg.finished(true);
17653 return Ok(response);
17654 }
17655 }
17656 }
17657 }
17658
17659 /// Resource name for the location.
17660 ///
17661 /// Sets the *name* path property to the given value.
17662 ///
17663 /// Even though the property as already been set when instantiating this call,
17664 /// we provide this method for API completeness.
17665 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
17666 self._name = new_value.to_string();
17667 self
17668 }
17669 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17670 /// while executing the actual API request.
17671 ///
17672 /// ````text
17673 /// It should be used to handle progress information, and to implement a certain level of resilience.
17674 /// ````
17675 ///
17676 /// Sets the *delegate* property to the given value.
17677 pub fn delegate(
17678 mut self,
17679 new_value: &'a mut dyn common::Delegate,
17680 ) -> ProjectLocationGetCall<'a, C> {
17681 self._delegate = Some(new_value);
17682 self
17683 }
17684
17685 /// Set any additional parameter of the query string used in the request.
17686 /// It should be used to set parameters which are not yet available through their own
17687 /// setters.
17688 ///
17689 /// Please note that this method must not be used to set any of the known parameters
17690 /// which have their own setter method. If done anyway, the request will fail.
17691 ///
17692 /// # Additional Parameters
17693 ///
17694 /// * *$.xgafv* (query-string) - V1 error format.
17695 /// * *access_token* (query-string) - OAuth access token.
17696 /// * *alt* (query-string) - Data format for response.
17697 /// * *callback* (query-string) - JSONP
17698 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17699 /// * *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.
17700 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17701 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17702 /// * *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.
17703 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17704 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17705 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
17706 where
17707 T: AsRef<str>,
17708 {
17709 self._additional_params
17710 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17711 self
17712 }
17713
17714 /// Identifies the authorization scope for the method you are building.
17715 ///
17716 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17717 /// [`Scope::CloudPlatform`].
17718 ///
17719 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17720 /// tokens for more than one scope.
17721 ///
17722 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17723 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17724 /// sufficient, a read-write scope will do as well.
17725 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
17726 where
17727 St: AsRef<str>,
17728 {
17729 self._scopes.insert(String::from(scope.as_ref()));
17730 self
17731 }
17732 /// Identifies the authorization scope(s) for the method you are building.
17733 ///
17734 /// See [`Self::add_scope()`] for details.
17735 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
17736 where
17737 I: IntoIterator<Item = St>,
17738 St: AsRef<str>,
17739 {
17740 self._scopes
17741 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17742 self
17743 }
17744
17745 /// Removes all scopes, and no default scope will be used either.
17746 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17747 /// for details).
17748 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
17749 self._scopes.clear();
17750 self
17751 }
17752}
17753
17754/// Lists information about the supported locations for this service.
17755///
17756/// A builder for the *locations.list* method supported by a *project* resource.
17757/// It is not used directly, but through a [`ProjectMethods`] instance.
17758///
17759/// # Example
17760///
17761/// Instantiate a resource method builder
17762///
17763/// ```test_harness,no_run
17764/// # extern crate hyper;
17765/// # extern crate hyper_rustls;
17766/// # extern crate google_privateca1 as privateca1;
17767/// # async fn dox() {
17768/// # use privateca1::{CertificateAuthorityService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17769///
17770/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17771/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17772/// # .with_native_roots()
17773/// # .unwrap()
17774/// # .https_only()
17775/// # .enable_http2()
17776/// # .build();
17777///
17778/// # let executor = hyper_util::rt::TokioExecutor::new();
17779/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17780/// # secret,
17781/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17782/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17783/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17784/// # ),
17785/// # ).build().await.unwrap();
17786///
17787/// # let client = hyper_util::client::legacy::Client::builder(
17788/// # hyper_util::rt::TokioExecutor::new()
17789/// # )
17790/// # .build(
17791/// # hyper_rustls::HttpsConnectorBuilder::new()
17792/// # .with_native_roots()
17793/// # .unwrap()
17794/// # .https_or_http()
17795/// # .enable_http2()
17796/// # .build()
17797/// # );
17798/// # let mut hub = CertificateAuthorityService::new(client, auth);
17799/// // You can configure optional parameters by calling the respective setters at will, and
17800/// // execute the final call using `doit()`.
17801/// // Values shown here are possibly random and not representative !
17802/// let result = hub.projects().locations_list("name")
17803/// .page_token("sed")
17804/// .page_size(-61)
17805/// .filter("nonumy")
17806/// .add_extra_location_types("At")
17807/// .doit().await;
17808/// # }
17809/// ```
17810pub struct ProjectLocationListCall<'a, C>
17811where
17812 C: 'a,
17813{
17814 hub: &'a CertificateAuthorityService<C>,
17815 _name: String,
17816 _page_token: Option<String>,
17817 _page_size: Option<i32>,
17818 _filter: Option<String>,
17819 _extra_location_types: Vec<String>,
17820 _delegate: Option<&'a mut dyn common::Delegate>,
17821 _additional_params: HashMap<String, String>,
17822 _scopes: BTreeSet<String>,
17823}
17824
17825impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
17826
17827impl<'a, C> ProjectLocationListCall<'a, C>
17828where
17829 C: common::Connector,
17830{
17831 /// Perform the operation you have build so far.
17832 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
17833 use std::borrow::Cow;
17834 use std::io::{Read, Seek};
17835
17836 use common::{url::Params, ToParts};
17837 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17838
17839 let mut dd = common::DefaultDelegate;
17840 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17841 dlg.begin(common::MethodInfo {
17842 id: "privateca.projects.locations.list",
17843 http_method: hyper::Method::GET,
17844 });
17845
17846 for &field in [
17847 "alt",
17848 "name",
17849 "pageToken",
17850 "pageSize",
17851 "filter",
17852 "extraLocationTypes",
17853 ]
17854 .iter()
17855 {
17856 if self._additional_params.contains_key(field) {
17857 dlg.finished(false);
17858 return Err(common::Error::FieldClash(field));
17859 }
17860 }
17861
17862 let mut params = Params::with_capacity(7 + self._additional_params.len());
17863 params.push("name", self._name);
17864 if let Some(value) = self._page_token.as_ref() {
17865 params.push("pageToken", value);
17866 }
17867 if let Some(value) = self._page_size.as_ref() {
17868 params.push("pageSize", value.to_string());
17869 }
17870 if let Some(value) = self._filter.as_ref() {
17871 params.push("filter", value);
17872 }
17873 if !self._extra_location_types.is_empty() {
17874 for f in self._extra_location_types.iter() {
17875 params.push("extraLocationTypes", f);
17876 }
17877 }
17878
17879 params.extend(self._additional_params.iter());
17880
17881 params.push("alt", "json");
17882 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
17883 if self._scopes.is_empty() {
17884 self._scopes
17885 .insert(Scope::CloudPlatform.as_ref().to_string());
17886 }
17887
17888 #[allow(clippy::single_element_loop)]
17889 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17890 url = params.uri_replacement(url, param_name, find_this, true);
17891 }
17892 {
17893 let to_remove = ["name"];
17894 params.remove_params(&to_remove);
17895 }
17896
17897 let url = params.parse_with_url(&url);
17898
17899 loop {
17900 let token = match self
17901 .hub
17902 .auth
17903 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17904 .await
17905 {
17906 Ok(token) => token,
17907 Err(e) => match dlg.token(e) {
17908 Ok(token) => token,
17909 Err(e) => {
17910 dlg.finished(false);
17911 return Err(common::Error::MissingToken(e));
17912 }
17913 },
17914 };
17915 let mut req_result = {
17916 let client = &self.hub.client;
17917 dlg.pre_request();
17918 let mut req_builder = hyper::Request::builder()
17919 .method(hyper::Method::GET)
17920 .uri(url.as_str())
17921 .header(USER_AGENT, self.hub._user_agent.clone());
17922
17923 if let Some(token) = token.as_ref() {
17924 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17925 }
17926
17927 let request = req_builder
17928 .header(CONTENT_LENGTH, 0_u64)
17929 .body(common::to_body::<String>(None));
17930
17931 client.request(request.unwrap()).await
17932 };
17933
17934 match req_result {
17935 Err(err) => {
17936 if let common::Retry::After(d) = dlg.http_error(&err) {
17937 sleep(d).await;
17938 continue;
17939 }
17940 dlg.finished(false);
17941 return Err(common::Error::HttpError(err));
17942 }
17943 Ok(res) => {
17944 let (mut parts, body) = res.into_parts();
17945 let mut body = common::Body::new(body);
17946 if !parts.status.is_success() {
17947 let bytes = common::to_bytes(body).await.unwrap_or_default();
17948 let error = serde_json::from_str(&common::to_string(&bytes));
17949 let response = common::to_response(parts, bytes.into());
17950
17951 if let common::Retry::After(d) =
17952 dlg.http_failure(&response, error.as_ref().ok())
17953 {
17954 sleep(d).await;
17955 continue;
17956 }
17957
17958 dlg.finished(false);
17959
17960 return Err(match error {
17961 Ok(value) => common::Error::BadRequest(value),
17962 _ => common::Error::Failure(response),
17963 });
17964 }
17965 let response = {
17966 let bytes = common::to_bytes(body).await.unwrap_or_default();
17967 let encoded = common::to_string(&bytes);
17968 match serde_json::from_str(&encoded) {
17969 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17970 Err(error) => {
17971 dlg.response_json_decode_error(&encoded, &error);
17972 return Err(common::Error::JsonDecodeError(
17973 encoded.to_string(),
17974 error,
17975 ));
17976 }
17977 }
17978 };
17979
17980 dlg.finished(true);
17981 return Ok(response);
17982 }
17983 }
17984 }
17985 }
17986
17987 /// The resource that owns the locations collection, if applicable.
17988 ///
17989 /// Sets the *name* path property to the given value.
17990 ///
17991 /// Even though the property as already been set when instantiating this call,
17992 /// we provide this method for API completeness.
17993 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
17994 self._name = new_value.to_string();
17995 self
17996 }
17997 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
17998 ///
17999 /// Sets the *page token* query property to the given value.
18000 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
18001 self._page_token = Some(new_value.to_string());
18002 self
18003 }
18004 /// The maximum number of results to return. If not set, the service selects a default.
18005 ///
18006 /// Sets the *page size* query property to the given value.
18007 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
18008 self._page_size = Some(new_value);
18009 self
18010 }
18011 /// 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).
18012 ///
18013 /// Sets the *filter* query property to the given value.
18014 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
18015 self._filter = Some(new_value.to_string());
18016 self
18017 }
18018 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
18019 ///
18020 /// Append the given value to the *extra location types* query property.
18021 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
18022 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
18023 self._extra_location_types.push(new_value.to_string());
18024 self
18025 }
18026 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18027 /// while executing the actual API request.
18028 ///
18029 /// ````text
18030 /// It should be used to handle progress information, and to implement a certain level of resilience.
18031 /// ````
18032 ///
18033 /// Sets the *delegate* property to the given value.
18034 pub fn delegate(
18035 mut self,
18036 new_value: &'a mut dyn common::Delegate,
18037 ) -> ProjectLocationListCall<'a, C> {
18038 self._delegate = Some(new_value);
18039 self
18040 }
18041
18042 /// Set any additional parameter of the query string used in the request.
18043 /// It should be used to set parameters which are not yet available through their own
18044 /// setters.
18045 ///
18046 /// Please note that this method must not be used to set any of the known parameters
18047 /// which have their own setter method. If done anyway, the request will fail.
18048 ///
18049 /// # Additional Parameters
18050 ///
18051 /// * *$.xgafv* (query-string) - V1 error format.
18052 /// * *access_token* (query-string) - OAuth access token.
18053 /// * *alt* (query-string) - Data format for response.
18054 /// * *callback* (query-string) - JSONP
18055 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18056 /// * *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.
18057 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18058 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18059 /// * *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.
18060 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18061 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18062 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
18063 where
18064 T: AsRef<str>,
18065 {
18066 self._additional_params
18067 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18068 self
18069 }
18070
18071 /// Identifies the authorization scope for the method you are building.
18072 ///
18073 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18074 /// [`Scope::CloudPlatform`].
18075 ///
18076 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18077 /// tokens for more than one scope.
18078 ///
18079 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18080 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18081 /// sufficient, a read-write scope will do as well.
18082 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
18083 where
18084 St: AsRef<str>,
18085 {
18086 self._scopes.insert(String::from(scope.as_ref()));
18087 self
18088 }
18089 /// Identifies the authorization scope(s) for the method you are building.
18090 ///
18091 /// See [`Self::add_scope()`] for details.
18092 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
18093 where
18094 I: IntoIterator<Item = St>,
18095 St: AsRef<str>,
18096 {
18097 self._scopes
18098 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18099 self
18100 }
18101
18102 /// Removes all scopes, and no default scope will be used either.
18103 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18104 /// for details).
18105 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
18106 self._scopes.clear();
18107 self
18108 }
18109}