google_cloudasset1_beta1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudAsset 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_cloudasset1_beta1 as cloudasset1_beta1;
49/// use cloudasset1_beta1::api::ExportAssetsRequest;
50/// use cloudasset1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = CloudAsset::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = ExportAssetsRequest::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.folders().export_assets(req, "parent")
99/// .doit().await;
100///
101/// match result {
102/// Err(e) => match e {
103/// // The Error enum provides details about what exactly happened.
104/// // You can also just use its `Debug`, `Display` or `Error` traits
105/// Error::HttpError(_)
106/// |Error::Io(_)
107/// |Error::MissingAPIKey
108/// |Error::MissingToken(_)
109/// |Error::Cancelled
110/// |Error::UploadSizeLimitExceeded(_, _)
111/// |Error::Failure(_)
112/// |Error::BadRequest(_)
113/// |Error::FieldClash(_)
114/// |Error::JsonDecodeError(_, _) => println!("{}", e),
115/// },
116/// Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct CloudAsset<C> {
122 pub client: common::Client<C>,
123 pub auth: Box<dyn common::GetToken>,
124 _user_agent: String,
125 _base_url: String,
126 _root_url: String,
127}
128
129impl<C> common::Hub for CloudAsset<C> {}
130
131impl<'a, C> CloudAsset<C> {
132 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> CloudAsset<C> {
133 CloudAsset {
134 client,
135 auth: Box::new(auth),
136 _user_agent: "google-api-rust-client/7.0.0".to_string(),
137 _base_url: "https://cloudasset.googleapis.com/".to_string(),
138 _root_url: "https://cloudasset.googleapis.com/".to_string(),
139 }
140 }
141
142 pub fn folders(&'a self) -> FolderMethods<'a, C> {
143 FolderMethods { hub: self }
144 }
145 pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
146 OrganizationMethods { hub: self }
147 }
148 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
149 ProjectMethods { hub: self }
150 }
151
152 /// Set the user-agent header field to use in all requests to the server.
153 /// It defaults to `google-api-rust-client/7.0.0`.
154 ///
155 /// Returns the previously set user-agent.
156 pub fn user_agent(&mut self, agent_name: String) -> String {
157 std::mem::replace(&mut self._user_agent, agent_name)
158 }
159
160 /// Set the base url to use in all requests to the server.
161 /// It defaults to `https://cloudasset.googleapis.com/`.
162 ///
163 /// Returns the previously set base url.
164 pub fn base_url(&mut self, new_base_url: String) -> String {
165 std::mem::replace(&mut self._base_url, new_base_url)
166 }
167
168 /// Set the root url to use in all requests to the server.
169 /// It defaults to `https://cloudasset.googleapis.com/`.
170 ///
171 /// Returns the previously set root url.
172 pub fn root_url(&mut self, new_root_url: String) -> String {
173 std::mem::replace(&mut self._root_url, new_root_url)
174 }
175}
176
177// ############
178// SCHEMAS ###
179// ##########
180/// An asset in Google Cloud. An asset can be any resource in the Google Cloud [resource hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), a resource outside the Google Cloud resource hierarchy (such as Google Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy). See [Supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for more information.
181///
182/// This type is not used in any activity, and only used as *part* of another schema.
183///
184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
185#[serde_with::serde_as]
186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
187pub struct Asset {
188 /// Please also refer to the [access level user guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).
189 #[serde(rename = "accessLevel")]
190 pub access_level: Option<GoogleIdentityAccesscontextmanagerV1AccessLevel>,
191 /// Please also refer to the [access policy user guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
192 #[serde(rename = "accessPolicy")]
193 pub access_policy: Option<GoogleIdentityAccesscontextmanagerV1AccessPolicy>,
194 /// The type of the asset. Example: `compute.googleapis.com/Disk` See [Supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for more information.
195 #[serde(rename = "assetType")]
196 pub asset_type: Option<String>,
197 /// A representation of the IAM policy set on a Google Cloud resource. There can be a maximum of one IAM policy set on any given resource. In addition, IAM policies inherit their granted access scope from any policies set on parent resources in the resource hierarchy. Therefore, the effectively policy is the union of both the policy set on this resource and each policy set on all of the resource's ancestry resource levels in the hierarchy. See [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance) for more information.
198 #[serde(rename = "iamPolicy")]
199 pub iam_policy: Option<Policy>,
200 /// The full name of the asset. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` See [Resource names](https://cloud.google.com/apis/design/resource_names#full_resource_name) for more information.
201 pub name: Option<String>,
202 /// A representation of an [organization policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). There can be more than one organization policy with different constraints set on a given resource.
203 #[serde(rename = "orgPolicy")]
204 pub org_policy: Option<Vec<GoogleCloudOrgpolicyV1Policy>>,
205 /// A representation of the resource.
206 pub resource: Option<Resource>,
207 /// Please also refer to the [service perimeter user guide](https://cloud.google.com/vpc-service-controls/docs/overview).
208 #[serde(rename = "servicePerimeter")]
209 pub service_perimeter: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeter>,
210}
211
212impl common::Part for Asset {}
213
214/// 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.
215///
216/// This type is not used in any activity, and only used as *part* of another schema.
217///
218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
219#[serde_with::serde_as]
220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
221pub struct AuditConfig {
222 /// The configuration for logging of each type of permission.
223 #[serde(rename = "auditLogConfigs")]
224 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
225 /// 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.
226 pub service: Option<String>,
227}
228
229impl common::Part for AuditConfig {}
230
231/// 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.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct AuditLogConfig {
239 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
240 #[serde(rename = "exemptedMembers")]
241 pub exempted_members: Option<Vec<String>>,
242 /// The log type that this config enables.
243 #[serde(rename = "logType")]
244 pub log_type: Option<String>,
245}
246
247impl common::Part for AuditLogConfig {}
248
249/// Batch get assets history response.
250///
251/// # Activities
252///
253/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
254/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
255///
256/// * [batch get assets history organizations](OrganizationBatchGetAssetsHistoryCall) (response)
257/// * [batch get assets history projects](ProjectBatchGetAssetsHistoryCall) (response)
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct BatchGetAssetsHistoryResponse {
262 /// A list of assets with valid time windows.
263 pub assets: Option<Vec<TemporalAsset>>,
264}
265
266impl common::ResponseResult for BatchGetAssetsHistoryResponse {}
267
268/// Associates `members`, or principals, with a `role`.
269///
270/// This type is not used in any activity, and only used as *part* of another schema.
271///
272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
273#[serde_with::serde_as]
274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
275pub struct Binding {
276 /// 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).
277 pub condition: Option<Expr>,
278 /// 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`.
279 pub members: Option<Vec<String>>,
280 /// 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).
281 pub role: Option<String>,
282}
283
284impl common::Part for Binding {}
285
286/// Export asset request.
287///
288/// # Activities
289///
290/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
291/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
292///
293/// * [export assets folders](FolderExportAssetCall) (request)
294/// * [export assets organizations](OrganizationExportAssetCall) (request)
295/// * [export assets projects](ProjectExportAssetCall) (request)
296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
297#[serde_with::serde_as]
298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
299pub struct ExportAssetsRequest {
300 /// A list of asset types of which to take a snapshot for. For example: "google.compute.Disk". If specified, only matching assets will be returned. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) for all supported asset types.
301 #[serde(rename = "assetTypes")]
302 pub asset_types: Option<Vec<String>>,
303 /// Asset content type. If not specified, no content but the asset name will be returned.
304 #[serde(rename = "contentType")]
305 pub content_type: Option<String>,
306 /// Required. Output configuration indicating where the results will be output to. All results will be in newline delimited JSON format.
307 #[serde(rename = "outputConfig")]
308 pub output_config: Option<OutputConfig>,
309 /// Timestamp to take an asset snapshot. This can only be set to a timestamp between 2018-10-02 UTC (inclusive) and the current time. If not specified, the current time will be used. Due to delays in resource data collection and indexing, there is a volatile window during which running the same query may get different results.
310 #[serde(rename = "readTime")]
311 pub read_time: Option<chrono::DateTime<chrono::offset::Utc>>,
312}
313
314impl common::RequestValue for ExportAssetsRequest {}
315
316/// 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.
317///
318/// This type is not used in any activity, and only used as *part* of another schema.
319///
320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
321#[serde_with::serde_as]
322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
323pub struct Expr {
324 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
325 pub description: Option<String>,
326 /// Textual representation of an expression in Common Expression Language syntax.
327 pub expression: Option<String>,
328 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
329 pub location: Option<String>,
330 /// 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.
331 pub title: Option<String>,
332}
333
334impl common::Part for Expr {}
335
336/// A Cloud Storage location.
337///
338/// This type is not used in any activity, and only used as *part* of another schema.
339///
340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
341#[serde_with::serde_as]
342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
343pub struct GcsDestination {
344 /// The URI of the Cloud Storage object. It's the same URI that is used by gsutil. For example: "gs://bucket_name/object_name". See [Viewing and Editing Object Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) for more information.
345 pub uri: Option<String>,
346 /// The URI prefix of all generated Cloud Storage objects. For example: "gs://bucket_name/object_name_prefix". Each object URI is in format: "gs://bucket_name/object_name_prefix// and only contains assets for that type. starts from 0. For example: "gs://bucket_name/object_name_prefix/google.compute.disk/0" is the first shard of output objects containing all google.compute.disk assets. An INVALID_ARGUMENT error will be returned if file with the same name "gs://bucket_name/object_name_prefix" already exists.
347 #[serde(rename = "uriPrefix")]
348 pub uri_prefix: Option<String>,
349}
350
351impl common::Part for GcsDestination {}
352
353/// Used in `policy_type` to specify how `boolean_policy` will behave at this resource.
354///
355/// This type is not used in any activity, and only used as *part* of another schema.
356///
357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
358#[serde_with::serde_as]
359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
360pub struct GoogleCloudOrgpolicyV1BooleanPolicy {
361 /// If `true`, then the `Policy` is enforced. If `false`, then any configuration is acceptable. Suppose you have a `Constraint` `constraints/compute.disableSerialPortAccess` with `constraint_default` set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following behavior: - If the `Policy` at this resource has enforced set to `false`, serial port connection attempts will be allowed. - If the `Policy` at this resource has enforced set to `true`, serial port connection attempts will be refused. - If the `Policy` at this resource is `RestoreDefault`, serial port connection attempts will be allowed. - If no `Policy` is set at this resource or anywhere higher in the resource hierarchy, serial port connection attempts will be allowed. - If no `Policy` is set at this resource, but one exists higher in the resource hierarchy, the behavior is as if the`Policy` were set at this resource. The following examples demonstrate the different possible layerings: Example 1 (nearest `Constraint` wins): `organizations/foo` has a `Policy` with: {enforced: false} `projects/bar` has no `Policy` set. The constraint at `projects/bar` and `organizations/foo` will not be enforced. Example 2 (enforcement gets replaced): `organizations/foo` has a `Policy` with: {enforced: false} `projects/bar` has a `Policy` with: {enforced: true} The constraint at `organizations/foo` is not enforced. The constraint at `projects/bar` is enforced. Example 3 (RestoreDefault): `organizations/foo` has a `Policy` with: {enforced: true} `projects/bar` has a `Policy` with: {RestoreDefault: {}} The constraint at `organizations/foo` is enforced. The constraint at `projects/bar` is not enforced, because `constraint_default` for the `Constraint` is `ALLOW`.
362 pub enforced: Option<bool>,
363}
364
365impl common::Part for GoogleCloudOrgpolicyV1BooleanPolicy {}
366
367/// Used in `policy_type` to specify how `list_policy` behaves at this resource. `ListPolicy` can define specific values and subtrees of Cloud Resource Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that are allowed or denied by setting the `allowed_values` and `denied_values` fields. This is achieved by using the `under:` and optional `is:` prefixes. The `under:` prefix is used to denote resource subtree values. The `is:` prefix is used to denote specific values, and is required only if the value contains a ":". Values prefixed with "is:" are treated the same as values with no prefix. Ancestry subtrees must be in one of the following formats: - "projects/", e.g. "projects/tokyo-rain-123" - "folders/", e.g. "folders/1234" - "organizations/", e.g. "organizations/1234" The `supports_under` field of the associated `Constraint` defines whether ancestry prefixes can be used. You can set `allowed_values` and `denied_values` in the same `Policy` if `all_values` is `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all values. If `all_values` is set to either `ALLOW` or `DENY`, `allowed_values` and `denied_values` must be unset.
368///
369/// This type is not used in any activity, and only used as *part* of another schema.
370///
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct GoogleCloudOrgpolicyV1ListPolicy {
375 /// The policy all_values state.
376 #[serde(rename = "allValues")]
377 pub all_values: Option<String>,
378 /// List of values allowed at this resource. Can only be set if `all_values` is set to `ALL_VALUES_UNSPECIFIED`.
379 #[serde(rename = "allowedValues")]
380 pub allowed_values: Option<Vec<String>>,
381 /// List of values denied at this resource. Can only be set if `all_values` is set to `ALL_VALUES_UNSPECIFIED`.
382 #[serde(rename = "deniedValues")]
383 pub denied_values: Option<Vec<String>>,
384 /// Determines the inheritance behavior for this `Policy`. By default, a `ListPolicy` set at a resource supersedes any `Policy` set anywhere up the resource hierarchy. However, if `inherit_from_parent` is set to `true`, then the values from the effective `Policy` of the parent resource are inherited, meaning the values set in this `Policy` are added to the values inherited up the hierarchy. Setting `Policy` hierarchies that inherit both allowed values and denied values isn't recommended in most circumstances to keep the configuration simple and understandable. However, it is possible to set a `Policy` with `allowed_values` set that inherits a `Policy` with `denied_values` set. In this case, the values that are allowed must be in `allowed_values` and not present in `denied_values`. For example, suppose you have a `Constraint` `constraints/serviceuser.services`, which has a `constraint_type` of `list_constraint`, and with `constraint_default` set to `ALLOW`. Suppose that at the Organization level, a `Policy` is applied that restricts the allowed API activations to {`E1`, `E2`}. Then, if a `Policy` is applied to a project below the Organization that has `inherit_from_parent` set to `false` and field all_values set to DENY, then an attempt to activate any API will be denied. The following examples demonstrate different possible layerings for `projects/bar` parented by `organizations/foo`: Example 1 (no inherited values): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values:"E2"} `projects/bar` has `inherit_from_parent` `false` and values: {allowed_values: "E3" allowed_values: "E4"} The accepted values at `organizations/foo` are `E1`, `E2`. The accepted values at `projects/bar` are `E3`, and `E4`. Example 2 (inherited values): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values:"E2"} `projects/bar` has a `Policy` with values: {value: "E3" value: "E4" inherit_from_parent: true} The accepted values at `organizations/foo` are `E1`, `E2`. The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`. Example 3 (inheriting both allowed and denied values): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values: "E2"} `projects/bar` has a `Policy` with: {denied_values: "E1"} The accepted values at `organizations/foo` are `E1`, `E2`. The value accepted at `projects/bar` is `E2`. Example 4 (RestoreDefault): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values:"E2"} `projects/bar` has a `Policy` with values: {RestoreDefault: {}} The accepted values at `organizations/foo` are `E1`, `E2`. The accepted values at `projects/bar` are either all or none depending on the value of `constraint_default` (if `ALLOW`, all; if `DENY`, none). Example 5 (no policy inherits parent policy): `organizations/foo` has no `Policy` set. `projects/bar` has no `Policy` set. The accepted values at both levels are either all or none depending on the value of `constraint_default` (if `ALLOW`, all; if `DENY`, none). Example 6 (ListConstraint allowing all): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values: "E2"} `projects/bar` has a `Policy` with: {all: ALLOW} The accepted values at `organizations/foo` are `E1`, E2`. Any value is accepted at `projects/bar`. Example 7 (ListConstraint allowing none): `organizations/foo` has a `Policy` with values: {allowed_values: "E1" allowed_values: "E2"} `projects/bar` has a `Policy` with: {all: DENY} The accepted values at `organizations/foo` are `E1`, E2`. No value is accepted at `projects/bar`. Example 10 (allowed and denied subtrees of Resource Manager hierarchy): Given the following resource hierarchy O1->{F1, F2}; F1->{P1}; F2->{P2, P3}, `organizations/foo` has a `Policy` with values: {allowed_values: "under:organizations/O1"} `projects/bar` has a `Policy` with: {allowed_values: "under:projects/P3"} {denied_values: "under:folders/F2"} The accepted values at `organizations/foo` are `organizations/O1`, `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`, `projects/P3`. The accepted values at `projects/bar` are `organizations/O1`, `folders/F1`, `projects/P1`.
385 #[serde(rename = "inheritFromParent")]
386 pub inherit_from_parent: Option<bool>,
387 /// Optional. The Google Cloud Console will try to default to a configuration that matches the value specified in this `Policy`. If `suggested_value` is not set, it will inherit the value specified higher in the hierarchy, unless `inherit_from_parent` is `false`.
388 #[serde(rename = "suggestedValue")]
389 pub suggested_value: Option<String>,
390}
391
392impl common::Part for GoogleCloudOrgpolicyV1ListPolicy {}
393
394/// Defines a Cloud Organization `Policy` which is used to specify `Constraints` for configurations of Cloud Platform resources.
395///
396/// This type is not used in any activity, and only used as *part* of another schema.
397///
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct GoogleCloudOrgpolicyV1Policy {
402 /// For boolean `Constraints`, whether to enforce the `Constraint` or not.
403 #[serde(rename = "booleanPolicy")]
404 pub boolean_policy: Option<GoogleCloudOrgpolicyV1BooleanPolicy>,
405 /// The name of the `Constraint` the `Policy` is configuring, for example, `constraints/serviceuser.services`. A [list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints) is available. Immutable after creation.
406 pub constraint: Option<String>,
407 /// An opaque tag indicating the current version of the `Policy`, used for concurrency control. When the `Policy` is returned from either a `GetPolicy` or a `ListOrgPolicy` request, this `etag` indicates the version of the current `Policy` to use when executing a read-modify-write loop. When the `Policy` is returned from a `GetEffectivePolicy` request, the `etag` will be unset. When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value that was returned from a `GetOrgPolicy` request as part of a read-modify-write loop for concurrency control. Not setting the `etag`in a `SetOrgPolicy` request will result in an unconditional write of the `Policy`.
408 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
409 pub etag: Option<Vec<u8>>,
410 /// List of values either allowed or disallowed.
411 #[serde(rename = "listPolicy")]
412 pub list_policy: Option<GoogleCloudOrgpolicyV1ListPolicy>,
413 /// Restores the default behavior of the constraint; independent of `Constraint` type.
414 #[serde(rename = "restoreDefault")]
415 pub restore_default: Option<GoogleCloudOrgpolicyV1RestoreDefault>,
416 /// The time stamp the `Policy` was previously updated. This is set by the server, not specified by the caller, and represents the last time a call to `SetOrgPolicy` was made for that `Policy`. Any value set by the client will be ignored.
417 #[serde(rename = "updateTime")]
418 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
419 /// Version of the `Policy`. Default version is 0;
420 pub version: Option<i32>,
421}
422
423impl common::Part for GoogleCloudOrgpolicyV1Policy {}
424
425/// Ignores policies set above this resource and restores the `constraint_default` enforcement behavior of the specific `Constraint` at this resource. Suppose that `constraint_default` is set to `ALLOW` for the `Constraint` `constraints/serviceuser.services`. Suppose that organization foo.com sets a `Policy` at their Organization resource node that restricts the allowed service activations to deny all service activations. They could then set a `Policy` with the `policy_type` `restore_default` on several experimental projects, restoring the `constraint_default` enforcement of the `Constraint` for only those projects, allowing those projects to have all services activated.
426///
427/// This type is not used in any activity, and only used as *part* of another schema.
428///
429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
430#[serde_with::serde_as]
431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
432pub struct GoogleCloudOrgpolicyV1RestoreDefault {
433 _never_set: Option<bool>,
434}
435
436impl common::Part for GoogleCloudOrgpolicyV1RestoreDefault {}
437
438/// An `AccessLevel` is a label that can be applied to requests to Google Cloud services, along with a list of requirements necessary for the label to be applied.
439///
440/// This type is not used in any activity, and only used as *part* of another schema.
441///
442#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
443#[serde_with::serde_as]
444#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
445pub struct GoogleIdentityAccesscontextmanagerV1AccessLevel {
446 /// A `BasicLevel` composed of `Conditions`.
447 pub basic: Option<GoogleIdentityAccesscontextmanagerV1BasicLevel>,
448 /// A `CustomLevel` written in the Common Expression Language.
449 pub custom: Option<GoogleIdentityAccesscontextmanagerV1CustomLevel>,
450 /// Description of the `AccessLevel` and its use. Does not affect behavior.
451 pub description: Option<String>,
452 /// Identifier. Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
453 pub name: Option<String>,
454 /// Human readable title. Must be unique within the Policy.
455 pub title: Option<String>,
456}
457
458impl common::Part for GoogleIdentityAccesscontextmanagerV1AccessLevel {}
459
460/// `AccessPolicy` is a container for `AccessLevels` (which define the necessary attributes to use Google Cloud services) and `ServicePerimeters` (which define regions of services able to freely pass data within a perimeter). An access policy is globally visible within an organization, and the restrictions it specifies apply to all projects within an organization.
461///
462/// This type is not used in any activity, and only used as *part* of another schema.
463///
464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
465#[serde_with::serde_as]
466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
467pub struct GoogleIdentityAccesscontextmanagerV1AccessPolicy {
468 /// Output only. An opaque identifier for the current version of the `AccessPolicy`. This will always be a strongly validated etag, meaning that two Access Policies will be identical if and only if their etags are identical. Clients should not expect this to be in any specific format.
469 pub etag: Option<String>,
470 /// Output only. Identifier. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}`
471 pub name: Option<String>,
472 /// Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently immutable once created. Format: `organizations/{organization_id}`
473 pub parent: Option<String>,
474 /// The scopes of the AccessPolicy. Scopes define which resources a policy can restrict and where its resources can be referenced. For example, policy A with `scopes=["folders/123"]` has the following behavior: - ServicePerimeter can only restrict projects within `folders/123`. - ServicePerimeter within policy A can only reference access levels defined within policy A. - Only one policy can include a given scope; thus, attempting to create a second policy which includes `folders/123` will result in an error. If no scopes are provided, then any resource within the organization can be restricted. Scopes cannot be modified after a policy is created. Policies can only have a single scope. Format: list of `folders/{folder_number}` or `projects/{project_number}`
475 pub scopes: Option<Vec<String>>,
476 /// Required. Human readable title. Does not affect behavior.
477 pub title: Option<String>,
478}
479
480impl common::Part for GoogleIdentityAccesscontextmanagerV1AccessPolicy {}
481
482/// Identification for an API Operation.
483///
484/// This type is not used in any activity, and only used as *part* of another schema.
485///
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct GoogleIdentityAccesscontextmanagerV1ApiOperation {
490 /// API methods or permissions to allow. Method or permission must belong to the service specified by `service_name` field. A single MethodSelector entry with `*` specified for the `method` field will allow all methods AND permissions for the service specified in `service_name`.
491 #[serde(rename = "methodSelectors")]
492 pub method_selectors: Option<Vec<GoogleIdentityAccesscontextmanagerV1MethodSelector>>,
493 /// The name of the API whose methods or permissions the IngressPolicy or EgressPolicy want to allow. A single ApiOperation with `service_name` field set to `*` will allow all methods AND permissions for all services.
494 #[serde(rename = "serviceName")]
495 pub service_name: Option<String>,
496}
497
498impl common::Part for GoogleIdentityAccesscontextmanagerV1ApiOperation {}
499
500/// `BasicLevel` is an `AccessLevel` using a set of recommended features.
501///
502/// This type is not used in any activity, and only used as *part* of another schema.
503///
504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
505#[serde_with::serde_as]
506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
507pub struct GoogleIdentityAccesscontextmanagerV1BasicLevel {
508 /// How the `conditions` list should be combined to determine if a request is granted this `AccessLevel`. If AND is used, each `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. If OR is used, at least one `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. Default behavior is AND.
509 #[serde(rename = "combiningFunction")]
510 pub combining_function: Option<String>,
511 /// Required. A list of requirements for the `AccessLevel` to be granted.
512 pub conditions: Option<Vec<GoogleIdentityAccesscontextmanagerV1Condition>>,
513}
514
515impl common::Part for GoogleIdentityAccesscontextmanagerV1BasicLevel {}
516
517/// A condition necessary for an `AccessLevel` to be granted. The Condition is an AND over its fields. So a Condition is true if: 1) the request IP is from one of the listed subnetworks AND 2) the originating device complies with the listed device policy AND 3) all listed access levels are granted AND 4) the request was sent at a time allowed by the DateTimeRestriction.
518///
519/// This type is not used in any activity, and only used as *part* of another schema.
520///
521#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
522#[serde_with::serde_as]
523#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
524pub struct GoogleIdentityAccesscontextmanagerV1Condition {
525 /// Device specific restrictions, all restrictions must hold for the Condition to be true. If not specified, all devices are allowed.
526 #[serde(rename = "devicePolicy")]
527 pub device_policy: Option<GoogleIdentityAccesscontextmanagerV1DevicePolicy>,
528 /// CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for a CIDR IP address block, the specified IP address portion must be properly truncated (i.e. all the host bits must be zero) or the input is considered malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32" is not. The originating IP of a request must be in one of the listed subnets in order for this Condition to be true. If empty, all IP addresses are allowed.
529 #[serde(rename = "ipSubnetworks")]
530 pub ip_subnetworks: Option<Vec<String>>,
531 /// The request must be made by one of the provided user or service accounts. Groups are not supported. Syntax: `user:{emailid}` `serviceAccount:{emailid}` If not specified, a request may come from any user.
532 pub members: Option<Vec<String>>,
533 /// Whether to negate the Condition. If true, the Condition becomes a NAND over its non-empty fields. Any non-empty field criteria evaluating to false will result in the Condition to be satisfied. Defaults to false.
534 pub negate: Option<bool>,
535 /// The request must originate from one of the provided countries/regions. Must be valid ISO 3166-1 alpha-2 codes.
536 pub regions: Option<Vec<String>>,
537 /// A list of other access levels defined in the same `Policy`, referenced by resource name. Referencing an `AccessLevel` which does not exist is an error. All access levels listed must be granted for the Condition to be true. Example: "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
538 #[serde(rename = "requiredAccessLevels")]
539 pub required_access_levels: Option<Vec<String>>,
540 /// The request must originate from one of the provided VPC networks in Google Cloud. Cannot specify this field together with `ip_subnetworks`.
541 #[serde(rename = "vpcNetworkSources")]
542 pub vpc_network_sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1VpcNetworkSource>>,
543}
544
545impl common::Part for GoogleIdentityAccesscontextmanagerV1Condition {}
546
547/// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language to represent the necessary conditions for the level to apply to a request. See CEL spec at: https://github.com/google/cel-spec
548///
549/// This type is not used in any activity, and only used as *part* of another schema.
550///
551#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
552#[serde_with::serde_as]
553#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
554pub struct GoogleIdentityAccesscontextmanagerV1CustomLevel {
555 /// Required. A Cloud CEL expression evaluating to a boolean.
556 pub expr: Option<Expr>,
557}
558
559impl common::Part for GoogleIdentityAccesscontextmanagerV1CustomLevel {}
560
561/// `DevicePolicy` specifies device specific restrictions necessary to acquire a given access level. A `DevicePolicy` specifies requirements for requests from devices to be granted access levels, it does not do any enforcement on the device. `DevicePolicy` acts as an AND over all specified fields, and each repeated field is an OR over its elements. Any unset fields are ignored. For example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be true for requests originating from encrypted Linux desktops and encrypted Windows desktops.
562///
563/// This type is not used in any activity, and only used as *part* of another schema.
564///
565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
566#[serde_with::serde_as]
567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
568pub struct GoogleIdentityAccesscontextmanagerV1DevicePolicy {
569 /// Allowed device management levels, an empty list allows all management levels.
570 #[serde(rename = "allowedDeviceManagementLevels")]
571 pub allowed_device_management_levels: Option<Vec<String>>,
572 /// Allowed encryptions statuses, an empty list allows all statuses.
573 #[serde(rename = "allowedEncryptionStatuses")]
574 pub allowed_encryption_statuses: Option<Vec<String>>,
575 /// Allowed OS versions, an empty list allows all types and all versions.
576 #[serde(rename = "osConstraints")]
577 pub os_constraints: Option<Vec<GoogleIdentityAccesscontextmanagerV1OsConstraint>>,
578 /// Whether the device needs to be approved by the customer admin.
579 #[serde(rename = "requireAdminApproval")]
580 pub require_admin_approval: Option<bool>,
581 /// Whether the device needs to be corp owned.
582 #[serde(rename = "requireCorpOwned")]
583 pub require_corp_owned: Option<bool>,
584 /// Whether or not screenlock is required for the DevicePolicy to be true. Defaults to `false`.
585 #[serde(rename = "requireScreenlock")]
586 pub require_screenlock: Option<bool>,
587}
588
589impl common::Part for GoogleIdentityAccesscontextmanagerV1DevicePolicy {}
590
591/// Defines the conditions under which an EgressPolicy matches a request. Conditions based on information about the source of the request. Note that if the destination of the request is also protected by a ServicePerimeter, then that ServicePerimeter must have an IngressPolicy which allows access in order for this request to succeed.
592///
593/// This type is not used in any activity, and only used as *part* of another schema.
594///
595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
596#[serde_with::serde_as]
597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
598pub struct GoogleIdentityAccesscontextmanagerV1EgressFrom {
599 /// A list of identities that are allowed access through [EgressPolicy]. Identities can be an individual user, service account, Google group, or third-party identity. For third-party identity, only single identities are supported and other identity types are not supported. The `v1` identities that have the prefix `user`, `group`, `serviceAccount`, and `principal` in https://cloud.google.com/iam/docs/principal-identifiers#v1 are supported.
600 pub identities: Option<Vec<String>>,
601 /// Specifies the type of identities that are allowed access to outside the perimeter. If left unspecified, then members of `identities` field will be allowed access.
602 #[serde(rename = "identityType")]
603 pub identity_type: Option<String>,
604 /// Whether to enforce traffic restrictions based on `sources` field. If the `sources` fields is non-empty, then this field must be set to `SOURCE_RESTRICTION_ENABLED`.
605 #[serde(rename = "sourceRestriction")]
606 pub source_restriction: Option<String>,
607 /// Sources that this EgressPolicy authorizes access from. If this field is not empty, then `source_restriction` must be set to `SOURCE_RESTRICTION_ENABLED`.
608 pub sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1EgressSource>>,
609}
610
611impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressFrom {}
612
613/// Policy for egress from perimeter. EgressPolicies match requests based on `egress_from` and `egress_to` stanzas. For an EgressPolicy to match, both `egress_from` and `egress_to` stanzas must be matched. If an EgressPolicy matches a request, the request is allowed to span the ServicePerimeter boundary. For example, an EgressPolicy can be used to allow VMs on networks within the ServicePerimeter to access a defined set of projects outside the perimeter in certain contexts (e.g. to read data from a Cloud Storage bucket or query against a BigQuery dataset). EgressPolicies are concerned with the *resources* that a request relates as well as the API services and API actions being used. They do not related to the direction of data movement. More detailed documentation for this concept can be found in the descriptions of EgressFrom and EgressTo.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct GoogleIdentityAccesscontextmanagerV1EgressPolicy {
621 /// Defines conditions on the source of a request causing this EgressPolicy to apply.
622 #[serde(rename = "egressFrom")]
623 pub egress_from: Option<GoogleIdentityAccesscontextmanagerV1EgressFrom>,
624 /// Defines the conditions on the ApiOperation and destination resources that cause this EgressPolicy to apply.
625 #[serde(rename = "egressTo")]
626 pub egress_to: Option<GoogleIdentityAccesscontextmanagerV1EgressTo>,
627 /// Optional. Human-readable title for the egress rule. The title must be unique within the perimeter and can not exceed 100 characters. Within the access policy, the combined length of all rule titles must not exceed 240,000 characters.
628 pub title: Option<String>,
629}
630
631impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressPolicy {}
632
633/// The source that EgressPolicy authorizes access from inside the ServicePerimeter to somewhere outside the ServicePerimeter boundaries.
634///
635/// This type is not used in any activity, and only used as *part* of another schema.
636///
637#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
638#[serde_with::serde_as]
639#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
640pub struct GoogleIdentityAccesscontextmanagerV1EgressSource {
641 /// An AccessLevel resource name that allows protected resources inside the ServicePerimeters to access outside the ServicePerimeter boundaries. AccessLevels listed must be in the same policy as this ServicePerimeter. Referencing a nonexistent AccessLevel will cause an error. If an AccessLevel name is not specified, only resources within the perimeter can be accessed through Google Cloud calls with request origins within the perimeter. Example: `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is specified for `access_level`, then all EgressSources will be allowed.
642 #[serde(rename = "accessLevel")]
643 pub access_level: Option<String>,
644 /// A Google Cloud resource from the service perimeter that you want to allow to access data outside the perimeter. This field supports only projects. The project format is `projects/{project_number}`. You can't use `*` in this field to allow all Google Cloud resources.
645 pub resource: Option<String>,
646}
647
648impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressSource {}
649
650/// Defines the conditions under which an EgressPolicy matches a request. Conditions are based on information about the ApiOperation intended to be performed on the `resources` specified. Note that if the destination of the request is also protected by a ServicePerimeter, then that ServicePerimeter must have an IngressPolicy which allows access in order for this request to succeed. The request must match `operations` AND `resources` fields in order to be allowed egress out of the perimeter.
651///
652/// This type is not used in any activity, and only used as *part* of another schema.
653///
654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
655#[serde_with::serde_as]
656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
657pub struct GoogleIdentityAccesscontextmanagerV1EgressTo {
658 /// A list of external resources that are allowed to be accessed. Only AWS and Azure resources are supported. For Amazon S3, the supported formats are s3://BUCKET_NAME, s3a://BUCKET_NAME, and s3n://BUCKET_NAME. For Azure Storage, the supported format is azure://myaccount.blob.core.windows.net/CONTAINER_NAME. A request matches if it contains an external resource in this list (Example: s3://bucket/path). Currently '*' is not allowed.
659 #[serde(rename = "externalResources")]
660 pub external_resources: Option<Vec<String>>,
661 /// A list of ApiOperations allowed to be performed by the sources specified in the corresponding EgressFrom. A request matches if it uses an operation/service in this list.
662 pub operations: Option<Vec<GoogleIdentityAccesscontextmanagerV1ApiOperation>>,
663 /// A list of resources, currently only projects in the form `projects/`, that are allowed to be accessed by sources defined in the corresponding EgressFrom. A request matches if it contains a resource in this list. If `*` is specified for `resources`, then this EgressTo rule will authorize access to all resources outside the perimeter.
664 pub resources: Option<Vec<String>>,
665 /// IAM roles that represent the set of operations that the sources specified in the corresponding EgressFrom. are allowed to perform in this ServicePerimeter.
666 pub roles: Option<Vec<String>>,
667}
668
669impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressTo {}
670
671/// Defines the conditions under which an IngressPolicy matches a request. Conditions are based on information about the source of the request. The request must satisfy what is defined in `sources` AND identity related fields in order to match.
672///
673/// This type is not used in any activity, and only used as *part* of another schema.
674///
675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
676#[serde_with::serde_as]
677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
678pub struct GoogleIdentityAccesscontextmanagerV1IngressFrom {
679 /// A list of identities that are allowed access through [IngressPolicy]. Identities can be an individual user, service account, Google group, or third-party identity. For third-party identity, only single identities are supported and other identity types are not supported. The `v1` identities that have the prefix `user`, `group`, `serviceAccount`, and `principal` in https://cloud.google.com/iam/docs/principal-identifiers#v1 are supported.
680 pub identities: Option<Vec<String>>,
681 /// Specifies the type of identities that are allowed access from outside the perimeter. If left unspecified, then members of `identities` field will be allowed access.
682 #[serde(rename = "identityType")]
683 pub identity_type: Option<String>,
684 /// Sources that this IngressPolicy authorizes access from.
685 pub sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1IngressSource>>,
686}
687
688impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressFrom {}
689
690/// Policy for ingress into ServicePerimeter. IngressPolicies match requests based on `ingress_from` and `ingress_to` stanzas. For an ingress policy to match, both the `ingress_from` and `ingress_to` stanzas must be matched. If an IngressPolicy matches a request, the request is allowed through the perimeter boundary from outside the perimeter. For example, access from the internet can be allowed either based on an AccessLevel or, for traffic hosted on Google Cloud, the project of the source network. For access from private networks, using the project of the hosting network is required. Individual ingress policies can be limited by restricting which services and/or actions they match using the `ingress_to` field.
691///
692/// This type is not used in any activity, and only used as *part* of another schema.
693///
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct GoogleIdentityAccesscontextmanagerV1IngressPolicy {
698 /// Defines the conditions on the source of a request causing this IngressPolicy to apply.
699 #[serde(rename = "ingressFrom")]
700 pub ingress_from: Option<GoogleIdentityAccesscontextmanagerV1IngressFrom>,
701 /// Defines the conditions on the ApiOperation and request destination that cause this IngressPolicy to apply.
702 #[serde(rename = "ingressTo")]
703 pub ingress_to: Option<GoogleIdentityAccesscontextmanagerV1IngressTo>,
704 /// Optional. Human-readable title for the ingress rule. The title must be unique within the perimeter and can not exceed 100 characters. Within the access policy, the combined length of all rule titles must not exceed 240,000 characters.
705 pub title: Option<String>,
706}
707
708impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressPolicy {}
709
710/// The source that IngressPolicy authorizes access from.
711///
712/// This type is not used in any activity, and only used as *part* of another schema.
713///
714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
715#[serde_with::serde_as]
716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
717pub struct GoogleIdentityAccesscontextmanagerV1IngressSource {
718 /// An AccessLevel resource name that allow resources within the ServicePerimeters to be accessed from the internet. AccessLevels listed must be in the same policy as this ServicePerimeter. Referencing a nonexistent AccessLevel will cause an error. If no AccessLevel names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. Example: `accessPolicies/MY_POLICY/accessLevels/MY_LEVEL`. If a single `*` is specified for `access_level`, then all IngressSources will be allowed.
719 #[serde(rename = "accessLevel")]
720 pub access_level: Option<String>,
721 /// A Google Cloud resource that is allowed to ingress the perimeter. Requests from these resources will be allowed to access perimeter data. Currently only projects and VPCs are allowed. Project format: `projects/{project_number}` VPC network format: `//compute.googleapis.com/projects/{PROJECT_ID}/global/networks/{NAME}`. The project may be in any Google Cloud organization, not just the organization that the perimeter is defined in. `*` is not allowed, the case of allowing all Google Cloud resources only is not supported.
722 pub resource: Option<String>,
723}
724
725impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressSource {}
726
727/// Defines the conditions under which an IngressPolicy matches a request. Conditions are based on information about the ApiOperation intended to be performed on the target resource of the request. The request must satisfy what is defined in `operations` AND `resources` in order to match.
728///
729/// This type is not used in any activity, and only used as *part* of another schema.
730///
731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
732#[serde_with::serde_as]
733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
734pub struct GoogleIdentityAccesscontextmanagerV1IngressTo {
735 /// A list of ApiOperations allowed to be performed by the sources specified in corresponding IngressFrom in this ServicePerimeter.
736 pub operations: Option<Vec<GoogleIdentityAccesscontextmanagerV1ApiOperation>>,
737 /// A list of resources, currently only projects in the form `projects/`, protected by this ServicePerimeter that are allowed to be accessed by sources defined in the corresponding IngressFrom. If a single `*` is specified, then access to all resources inside the perimeter are allowed.
738 pub resources: Option<Vec<String>>,
739 /// IAM roles that represent the set of operations that the sources specified in the corresponding IngressFrom are allowed to perform in this ServicePerimeter.
740 pub roles: Option<Vec<String>>,
741}
742
743impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressTo {}
744
745/// An allowed method or permission of a service specified in ApiOperation.
746///
747/// This type is not used in any activity, and only used as *part* of another schema.
748///
749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
750#[serde_with::serde_as]
751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
752pub struct GoogleIdentityAccesscontextmanagerV1MethodSelector {
753 /// A valid method name for the corresponding `service_name` in ApiOperation. If `*` is used as the value for the `method`, then ALL methods and permissions are allowed.
754 pub method: Option<String>,
755 /// A valid Cloud IAM permission for the corresponding `service_name` in ApiOperation.
756 pub permission: Option<String>,
757}
758
759impl common::Part for GoogleIdentityAccesscontextmanagerV1MethodSelector {}
760
761/// A restriction on the OS type and version of devices making requests.
762///
763/// This type is not used in any activity, and only used as *part* of another schema.
764///
765#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
766#[serde_with::serde_as]
767#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
768pub struct GoogleIdentityAccesscontextmanagerV1OsConstraint {
769 /// The minimum allowed OS version. If not set, any version of this OS satisfies the constraint. Format: `"major.minor.patch"`. Examples: `"10.5.301"`, `"9.2.1"`.
770 #[serde(rename = "minimumVersion")]
771 pub minimum_version: Option<String>,
772 /// Required. The allowed OS type.
773 #[serde(rename = "osType")]
774 pub os_type: Option<String>,
775 /// Only allows requests from devices with a verified Chrome OS. Verifications includes requirements that the device is enterprise-managed, conformant to domain policies, and the caller has permission to call the API targeted by the request.
776 #[serde(rename = "requireVerifiedChromeOs")]
777 pub require_verified_chrome_os: Option<bool>,
778}
779
780impl common::Part for GoogleIdentityAccesscontextmanagerV1OsConstraint {}
781
782/// `ServicePerimeter` describes a set of Google Cloud resources which can freely import and export data amongst themselves, but not export outside of the `ServicePerimeter`. If a request with a source within this `ServicePerimeter` has a target outside of the `ServicePerimeter`, the request will be blocked. Otherwise the request is allowed. There are two types of Service Perimeter - Regular and Bridge. Regular Service Perimeters cannot overlap, a single Google Cloud project or VPC network can only belong to a single regular Service Perimeter. Service Perimeter Bridges can contain only Google Cloud projects as members, a single Google Cloud project may belong to multiple Service Perimeter Bridges.
783///
784/// This type is not used in any activity, and only used as *part* of another schema.
785///
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct GoogleIdentityAccesscontextmanagerV1ServicePerimeter {
790 /// Description of the `ServicePerimeter` and its use. Does not affect behavior.
791 pub description: Option<String>,
792 /// Optional. An opaque identifier for the current version of the `ServicePerimeter`. This identifier does not follow any specific format. If an etag is not provided, the operation will be performed as if a valid etag is provided.
793 pub etag: Option<String>,
794 /// Identifier. Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
795 pub name: Option<String>,
796 /// Perimeter type indicator. A single project or VPC network is allowed to be a member of single regular perimeter, but multiple service perimeter bridges. A project cannot be a included in a perimeter bridge without being included in regular perimeter. For perimeter bridges, the restricted service list as well as access level lists must be empty.
797 #[serde(rename = "perimeterType")]
798 pub perimeter_type: Option<String>,
799 /// Proposed (or dry run) ServicePerimeter configuration. This configuration allows to specify and test ServicePerimeter configuration without enforcing actual access restrictions. Only allowed to be set when the "use_explicit_dry_run_spec" flag is set.
800 pub spec: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig>,
801 /// Current ServicePerimeter configuration. Specifies sets of resources, restricted services and access levels that determine perimeter content and boundaries.
802 pub status: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig>,
803 /// Human readable title. Must be unique within the Policy.
804 pub title: Option<String>,
805 /// Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly exists for all Service Perimeters, and that spec is identical to the status for those Service Perimeters. When this flag is set, it inhibits the generation of the implicit spec, thereby allowing the user to explicitly provide a configuration ("spec") to use in a dry-run version of the Service Perimeter. This allows the user to test changes to the enforced config ("status") without actually enforcing them. This testing is done through analyzing the differences between currently enforced and suggested restrictions. use_explicit_dry_run_spec must bet set to True if any of the fields in the spec are set to non-default values.
806 #[serde(rename = "useExplicitDryRunSpec")]
807 pub use_explicit_dry_run_spec: Option<bool>,
808}
809
810impl common::Part for GoogleIdentityAccesscontextmanagerV1ServicePerimeter {}
811
812/// `ServicePerimeterConfig` specifies a set of Google Cloud resources that describe specific Service Perimeter configuration.
813///
814/// This type is not used in any activity, and only used as *part* of another schema.
815///
816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
817#[serde_with::serde_as]
818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
819pub struct GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig {
820 /// A list of `AccessLevel` resource names that allow resources within the `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed must be in the same policy as this `ServicePerimeter`. Referencing a nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. Example: `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. For Service Perimeter Bridge, must be empty.
821 #[serde(rename = "accessLevels")]
822 pub access_levels: Option<Vec<String>>,
823 /// List of EgressPolicies to apply to the perimeter. A perimeter may have multiple EgressPolicies, each of which is evaluated separately. Access is granted if any EgressPolicy grants it. Must be empty for a perimeter bridge.
824 #[serde(rename = "egressPolicies")]
825 pub egress_policies: Option<Vec<GoogleIdentityAccesscontextmanagerV1EgressPolicy>>,
826 /// List of IngressPolicies to apply to the perimeter. A perimeter may have multiple IngressPolicies, each of which is evaluated separately. Access is granted if any Ingress Policy grants it. Must be empty for a perimeter bridge.
827 #[serde(rename = "ingressPolicies")]
828 pub ingress_policies: Option<Vec<GoogleIdentityAccesscontextmanagerV1IngressPolicy>>,
829 /// A list of Google Cloud resources that are inside of the service perimeter. Currently only projects and VPCs are allowed. Project format: `projects/{project_number}` VPC network format: `//compute.googleapis.com/projects/{PROJECT_ID}/global/networks/{NAME}`.
830 pub resources: Option<Vec<String>>,
831 /// Google Cloud services that are subject to the Service Perimeter restrictions. For example, if `storage.googleapis.com` is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions.
832 #[serde(rename = "restrictedServices")]
833 pub restricted_services: Option<Vec<String>>,
834 /// Configuration for APIs allowed within Perimeter.
835 #[serde(rename = "vpcAccessibleServices")]
836 pub vpc_accessible_services: Option<GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices>,
837}
838
839impl common::Part for GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig {}
840
841/// Specifies how APIs are allowed to communicate within the Service Perimeter.
842///
843/// This type is not used in any activity, and only used as *part* of another schema.
844///
845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
846#[serde_with::serde_as]
847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
848pub struct GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices {
849 /// The list of APIs usable within the Service Perimeter. Must be empty unless 'enable_restriction' is True. You can specify a list of individual services, as well as include the 'RESTRICTED-SERVICES' value, which automatically includes all of the services protected by the perimeter.
850 #[serde(rename = "allowedServices")]
851 pub allowed_services: Option<Vec<String>>,
852 /// Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowed_services'.
853 #[serde(rename = "enableRestriction")]
854 pub enable_restriction: Option<bool>,
855}
856
857impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices {}
858
859/// The originating network source in Google Cloud.
860///
861/// This type is not used in any activity, and only used as *part* of another schema.
862///
863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
864#[serde_with::serde_as]
865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
866pub struct GoogleIdentityAccesscontextmanagerV1VpcNetworkSource {
867 /// Sub-segment ranges of a VPC network.
868 #[serde(rename = "vpcSubnetwork")]
869 pub vpc_subnetwork: Option<GoogleIdentityAccesscontextmanagerV1VpcSubNetwork>,
870}
871
872impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcNetworkSource {}
873
874/// Sub-segment ranges inside of a VPC Network.
875///
876/// This type is not used in any activity, and only used as *part* of another schema.
877///
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct GoogleIdentityAccesscontextmanagerV1VpcSubNetwork {
882 /// Required. Network name. If the network is not part of the organization, the `compute.network.get` permission must be granted to the caller. Format: `//compute.googleapis.com/projects/{PROJECT_ID}/global/networks/{NETWORK_NAME}` Example: `//compute.googleapis.com/projects/my-project/global/networks/network-1`
883 pub network: Option<String>,
884 /// CIDR block IP subnetwork specification. The IP address must be an IPv4 address and can be a public or private IP address. Note that for a CIDR IP address block, the specified IP address portion must be properly truncated (i.e. all the host bits must be zero) or the input is considered malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. If empty, all IP addresses are allowed.
885 #[serde(rename = "vpcIpSubnetworks")]
886 pub vpc_ip_subnetworks: Option<Vec<String>>,
887}
888
889impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcSubNetwork {}
890
891/// This resource represents a long-running operation that is the result of a network API call.
892///
893/// # Activities
894///
895/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
896/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
897///
898/// * [operations get folders](FolderOperationGetCall) (response)
899/// * [export assets folders](FolderExportAssetCall) (response)
900/// * [operations get organizations](OrganizationOperationGetCall) (response)
901/// * [export assets organizations](OrganizationExportAssetCall) (response)
902/// * [operations get projects](ProjectOperationGetCall) (response)
903/// * [export assets projects](ProjectExportAssetCall) (response)
904#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
905#[serde_with::serde_as]
906#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
907pub struct Operation {
908 /// 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.
909 pub done: Option<bool>,
910 /// The error result of the operation in case of failure or cancellation.
911 pub error: Option<Status>,
912 /// 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.
913 pub metadata: Option<HashMap<String, serde_json::Value>>,
914 /// 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}`.
915 pub name: Option<String>,
916 /// 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`.
917 pub response: Option<HashMap<String, serde_json::Value>>,
918}
919
920impl common::ResponseResult for Operation {}
921
922/// Output configuration for export assets destination.
923///
924/// This type is not used in any activity, and only used as *part* of another schema.
925///
926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
927#[serde_with::serde_as]
928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
929pub struct OutputConfig {
930 /// Destination on Cloud Storage.
931 #[serde(rename = "gcsDestination")]
932 pub gcs_destination: Option<GcsDestination>,
933}
934
935impl common::Part for OutputConfig {}
936
937/// 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/).
938///
939/// This type is not used in any activity, and only used as *part* of another schema.
940///
941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
942#[serde_with::serde_as]
943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
944pub struct Policy {
945 /// Specifies cloud audit logging configuration for this policy.
946 #[serde(rename = "auditConfigs")]
947 pub audit_configs: Option<Vec<AuditConfig>>,
948 /// 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`.
949 pub bindings: Option<Vec<Binding>>,
950 /// `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.
951 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
952 pub etag: Option<Vec<u8>>,
953 /// 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).
954 pub version: Option<i32>,
955}
956
957impl common::Part for Policy {}
958
959/// A representation of a Google Cloud resource.
960///
961/// This type is not used in any activity, and only used as *part* of another schema.
962///
963#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
964#[serde_with::serde_as]
965#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
966pub struct Resource {
967 /// The content of the resource, in which some sensitive fields are removed and may not be present.
968 pub data: Option<HashMap<String, serde_json::Value>>,
969 /// The URL of the discovery document containing the resource's JSON schema. Example: `https://www.googleapis.com/discovery/v1/apis/compute/v1/rest` This value is unspecified for resources that do not have an API based on a discovery document, such as Cloud Bigtable.
970 #[serde(rename = "discoveryDocumentUri")]
971 pub discovery_document_uri: Option<String>,
972 /// The JSON schema name listed in the discovery document. Example: `Project` This value is unspecified for resources that do not have an API based on a discovery document, such as Cloud Bigtable.
973 #[serde(rename = "discoveryName")]
974 pub discovery_name: Option<String>,
975 /// The full name of the immediate parent of this resource. See [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) for more information. For Google Cloud assets, this value is the parent resource defined in the [IAM policy hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). Example: `//cloudresourcemanager.googleapis.com/projects/my_project_123` For third-party assets, this field may be set differently.
976 pub parent: Option<String>,
977 /// The REST URL for accessing the resource. An HTTP `GET` request using this URL returns the resource itself. Example: `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123` This value is unspecified for resources without a REST API.
978 #[serde(rename = "resourceUrl")]
979 pub resource_url: Option<String>,
980 /// The API version. Example: `v1`
981 pub version: Option<String>,
982}
983
984impl common::Part for Resource {}
985
986/// 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).
987///
988/// This type is not used in any activity, and only used as *part* of another schema.
989///
990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
991#[serde_with::serde_as]
992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
993pub struct Status {
994 /// The status code, which should be an enum value of google.rpc.Code.
995 pub code: Option<i32>,
996 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
997 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
998 /// 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.
999 pub message: Option<String>,
1000}
1001
1002impl common::Part for Status {}
1003
1004/// An asset in Google Cloud and its temporal metadata, including the time window when it was observed and its status during that window.
1005///
1006/// This type is not used in any activity, and only used as *part* of another schema.
1007///
1008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1009#[serde_with::serde_as]
1010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1011pub struct TemporalAsset {
1012 /// An asset in Google Cloud.
1013 pub asset: Option<Asset>,
1014 /// Whether the asset has been deleted or not.
1015 pub deleted: Option<bool>,
1016 /// The time window when the asset data and state was observed.
1017 pub window: Option<TimeWindow>,
1018}
1019
1020impl common::Part for TemporalAsset {}
1021
1022/// A time window specified by its `start_time` and `end_time`.
1023///
1024/// This type is not used in any activity, and only used as *part* of another schema.
1025///
1026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1027#[serde_with::serde_as]
1028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1029pub struct TimeWindow {
1030 /// End time of the time window (inclusive). If not specified, the current timestamp is used instead.
1031 #[serde(rename = "endTime")]
1032 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1033 /// Start time of the time window (exclusive).
1034 #[serde(rename = "startTime")]
1035 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1036}
1037
1038impl common::Part for TimeWindow {}
1039
1040// ###################
1041// MethodBuilders ###
1042// #################
1043
1044/// A builder providing access to all methods supported on *folder* resources.
1045/// It is not used directly, but through the [`CloudAsset`] hub.
1046///
1047/// # Example
1048///
1049/// Instantiate a resource builder
1050///
1051/// ```test_harness,no_run
1052/// extern crate hyper;
1053/// extern crate hyper_rustls;
1054/// extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
1055///
1056/// # async fn dox() {
1057/// use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1058///
1059/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1060/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1061/// .with_native_roots()
1062/// .unwrap()
1063/// .https_only()
1064/// .enable_http2()
1065/// .build();
1066///
1067/// let executor = hyper_util::rt::TokioExecutor::new();
1068/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1069/// secret,
1070/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1071/// yup_oauth2::client::CustomHyperClientBuilder::from(
1072/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1073/// ),
1074/// ).build().await.unwrap();
1075///
1076/// let client = hyper_util::client::legacy::Client::builder(
1077/// hyper_util::rt::TokioExecutor::new()
1078/// )
1079/// .build(
1080/// hyper_rustls::HttpsConnectorBuilder::new()
1081/// .with_native_roots()
1082/// .unwrap()
1083/// .https_or_http()
1084/// .enable_http2()
1085/// .build()
1086/// );
1087/// let mut hub = CloudAsset::new(client, auth);
1088/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1089/// // like `export_assets(...)` and `operations_get(...)`
1090/// // to build up your call.
1091/// let rb = hub.folders();
1092/// # }
1093/// ```
1094pub struct FolderMethods<'a, C>
1095where
1096 C: 'a,
1097{
1098 hub: &'a CloudAsset<C>,
1099}
1100
1101impl<'a, C> common::MethodsBuilder for FolderMethods<'a, C> {}
1102
1103impl<'a, C> FolderMethods<'a, C> {
1104 /// Create a builder to help you perform the following task:
1105 ///
1106 /// 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.
1107 ///
1108 /// # Arguments
1109 ///
1110 /// * `name` - The name of the operation resource.
1111 pub fn operations_get(&self, name: &str) -> FolderOperationGetCall<'a, C> {
1112 FolderOperationGetCall {
1113 hub: self.hub,
1114 _name: name.to_string(),
1115 _delegate: Default::default(),
1116 _additional_params: Default::default(),
1117 _scopes: Default::default(),
1118 }
1119 }
1120
1121 /// Create a builder to help you perform the following task:
1122 ///
1123 /// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
1124 ///
1125 /// # Arguments
1126 ///
1127 /// * `request` - No description provided.
1128 /// * `parent` - Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
1129 pub fn export_assets(
1130 &self,
1131 request: ExportAssetsRequest,
1132 parent: &str,
1133 ) -> FolderExportAssetCall<'a, C> {
1134 FolderExportAssetCall {
1135 hub: self.hub,
1136 _request: request,
1137 _parent: parent.to_string(),
1138 _delegate: Default::default(),
1139 _additional_params: Default::default(),
1140 _scopes: Default::default(),
1141 }
1142 }
1143}
1144
1145/// A builder providing access to all methods supported on *organization* resources.
1146/// It is not used directly, but through the [`CloudAsset`] hub.
1147///
1148/// # Example
1149///
1150/// Instantiate a resource builder
1151///
1152/// ```test_harness,no_run
1153/// extern crate hyper;
1154/// extern crate hyper_rustls;
1155/// extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
1156///
1157/// # async fn dox() {
1158/// use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1159///
1160/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1161/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1162/// .with_native_roots()
1163/// .unwrap()
1164/// .https_only()
1165/// .enable_http2()
1166/// .build();
1167///
1168/// let executor = hyper_util::rt::TokioExecutor::new();
1169/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1170/// secret,
1171/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1172/// yup_oauth2::client::CustomHyperClientBuilder::from(
1173/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1174/// ),
1175/// ).build().await.unwrap();
1176///
1177/// let client = hyper_util::client::legacy::Client::builder(
1178/// hyper_util::rt::TokioExecutor::new()
1179/// )
1180/// .build(
1181/// hyper_rustls::HttpsConnectorBuilder::new()
1182/// .with_native_roots()
1183/// .unwrap()
1184/// .https_or_http()
1185/// .enable_http2()
1186/// .build()
1187/// );
1188/// let mut hub = CloudAsset::new(client, auth);
1189/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1190/// // like `batch_get_assets_history(...)`, `export_assets(...)` and `operations_get(...)`
1191/// // to build up your call.
1192/// let rb = hub.organizations();
1193/// # }
1194/// ```
1195pub struct OrganizationMethods<'a, C>
1196where
1197 C: 'a,
1198{
1199 hub: &'a CloudAsset<C>,
1200}
1201
1202impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
1203
1204impl<'a, C> OrganizationMethods<'a, C> {
1205 /// Create a builder to help you perform the following task:
1206 ///
1207 /// 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.
1208 ///
1209 /// # Arguments
1210 ///
1211 /// * `name` - The name of the operation resource.
1212 pub fn operations_get(&self, name: &str) -> OrganizationOperationGetCall<'a, C> {
1213 OrganizationOperationGetCall {
1214 hub: self.hub,
1215 _name: name.to_string(),
1216 _delegate: Default::default(),
1217 _additional_params: Default::default(),
1218 _scopes: Default::default(),
1219 }
1220 }
1221
1222 /// Create a builder to help you perform the following task:
1223 ///
1224 /// Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
1225 ///
1226 /// # Arguments
1227 ///
1228 /// * `parent` - Required. The relative name of the root asset. It can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345").
1229 pub fn batch_get_assets_history(
1230 &self,
1231 parent: &str,
1232 ) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
1233 OrganizationBatchGetAssetsHistoryCall {
1234 hub: self.hub,
1235 _parent: parent.to_string(),
1236 _read_time_window_start_time: Default::default(),
1237 _read_time_window_end_time: Default::default(),
1238 _content_type: Default::default(),
1239 _asset_names: Default::default(),
1240 _delegate: Default::default(),
1241 _additional_params: Default::default(),
1242 _scopes: Default::default(),
1243 }
1244 }
1245
1246 /// Create a builder to help you perform the following task:
1247 ///
1248 /// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
1249 ///
1250 /// # Arguments
1251 ///
1252 /// * `request` - No description provided.
1253 /// * `parent` - Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
1254 pub fn export_assets(
1255 &self,
1256 request: ExportAssetsRequest,
1257 parent: &str,
1258 ) -> OrganizationExportAssetCall<'a, C> {
1259 OrganizationExportAssetCall {
1260 hub: self.hub,
1261 _request: request,
1262 _parent: parent.to_string(),
1263 _delegate: Default::default(),
1264 _additional_params: Default::default(),
1265 _scopes: Default::default(),
1266 }
1267 }
1268}
1269
1270/// A builder providing access to all methods supported on *project* resources.
1271/// It is not used directly, but through the [`CloudAsset`] hub.
1272///
1273/// # Example
1274///
1275/// Instantiate a resource builder
1276///
1277/// ```test_harness,no_run
1278/// extern crate hyper;
1279/// extern crate hyper_rustls;
1280/// extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
1281///
1282/// # async fn dox() {
1283/// use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1284///
1285/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1286/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1287/// .with_native_roots()
1288/// .unwrap()
1289/// .https_only()
1290/// .enable_http2()
1291/// .build();
1292///
1293/// let executor = hyper_util::rt::TokioExecutor::new();
1294/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1295/// secret,
1296/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1297/// yup_oauth2::client::CustomHyperClientBuilder::from(
1298/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1299/// ),
1300/// ).build().await.unwrap();
1301///
1302/// let client = hyper_util::client::legacy::Client::builder(
1303/// hyper_util::rt::TokioExecutor::new()
1304/// )
1305/// .build(
1306/// hyper_rustls::HttpsConnectorBuilder::new()
1307/// .with_native_roots()
1308/// .unwrap()
1309/// .https_or_http()
1310/// .enable_http2()
1311/// .build()
1312/// );
1313/// let mut hub = CloudAsset::new(client, auth);
1314/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1315/// // like `batch_get_assets_history(...)`, `export_assets(...)` and `operations_get(...)`
1316/// // to build up your call.
1317/// let rb = hub.projects();
1318/// # }
1319/// ```
1320pub struct ProjectMethods<'a, C>
1321where
1322 C: 'a,
1323{
1324 hub: &'a CloudAsset<C>,
1325}
1326
1327impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1328
1329impl<'a, C> ProjectMethods<'a, C> {
1330 /// Create a builder to help you perform the following task:
1331 ///
1332 /// 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.
1333 ///
1334 /// # Arguments
1335 ///
1336 /// * `name` - The name of the operation resource.
1337 pub fn operations_get(&self, name: &str) -> ProjectOperationGetCall<'a, C> {
1338 ProjectOperationGetCall {
1339 hub: self.hub,
1340 _name: name.to_string(),
1341 _delegate: Default::default(),
1342 _additional_params: Default::default(),
1343 _scopes: Default::default(),
1344 }
1345 }
1346
1347 /// Create a builder to help you perform the following task:
1348 ///
1349 /// Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
1350 ///
1351 /// # Arguments
1352 ///
1353 /// * `parent` - Required. The relative name of the root asset. It can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345").
1354 pub fn batch_get_assets_history(
1355 &self,
1356 parent: &str,
1357 ) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
1358 ProjectBatchGetAssetsHistoryCall {
1359 hub: self.hub,
1360 _parent: parent.to_string(),
1361 _read_time_window_start_time: Default::default(),
1362 _read_time_window_end_time: Default::default(),
1363 _content_type: Default::default(),
1364 _asset_names: Default::default(),
1365 _delegate: Default::default(),
1366 _additional_params: Default::default(),
1367 _scopes: Default::default(),
1368 }
1369 }
1370
1371 /// Create a builder to help you perform the following task:
1372 ///
1373 /// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
1374 ///
1375 /// # Arguments
1376 ///
1377 /// * `request` - No description provided.
1378 /// * `parent` - Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
1379 pub fn export_assets(
1380 &self,
1381 request: ExportAssetsRequest,
1382 parent: &str,
1383 ) -> ProjectExportAssetCall<'a, C> {
1384 ProjectExportAssetCall {
1385 hub: self.hub,
1386 _request: request,
1387 _parent: parent.to_string(),
1388 _delegate: Default::default(),
1389 _additional_params: Default::default(),
1390 _scopes: Default::default(),
1391 }
1392 }
1393}
1394
1395// ###################
1396// CallBuilders ###
1397// #################
1398
1399/// 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.
1400///
1401/// A builder for the *operations.get* method supported by a *folder* resource.
1402/// It is not used directly, but through a [`FolderMethods`] instance.
1403///
1404/// # Example
1405///
1406/// Instantiate a resource method builder
1407///
1408/// ```test_harness,no_run
1409/// # extern crate hyper;
1410/// # extern crate hyper_rustls;
1411/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
1412/// # async fn dox() {
1413/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1414///
1415/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1416/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1417/// # .with_native_roots()
1418/// # .unwrap()
1419/// # .https_only()
1420/// # .enable_http2()
1421/// # .build();
1422///
1423/// # let executor = hyper_util::rt::TokioExecutor::new();
1424/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1425/// # secret,
1426/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1427/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1428/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1429/// # ),
1430/// # ).build().await.unwrap();
1431///
1432/// # let client = hyper_util::client::legacy::Client::builder(
1433/// # hyper_util::rt::TokioExecutor::new()
1434/// # )
1435/// # .build(
1436/// # hyper_rustls::HttpsConnectorBuilder::new()
1437/// # .with_native_roots()
1438/// # .unwrap()
1439/// # .https_or_http()
1440/// # .enable_http2()
1441/// # .build()
1442/// # );
1443/// # let mut hub = CloudAsset::new(client, auth);
1444/// // You can configure optional parameters by calling the respective setters at will, and
1445/// // execute the final call using `doit()`.
1446/// // Values shown here are possibly random and not representative !
1447/// let result = hub.folders().operations_get("name")
1448/// .doit().await;
1449/// # }
1450/// ```
1451pub struct FolderOperationGetCall<'a, C>
1452where
1453 C: 'a,
1454{
1455 hub: &'a CloudAsset<C>,
1456 _name: String,
1457 _delegate: Option<&'a mut dyn common::Delegate>,
1458 _additional_params: HashMap<String, String>,
1459 _scopes: BTreeSet<String>,
1460}
1461
1462impl<'a, C> common::CallBuilder for FolderOperationGetCall<'a, C> {}
1463
1464impl<'a, C> FolderOperationGetCall<'a, C>
1465where
1466 C: common::Connector,
1467{
1468 /// Perform the operation you have build so far.
1469 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1470 use std::borrow::Cow;
1471 use std::io::{Read, Seek};
1472
1473 use common::{url::Params, ToParts};
1474 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1475
1476 let mut dd = common::DefaultDelegate;
1477 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1478 dlg.begin(common::MethodInfo {
1479 id: "cloudasset.folders.operations.get",
1480 http_method: hyper::Method::GET,
1481 });
1482
1483 for &field in ["alt", "name"].iter() {
1484 if self._additional_params.contains_key(field) {
1485 dlg.finished(false);
1486 return Err(common::Error::FieldClash(field));
1487 }
1488 }
1489
1490 let mut params = Params::with_capacity(3 + self._additional_params.len());
1491 params.push("name", self._name);
1492
1493 params.extend(self._additional_params.iter());
1494
1495 params.push("alt", "json");
1496 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
1497 if self._scopes.is_empty() {
1498 self._scopes
1499 .insert(Scope::CloudPlatform.as_ref().to_string());
1500 }
1501
1502 #[allow(clippy::single_element_loop)]
1503 for &(find_this, param_name) in [("{+name}", "name")].iter() {
1504 url = params.uri_replacement(url, param_name, find_this, true);
1505 }
1506 {
1507 let to_remove = ["name"];
1508 params.remove_params(&to_remove);
1509 }
1510
1511 let url = params.parse_with_url(&url);
1512
1513 loop {
1514 let token = match self
1515 .hub
1516 .auth
1517 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1518 .await
1519 {
1520 Ok(token) => token,
1521 Err(e) => match dlg.token(e) {
1522 Ok(token) => token,
1523 Err(e) => {
1524 dlg.finished(false);
1525 return Err(common::Error::MissingToken(e));
1526 }
1527 },
1528 };
1529 let mut req_result = {
1530 let client = &self.hub.client;
1531 dlg.pre_request();
1532 let mut req_builder = hyper::Request::builder()
1533 .method(hyper::Method::GET)
1534 .uri(url.as_str())
1535 .header(USER_AGENT, self.hub._user_agent.clone());
1536
1537 if let Some(token) = token.as_ref() {
1538 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1539 }
1540
1541 let request = req_builder
1542 .header(CONTENT_LENGTH, 0_u64)
1543 .body(common::to_body::<String>(None));
1544
1545 client.request(request.unwrap()).await
1546 };
1547
1548 match req_result {
1549 Err(err) => {
1550 if let common::Retry::After(d) = dlg.http_error(&err) {
1551 sleep(d).await;
1552 continue;
1553 }
1554 dlg.finished(false);
1555 return Err(common::Error::HttpError(err));
1556 }
1557 Ok(res) => {
1558 let (mut parts, body) = res.into_parts();
1559 let mut body = common::Body::new(body);
1560 if !parts.status.is_success() {
1561 let bytes = common::to_bytes(body).await.unwrap_or_default();
1562 let error = serde_json::from_str(&common::to_string(&bytes));
1563 let response = common::to_response(parts, bytes.into());
1564
1565 if let common::Retry::After(d) =
1566 dlg.http_failure(&response, error.as_ref().ok())
1567 {
1568 sleep(d).await;
1569 continue;
1570 }
1571
1572 dlg.finished(false);
1573
1574 return Err(match error {
1575 Ok(value) => common::Error::BadRequest(value),
1576 _ => common::Error::Failure(response),
1577 });
1578 }
1579 let response = {
1580 let bytes = common::to_bytes(body).await.unwrap_or_default();
1581 let encoded = common::to_string(&bytes);
1582 match serde_json::from_str(&encoded) {
1583 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1584 Err(error) => {
1585 dlg.response_json_decode_error(&encoded, &error);
1586 return Err(common::Error::JsonDecodeError(
1587 encoded.to_string(),
1588 error,
1589 ));
1590 }
1591 }
1592 };
1593
1594 dlg.finished(true);
1595 return Ok(response);
1596 }
1597 }
1598 }
1599 }
1600
1601 /// The name of the operation resource.
1602 ///
1603 /// Sets the *name* path property to the given value.
1604 ///
1605 /// Even though the property as already been set when instantiating this call,
1606 /// we provide this method for API completeness.
1607 pub fn name(mut self, new_value: &str) -> FolderOperationGetCall<'a, C> {
1608 self._name = new_value.to_string();
1609 self
1610 }
1611 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1612 /// while executing the actual API request.
1613 ///
1614 /// ````text
1615 /// It should be used to handle progress information, and to implement a certain level of resilience.
1616 /// ````
1617 ///
1618 /// Sets the *delegate* property to the given value.
1619 pub fn delegate(
1620 mut self,
1621 new_value: &'a mut dyn common::Delegate,
1622 ) -> FolderOperationGetCall<'a, C> {
1623 self._delegate = Some(new_value);
1624 self
1625 }
1626
1627 /// Set any additional parameter of the query string used in the request.
1628 /// It should be used to set parameters which are not yet available through their own
1629 /// setters.
1630 ///
1631 /// Please note that this method must not be used to set any of the known parameters
1632 /// which have their own setter method. If done anyway, the request will fail.
1633 ///
1634 /// # Additional Parameters
1635 ///
1636 /// * *$.xgafv* (query-string) - V1 error format.
1637 /// * *access_token* (query-string) - OAuth access token.
1638 /// * *alt* (query-string) - Data format for response.
1639 /// * *callback* (query-string) - JSONP
1640 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1641 /// * *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.
1642 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1643 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1644 /// * *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.
1645 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1646 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1647 pub fn param<T>(mut self, name: T, value: T) -> FolderOperationGetCall<'a, C>
1648 where
1649 T: AsRef<str>,
1650 {
1651 self._additional_params
1652 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1653 self
1654 }
1655
1656 /// Identifies the authorization scope for the method you are building.
1657 ///
1658 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1659 /// [`Scope::CloudPlatform`].
1660 ///
1661 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1662 /// tokens for more than one scope.
1663 ///
1664 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1665 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1666 /// sufficient, a read-write scope will do as well.
1667 pub fn add_scope<St>(mut self, scope: St) -> FolderOperationGetCall<'a, C>
1668 where
1669 St: AsRef<str>,
1670 {
1671 self._scopes.insert(String::from(scope.as_ref()));
1672 self
1673 }
1674 /// Identifies the authorization scope(s) for the method you are building.
1675 ///
1676 /// See [`Self::add_scope()`] for details.
1677 pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderOperationGetCall<'a, C>
1678 where
1679 I: IntoIterator<Item = St>,
1680 St: AsRef<str>,
1681 {
1682 self._scopes
1683 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1684 self
1685 }
1686
1687 /// Removes all scopes, and no default scope will be used either.
1688 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1689 /// for details).
1690 pub fn clear_scopes(mut self) -> FolderOperationGetCall<'a, C> {
1691 self._scopes.clear();
1692 self
1693 }
1694}
1695
1696/// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
1697///
1698/// A builder for the *exportAssets* method supported by a *folder* resource.
1699/// It is not used directly, but through a [`FolderMethods`] instance.
1700///
1701/// # Example
1702///
1703/// Instantiate a resource method builder
1704///
1705/// ```test_harness,no_run
1706/// # extern crate hyper;
1707/// # extern crate hyper_rustls;
1708/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
1709/// use cloudasset1_beta1::api::ExportAssetsRequest;
1710/// # async fn dox() {
1711/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1712///
1713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1715/// # .with_native_roots()
1716/// # .unwrap()
1717/// # .https_only()
1718/// # .enable_http2()
1719/// # .build();
1720///
1721/// # let executor = hyper_util::rt::TokioExecutor::new();
1722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1723/// # secret,
1724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1725/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1726/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1727/// # ),
1728/// # ).build().await.unwrap();
1729///
1730/// # let client = hyper_util::client::legacy::Client::builder(
1731/// # hyper_util::rt::TokioExecutor::new()
1732/// # )
1733/// # .build(
1734/// # hyper_rustls::HttpsConnectorBuilder::new()
1735/// # .with_native_roots()
1736/// # .unwrap()
1737/// # .https_or_http()
1738/// # .enable_http2()
1739/// # .build()
1740/// # );
1741/// # let mut hub = CloudAsset::new(client, auth);
1742/// // As the method needs a request, you would usually fill it with the desired information
1743/// // into the respective structure. Some of the parts shown here might not be applicable !
1744/// // Values shown here are possibly random and not representative !
1745/// let mut req = ExportAssetsRequest::default();
1746///
1747/// // You can configure optional parameters by calling the respective setters at will, and
1748/// // execute the final call using `doit()`.
1749/// // Values shown here are possibly random and not representative !
1750/// let result = hub.folders().export_assets(req, "parent")
1751/// .doit().await;
1752/// # }
1753/// ```
1754pub struct FolderExportAssetCall<'a, C>
1755where
1756 C: 'a,
1757{
1758 hub: &'a CloudAsset<C>,
1759 _request: ExportAssetsRequest,
1760 _parent: String,
1761 _delegate: Option<&'a mut dyn common::Delegate>,
1762 _additional_params: HashMap<String, String>,
1763 _scopes: BTreeSet<String>,
1764}
1765
1766impl<'a, C> common::CallBuilder for FolderExportAssetCall<'a, C> {}
1767
1768impl<'a, C> FolderExportAssetCall<'a, C>
1769where
1770 C: common::Connector,
1771{
1772 /// Perform the operation you have build so far.
1773 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
1774 use std::borrow::Cow;
1775 use std::io::{Read, Seek};
1776
1777 use common::{url::Params, ToParts};
1778 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1779
1780 let mut dd = common::DefaultDelegate;
1781 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1782 dlg.begin(common::MethodInfo {
1783 id: "cloudasset.folders.exportAssets",
1784 http_method: hyper::Method::POST,
1785 });
1786
1787 for &field in ["alt", "parent"].iter() {
1788 if self._additional_params.contains_key(field) {
1789 dlg.finished(false);
1790 return Err(common::Error::FieldClash(field));
1791 }
1792 }
1793
1794 let mut params = Params::with_capacity(4 + self._additional_params.len());
1795 params.push("parent", self._parent);
1796
1797 params.extend(self._additional_params.iter());
1798
1799 params.push("alt", "json");
1800 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:exportAssets";
1801 if self._scopes.is_empty() {
1802 self._scopes
1803 .insert(Scope::CloudPlatform.as_ref().to_string());
1804 }
1805
1806 #[allow(clippy::single_element_loop)]
1807 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1808 url = params.uri_replacement(url, param_name, find_this, true);
1809 }
1810 {
1811 let to_remove = ["parent"];
1812 params.remove_params(&to_remove);
1813 }
1814
1815 let url = params.parse_with_url(&url);
1816
1817 let mut json_mime_type = mime::APPLICATION_JSON;
1818 let mut request_value_reader = {
1819 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1820 common::remove_json_null_values(&mut value);
1821 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1822 serde_json::to_writer(&mut dst, &value).unwrap();
1823 dst
1824 };
1825 let request_size = request_value_reader
1826 .seek(std::io::SeekFrom::End(0))
1827 .unwrap();
1828 request_value_reader
1829 .seek(std::io::SeekFrom::Start(0))
1830 .unwrap();
1831
1832 loop {
1833 let token = match self
1834 .hub
1835 .auth
1836 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1837 .await
1838 {
1839 Ok(token) => token,
1840 Err(e) => match dlg.token(e) {
1841 Ok(token) => token,
1842 Err(e) => {
1843 dlg.finished(false);
1844 return Err(common::Error::MissingToken(e));
1845 }
1846 },
1847 };
1848 request_value_reader
1849 .seek(std::io::SeekFrom::Start(0))
1850 .unwrap();
1851 let mut req_result = {
1852 let client = &self.hub.client;
1853 dlg.pre_request();
1854 let mut req_builder = hyper::Request::builder()
1855 .method(hyper::Method::POST)
1856 .uri(url.as_str())
1857 .header(USER_AGENT, self.hub._user_agent.clone());
1858
1859 if let Some(token) = token.as_ref() {
1860 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1861 }
1862
1863 let request = req_builder
1864 .header(CONTENT_TYPE, json_mime_type.to_string())
1865 .header(CONTENT_LENGTH, request_size as u64)
1866 .body(common::to_body(
1867 request_value_reader.get_ref().clone().into(),
1868 ));
1869
1870 client.request(request.unwrap()).await
1871 };
1872
1873 match req_result {
1874 Err(err) => {
1875 if let common::Retry::After(d) = dlg.http_error(&err) {
1876 sleep(d).await;
1877 continue;
1878 }
1879 dlg.finished(false);
1880 return Err(common::Error::HttpError(err));
1881 }
1882 Ok(res) => {
1883 let (mut parts, body) = res.into_parts();
1884 let mut body = common::Body::new(body);
1885 if !parts.status.is_success() {
1886 let bytes = common::to_bytes(body).await.unwrap_or_default();
1887 let error = serde_json::from_str(&common::to_string(&bytes));
1888 let response = common::to_response(parts, bytes.into());
1889
1890 if let common::Retry::After(d) =
1891 dlg.http_failure(&response, error.as_ref().ok())
1892 {
1893 sleep(d).await;
1894 continue;
1895 }
1896
1897 dlg.finished(false);
1898
1899 return Err(match error {
1900 Ok(value) => common::Error::BadRequest(value),
1901 _ => common::Error::Failure(response),
1902 });
1903 }
1904 let response = {
1905 let bytes = common::to_bytes(body).await.unwrap_or_default();
1906 let encoded = common::to_string(&bytes);
1907 match serde_json::from_str(&encoded) {
1908 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1909 Err(error) => {
1910 dlg.response_json_decode_error(&encoded, &error);
1911 return Err(common::Error::JsonDecodeError(
1912 encoded.to_string(),
1913 error,
1914 ));
1915 }
1916 }
1917 };
1918
1919 dlg.finished(true);
1920 return Ok(response);
1921 }
1922 }
1923 }
1924 }
1925
1926 ///
1927 /// Sets the *request* property to the given value.
1928 ///
1929 /// Even though the property as already been set when instantiating this call,
1930 /// we provide this method for API completeness.
1931 pub fn request(mut self, new_value: ExportAssetsRequest) -> FolderExportAssetCall<'a, C> {
1932 self._request = new_value;
1933 self
1934 }
1935 /// Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
1936 ///
1937 /// Sets the *parent* path property to the given value.
1938 ///
1939 /// Even though the property as already been set when instantiating this call,
1940 /// we provide this method for API completeness.
1941 pub fn parent(mut self, new_value: &str) -> FolderExportAssetCall<'a, C> {
1942 self._parent = new_value.to_string();
1943 self
1944 }
1945 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1946 /// while executing the actual API request.
1947 ///
1948 /// ````text
1949 /// It should be used to handle progress information, and to implement a certain level of resilience.
1950 /// ````
1951 ///
1952 /// Sets the *delegate* property to the given value.
1953 pub fn delegate(
1954 mut self,
1955 new_value: &'a mut dyn common::Delegate,
1956 ) -> FolderExportAssetCall<'a, C> {
1957 self._delegate = Some(new_value);
1958 self
1959 }
1960
1961 /// Set any additional parameter of the query string used in the request.
1962 /// It should be used to set parameters which are not yet available through their own
1963 /// setters.
1964 ///
1965 /// Please note that this method must not be used to set any of the known parameters
1966 /// which have their own setter method. If done anyway, the request will fail.
1967 ///
1968 /// # Additional Parameters
1969 ///
1970 /// * *$.xgafv* (query-string) - V1 error format.
1971 /// * *access_token* (query-string) - OAuth access token.
1972 /// * *alt* (query-string) - Data format for response.
1973 /// * *callback* (query-string) - JSONP
1974 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1975 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1976 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1977 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1978 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1979 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1980 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1981 pub fn param<T>(mut self, name: T, value: T) -> FolderExportAssetCall<'a, C>
1982 where
1983 T: AsRef<str>,
1984 {
1985 self._additional_params
1986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1987 self
1988 }
1989
1990 /// Identifies the authorization scope for the method you are building.
1991 ///
1992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1993 /// [`Scope::CloudPlatform`].
1994 ///
1995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1996 /// tokens for more than one scope.
1997 ///
1998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
1999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2000 /// sufficient, a read-write scope will do as well.
2001 pub fn add_scope<St>(mut self, scope: St) -> FolderExportAssetCall<'a, C>
2002 where
2003 St: AsRef<str>,
2004 {
2005 self._scopes.insert(String::from(scope.as_ref()));
2006 self
2007 }
2008 /// Identifies the authorization scope(s) for the method you are building.
2009 ///
2010 /// See [`Self::add_scope()`] for details.
2011 pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderExportAssetCall<'a, C>
2012 where
2013 I: IntoIterator<Item = St>,
2014 St: AsRef<str>,
2015 {
2016 self._scopes
2017 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2018 self
2019 }
2020
2021 /// Removes all scopes, and no default scope will be used either.
2022 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2023 /// for details).
2024 pub fn clear_scopes(mut self) -> FolderExportAssetCall<'a, C> {
2025 self._scopes.clear();
2026 self
2027 }
2028}
2029
2030/// 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.
2031///
2032/// A builder for the *operations.get* method supported by a *organization* resource.
2033/// It is not used directly, but through a [`OrganizationMethods`] instance.
2034///
2035/// # Example
2036///
2037/// Instantiate a resource method builder
2038///
2039/// ```test_harness,no_run
2040/// # extern crate hyper;
2041/// # extern crate hyper_rustls;
2042/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
2043/// # async fn dox() {
2044/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2045///
2046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2047/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2048/// # .with_native_roots()
2049/// # .unwrap()
2050/// # .https_only()
2051/// # .enable_http2()
2052/// # .build();
2053///
2054/// # let executor = hyper_util::rt::TokioExecutor::new();
2055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2056/// # secret,
2057/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2058/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2059/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2060/// # ),
2061/// # ).build().await.unwrap();
2062///
2063/// # let client = hyper_util::client::legacy::Client::builder(
2064/// # hyper_util::rt::TokioExecutor::new()
2065/// # )
2066/// # .build(
2067/// # hyper_rustls::HttpsConnectorBuilder::new()
2068/// # .with_native_roots()
2069/// # .unwrap()
2070/// # .https_or_http()
2071/// # .enable_http2()
2072/// # .build()
2073/// # );
2074/// # let mut hub = CloudAsset::new(client, auth);
2075/// // You can configure optional parameters by calling the respective setters at will, and
2076/// // execute the final call using `doit()`.
2077/// // Values shown here are possibly random and not representative !
2078/// let result = hub.organizations().operations_get("name")
2079/// .doit().await;
2080/// # }
2081/// ```
2082pub struct OrganizationOperationGetCall<'a, C>
2083where
2084 C: 'a,
2085{
2086 hub: &'a CloudAsset<C>,
2087 _name: String,
2088 _delegate: Option<&'a mut dyn common::Delegate>,
2089 _additional_params: HashMap<String, String>,
2090 _scopes: BTreeSet<String>,
2091}
2092
2093impl<'a, C> common::CallBuilder for OrganizationOperationGetCall<'a, C> {}
2094
2095impl<'a, C> OrganizationOperationGetCall<'a, C>
2096where
2097 C: common::Connector,
2098{
2099 /// Perform the operation you have build so far.
2100 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2101 use std::borrow::Cow;
2102 use std::io::{Read, Seek};
2103
2104 use common::{url::Params, ToParts};
2105 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2106
2107 let mut dd = common::DefaultDelegate;
2108 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2109 dlg.begin(common::MethodInfo {
2110 id: "cloudasset.organizations.operations.get",
2111 http_method: hyper::Method::GET,
2112 });
2113
2114 for &field in ["alt", "name"].iter() {
2115 if self._additional_params.contains_key(field) {
2116 dlg.finished(false);
2117 return Err(common::Error::FieldClash(field));
2118 }
2119 }
2120
2121 let mut params = Params::with_capacity(3 + self._additional_params.len());
2122 params.push("name", self._name);
2123
2124 params.extend(self._additional_params.iter());
2125
2126 params.push("alt", "json");
2127 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2128 if self._scopes.is_empty() {
2129 self._scopes
2130 .insert(Scope::CloudPlatform.as_ref().to_string());
2131 }
2132
2133 #[allow(clippy::single_element_loop)]
2134 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2135 url = params.uri_replacement(url, param_name, find_this, true);
2136 }
2137 {
2138 let to_remove = ["name"];
2139 params.remove_params(&to_remove);
2140 }
2141
2142 let url = params.parse_with_url(&url);
2143
2144 loop {
2145 let token = match self
2146 .hub
2147 .auth
2148 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2149 .await
2150 {
2151 Ok(token) => token,
2152 Err(e) => match dlg.token(e) {
2153 Ok(token) => token,
2154 Err(e) => {
2155 dlg.finished(false);
2156 return Err(common::Error::MissingToken(e));
2157 }
2158 },
2159 };
2160 let mut req_result = {
2161 let client = &self.hub.client;
2162 dlg.pre_request();
2163 let mut req_builder = hyper::Request::builder()
2164 .method(hyper::Method::GET)
2165 .uri(url.as_str())
2166 .header(USER_AGENT, self.hub._user_agent.clone());
2167
2168 if let Some(token) = token.as_ref() {
2169 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2170 }
2171
2172 let request = req_builder
2173 .header(CONTENT_LENGTH, 0_u64)
2174 .body(common::to_body::<String>(None));
2175
2176 client.request(request.unwrap()).await
2177 };
2178
2179 match req_result {
2180 Err(err) => {
2181 if let common::Retry::After(d) = dlg.http_error(&err) {
2182 sleep(d).await;
2183 continue;
2184 }
2185 dlg.finished(false);
2186 return Err(common::Error::HttpError(err));
2187 }
2188 Ok(res) => {
2189 let (mut parts, body) = res.into_parts();
2190 let mut body = common::Body::new(body);
2191 if !parts.status.is_success() {
2192 let bytes = common::to_bytes(body).await.unwrap_or_default();
2193 let error = serde_json::from_str(&common::to_string(&bytes));
2194 let response = common::to_response(parts, bytes.into());
2195
2196 if let common::Retry::After(d) =
2197 dlg.http_failure(&response, error.as_ref().ok())
2198 {
2199 sleep(d).await;
2200 continue;
2201 }
2202
2203 dlg.finished(false);
2204
2205 return Err(match error {
2206 Ok(value) => common::Error::BadRequest(value),
2207 _ => common::Error::Failure(response),
2208 });
2209 }
2210 let response = {
2211 let bytes = common::to_bytes(body).await.unwrap_or_default();
2212 let encoded = common::to_string(&bytes);
2213 match serde_json::from_str(&encoded) {
2214 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2215 Err(error) => {
2216 dlg.response_json_decode_error(&encoded, &error);
2217 return Err(common::Error::JsonDecodeError(
2218 encoded.to_string(),
2219 error,
2220 ));
2221 }
2222 }
2223 };
2224
2225 dlg.finished(true);
2226 return Ok(response);
2227 }
2228 }
2229 }
2230 }
2231
2232 /// The name of the operation resource.
2233 ///
2234 /// Sets the *name* path property to the given value.
2235 ///
2236 /// Even though the property as already been set when instantiating this call,
2237 /// we provide this method for API completeness.
2238 pub fn name(mut self, new_value: &str) -> OrganizationOperationGetCall<'a, C> {
2239 self._name = new_value.to_string();
2240 self
2241 }
2242 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2243 /// while executing the actual API request.
2244 ///
2245 /// ````text
2246 /// It should be used to handle progress information, and to implement a certain level of resilience.
2247 /// ````
2248 ///
2249 /// Sets the *delegate* property to the given value.
2250 pub fn delegate(
2251 mut self,
2252 new_value: &'a mut dyn common::Delegate,
2253 ) -> OrganizationOperationGetCall<'a, C> {
2254 self._delegate = Some(new_value);
2255 self
2256 }
2257
2258 /// Set any additional parameter of the query string used in the request.
2259 /// It should be used to set parameters which are not yet available through their own
2260 /// setters.
2261 ///
2262 /// Please note that this method must not be used to set any of the known parameters
2263 /// which have their own setter method. If done anyway, the request will fail.
2264 ///
2265 /// # Additional Parameters
2266 ///
2267 /// * *$.xgafv* (query-string) - V1 error format.
2268 /// * *access_token* (query-string) - OAuth access token.
2269 /// * *alt* (query-string) - Data format for response.
2270 /// * *callback* (query-string) - JSONP
2271 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2272 /// * *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.
2273 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2274 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2275 /// * *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.
2276 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2277 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2278 pub fn param<T>(mut self, name: T, value: T) -> OrganizationOperationGetCall<'a, C>
2279 where
2280 T: AsRef<str>,
2281 {
2282 self._additional_params
2283 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2284 self
2285 }
2286
2287 /// Identifies the authorization scope for the method you are building.
2288 ///
2289 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2290 /// [`Scope::CloudPlatform`].
2291 ///
2292 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2293 /// tokens for more than one scope.
2294 ///
2295 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2296 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2297 /// sufficient, a read-write scope will do as well.
2298 pub fn add_scope<St>(mut self, scope: St) -> OrganizationOperationGetCall<'a, C>
2299 where
2300 St: AsRef<str>,
2301 {
2302 self._scopes.insert(String::from(scope.as_ref()));
2303 self
2304 }
2305 /// Identifies the authorization scope(s) for the method you are building.
2306 ///
2307 /// See [`Self::add_scope()`] for details.
2308 pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationOperationGetCall<'a, C>
2309 where
2310 I: IntoIterator<Item = St>,
2311 St: AsRef<str>,
2312 {
2313 self._scopes
2314 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2315 self
2316 }
2317
2318 /// Removes all scopes, and no default scope will be used either.
2319 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2320 /// for details).
2321 pub fn clear_scopes(mut self) -> OrganizationOperationGetCall<'a, C> {
2322 self._scopes.clear();
2323 self
2324 }
2325}
2326
2327/// Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
2328///
2329/// A builder for the *batchGetAssetsHistory* method supported by a *organization* resource.
2330/// It is not used directly, but through a [`OrganizationMethods`] instance.
2331///
2332/// # Example
2333///
2334/// Instantiate a resource method builder
2335///
2336/// ```test_harness,no_run
2337/// # extern crate hyper;
2338/// # extern crate hyper_rustls;
2339/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
2340/// # async fn dox() {
2341/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2342///
2343/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2344/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2345/// # .with_native_roots()
2346/// # .unwrap()
2347/// # .https_only()
2348/// # .enable_http2()
2349/// # .build();
2350///
2351/// # let executor = hyper_util::rt::TokioExecutor::new();
2352/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2353/// # secret,
2354/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2355/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2356/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2357/// # ),
2358/// # ).build().await.unwrap();
2359///
2360/// # let client = hyper_util::client::legacy::Client::builder(
2361/// # hyper_util::rt::TokioExecutor::new()
2362/// # )
2363/// # .build(
2364/// # hyper_rustls::HttpsConnectorBuilder::new()
2365/// # .with_native_roots()
2366/// # .unwrap()
2367/// # .https_or_http()
2368/// # .enable_http2()
2369/// # .build()
2370/// # );
2371/// # let mut hub = CloudAsset::new(client, auth);
2372/// // You can configure optional parameters by calling the respective setters at will, and
2373/// // execute the final call using `doit()`.
2374/// // Values shown here are possibly random and not representative !
2375/// let result = hub.organizations().batch_get_assets_history("parent")
2376/// .read_time_window_start_time(chrono::Utc::now())
2377/// .read_time_window_end_time(chrono::Utc::now())
2378/// .content_type("sed")
2379/// .add_asset_names("amet.")
2380/// .doit().await;
2381/// # }
2382/// ```
2383pub struct OrganizationBatchGetAssetsHistoryCall<'a, C>
2384where
2385 C: 'a,
2386{
2387 hub: &'a CloudAsset<C>,
2388 _parent: String,
2389 _read_time_window_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2390 _read_time_window_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2391 _content_type: Option<String>,
2392 _asset_names: Vec<String>,
2393 _delegate: Option<&'a mut dyn common::Delegate>,
2394 _additional_params: HashMap<String, String>,
2395 _scopes: BTreeSet<String>,
2396}
2397
2398impl<'a, C> common::CallBuilder for OrganizationBatchGetAssetsHistoryCall<'a, C> {}
2399
2400impl<'a, C> OrganizationBatchGetAssetsHistoryCall<'a, C>
2401where
2402 C: common::Connector,
2403{
2404 /// Perform the operation you have build so far.
2405 pub async fn doit(
2406 mut self,
2407 ) -> common::Result<(common::Response, BatchGetAssetsHistoryResponse)> {
2408 use std::borrow::Cow;
2409 use std::io::{Read, Seek};
2410
2411 use common::{url::Params, ToParts};
2412 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2413
2414 let mut dd = common::DefaultDelegate;
2415 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2416 dlg.begin(common::MethodInfo {
2417 id: "cloudasset.organizations.batchGetAssetsHistory",
2418 http_method: hyper::Method::GET,
2419 });
2420
2421 for &field in [
2422 "alt",
2423 "parent",
2424 "readTimeWindow.startTime",
2425 "readTimeWindow.endTime",
2426 "contentType",
2427 "assetNames",
2428 ]
2429 .iter()
2430 {
2431 if self._additional_params.contains_key(field) {
2432 dlg.finished(false);
2433 return Err(common::Error::FieldClash(field));
2434 }
2435 }
2436
2437 let mut params = Params::with_capacity(7 + self._additional_params.len());
2438 params.push("parent", self._parent);
2439 if let Some(value) = self._read_time_window_start_time.as_ref() {
2440 params.push(
2441 "readTimeWindow.startTime",
2442 common::serde::datetime_to_string(&value),
2443 );
2444 }
2445 if let Some(value) = self._read_time_window_end_time.as_ref() {
2446 params.push(
2447 "readTimeWindow.endTime",
2448 common::serde::datetime_to_string(&value),
2449 );
2450 }
2451 if let Some(value) = self._content_type.as_ref() {
2452 params.push("contentType", value);
2453 }
2454 if !self._asset_names.is_empty() {
2455 for f in self._asset_names.iter() {
2456 params.push("assetNames", f);
2457 }
2458 }
2459
2460 params.extend(self._additional_params.iter());
2461
2462 params.push("alt", "json");
2463 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:batchGetAssetsHistory";
2464 if self._scopes.is_empty() {
2465 self._scopes
2466 .insert(Scope::CloudPlatform.as_ref().to_string());
2467 }
2468
2469 #[allow(clippy::single_element_loop)]
2470 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2471 url = params.uri_replacement(url, param_name, find_this, true);
2472 }
2473 {
2474 let to_remove = ["parent"];
2475 params.remove_params(&to_remove);
2476 }
2477
2478 let url = params.parse_with_url(&url);
2479
2480 loop {
2481 let token = match self
2482 .hub
2483 .auth
2484 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2485 .await
2486 {
2487 Ok(token) => token,
2488 Err(e) => match dlg.token(e) {
2489 Ok(token) => token,
2490 Err(e) => {
2491 dlg.finished(false);
2492 return Err(common::Error::MissingToken(e));
2493 }
2494 },
2495 };
2496 let mut req_result = {
2497 let client = &self.hub.client;
2498 dlg.pre_request();
2499 let mut req_builder = hyper::Request::builder()
2500 .method(hyper::Method::GET)
2501 .uri(url.as_str())
2502 .header(USER_AGENT, self.hub._user_agent.clone());
2503
2504 if let Some(token) = token.as_ref() {
2505 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2506 }
2507
2508 let request = req_builder
2509 .header(CONTENT_LENGTH, 0_u64)
2510 .body(common::to_body::<String>(None));
2511
2512 client.request(request.unwrap()).await
2513 };
2514
2515 match req_result {
2516 Err(err) => {
2517 if let common::Retry::After(d) = dlg.http_error(&err) {
2518 sleep(d).await;
2519 continue;
2520 }
2521 dlg.finished(false);
2522 return Err(common::Error::HttpError(err));
2523 }
2524 Ok(res) => {
2525 let (mut parts, body) = res.into_parts();
2526 let mut body = common::Body::new(body);
2527 if !parts.status.is_success() {
2528 let bytes = common::to_bytes(body).await.unwrap_or_default();
2529 let error = serde_json::from_str(&common::to_string(&bytes));
2530 let response = common::to_response(parts, bytes.into());
2531
2532 if let common::Retry::After(d) =
2533 dlg.http_failure(&response, error.as_ref().ok())
2534 {
2535 sleep(d).await;
2536 continue;
2537 }
2538
2539 dlg.finished(false);
2540
2541 return Err(match error {
2542 Ok(value) => common::Error::BadRequest(value),
2543 _ => common::Error::Failure(response),
2544 });
2545 }
2546 let response = {
2547 let bytes = common::to_bytes(body).await.unwrap_or_default();
2548 let encoded = common::to_string(&bytes);
2549 match serde_json::from_str(&encoded) {
2550 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2551 Err(error) => {
2552 dlg.response_json_decode_error(&encoded, &error);
2553 return Err(common::Error::JsonDecodeError(
2554 encoded.to_string(),
2555 error,
2556 ));
2557 }
2558 }
2559 };
2560
2561 dlg.finished(true);
2562 return Ok(response);
2563 }
2564 }
2565 }
2566 }
2567
2568 /// Required. The relative name of the root asset. It can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345").
2569 ///
2570 /// Sets the *parent* path property to the given value.
2571 ///
2572 /// Even though the property as already been set when instantiating this call,
2573 /// we provide this method for API completeness.
2574 pub fn parent(mut self, new_value: &str) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2575 self._parent = new_value.to_string();
2576 self
2577 }
2578 /// Start time of the time window (exclusive).
2579 ///
2580 /// Sets the *read time window.start time* query property to the given value.
2581 pub fn read_time_window_start_time(
2582 mut self,
2583 new_value: chrono::DateTime<chrono::offset::Utc>,
2584 ) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2585 self._read_time_window_start_time = Some(new_value);
2586 self
2587 }
2588 /// End time of the time window (inclusive). If not specified, the current timestamp is used instead.
2589 ///
2590 /// Sets the *read time window.end time* query property to the given value.
2591 pub fn read_time_window_end_time(
2592 mut self,
2593 new_value: chrono::DateTime<chrono::offset::Utc>,
2594 ) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2595 self._read_time_window_end_time = Some(new_value);
2596 self
2597 }
2598 /// Optional. The content type.
2599 ///
2600 /// Sets the *content type* query property to the given value.
2601 pub fn content_type(mut self, new_value: &str) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2602 self._content_type = Some(new_value.to_string());
2603 self
2604 }
2605 /// A list of the full names of the assets. For example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. See [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) for more info. The request becomes a no-op if the asset name list is empty, and the max size of the asset name list is 100 in one request.
2606 ///
2607 /// Append the given value to the *asset names* query property.
2608 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
2609 pub fn add_asset_names(
2610 mut self,
2611 new_value: &str,
2612 ) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2613 self._asset_names.push(new_value.to_string());
2614 self
2615 }
2616 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2617 /// while executing the actual API request.
2618 ///
2619 /// ````text
2620 /// It should be used to handle progress information, and to implement a certain level of resilience.
2621 /// ````
2622 ///
2623 /// Sets the *delegate* property to the given value.
2624 pub fn delegate(
2625 mut self,
2626 new_value: &'a mut dyn common::Delegate,
2627 ) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2628 self._delegate = Some(new_value);
2629 self
2630 }
2631
2632 /// Set any additional parameter of the query string used in the request.
2633 /// It should be used to set parameters which are not yet available through their own
2634 /// setters.
2635 ///
2636 /// Please note that this method must not be used to set any of the known parameters
2637 /// which have their own setter method. If done anyway, the request will fail.
2638 ///
2639 /// # Additional Parameters
2640 ///
2641 /// * *$.xgafv* (query-string) - V1 error format.
2642 /// * *access_token* (query-string) - OAuth access token.
2643 /// * *alt* (query-string) - Data format for response.
2644 /// * *callback* (query-string) - JSONP
2645 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2646 /// * *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.
2647 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2648 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2649 /// * *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.
2650 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2651 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2652 pub fn param<T>(mut self, name: T, value: T) -> OrganizationBatchGetAssetsHistoryCall<'a, C>
2653 where
2654 T: AsRef<str>,
2655 {
2656 self._additional_params
2657 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2658 self
2659 }
2660
2661 /// Identifies the authorization scope for the method you are building.
2662 ///
2663 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2664 /// [`Scope::CloudPlatform`].
2665 ///
2666 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2667 /// tokens for more than one scope.
2668 ///
2669 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2670 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2671 /// sufficient, a read-write scope will do as well.
2672 pub fn add_scope<St>(mut self, scope: St) -> OrganizationBatchGetAssetsHistoryCall<'a, C>
2673 where
2674 St: AsRef<str>,
2675 {
2676 self._scopes.insert(String::from(scope.as_ref()));
2677 self
2678 }
2679 /// Identifies the authorization scope(s) for the method you are building.
2680 ///
2681 /// See [`Self::add_scope()`] for details.
2682 pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationBatchGetAssetsHistoryCall<'a, C>
2683 where
2684 I: IntoIterator<Item = St>,
2685 St: AsRef<str>,
2686 {
2687 self._scopes
2688 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2689 self
2690 }
2691
2692 /// Removes all scopes, and no default scope will be used either.
2693 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2694 /// for details).
2695 pub fn clear_scopes(mut self) -> OrganizationBatchGetAssetsHistoryCall<'a, C> {
2696 self._scopes.clear();
2697 self
2698 }
2699}
2700
2701/// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
2702///
2703/// A builder for the *exportAssets* method supported by a *organization* resource.
2704/// It is not used directly, but through a [`OrganizationMethods`] instance.
2705///
2706/// # Example
2707///
2708/// Instantiate a resource method builder
2709///
2710/// ```test_harness,no_run
2711/// # extern crate hyper;
2712/// # extern crate hyper_rustls;
2713/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
2714/// use cloudasset1_beta1::api::ExportAssetsRequest;
2715/// # async fn dox() {
2716/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2717///
2718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2719/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2720/// # .with_native_roots()
2721/// # .unwrap()
2722/// # .https_only()
2723/// # .enable_http2()
2724/// # .build();
2725///
2726/// # let executor = hyper_util::rt::TokioExecutor::new();
2727/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2728/// # secret,
2729/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2730/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2731/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2732/// # ),
2733/// # ).build().await.unwrap();
2734///
2735/// # let client = hyper_util::client::legacy::Client::builder(
2736/// # hyper_util::rt::TokioExecutor::new()
2737/// # )
2738/// # .build(
2739/// # hyper_rustls::HttpsConnectorBuilder::new()
2740/// # .with_native_roots()
2741/// # .unwrap()
2742/// # .https_or_http()
2743/// # .enable_http2()
2744/// # .build()
2745/// # );
2746/// # let mut hub = CloudAsset::new(client, auth);
2747/// // As the method needs a request, you would usually fill it with the desired information
2748/// // into the respective structure. Some of the parts shown here might not be applicable !
2749/// // Values shown here are possibly random and not representative !
2750/// let mut req = ExportAssetsRequest::default();
2751///
2752/// // You can configure optional parameters by calling the respective setters at will, and
2753/// // execute the final call using `doit()`.
2754/// // Values shown here are possibly random and not representative !
2755/// let result = hub.organizations().export_assets(req, "parent")
2756/// .doit().await;
2757/// # }
2758/// ```
2759pub struct OrganizationExportAssetCall<'a, C>
2760where
2761 C: 'a,
2762{
2763 hub: &'a CloudAsset<C>,
2764 _request: ExportAssetsRequest,
2765 _parent: String,
2766 _delegate: Option<&'a mut dyn common::Delegate>,
2767 _additional_params: HashMap<String, String>,
2768 _scopes: BTreeSet<String>,
2769}
2770
2771impl<'a, C> common::CallBuilder for OrganizationExportAssetCall<'a, C> {}
2772
2773impl<'a, C> OrganizationExportAssetCall<'a, C>
2774where
2775 C: common::Connector,
2776{
2777 /// Perform the operation you have build so far.
2778 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2779 use std::borrow::Cow;
2780 use std::io::{Read, Seek};
2781
2782 use common::{url::Params, ToParts};
2783 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2784
2785 let mut dd = common::DefaultDelegate;
2786 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2787 dlg.begin(common::MethodInfo {
2788 id: "cloudasset.organizations.exportAssets",
2789 http_method: hyper::Method::POST,
2790 });
2791
2792 for &field in ["alt", "parent"].iter() {
2793 if self._additional_params.contains_key(field) {
2794 dlg.finished(false);
2795 return Err(common::Error::FieldClash(field));
2796 }
2797 }
2798
2799 let mut params = Params::with_capacity(4 + self._additional_params.len());
2800 params.push("parent", self._parent);
2801
2802 params.extend(self._additional_params.iter());
2803
2804 params.push("alt", "json");
2805 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:exportAssets";
2806 if self._scopes.is_empty() {
2807 self._scopes
2808 .insert(Scope::CloudPlatform.as_ref().to_string());
2809 }
2810
2811 #[allow(clippy::single_element_loop)]
2812 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2813 url = params.uri_replacement(url, param_name, find_this, true);
2814 }
2815 {
2816 let to_remove = ["parent"];
2817 params.remove_params(&to_remove);
2818 }
2819
2820 let url = params.parse_with_url(&url);
2821
2822 let mut json_mime_type = mime::APPLICATION_JSON;
2823 let mut request_value_reader = {
2824 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2825 common::remove_json_null_values(&mut value);
2826 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2827 serde_json::to_writer(&mut dst, &value).unwrap();
2828 dst
2829 };
2830 let request_size = request_value_reader
2831 .seek(std::io::SeekFrom::End(0))
2832 .unwrap();
2833 request_value_reader
2834 .seek(std::io::SeekFrom::Start(0))
2835 .unwrap();
2836
2837 loop {
2838 let token = match self
2839 .hub
2840 .auth
2841 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2842 .await
2843 {
2844 Ok(token) => token,
2845 Err(e) => match dlg.token(e) {
2846 Ok(token) => token,
2847 Err(e) => {
2848 dlg.finished(false);
2849 return Err(common::Error::MissingToken(e));
2850 }
2851 },
2852 };
2853 request_value_reader
2854 .seek(std::io::SeekFrom::Start(0))
2855 .unwrap();
2856 let mut req_result = {
2857 let client = &self.hub.client;
2858 dlg.pre_request();
2859 let mut req_builder = hyper::Request::builder()
2860 .method(hyper::Method::POST)
2861 .uri(url.as_str())
2862 .header(USER_AGENT, self.hub._user_agent.clone());
2863
2864 if let Some(token) = token.as_ref() {
2865 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2866 }
2867
2868 let request = req_builder
2869 .header(CONTENT_TYPE, json_mime_type.to_string())
2870 .header(CONTENT_LENGTH, request_size as u64)
2871 .body(common::to_body(
2872 request_value_reader.get_ref().clone().into(),
2873 ));
2874
2875 client.request(request.unwrap()).await
2876 };
2877
2878 match req_result {
2879 Err(err) => {
2880 if let common::Retry::After(d) = dlg.http_error(&err) {
2881 sleep(d).await;
2882 continue;
2883 }
2884 dlg.finished(false);
2885 return Err(common::Error::HttpError(err));
2886 }
2887 Ok(res) => {
2888 let (mut parts, body) = res.into_parts();
2889 let mut body = common::Body::new(body);
2890 if !parts.status.is_success() {
2891 let bytes = common::to_bytes(body).await.unwrap_or_default();
2892 let error = serde_json::from_str(&common::to_string(&bytes));
2893 let response = common::to_response(parts, bytes.into());
2894
2895 if let common::Retry::After(d) =
2896 dlg.http_failure(&response, error.as_ref().ok())
2897 {
2898 sleep(d).await;
2899 continue;
2900 }
2901
2902 dlg.finished(false);
2903
2904 return Err(match error {
2905 Ok(value) => common::Error::BadRequest(value),
2906 _ => common::Error::Failure(response),
2907 });
2908 }
2909 let response = {
2910 let bytes = common::to_bytes(body).await.unwrap_or_default();
2911 let encoded = common::to_string(&bytes);
2912 match serde_json::from_str(&encoded) {
2913 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2914 Err(error) => {
2915 dlg.response_json_decode_error(&encoded, &error);
2916 return Err(common::Error::JsonDecodeError(
2917 encoded.to_string(),
2918 error,
2919 ));
2920 }
2921 }
2922 };
2923
2924 dlg.finished(true);
2925 return Ok(response);
2926 }
2927 }
2928 }
2929 }
2930
2931 ///
2932 /// Sets the *request* property to the given value.
2933 ///
2934 /// Even though the property as already been set when instantiating this call,
2935 /// we provide this method for API completeness.
2936 pub fn request(mut self, new_value: ExportAssetsRequest) -> OrganizationExportAssetCall<'a, C> {
2937 self._request = new_value;
2938 self
2939 }
2940 /// Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
2941 ///
2942 /// Sets the *parent* path property to the given value.
2943 ///
2944 /// Even though the property as already been set when instantiating this call,
2945 /// we provide this method for API completeness.
2946 pub fn parent(mut self, new_value: &str) -> OrganizationExportAssetCall<'a, C> {
2947 self._parent = new_value.to_string();
2948 self
2949 }
2950 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2951 /// while executing the actual API request.
2952 ///
2953 /// ````text
2954 /// It should be used to handle progress information, and to implement a certain level of resilience.
2955 /// ````
2956 ///
2957 /// Sets the *delegate* property to the given value.
2958 pub fn delegate(
2959 mut self,
2960 new_value: &'a mut dyn common::Delegate,
2961 ) -> OrganizationExportAssetCall<'a, C> {
2962 self._delegate = Some(new_value);
2963 self
2964 }
2965
2966 /// Set any additional parameter of the query string used in the request.
2967 /// It should be used to set parameters which are not yet available through their own
2968 /// setters.
2969 ///
2970 /// Please note that this method must not be used to set any of the known parameters
2971 /// which have their own setter method. If done anyway, the request will fail.
2972 ///
2973 /// # Additional Parameters
2974 ///
2975 /// * *$.xgafv* (query-string) - V1 error format.
2976 /// * *access_token* (query-string) - OAuth access token.
2977 /// * *alt* (query-string) - Data format for response.
2978 /// * *callback* (query-string) - JSONP
2979 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2980 /// * *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.
2981 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2982 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2983 /// * *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.
2984 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2985 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2986 pub fn param<T>(mut self, name: T, value: T) -> OrganizationExportAssetCall<'a, C>
2987 where
2988 T: AsRef<str>,
2989 {
2990 self._additional_params
2991 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2992 self
2993 }
2994
2995 /// Identifies the authorization scope for the method you are building.
2996 ///
2997 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2998 /// [`Scope::CloudPlatform`].
2999 ///
3000 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3001 /// tokens for more than one scope.
3002 ///
3003 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3004 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3005 /// sufficient, a read-write scope will do as well.
3006 pub fn add_scope<St>(mut self, scope: St) -> OrganizationExportAssetCall<'a, C>
3007 where
3008 St: AsRef<str>,
3009 {
3010 self._scopes.insert(String::from(scope.as_ref()));
3011 self
3012 }
3013 /// Identifies the authorization scope(s) for the method you are building.
3014 ///
3015 /// See [`Self::add_scope()`] for details.
3016 pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationExportAssetCall<'a, C>
3017 where
3018 I: IntoIterator<Item = St>,
3019 St: AsRef<str>,
3020 {
3021 self._scopes
3022 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3023 self
3024 }
3025
3026 /// Removes all scopes, and no default scope will be used either.
3027 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3028 /// for details).
3029 pub fn clear_scopes(mut self) -> OrganizationExportAssetCall<'a, C> {
3030 self._scopes.clear();
3031 self
3032 }
3033}
3034
3035/// 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.
3036///
3037/// A builder for the *operations.get* method supported by a *project* resource.
3038/// It is not used directly, but through a [`ProjectMethods`] instance.
3039///
3040/// # Example
3041///
3042/// Instantiate a resource method builder
3043///
3044/// ```test_harness,no_run
3045/// # extern crate hyper;
3046/// # extern crate hyper_rustls;
3047/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
3048/// # async fn dox() {
3049/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3050///
3051/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3052/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3053/// # .with_native_roots()
3054/// # .unwrap()
3055/// # .https_only()
3056/// # .enable_http2()
3057/// # .build();
3058///
3059/// # let executor = hyper_util::rt::TokioExecutor::new();
3060/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3061/// # secret,
3062/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3063/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3064/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3065/// # ),
3066/// # ).build().await.unwrap();
3067///
3068/// # let client = hyper_util::client::legacy::Client::builder(
3069/// # hyper_util::rt::TokioExecutor::new()
3070/// # )
3071/// # .build(
3072/// # hyper_rustls::HttpsConnectorBuilder::new()
3073/// # .with_native_roots()
3074/// # .unwrap()
3075/// # .https_or_http()
3076/// # .enable_http2()
3077/// # .build()
3078/// # );
3079/// # let mut hub = CloudAsset::new(client, auth);
3080/// // You can configure optional parameters by calling the respective setters at will, and
3081/// // execute the final call using `doit()`.
3082/// // Values shown here are possibly random and not representative !
3083/// let result = hub.projects().operations_get("name")
3084/// .doit().await;
3085/// # }
3086/// ```
3087pub struct ProjectOperationGetCall<'a, C>
3088where
3089 C: 'a,
3090{
3091 hub: &'a CloudAsset<C>,
3092 _name: String,
3093 _delegate: Option<&'a mut dyn common::Delegate>,
3094 _additional_params: HashMap<String, String>,
3095 _scopes: BTreeSet<String>,
3096}
3097
3098impl<'a, C> common::CallBuilder for ProjectOperationGetCall<'a, C> {}
3099
3100impl<'a, C> ProjectOperationGetCall<'a, C>
3101where
3102 C: common::Connector,
3103{
3104 /// Perform the operation you have build so far.
3105 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3106 use std::borrow::Cow;
3107 use std::io::{Read, Seek};
3108
3109 use common::{url::Params, ToParts};
3110 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3111
3112 let mut dd = common::DefaultDelegate;
3113 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3114 dlg.begin(common::MethodInfo {
3115 id: "cloudasset.projects.operations.get",
3116 http_method: hyper::Method::GET,
3117 });
3118
3119 for &field in ["alt", "name"].iter() {
3120 if self._additional_params.contains_key(field) {
3121 dlg.finished(false);
3122 return Err(common::Error::FieldClash(field));
3123 }
3124 }
3125
3126 let mut params = Params::with_capacity(3 + self._additional_params.len());
3127 params.push("name", self._name);
3128
3129 params.extend(self._additional_params.iter());
3130
3131 params.push("alt", "json");
3132 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
3133 if self._scopes.is_empty() {
3134 self._scopes
3135 .insert(Scope::CloudPlatform.as_ref().to_string());
3136 }
3137
3138 #[allow(clippy::single_element_loop)]
3139 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3140 url = params.uri_replacement(url, param_name, find_this, true);
3141 }
3142 {
3143 let to_remove = ["name"];
3144 params.remove_params(&to_remove);
3145 }
3146
3147 let url = params.parse_with_url(&url);
3148
3149 loop {
3150 let token = match self
3151 .hub
3152 .auth
3153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3154 .await
3155 {
3156 Ok(token) => token,
3157 Err(e) => match dlg.token(e) {
3158 Ok(token) => token,
3159 Err(e) => {
3160 dlg.finished(false);
3161 return Err(common::Error::MissingToken(e));
3162 }
3163 },
3164 };
3165 let mut req_result = {
3166 let client = &self.hub.client;
3167 dlg.pre_request();
3168 let mut req_builder = hyper::Request::builder()
3169 .method(hyper::Method::GET)
3170 .uri(url.as_str())
3171 .header(USER_AGENT, self.hub._user_agent.clone());
3172
3173 if let Some(token) = token.as_ref() {
3174 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3175 }
3176
3177 let request = req_builder
3178 .header(CONTENT_LENGTH, 0_u64)
3179 .body(common::to_body::<String>(None));
3180
3181 client.request(request.unwrap()).await
3182 };
3183
3184 match req_result {
3185 Err(err) => {
3186 if let common::Retry::After(d) = dlg.http_error(&err) {
3187 sleep(d).await;
3188 continue;
3189 }
3190 dlg.finished(false);
3191 return Err(common::Error::HttpError(err));
3192 }
3193 Ok(res) => {
3194 let (mut parts, body) = res.into_parts();
3195 let mut body = common::Body::new(body);
3196 if !parts.status.is_success() {
3197 let bytes = common::to_bytes(body).await.unwrap_or_default();
3198 let error = serde_json::from_str(&common::to_string(&bytes));
3199 let response = common::to_response(parts, bytes.into());
3200
3201 if let common::Retry::After(d) =
3202 dlg.http_failure(&response, error.as_ref().ok())
3203 {
3204 sleep(d).await;
3205 continue;
3206 }
3207
3208 dlg.finished(false);
3209
3210 return Err(match error {
3211 Ok(value) => common::Error::BadRequest(value),
3212 _ => common::Error::Failure(response),
3213 });
3214 }
3215 let response = {
3216 let bytes = common::to_bytes(body).await.unwrap_or_default();
3217 let encoded = common::to_string(&bytes);
3218 match serde_json::from_str(&encoded) {
3219 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3220 Err(error) => {
3221 dlg.response_json_decode_error(&encoded, &error);
3222 return Err(common::Error::JsonDecodeError(
3223 encoded.to_string(),
3224 error,
3225 ));
3226 }
3227 }
3228 };
3229
3230 dlg.finished(true);
3231 return Ok(response);
3232 }
3233 }
3234 }
3235 }
3236
3237 /// The name of the operation resource.
3238 ///
3239 /// Sets the *name* path property to the given value.
3240 ///
3241 /// Even though the property as already been set when instantiating this call,
3242 /// we provide this method for API completeness.
3243 pub fn name(mut self, new_value: &str) -> ProjectOperationGetCall<'a, C> {
3244 self._name = new_value.to_string();
3245 self
3246 }
3247 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3248 /// while executing the actual API request.
3249 ///
3250 /// ````text
3251 /// It should be used to handle progress information, and to implement a certain level of resilience.
3252 /// ````
3253 ///
3254 /// Sets the *delegate* property to the given value.
3255 pub fn delegate(
3256 mut self,
3257 new_value: &'a mut dyn common::Delegate,
3258 ) -> ProjectOperationGetCall<'a, C> {
3259 self._delegate = Some(new_value);
3260 self
3261 }
3262
3263 /// Set any additional parameter of the query string used in the request.
3264 /// It should be used to set parameters which are not yet available through their own
3265 /// setters.
3266 ///
3267 /// Please note that this method must not be used to set any of the known parameters
3268 /// which have their own setter method. If done anyway, the request will fail.
3269 ///
3270 /// # Additional Parameters
3271 ///
3272 /// * *$.xgafv* (query-string) - V1 error format.
3273 /// * *access_token* (query-string) - OAuth access token.
3274 /// * *alt* (query-string) - Data format for response.
3275 /// * *callback* (query-string) - JSONP
3276 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3277 /// * *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.
3278 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3279 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3280 /// * *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.
3281 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3282 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3283 pub fn param<T>(mut self, name: T, value: T) -> ProjectOperationGetCall<'a, C>
3284 where
3285 T: AsRef<str>,
3286 {
3287 self._additional_params
3288 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3289 self
3290 }
3291
3292 /// Identifies the authorization scope for the method you are building.
3293 ///
3294 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3295 /// [`Scope::CloudPlatform`].
3296 ///
3297 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3298 /// tokens for more than one scope.
3299 ///
3300 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3301 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3302 /// sufficient, a read-write scope will do as well.
3303 pub fn add_scope<St>(mut self, scope: St) -> ProjectOperationGetCall<'a, C>
3304 where
3305 St: AsRef<str>,
3306 {
3307 self._scopes.insert(String::from(scope.as_ref()));
3308 self
3309 }
3310 /// Identifies the authorization scope(s) for the method you are building.
3311 ///
3312 /// See [`Self::add_scope()`] for details.
3313 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectOperationGetCall<'a, C>
3314 where
3315 I: IntoIterator<Item = St>,
3316 St: AsRef<str>,
3317 {
3318 self._scopes
3319 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3320 self
3321 }
3322
3323 /// Removes all scopes, and no default scope will be used either.
3324 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3325 /// for details).
3326 pub fn clear_scopes(mut self) -> ProjectOperationGetCall<'a, C> {
3327 self._scopes.clear();
3328 self
3329 }
3330}
3331
3332/// Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
3333///
3334/// A builder for the *batchGetAssetsHistory* method supported by a *project* resource.
3335/// It is not used directly, but through a [`ProjectMethods`] instance.
3336///
3337/// # Example
3338///
3339/// Instantiate a resource method builder
3340///
3341/// ```test_harness,no_run
3342/// # extern crate hyper;
3343/// # extern crate hyper_rustls;
3344/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
3345/// # async fn dox() {
3346/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3347///
3348/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3349/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3350/// # .with_native_roots()
3351/// # .unwrap()
3352/// # .https_only()
3353/// # .enable_http2()
3354/// # .build();
3355///
3356/// # let executor = hyper_util::rt::TokioExecutor::new();
3357/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3358/// # secret,
3359/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3360/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3361/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3362/// # ),
3363/// # ).build().await.unwrap();
3364///
3365/// # let client = hyper_util::client::legacy::Client::builder(
3366/// # hyper_util::rt::TokioExecutor::new()
3367/// # )
3368/// # .build(
3369/// # hyper_rustls::HttpsConnectorBuilder::new()
3370/// # .with_native_roots()
3371/// # .unwrap()
3372/// # .https_or_http()
3373/// # .enable_http2()
3374/// # .build()
3375/// # );
3376/// # let mut hub = CloudAsset::new(client, auth);
3377/// // You can configure optional parameters by calling the respective setters at will, and
3378/// // execute the final call using `doit()`.
3379/// // Values shown here are possibly random and not representative !
3380/// let result = hub.projects().batch_get_assets_history("parent")
3381/// .read_time_window_start_time(chrono::Utc::now())
3382/// .read_time_window_end_time(chrono::Utc::now())
3383/// .content_type("ipsum")
3384/// .add_asset_names("gubergren")
3385/// .doit().await;
3386/// # }
3387/// ```
3388pub struct ProjectBatchGetAssetsHistoryCall<'a, C>
3389where
3390 C: 'a,
3391{
3392 hub: &'a CloudAsset<C>,
3393 _parent: String,
3394 _read_time_window_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3395 _read_time_window_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3396 _content_type: Option<String>,
3397 _asset_names: Vec<String>,
3398 _delegate: Option<&'a mut dyn common::Delegate>,
3399 _additional_params: HashMap<String, String>,
3400 _scopes: BTreeSet<String>,
3401}
3402
3403impl<'a, C> common::CallBuilder for ProjectBatchGetAssetsHistoryCall<'a, C> {}
3404
3405impl<'a, C> ProjectBatchGetAssetsHistoryCall<'a, C>
3406where
3407 C: common::Connector,
3408{
3409 /// Perform the operation you have build so far.
3410 pub async fn doit(
3411 mut self,
3412 ) -> common::Result<(common::Response, BatchGetAssetsHistoryResponse)> {
3413 use std::borrow::Cow;
3414 use std::io::{Read, Seek};
3415
3416 use common::{url::Params, ToParts};
3417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3418
3419 let mut dd = common::DefaultDelegate;
3420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3421 dlg.begin(common::MethodInfo {
3422 id: "cloudasset.projects.batchGetAssetsHistory",
3423 http_method: hyper::Method::GET,
3424 });
3425
3426 for &field in [
3427 "alt",
3428 "parent",
3429 "readTimeWindow.startTime",
3430 "readTimeWindow.endTime",
3431 "contentType",
3432 "assetNames",
3433 ]
3434 .iter()
3435 {
3436 if self._additional_params.contains_key(field) {
3437 dlg.finished(false);
3438 return Err(common::Error::FieldClash(field));
3439 }
3440 }
3441
3442 let mut params = Params::with_capacity(7 + self._additional_params.len());
3443 params.push("parent", self._parent);
3444 if let Some(value) = self._read_time_window_start_time.as_ref() {
3445 params.push(
3446 "readTimeWindow.startTime",
3447 common::serde::datetime_to_string(&value),
3448 );
3449 }
3450 if let Some(value) = self._read_time_window_end_time.as_ref() {
3451 params.push(
3452 "readTimeWindow.endTime",
3453 common::serde::datetime_to_string(&value),
3454 );
3455 }
3456 if let Some(value) = self._content_type.as_ref() {
3457 params.push("contentType", value);
3458 }
3459 if !self._asset_names.is_empty() {
3460 for f in self._asset_names.iter() {
3461 params.push("assetNames", f);
3462 }
3463 }
3464
3465 params.extend(self._additional_params.iter());
3466
3467 params.push("alt", "json");
3468 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:batchGetAssetsHistory";
3469 if self._scopes.is_empty() {
3470 self._scopes
3471 .insert(Scope::CloudPlatform.as_ref().to_string());
3472 }
3473
3474 #[allow(clippy::single_element_loop)]
3475 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3476 url = params.uri_replacement(url, param_name, find_this, true);
3477 }
3478 {
3479 let to_remove = ["parent"];
3480 params.remove_params(&to_remove);
3481 }
3482
3483 let url = params.parse_with_url(&url);
3484
3485 loop {
3486 let token = match self
3487 .hub
3488 .auth
3489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3490 .await
3491 {
3492 Ok(token) => token,
3493 Err(e) => match dlg.token(e) {
3494 Ok(token) => token,
3495 Err(e) => {
3496 dlg.finished(false);
3497 return Err(common::Error::MissingToken(e));
3498 }
3499 },
3500 };
3501 let mut req_result = {
3502 let client = &self.hub.client;
3503 dlg.pre_request();
3504 let mut req_builder = hyper::Request::builder()
3505 .method(hyper::Method::GET)
3506 .uri(url.as_str())
3507 .header(USER_AGENT, self.hub._user_agent.clone());
3508
3509 if let Some(token) = token.as_ref() {
3510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3511 }
3512
3513 let request = req_builder
3514 .header(CONTENT_LENGTH, 0_u64)
3515 .body(common::to_body::<String>(None));
3516
3517 client.request(request.unwrap()).await
3518 };
3519
3520 match req_result {
3521 Err(err) => {
3522 if let common::Retry::After(d) = dlg.http_error(&err) {
3523 sleep(d).await;
3524 continue;
3525 }
3526 dlg.finished(false);
3527 return Err(common::Error::HttpError(err));
3528 }
3529 Ok(res) => {
3530 let (mut parts, body) = res.into_parts();
3531 let mut body = common::Body::new(body);
3532 if !parts.status.is_success() {
3533 let bytes = common::to_bytes(body).await.unwrap_or_default();
3534 let error = serde_json::from_str(&common::to_string(&bytes));
3535 let response = common::to_response(parts, bytes.into());
3536
3537 if let common::Retry::After(d) =
3538 dlg.http_failure(&response, error.as_ref().ok())
3539 {
3540 sleep(d).await;
3541 continue;
3542 }
3543
3544 dlg.finished(false);
3545
3546 return Err(match error {
3547 Ok(value) => common::Error::BadRequest(value),
3548 _ => common::Error::Failure(response),
3549 });
3550 }
3551 let response = {
3552 let bytes = common::to_bytes(body).await.unwrap_or_default();
3553 let encoded = common::to_string(&bytes);
3554 match serde_json::from_str(&encoded) {
3555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3556 Err(error) => {
3557 dlg.response_json_decode_error(&encoded, &error);
3558 return Err(common::Error::JsonDecodeError(
3559 encoded.to_string(),
3560 error,
3561 ));
3562 }
3563 }
3564 };
3565
3566 dlg.finished(true);
3567 return Ok(response);
3568 }
3569 }
3570 }
3571 }
3572
3573 /// Required. The relative name of the root asset. It can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345").
3574 ///
3575 /// Sets the *parent* path property to the given value.
3576 ///
3577 /// Even though the property as already been set when instantiating this call,
3578 /// we provide this method for API completeness.
3579 pub fn parent(mut self, new_value: &str) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3580 self._parent = new_value.to_string();
3581 self
3582 }
3583 /// Start time of the time window (exclusive).
3584 ///
3585 /// Sets the *read time window.start time* query property to the given value.
3586 pub fn read_time_window_start_time(
3587 mut self,
3588 new_value: chrono::DateTime<chrono::offset::Utc>,
3589 ) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3590 self._read_time_window_start_time = Some(new_value);
3591 self
3592 }
3593 /// End time of the time window (inclusive). If not specified, the current timestamp is used instead.
3594 ///
3595 /// Sets the *read time window.end time* query property to the given value.
3596 pub fn read_time_window_end_time(
3597 mut self,
3598 new_value: chrono::DateTime<chrono::offset::Utc>,
3599 ) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3600 self._read_time_window_end_time = Some(new_value);
3601 self
3602 }
3603 /// Optional. The content type.
3604 ///
3605 /// Sets the *content type* query property to the given value.
3606 pub fn content_type(mut self, new_value: &str) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3607 self._content_type = Some(new_value.to_string());
3608 self
3609 }
3610 /// A list of the full names of the assets. For example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. See [Resource Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) for more info. The request becomes a no-op if the asset name list is empty, and the max size of the asset name list is 100 in one request.
3611 ///
3612 /// Append the given value to the *asset names* query property.
3613 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
3614 pub fn add_asset_names(mut self, new_value: &str) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3615 self._asset_names.push(new_value.to_string());
3616 self
3617 }
3618 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3619 /// while executing the actual API request.
3620 ///
3621 /// ````text
3622 /// It should be used to handle progress information, and to implement a certain level of resilience.
3623 /// ````
3624 ///
3625 /// Sets the *delegate* property to the given value.
3626 pub fn delegate(
3627 mut self,
3628 new_value: &'a mut dyn common::Delegate,
3629 ) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3630 self._delegate = Some(new_value);
3631 self
3632 }
3633
3634 /// Set any additional parameter of the query string used in the request.
3635 /// It should be used to set parameters which are not yet available through their own
3636 /// setters.
3637 ///
3638 /// Please note that this method must not be used to set any of the known parameters
3639 /// which have their own setter method. If done anyway, the request will fail.
3640 ///
3641 /// # Additional Parameters
3642 ///
3643 /// * *$.xgafv* (query-string) - V1 error format.
3644 /// * *access_token* (query-string) - OAuth access token.
3645 /// * *alt* (query-string) - Data format for response.
3646 /// * *callback* (query-string) - JSONP
3647 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3648 /// * *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.
3649 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3650 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3651 /// * *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.
3652 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3653 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3654 pub fn param<T>(mut self, name: T, value: T) -> ProjectBatchGetAssetsHistoryCall<'a, C>
3655 where
3656 T: AsRef<str>,
3657 {
3658 self._additional_params
3659 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3660 self
3661 }
3662
3663 /// Identifies the authorization scope for the method you are building.
3664 ///
3665 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3666 /// [`Scope::CloudPlatform`].
3667 ///
3668 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3669 /// tokens for more than one scope.
3670 ///
3671 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3672 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3673 /// sufficient, a read-write scope will do as well.
3674 pub fn add_scope<St>(mut self, scope: St) -> ProjectBatchGetAssetsHistoryCall<'a, C>
3675 where
3676 St: AsRef<str>,
3677 {
3678 self._scopes.insert(String::from(scope.as_ref()));
3679 self
3680 }
3681 /// Identifies the authorization scope(s) for the method you are building.
3682 ///
3683 /// See [`Self::add_scope()`] for details.
3684 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectBatchGetAssetsHistoryCall<'a, C>
3685 where
3686 I: IntoIterator<Item = St>,
3687 St: AsRef<str>,
3688 {
3689 self._scopes
3690 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3691 self
3692 }
3693
3694 /// Removes all scopes, and no default scope will be used either.
3695 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3696 /// for details).
3697 pub fn clear_scopes(mut self) -> ProjectBatchGetAssetsHistoryCall<'a, C> {
3698 self._scopes.clear();
3699 self
3700 }
3701}
3702
3703/// Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
3704///
3705/// A builder for the *exportAssets* method supported by a *project* resource.
3706/// It is not used directly, but through a [`ProjectMethods`] instance.
3707///
3708/// # Example
3709///
3710/// Instantiate a resource method builder
3711///
3712/// ```test_harness,no_run
3713/// # extern crate hyper;
3714/// # extern crate hyper_rustls;
3715/// # extern crate google_cloudasset1_beta1 as cloudasset1_beta1;
3716/// use cloudasset1_beta1::api::ExportAssetsRequest;
3717/// # async fn dox() {
3718/// # use cloudasset1_beta1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3719///
3720/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3721/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3722/// # .with_native_roots()
3723/// # .unwrap()
3724/// # .https_only()
3725/// # .enable_http2()
3726/// # .build();
3727///
3728/// # let executor = hyper_util::rt::TokioExecutor::new();
3729/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3730/// # secret,
3731/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3732/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3733/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3734/// # ),
3735/// # ).build().await.unwrap();
3736///
3737/// # let client = hyper_util::client::legacy::Client::builder(
3738/// # hyper_util::rt::TokioExecutor::new()
3739/// # )
3740/// # .build(
3741/// # hyper_rustls::HttpsConnectorBuilder::new()
3742/// # .with_native_roots()
3743/// # .unwrap()
3744/// # .https_or_http()
3745/// # .enable_http2()
3746/// # .build()
3747/// # );
3748/// # let mut hub = CloudAsset::new(client, auth);
3749/// // As the method needs a request, you would usually fill it with the desired information
3750/// // into the respective structure. Some of the parts shown here might not be applicable !
3751/// // Values shown here are possibly random and not representative !
3752/// let mut req = ExportAssetsRequest::default();
3753///
3754/// // You can configure optional parameters by calling the respective setters at will, and
3755/// // execute the final call using `doit()`.
3756/// // Values shown here are possibly random and not representative !
3757/// let result = hub.projects().export_assets(req, "parent")
3758/// .doit().await;
3759/// # }
3760/// ```
3761pub struct ProjectExportAssetCall<'a, C>
3762where
3763 C: 'a,
3764{
3765 hub: &'a CloudAsset<C>,
3766 _request: ExportAssetsRequest,
3767 _parent: String,
3768 _delegate: Option<&'a mut dyn common::Delegate>,
3769 _additional_params: HashMap<String, String>,
3770 _scopes: BTreeSet<String>,
3771}
3772
3773impl<'a, C> common::CallBuilder for ProjectExportAssetCall<'a, C> {}
3774
3775impl<'a, C> ProjectExportAssetCall<'a, C>
3776where
3777 C: common::Connector,
3778{
3779 /// Perform the operation you have build so far.
3780 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3781 use std::borrow::Cow;
3782 use std::io::{Read, Seek};
3783
3784 use common::{url::Params, ToParts};
3785 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3786
3787 let mut dd = common::DefaultDelegate;
3788 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3789 dlg.begin(common::MethodInfo {
3790 id: "cloudasset.projects.exportAssets",
3791 http_method: hyper::Method::POST,
3792 });
3793
3794 for &field in ["alt", "parent"].iter() {
3795 if self._additional_params.contains_key(field) {
3796 dlg.finished(false);
3797 return Err(common::Error::FieldClash(field));
3798 }
3799 }
3800
3801 let mut params = Params::with_capacity(4 + self._additional_params.len());
3802 params.push("parent", self._parent);
3803
3804 params.extend(self._additional_params.iter());
3805
3806 params.push("alt", "json");
3807 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}:exportAssets";
3808 if self._scopes.is_empty() {
3809 self._scopes
3810 .insert(Scope::CloudPlatform.as_ref().to_string());
3811 }
3812
3813 #[allow(clippy::single_element_loop)]
3814 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3815 url = params.uri_replacement(url, param_name, find_this, true);
3816 }
3817 {
3818 let to_remove = ["parent"];
3819 params.remove_params(&to_remove);
3820 }
3821
3822 let url = params.parse_with_url(&url);
3823
3824 let mut json_mime_type = mime::APPLICATION_JSON;
3825 let mut request_value_reader = {
3826 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3827 common::remove_json_null_values(&mut value);
3828 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3829 serde_json::to_writer(&mut dst, &value).unwrap();
3830 dst
3831 };
3832 let request_size = request_value_reader
3833 .seek(std::io::SeekFrom::End(0))
3834 .unwrap();
3835 request_value_reader
3836 .seek(std::io::SeekFrom::Start(0))
3837 .unwrap();
3838
3839 loop {
3840 let token = match self
3841 .hub
3842 .auth
3843 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3844 .await
3845 {
3846 Ok(token) => token,
3847 Err(e) => match dlg.token(e) {
3848 Ok(token) => token,
3849 Err(e) => {
3850 dlg.finished(false);
3851 return Err(common::Error::MissingToken(e));
3852 }
3853 },
3854 };
3855 request_value_reader
3856 .seek(std::io::SeekFrom::Start(0))
3857 .unwrap();
3858 let mut req_result = {
3859 let client = &self.hub.client;
3860 dlg.pre_request();
3861 let mut req_builder = hyper::Request::builder()
3862 .method(hyper::Method::POST)
3863 .uri(url.as_str())
3864 .header(USER_AGENT, self.hub._user_agent.clone());
3865
3866 if let Some(token) = token.as_ref() {
3867 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3868 }
3869
3870 let request = req_builder
3871 .header(CONTENT_TYPE, json_mime_type.to_string())
3872 .header(CONTENT_LENGTH, request_size as u64)
3873 .body(common::to_body(
3874 request_value_reader.get_ref().clone().into(),
3875 ));
3876
3877 client.request(request.unwrap()).await
3878 };
3879
3880 match req_result {
3881 Err(err) => {
3882 if let common::Retry::After(d) = dlg.http_error(&err) {
3883 sleep(d).await;
3884 continue;
3885 }
3886 dlg.finished(false);
3887 return Err(common::Error::HttpError(err));
3888 }
3889 Ok(res) => {
3890 let (mut parts, body) = res.into_parts();
3891 let mut body = common::Body::new(body);
3892 if !parts.status.is_success() {
3893 let bytes = common::to_bytes(body).await.unwrap_or_default();
3894 let error = serde_json::from_str(&common::to_string(&bytes));
3895 let response = common::to_response(parts, bytes.into());
3896
3897 if let common::Retry::After(d) =
3898 dlg.http_failure(&response, error.as_ref().ok())
3899 {
3900 sleep(d).await;
3901 continue;
3902 }
3903
3904 dlg.finished(false);
3905
3906 return Err(match error {
3907 Ok(value) => common::Error::BadRequest(value),
3908 _ => common::Error::Failure(response),
3909 });
3910 }
3911 let response = {
3912 let bytes = common::to_bytes(body).await.unwrap_or_default();
3913 let encoded = common::to_string(&bytes);
3914 match serde_json::from_str(&encoded) {
3915 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3916 Err(error) => {
3917 dlg.response_json_decode_error(&encoded, &error);
3918 return Err(common::Error::JsonDecodeError(
3919 encoded.to_string(),
3920 error,
3921 ));
3922 }
3923 }
3924 };
3925
3926 dlg.finished(true);
3927 return Ok(response);
3928 }
3929 }
3930 }
3931 }
3932
3933 ///
3934 /// Sets the *request* property to the given value.
3935 ///
3936 /// Even though the property as already been set when instantiating this call,
3937 /// we provide this method for API completeness.
3938 pub fn request(mut self, new_value: ExportAssetsRequest) -> ProjectExportAssetCall<'a, C> {
3939 self._request = new_value;
3940 self
3941 }
3942 /// Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), a project number (such as "projects/12345"), or a folder number (such as "folders/123").
3943 ///
3944 /// Sets the *parent* path property to the given value.
3945 ///
3946 /// Even though the property as already been set when instantiating this call,
3947 /// we provide this method for API completeness.
3948 pub fn parent(mut self, new_value: &str) -> ProjectExportAssetCall<'a, C> {
3949 self._parent = new_value.to_string();
3950 self
3951 }
3952 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3953 /// while executing the actual API request.
3954 ///
3955 /// ````text
3956 /// It should be used to handle progress information, and to implement a certain level of resilience.
3957 /// ````
3958 ///
3959 /// Sets the *delegate* property to the given value.
3960 pub fn delegate(
3961 mut self,
3962 new_value: &'a mut dyn common::Delegate,
3963 ) -> ProjectExportAssetCall<'a, C> {
3964 self._delegate = Some(new_value);
3965 self
3966 }
3967
3968 /// Set any additional parameter of the query string used in the request.
3969 /// It should be used to set parameters which are not yet available through their own
3970 /// setters.
3971 ///
3972 /// Please note that this method must not be used to set any of the known parameters
3973 /// which have their own setter method. If done anyway, the request will fail.
3974 ///
3975 /// # Additional Parameters
3976 ///
3977 /// * *$.xgafv* (query-string) - V1 error format.
3978 /// * *access_token* (query-string) - OAuth access token.
3979 /// * *alt* (query-string) - Data format for response.
3980 /// * *callback* (query-string) - JSONP
3981 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3982 /// * *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.
3983 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3984 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3985 /// * *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.
3986 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3987 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3988 pub fn param<T>(mut self, name: T, value: T) -> ProjectExportAssetCall<'a, C>
3989 where
3990 T: AsRef<str>,
3991 {
3992 self._additional_params
3993 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3994 self
3995 }
3996
3997 /// Identifies the authorization scope for the method you are building.
3998 ///
3999 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4000 /// [`Scope::CloudPlatform`].
4001 ///
4002 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4003 /// tokens for more than one scope.
4004 ///
4005 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4006 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4007 /// sufficient, a read-write scope will do as well.
4008 pub fn add_scope<St>(mut self, scope: St) -> ProjectExportAssetCall<'a, C>
4009 where
4010 St: AsRef<str>,
4011 {
4012 self._scopes.insert(String::from(scope.as_ref()));
4013 self
4014 }
4015 /// Identifies the authorization scope(s) for the method you are building.
4016 ///
4017 /// See [`Self::add_scope()`] for details.
4018 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectExportAssetCall<'a, C>
4019 where
4020 I: IntoIterator<Item = St>,
4021 St: AsRef<str>,
4022 {
4023 self._scopes
4024 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4025 self
4026 }
4027
4028 /// Removes all scopes, and no default scope will be used either.
4029 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4030 /// for details).
4031 pub fn clear_scopes(mut self) -> ProjectExportAssetCall<'a, C> {
4032 self._scopes.clear();
4033 self
4034 }
4035}