google_cloudasset1/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 as cloudasset1;
49/// use cloudasset1::api::CreateFeedRequest;
50/// use cloudasset1::{Result, Error};
51/// # async fn dox() {
52/// use cloudasset1::{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 = CreateFeedRequest::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.feeds().create(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 assets(&'a self) -> AssetMethods<'a, C> {
143 AssetMethods { hub: self }
144 }
145 pub fn effective_iam_policies(&'a self) -> EffectiveIamPolicyMethods<'a, C> {
146 EffectiveIamPolicyMethods { hub: self }
147 }
148 pub fn feeds(&'a self) -> FeedMethods<'a, C> {
149 FeedMethods { hub: self }
150 }
151 pub fn methods(&'a self) -> MethodMethods<'a, C> {
152 MethodMethods { hub: self }
153 }
154 pub fn operations(&'a self) -> OperationMethods<'a, C> {
155 OperationMethods { hub: self }
156 }
157 pub fn saved_queries(&'a self) -> SavedQueryMethods<'a, C> {
158 SavedQueryMethods { hub: self }
159 }
160
161 /// Set the user-agent header field to use in all requests to the server.
162 /// It defaults to `google-api-rust-client/7.0.0`.
163 ///
164 /// Returns the previously set user-agent.
165 pub fn user_agent(&mut self, agent_name: String) -> String {
166 std::mem::replace(&mut self._user_agent, agent_name)
167 }
168
169 /// Set the base url to use in all requests to the server.
170 /// It defaults to `https://cloudasset.googleapis.com/`.
171 ///
172 /// Returns the previously set base url.
173 pub fn base_url(&mut self, new_base_url: String) -> String {
174 std::mem::replace(&mut self._base_url, new_base_url)
175 }
176
177 /// Set the root url to use in all requests to the server.
178 /// It defaults to `https://cloudasset.googleapis.com/`.
179 ///
180 /// Returns the previously set root url.
181 pub fn root_url(&mut self, new_root_url: String) -> String {
182 std::mem::replace(&mut self._root_url, new_root_url)
183 }
184}
185
186// ############
187// SCHEMAS ###
188// ##########
189/// Specifies roles and/or permissions to analyze, to determine both the identities possessing them and the resources they control. If multiple values are specified, results will include roles or permissions matching any of them. The total number of roles and permissions should be equal or less than 10.
190///
191/// This type is not used in any activity, and only used as *part* of another schema.
192///
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct AccessSelector {
197 /// Optional. The permissions to appear in result.
198 pub permissions: Option<Vec<String>>,
199 /// Optional. The roles to appear in result.
200 pub roles: Option<Vec<String>>,
201}
202
203impl common::Part for AccessSelector {}
204
205/// A request message for AssetService.AnalyzeIamPolicyLongrunning.
206///
207/// # Activities
208///
209/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
210/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
211///
212/// * [analyze iam policy longrunning](MethodAnalyzeIamPolicyLongrunningCall) (request)
213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
214#[serde_with::serde_as]
215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
216pub struct AnalyzeIamPolicyLongrunningRequest {
217 /// Required. The request query.
218 #[serde(rename = "analysisQuery")]
219 pub analysis_query: Option<IamPolicyAnalysisQuery>,
220 /// Required. Output configuration indicating where the results will be output to.
221 #[serde(rename = "outputConfig")]
222 pub output_config: Option<IamPolicyAnalysisOutputConfig>,
223 /// Optional. The name of a saved query, which must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id If both `analysis_query` and `saved_analysis_query` are provided, they will be merged together with the `saved_analysis_query` as base and the `analysis_query` as overrides. For more details of the merge behavior, refer to the [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) doc. Note that you cannot override primitive fields with default value, such as 0 or empty string, etc., because we use proto3, which doesn't support field presence yet.
224 #[serde(rename = "savedAnalysisQuery")]
225 pub saved_analysis_query: Option<String>,
226}
227
228impl common::RequestValue for AnalyzeIamPolicyLongrunningRequest {}
229
230/// A response message for AssetService.AnalyzeIamPolicy.
231///
232/// # Activities
233///
234/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
235/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
236///
237/// * [analyze iam policy](MethodAnalyzeIamPolicyCall) (response)
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct AnalyzeIamPolicyResponse {
242 /// Represents whether all entries in the main_analysis and service_account_impersonation_analysis have been fully explored to answer the query in the request.
243 #[serde(rename = "fullyExplored")]
244 pub fully_explored: Option<bool>,
245 /// The main analysis that matches the original request.
246 #[serde(rename = "mainAnalysis")]
247 pub main_analysis: Option<IamPolicyAnalysis>,
248 /// The service account impersonation analysis if IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation is enabled.
249 #[serde(rename = "serviceAccountImpersonationAnalysis")]
250 pub service_account_impersonation_analysis: Option<Vec<IamPolicyAnalysis>>,
251}
252
253impl common::ResponseResult for AnalyzeIamPolicyResponse {}
254
255/// The response message for resource move analysis.
256///
257/// # Activities
258///
259/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
260/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
261///
262/// * [analyze move](MethodAnalyzeMoveCall) (response)
263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
264#[serde_with::serde_as]
265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
266pub struct AnalyzeMoveResponse {
267 /// The list of analyses returned from performing the intended resource move analysis. The analysis is grouped by different Google Cloud services.
268 #[serde(rename = "moveAnalysis")]
269 pub move_analysis: Option<Vec<MoveAnalysis>>,
270}
271
272impl common::ResponseResult for AnalyzeMoveResponse {}
273
274/// The response message for AssetService.AnalyzeOrgPolicies.
275///
276/// # Activities
277///
278/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
279/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
280///
281/// * [analyze org policies](MethodAnalyzeOrgPolicyCall) (response)
282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
283#[serde_with::serde_as]
284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
285pub struct AnalyzeOrgPoliciesResponse {
286 /// The definition of the constraint in the request.
287 pub constraint: Option<AnalyzerOrgPolicyConstraint>,
288 /// The page token to fetch the next page for AnalyzeOrgPoliciesResponse.org_policy_results.
289 #[serde(rename = "nextPageToken")]
290 pub next_page_token: Option<String>,
291 /// The organization policies under the AnalyzeOrgPoliciesRequest.scope with the AnalyzeOrgPoliciesRequest.constraint.
292 #[serde(rename = "orgPolicyResults")]
293 pub org_policy_results: Option<Vec<OrgPolicyResult>>,
294}
295
296impl common::ResponseResult for AnalyzeOrgPoliciesResponse {}
297
298/// The response message for AssetService.AnalyzeOrgPolicyGovernedAssets.
299///
300/// # Activities
301///
302/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
303/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
304///
305/// * [analyze org policy governed assets](MethodAnalyzeOrgPolicyGovernedAssetCall) (response)
306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
307#[serde_with::serde_as]
308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
309pub struct AnalyzeOrgPolicyGovernedAssetsResponse {
310 /// The definition of the constraint in the request.
311 pub constraint: Option<AnalyzerOrgPolicyConstraint>,
312 /// The list of the analyzed governed assets.
313 #[serde(rename = "governedAssets")]
314 pub governed_assets:
315 Option<Vec<GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedAsset>>,
316 /// The page token to fetch the next page for AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets.
317 #[serde(rename = "nextPageToken")]
318 pub next_page_token: Option<String>,
319}
320
321impl common::ResponseResult for AnalyzeOrgPolicyGovernedAssetsResponse {}
322
323/// The response message for AssetService.AnalyzeOrgPolicyGovernedContainers.
324///
325/// # Activities
326///
327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
329///
330/// * [analyze org policy governed containers](MethodAnalyzeOrgPolicyGovernedContainerCall) (response)
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct AnalyzeOrgPolicyGovernedContainersResponse {
335 /// The definition of the constraint in the request.
336 pub constraint: Option<AnalyzerOrgPolicyConstraint>,
337 /// The list of the analyzed governed containers.
338 #[serde(rename = "governedContainers")]
339 pub governed_containers: Option<Vec<GoogleCloudAssetV1GovernedContainer>>,
340 /// The page token to fetch the next page for AnalyzeOrgPolicyGovernedContainersResponse.governed_containers.
341 #[serde(rename = "nextPageToken")]
342 pub next_page_token: Option<String>,
343}
344
345impl common::ResponseResult for AnalyzeOrgPolicyGovernedContainersResponse {}
346
347/// This organization policy message is a modified version of the one defined in the Organization Policy system. This message contains several fields defined in the original organization policy with some new fields for analysis purpose.
348///
349/// This type is not used in any activity, and only used as *part* of another schema.
350///
351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
352#[serde_with::serde_as]
353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
354pub struct AnalyzerOrgPolicy {
355 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of an organization/folder/project resource where this organization policy applies to. For any user defined org policies, this field has the same value as the [attached_resource] field. Only for default policy, this field has the different value.
356 #[serde(rename = "appliedResource")]
357 pub applied_resource: Option<String>,
358 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of an organization/folder/project resource where this organization policy is set. Notice that some type of constraints are defined with default policy. This field will be empty for them.
359 #[serde(rename = "attachedResource")]
360 pub attached_resource: Option<String>,
361 /// If `inherit_from_parent` is true, Rules set higher up in the hierarchy (up to the closest root) are inherited and present in the effective policy. If it is false, then no rules are inherited, and this policy becomes the effective root for evaluation.
362 #[serde(rename = "inheritFromParent")]
363 pub inherit_from_parent: Option<bool>,
364 /// Ignores policies set above this resource and restores the default behavior of the constraint at this resource. This field can be set in policies for either list or boolean constraints. If set, `rules` must be empty and `inherit_from_parent` must be set to false.
365 pub reset: Option<bool>,
366 /// List of rules for this organization policy.
367 pub rules: Option<Vec<GoogleCloudAssetV1Rule>>,
368}
369
370impl common::Part for AnalyzerOrgPolicy {}
371
372/// The organization policy constraint definition.
373///
374/// This type is not used in any activity, and only used as *part* of another schema.
375///
376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
377#[serde_with::serde_as]
378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
379pub struct AnalyzerOrgPolicyConstraint {
380 /// The definition of the custom constraint.
381 #[serde(rename = "customConstraint")]
382 pub custom_constraint: Option<GoogleCloudAssetV1CustomConstraint>,
383 /// The definition of the canned constraint defined by Google.
384 #[serde(rename = "googleDefinedConstraint")]
385 pub google_defined_constraint: Option<GoogleCloudAssetV1Constraint>,
386}
387
388impl common::Part for AnalyzerOrgPolicyConstraint {}
389
390/// 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), or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship). See [Supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for more information.
391///
392/// # Activities
393///
394/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
395/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
396///
397/// * [list assets](AssetListCall) (none)
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct Asset {
402 /// Also refer to the [access level user guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).
403 #[serde(rename = "accessLevel")]
404 pub access_level: Option<GoogleIdentityAccesscontextmanagerV1AccessLevel>,
405 /// Also refer to the [access policy user guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
406 #[serde(rename = "accessPolicy")]
407 pub access_policy: Option<GoogleIdentityAccesscontextmanagerV1AccessPolicy>,
408 /// The ancestry path of an asset in Google Cloud [resource hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), represented as a list of relative resource names. An ancestry path starts with the closest ancestor in the hierarchy and ends at root. If the asset is a project, folder, or organization, the ancestry path starts from the asset itself. Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
409 pub ancestors: Option<Vec<String>>,
410 /// The exceptions of a resource.
411 #[serde(rename = "assetExceptions")]
412 pub asset_exceptions: Option<Vec<AssetException>>,
413 /// 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.
414 #[serde(rename = "assetType")]
415 pub asset_type: Option<String>,
416 /// 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.
417 #[serde(rename = "iamPolicy")]
418 pub iam_policy: Option<Policy>,
419 /// 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.
420 pub name: Option<String>,
421 /// 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.
422 #[serde(rename = "orgPolicy")]
423 pub org_policy: Option<Vec<GoogleCloudOrgpolicyV1Policy>>,
424 /// A representation of runtime OS Inventory information. See [this topic](https://cloud.google.com/compute/docs/instances/os-inventory-management) for more information.
425 #[serde(rename = "osInventory")]
426 pub os_inventory: Option<Inventory>,
427 /// One related asset of the current asset.
428 #[serde(rename = "relatedAsset")]
429 pub related_asset: Option<RelatedAsset>,
430 /// DEPRECATED. This field only presents for the purpose of backward-compatibility. The server will never generate responses with this field. The related assets of the asset of one relationship type. One asset only represents one type of relationship.
431 #[serde(rename = "relatedAssets")]
432 pub related_assets: Option<RelatedAssets>,
433 /// A representation of the resource.
434 pub resource: Option<Resource>,
435 /// Also refer to the [service perimeter user guide](https://cloud.google.com/vpc-service-controls/docs/overview).
436 #[serde(rename = "servicePerimeter")]
437 pub service_perimeter: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeter>,
438 /// The last update timestamp of an asset. update_time is updated when create/update/delete operation is performed.
439 #[serde(rename = "updateTime")]
440 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
441}
442
443impl common::Resource for Asset {}
444
445/// The enhanced metadata information for a resource.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct AssetEnrichment {
453 /// The resource owners for a resource. Note that this field only contains the members that have "roles/owner" role in the resource's IAM Policy.
454 #[serde(rename = "resourceOwners")]
455 pub resource_owners: Option<ResourceOwners>,
456}
457
458impl common::Part for AssetEnrichment {}
459
460/// An exception of an asset.
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 AssetException {
468 /// The details of the exception.
469 pub details: Option<String>,
470 /// The type of exception.
471 #[serde(rename = "exceptionType")]
472 pub exception_type: Option<String>,
473}
474
475impl common::Part for AssetException {}
476
477/// Attached resource representation, which is defined by the corresponding service provider. It represents an attached resource's payload.
478///
479/// This type is not used in any activity, and only used as *part* of another schema.
480///
481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
482#[serde_with::serde_as]
483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
484pub struct AttachedResource {
485 /// The type of this attached resource. Example: `osconfig.googleapis.com/Inventory` You can find the supported attached asset types of each resource in this table: `https://cloud.google.com/asset-inventory/docs/supported-asset-types`
486 #[serde(rename = "assetType")]
487 pub asset_type: Option<String>,
488 /// Versioned resource representations of this attached resource. This is repeated because there could be multiple versions of the attached resource representations during version migration.
489 #[serde(rename = "versionedResources")]
490 pub versioned_resources: Option<Vec<VersionedResource>>,
491}
492
493impl common::Part for AttachedResource {}
494
495/// 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.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct AuditConfig {
503 /// The configuration for logging of each type of permission.
504 #[serde(rename = "auditLogConfigs")]
505 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
506 /// 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.
507 pub service: Option<String>,
508}
509
510impl common::Part for AuditConfig {}
511
512/// 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.
513///
514/// This type is not used in any activity, and only used as *part* of another schema.
515///
516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
517#[serde_with::serde_as]
518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
519pub struct AuditLogConfig {
520 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
521 #[serde(rename = "exemptedMembers")]
522 pub exempted_members: Option<Vec<String>>,
523 /// The log type that this config enables.
524 #[serde(rename = "logType")]
525 pub log_type: Option<String>,
526}
527
528impl common::Part for AuditLogConfig {}
529
530/// Batch get assets history response.
531///
532/// # Activities
533///
534/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
535/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
536///
537/// * [batch get assets history](MethodBatchGetAssetsHistoryCall) (response)
538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
539#[serde_with::serde_as]
540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
541pub struct BatchGetAssetsHistoryResponse {
542 /// A list of assets with valid time windows.
543 pub assets: Option<Vec<TemporalAsset>>,
544}
545
546impl common::ResponseResult for BatchGetAssetsHistoryResponse {}
547
548/// A response message for AssetService.BatchGetEffectiveIamPolicies.
549///
550/// # Activities
551///
552/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
553/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
554///
555/// * [batch get effective iam policies](EffectiveIamPolicyBatchGetCall) (response)
556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
557#[serde_with::serde_as]
558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
559pub struct BatchGetEffectiveIamPoliciesResponse {
560 /// The effective policies for a batch of resources. Note that the results order is the same as the order of BatchGetEffectiveIamPoliciesRequest.names. When a resource does not have any effective IAM policies, its corresponding policy_result will contain empty EffectiveIamPolicy.policies.
561 #[serde(rename = "policyResults")]
562 pub policy_results: Option<Vec<EffectiveIamPolicy>>,
563}
564
565impl common::ResponseResult for BatchGetEffectiveIamPoliciesResponse {}
566
567/// A BigQuery destination for exporting assets to.
568///
569/// This type is not used in any activity, and only used as *part* of another schema.
570///
571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
572#[serde_with::serde_as]
573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
574pub struct BigQueryDestination {
575 /// Required. The BigQuery dataset in format “projects/projectId/datasets/datasetId”, to which the snapshot result should be exported. If this dataset does not exist, the export call returns an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets` determines the [schema](https://cloud.google.com/asset-inventory/docs/exporting-to-bigquery#bigquery-schema) of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also influences the schema.
576 pub dataset: Option<String>,
577 /// If the destination table already exists and this flag is `TRUE`, the table will be overwritten by the contents of assets snapshot. If the flag is `FALSE` or unset and the destination table already exists, the export call returns an INVALID_ARGUMENT error.
578 pub force: Option<bool>,
579 /// [partition_spec] determines whether to export to partitioned table(s) and how to partition the data. If [partition_spec] is unset or [partition_spec.partition_key] is unset or `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to non-partitioned table(s). [force] will decide whether to overwrite existing table(s). If [partition_spec] is specified. First, the snapshot results will be written to partitioned table(s) with two additional timestamp columns, readTime and requestTime, one of which will be the partition key. Secondly, in the case when any destination table already exists, it will first try to update existing table's schema as necessary by appending additional columns. Then, if [force] is `TRUE`, the corresponding partition will be overwritten by the snapshot results (data in different partitions will remain intact); if [force] is unset or `FALSE`, it will append the data. An error will be returned if the schema update or data appension fails.
580 #[serde(rename = "partitionSpec")]
581 pub partition_spec: Option<PartitionSpec>,
582 /// If this flag is `TRUE`, the snapshot results will be written to one or multiple tables, each of which contains results of one asset type. The [force] and [partition_spec] fields will apply to each of them. Field [table] will be concatenated with "_" and the asset type names (see https://cloud.google.com/asset-inventory/docs/supported-asset-types for supported asset types) to construct per-asset-type table names, in which all non-alphanumeric characters like "." and "/" will be substituted by "_". Example: if field [table] is "mytable" and snapshot results contain "storage.googleapis.com/Bucket" assets, the corresponding table name will be "mytable_storage_googleapis_com_Bucket". If any of these tables does not exist, a new table with the concatenated name will be created. When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of each table will include RECORD-type columns mapped to the nested fields in the Asset.resource.data field of that asset type (up to the 15 nested level BigQuery supports (https://cloud.google.com/bigquery/docs/nested-repeated#limitations)). The fields in >15 nested levels will be stored in JSON format string as a child column of its parent RECORD column. If error occurs when exporting to any table, the whole export call will return an error but the export results that already succeed will persist. Example: if exporting to table_type_A succeeds when exporting to table_type_B fails during one export call, the results in table_type_A will persist and there will not be partial results persisting in a table.
583 #[serde(rename = "separateTablesPerAssetType")]
584 pub separate_tables_per_asset_type: Option<bool>,
585 /// Required. The BigQuery table to which the snapshot result should be written. If this table does not exist, a new table with the given name will be created.
586 pub table: Option<String>,
587}
588
589impl common::Part for BigQueryDestination {}
590
591/// Associates `members`, or principals, with a `role`.
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 Binding {
599 /// 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).
600 pub condition: Option<Expr>,
601 /// 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`.
602 pub members: Option<Vec<String>>,
603 /// 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).
604 pub role: Option<String>,
605}
606
607impl common::Part for Binding {}
608
609/// The IAM conditions context.
610///
611/// This type is not used in any activity, and only used as *part* of another schema.
612///
613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
614#[serde_with::serde_as]
615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
616pub struct ConditionContext {
617 /// The hypothetical access timestamp to evaluate IAM conditions. Note that this value must not be earlier than the current time; otherwise, an INVALID_ARGUMENT error will be returned.
618 #[serde(rename = "accessTime")]
619 pub access_time: Option<chrono::DateTime<chrono::offset::Utc>>,
620}
621
622impl common::Part for ConditionContext {}
623
624/// The condition evaluation.
625///
626/// This type is not used in any activity, and only used as *part* of another schema.
627///
628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
629#[serde_with::serde_as]
630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
631pub struct ConditionEvaluation {
632 /// The evaluation result.
633 #[serde(rename = "evaluationValue")]
634 pub evaluation_value: Option<String>,
635}
636
637impl common::Part for ConditionEvaluation {}
638
639/// Create asset feed request.
640///
641/// # Activities
642///
643/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
644/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
645///
646/// * [create feeds](FeedCreateCall) (request)
647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
648#[serde_with::serde_as]
649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
650pub struct CreateFeedRequest {
651 /// Required. The feed details. The field `name` must be empty and it will be generated in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
652 pub feed: Option<Feed>,
653 /// Required. This is the client-assigned asset feed identifier and it needs to be unique under a specific parent project/folder/organization.
654 #[serde(rename = "feedId")]
655 pub feed_id: Option<String>,
656}
657
658impl common::RequestValue for CreateFeedRequest {}
659
660/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
661///
662/// This type is not used in any activity, and only used as *part* of another schema.
663///
664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
665#[serde_with::serde_as]
666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
667pub struct Date {
668 /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
669 pub day: Option<i32>,
670 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
671 pub month: Option<i32>,
672 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
673 pub year: Option<i32>,
674}
675
676impl common::Part for Date {}
677
678/// The effective IAM policies on one resource.
679///
680/// This type is not used in any activity, and only used as *part* of another schema.
681///
682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
683#[serde_with::serde_as]
684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
685pub struct EffectiveIamPolicy {
686 /// The [full_resource_name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) for which the policies are computed. This is one of the BatchGetEffectiveIamPoliciesRequest.names the caller provides in the request.
687 #[serde(rename = "fullResourceName")]
688 pub full_resource_name: Option<String>,
689 /// The effective policies for the full_resource_name. These policies include the policy set on the full_resource_name and those set on its parents and ancestors up to the BatchGetEffectiveIamPoliciesRequest.scope. Note that these policies are not filtered according to the resource type of the full_resource_name. These policies are hierarchically ordered by PolicyInfo.attached_resource starting from full_resource_name itself to its parents and ancestors, such that policies[i]'s PolicyInfo.attached_resource is the child of policies[i+1]'s PolicyInfo.attached_resource, if policies[i+1] exists.
690 pub policies: Option<Vec<PolicyInfo>>,
691}
692
693impl common::Part for EffectiveIamPolicy {}
694
695/// The effective tags and the ancestor resources from which they were inherited.
696///
697/// This type is not used in any activity, and only used as *part* of another schema.
698///
699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
700#[serde_with::serde_as]
701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
702pub struct EffectiveTagDetails {
703 /// The [full resource name](https://cloud.google.com/asset-inventory/docs/resource-name-format) of the ancestor from which effective_tags are inherited, according to [tag inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
704 #[serde(rename = "attachedResource")]
705 pub attached_resource: Option<String>,
706 /// The effective tags inherited from the attached_resource. Note that tags with the same key but different values may attach to resources at a different hierarchy levels. The lower hierarchy tag value will overwrite the higher hierarchy tag value of the same tag key. In this case, the tag value at the higher hierarchy level will be removed. For more information, see [tag inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
707 #[serde(rename = "effectiveTags")]
708 pub effective_tags: Option<Vec<Tag>>,
709}
710
711impl common::Part for EffectiveTagDetails {}
712
713/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
714///
715/// # Activities
716///
717/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
718/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
719///
720/// * [delete feeds](FeedDeleteCall) (response)
721/// * [delete saved queries](SavedQueryDeleteCall) (response)
722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
723#[serde_with::serde_as]
724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct Empty {
726 _never_set: Option<bool>,
727}
728
729impl common::ResponseResult for Empty {}
730
731/// Explanation about the IAM policy search result.
732///
733/// This type is not used in any activity, and only used as *part* of another schema.
734///
735#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
736#[serde_with::serde_as]
737#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
738pub struct Explanation {
739 /// The map from roles to their included permissions that match the permission query (i.e., a query containing `policy.role.permissions:`). Example: if query `policy.role.permissions:compute.disk.get` matches a policy binding that contains owner role, the matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The roles can also be found in the returned `policy` bindings. Note that the map is populated only for requests with permission queries.
740 #[serde(rename = "matchedPermissions")]
741 pub matched_permissions: Option<HashMap<String, Permissions>>,
742}
743
744impl common::Part for Explanation {}
745
746/// Export asset request.
747///
748/// # Activities
749///
750/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
751/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
752///
753/// * [export assets](MethodExportAssetCall) (request)
754#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
755#[serde_with::serde_as]
756#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
757pub struct ExportAssetsRequest {
758 /// A list of asset types to take a snapshot for. For example: "compute.googleapis.com/Disk". Regular expressions are also supported. For example: * "compute.googleapis.com.*" snapshots resources whose asset type starts with "compute.googleapis.com". * ".*Instance" snapshots resources whose asset type ends with "Instance". * ".*Instance.*" snapshots resources whose asset type contains "Instance". See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned. If specified, only matching assets will be returned, otherwise, it will snapshot all asset types. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types.
759 #[serde(rename = "assetTypes")]
760 pub asset_types: Option<Vec<String>>,
761 /// Asset content type. If not specified, no content but the asset name will be returned.
762 #[serde(rename = "contentType")]
763 pub content_type: Option<String>,
764 /// Required. Output configuration indicating where the results will be output to.
765 #[serde(rename = "outputConfig")]
766 pub output_config: Option<OutputConfig>,
767 /// Timestamp to take an asset snapshot. This can only be set to a timestamp between the current time and the current time minus 35 days (inclusive). 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.
768 #[serde(rename = "readTime")]
769 pub read_time: Option<chrono::DateTime<chrono::offset::Utc>>,
770 /// A list of relationship types to export, for example: `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if content_type=RELATIONSHIP. * If specified: it snapshots specified relationships. It returns an error if any of the [relationship_types] doesn't belong to the supported relationship types of the [asset_types] or if any of the [asset_types] doesn't belong to the source types of the [relationship_types]. * Otherwise: it snapshots the supported relationships for all [asset_types] or returns an error if any of the [asset_types] has no relationship support. An unspecified asset types field means all supported asset_types. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types and relationship types.
771 #[serde(rename = "relationshipTypes")]
772 pub relationship_types: Option<Vec<String>>,
773}
774
775impl common::RequestValue for ExportAssetsRequest {}
776
777/// 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.
778///
779/// This type is not used in any activity, and only used as *part* of another schema.
780///
781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
782#[serde_with::serde_as]
783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
784pub struct Expr {
785 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
786 pub description: Option<String>,
787 /// Textual representation of an expression in Common Expression Language syntax.
788 pub expression: Option<String>,
789 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
790 pub location: Option<String>,
791 /// 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.
792 pub title: Option<String>,
793}
794
795impl common::Part for Expr {}
796
797/// An asset feed used to export asset updates to a destinations. An asset feed filter controls what updates are exported. The asset feed must be created within a project, organization, or folder. Supported destinations are: Pub/Sub topics.
798///
799/// # Activities
800///
801/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
802/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
803///
804/// * [create feeds](FeedCreateCall) (response)
805/// * [delete feeds](FeedDeleteCall) (none)
806/// * [get feeds](FeedGetCall) (response)
807/// * [list feeds](FeedListCall) (none)
808/// * [patch feeds](FeedPatchCall) (response)
809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
810#[serde_with::serde_as]
811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
812pub struct Feed {
813 /// A list of the full names of the assets to receive updates. You must specify either or both of asset_names and asset_types. Only asset updates matching specified asset_names or asset_types are exported to the feed. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. For a list of the full names for supported asset types, see [Resource name format](https://cloud.google.com/asset-inventory/docs/resource-name-format).
814 #[serde(rename = "assetNames")]
815 pub asset_names: Option<Vec<String>>,
816 /// A list of types of the assets to receive updates. You must specify either or both of asset_names and asset_types. Only asset updates matching specified asset_names or asset_types are exported to the feed. Example: `"compute.googleapis.com/Disk"` For a list of all supported asset types, see [Supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
817 #[serde(rename = "assetTypes")]
818 pub asset_types: Option<Vec<String>>,
819 /// A condition which determines whether an asset update should be published. If specified, an asset will be returned only when the expression evaluates to true. When set, `expression` field in the `Expr` must be a valid [CEL expression] (https://github.com/google/cel-spec) on a TemporalAsset with name `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted == true") will only publish Asset deletions. Other fields of `Expr` are optional. See our [user guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition) for detailed instructions.
820 pub condition: Option<Expr>,
821 /// Asset content type. If not specified, no content but the asset name and type will be returned.
822 #[serde(rename = "contentType")]
823 pub content_type: Option<String>,
824 /// Required. Feed output configuration defining where the asset updates are published to.
825 #[serde(rename = "feedOutputConfig")]
826 pub feed_output_config: Option<FeedOutputConfig>,
827 /// Required. The format will be projects/{project_number}/feeds/{client-assigned_feed_identifier} or folders/{folder_number}/feeds/{client-assigned_feed_identifier} or organizations/{organization_number}/feeds/{client-assigned_feed_identifier} The client-assigned feed identifier must be unique within the parent project/folder/organization.
828 pub name: Option<String>,
829 /// A list of relationship types to output, for example: `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if content_type=RELATIONSHIP. * If specified: it outputs specified relationship updates on the [asset_names] or the [asset_types]. It returns an error if any of the [relationship_types] doesn't belong to the supported relationship types of the [asset_names] or [asset_types], or any of the [asset_names] or the [asset_types] doesn't belong to the source types of the [relationship_types]. * Otherwise: it outputs the supported relationships of the types of [asset_names] and [asset_types] or returns an error if any of the [asset_names] or the [asset_types] has no replationship support. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types and relationship types.
830 #[serde(rename = "relationshipTypes")]
831 pub relationship_types: Option<Vec<String>>,
832}
833
834impl common::Resource for Feed {}
835impl common::ResponseResult for Feed {}
836
837/// Output configuration for asset feed destination.
838///
839/// This type is not used in any activity, and only used as *part* of another schema.
840///
841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
842#[serde_with::serde_as]
843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
844pub struct FeedOutputConfig {
845 /// Destination on Pub/Sub.
846 #[serde(rename = "pubsubDestination")]
847 pub pubsub_destination: Option<PubsubDestination>,
848}
849
850impl common::Part for FeedOutputConfig {}
851
852/// A Cloud Storage location.
853///
854/// This type is not used in any activity, and only used as *part* of another schema.
855///
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct GcsDestination {
860 /// The URI of the Cloud Storage object. It's the same URI that is used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and Editing Object Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) for more information. If the specified Cloud Storage object already exists and there is no [hold](https://cloud.google.com/storage/docs/object-holds), it will be overwritten with the exported result.
861 pub uri: Option<String>,
862 /// The URI prefix of all generated Cloud Storage objects. 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. Example: "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is the first shard of output objects containing all compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be returned if file with the same name "gs://bucket_name/object_name_prefix" already exists.
863 #[serde(rename = "uriPrefix")]
864 pub uri_prefix: Option<String>,
865}
866
867impl common::Part for GcsDestination {}
868
869/// An IAM role or permission under analysis.
870///
871/// This type is not used in any activity, and only used as *part* of another schema.
872///
873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
874#[serde_with::serde_as]
875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
876pub struct GoogleCloudAssetV1Access {
877 /// The analysis state of this access.
878 #[serde(rename = "analysisState")]
879 pub analysis_state: Option<IamPolicyAnalysisState>,
880 /// The permission.
881 pub permission: Option<String>,
882 /// The role.
883 pub role: Option<String>,
884}
885
886impl common::Part for GoogleCloudAssetV1Access {}
887
888/// An access control list, derived from the above IAM policy binding, which contains a set of resources and accesses. May include one item from each set to compose an access control entry. NOTICE that there could be multiple access control lists for one IAM policy binding. The access control lists are created based on resource and access combinations. For example, assume we have the following cases in one IAM policy binding: - Permission P1 and P2 apply to resource R1 and R2; - Permission P3 applies to resource R2 and R3; This will result in the following access control lists: - AccessControlList 1: [R1, R2], [P1, P2] - AccessControlList 2: [R2, R3], [P3]
889///
890/// This type is not used in any activity, and only used as *part* of another schema.
891///
892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
893#[serde_with::serde_as]
894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
895pub struct GoogleCloudAssetV1AccessControlList {
896 /// The accesses that match one of the following conditions: - The access_selector, if it is specified in request; - Otherwise, access specifiers reachable from the policy binding's role.
897 pub accesses: Option<Vec<GoogleCloudAssetV1Access>>,
898 /// Condition evaluation for this AccessControlList, if there is a condition defined in the above IAM policy binding.
899 #[serde(rename = "conditionEvaluation")]
900 pub condition_evaluation: Option<ConditionEvaluation>,
901 /// Resource edges of the graph starting from the policy attached resource to any descendant resources. The Edge.source_node contains the full resource name of a parent resource and Edge.target_node contains the full resource name of a child resource. This field is present only if the output_resource_edges option is enabled in request.
902 #[serde(rename = "resourceEdges")]
903 pub resource_edges: Option<Vec<GoogleCloudAssetV1Edge>>,
904 /// The resources that match one of the following conditions: - The resource_selector, if it is specified in request; - Otherwise, resources reachable from the policy attached resource.
905 pub resources: Option<Vec<GoogleCloudAssetV1Resource>>,
906}
907
908impl common::Part for GoogleCloudAssetV1AccessControlList {}
909
910/// Represents a Google Cloud asset(resource or IAM policy) governed by the organization policies of the AnalyzeOrgPolicyGovernedAssetsRequest.constraint.
911///
912/// This type is not used in any activity, and only used as *part* of another schema.
913///
914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
915#[serde_with::serde_as]
916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
917pub struct GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedAsset {
918 /// The consolidated policy for the analyzed asset. The consolidated policy is computed by merging and evaluating AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle. The evaluation will respect the organization policy [hierarchy rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
919 #[serde(rename = "consolidatedPolicy")]
920 pub consolidated_policy: Option<AnalyzerOrgPolicy>,
921 /// An IAM policy governed by the organization policies of the AnalyzeOrgPolicyGovernedAssetsRequest.constraint.
922 #[serde(rename = "governedIamPolicy")]
923 pub governed_iam_policy:
924 Option<GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedIamPolicy>,
925 /// A Google Cloud resource governed by the organization policies of the AnalyzeOrgPolicyGovernedAssetsRequest.constraint.
926 #[serde(rename = "governedResource")]
927 pub governed_resource:
928 Option<GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedResource>,
929 /// The ordered list of all organization policies from the consolidated_policy.attached_resource to the scope specified in the request. If the constraint is defined with default policy, it will also appear in the list.
930 #[serde(rename = "policyBundle")]
931 pub policy_bundle: Option<Vec<AnalyzerOrgPolicy>>,
932}
933
934impl common::Part for GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedAsset {}
935
936/// The IAM policies governed by the organization policies of the AnalyzeOrgPolicyGovernedAssetsRequest.constraint.
937///
938/// This type is not used in any activity, and only used as *part* of another schema.
939///
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedIamPolicy {
944 /// The asset type of the AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource. Example: `cloudresourcemanager.googleapis.com/Project` See [Cloud Asset Inventory Supported Asset Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for all supported asset types.
945 #[serde(rename = "assetType")]
946 pub asset_type: Option<String>,
947 /// The full resource name of the resource on which this IAM policy is set. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. See [Cloud Asset Inventory Resource Name Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) for more information.
948 #[serde(rename = "attachedResource")]
949 pub attached_resource: Option<String>,
950 /// The folder(s) that this IAM policy belongs to, in the format of folders/{FOLDER_NUMBER}. This field is available when the IAM policy belongs (directly or cascadingly) to one or more folders.
951 pub folders: Option<Vec<String>>,
952 /// The organization that this IAM policy belongs to, in the format of organizations/{ORGANIZATION_NUMBER}. This field is available when the IAM policy belongs (directly or cascadingly) to an organization.
953 pub organization: Option<String>,
954 /// The IAM policy directly set on the given resource.
955 pub policy: Option<Policy>,
956 /// The project that this IAM policy belongs to, in the format of projects/{PROJECT_NUMBER}. This field is available when the IAM policy belongs to a project.
957 pub project: Option<String>,
958}
959
960impl common::Part for GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedIamPolicy {}
961
962/// The Google Cloud resources governed by the organization policies of the AnalyzeOrgPolicyGovernedAssetsRequest.constraint.
963///
964/// This type is not used in any activity, and only used as *part* of another schema.
965///
966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
967#[serde_with::serde_as]
968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
969pub struct GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedResource {
970 /// The asset type of the AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name Example: `cloudresourcemanager.googleapis.com/Project` See [Cloud Asset Inventory Supported Asset Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) for all supported asset types.
971 #[serde(rename = "assetType")]
972 pub asset_type: Option<String>,
973 /// The effective tags on this resource.
974 #[serde(rename = "effectiveTags")]
975 pub effective_tags: Option<Vec<EffectiveTagDetails>>,
976 /// The folder(s) that this resource belongs to, in the format of folders/{FOLDER_NUMBER}. This field is available when the resource belongs (directly or cascadingly) to one or more folders.
977 pub folders: Option<Vec<String>>,
978 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of the Google Cloud resource.
979 #[serde(rename = "fullResourceName")]
980 pub full_resource_name: Option<String>,
981 /// The organization that this resource belongs to, in the format of organizations/{ORGANIZATION_NUMBER}. This field is available when the resource belongs (directly or cascadingly) to an organization.
982 pub organization: Option<String>,
983 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of the parent of AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name.
984 pub parent: Option<String>,
985 /// The project that this resource belongs to, in the format of projects/{PROJECT_NUMBER}. This field is available when the resource belongs to a project.
986 pub project: Option<String>,
987}
988
989impl common::Part for GoogleCloudAssetV1AnalyzeOrgPolicyGovernedAssetsResponseGovernedResource {}
990
991/// A BigQuery destination.
992///
993/// This type is not used in any activity, and only used as *part* of another schema.
994///
995#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
996#[serde_with::serde_as]
997#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
998pub struct GoogleCloudAssetV1BigQueryDestination {
999 /// Required. The BigQuery dataset in format "projects/projectId/datasets/datasetId", to which the analysis results should be exported. If this dataset does not exist, the export call will return an INVALID_ARGUMENT error.
1000 pub dataset: Option<String>,
1001 /// The partition key for BigQuery partitioned table.
1002 #[serde(rename = "partitionKey")]
1003 pub partition_key: Option<String>,
1004 /// Required. The prefix of the BigQuery tables to which the analysis results will be written. Tables will be created based on this table_prefix if not exist: * _analysis table will contain export operation's metadata. * _analysis_result will contain all the IamPolicyAnalysisResult. When [partition_key] is specified, both tables will be partitioned based on the [partition_key].
1005 #[serde(rename = "tablePrefix")]
1006 pub table_prefix: Option<String>,
1007 /// Optional. Specifies the action that occurs if the destination table or partition already exists. The following values are supported: * WRITE_TRUNCATE: If the table or partition already exists, BigQuery overwrites the entire table or all the partitions data. * WRITE_APPEND: If the table or partition already exists, BigQuery appends the data to the table or the latest partition. * WRITE_EMPTY: If the table already exists and contains data, an error is returned. The default value is WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Details are at https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file.
1008 #[serde(rename = "writeDisposition")]
1009 pub write_disposition: Option<String>,
1010}
1011
1012impl common::Part for GoogleCloudAssetV1BigQueryDestination {}
1013
1014/// A `Constraint` that is either enforced or not. For example a constraint `constraints/compute.disableSerialPortAccess`. If it is enforced on a VM instance, serial port connections will not be opened to that instance.
1015///
1016/// This type is not used in any activity, and only used as *part* of another schema.
1017///
1018#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1019#[serde_with::serde_as]
1020#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1021pub struct GoogleCloudAssetV1BooleanConstraint {
1022 _never_set: Option<bool>,
1023}
1024
1025impl common::Part for GoogleCloudAssetV1BooleanConstraint {}
1026
1027/// The definition of a constraint.
1028///
1029/// This type is not used in any activity, and only used as *part* of another schema.
1030///
1031#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1032#[serde_with::serde_as]
1033#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1034pub struct GoogleCloudAssetV1Constraint {
1035 /// Defines this constraint as being a BooleanConstraint.
1036 #[serde(rename = "booleanConstraint")]
1037 pub boolean_constraint: Option<GoogleCloudAssetV1BooleanConstraint>,
1038 /// The evaluation behavior of this constraint in the absence of 'Policy'.
1039 #[serde(rename = "constraintDefault")]
1040 pub constraint_default: Option<String>,
1041 /// Detailed description of what this `Constraint` controls as well as how and where it is enforced.
1042 pub description: Option<String>,
1043 /// The human readable name of the constraint.
1044 #[serde(rename = "displayName")]
1045 pub display_name: Option<String>,
1046 /// Defines this constraint as being a ListConstraint.
1047 #[serde(rename = "listConstraint")]
1048 pub list_constraint: Option<GoogleCloudAssetV1ListConstraint>,
1049 /// The unique name of the constraint. Format of the name should be * `constraints/{constraint_name}` For example, `constraints/compute.disableSerialPortAccess`.
1050 pub name: Option<String>,
1051}
1052
1053impl common::Part for GoogleCloudAssetV1Constraint {}
1054
1055/// The definition of a custom constraint.
1056///
1057/// This type is not used in any activity, and only used as *part* of another schema.
1058///
1059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1060#[serde_with::serde_as]
1061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1062pub struct GoogleCloudAssetV1CustomConstraint {
1063 /// Allow or deny type.
1064 #[serde(rename = "actionType")]
1065 pub action_type: Option<String>,
1066 /// Organization Policy condition/expression. For example: `resource.instanceName.matches("(production|test)_(.+_)?[\d]+")'` or, `resource.management.auto_upgrade == true`
1067 pub condition: Option<String>,
1068 /// Detailed information about this custom policy constraint.
1069 pub description: Option<String>,
1070 /// One line display name for the UI.
1071 #[serde(rename = "displayName")]
1072 pub display_name: Option<String>,
1073 /// All the operations being applied for this constraint.
1074 #[serde(rename = "methodTypes")]
1075 pub method_types: Option<Vec<String>>,
1076 /// Name of the constraint. This is unique within the organization. Format of the name should be * `organizations/{organization_id}/customConstraints/{custom_constraint_id}` Example : "organizations/123/customConstraints/custom.createOnlyE2TypeVms"
1077 pub name: Option<String>,
1078 /// The Resource Instance type on which this policy applies to. Format will be of the form : "/" Example: * `compute.googleapis.com/Instance`.
1079 #[serde(rename = "resourceTypes")]
1080 pub resource_types: Option<Vec<String>>,
1081}
1082
1083impl common::Part for GoogleCloudAssetV1CustomConstraint {}
1084
1085/// A directional edge.
1086///
1087/// This type is not used in any activity, and only used as *part* of another schema.
1088///
1089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1090#[serde_with::serde_as]
1091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1092pub struct GoogleCloudAssetV1Edge {
1093 /// The source node of the edge. For example, it could be a full resource name for a resource node or an email of an identity.
1094 #[serde(rename = "sourceNode")]
1095 pub source_node: Option<String>,
1096 /// The target node of the edge. For example, it could be a full resource name for a resource node or an email of an identity.
1097 #[serde(rename = "targetNode")]
1098 pub target_node: Option<String>,
1099}
1100
1101impl common::Part for GoogleCloudAssetV1Edge {}
1102
1103/// A Cloud Storage location.
1104///
1105/// This type is not used in any activity, and only used as *part* of another schema.
1106///
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct GoogleCloudAssetV1GcsDestination {
1111 /// Required. The URI of the Cloud Storage object. It's the same URI that is used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and Editing Object Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) for more information. If the specified Cloud Storage object already exists and there is no [hold](https://cloud.google.com/storage/docs/object-holds), it will be overwritten with the analysis result.
1112 pub uri: Option<String>,
1113}
1114
1115impl common::Part for GoogleCloudAssetV1GcsDestination {}
1116
1117/// The organization/folder/project resource governed by organization policies of AnalyzeOrgPolicyGovernedContainersRequest.constraint.
1118///
1119/// This type is not used in any activity, and only used as *part* of another schema.
1120///
1121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1122#[serde_with::serde_as]
1123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1124pub struct GoogleCloudAssetV1GovernedContainer {
1125 /// The consolidated organization policy for the analyzed resource. The consolidated organization policy is computed by merging and evaluating AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle. The evaluation will respect the organization policy [hierarchy rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
1126 #[serde(rename = "consolidatedPolicy")]
1127 pub consolidated_policy: Option<AnalyzerOrgPolicy>,
1128 /// The effective tags on this resource.
1129 #[serde(rename = "effectiveTags")]
1130 pub effective_tags: Option<Vec<EffectiveTagDetails>>,
1131 /// The folder(s) that this resource belongs to, in the format of folders/{FOLDER_NUMBER}. This field is available when the resource belongs (directly or cascadingly) to one or more folders.
1132 pub folders: Option<Vec<String>>,
1133 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of an organization/folder/project resource.
1134 #[serde(rename = "fullResourceName")]
1135 pub full_resource_name: Option<String>,
1136 /// The organization that this resource belongs to, in the format of organizations/{ORGANIZATION_NUMBER}. This field is available when the resource belongs (directly or cascadingly) to an organization.
1137 pub organization: Option<String>,
1138 /// The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of the parent of AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name.
1139 pub parent: Option<String>,
1140 /// The ordered list of all organization policies from the consolidated_policy.attached_resource. to the scope specified in the request. If the constraint is defined with default policy, it will also appear in the list.
1141 #[serde(rename = "policyBundle")]
1142 pub policy_bundle: Option<Vec<AnalyzerOrgPolicy>>,
1143 /// The project that this resource belongs to, in the format of projects/{PROJECT_NUMBER}. This field is available when the resource belongs to a project.
1144 pub project: Option<String>,
1145}
1146
1147impl common::Part for GoogleCloudAssetV1GovernedContainer {}
1148
1149/// An identity under analysis.
1150///
1151/// This type is not used in any activity, and only used as *part* of another schema.
1152///
1153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1154#[serde_with::serde_as]
1155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1156pub struct GoogleCloudAssetV1Identity {
1157 /// The analysis state of this identity.
1158 #[serde(rename = "analysisState")]
1159 pub analysis_state: Option<IamPolicyAnalysisState>,
1160 /// The identity of members, formatted as appear in an [IAM policy binding](https://cloud.google.com/iam/reference/rest/v1/Binding). For example, they might be formatted like the following: - user:foo@google.com - group:group1@google.com - serviceAccount:s1@prj1.iam.gserviceaccount.com - projectOwner:some_project_id - domain:google.com - allUsers
1161 pub name: Option<String>,
1162}
1163
1164impl common::Part for GoogleCloudAssetV1Identity {}
1165
1166/// The identities and group edges.
1167///
1168/// This type is not used in any activity, and only used as *part* of another schema.
1169///
1170#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1171#[serde_with::serde_as]
1172#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1173pub struct GoogleCloudAssetV1IdentityList {
1174 /// Group identity edges of the graph starting from the binding's group members to any node of the identities. The Edge.source_node contains a group, such as `group:parent@google.com`. The Edge.target_node contains a member of the group, such as `group:child@google.com` or `user:foo@google.com`. This field is present only if the output_group_edges option is enabled in request.
1175 #[serde(rename = "groupEdges")]
1176 pub group_edges: Option<Vec<GoogleCloudAssetV1Edge>>,
1177 /// Only the identities that match one of the following conditions will be presented: - The identity_selector, if it is specified in request; - Otherwise, identities reachable from the policy binding's members.
1178 pub identities: Option<Vec<GoogleCloudAssetV1Identity>>,
1179}
1180
1181impl common::Part for GoogleCloudAssetV1IdentityList {}
1182
1183/// A `Constraint` that allows or disallows a list of string values, which are configured by an organization's policy administrator with a `Policy`.
1184///
1185/// This type is not used in any activity, and only used as *part* of another schema.
1186///
1187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1188#[serde_with::serde_as]
1189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1190pub struct GoogleCloudAssetV1ListConstraint {
1191 /// Indicates whether values grouped into categories can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"in:Python"` would match any value in the 'Python' group.
1192 #[serde(rename = "supportsIn")]
1193 pub supports_in: Option<bool>,
1194 /// Indicates whether subtrees of Cloud Resource Manager resource hierarchy can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"under:folders/123"` would match any resource under the 'folders/123' folder.
1195 #[serde(rename = "supportsUnder")]
1196 pub supports_under: Option<bool>,
1197}
1198
1199impl common::Part for GoogleCloudAssetV1ListConstraint {}
1200
1201/// BigQuery destination.
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct GoogleCloudAssetV1QueryAssetsOutputConfigBigQueryDestination {
1209 /// Required. The BigQuery dataset where the query results will be saved. It has the format of "projects/{projectId}/datasets/{datasetId}".
1210 pub dataset: Option<String>,
1211 /// Required. The BigQuery table where the query results will be saved. If this table does not exist, a new table with the given name will be created.
1212 pub table: Option<String>,
1213 /// Specifies the action that occurs if the destination table or partition already exists. The following values are supported: * WRITE_TRUNCATE: If the table or partition already exists, BigQuery overwrites the entire table or all the partitions data. * WRITE_APPEND: If the table or partition already exists, BigQuery appends the data to the table or the latest partition. * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY.
1214 #[serde(rename = "writeDisposition")]
1215 pub write_disposition: Option<String>,
1216}
1217
1218impl common::Part for GoogleCloudAssetV1QueryAssetsOutputConfigBigQueryDestination {}
1219
1220/// A Google Cloud resource under analysis.
1221///
1222/// This type is not used in any activity, and only used as *part* of another schema.
1223///
1224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1225#[serde_with::serde_as]
1226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1227pub struct GoogleCloudAssetV1Resource {
1228 /// The analysis state of this resource.
1229 #[serde(rename = "analysisState")]
1230 pub analysis_state: Option<IamPolicyAnalysisState>,
1231 /// The [full resource name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
1232 #[serde(rename = "fullResourceName")]
1233 pub full_resource_name: Option<String>,
1234}
1235
1236impl common::Part for GoogleCloudAssetV1Resource {}
1237
1238/// This rule message is a customized version of the one defined in the Organization Policy system. In addition to the fields defined in the original organization policy, it contains additional field(s) under specific circumstances to support analysis results.
1239///
1240/// This type is not used in any activity, and only used as *part* of another schema.
1241///
1242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1243#[serde_with::serde_as]
1244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1245pub struct GoogleCloudAssetV1Rule {
1246 /// Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.
1247 #[serde(rename = "allowAll")]
1248 pub allow_all: Option<bool>,
1249 /// The evaluating condition for this rule.
1250 pub condition: Option<Expr>,
1251 /// The condition evaluation result for this rule. Only populated if it meets all the following criteria: * There is a condition defined for this rule. * This rule is within AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy, or AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy when the AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset has AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource.
1252 #[serde(rename = "conditionEvaluation")]
1253 pub condition_evaluation: Option<ConditionEvaluation>,
1254 /// Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.
1255 #[serde(rename = "denyAll")]
1256 pub deny_all: Option<bool>,
1257 /// If `true`, then the `Policy` is enforced. If `false`, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.
1258 pub enforce: Option<bool>,
1259 /// List of values to be used for this policy rule. This field can be set only in policies for list constraints.
1260 pub values: Option<GoogleCloudAssetV1StringValues>,
1261}
1262
1263impl common::Part for GoogleCloudAssetV1Rule {}
1264
1265/// The string values for the list constraints.
1266///
1267/// This type is not used in any activity, and only used as *part* of another schema.
1268///
1269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1270#[serde_with::serde_as]
1271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1272pub struct GoogleCloudAssetV1StringValues {
1273 /// List of values allowed at this resource.
1274 #[serde(rename = "allowedValues")]
1275 pub allowed_values: Option<Vec<String>>,
1276 /// List of values denied at this resource.
1277 #[serde(rename = "deniedValues")]
1278 pub denied_values: Option<Vec<String>>,
1279}
1280
1281impl common::Part for GoogleCloudAssetV1StringValues {}
1282
1283/// Used in `policy_type` to specify how `boolean_policy` will behave at this resource.
1284///
1285/// This type is not used in any activity, and only used as *part* of another schema.
1286///
1287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1288#[serde_with::serde_as]
1289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1290pub struct GoogleCloudOrgpolicyV1BooleanPolicy {
1291 /// 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`.
1292 pub enforced: Option<bool>,
1293}
1294
1295impl common::Part for GoogleCloudOrgpolicyV1BooleanPolicy {}
1296
1297/// 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.
1298///
1299/// This type is not used in any activity, and only used as *part* of another schema.
1300///
1301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1302#[serde_with::serde_as]
1303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1304pub struct GoogleCloudOrgpolicyV1ListPolicy {
1305 /// The policy all_values state.
1306 #[serde(rename = "allValues")]
1307 pub all_values: Option<String>,
1308 /// List of values allowed at this resource. Can only be set if `all_values` is set to `ALL_VALUES_UNSPECIFIED`.
1309 #[serde(rename = "allowedValues")]
1310 pub allowed_values: Option<Vec<String>>,
1311 /// List of values denied at this resource. Can only be set if `all_values` is set to `ALL_VALUES_UNSPECIFIED`.
1312 #[serde(rename = "deniedValues")]
1313 pub denied_values: Option<Vec<String>>,
1314 /// 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`.
1315 #[serde(rename = "inheritFromParent")]
1316 pub inherit_from_parent: Option<bool>,
1317 /// 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`.
1318 #[serde(rename = "suggestedValue")]
1319 pub suggested_value: Option<String>,
1320}
1321
1322impl common::Part for GoogleCloudOrgpolicyV1ListPolicy {}
1323
1324/// Defines a Cloud Organization `Policy` which is used to specify `Constraints` for configurations of Cloud Platform resources.
1325///
1326/// This type is not used in any activity, and only used as *part* of another schema.
1327///
1328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1329#[serde_with::serde_as]
1330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1331pub struct GoogleCloudOrgpolicyV1Policy {
1332 /// For boolean `Constraints`, whether to enforce the `Constraint` or not.
1333 #[serde(rename = "booleanPolicy")]
1334 pub boolean_policy: Option<GoogleCloudOrgpolicyV1BooleanPolicy>,
1335 /// 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.
1336 pub constraint: Option<String>,
1337 /// 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`.
1338 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1339 pub etag: Option<Vec<u8>>,
1340 /// List of values either allowed or disallowed.
1341 #[serde(rename = "listPolicy")]
1342 pub list_policy: Option<GoogleCloudOrgpolicyV1ListPolicy>,
1343 /// Restores the default behavior of the constraint; independent of `Constraint` type.
1344 #[serde(rename = "restoreDefault")]
1345 pub restore_default: Option<GoogleCloudOrgpolicyV1RestoreDefault>,
1346 /// 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.
1347 #[serde(rename = "updateTime")]
1348 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1349 /// Version of the `Policy`. Default version is 0;
1350 pub version: Option<i32>,
1351}
1352
1353impl common::Part for GoogleCloudOrgpolicyV1Policy {}
1354
1355/// 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.
1356///
1357/// This type is not used in any activity, and only used as *part* of another schema.
1358///
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct GoogleCloudOrgpolicyV1RestoreDefault {
1363 _never_set: Option<bool>,
1364}
1365
1366impl common::Part for GoogleCloudOrgpolicyV1RestoreDefault {}
1367
1368/// 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.
1369///
1370/// This type is not used in any activity, and only used as *part* of another schema.
1371///
1372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1373#[serde_with::serde_as]
1374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1375pub struct GoogleIdentityAccesscontextmanagerV1AccessLevel {
1376 /// A `BasicLevel` composed of `Conditions`.
1377 pub basic: Option<GoogleIdentityAccesscontextmanagerV1BasicLevel>,
1378 /// A `CustomLevel` written in the Common Expression Language.
1379 pub custom: Option<GoogleIdentityAccesscontextmanagerV1CustomLevel>,
1380 /// Description of the `AccessLevel` and its use. Does not affect behavior.
1381 pub description: Option<String>,
1382 /// 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`.
1383 pub name: Option<String>,
1384 /// Human readable title. Must be unique within the Policy.
1385 pub title: Option<String>,
1386}
1387
1388impl common::Part for GoogleIdentityAccesscontextmanagerV1AccessLevel {}
1389
1390/// `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.
1391///
1392/// This type is not used in any activity, and only used as *part* of another schema.
1393///
1394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1395#[serde_with::serde_as]
1396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1397pub struct GoogleIdentityAccesscontextmanagerV1AccessPolicy {
1398 /// 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.
1399 pub etag: Option<String>,
1400 /// Output only. Identifier. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}`
1401 pub name: Option<String>,
1402 /// Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently immutable once created. Format: `organizations/{organization_id}`
1403 pub parent: Option<String>,
1404 /// 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}`
1405 pub scopes: Option<Vec<String>>,
1406 /// Required. Human readable title. Does not affect behavior.
1407 pub title: Option<String>,
1408}
1409
1410impl common::Part for GoogleIdentityAccesscontextmanagerV1AccessPolicy {}
1411
1412/// Identification for an API Operation.
1413///
1414/// This type is not used in any activity, and only used as *part* of another schema.
1415///
1416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1417#[serde_with::serde_as]
1418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1419pub struct GoogleIdentityAccesscontextmanagerV1ApiOperation {
1420 /// 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`.
1421 #[serde(rename = "methodSelectors")]
1422 pub method_selectors: Option<Vec<GoogleIdentityAccesscontextmanagerV1MethodSelector>>,
1423 /// 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.
1424 #[serde(rename = "serviceName")]
1425 pub service_name: Option<String>,
1426}
1427
1428impl common::Part for GoogleIdentityAccesscontextmanagerV1ApiOperation {}
1429
1430/// `BasicLevel` is an `AccessLevel` using a set of recommended features.
1431///
1432/// This type is not used in any activity, and only used as *part* of another schema.
1433///
1434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1435#[serde_with::serde_as]
1436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1437pub struct GoogleIdentityAccesscontextmanagerV1BasicLevel {
1438 /// 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.
1439 #[serde(rename = "combiningFunction")]
1440 pub combining_function: Option<String>,
1441 /// Required. A list of requirements for the `AccessLevel` to be granted.
1442 pub conditions: Option<Vec<GoogleIdentityAccesscontextmanagerV1Condition>>,
1443}
1444
1445impl common::Part for GoogleIdentityAccesscontextmanagerV1BasicLevel {}
1446
1447/// 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.
1448///
1449/// This type is not used in any activity, and only used as *part* of another schema.
1450///
1451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1452#[serde_with::serde_as]
1453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1454pub struct GoogleIdentityAccesscontextmanagerV1Condition {
1455 /// Device specific restrictions, all restrictions must hold for the Condition to be true. If not specified, all devices are allowed.
1456 #[serde(rename = "devicePolicy")]
1457 pub device_policy: Option<GoogleIdentityAccesscontextmanagerV1DevicePolicy>,
1458 /// 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.
1459 #[serde(rename = "ipSubnetworks")]
1460 pub ip_subnetworks: Option<Vec<String>>,
1461 /// 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.
1462 pub members: Option<Vec<String>>,
1463 /// 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.
1464 pub negate: Option<bool>,
1465 /// The request must originate from one of the provided countries/regions. Must be valid ISO 3166-1 alpha-2 codes.
1466 pub regions: Option<Vec<String>>,
1467 /// 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"`
1468 #[serde(rename = "requiredAccessLevels")]
1469 pub required_access_levels: Option<Vec<String>>,
1470 /// The request must originate from one of the provided VPC networks in Google Cloud. Cannot specify this field together with `ip_subnetworks`.
1471 #[serde(rename = "vpcNetworkSources")]
1472 pub vpc_network_sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1VpcNetworkSource>>,
1473}
1474
1475impl common::Part for GoogleIdentityAccesscontextmanagerV1Condition {}
1476
1477/// `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
1478///
1479/// This type is not used in any activity, and only used as *part* of another schema.
1480///
1481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1482#[serde_with::serde_as]
1483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1484pub struct GoogleIdentityAccesscontextmanagerV1CustomLevel {
1485 /// Required. A Cloud CEL expression evaluating to a boolean.
1486 pub expr: Option<Expr>,
1487}
1488
1489impl common::Part for GoogleIdentityAccesscontextmanagerV1CustomLevel {}
1490
1491/// `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.
1492///
1493/// This type is not used in any activity, and only used as *part* of another schema.
1494///
1495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1496#[serde_with::serde_as]
1497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1498pub struct GoogleIdentityAccesscontextmanagerV1DevicePolicy {
1499 /// Allowed device management levels, an empty list allows all management levels.
1500 #[serde(rename = "allowedDeviceManagementLevels")]
1501 pub allowed_device_management_levels: Option<Vec<String>>,
1502 /// Allowed encryptions statuses, an empty list allows all statuses.
1503 #[serde(rename = "allowedEncryptionStatuses")]
1504 pub allowed_encryption_statuses: Option<Vec<String>>,
1505 /// Allowed OS versions, an empty list allows all types and all versions.
1506 #[serde(rename = "osConstraints")]
1507 pub os_constraints: Option<Vec<GoogleIdentityAccesscontextmanagerV1OsConstraint>>,
1508 /// Whether the device needs to be approved by the customer admin.
1509 #[serde(rename = "requireAdminApproval")]
1510 pub require_admin_approval: Option<bool>,
1511 /// Whether the device needs to be corp owned.
1512 #[serde(rename = "requireCorpOwned")]
1513 pub require_corp_owned: Option<bool>,
1514 /// Whether or not screenlock is required for the DevicePolicy to be true. Defaults to `false`.
1515 #[serde(rename = "requireScreenlock")]
1516 pub require_screenlock: Option<bool>,
1517}
1518
1519impl common::Part for GoogleIdentityAccesscontextmanagerV1DevicePolicy {}
1520
1521/// 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.
1522///
1523/// This type is not used in any activity, and only used as *part* of another schema.
1524///
1525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1526#[serde_with::serde_as]
1527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1528pub struct GoogleIdentityAccesscontextmanagerV1EgressFrom {
1529 /// 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.
1530 pub identities: Option<Vec<String>>,
1531 /// 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.
1532 #[serde(rename = "identityType")]
1533 pub identity_type: Option<String>,
1534 /// 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`.
1535 #[serde(rename = "sourceRestriction")]
1536 pub source_restriction: Option<String>,
1537 /// Sources that this EgressPolicy authorizes access from. If this field is not empty, then `source_restriction` must be set to `SOURCE_RESTRICTION_ENABLED`.
1538 pub sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1EgressSource>>,
1539}
1540
1541impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressFrom {}
1542
1543/// 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.
1544///
1545/// This type is not used in any activity, and only used as *part* of another schema.
1546///
1547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1548#[serde_with::serde_as]
1549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1550pub struct GoogleIdentityAccesscontextmanagerV1EgressPolicy {
1551 /// Defines conditions on the source of a request causing this EgressPolicy to apply.
1552 #[serde(rename = "egressFrom")]
1553 pub egress_from: Option<GoogleIdentityAccesscontextmanagerV1EgressFrom>,
1554 /// Defines the conditions on the ApiOperation and destination resources that cause this EgressPolicy to apply.
1555 #[serde(rename = "egressTo")]
1556 pub egress_to: Option<GoogleIdentityAccesscontextmanagerV1EgressTo>,
1557 /// 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.
1558 pub title: Option<String>,
1559}
1560
1561impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressPolicy {}
1562
1563/// The source that EgressPolicy authorizes access from inside the ServicePerimeter to somewhere outside the ServicePerimeter boundaries.
1564///
1565/// This type is not used in any activity, and only used as *part* of another schema.
1566///
1567#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1568#[serde_with::serde_as]
1569#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1570pub struct GoogleIdentityAccesscontextmanagerV1EgressSource {
1571 /// 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.
1572 #[serde(rename = "accessLevel")]
1573 pub access_level: Option<String>,
1574 /// 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.
1575 pub resource: Option<String>,
1576}
1577
1578impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressSource {}
1579
1580/// 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.
1581///
1582/// This type is not used in any activity, and only used as *part* of another schema.
1583///
1584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1585#[serde_with::serde_as]
1586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1587pub struct GoogleIdentityAccesscontextmanagerV1EgressTo {
1588 /// 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.
1589 #[serde(rename = "externalResources")]
1590 pub external_resources: Option<Vec<String>>,
1591 /// 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.
1592 pub operations: Option<Vec<GoogleIdentityAccesscontextmanagerV1ApiOperation>>,
1593 /// 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.
1594 pub resources: Option<Vec<String>>,
1595 /// IAM roles that represent the set of operations that the sources specified in the corresponding EgressFrom. are allowed to perform in this ServicePerimeter.
1596 pub roles: Option<Vec<String>>,
1597}
1598
1599impl common::Part for GoogleIdentityAccesscontextmanagerV1EgressTo {}
1600
1601/// 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.
1602///
1603/// This type is not used in any activity, and only used as *part* of another schema.
1604///
1605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1606#[serde_with::serde_as]
1607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1608pub struct GoogleIdentityAccesscontextmanagerV1IngressFrom {
1609 /// 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.
1610 pub identities: Option<Vec<String>>,
1611 /// 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.
1612 #[serde(rename = "identityType")]
1613 pub identity_type: Option<String>,
1614 /// Sources that this IngressPolicy authorizes access from.
1615 pub sources: Option<Vec<GoogleIdentityAccesscontextmanagerV1IngressSource>>,
1616}
1617
1618impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressFrom {}
1619
1620/// 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.
1621///
1622/// This type is not used in any activity, and only used as *part* of another schema.
1623///
1624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1625#[serde_with::serde_as]
1626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1627pub struct GoogleIdentityAccesscontextmanagerV1IngressPolicy {
1628 /// Defines the conditions on the source of a request causing this IngressPolicy to apply.
1629 #[serde(rename = "ingressFrom")]
1630 pub ingress_from: Option<GoogleIdentityAccesscontextmanagerV1IngressFrom>,
1631 /// Defines the conditions on the ApiOperation and request destination that cause this IngressPolicy to apply.
1632 #[serde(rename = "ingressTo")]
1633 pub ingress_to: Option<GoogleIdentityAccesscontextmanagerV1IngressTo>,
1634 /// 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.
1635 pub title: Option<String>,
1636}
1637
1638impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressPolicy {}
1639
1640/// The source that IngressPolicy authorizes access from.
1641///
1642/// This type is not used in any activity, and only used as *part* of another schema.
1643///
1644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1645#[serde_with::serde_as]
1646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1647pub struct GoogleIdentityAccesscontextmanagerV1IngressSource {
1648 /// 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.
1649 #[serde(rename = "accessLevel")]
1650 pub access_level: Option<String>,
1651 /// 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.
1652 pub resource: Option<String>,
1653}
1654
1655impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressSource {}
1656
1657/// 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.
1658///
1659/// This type is not used in any activity, and only used as *part* of another schema.
1660///
1661#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1662#[serde_with::serde_as]
1663#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1664pub struct GoogleIdentityAccesscontextmanagerV1IngressTo {
1665 /// A list of ApiOperations allowed to be performed by the sources specified in corresponding IngressFrom in this ServicePerimeter.
1666 pub operations: Option<Vec<GoogleIdentityAccesscontextmanagerV1ApiOperation>>,
1667 /// 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.
1668 pub resources: Option<Vec<String>>,
1669 /// IAM roles that represent the set of operations that the sources specified in the corresponding IngressFrom are allowed to perform in this ServicePerimeter.
1670 pub roles: Option<Vec<String>>,
1671}
1672
1673impl common::Part for GoogleIdentityAccesscontextmanagerV1IngressTo {}
1674
1675/// An allowed method or permission of a service specified in ApiOperation.
1676///
1677/// This type is not used in any activity, and only used as *part* of another schema.
1678///
1679#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1680#[serde_with::serde_as]
1681#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1682pub struct GoogleIdentityAccesscontextmanagerV1MethodSelector {
1683 /// 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.
1684 pub method: Option<String>,
1685 /// A valid Cloud IAM permission for the corresponding `service_name` in ApiOperation.
1686 pub permission: Option<String>,
1687}
1688
1689impl common::Part for GoogleIdentityAccesscontextmanagerV1MethodSelector {}
1690
1691/// A restriction on the OS type and version of devices making requests.
1692///
1693/// This type is not used in any activity, and only used as *part* of another schema.
1694///
1695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1696#[serde_with::serde_as]
1697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1698pub struct GoogleIdentityAccesscontextmanagerV1OsConstraint {
1699 /// 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"`.
1700 #[serde(rename = "minimumVersion")]
1701 pub minimum_version: Option<String>,
1702 /// Required. The allowed OS type.
1703 #[serde(rename = "osType")]
1704 pub os_type: Option<String>,
1705 /// 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.
1706 #[serde(rename = "requireVerifiedChromeOs")]
1707 pub require_verified_chrome_os: Option<bool>,
1708}
1709
1710impl common::Part for GoogleIdentityAccesscontextmanagerV1OsConstraint {}
1711
1712/// `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.
1713///
1714/// This type is not used in any activity, and only used as *part* of another schema.
1715///
1716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1717#[serde_with::serde_as]
1718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1719pub struct GoogleIdentityAccesscontextmanagerV1ServicePerimeter {
1720 /// Description of the `ServicePerimeter` and its use. Does not affect behavior.
1721 pub description: Option<String>,
1722 /// 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.
1723 pub etag: Option<String>,
1724 /// 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`.
1725 pub name: Option<String>,
1726 /// 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.
1727 #[serde(rename = "perimeterType")]
1728 pub perimeter_type: Option<String>,
1729 /// 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.
1730 pub spec: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig>,
1731 /// Current ServicePerimeter configuration. Specifies sets of resources, restricted services and access levels that determine perimeter content and boundaries.
1732 pub status: Option<GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig>,
1733 /// Human readable title. Must be unique within the Policy.
1734 pub title: Option<String>,
1735 /// 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.
1736 #[serde(rename = "useExplicitDryRunSpec")]
1737 pub use_explicit_dry_run_spec: Option<bool>,
1738}
1739
1740impl common::Part for GoogleIdentityAccesscontextmanagerV1ServicePerimeter {}
1741
1742/// `ServicePerimeterConfig` specifies a set of Google Cloud resources that describe specific Service Perimeter configuration.
1743///
1744/// This type is not used in any activity, and only used as *part* of another schema.
1745///
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig {
1750 /// 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.
1751 #[serde(rename = "accessLevels")]
1752 pub access_levels: Option<Vec<String>>,
1753 /// 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.
1754 #[serde(rename = "egressPolicies")]
1755 pub egress_policies: Option<Vec<GoogleIdentityAccesscontextmanagerV1EgressPolicy>>,
1756 /// 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.
1757 #[serde(rename = "ingressPolicies")]
1758 pub ingress_policies: Option<Vec<GoogleIdentityAccesscontextmanagerV1IngressPolicy>>,
1759 /// 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}`.
1760 pub resources: Option<Vec<String>>,
1761 /// 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.
1762 #[serde(rename = "restrictedServices")]
1763 pub restricted_services: Option<Vec<String>>,
1764 /// Configuration for APIs allowed within Perimeter.
1765 #[serde(rename = "vpcAccessibleServices")]
1766 pub vpc_accessible_services: Option<GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices>,
1767}
1768
1769impl common::Part for GoogleIdentityAccesscontextmanagerV1ServicePerimeterConfig {}
1770
1771/// Specifies how APIs are allowed to communicate within the Service Perimeter.
1772///
1773/// This type is not used in any activity, and only used as *part* of another schema.
1774///
1775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1776#[serde_with::serde_as]
1777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1778pub struct GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices {
1779 /// 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.
1780 #[serde(rename = "allowedServices")]
1781 pub allowed_services: Option<Vec<String>>,
1782 /// Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowed_services'.
1783 #[serde(rename = "enableRestriction")]
1784 pub enable_restriction: Option<bool>,
1785}
1786
1787impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcAccessibleServices {}
1788
1789/// The originating network source in Google Cloud.
1790///
1791/// This type is not used in any activity, and only used as *part* of another schema.
1792///
1793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1794#[serde_with::serde_as]
1795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1796pub struct GoogleIdentityAccesscontextmanagerV1VpcNetworkSource {
1797 /// Sub-segment ranges of a VPC network.
1798 #[serde(rename = "vpcSubnetwork")]
1799 pub vpc_subnetwork: Option<GoogleIdentityAccesscontextmanagerV1VpcSubNetwork>,
1800}
1801
1802impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcNetworkSource {}
1803
1804/// Sub-segment ranges inside of a VPC Network.
1805///
1806/// This type is not used in any activity, and only used as *part* of another schema.
1807///
1808#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1809#[serde_with::serde_as]
1810#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1811pub struct GoogleIdentityAccesscontextmanagerV1VpcSubNetwork {
1812 /// 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`
1813 pub network: Option<String>,
1814 /// 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.
1815 #[serde(rename = "vpcIpSubnetworks")]
1816 pub vpc_ip_subnetworks: Option<Vec<String>>,
1817}
1818
1819impl common::Part for GoogleIdentityAccesscontextmanagerV1VpcSubNetwork {}
1820
1821/// An analysis message to group the query and results.
1822///
1823/// This type is not used in any activity, and only used as *part* of another schema.
1824///
1825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1826#[serde_with::serde_as]
1827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1828pub struct IamPolicyAnalysis {
1829 /// The analysis query.
1830 #[serde(rename = "analysisQuery")]
1831 pub analysis_query: Option<IamPolicyAnalysisQuery>,
1832 /// A list of IamPolicyAnalysisResult that matches the analysis query, or empty if no result is found.
1833 #[serde(rename = "analysisResults")]
1834 pub analysis_results: Option<Vec<IamPolicyAnalysisResult>>,
1835 /// Represents whether all entries in the analysis_results have been fully explored to answer the query.
1836 #[serde(rename = "fullyExplored")]
1837 pub fully_explored: Option<bool>,
1838 /// A list of non-critical errors happened during the query handling.
1839 #[serde(rename = "nonCriticalErrors")]
1840 pub non_critical_errors: Option<Vec<IamPolicyAnalysisState>>,
1841}
1842
1843impl common::Part for IamPolicyAnalysis {}
1844
1845/// Output configuration for export IAM policy analysis destination.
1846///
1847/// This type is not used in any activity, and only used as *part* of another schema.
1848///
1849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1850#[serde_with::serde_as]
1851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1852pub struct IamPolicyAnalysisOutputConfig {
1853 /// Destination on BigQuery.
1854 #[serde(rename = "bigqueryDestination")]
1855 pub bigquery_destination: Option<GoogleCloudAssetV1BigQueryDestination>,
1856 /// Destination on Cloud Storage.
1857 #[serde(rename = "gcsDestination")]
1858 pub gcs_destination: Option<GoogleCloudAssetV1GcsDestination>,
1859}
1860
1861impl common::Part for IamPolicyAnalysisOutputConfig {}
1862
1863/// IAM policy analysis query message.
1864///
1865/// This type is not used in any activity, and only used as *part* of another schema.
1866///
1867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1868#[serde_with::serde_as]
1869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1870pub struct IamPolicyAnalysisQuery {
1871 /// Optional. Specifies roles or permissions for analysis. This is optional.
1872 #[serde(rename = "accessSelector")]
1873 pub access_selector: Option<AccessSelector>,
1874 /// Optional. The hypothetical context for IAM conditions evaluation.
1875 #[serde(rename = "conditionContext")]
1876 pub condition_context: Option<ConditionContext>,
1877 /// Optional. Specifies an identity for analysis.
1878 #[serde(rename = "identitySelector")]
1879 pub identity_selector: Option<IdentitySelector>,
1880 /// Optional. The query options.
1881 pub options: Option<Options>,
1882 /// Optional. Specifies a resource for analysis.
1883 #[serde(rename = "resourceSelector")]
1884 pub resource_selector: Option<ResourceSelector>,
1885 /// Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
1886 pub scope: Option<String>,
1887}
1888
1889impl common::Part for IamPolicyAnalysisQuery {}
1890
1891/// IAM Policy analysis result, consisting of one IAM policy binding and derived access control lists.
1892///
1893/// This type is not used in any activity, and only used as *part* of another schema.
1894///
1895#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1896#[serde_with::serde_as]
1897#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1898pub struct IamPolicyAnalysisResult {
1899 /// The access control lists derived from the iam_binding that match or potentially match resource and access selectors specified in the request.
1900 #[serde(rename = "accessControlLists")]
1901 pub access_control_lists: Option<Vec<GoogleCloudAssetV1AccessControlList>>,
1902 /// The [full resource name](https://cloud.google.com/asset-inventory/docs/resource-name-format) of the resource to which the iam_binding policy attaches.
1903 #[serde(rename = "attachedResourceFullName")]
1904 pub attached_resource_full_name: Option<String>,
1905 /// Represents whether all analyses on the iam_binding have successfully finished.
1906 #[serde(rename = "fullyExplored")]
1907 pub fully_explored: Option<bool>,
1908 /// The IAM policy binding under analysis.
1909 #[serde(rename = "iamBinding")]
1910 pub iam_binding: Option<Binding>,
1911 /// The identity list derived from members of the iam_binding that match or potentially match identity selector specified in the request.
1912 #[serde(rename = "identityList")]
1913 pub identity_list: Option<GoogleCloudAssetV1IdentityList>,
1914}
1915
1916impl common::Part for IamPolicyAnalysisResult {}
1917
1918/// Represents the detailed state of an entity under analysis, such as a resource, an identity or an access.
1919///
1920/// This type is not used in any activity, and only used as *part* of another schema.
1921///
1922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1923#[serde_with::serde_as]
1924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1925pub struct IamPolicyAnalysisState {
1926 /// The human-readable description of the cause of failure.
1927 pub cause: Option<String>,
1928 /// The Google standard error code that best describes the state. For example: - OK means the analysis on this entity has been successfully finished; - PERMISSION_DENIED means an access denied error is encountered; - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started in time;
1929 pub code: Option<String>,
1930}
1931
1932impl common::Part for IamPolicyAnalysisState {}
1933
1934/// A result of IAM Policy search, containing information of an IAM policy.
1935///
1936/// This type is not used in any activity, and only used as *part* of another schema.
1937///
1938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1939#[serde_with::serde_as]
1940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1941pub struct IamPolicySearchResult {
1942 /// The type of the resource associated with this IAM policy. Example: `compute.googleapis.com/Disk`. To search against the `asset_type`: * specify the `asset_types` field in your search request.
1943 #[serde(rename = "assetType")]
1944 pub asset_type: Option<String>,
1945 /// Explanation about the IAM policy search result. It contains additional information to explain why the search result matches the query.
1946 pub explanation: Option<Explanation>,
1947 /// The folder(s) that the IAM policy belongs to, in the form of folders/{FOLDER_NUMBER}. This field is available when the IAM policy belongs to one or more folders. To search against `folders`: * use a field query. Example: `folders:(123 OR 456)` * use a free text query. Example: `123` * specify the `scope` field as this folder in your search request.
1948 pub folders: Option<Vec<String>>,
1949 /// The organization that the IAM policy belongs to, in the form of organizations/{ORGANIZATION_NUMBER}. This field is available when the IAM policy belongs to an organization. To search against `organization`: * use a field query. Example: `organization:123` * use a free text query. Example: `123` * specify the `scope` field as this organization in your search request.
1950 pub organization: Option<String>,
1951 /// The IAM policy directly set on the given resource. Note that the original IAM policy can contain multiple bindings. This only contains the bindings that match the given query. For queries that don't contain a constrain on policies (e.g., an empty query), this contains all the bindings. To search against the `policy` bindings: * use a field query: - query by the policy contained members. Example: `policy:amy@gmail.com` - query by the policy contained roles. Example: `policy:roles/compute.admin` - query by the policy contained roles' included permissions. Example: `policy.role.permissions:compute.instances.create`
1952 pub policy: Option<Policy>,
1953 /// The project that the associated Google Cloud resource belongs to, in the form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM instance, Cloud Storage bucket), the project field will indicate the project that contains the resource. If an IAM policy is set on a folder or organization, this field will be empty. To search against the `project`: * specify the `scope` field as this project in your search request.
1954 pub project: Option<String>,
1955 /// The full resource name of the resource associated with this IAM policy. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. See [Cloud Asset Inventory Resource Name Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) for more information. To search against the `resource`: * use a field query. Example: `resource:organizations/123`
1956 pub resource: Option<String>,
1957}
1958
1959impl common::Part for IamPolicySearchResult {}
1960
1961/// Specifies an identity for which to determine resource access, based on roles assigned either directly to them or to the groups they belong to, directly or indirectly.
1962///
1963/// This type is not used in any activity, and only used as *part* of another schema.
1964///
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct IdentitySelector {
1969 /// Required. The identity appear in the form of principals in [IAM policy binding](https://cloud.google.com/iam/reference/rest/v1/Binding). The examples of supported forms are: "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com". Notice that wildcard characters (such as * and ?) are not supported. You must give a specific identity.
1970 pub identity: Option<String>,
1971}
1972
1973impl common::Part for IdentitySelector {}
1974
1975/// This API resource represents the available inventory data for a Compute Engine virtual machine (VM) instance at a given point in time. You can use this API resource to determine the inventory data of your VM. For more information, see [Information provided by OS inventory management](https://cloud.google.com/compute/docs/instances/os-inventory-management#data-collected).
1976///
1977/// This type is not used in any activity, and only used as *part* of another schema.
1978///
1979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1980#[serde_with::serde_as]
1981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1982pub struct Inventory {
1983 /// Inventory items related to the VM keyed by an opaque unique identifier for each inventory item. The identifier is unique to each distinct and addressable inventory item and will change, when there is a new package version.
1984 pub items: Option<HashMap<String, Item>>,
1985 /// Output only. The `Inventory` API resource name. Format: `projects/{project_number}/locations/{location}/instances/{instance_id}/inventory`
1986 pub name: Option<String>,
1987 /// Base level operating system information for the VM.
1988 #[serde(rename = "osInfo")]
1989 pub os_info: Option<OsInfo>,
1990 /// Output only. Timestamp of the last reported inventory for the VM.
1991 #[serde(rename = "updateTime")]
1992 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1993}
1994
1995impl common::Part for Inventory {}
1996
1997/// A single piece of inventory on a VM.
1998///
1999/// This type is not used in any activity, and only used as *part* of another schema.
2000///
2001#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2002#[serde_with::serde_as]
2003#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2004pub struct Item {
2005 /// Software package available to be installed on the VM instance.
2006 #[serde(rename = "availablePackage")]
2007 pub available_package: Option<SoftwarePackage>,
2008 /// When this inventory item was first detected.
2009 #[serde(rename = "createTime")]
2010 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2011 /// Identifier for this item, unique across items for this VM.
2012 pub id: Option<String>,
2013 /// Software package present on the VM instance.
2014 #[serde(rename = "installedPackage")]
2015 pub installed_package: Option<SoftwarePackage>,
2016 /// The origin of this inventory item.
2017 #[serde(rename = "originType")]
2018 pub origin_type: Option<String>,
2019 /// The specific type of inventory, correlating to its specific details.
2020 #[serde(rename = "type")]
2021 pub type_: Option<String>,
2022 /// When this inventory item was last modified.
2023 #[serde(rename = "updateTime")]
2024 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2025}
2026
2027impl common::Part for Item {}
2028
2029/// ListAssets response.
2030///
2031/// # Activities
2032///
2033/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2034/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2035///
2036/// * [list assets](AssetListCall) (response)
2037#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2038#[serde_with::serde_as]
2039#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2040pub struct ListAssetsResponse {
2041 /// Assets.
2042 pub assets: Option<Vec<Asset>>,
2043 /// Token to retrieve the next page of results. It expires 72 hours after the page token for the first page is generated. Set to empty if there are no remaining results.
2044 #[serde(rename = "nextPageToken")]
2045 pub next_page_token: Option<String>,
2046 /// Time the snapshot was taken.
2047 #[serde(rename = "readTime")]
2048 pub read_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2049}
2050
2051impl common::ResponseResult for ListAssetsResponse {}
2052
2053/// There is no detailed description.
2054///
2055/// # Activities
2056///
2057/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2058/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2059///
2060/// * [list feeds](FeedListCall) (response)
2061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2062#[serde_with::serde_as]
2063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2064pub struct ListFeedsResponse {
2065 /// A list of feeds.
2066 pub feeds: Option<Vec<Feed>>,
2067}
2068
2069impl common::ResponseResult for ListFeedsResponse {}
2070
2071/// Response of listing saved queries.
2072///
2073/// # Activities
2074///
2075/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2076/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2077///
2078/// * [list saved queries](SavedQueryListCall) (response)
2079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2080#[serde_with::serde_as]
2081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2082pub struct ListSavedQueriesResponse {
2083 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
2084 #[serde(rename = "nextPageToken")]
2085 pub next_page_token: Option<String>,
2086 /// A list of savedQueries.
2087 #[serde(rename = "savedQueries")]
2088 pub saved_queries: Option<Vec<SavedQuery>>,
2089}
2090
2091impl common::ResponseResult for ListSavedQueriesResponse {}
2092
2093/// A message to group the analysis information.
2094///
2095/// This type is not used in any activity, and only used as *part* of another schema.
2096///
2097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2098#[serde_with::serde_as]
2099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2100pub struct MoveAnalysis {
2101 /// Analysis result of moving the target resource.
2102 pub analysis: Option<MoveAnalysisResult>,
2103 /// The user friendly display name of the analysis. E.g. IAM, organization policy etc.
2104 #[serde(rename = "displayName")]
2105 pub display_name: Option<String>,
2106 /// Description of error encountered when performing the analysis.
2107 pub error: Option<Status>,
2108}
2109
2110impl common::Part for MoveAnalysis {}
2111
2112/// An analysis result including blockers and warnings.
2113///
2114/// This type is not used in any activity, and only used as *part* of another schema.
2115///
2116#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2117#[serde_with::serde_as]
2118#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2119pub struct MoveAnalysisResult {
2120 /// Blocking information that would prevent the target resource from moving to the specified destination at runtime.
2121 pub blockers: Option<Vec<MoveImpact>>,
2122 /// Warning information indicating that moving the target resource to the specified destination might be unsafe. This can include important policy information and configuration changes, but will not block moves at runtime.
2123 pub warnings: Option<Vec<MoveImpact>>,
2124}
2125
2126impl common::Part for MoveAnalysisResult {}
2127
2128/// A message to group impacts of moving the target resource.
2129///
2130/// This type is not used in any activity, and only used as *part* of another schema.
2131///
2132#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2133#[serde_with::serde_as]
2134#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2135pub struct MoveImpact {
2136 /// User friendly impact detail in a free form message.
2137 pub detail: Option<String>,
2138}
2139
2140impl common::Part for MoveImpact {}
2141
2142/// This resource represents a long-running operation that is the result of a network API call.
2143///
2144/// # Activities
2145///
2146/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2147/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2148///
2149/// * [get operations](OperationGetCall) (response)
2150/// * [analyze iam policy longrunning](MethodAnalyzeIamPolicyLongrunningCall) (response)
2151/// * [export assets](MethodExportAssetCall) (response)
2152#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2153#[serde_with::serde_as]
2154#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2155pub struct Operation {
2156 /// 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.
2157 pub done: Option<bool>,
2158 /// The error result of the operation in case of failure or cancellation.
2159 pub error: Option<Status>,
2160 /// 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.
2161 pub metadata: Option<HashMap<String, serde_json::Value>>,
2162 /// 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}`.
2163 pub name: Option<String>,
2164 /// 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`.
2165 pub response: Option<HashMap<String, serde_json::Value>>,
2166}
2167
2168impl common::Resource for Operation {}
2169impl common::ResponseResult for Operation {}
2170
2171/// Contains query options.
2172///
2173/// This type is not used in any activity, and only used as *part* of another schema.
2174///
2175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2176#[serde_with::serde_as]
2177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2178pub struct Options {
2179 /// Optional. If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed. We highly recommend you use AssetService.AnalyzeIamPolicyLongrunning RPC instead. For example, if the request analyzes for which resources user A has permission P, and there's an IAM policy states user A has iam.serviceAccounts.getAccessToken permission to a service account SA, and there's another IAM policy states service account SA has permission P to a Google Cloud folder F, then user A potentially has access to the Google Cloud folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis. Another example, if the request analyzes for who has permission P to a Google Cloud folder F, and there's an IAM policy states user A has iam.serviceAccounts.actAs permission to a service account SA, and there's another IAM policy states service account SA has permission P to the Google Cloud folder F, then user A potentially has access to the Google Cloud folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis. Only the following permissions are considered in this analysis: * `iam.serviceAccounts.actAs` * `iam.serviceAccounts.signBlob` * `iam.serviceAccounts.signJwt` * `iam.serviceAccounts.getAccessToken` * `iam.serviceAccounts.getOpenIdToken` * `iam.serviceAccounts.implicitDelegation` Default is false.
2180 #[serde(rename = "analyzeServiceAccountImpersonation")]
2181 pub analyze_service_account_impersonation: Option<bool>,
2182 /// Optional. If true, the identities section of the result will expand any Google groups appearing in an IAM policy binding. If IamPolicyAnalysisQuery.identity_selector is specified, the identity in the result will be determined by the selector, and this flag is not allowed to set. If true, the default max expansion per group is 1000 for AssetService.AnalyzeIamPolicy][]. Default is false.
2183 #[serde(rename = "expandGroups")]
2184 pub expand_groups: Option<bool>,
2185 /// Optional. If true and IamPolicyAnalysisQuery.resource_selector is not specified, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy. For example, if the request analyzes for which resources user A has permission P, and the results include an IAM policy with P on a Google Cloud folder, the results will also include resources in that folder with permission P. If true and IamPolicyAnalysisQuery.resource_selector is specified, the resource section of the result will expand the specified resource to include resources lower in the resource hierarchy. Only project or lower resources are supported. Folder and organization resources cannot be used together with this option. For example, if the request analyzes for which users have permission P on a Google Cloud project with this option enabled, the results will include all users who have permission P on that project or any lower resource. If true, the default max expansion per resource is 1000 for AssetService.AnalyzeIamPolicy][] and 100000 for AssetService.AnalyzeIamPolicyLongrunning][]. Default is false.
2186 #[serde(rename = "expandResources")]
2187 pub expand_resources: Option<bool>,
2188 /// Optional. If true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions. If IamPolicyAnalysisQuery.access_selector is specified, the access section of the result will be determined by the selector, and this flag is not allowed to set. Default is false.
2189 #[serde(rename = "expandRoles")]
2190 pub expand_roles: Option<bool>,
2191 /// Optional. If true, the result will output the relevant membership relationships between groups and other groups, and between groups and principals. Default is false.
2192 #[serde(rename = "outputGroupEdges")]
2193 pub output_group_edges: Option<bool>,
2194 /// Optional. If true, the result will output the relevant parent/child relationships between resources. Default is false.
2195 #[serde(rename = "outputResourceEdges")]
2196 pub output_resource_edges: Option<bool>,
2197}
2198
2199impl common::Part for Options {}
2200
2201/// The organization policy result to the query.
2202///
2203/// This type is not used in any activity, and only used as *part* of another schema.
2204///
2205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2206#[serde_with::serde_as]
2207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2208pub struct OrgPolicyResult {
2209 /// The consolidated organization policy for the analyzed resource. The consolidated organization policy is computed by merging and evaluating policy_bundle. The evaluation will respect the organization policy [hierarchy rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
2210 #[serde(rename = "consolidatedPolicy")]
2211 pub consolidated_policy: Option<AnalyzerOrgPolicy>,
2212 /// The folder(s) that this consolidated policy belongs to, in the format of folders/{FOLDER_NUMBER}. This field is available when the consolidated policy belongs (directly or cascadingly) to one or more folders.
2213 pub folders: Option<Vec<String>>,
2214 /// The organization that this consolidated policy belongs to, in the format of organizations/{ORGANIZATION_NUMBER}. This field is available when the consolidated policy belongs (directly or cascadingly) to an organization.
2215 pub organization: Option<String>,
2216 /// The ordered list of all organization policies from the consolidated_policy.attached_resource. to the scope specified in the request. If the constraint is defined with default policy, it will also appear in the list.
2217 #[serde(rename = "policyBundle")]
2218 pub policy_bundle: Option<Vec<AnalyzerOrgPolicy>>,
2219 /// The project that this consolidated policy belongs to, in the format of projects/{PROJECT_NUMBER}. This field is available when the consolidated policy belongs to a project.
2220 pub project: Option<String>,
2221}
2222
2223impl common::Part for OrgPolicyResult {}
2224
2225/// Operating system information for the VM.
2226///
2227/// This type is not used in any activity, and only used as *part* of another schema.
2228///
2229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2230#[serde_with::serde_as]
2231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2232pub struct OsInfo {
2233 /// The system architecture of the operating system.
2234 pub architecture: Option<String>,
2235 /// The VM hostname.
2236 pub hostname: Option<String>,
2237 /// The kernel release of the operating system.
2238 #[serde(rename = "kernelRelease")]
2239 pub kernel_release: Option<String>,
2240 /// The kernel version of the operating system.
2241 #[serde(rename = "kernelVersion")]
2242 pub kernel_version: Option<String>,
2243 /// The operating system long name. For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 Datacenter'.
2244 #[serde(rename = "longName")]
2245 pub long_name: Option<String>,
2246 /// The current version of the OS Config agent running on the VM.
2247 #[serde(rename = "osconfigAgentVersion")]
2248 pub osconfig_agent_version: Option<String>,
2249 /// The operating system short name. For example, 'windows' or 'debian'.
2250 #[serde(rename = "shortName")]
2251 pub short_name: Option<String>,
2252 /// The version of the operating system.
2253 pub version: Option<String>,
2254}
2255
2256impl common::Part for OsInfo {}
2257
2258/// Output configuration for export assets destination.
2259///
2260/// This type is not used in any activity, and only used as *part* of another schema.
2261///
2262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2263#[serde_with::serde_as]
2264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2265pub struct OutputConfig {
2266 /// Destination on BigQuery. The output table stores the fields in asset Protobuf as columns in BigQuery.
2267 #[serde(rename = "bigqueryDestination")]
2268 pub bigquery_destination: Option<BigQueryDestination>,
2269 /// Destination on Cloud Storage.
2270 #[serde(rename = "gcsDestination")]
2271 pub gcs_destination: Option<GcsDestination>,
2272}
2273
2274impl common::Part for OutputConfig {}
2275
2276/// Specifications of BigQuery partitioned table as export destination.
2277///
2278/// This type is not used in any activity, and only used as *part* of another schema.
2279///
2280#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2281#[serde_with::serde_as]
2282#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2283pub struct PartitionSpec {
2284 /// The partition key for BigQuery partitioned table.
2285 #[serde(rename = "partitionKey")]
2286 pub partition_key: Option<String>,
2287}
2288
2289impl common::Part for PartitionSpec {}
2290
2291/// IAM permissions
2292///
2293/// This type is not used in any activity, and only used as *part* of another schema.
2294///
2295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2296#[serde_with::serde_as]
2297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2298pub struct Permissions {
2299 /// A list of permissions. A sample permission string: `compute.disk.get`.
2300 pub permissions: Option<Vec<String>>,
2301}
2302
2303impl common::Part for Permissions {}
2304
2305/// 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/).
2306///
2307/// This type is not used in any activity, and only used as *part* of another schema.
2308///
2309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2310#[serde_with::serde_as]
2311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2312pub struct Policy {
2313 /// Specifies cloud audit logging configuration for this policy.
2314 #[serde(rename = "auditConfigs")]
2315 pub audit_configs: Option<Vec<AuditConfig>>,
2316 /// 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`.
2317 pub bindings: Option<Vec<Binding>>,
2318 /// `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.
2319 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2320 pub etag: Option<Vec<u8>>,
2321 /// 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).
2322 pub version: Option<i32>,
2323}
2324
2325impl common::Part for Policy {}
2326
2327/// The IAM policy and its attached resource.
2328///
2329/// This type is not used in any activity, and only used as *part* of another schema.
2330///
2331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2332#[serde_with::serde_as]
2333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2334pub struct PolicyInfo {
2335 /// The full resource name the policy is directly attached to.
2336 #[serde(rename = "attachedResource")]
2337 pub attached_resource: Option<String>,
2338 /// The IAM policy that's directly attached to the attached_resource.
2339 pub policy: Option<Policy>,
2340}
2341
2342impl common::Part for PolicyInfo {}
2343
2344/// A Pub/Sub destination.
2345///
2346/// This type is not used in any activity, and only used as *part* of another schema.
2347///
2348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2349#[serde_with::serde_as]
2350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2351pub struct PubsubDestination {
2352 /// The name of the Pub/Sub topic to publish to. Example: `projects/PROJECT_ID/topics/TOPIC_ID`.
2353 pub topic: Option<String>,
2354}
2355
2356impl common::Part for PubsubDestination {}
2357
2358/// Output configuration query assets.
2359///
2360/// This type is not used in any activity, and only used as *part* of another schema.
2361///
2362#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2363#[serde_with::serde_as]
2364#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2365pub struct QueryAssetsOutputConfig {
2366 /// BigQuery destination where the query results will be saved.
2367 #[serde(rename = "bigqueryDestination")]
2368 pub bigquery_destination: Option<GoogleCloudAssetV1QueryAssetsOutputConfigBigQueryDestination>,
2369}
2370
2371impl common::Part for QueryAssetsOutputConfig {}
2372
2373/// QueryAssets request.
2374///
2375/// # Activities
2376///
2377/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2378/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2379///
2380/// * [query assets](MethodQueryAssetCall) (request)
2381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2382#[serde_with::serde_as]
2383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2384pub struct QueryAssetsRequest {
2385 /// Optional. Reference to the query job, which is from the `QueryAssetsResponse` of previous `QueryAssets` call.
2386 #[serde(rename = "jobReference")]
2387 pub job_reference: Option<String>,
2388 /// Optional. Destination where the query results will be saved. When this field is specified, the query results won't be saved in the [QueryAssetsResponse.query_result]. Instead [QueryAssetsResponse.output_config] will be set. Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used to check the status of the query job when passed to a following [QueryAssets] API call.
2389 #[serde(rename = "outputConfig")]
2390 pub output_config: Option<QueryAssetsOutputConfig>,
2391 /// Optional. The maximum number of rows to return in the results. Responses are limited to 10 MB and 1000 rows. By default, the maximum row count is 1000. When the byte or row count limit is reached, the rest of the query results will be paginated. The field will be ignored when [output_config] is specified.
2392 #[serde(rename = "pageSize")]
2393 pub page_size: Option<i32>,
2394 /// Optional. A page token received from previous `QueryAssets`. The field will be ignored when [output_config] is specified.
2395 #[serde(rename = "pageToken")]
2396 pub page_token: Option<String>,
2397 /// Optional. Queries cloud assets as they appeared at the specified point in time.
2398 #[serde(rename = "readTime")]
2399 pub read_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2400 /// Optional. [start_time] is required. [start_time] must be less than [end_time] Defaults [end_time] to now if [start_time] is set and [end_time] isn't. Maximum permitted time range is 7 days.
2401 #[serde(rename = "readTimeWindow")]
2402 pub read_time_window: Option<TimeWindow>,
2403 /// Optional. A SQL statement that's compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql).
2404 pub statement: Option<String>,
2405 /// Optional. Specifies the maximum amount of time that the client is willing to wait for the query to complete. By default, this limit is 5 min for the first query, and 1 minute for the following queries. If the query is complete, the `done` field in the `QueryAssetsResponse` is true, otherwise false. Like BigQuery [jobs.query API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) The call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. The field will be ignored when [output_config] is specified.
2406 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2407 pub timeout: Option<chrono::Duration>,
2408}
2409
2410impl common::RequestValue for QueryAssetsRequest {}
2411
2412/// QueryAssets response.
2413///
2414/// # Activities
2415///
2416/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2417/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2418///
2419/// * [query assets](MethodQueryAssetCall) (response)
2420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2421#[serde_with::serde_as]
2422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2423pub struct QueryAssetsResponse {
2424 /// The query response, which can be either an `error` or a valid `response`. If `done` == `false` and the query result is being saved in an output, the output_config field will be set. If `done` == `true`, exactly one of `error`, `query_result` or `output_config` will be set. [done] is unset unless the [QueryAssetsResponse] contains a [QueryAssetsResponse.job_reference].
2425 pub done: Option<bool>,
2426 /// Error status.
2427 pub error: Option<Status>,
2428 /// Reference to a query job.
2429 #[serde(rename = "jobReference")]
2430 pub job_reference: Option<String>,
2431 /// Output configuration, which indicates that instead of being returned in an API response on the fly, the query result will be saved in a specific output.
2432 #[serde(rename = "outputConfig")]
2433 pub output_config: Option<QueryAssetsOutputConfig>,
2434 /// Result of the query.
2435 #[serde(rename = "queryResult")]
2436 pub query_result: Option<QueryResult>,
2437}
2438
2439impl common::ResponseResult for QueryAssetsResponse {}
2440
2441/// The query content.
2442///
2443/// This type is not used in any activity, and only used as *part* of another schema.
2444///
2445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2446#[serde_with::serde_as]
2447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2448pub struct QueryContent {
2449 /// An IAM Policy Analysis query, which could be used in the AssetService.AnalyzeIamPolicy RPC or the AssetService.AnalyzeIamPolicyLongrunning RPC.
2450 #[serde(rename = "iamPolicyAnalysisQuery")]
2451 pub iam_policy_analysis_query: Option<IamPolicyAnalysisQuery>,
2452}
2453
2454impl common::Part for QueryContent {}
2455
2456/// Execution results of the query. The result is formatted as rows represented by BigQuery compatible [schema]. When pagination is necessary, it will contains the page token to retrieve the results of following pages.
2457///
2458/// This type is not used in any activity, and only used as *part* of another schema.
2459///
2460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2461#[serde_with::serde_as]
2462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2463pub struct QueryResult {
2464 /// Token to retrieve the next page of the results.
2465 #[serde(rename = "nextPageToken")]
2466 pub next_page_token: Option<String>,
2467 /// Each row hold a query result in the format of `Struct`.
2468 pub rows: Option<Vec<HashMap<String, serde_json::Value>>>,
2469 /// Describes the format of the [rows].
2470 pub schema: Option<TableSchema>,
2471 /// Total rows of the whole query results.
2472 #[serde(rename = "totalRows")]
2473 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2474 pub total_rows: Option<i64>,
2475}
2476
2477impl common::Part for QueryResult {}
2478
2479/// An asset identifier in Google Cloud which contains its name, type and ancestors. 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.
2480///
2481/// This type is not used in any activity, and only used as *part* of another schema.
2482///
2483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2484#[serde_with::serde_as]
2485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2486pub struct RelatedAsset {
2487 /// The ancestors of an asset in Google Cloud [resource hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), represented as a list of relative resource names. An ancestry path starts with the closest ancestor in the hierarchy and ends at root. Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
2488 pub ancestors: Option<Vec<String>>,
2489 /// 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.
2490 pub asset: Option<String>,
2491 /// 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.
2492 #[serde(rename = "assetType")]
2493 pub asset_type: Option<String>,
2494 /// The unique identifier of the relationship type. Example: `INSTANCE_TO_INSTANCEGROUP`
2495 #[serde(rename = "relationshipType")]
2496 pub relationship_type: Option<String>,
2497}
2498
2499impl common::Part for RelatedAsset {}
2500
2501/// DEPRECATED. This message only presents for the purpose of backward-compatibility. The server will never populate this message in responses. The detailed related assets with the `relationship_type`.
2502///
2503/// This type is not used in any activity, and only used as *part* of another schema.
2504///
2505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2506#[serde_with::serde_as]
2507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2508pub struct RelatedAssets {
2509 /// The peer resources of the relationship.
2510 pub assets: Option<Vec<RelatedAsset>>,
2511 /// The detailed relationship attributes.
2512 #[serde(rename = "relationshipAttributes")]
2513 pub relationship_attributes: Option<RelationshipAttributes>,
2514}
2515
2516impl common::Part for RelatedAssets {}
2517
2518/// The detailed related resource.
2519///
2520/// This type is not used in any activity, and only used as *part* of another schema.
2521///
2522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2523#[serde_with::serde_as]
2524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2525pub struct RelatedResource {
2526 /// The type of the asset. Example: `compute.googleapis.com/Instance`
2527 #[serde(rename = "assetType")]
2528 pub asset_type: Option<String>,
2529 /// The full resource name of the related resource. Example: `//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123`
2530 #[serde(rename = "fullResourceName")]
2531 pub full_resource_name: Option<String>,
2532}
2533
2534impl common::Part for RelatedResource {}
2535
2536/// The related resources of the primary resource.
2537///
2538/// This type is not used in any activity, and only used as *part* of another schema.
2539///
2540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2541#[serde_with::serde_as]
2542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2543pub struct RelatedResources {
2544 /// The detailed related resources of the primary resource.
2545 #[serde(rename = "relatedResources")]
2546 pub related_resources: Option<Vec<RelatedResource>>,
2547}
2548
2549impl common::Part for RelatedResources {}
2550
2551/// DEPRECATED. This message only presents for the purpose of backward-compatibility. The server will never populate this message in responses. The relationship attributes which include `type`, `source_resource_type`, `target_resource_type` and `action`.
2552///
2553/// This type is not used in any activity, and only used as *part* of another schema.
2554///
2555#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2556#[serde_with::serde_as]
2557#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2558pub struct RelationshipAttributes {
2559 /// The detail of the relationship, e.g. `contains`, `attaches`
2560 pub action: Option<String>,
2561 /// The source asset type. Example: `compute.googleapis.com/Instance`
2562 #[serde(rename = "sourceResourceType")]
2563 pub source_resource_type: Option<String>,
2564 /// The target asset type. Example: `compute.googleapis.com/Disk`
2565 #[serde(rename = "targetResourceType")]
2566 pub target_resource_type: Option<String>,
2567 /// The unique identifier of the relationship type. Example: `INSTANCE_TO_INSTANCEGROUP`
2568 #[serde(rename = "type")]
2569 pub type_: Option<String>,
2570}
2571
2572impl common::Part for RelationshipAttributes {}
2573
2574/// A representation of a Google Cloud resource.
2575///
2576/// This type is not used in any activity, and only used as *part* of another schema.
2577///
2578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2579#[serde_with::serde_as]
2580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2581pub struct Resource {
2582 /// The content of the resource, in which some sensitive fields are removed and may not be present.
2583 pub data: Option<HashMap<String, serde_json::Value>>,
2584 /// 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.
2585 #[serde(rename = "discoveryDocumentUri")]
2586 pub discovery_document_uri: Option<String>,
2587 /// 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.
2588 #[serde(rename = "discoveryName")]
2589 pub discovery_name: Option<String>,
2590 /// The location of the resource in Google Cloud, such as its zone and region. For more information, see https://cloud.google.com/about/locations/.
2591 pub location: Option<String>,
2592 /// 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`
2593 pub parent: Option<String>,
2594 /// 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.
2595 #[serde(rename = "resourceUrl")]
2596 pub resource_url: Option<String>,
2597 /// The API version. Example: `v1`
2598 pub version: Option<String>,
2599}
2600
2601impl common::Part for Resource {}
2602
2603/// The resource owners information.
2604///
2605/// This type is not used in any activity, and only used as *part* of another schema.
2606///
2607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2608#[serde_with::serde_as]
2609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2610pub struct ResourceOwners {
2611 /// List of resource owners.
2612 #[serde(rename = "resourceOwners")]
2613 pub resource_owners: Option<Vec<String>>,
2614}
2615
2616impl common::Part for ResourceOwners {}
2617
2618/// A result of Resource Search, containing information of a cloud resource.
2619///
2620/// This type is not used in any activity, and only used as *part* of another schema.
2621///
2622#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2623#[serde_with::serde_as]
2624#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2625pub struct ResourceSearchResult {
2626 /// The additional searchable attributes of this resource. The attributes may vary from one resource type to another. Examples: `projectId` for Project, `dnsName` for DNS ManagedZone. This field contains a subset of the resource metadata fields that are returned by the List or Get APIs provided by the corresponding Google Cloud service (e.g., Compute Engine). see [API references and supported searchable attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types) to see which fields are included. You can search values of these fields through free text search. However, you should not consume the field programically as the field names and values may change as the Google Cloud service updates to a new incompatible API version. To search against the `additional_attributes`: * Use a free text query to match the attributes values. Example: to search `additional_attributes = { dnsName: "foobar" }`, you can issue a query `foobar`.
2627 #[serde(rename = "additionalAttributes")]
2628 pub additional_attributes: Option<HashMap<String, serde_json::Value>>,
2629 /// The type of this resource. Example: `compute.googleapis.com/Disk`. To search against the `asset_type`: * Specify the `asset_type` field in your search request.
2630 #[serde(rename = "assetType")]
2631 pub asset_type: Option<String>,
2632 /// Attached resources of this resource. For example, an OSConfig Inventory is an attached resource of a Compute Instance. This field is repeated because a resource could have multiple attached resources. This `attached_resources` field is not searchable. Some attributes of the attached resources are exposed in `additional_attributes` field, so as to allow users to search on them.
2633 #[serde(rename = "attachedResources")]
2634 pub attached_resources: Option<Vec<AttachedResource>>,
2635 /// The create timestamp of this resource, at which the resource was created. The granularity is in seconds. Timestamp.nanos will always be 0. This field is available only when the resource's Protobuf contains it. To search against `create_time`: * Use a field query. - value in seconds since unix epoch. Example: `createTime > 1609459200` - value in date string. Example: `createTime > 2021-01-01` - value in date-time string (must be quoted). Example: `createTime > "2021-01-01T00:00:00"`
2636 #[serde(rename = "createTime")]
2637 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2638 /// One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes. This field is available only when the resource's Protobuf contains it. To search against the `description`: * Use a field query. Example: `description:"important instance"` * Use a free text query. Example: `"important instance"`
2639 pub description: Option<String>,
2640 /// The display name of this resource. This field is available only when the resource's Protobuf contains it. To search against the `display_name`: * Use a field query. Example: `displayName:"My Instance"` * Use a free text query. Example: `"My Instance"`
2641 #[serde(rename = "displayName")]
2642 pub display_name: Option<String>,
2643 /// The effective tags on this resource. All of the tags that are both attached to and inherited by a resource are collectively called the effective tags. For more information, see [tag inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance). To search against the `effective_tags`: * Use a field query. Example: - `effectiveTagKeys:"123456789/env*"` - `effectiveTagKeys="123456789/env"` - `effectiveTagKeys:"env"` - `effectiveTagKeyIds="tagKeys/123"` - `effectiveTagValues:"env"` - `effectiveTagValues:"env/prod"` - `effectiveTagValues:"123456789/env/prod*"` - `effectiveTagValues="123456789/env/prod"` - `effectiveTagValueIds="tagValues/456"`
2644 #[serde(rename = "effectiveTags")]
2645 pub effective_tags: Option<Vec<EffectiveTagDetails>>,
2646 /// Enrichments of the asset. Currently supported enrichment types with SearchAllResources API: * RESOURCE_OWNERS The corresponding read masks in order to get the enrichment: * enrichments.resource_owners The corresponding required permissions: * cloudasset.assets.searchEnrichmentResourceOwners Example query to get resource owner enrichment: ``` scope: "projects/my-project" query: "name: my-project" assetTypes: "cloudresourcemanager.googleapis.com/Project" readMask: { paths: "asset_type" paths: "name" paths: "enrichments.resource_owners" } ```
2647 pub enrichments: Option<Vec<AssetEnrichment>>,
2648 /// The folder(s) that this resource belongs to, in the form of folders/{FOLDER_NUMBER}. This field is available when the resource belongs to one or more folders. To search against `folders`: * Use a field query. Example: `folders:(123 OR 456)` * Use a free text query. Example: `123` * Specify the `scope` field as this folder in your search request.
2649 pub folders: Option<Vec<String>>,
2650 /// The Cloud KMS [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) name or [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions) name. This field only presents for the purpose of backward compatibility. Use the `kms_keys` field to retrieve Cloud KMS key information. This field is available only when the resource's Protobuf contains it and will only be populated for [these resource types](https://cloud.google.com/asset-inventory/docs/legacy-field-names#resource_types_with_the_to_be_deprecated_kmskey_field) for backward compatible purposes. To search against the `kms_key`: * Use a field query. Example: `kmsKey:key` * Use a free text query. Example: `key`
2651 #[serde(rename = "kmsKey")]
2652 pub kms_key: Option<String>,
2653 /// The Cloud KMS [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) names or [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions) names. This field is available only when the resource's Protobuf contains it. To search against the `kms_keys`: * Use a field query. Example: `kmsKeys:key` * Use a free text query. Example: `key`
2654 #[serde(rename = "kmsKeys")]
2655 pub kms_keys: Option<Vec<String>>,
2656 /// User labels associated with this resource. See [Labelling and grouping Google Cloud resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) for more information. This field is available only when the resource's Protobuf contains it. To search against the `labels`: * Use a field query: - query on any label's key or value. Example: `labels:prod` - query by a given label. Example: `labels.env:prod` - query by a given label's existence. Example: `labels.env:*` * Use a free text query. Example: `prod`
2657 pub labels: Option<HashMap<String, String>>,
2658 /// Location can be `global`, regional like `us-east1`, or zonal like `us-west1-b`. This field is available only when the resource's Protobuf contains it. To search against the `location`: * Use a field query. Example: `location:us-west*` * Use a free text query. Example: `us-west*`
2659 pub location: Option<String>,
2660 /// The full resource name of this resource. Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. See [Cloud Asset Inventory Resource Name Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) for more information. To search against the `name`: * Use a field query. Example: `name:instance1` * Use a free text query. Example: `instance1`
2661 pub name: Option<String>,
2662 /// Network tags associated with this resource. Like labels, network tags are a type of annotations used to group Google Cloud resources. See [Labelling Google Cloud resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) for more information. This field is available only when the resource's Protobuf contains it. To search against the `network_tags`: * Use a field query. Example: `networkTags:internal` * Use a free text query. Example: `internal`
2663 #[serde(rename = "networkTags")]
2664 pub network_tags: Option<Vec<String>>,
2665 /// The organization that this resource belongs to, in the form of organizations/{ORGANIZATION_NUMBER}. This field is available when the resource belongs to an organization. To search against `organization`: * Use a field query. Example: `organization:123` * Use a free text query. Example: `123` * Specify the `scope` field as this organization in your search request.
2666 pub organization: Option<String>,
2667 /// The type of this resource's immediate parent, if there is one. To search against the `parent_asset_type`: * Use a field query. Example: `parentAssetType:"cloudresourcemanager.googleapis.com/Project"` * Use a free text query. Example: `cloudresourcemanager.googleapis.com/Project`
2668 #[serde(rename = "parentAssetType")]
2669 pub parent_asset_type: Option<String>,
2670 /// The full resource name of this resource's parent, if it has one. To search against the `parent_full_resource_name`: * Use a field query. Example: `parentFullResourceName:"project-name"` * Use a free text query. Example: `project-name`
2671 #[serde(rename = "parentFullResourceName")]
2672 pub parent_full_resource_name: Option<String>,
2673 /// The project that this resource belongs to, in the form of projects/{PROJECT_NUMBER}. This field is available when the resource belongs to a project. To search against `project`: * Use a field query. Example: `project:12345` * Use a free text query. Example: `12345` * Specify the `scope` field as this project in your search request.
2674 pub project: Option<String>,
2675 /// A map of related resources of this resource, keyed by the relationship type. A relationship type is in the format of {SourceType}_{ACTION}_{DestType}. Example: `DISK_TO_INSTANCE`, `DISK_TO_NETWORK`, `INSTANCE_TO_INSTANCEGROUP`. See [supported relationship types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types).
2676 pub relationships: Option<HashMap<String, RelatedResources>>,
2677 /// The actual content of Security Command Center security marks associated with the asset. To search against SCC SecurityMarks field: * Use a field query: - query by a given key value pair. Example: `sccSecurityMarks.foo=bar` - query by a given key's existence. Example: `sccSecurityMarks.foo:*`
2678 #[serde(rename = "sccSecurityMarks")]
2679 pub scc_security_marks: Option<HashMap<String, String>>,
2680 /// The state of this resource. Different resources types have different state definitions that are mapped from various fields of different resource types. This field is available only when the resource's Protobuf contains it. Example: If the resource is an instance provided by Compute Engine, its state will include PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See `status` definition in [API Reference](https://cloud.google.com/compute/docs/reference/rest/v1/instances). If the resource is a project provided by Resource Manager, its state will include LIFECYCLE_STATE_UNSPECIFIED, ACTIVE, DELETE_REQUESTED and DELETE_IN_PROGRESS. See `lifecycleState` definition in [API Reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects). To search against the `state`: * Use a field query. Example: `state:RUNNING` * Use a free text query. Example: `RUNNING`
2681 pub state: Option<String>,
2682 /// This field is only present for the purpose of backward compatibility. Use the `tags` field instead. TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}. To search against the `tagKeys`: * Use a field query. Example: - `tagKeys:"123456789/env*"` - `tagKeys="123456789/env"` - `tagKeys:"env"` * Use a free text query. Example: - `env`
2683 #[serde(rename = "tagKeys")]
2684 pub tag_keys: Option<Vec<String>>,
2685 /// This field is only present for the purpose of backward compatibility. Use the `tags` field instead. TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}. To search against the `tagValueIds`: * Use a field query. Example: - `tagValueIds="tagValues/456"` * Use a free text query. Example: - `456`
2686 #[serde(rename = "tagValueIds")]
2687 pub tag_value_ids: Option<Vec<String>>,
2688 /// This field is only present for the purpose of backward compatibility. Use the `tags` field instead. TagValue namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}. To search against the `tagValues`: * Use a field query. Example: - `tagValues:"env"` - `tagValues:"env/prod"` - `tagValues:"123456789/env/prod*"` - `tagValues="123456789/env/prod"` * Use a free text query. Example: - `prod`
2689 #[serde(rename = "tagValues")]
2690 pub tag_values: Option<Vec<String>>,
2691 /// The tags directly attached to this resource. To search against the `tags`: * Use a field query. Example: - `tagKeys:"123456789/env*"` - `tagKeys="123456789/env"` - `tagKeys:"env"` - `tagKeyIds="tagKeys/123"` - `tagValues:"env"` - `tagValues:"env/prod"` - `tagValues:"123456789/env/prod*"` - `tagValues="123456789/env/prod"` - `tagValueIds="tagValues/456"` * Use a free text query. Example: - `env/prod`
2692 pub tags: Option<Vec<Tag>>,
2693 /// The last update timestamp of this resource, at which the resource was last modified or deleted. The granularity is in seconds. Timestamp.nanos will always be 0. This field is available only when the resource's Protobuf contains it. To search against `update_time`: * Use a field query. - value in seconds since unix epoch. Example: `updateTime < 1609459200` - value in date string. Example: `updateTime < 2021-01-01` - value in date-time string (must be quoted). Example: `updateTime < "2021-01-01T00:00:00"`
2694 #[serde(rename = "updateTime")]
2695 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2696 /// Versioned resource representations of this resource. This is repeated because there could be multiple versions of resource representations during version migration. This `versioned_resources` field is not searchable. Some attributes of the resource representations are exposed in `additional_attributes` field, so as to allow users to search on them.
2697 #[serde(rename = "versionedResources")]
2698 pub versioned_resources: Option<Vec<VersionedResource>>,
2699}
2700
2701impl common::Part for ResourceSearchResult {}
2702
2703/// Specifies the resource to analyze for access policies, which may be set directly on the resource, or on ancestors such as organizations, folders or projects.
2704///
2705/// This type is not used in any activity, and only used as *part* of another schema.
2706///
2707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2708#[serde_with::serde_as]
2709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2710pub struct ResourceSelector {
2711 /// Required. The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of a resource of [supported resource types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types).
2712 #[serde(rename = "fullResourceName")]
2713 pub full_resource_name: Option<String>,
2714}
2715
2716impl common::Part for ResourceSelector {}
2717
2718/// A saved query which can be shared with others or used later.
2719///
2720/// # Activities
2721///
2722/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2723/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2724///
2725/// * [create saved queries](SavedQueryCreateCall) (request|response)
2726/// * [get saved queries](SavedQueryGetCall) (response)
2727/// * [patch saved queries](SavedQueryPatchCall) (request|response)
2728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2729#[serde_with::serde_as]
2730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2731pub struct SavedQuery {
2732 /// The query content.
2733 pub content: Option<QueryContent>,
2734 /// Output only. The create time of this saved query.
2735 #[serde(rename = "createTime")]
2736 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2737 /// Output only. The account's email address who has created this saved query.
2738 pub creator: Option<String>,
2739 /// The description of this saved query. This value should be fewer than 255 characters.
2740 pub description: Option<String>,
2741 /// Labels applied on the resource. This value should not contain more than 10 entries. The key and value of each entry must be non-empty and fewer than 64 characters.
2742 pub labels: Option<HashMap<String, String>>,
2743 /// Output only. The last update time of this saved query.
2744 #[serde(rename = "lastUpdateTime")]
2745 pub last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2746 /// Output only. The account's email address who has updated this saved query most recently.
2747 #[serde(rename = "lastUpdater")]
2748 pub last_updater: Option<String>,
2749 /// The resource name of the saved query. The format must be: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
2750 pub name: Option<String>,
2751}
2752
2753impl common::RequestValue for SavedQuery {}
2754impl common::ResponseResult for SavedQuery {}
2755
2756/// Search all IAM policies response.
2757///
2758/// # Activities
2759///
2760/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2761/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2762///
2763/// * [search all iam policies](MethodSearchAllIamPolicyCall) (response)
2764#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2765#[serde_with::serde_as]
2766#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2767pub struct SearchAllIamPoliciesResponse {
2768 /// Set if there are more results than those appearing in this response; to get the next set of results, call this method again, using this value as the `page_token`.
2769 #[serde(rename = "nextPageToken")]
2770 pub next_page_token: Option<String>,
2771 /// A list of IAM policies that match the search query. Related information such as the associated resource is returned along with the policy.
2772 pub results: Option<Vec<IamPolicySearchResult>>,
2773}
2774
2775impl common::ResponseResult for SearchAllIamPoliciesResponse {}
2776
2777/// Search all resources response.
2778///
2779/// # Activities
2780///
2781/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2782/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2783///
2784/// * [search all resources](MethodSearchAllResourceCall) (response)
2785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2786#[serde_with::serde_as]
2787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2788pub struct SearchAllResourcesResponse {
2789 /// If there are more results than those appearing in this response, then `next_page_token` is included. To get the next set of results, call this method again using the value of `next_page_token` as `page_token`.
2790 #[serde(rename = "nextPageToken")]
2791 pub next_page_token: Option<String>,
2792 /// A list of Resources that match the search query. It contains the resource standard metadata information.
2793 pub results: Option<Vec<ResourceSearchResult>>,
2794}
2795
2796impl common::ResponseResult for SearchAllResourcesResponse {}
2797
2798/// Software package information of the operating system.
2799///
2800/// This type is not used in any activity, and only used as *part* of another schema.
2801///
2802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2803#[serde_with::serde_as]
2804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2805pub struct SoftwarePackage {
2806 /// Details of an APT package. For details about the apt package manager, see https://wiki.debian.org/Apt.
2807 #[serde(rename = "aptPackage")]
2808 pub apt_package: Option<VersionedPackage>,
2809 /// Details of a COS package.
2810 #[serde(rename = "cosPackage")]
2811 pub cos_package: Option<VersionedPackage>,
2812 /// Details of a Googet package. For details about the googet package manager, see https://github.com/google/googet.
2813 #[serde(rename = "googetPackage")]
2814 pub googet_package: Option<VersionedPackage>,
2815 /// Details of a Windows Quick Fix engineering package. See https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering for info in Windows Quick Fix Engineering.
2816 #[serde(rename = "qfePackage")]
2817 pub qfe_package: Option<WindowsQuickFixEngineeringPackage>,
2818 /// Details of Windows Application.
2819 #[serde(rename = "windowsApplication")]
2820 pub windows_application: Option<WindowsApplication>,
2821 /// Details of a Windows Update package. See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for information about Windows Update.
2822 #[serde(rename = "wuaPackage")]
2823 pub wua_package: Option<WindowsUpdatePackage>,
2824 /// Yum package info. For details about the yum package manager, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum.
2825 #[serde(rename = "yumPackage")]
2826 pub yum_package: Option<VersionedPackage>,
2827 /// Details of a Zypper package. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual.
2828 #[serde(rename = "zypperPackage")]
2829 pub zypper_package: Option<VersionedPackage>,
2830 /// Details of a Zypper patch. For details about the Zypper package manager, see https://en.opensuse.org/SDB:Zypper_manual.
2831 #[serde(rename = "zypperPatch")]
2832 pub zypper_patch: Option<ZypperPatch>,
2833}
2834
2835impl common::Part for SoftwarePackage {}
2836
2837/// 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).
2838///
2839/// This type is not used in any activity, and only used as *part* of another schema.
2840///
2841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2842#[serde_with::serde_as]
2843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2844pub struct Status {
2845 /// The status code, which should be an enum value of google.rpc.Code.
2846 pub code: Option<i32>,
2847 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2848 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2849 /// 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.
2850 pub message: Option<String>,
2851}
2852
2853impl common::Part for Status {}
2854
2855/// A field in TableSchema.
2856///
2857/// This type is not used in any activity, and only used as *part* of another schema.
2858///
2859#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2860#[serde_with::serde_as]
2861#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2862pub struct TableFieldSchema {
2863 /// The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
2864 pub field: Option<String>,
2865 /// Describes the nested schema fields if the type property is set to RECORD.
2866 pub fields: Option<Vec<TableFieldSchema>>,
2867 /// The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
2868 pub mode: Option<String>,
2869 /// The field data type. Possible values include * STRING * BYTES * INTEGER * FLOAT * BOOLEAN * TIMESTAMP * DATE * TIME * DATETIME * GEOGRAPHY, * NUMERIC, * BIGNUMERIC, * RECORD (where RECORD indicates that the field contains a nested schema).
2870 #[serde(rename = "type")]
2871 pub type_: Option<String>,
2872}
2873
2874impl common::Part for TableFieldSchema {}
2875
2876/// BigQuery Compatible table schema.
2877///
2878/// This type is not used in any activity, and only used as *part* of another schema.
2879///
2880#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2881#[serde_with::serde_as]
2882#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2883pub struct TableSchema {
2884 /// Describes the fields in a table.
2885 pub fields: Option<Vec<TableFieldSchema>>,
2886}
2887
2888impl common::Part for TableSchema {}
2889
2890/// The key and value for a [tag](https://cloud.google.com/resource-manager/docs/tags/tags-overview).
2891///
2892/// This type is not used in any activity, and only used as *part* of another schema.
2893///
2894#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2895#[serde_with::serde_as]
2896#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2897pub struct Tag {
2898 /// TagKey namespaced name, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}.
2899 #[serde(rename = "tagKey")]
2900 pub tag_key: Option<String>,
2901 /// TagKey ID, in the format of tagKeys/{TAG_KEY_ID}.
2902 #[serde(rename = "tagKeyId")]
2903 pub tag_key_id: Option<String>,
2904 /// TagValue namespaced name, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}.
2905 #[serde(rename = "tagValue")]
2906 pub tag_value: Option<String>,
2907 /// TagValue ID, in the format of tagValues/{TAG_VALUE_ID}.
2908 #[serde(rename = "tagValueId")]
2909 pub tag_value_id: Option<String>,
2910}
2911
2912impl common::Part for Tag {}
2913
2914/// An asset in Google Cloud and its temporal metadata, including the time window when it was observed and its status during that window.
2915///
2916/// This type is not used in any activity, and only used as *part* of another schema.
2917///
2918#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2919#[serde_with::serde_as]
2920#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2921pub struct TemporalAsset {
2922 /// An asset in Google Cloud.
2923 pub asset: Option<Asset>,
2924 /// Whether the asset has been deleted or not.
2925 pub deleted: Option<bool>,
2926 /// Prior copy of the asset. Populated if prior_asset_state is PRESENT. Currently this is only set for responses in Real-Time Feed.
2927 #[serde(rename = "priorAsset")]
2928 pub prior_asset: Option<Asset>,
2929 /// State of prior_asset.
2930 #[serde(rename = "priorAssetState")]
2931 pub prior_asset_state: Option<String>,
2932 /// The time window when the asset data and state was observed.
2933 pub window: Option<TimeWindow>,
2934}
2935
2936impl common::Part for TemporalAsset {}
2937
2938/// A time window specified by its `start_time` and `end_time`.
2939///
2940/// This type is not used in any activity, and only used as *part* of another schema.
2941///
2942#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2943#[serde_with::serde_as]
2944#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2945pub struct TimeWindow {
2946 /// End time of the time window (inclusive). If not specified, the current timestamp is used instead.
2947 #[serde(rename = "endTime")]
2948 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2949 /// Start time of the time window (exclusive).
2950 #[serde(rename = "startTime")]
2951 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2952}
2953
2954impl common::Part for TimeWindow {}
2955
2956/// Update asset feed request.
2957///
2958/// # Activities
2959///
2960/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2961/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2962///
2963/// * [patch feeds](FeedPatchCall) (request)
2964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2965#[serde_with::serde_as]
2966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2967pub struct UpdateFeedRequest {
2968 /// Required. The new values of feed details. It must match an existing feed and the field `name` must be in the format of: projects/project_number/feeds/feed_id or folders/folder_number/feeds/feed_id or organizations/organization_number/feeds/feed_id.
2969 pub feed: Option<Feed>,
2970 /// Required. Only updates the `feed` fields indicated by this mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server.
2971 #[serde(rename = "updateMask")]
2972 pub update_mask: Option<common::FieldMask>,
2973}
2974
2975impl common::RequestValue for UpdateFeedRequest {}
2976
2977/// Information related to the a standard versioned package. This includes package info for APT, Yum, Zypper, and Googet package managers.
2978///
2979/// This type is not used in any activity, and only used as *part* of another schema.
2980///
2981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2982#[serde_with::serde_as]
2983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2984pub struct VersionedPackage {
2985 /// The system architecture this package is intended for.
2986 pub architecture: Option<String>,
2987 /// The name of the package.
2988 #[serde(rename = "packageName")]
2989 pub package_name: Option<String>,
2990 /// The version of the package.
2991 pub version: Option<String>,
2992}
2993
2994impl common::Part for VersionedPackage {}
2995
2996/// Resource representation as defined by the corresponding service providing the resource for a given API version.
2997///
2998/// This type is not used in any activity, and only used as *part* of another schema.
2999///
3000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3001#[serde_with::serde_as]
3002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3003pub struct VersionedResource {
3004 /// The exceptions of a resource.
3005 #[serde(rename = "assetExceptions")]
3006 pub asset_exceptions: Option<Vec<AssetException>>,
3007 /// JSON representation of the resource as defined by the corresponding service providing this resource. Example: If the resource is an instance provided by Compute Engine, this field will contain the JSON representation of the instance as defined by Compute Engine: `https://cloud.google.com/compute/docs/reference/rest/v1/instances`. You can find the resource definition for each supported resource type in this table: `https://cloud.google.com/asset-inventory/docs/supported-asset-types`
3008 pub resource: Option<HashMap<String, serde_json::Value>>,
3009 /// API version of the resource. Example: If the resource is an instance provided by Compute Engine v1 API as defined in `https://cloud.google.com/compute/docs/reference/rest/v1/instances`, version will be "v1".
3010 pub version: Option<String>,
3011}
3012
3013impl common::Part for VersionedResource {}
3014
3015/// Contains information about a Windows application that is retrieved from the Windows Registry. For more information about these fields, see: https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key
3016///
3017/// This type is not used in any activity, and only used as *part* of another schema.
3018///
3019#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3020#[serde_with::serde_as]
3021#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3022pub struct WindowsApplication {
3023 /// The name of the application or product.
3024 #[serde(rename = "displayName")]
3025 pub display_name: Option<String>,
3026 /// The version of the product or application in string format.
3027 #[serde(rename = "displayVersion")]
3028 pub display_version: Option<String>,
3029 /// The internet address for technical support.
3030 #[serde(rename = "helpLink")]
3031 pub help_link: Option<String>,
3032 /// The last time this product received service. The value of this property is replaced each time a patch is applied or removed from the product or the command-line option is used to repair the product.
3033 #[serde(rename = "installDate")]
3034 pub install_date: Option<Date>,
3035 /// The name of the manufacturer for the product or application.
3036 pub publisher: Option<String>,
3037}
3038
3039impl common::Part for WindowsApplication {}
3040
3041/// Information related to a Quick Fix Engineering package. Fields are taken from Windows QuickFixEngineering Interface and match the source names: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering
3042///
3043/// This type is not used in any activity, and only used as *part* of another schema.
3044///
3045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3046#[serde_with::serde_as]
3047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3048pub struct WindowsQuickFixEngineeringPackage {
3049 /// A short textual description of the QFE update.
3050 pub caption: Option<String>,
3051 /// A textual description of the QFE update.
3052 pub description: Option<String>,
3053 /// Unique identifier associated with a particular QFE update.
3054 #[serde(rename = "hotFixId")]
3055 pub hot_fix_id: Option<String>,
3056 /// Date that the QFE update was installed. Mapped from installed_on field.
3057 #[serde(rename = "installTime")]
3058 pub install_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3059}
3060
3061impl common::Part for WindowsQuickFixEngineeringPackage {}
3062
3063/// Categories specified by the Windows Update.
3064///
3065/// This type is not used in any activity, and only used as *part* of another schema.
3066///
3067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3068#[serde_with::serde_as]
3069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3070pub struct WindowsUpdateCategory {
3071 /// The identifier of the windows update category.
3072 pub id: Option<String>,
3073 /// The name of the windows update category.
3074 pub name: Option<String>,
3075}
3076
3077impl common::Part for WindowsUpdateCategory {}
3078
3079/// Details related to a Windows Update package. Field data and names are taken from Windows Update API IUpdate Interface: https://docs.microsoft.com/en-us/windows/win32/api/_wua/ Descriptive fields like title, and description are localized based on the locale of the VM being updated.
3080///
3081/// This type is not used in any activity, and only used as *part* of another schema.
3082///
3083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3084#[serde_with::serde_as]
3085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3086pub struct WindowsUpdatePackage {
3087 /// The categories that are associated with this update package.
3088 pub categories: Option<Vec<WindowsUpdateCategory>>,
3089 /// The localized description of the update package.
3090 pub description: Option<String>,
3091 /// A collection of Microsoft Knowledge Base article IDs that are associated with the update package.
3092 #[serde(rename = "kbArticleIds")]
3093 pub kb_article_ids: Option<Vec<String>>,
3094 /// The last published date of the update, in (UTC) date and time.
3095 #[serde(rename = "lastDeploymentChangeTime")]
3096 pub last_deployment_change_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3097 /// A collection of URLs that provide more information about the update package.
3098 #[serde(rename = "moreInfoUrls")]
3099 pub more_info_urls: Option<Vec<String>>,
3100 /// The revision number of this update package.
3101 #[serde(rename = "revisionNumber")]
3102 pub revision_number: Option<i32>,
3103 /// A hyperlink to the language-specific support information for the update.
3104 #[serde(rename = "supportUrl")]
3105 pub support_url: Option<String>,
3106 /// The localized title of the update package.
3107 pub title: Option<String>,
3108 /// Gets the identifier of an update package. Stays the same across revisions.
3109 #[serde(rename = "updateId")]
3110 pub update_id: Option<String>,
3111}
3112
3113impl common::Part for WindowsUpdatePackage {}
3114
3115/// Details related to a Zypper Patch.
3116///
3117/// This type is not used in any activity, and only used as *part* of another schema.
3118///
3119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3120#[serde_with::serde_as]
3121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3122pub struct ZypperPatch {
3123 /// The category of the patch.
3124 pub category: Option<String>,
3125 /// The name of the patch.
3126 #[serde(rename = "patchName")]
3127 pub patch_name: Option<String>,
3128 /// The severity specified for this patch
3129 pub severity: Option<String>,
3130 /// Any summary information provided about this patch.
3131 pub summary: Option<String>,
3132}
3133
3134impl common::Part for ZypperPatch {}
3135
3136// ###################
3137// MethodBuilders ###
3138// #################
3139
3140/// A builder providing access to all methods supported on *asset* resources.
3141/// It is not used directly, but through the [`CloudAsset`] hub.
3142///
3143/// # Example
3144///
3145/// Instantiate a resource builder
3146///
3147/// ```test_harness,no_run
3148/// extern crate hyper;
3149/// extern crate hyper_rustls;
3150/// extern crate google_cloudasset1 as cloudasset1;
3151///
3152/// # async fn dox() {
3153/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3154///
3155/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3156/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3157/// .with_native_roots()
3158/// .unwrap()
3159/// .https_only()
3160/// .enable_http2()
3161/// .build();
3162///
3163/// let executor = hyper_util::rt::TokioExecutor::new();
3164/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3165/// secret,
3166/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3167/// yup_oauth2::client::CustomHyperClientBuilder::from(
3168/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3169/// ),
3170/// ).build().await.unwrap();
3171///
3172/// let client = hyper_util::client::legacy::Client::builder(
3173/// hyper_util::rt::TokioExecutor::new()
3174/// )
3175/// .build(
3176/// hyper_rustls::HttpsConnectorBuilder::new()
3177/// .with_native_roots()
3178/// .unwrap()
3179/// .https_or_http()
3180/// .enable_http2()
3181/// .build()
3182/// );
3183/// let mut hub = CloudAsset::new(client, auth);
3184/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3185/// // like `list(...)`
3186/// // to build up your call.
3187/// let rb = hub.assets();
3188/// # }
3189/// ```
3190pub struct AssetMethods<'a, C>
3191where
3192 C: 'a,
3193{
3194 hub: &'a CloudAsset<C>,
3195}
3196
3197impl<'a, C> common::MethodsBuilder for AssetMethods<'a, C> {}
3198
3199impl<'a, C> AssetMethods<'a, C> {
3200 /// Create a builder to help you perform the following task:
3201 ///
3202 /// Lists assets with time and resource types and returns paged results in response.
3203 ///
3204 /// # Arguments
3205 ///
3206 /// * `parent` - Required. Name of the organization, folder, or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]" (such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
3207 pub fn list(&self, parent: &str) -> AssetListCall<'a, C> {
3208 AssetListCall {
3209 hub: self.hub,
3210 _parent: parent.to_string(),
3211 _relationship_types: Default::default(),
3212 _read_time: Default::default(),
3213 _page_token: Default::default(),
3214 _page_size: Default::default(),
3215 _content_type: Default::default(),
3216 _asset_types: Default::default(),
3217 _delegate: Default::default(),
3218 _additional_params: Default::default(),
3219 _scopes: Default::default(),
3220 }
3221 }
3222}
3223
3224/// A builder providing access to all methods supported on *effectiveIamPolicy* resources.
3225/// It is not used directly, but through the [`CloudAsset`] hub.
3226///
3227/// # Example
3228///
3229/// Instantiate a resource builder
3230///
3231/// ```test_harness,no_run
3232/// extern crate hyper;
3233/// extern crate hyper_rustls;
3234/// extern crate google_cloudasset1 as cloudasset1;
3235///
3236/// # async fn dox() {
3237/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3238///
3239/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3240/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3241/// .with_native_roots()
3242/// .unwrap()
3243/// .https_only()
3244/// .enable_http2()
3245/// .build();
3246///
3247/// let executor = hyper_util::rt::TokioExecutor::new();
3248/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3249/// secret,
3250/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3251/// yup_oauth2::client::CustomHyperClientBuilder::from(
3252/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3253/// ),
3254/// ).build().await.unwrap();
3255///
3256/// let client = hyper_util::client::legacy::Client::builder(
3257/// hyper_util::rt::TokioExecutor::new()
3258/// )
3259/// .build(
3260/// hyper_rustls::HttpsConnectorBuilder::new()
3261/// .with_native_roots()
3262/// .unwrap()
3263/// .https_or_http()
3264/// .enable_http2()
3265/// .build()
3266/// );
3267/// let mut hub = CloudAsset::new(client, auth);
3268/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3269/// // like `batch_get(...)`
3270/// // to build up your call.
3271/// let rb = hub.effective_iam_policies();
3272/// # }
3273/// ```
3274pub struct EffectiveIamPolicyMethods<'a, C>
3275where
3276 C: 'a,
3277{
3278 hub: &'a CloudAsset<C>,
3279}
3280
3281impl<'a, C> common::MethodsBuilder for EffectiveIamPolicyMethods<'a, C> {}
3282
3283impl<'a, C> EffectiveIamPolicyMethods<'a, C> {
3284 /// Create a builder to help you perform the following task:
3285 ///
3286 /// Gets effective IAM policies for a batch of resources.
3287 ///
3288 /// # Arguments
3289 ///
3290 /// * `scope` - Required. Only IAM policies on or below the scope will be returned. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
3291 pub fn batch_get(&self, scope: &str) -> EffectiveIamPolicyBatchGetCall<'a, C> {
3292 EffectiveIamPolicyBatchGetCall {
3293 hub: self.hub,
3294 _scope: scope.to_string(),
3295 _names: Default::default(),
3296 _delegate: Default::default(),
3297 _additional_params: Default::default(),
3298 _scopes: Default::default(),
3299 }
3300 }
3301}
3302
3303/// A builder providing access to all methods supported on *feed* resources.
3304/// It is not used directly, but through the [`CloudAsset`] hub.
3305///
3306/// # Example
3307///
3308/// Instantiate a resource builder
3309///
3310/// ```test_harness,no_run
3311/// extern crate hyper;
3312/// extern crate hyper_rustls;
3313/// extern crate google_cloudasset1 as cloudasset1;
3314///
3315/// # async fn dox() {
3316/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3317///
3318/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3319/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3320/// .with_native_roots()
3321/// .unwrap()
3322/// .https_only()
3323/// .enable_http2()
3324/// .build();
3325///
3326/// let executor = hyper_util::rt::TokioExecutor::new();
3327/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3328/// secret,
3329/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3330/// yup_oauth2::client::CustomHyperClientBuilder::from(
3331/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3332/// ),
3333/// ).build().await.unwrap();
3334///
3335/// let client = hyper_util::client::legacy::Client::builder(
3336/// hyper_util::rt::TokioExecutor::new()
3337/// )
3338/// .build(
3339/// hyper_rustls::HttpsConnectorBuilder::new()
3340/// .with_native_roots()
3341/// .unwrap()
3342/// .https_or_http()
3343/// .enable_http2()
3344/// .build()
3345/// );
3346/// let mut hub = CloudAsset::new(client, auth);
3347/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3348/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
3349/// // to build up your call.
3350/// let rb = hub.feeds();
3351/// # }
3352/// ```
3353pub struct FeedMethods<'a, C>
3354where
3355 C: 'a,
3356{
3357 hub: &'a CloudAsset<C>,
3358}
3359
3360impl<'a, C> common::MethodsBuilder for FeedMethods<'a, C> {}
3361
3362impl<'a, C> FeedMethods<'a, C> {
3363 /// Create a builder to help you perform the following task:
3364 ///
3365 /// Creates a feed in a parent project/folder/organization to listen to its asset updates.
3366 ///
3367 /// # Arguments
3368 ///
3369 /// * `request` - No description provided.
3370 /// * `parent` - Required. The name of the project/folder/organization where this feed should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
3371 pub fn create(&self, request: CreateFeedRequest, parent: &str) -> FeedCreateCall<'a, C> {
3372 FeedCreateCall {
3373 hub: self.hub,
3374 _request: request,
3375 _parent: parent.to_string(),
3376 _delegate: Default::default(),
3377 _additional_params: Default::default(),
3378 _scopes: Default::default(),
3379 }
3380 }
3381
3382 /// Create a builder to help you perform the following task:
3383 ///
3384 /// Deletes an asset feed.
3385 ///
3386 /// # Arguments
3387 ///
3388 /// * `name` - Required. The name of the feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
3389 pub fn delete(&self, name: &str) -> FeedDeleteCall<'a, C> {
3390 FeedDeleteCall {
3391 hub: self.hub,
3392 _name: name.to_string(),
3393 _delegate: Default::default(),
3394 _additional_params: Default::default(),
3395 _scopes: Default::default(),
3396 }
3397 }
3398
3399 /// Create a builder to help you perform the following task:
3400 ///
3401 /// Gets details about an asset feed.
3402 ///
3403 /// # Arguments
3404 ///
3405 /// * `name` - Required. The name of the Feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
3406 pub fn get(&self, name: &str) -> FeedGetCall<'a, C> {
3407 FeedGetCall {
3408 hub: self.hub,
3409 _name: name.to_string(),
3410 _delegate: Default::default(),
3411 _additional_params: Default::default(),
3412 _scopes: Default::default(),
3413 }
3414 }
3415
3416 /// Create a builder to help you perform the following task:
3417 ///
3418 /// Lists all asset feeds in a parent project/folder/organization.
3419 ///
3420 /// # Arguments
3421 ///
3422 /// * `parent` - Required. The parent project/folder/organization whose feeds are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
3423 pub fn list(&self, parent: &str) -> FeedListCall<'a, C> {
3424 FeedListCall {
3425 hub: self.hub,
3426 _parent: parent.to_string(),
3427 _delegate: Default::default(),
3428 _additional_params: Default::default(),
3429 _scopes: Default::default(),
3430 }
3431 }
3432
3433 /// Create a builder to help you perform the following task:
3434 ///
3435 /// Updates an asset feed configuration.
3436 ///
3437 /// # Arguments
3438 ///
3439 /// * `request` - No description provided.
3440 /// * `name` - Required. The format will be projects/{project_number}/feeds/{client-assigned_feed_identifier} or folders/{folder_number}/feeds/{client-assigned_feed_identifier} or organizations/{organization_number}/feeds/{client-assigned_feed_identifier} The client-assigned feed identifier must be unique within the parent project/folder/organization.
3441 pub fn patch(&self, request: UpdateFeedRequest, name: &str) -> FeedPatchCall<'a, C> {
3442 FeedPatchCall {
3443 hub: self.hub,
3444 _request: request,
3445 _name: name.to_string(),
3446 _delegate: Default::default(),
3447 _additional_params: Default::default(),
3448 _scopes: Default::default(),
3449 }
3450 }
3451}
3452
3453/// A builder providing access to all methods supported on *operation* resources.
3454/// It is not used directly, but through the [`CloudAsset`] hub.
3455///
3456/// # Example
3457///
3458/// Instantiate a resource builder
3459///
3460/// ```test_harness,no_run
3461/// extern crate hyper;
3462/// extern crate hyper_rustls;
3463/// extern crate google_cloudasset1 as cloudasset1;
3464///
3465/// # async fn dox() {
3466/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3467///
3468/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3469/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3470/// .with_native_roots()
3471/// .unwrap()
3472/// .https_only()
3473/// .enable_http2()
3474/// .build();
3475///
3476/// let executor = hyper_util::rt::TokioExecutor::new();
3477/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3478/// secret,
3479/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3480/// yup_oauth2::client::CustomHyperClientBuilder::from(
3481/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3482/// ),
3483/// ).build().await.unwrap();
3484///
3485/// let client = hyper_util::client::legacy::Client::builder(
3486/// hyper_util::rt::TokioExecutor::new()
3487/// )
3488/// .build(
3489/// hyper_rustls::HttpsConnectorBuilder::new()
3490/// .with_native_roots()
3491/// .unwrap()
3492/// .https_or_http()
3493/// .enable_http2()
3494/// .build()
3495/// );
3496/// let mut hub = CloudAsset::new(client, auth);
3497/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3498/// // like `get(...)`
3499/// // to build up your call.
3500/// let rb = hub.operations();
3501/// # }
3502/// ```
3503pub struct OperationMethods<'a, C>
3504where
3505 C: 'a,
3506{
3507 hub: &'a CloudAsset<C>,
3508}
3509
3510impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
3511
3512impl<'a, C> OperationMethods<'a, C> {
3513 /// Create a builder to help you perform the following task:
3514 ///
3515 /// 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.
3516 ///
3517 /// # Arguments
3518 ///
3519 /// * `name` - The name of the operation resource.
3520 pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
3521 OperationGetCall {
3522 hub: self.hub,
3523 _name: name.to_string(),
3524 _delegate: Default::default(),
3525 _additional_params: Default::default(),
3526 _scopes: Default::default(),
3527 }
3528 }
3529}
3530
3531/// A builder providing access to all methods supported on *savedQuery* resources.
3532/// It is not used directly, but through the [`CloudAsset`] hub.
3533///
3534/// # Example
3535///
3536/// Instantiate a resource builder
3537///
3538/// ```test_harness,no_run
3539/// extern crate hyper;
3540/// extern crate hyper_rustls;
3541/// extern crate google_cloudasset1 as cloudasset1;
3542///
3543/// # async fn dox() {
3544/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3545///
3546/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3547/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3548/// .with_native_roots()
3549/// .unwrap()
3550/// .https_only()
3551/// .enable_http2()
3552/// .build();
3553///
3554/// let executor = hyper_util::rt::TokioExecutor::new();
3555/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3556/// secret,
3557/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3558/// yup_oauth2::client::CustomHyperClientBuilder::from(
3559/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3560/// ),
3561/// ).build().await.unwrap();
3562///
3563/// let client = hyper_util::client::legacy::Client::builder(
3564/// hyper_util::rt::TokioExecutor::new()
3565/// )
3566/// .build(
3567/// hyper_rustls::HttpsConnectorBuilder::new()
3568/// .with_native_roots()
3569/// .unwrap()
3570/// .https_or_http()
3571/// .enable_http2()
3572/// .build()
3573/// );
3574/// let mut hub = CloudAsset::new(client, auth);
3575/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3576/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)`
3577/// // to build up your call.
3578/// let rb = hub.saved_queries();
3579/// # }
3580/// ```
3581pub struct SavedQueryMethods<'a, C>
3582where
3583 C: 'a,
3584{
3585 hub: &'a CloudAsset<C>,
3586}
3587
3588impl<'a, C> common::MethodsBuilder for SavedQueryMethods<'a, C> {}
3589
3590impl<'a, C> SavedQueryMethods<'a, C> {
3591 /// Create a builder to help you perform the following task:
3592 ///
3593 /// Creates a saved query in a parent project/folder/organization.
3594 ///
3595 /// # Arguments
3596 ///
3597 /// * `request` - No description provided.
3598 /// * `parent` - Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
3599 pub fn create(&self, request: SavedQuery, parent: &str) -> SavedQueryCreateCall<'a, C> {
3600 SavedQueryCreateCall {
3601 hub: self.hub,
3602 _request: request,
3603 _parent: parent.to_string(),
3604 _saved_query_id: Default::default(),
3605 _delegate: Default::default(),
3606 _additional_params: Default::default(),
3607 _scopes: Default::default(),
3608 }
3609 }
3610
3611 /// Create a builder to help you perform the following task:
3612 ///
3613 /// Deletes a saved query.
3614 ///
3615 /// # Arguments
3616 ///
3617 /// * `name` - Required. The name of the saved query to delete. It must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
3618 pub fn delete(&self, name: &str) -> SavedQueryDeleteCall<'a, C> {
3619 SavedQueryDeleteCall {
3620 hub: self.hub,
3621 _name: name.to_string(),
3622 _delegate: Default::default(),
3623 _additional_params: Default::default(),
3624 _scopes: Default::default(),
3625 }
3626 }
3627
3628 /// Create a builder to help you perform the following task:
3629 ///
3630 /// Gets details about a saved query.
3631 ///
3632 /// # Arguments
3633 ///
3634 /// * `name` - Required. The name of the saved query and it must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
3635 pub fn get(&self, name: &str) -> SavedQueryGetCall<'a, C> {
3636 SavedQueryGetCall {
3637 hub: self.hub,
3638 _name: name.to_string(),
3639 _delegate: Default::default(),
3640 _additional_params: Default::default(),
3641 _scopes: Default::default(),
3642 }
3643 }
3644
3645 /// Create a builder to help you perform the following task:
3646 ///
3647 /// Lists all saved queries in a parent project/folder/organization.
3648 ///
3649 /// # Arguments
3650 ///
3651 /// * `parent` - Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
3652 pub fn list(&self, parent: &str) -> SavedQueryListCall<'a, C> {
3653 SavedQueryListCall {
3654 hub: self.hub,
3655 _parent: parent.to_string(),
3656 _page_token: Default::default(),
3657 _page_size: Default::default(),
3658 _filter: Default::default(),
3659 _delegate: Default::default(),
3660 _additional_params: Default::default(),
3661 _scopes: Default::default(),
3662 }
3663 }
3664
3665 /// Create a builder to help you perform the following task:
3666 ///
3667 /// Updates a saved query.
3668 ///
3669 /// # Arguments
3670 ///
3671 /// * `request` - No description provided.
3672 /// * `name` - The resource name of the saved query. The format must be: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
3673 pub fn patch(&self, request: SavedQuery, name: &str) -> SavedQueryPatchCall<'a, C> {
3674 SavedQueryPatchCall {
3675 hub: self.hub,
3676 _request: request,
3677 _name: name.to_string(),
3678 _update_mask: Default::default(),
3679 _delegate: Default::default(),
3680 _additional_params: Default::default(),
3681 _scopes: Default::default(),
3682 }
3683 }
3684}
3685
3686/// A builder providing access to all free methods, which are not associated with a particular resource.
3687/// It is not used directly, but through the [`CloudAsset`] hub.
3688///
3689/// # Example
3690///
3691/// Instantiate a resource builder
3692///
3693/// ```test_harness,no_run
3694/// extern crate hyper;
3695/// extern crate hyper_rustls;
3696/// extern crate google_cloudasset1 as cloudasset1;
3697///
3698/// # async fn dox() {
3699/// use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3700///
3701/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3702/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3703/// .with_native_roots()
3704/// .unwrap()
3705/// .https_only()
3706/// .enable_http2()
3707/// .build();
3708///
3709/// let executor = hyper_util::rt::TokioExecutor::new();
3710/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3711/// secret,
3712/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3713/// yup_oauth2::client::CustomHyperClientBuilder::from(
3714/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3715/// ),
3716/// ).build().await.unwrap();
3717///
3718/// let client = hyper_util::client::legacy::Client::builder(
3719/// hyper_util::rt::TokioExecutor::new()
3720/// )
3721/// .build(
3722/// hyper_rustls::HttpsConnectorBuilder::new()
3723/// .with_native_roots()
3724/// .unwrap()
3725/// .https_or_http()
3726/// .enable_http2()
3727/// .build()
3728/// );
3729/// let mut hub = CloudAsset::new(client, auth);
3730/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3731/// // like `analyze_iam_policy(...)`, `analyze_iam_policy_longrunning(...)`, `analyze_move(...)`, `analyze_org_policies(...)`, `analyze_org_policy_governed_assets(...)`, `analyze_org_policy_governed_containers(...)`, `batch_get_assets_history(...)`, `export_assets(...)`, `query_assets(...)`, `search_all_iam_policies(...)` and `search_all_resources(...)`
3732/// // to build up your call.
3733/// let rb = hub.methods();
3734/// # }
3735/// ```
3736pub struct MethodMethods<'a, C>
3737where
3738 C: 'a,
3739{
3740 hub: &'a CloudAsset<C>,
3741}
3742
3743impl<'a, C> common::MethodsBuilder for MethodMethods<'a, C> {}
3744
3745impl<'a, C> MethodMethods<'a, C> {
3746 /// Create a builder to help you perform the following task:
3747 ///
3748 /// Analyzes IAM policies to answer which identities have what accesses on which resources.
3749 ///
3750 /// # Arguments
3751 ///
3752 /// * `scope` - Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
3753 pub fn analyze_iam_policy(&self, scope: &str) -> MethodAnalyzeIamPolicyCall<'a, C> {
3754 MethodAnalyzeIamPolicyCall {
3755 hub: self.hub,
3756 _scope: scope.to_string(),
3757 _saved_analysis_query: Default::default(),
3758 _execution_timeout: Default::default(),
3759 _analysis_query_resource_selector_full_resource_name: Default::default(),
3760 _analysis_query_options_output_resource_edges: Default::default(),
3761 _analysis_query_options_output_group_edges: Default::default(),
3762 _analysis_query_options_expand_roles: Default::default(),
3763 _analysis_query_options_expand_resources: Default::default(),
3764 _analysis_query_options_expand_groups: Default::default(),
3765 _analysis_query_options_analyze_service_account_impersonation: Default::default(),
3766 _analysis_query_identity_selector_identity: Default::default(),
3767 _analysis_query_condition_context_access_time: Default::default(),
3768 _analysis_query_access_selector_roles: Default::default(),
3769 _analysis_query_access_selector_permissions: Default::default(),
3770 _delegate: Default::default(),
3771 _additional_params: Default::default(),
3772 _scopes: Default::default(),
3773 }
3774 }
3775
3776 /// Create a builder to help you perform the following task:
3777 ///
3778 /// Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.
3779 ///
3780 /// # Arguments
3781 ///
3782 /// * `request` - No description provided.
3783 /// * `scope` - Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
3784 pub fn analyze_iam_policy_longrunning(
3785 &self,
3786 request: AnalyzeIamPolicyLongrunningRequest,
3787 scope: &str,
3788 ) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C> {
3789 MethodAnalyzeIamPolicyLongrunningCall {
3790 hub: self.hub,
3791 _request: request,
3792 _scope: scope.to_string(),
3793 _delegate: Default::default(),
3794 _additional_params: Default::default(),
3795 _scopes: Default::default(),
3796 }
3797 }
3798
3799 /// Create a builder to help you perform the following task:
3800 ///
3801 /// Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.
3802 ///
3803 /// # Arguments
3804 ///
3805 /// * `resource` - Required. Name of the resource to perform the analysis against. Only Google Cloud projects are supported as of today. Hence, this can only be a project ID (such as "projects/my-project-id") or a project number (such as "projects/12345").
3806 pub fn analyze_move(&self, resource: &str) -> MethodAnalyzeMoveCall<'a, C> {
3807 MethodAnalyzeMoveCall {
3808 hub: self.hub,
3809 _resource: resource.to_string(),
3810 _view: Default::default(),
3811 _destination_parent: Default::default(),
3812 _delegate: Default::default(),
3813 _additional_params: Default::default(),
3814 _scopes: Default::default(),
3815 }
3816 }
3817
3818 /// Create a builder to help you perform the following task:
3819 ///
3820 /// Analyzes organization policies under a scope.
3821 ///
3822 /// # Arguments
3823 ///
3824 /// * `scope` - Required. The organization to scope the request. Only organization policies within the scope will be analyzed. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
3825 pub fn analyze_org_policies(&self, scope: &str) -> MethodAnalyzeOrgPolicyCall<'a, C> {
3826 MethodAnalyzeOrgPolicyCall {
3827 hub: self.hub,
3828 _scope: scope.to_string(),
3829 _page_token: Default::default(),
3830 _page_size: Default::default(),
3831 _filter: Default::default(),
3832 _constraint: Default::default(),
3833 _delegate: Default::default(),
3834 _additional_params: Default::default(),
3835 _scopes: Default::default(),
3836 }
3837 }
3838
3839 /// Create a builder to help you perform the following task:
3840 ///
3841 /// Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints: * constraints/ainotebooks.accessMode * constraints/ainotebooks.disableFileDownloads * constraints/ainotebooks.disableRootAccess * constraints/ainotebooks.disableTerminal * constraints/ainotebooks.environmentOptions * constraints/ainotebooks.requireAutoUpgradeSchedule * constraints/ainotebooks.restrictVpcNetworks * constraints/compute.disableGuestAttributesAccess * constraints/compute.disableInstanceDataAccessApis * constraints/compute.disableNestedVirtualization * constraints/compute.disableSerialPortAccess * constraints/compute.disableSerialPortLogging * constraints/compute.disableVpcExternalIpv6 * constraints/compute.requireOsLogin * constraints/compute.requireShieldedVm * constraints/compute.restrictLoadBalancerCreationForTypes * constraints/compute.restrictProtocolForwardingCreationForTypes * constraints/compute.restrictXpnProjectLienRemoval * constraints/compute.setNewProjectDefaultToZonalDNSOnly * constraints/compute.skipDefaultNetworkCreation * constraints/compute.trustedImageProjects * constraints/compute.vmCanIpForward * constraints/compute.vmExternalIpAccess * constraints/gcp.detailedAuditLoggingMode * constraints/gcp.resourceLocations * constraints/iam.allowedPolicyMemberDomains * constraints/iam.automaticIamGrantsForDefaultServiceAccounts * constraints/iam.disableServiceAccountCreation * constraints/iam.disableServiceAccountKeyCreation * constraints/iam.disableServiceAccountKeyUpload * constraints/iam.restrictCrossProjectServiceAccountLienRemoval * constraints/iam.serviceAccountKeyExpiryHours * constraints/resourcemanager.accessBoundaries * constraints/resourcemanager.allowedExportDestinations * constraints/sql.restrictAuthorizedNetworks * constraints/sql.restrictNoncompliantDiagnosticDataAccess * constraints/sql.restrictNoncompliantResourceCreation * constraints/sql.restrictPublicIp * constraints/storage.publicAccessPrevention * constraints/storage.restrictAuthTypes * constraints/storage.uniformBucketLevelAccess This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.
3842 ///
3843 /// # Arguments
3844 ///
3845 /// * `scope` - Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output assets will also be limited to the ones governed by those in-scope organization policies. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
3846 pub fn analyze_org_policy_governed_assets(
3847 &self,
3848 scope: &str,
3849 ) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
3850 MethodAnalyzeOrgPolicyGovernedAssetCall {
3851 hub: self.hub,
3852 _scope: scope.to_string(),
3853 _page_token: Default::default(),
3854 _page_size: Default::default(),
3855 _filter: Default::default(),
3856 _constraint: Default::default(),
3857 _delegate: Default::default(),
3858 _additional_params: Default::default(),
3859 _scopes: Default::default(),
3860 }
3861 }
3862
3863 /// Create a builder to help you perform the following task:
3864 ///
3865 /// Analyzes organization policies governed containers (projects, folders or organization) under a scope.
3866 ///
3867 /// # Arguments
3868 ///
3869 /// * `scope` - Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output containers will also be limited to the ones governed by those in-scope organization policies. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
3870 pub fn analyze_org_policy_governed_containers(
3871 &self,
3872 scope: &str,
3873 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
3874 MethodAnalyzeOrgPolicyGovernedContainerCall {
3875 hub: self.hub,
3876 _scope: scope.to_string(),
3877 _page_token: Default::default(),
3878 _page_size: Default::default(),
3879 _filter: Default::default(),
3880 _constraint: Default::default(),
3881 _delegate: Default::default(),
3882 _additional_params: Default::default(),
3883 _scopes: Default::default(),
3884 }
3885 }
3886
3887 /// Create a builder to help you perform the following task:
3888 ///
3889 /// 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.
3890 ///
3891 /// # Arguments
3892 ///
3893 /// * `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").
3894 pub fn batch_get_assets_history(&self, parent: &str) -> MethodBatchGetAssetsHistoryCall<'a, C> {
3895 MethodBatchGetAssetsHistoryCall {
3896 hub: self.hub,
3897 _parent: parent.to_string(),
3898 _relationship_types: Default::default(),
3899 _read_time_window_start_time: Default::default(),
3900 _read_time_window_end_time: Default::default(),
3901 _content_type: Default::default(),
3902 _asset_names: Default::default(),
3903 _delegate: Default::default(),
3904 _additional_params: Default::default(),
3905 _scopes: Default::default(),
3906 }
3907 }
3908
3909 /// Create a builder to help you perform the following task:
3910 ///
3911 /// Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a google.cloud.asset.v1.Asset in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the google.longrunning.Operation API, which allows 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.
3912 ///
3913 /// # Arguments
3914 ///
3915 /// * `request` - No description provided.
3916 /// * `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"), or a project number (such as "projects/12345"), or a folder number (such as "folders/123").
3917 pub fn export_assets(
3918 &self,
3919 request: ExportAssetsRequest,
3920 parent: &str,
3921 ) -> MethodExportAssetCall<'a, C> {
3922 MethodExportAssetCall {
3923 hub: self.hub,
3924 _request: request,
3925 _parent: parent.to_string(),
3926 _delegate: Default::default(),
3927 _additional_params: Default::default(),
3928 _scopes: Default::default(),
3929 }
3930 }
3931
3932 /// Create a builder to help you perform the following task:
3933 ///
3934 /// Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.
3935 ///
3936 /// # Arguments
3937 ///
3938 /// * `request` - No description provided.
3939 /// * `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"), or a project number (such as "projects/12345"), or a folder number (such as "folders/123"). Only assets belonging to the `parent` will be returned.
3940 pub fn query_assets(
3941 &self,
3942 request: QueryAssetsRequest,
3943 parent: &str,
3944 ) -> MethodQueryAssetCall<'a, C> {
3945 MethodQueryAssetCall {
3946 hub: self.hub,
3947 _request: request,
3948 _parent: parent.to_string(),
3949 _delegate: Default::default(),
3950 _additional_params: Default::default(),
3951 _scopes: Default::default(),
3952 }
3953 }
3954
3955 /// Create a builder to help you perform the following task:
3956 ///
3957 /// Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.
3958 ///
3959 /// # Arguments
3960 ///
3961 /// * `scope` - Required. A scope can be a project, a folder, or an organization. The search is limited to the IAM policies within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope. The allowed values are: * projects/{PROJECT_ID} (e.g., "projects/foo-bar") * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
3962 pub fn search_all_iam_policies(&self, scope: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
3963 MethodSearchAllIamPolicyCall {
3964 hub: self.hub,
3965 _scope: scope.to_string(),
3966 _query: Default::default(),
3967 _page_token: Default::default(),
3968 _page_size: Default::default(),
3969 _order_by: Default::default(),
3970 _asset_types: Default::default(),
3971 _delegate: Default::default(),
3972 _additional_params: Default::default(),
3973 _scopes: Default::default(),
3974 }
3975 }
3976
3977 /// Create a builder to help you perform the following task:
3978 ///
3979 /// Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.
3980 ///
3981 /// # Arguments
3982 ///
3983 /// * `scope` - Required. A scope can be a project, a folder, or an organization. The search is limited to the resources within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope. The allowed values are: * projects/{PROJECT_ID} (e.g., "projects/foo-bar") * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
3984 pub fn search_all_resources(&self, scope: &str) -> MethodSearchAllResourceCall<'a, C> {
3985 MethodSearchAllResourceCall {
3986 hub: self.hub,
3987 _scope: scope.to_string(),
3988 _read_mask: Default::default(),
3989 _query: Default::default(),
3990 _page_token: Default::default(),
3991 _page_size: Default::default(),
3992 _order_by: Default::default(),
3993 _asset_types: Default::default(),
3994 _delegate: Default::default(),
3995 _additional_params: Default::default(),
3996 _scopes: Default::default(),
3997 }
3998 }
3999}
4000
4001// ###################
4002// CallBuilders ###
4003// #################
4004
4005/// Lists assets with time and resource types and returns paged results in response.
4006///
4007/// A builder for the *list* method supported by a *asset* resource.
4008/// It is not used directly, but through a [`AssetMethods`] instance.
4009///
4010/// # Example
4011///
4012/// Instantiate a resource method builder
4013///
4014/// ```test_harness,no_run
4015/// # extern crate hyper;
4016/// # extern crate hyper_rustls;
4017/// # extern crate google_cloudasset1 as cloudasset1;
4018/// # async fn dox() {
4019/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4020///
4021/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4022/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4023/// # .with_native_roots()
4024/// # .unwrap()
4025/// # .https_only()
4026/// # .enable_http2()
4027/// # .build();
4028///
4029/// # let executor = hyper_util::rt::TokioExecutor::new();
4030/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4031/// # secret,
4032/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4033/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4034/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4035/// # ),
4036/// # ).build().await.unwrap();
4037///
4038/// # let client = hyper_util::client::legacy::Client::builder(
4039/// # hyper_util::rt::TokioExecutor::new()
4040/// # )
4041/// # .build(
4042/// # hyper_rustls::HttpsConnectorBuilder::new()
4043/// # .with_native_roots()
4044/// # .unwrap()
4045/// # .https_or_http()
4046/// # .enable_http2()
4047/// # .build()
4048/// # );
4049/// # let mut hub = CloudAsset::new(client, auth);
4050/// // You can configure optional parameters by calling the respective setters at will, and
4051/// // execute the final call using `doit()`.
4052/// // Values shown here are possibly random and not representative !
4053/// let result = hub.assets().list("parent")
4054/// .add_relationship_types("voluptua.")
4055/// .read_time(chrono::Utc::now())
4056/// .page_token("At")
4057/// .page_size(-8)
4058/// .content_type("sed")
4059/// .add_asset_types("amet.")
4060/// .doit().await;
4061/// # }
4062/// ```
4063pub struct AssetListCall<'a, C>
4064where
4065 C: 'a,
4066{
4067 hub: &'a CloudAsset<C>,
4068 _parent: String,
4069 _relationship_types: Vec<String>,
4070 _read_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4071 _page_token: Option<String>,
4072 _page_size: Option<i32>,
4073 _content_type: Option<String>,
4074 _asset_types: Vec<String>,
4075 _delegate: Option<&'a mut dyn common::Delegate>,
4076 _additional_params: HashMap<String, String>,
4077 _scopes: BTreeSet<String>,
4078}
4079
4080impl<'a, C> common::CallBuilder for AssetListCall<'a, C> {}
4081
4082impl<'a, C> AssetListCall<'a, C>
4083where
4084 C: common::Connector,
4085{
4086 /// Perform the operation you have build so far.
4087 pub async fn doit(mut self) -> common::Result<(common::Response, ListAssetsResponse)> {
4088 use std::borrow::Cow;
4089 use std::io::{Read, Seek};
4090
4091 use common::{url::Params, ToParts};
4092 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4093
4094 let mut dd = common::DefaultDelegate;
4095 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4096 dlg.begin(common::MethodInfo {
4097 id: "cloudasset.assets.list",
4098 http_method: hyper::Method::GET,
4099 });
4100
4101 for &field in [
4102 "alt",
4103 "parent",
4104 "relationshipTypes",
4105 "readTime",
4106 "pageToken",
4107 "pageSize",
4108 "contentType",
4109 "assetTypes",
4110 ]
4111 .iter()
4112 {
4113 if self._additional_params.contains_key(field) {
4114 dlg.finished(false);
4115 return Err(common::Error::FieldClash(field));
4116 }
4117 }
4118
4119 let mut params = Params::with_capacity(9 + self._additional_params.len());
4120 params.push("parent", self._parent);
4121 if !self._relationship_types.is_empty() {
4122 for f in self._relationship_types.iter() {
4123 params.push("relationshipTypes", f);
4124 }
4125 }
4126 if let Some(value) = self._read_time.as_ref() {
4127 params.push("readTime", common::serde::datetime_to_string(&value));
4128 }
4129 if let Some(value) = self._page_token.as_ref() {
4130 params.push("pageToken", value);
4131 }
4132 if let Some(value) = self._page_size.as_ref() {
4133 params.push("pageSize", value.to_string());
4134 }
4135 if let Some(value) = self._content_type.as_ref() {
4136 params.push("contentType", value);
4137 }
4138 if !self._asset_types.is_empty() {
4139 for f in self._asset_types.iter() {
4140 params.push("assetTypes", f);
4141 }
4142 }
4143
4144 params.extend(self._additional_params.iter());
4145
4146 params.push("alt", "json");
4147 let mut url = self.hub._base_url.clone() + "v1/{+parent}/assets";
4148 if self._scopes.is_empty() {
4149 self._scopes
4150 .insert(Scope::CloudPlatform.as_ref().to_string());
4151 }
4152
4153 #[allow(clippy::single_element_loop)]
4154 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4155 url = params.uri_replacement(url, param_name, find_this, true);
4156 }
4157 {
4158 let to_remove = ["parent"];
4159 params.remove_params(&to_remove);
4160 }
4161
4162 let url = params.parse_with_url(&url);
4163
4164 loop {
4165 let token = match self
4166 .hub
4167 .auth
4168 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4169 .await
4170 {
4171 Ok(token) => token,
4172 Err(e) => match dlg.token(e) {
4173 Ok(token) => token,
4174 Err(e) => {
4175 dlg.finished(false);
4176 return Err(common::Error::MissingToken(e));
4177 }
4178 },
4179 };
4180 let mut req_result = {
4181 let client = &self.hub.client;
4182 dlg.pre_request();
4183 let mut req_builder = hyper::Request::builder()
4184 .method(hyper::Method::GET)
4185 .uri(url.as_str())
4186 .header(USER_AGENT, self.hub._user_agent.clone());
4187
4188 if let Some(token) = token.as_ref() {
4189 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4190 }
4191
4192 let request = req_builder
4193 .header(CONTENT_LENGTH, 0_u64)
4194 .body(common::to_body::<String>(None));
4195
4196 client.request(request.unwrap()).await
4197 };
4198
4199 match req_result {
4200 Err(err) => {
4201 if let common::Retry::After(d) = dlg.http_error(&err) {
4202 sleep(d).await;
4203 continue;
4204 }
4205 dlg.finished(false);
4206 return Err(common::Error::HttpError(err));
4207 }
4208 Ok(res) => {
4209 let (mut parts, body) = res.into_parts();
4210 let mut body = common::Body::new(body);
4211 if !parts.status.is_success() {
4212 let bytes = common::to_bytes(body).await.unwrap_or_default();
4213 let error = serde_json::from_str(&common::to_string(&bytes));
4214 let response = common::to_response(parts, bytes.into());
4215
4216 if let common::Retry::After(d) =
4217 dlg.http_failure(&response, error.as_ref().ok())
4218 {
4219 sleep(d).await;
4220 continue;
4221 }
4222
4223 dlg.finished(false);
4224
4225 return Err(match error {
4226 Ok(value) => common::Error::BadRequest(value),
4227 _ => common::Error::Failure(response),
4228 });
4229 }
4230 let response = {
4231 let bytes = common::to_bytes(body).await.unwrap_or_default();
4232 let encoded = common::to_string(&bytes);
4233 match serde_json::from_str(&encoded) {
4234 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4235 Err(error) => {
4236 dlg.response_json_decode_error(&encoded, &error);
4237 return Err(common::Error::JsonDecodeError(
4238 encoded.to_string(),
4239 error,
4240 ));
4241 }
4242 }
4243 };
4244
4245 dlg.finished(true);
4246 return Ok(response);
4247 }
4248 }
4249 }
4250 }
4251
4252 /// Required. Name of the organization, folder, or project the assets belong to. Format: "organizations/[organization-number]" (such as "organizations/123"), "projects/[project-id]" (such as "projects/my-project-id"), "projects/[project-number]" (such as "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
4253 ///
4254 /// Sets the *parent* path property to the given value.
4255 ///
4256 /// Even though the property as already been set when instantiating this call,
4257 /// we provide this method for API completeness.
4258 pub fn parent(mut self, new_value: &str) -> AssetListCall<'a, C> {
4259 self._parent = new_value.to_string();
4260 self
4261 }
4262 /// A list of relationship types to output, for example: `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if content_type=RELATIONSHIP. * If specified: it snapshots specified relationships. It returns an error if any of the [relationship_types] doesn't belong to the supported relationship types of the [asset_types] or if any of the [asset_types] doesn't belong to the source types of the [relationship_types]. * Otherwise: it snapshots the supported relationships for all [asset_types] or returns an error if any of the [asset_types] has no relationship support. An unspecified asset types field means all supported asset_types. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types and relationship types.
4263 ///
4264 /// Append the given value to the *relationship types* query property.
4265 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4266 pub fn add_relationship_types(mut self, new_value: &str) -> AssetListCall<'a, C> {
4267 self._relationship_types.push(new_value.to_string());
4268 self
4269 }
4270 /// Timestamp to take an asset snapshot. This can only be set to a timestamp between the current time and the current time minus 35 days (inclusive). 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.
4271 ///
4272 /// Sets the *read time* query property to the given value.
4273 pub fn read_time(
4274 mut self,
4275 new_value: chrono::DateTime<chrono::offset::Utc>,
4276 ) -> AssetListCall<'a, C> {
4277 self._read_time = Some(new_value);
4278 self
4279 }
4280 /// The `next_page_token` returned from the previous `ListAssetsResponse`, or unspecified for the first `ListAssetsRequest`. It is a continuation of a prior `ListAssets` call, and the API should return the next page of assets.
4281 ///
4282 /// Sets the *page token* query property to the given value.
4283 pub fn page_token(mut self, new_value: &str) -> AssetListCall<'a, C> {
4284 self._page_token = Some(new_value.to_string());
4285 self
4286 }
4287 /// The maximum number of assets to be returned in a single response. Default is 100, minimum is 1, and maximum is 1000.
4288 ///
4289 /// Sets the *page size* query property to the given value.
4290 pub fn page_size(mut self, new_value: i32) -> AssetListCall<'a, C> {
4291 self._page_size = Some(new_value);
4292 self
4293 }
4294 /// Asset content type. If not specified, no content but the asset name will be returned.
4295 ///
4296 /// Sets the *content type* query property to the given value.
4297 pub fn content_type(mut self, new_value: &str) -> AssetListCall<'a, C> {
4298 self._content_type = Some(new_value.to_string());
4299 self
4300 }
4301 /// A list of asset types to take a snapshot for. For example: "compute.googleapis.com/Disk". Regular expression is also supported. For example: * "compute.googleapis.com.*" snapshots resources whose asset type starts with "compute.googleapis.com". * ".*Instance" snapshots resources whose asset type ends with "Instance". * ".*Instance.*" snapshots resources whose asset type contains "Instance". See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned. If specified, only matching assets will be returned, otherwise, it will snapshot all asset types. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types.
4302 ///
4303 /// Append the given value to the *asset types* query property.
4304 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4305 pub fn add_asset_types(mut self, new_value: &str) -> AssetListCall<'a, C> {
4306 self._asset_types.push(new_value.to_string());
4307 self
4308 }
4309 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4310 /// while executing the actual API request.
4311 ///
4312 /// ````text
4313 /// It should be used to handle progress information, and to implement a certain level of resilience.
4314 /// ````
4315 ///
4316 /// Sets the *delegate* property to the given value.
4317 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> AssetListCall<'a, C> {
4318 self._delegate = Some(new_value);
4319 self
4320 }
4321
4322 /// Set any additional parameter of the query string used in the request.
4323 /// It should be used to set parameters which are not yet available through their own
4324 /// setters.
4325 ///
4326 /// Please note that this method must not be used to set any of the known parameters
4327 /// which have their own setter method. If done anyway, the request will fail.
4328 ///
4329 /// # Additional Parameters
4330 ///
4331 /// * *$.xgafv* (query-string) - V1 error format.
4332 /// * *access_token* (query-string) - OAuth access token.
4333 /// * *alt* (query-string) - Data format for response.
4334 /// * *callback* (query-string) - JSONP
4335 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4336 /// * *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.
4337 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4338 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4339 /// * *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.
4340 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4341 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4342 pub fn param<T>(mut self, name: T, value: T) -> AssetListCall<'a, C>
4343 where
4344 T: AsRef<str>,
4345 {
4346 self._additional_params
4347 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4348 self
4349 }
4350
4351 /// Identifies the authorization scope for the method you are building.
4352 ///
4353 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4354 /// [`Scope::CloudPlatform`].
4355 ///
4356 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4357 /// tokens for more than one scope.
4358 ///
4359 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4360 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4361 /// sufficient, a read-write scope will do as well.
4362 pub fn add_scope<St>(mut self, scope: St) -> AssetListCall<'a, C>
4363 where
4364 St: AsRef<str>,
4365 {
4366 self._scopes.insert(String::from(scope.as_ref()));
4367 self
4368 }
4369 /// Identifies the authorization scope(s) for the method you are building.
4370 ///
4371 /// See [`Self::add_scope()`] for details.
4372 pub fn add_scopes<I, St>(mut self, scopes: I) -> AssetListCall<'a, C>
4373 where
4374 I: IntoIterator<Item = St>,
4375 St: AsRef<str>,
4376 {
4377 self._scopes
4378 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4379 self
4380 }
4381
4382 /// Removes all scopes, and no default scope will be used either.
4383 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4384 /// for details).
4385 pub fn clear_scopes(mut self) -> AssetListCall<'a, C> {
4386 self._scopes.clear();
4387 self
4388 }
4389}
4390
4391/// Gets effective IAM policies for a batch of resources.
4392///
4393/// A builder for the *batchGet* method supported by a *effectiveIamPolicy* resource.
4394/// It is not used directly, but through a [`EffectiveIamPolicyMethods`] instance.
4395///
4396/// # Example
4397///
4398/// Instantiate a resource method builder
4399///
4400/// ```test_harness,no_run
4401/// # extern crate hyper;
4402/// # extern crate hyper_rustls;
4403/// # extern crate google_cloudasset1 as cloudasset1;
4404/// # async fn dox() {
4405/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4406///
4407/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4408/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4409/// # .with_native_roots()
4410/// # .unwrap()
4411/// # .https_only()
4412/// # .enable_http2()
4413/// # .build();
4414///
4415/// # let executor = hyper_util::rt::TokioExecutor::new();
4416/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4417/// # secret,
4418/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4419/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4420/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4421/// # ),
4422/// # ).build().await.unwrap();
4423///
4424/// # let client = hyper_util::client::legacy::Client::builder(
4425/// # hyper_util::rt::TokioExecutor::new()
4426/// # )
4427/// # .build(
4428/// # hyper_rustls::HttpsConnectorBuilder::new()
4429/// # .with_native_roots()
4430/// # .unwrap()
4431/// # .https_or_http()
4432/// # .enable_http2()
4433/// # .build()
4434/// # );
4435/// # let mut hub = CloudAsset::new(client, auth);
4436/// // You can configure optional parameters by calling the respective setters at will, and
4437/// // execute the final call using `doit()`.
4438/// // Values shown here are possibly random and not representative !
4439/// let result = hub.effective_iam_policies().batch_get("scope")
4440/// .add_names("amet.")
4441/// .doit().await;
4442/// # }
4443/// ```
4444pub struct EffectiveIamPolicyBatchGetCall<'a, C>
4445where
4446 C: 'a,
4447{
4448 hub: &'a CloudAsset<C>,
4449 _scope: String,
4450 _names: Vec<String>,
4451 _delegate: Option<&'a mut dyn common::Delegate>,
4452 _additional_params: HashMap<String, String>,
4453 _scopes: BTreeSet<String>,
4454}
4455
4456impl<'a, C> common::CallBuilder for EffectiveIamPolicyBatchGetCall<'a, C> {}
4457
4458impl<'a, C> EffectiveIamPolicyBatchGetCall<'a, C>
4459where
4460 C: common::Connector,
4461{
4462 /// Perform the operation you have build so far.
4463 pub async fn doit(
4464 mut self,
4465 ) -> common::Result<(common::Response, BatchGetEffectiveIamPoliciesResponse)> {
4466 use std::borrow::Cow;
4467 use std::io::{Read, Seek};
4468
4469 use common::{url::Params, ToParts};
4470 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4471
4472 let mut dd = common::DefaultDelegate;
4473 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4474 dlg.begin(common::MethodInfo {
4475 id: "cloudasset.effectiveIamPolicies.batchGet",
4476 http_method: hyper::Method::GET,
4477 });
4478
4479 for &field in ["alt", "scope", "names"].iter() {
4480 if self._additional_params.contains_key(field) {
4481 dlg.finished(false);
4482 return Err(common::Error::FieldClash(field));
4483 }
4484 }
4485
4486 let mut params = Params::with_capacity(4 + self._additional_params.len());
4487 params.push("scope", self._scope);
4488 if !self._names.is_empty() {
4489 for f in self._names.iter() {
4490 params.push("names", f);
4491 }
4492 }
4493
4494 params.extend(self._additional_params.iter());
4495
4496 params.push("alt", "json");
4497 let mut url = self.hub._base_url.clone() + "v1/{+scope}/effectiveIamPolicies:batchGet";
4498 if self._scopes.is_empty() {
4499 self._scopes
4500 .insert(Scope::CloudPlatform.as_ref().to_string());
4501 }
4502
4503 #[allow(clippy::single_element_loop)]
4504 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
4505 url = params.uri_replacement(url, param_name, find_this, true);
4506 }
4507 {
4508 let to_remove = ["scope"];
4509 params.remove_params(&to_remove);
4510 }
4511
4512 let url = params.parse_with_url(&url);
4513
4514 loop {
4515 let token = match self
4516 .hub
4517 .auth
4518 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4519 .await
4520 {
4521 Ok(token) => token,
4522 Err(e) => match dlg.token(e) {
4523 Ok(token) => token,
4524 Err(e) => {
4525 dlg.finished(false);
4526 return Err(common::Error::MissingToken(e));
4527 }
4528 },
4529 };
4530 let mut req_result = {
4531 let client = &self.hub.client;
4532 dlg.pre_request();
4533 let mut req_builder = hyper::Request::builder()
4534 .method(hyper::Method::GET)
4535 .uri(url.as_str())
4536 .header(USER_AGENT, self.hub._user_agent.clone());
4537
4538 if let Some(token) = token.as_ref() {
4539 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4540 }
4541
4542 let request = req_builder
4543 .header(CONTENT_LENGTH, 0_u64)
4544 .body(common::to_body::<String>(None));
4545
4546 client.request(request.unwrap()).await
4547 };
4548
4549 match req_result {
4550 Err(err) => {
4551 if let common::Retry::After(d) = dlg.http_error(&err) {
4552 sleep(d).await;
4553 continue;
4554 }
4555 dlg.finished(false);
4556 return Err(common::Error::HttpError(err));
4557 }
4558 Ok(res) => {
4559 let (mut parts, body) = res.into_parts();
4560 let mut body = common::Body::new(body);
4561 if !parts.status.is_success() {
4562 let bytes = common::to_bytes(body).await.unwrap_or_default();
4563 let error = serde_json::from_str(&common::to_string(&bytes));
4564 let response = common::to_response(parts, bytes.into());
4565
4566 if let common::Retry::After(d) =
4567 dlg.http_failure(&response, error.as_ref().ok())
4568 {
4569 sleep(d).await;
4570 continue;
4571 }
4572
4573 dlg.finished(false);
4574
4575 return Err(match error {
4576 Ok(value) => common::Error::BadRequest(value),
4577 _ => common::Error::Failure(response),
4578 });
4579 }
4580 let response = {
4581 let bytes = common::to_bytes(body).await.unwrap_or_default();
4582 let encoded = common::to_string(&bytes);
4583 match serde_json::from_str(&encoded) {
4584 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4585 Err(error) => {
4586 dlg.response_json_decode_error(&encoded, &error);
4587 return Err(common::Error::JsonDecodeError(
4588 encoded.to_string(),
4589 error,
4590 ));
4591 }
4592 }
4593 };
4594
4595 dlg.finished(true);
4596 return Ok(response);
4597 }
4598 }
4599 }
4600 }
4601
4602 /// Required. Only IAM policies on or below the scope will be returned. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
4603 ///
4604 /// Sets the *scope* path property to the given value.
4605 ///
4606 /// Even though the property as already been set when instantiating this call,
4607 /// we provide this method for API completeness.
4608 pub fn scope(mut self, new_value: &str) -> EffectiveIamPolicyBatchGetCall<'a, C> {
4609 self._scope = new_value.to_string();
4610 self
4611 }
4612 /// Required. The names refer to the [full_resource_names] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of the asset types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types). A maximum of 20 resources' effective policies can be retrieved in a batch.
4613 ///
4614 /// Append the given value to the *names* query property.
4615 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
4616 pub fn add_names(mut self, new_value: &str) -> EffectiveIamPolicyBatchGetCall<'a, C> {
4617 self._names.push(new_value.to_string());
4618 self
4619 }
4620 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4621 /// while executing the actual API request.
4622 ///
4623 /// ````text
4624 /// It should be used to handle progress information, and to implement a certain level of resilience.
4625 /// ````
4626 ///
4627 /// Sets the *delegate* property to the given value.
4628 pub fn delegate(
4629 mut self,
4630 new_value: &'a mut dyn common::Delegate,
4631 ) -> EffectiveIamPolicyBatchGetCall<'a, C> {
4632 self._delegate = Some(new_value);
4633 self
4634 }
4635
4636 /// Set any additional parameter of the query string used in the request.
4637 /// It should be used to set parameters which are not yet available through their own
4638 /// setters.
4639 ///
4640 /// Please note that this method must not be used to set any of the known parameters
4641 /// which have their own setter method. If done anyway, the request will fail.
4642 ///
4643 /// # Additional Parameters
4644 ///
4645 /// * *$.xgafv* (query-string) - V1 error format.
4646 /// * *access_token* (query-string) - OAuth access token.
4647 /// * *alt* (query-string) - Data format for response.
4648 /// * *callback* (query-string) - JSONP
4649 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4650 /// * *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.
4651 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4652 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4653 /// * *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.
4654 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4655 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4656 pub fn param<T>(mut self, name: T, value: T) -> EffectiveIamPolicyBatchGetCall<'a, C>
4657 where
4658 T: AsRef<str>,
4659 {
4660 self._additional_params
4661 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4662 self
4663 }
4664
4665 /// Identifies the authorization scope for the method you are building.
4666 ///
4667 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4668 /// [`Scope::CloudPlatform`].
4669 ///
4670 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4671 /// tokens for more than one scope.
4672 ///
4673 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4674 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4675 /// sufficient, a read-write scope will do as well.
4676 pub fn add_scope<St>(mut self, scope: St) -> EffectiveIamPolicyBatchGetCall<'a, C>
4677 where
4678 St: AsRef<str>,
4679 {
4680 self._scopes.insert(String::from(scope.as_ref()));
4681 self
4682 }
4683 /// Identifies the authorization scope(s) for the method you are building.
4684 ///
4685 /// See [`Self::add_scope()`] for details.
4686 pub fn add_scopes<I, St>(mut self, scopes: I) -> EffectiveIamPolicyBatchGetCall<'a, C>
4687 where
4688 I: IntoIterator<Item = St>,
4689 St: AsRef<str>,
4690 {
4691 self._scopes
4692 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4693 self
4694 }
4695
4696 /// Removes all scopes, and no default scope will be used either.
4697 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4698 /// for details).
4699 pub fn clear_scopes(mut self) -> EffectiveIamPolicyBatchGetCall<'a, C> {
4700 self._scopes.clear();
4701 self
4702 }
4703}
4704
4705/// Creates a feed in a parent project/folder/organization to listen to its asset updates.
4706///
4707/// A builder for the *create* method supported by a *feed* resource.
4708/// It is not used directly, but through a [`FeedMethods`] instance.
4709///
4710/// # Example
4711///
4712/// Instantiate a resource method builder
4713///
4714/// ```test_harness,no_run
4715/// # extern crate hyper;
4716/// # extern crate hyper_rustls;
4717/// # extern crate google_cloudasset1 as cloudasset1;
4718/// use cloudasset1::api::CreateFeedRequest;
4719/// # async fn dox() {
4720/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4721///
4722/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4723/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4724/// # .with_native_roots()
4725/// # .unwrap()
4726/// # .https_only()
4727/// # .enable_http2()
4728/// # .build();
4729///
4730/// # let executor = hyper_util::rt::TokioExecutor::new();
4731/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4732/// # secret,
4733/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4734/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4735/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4736/// # ),
4737/// # ).build().await.unwrap();
4738///
4739/// # let client = hyper_util::client::legacy::Client::builder(
4740/// # hyper_util::rt::TokioExecutor::new()
4741/// # )
4742/// # .build(
4743/// # hyper_rustls::HttpsConnectorBuilder::new()
4744/// # .with_native_roots()
4745/// # .unwrap()
4746/// # .https_or_http()
4747/// # .enable_http2()
4748/// # .build()
4749/// # );
4750/// # let mut hub = CloudAsset::new(client, auth);
4751/// // As the method needs a request, you would usually fill it with the desired information
4752/// // into the respective structure. Some of the parts shown here might not be applicable !
4753/// // Values shown here are possibly random and not representative !
4754/// let mut req = CreateFeedRequest::default();
4755///
4756/// // You can configure optional parameters by calling the respective setters at will, and
4757/// // execute the final call using `doit()`.
4758/// // Values shown here are possibly random and not representative !
4759/// let result = hub.feeds().create(req, "parent")
4760/// .doit().await;
4761/// # }
4762/// ```
4763pub struct FeedCreateCall<'a, C>
4764where
4765 C: 'a,
4766{
4767 hub: &'a CloudAsset<C>,
4768 _request: CreateFeedRequest,
4769 _parent: String,
4770 _delegate: Option<&'a mut dyn common::Delegate>,
4771 _additional_params: HashMap<String, String>,
4772 _scopes: BTreeSet<String>,
4773}
4774
4775impl<'a, C> common::CallBuilder for FeedCreateCall<'a, C> {}
4776
4777impl<'a, C> FeedCreateCall<'a, C>
4778where
4779 C: common::Connector,
4780{
4781 /// Perform the operation you have build so far.
4782 pub async fn doit(mut self) -> common::Result<(common::Response, Feed)> {
4783 use std::borrow::Cow;
4784 use std::io::{Read, Seek};
4785
4786 use common::{url::Params, ToParts};
4787 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4788
4789 let mut dd = common::DefaultDelegate;
4790 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4791 dlg.begin(common::MethodInfo {
4792 id: "cloudasset.feeds.create",
4793 http_method: hyper::Method::POST,
4794 });
4795
4796 for &field in ["alt", "parent"].iter() {
4797 if self._additional_params.contains_key(field) {
4798 dlg.finished(false);
4799 return Err(common::Error::FieldClash(field));
4800 }
4801 }
4802
4803 let mut params = Params::with_capacity(4 + self._additional_params.len());
4804 params.push("parent", self._parent);
4805
4806 params.extend(self._additional_params.iter());
4807
4808 params.push("alt", "json");
4809 let mut url = self.hub._base_url.clone() + "v1/{+parent}/feeds";
4810 if self._scopes.is_empty() {
4811 self._scopes
4812 .insert(Scope::CloudPlatform.as_ref().to_string());
4813 }
4814
4815 #[allow(clippy::single_element_loop)]
4816 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4817 url = params.uri_replacement(url, param_name, find_this, true);
4818 }
4819 {
4820 let to_remove = ["parent"];
4821 params.remove_params(&to_remove);
4822 }
4823
4824 let url = params.parse_with_url(&url);
4825
4826 let mut json_mime_type = mime::APPLICATION_JSON;
4827 let mut request_value_reader = {
4828 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4829 common::remove_json_null_values(&mut value);
4830 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4831 serde_json::to_writer(&mut dst, &value).unwrap();
4832 dst
4833 };
4834 let request_size = request_value_reader
4835 .seek(std::io::SeekFrom::End(0))
4836 .unwrap();
4837 request_value_reader
4838 .seek(std::io::SeekFrom::Start(0))
4839 .unwrap();
4840
4841 loop {
4842 let token = match self
4843 .hub
4844 .auth
4845 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4846 .await
4847 {
4848 Ok(token) => token,
4849 Err(e) => match dlg.token(e) {
4850 Ok(token) => token,
4851 Err(e) => {
4852 dlg.finished(false);
4853 return Err(common::Error::MissingToken(e));
4854 }
4855 },
4856 };
4857 request_value_reader
4858 .seek(std::io::SeekFrom::Start(0))
4859 .unwrap();
4860 let mut req_result = {
4861 let client = &self.hub.client;
4862 dlg.pre_request();
4863 let mut req_builder = hyper::Request::builder()
4864 .method(hyper::Method::POST)
4865 .uri(url.as_str())
4866 .header(USER_AGENT, self.hub._user_agent.clone());
4867
4868 if let Some(token) = token.as_ref() {
4869 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4870 }
4871
4872 let request = req_builder
4873 .header(CONTENT_TYPE, json_mime_type.to_string())
4874 .header(CONTENT_LENGTH, request_size as u64)
4875 .body(common::to_body(
4876 request_value_reader.get_ref().clone().into(),
4877 ));
4878
4879 client.request(request.unwrap()).await
4880 };
4881
4882 match req_result {
4883 Err(err) => {
4884 if let common::Retry::After(d) = dlg.http_error(&err) {
4885 sleep(d).await;
4886 continue;
4887 }
4888 dlg.finished(false);
4889 return Err(common::Error::HttpError(err));
4890 }
4891 Ok(res) => {
4892 let (mut parts, body) = res.into_parts();
4893 let mut body = common::Body::new(body);
4894 if !parts.status.is_success() {
4895 let bytes = common::to_bytes(body).await.unwrap_or_default();
4896 let error = serde_json::from_str(&common::to_string(&bytes));
4897 let response = common::to_response(parts, bytes.into());
4898
4899 if let common::Retry::After(d) =
4900 dlg.http_failure(&response, error.as_ref().ok())
4901 {
4902 sleep(d).await;
4903 continue;
4904 }
4905
4906 dlg.finished(false);
4907
4908 return Err(match error {
4909 Ok(value) => common::Error::BadRequest(value),
4910 _ => common::Error::Failure(response),
4911 });
4912 }
4913 let response = {
4914 let bytes = common::to_bytes(body).await.unwrap_or_default();
4915 let encoded = common::to_string(&bytes);
4916 match serde_json::from_str(&encoded) {
4917 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4918 Err(error) => {
4919 dlg.response_json_decode_error(&encoded, &error);
4920 return Err(common::Error::JsonDecodeError(
4921 encoded.to_string(),
4922 error,
4923 ));
4924 }
4925 }
4926 };
4927
4928 dlg.finished(true);
4929 return Ok(response);
4930 }
4931 }
4932 }
4933 }
4934
4935 ///
4936 /// Sets the *request* property to the given value.
4937 ///
4938 /// Even though the property as already been set when instantiating this call,
4939 /// we provide this method for API completeness.
4940 pub fn request(mut self, new_value: CreateFeedRequest) -> FeedCreateCall<'a, C> {
4941 self._request = new_value;
4942 self
4943 }
4944 /// Required. The name of the project/folder/organization where this feed should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
4945 ///
4946 /// Sets the *parent* path property to the given value.
4947 ///
4948 /// Even though the property as already been set when instantiating this call,
4949 /// we provide this method for API completeness.
4950 pub fn parent(mut self, new_value: &str) -> FeedCreateCall<'a, C> {
4951 self._parent = new_value.to_string();
4952 self
4953 }
4954 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4955 /// while executing the actual API request.
4956 ///
4957 /// ````text
4958 /// It should be used to handle progress information, and to implement a certain level of resilience.
4959 /// ````
4960 ///
4961 /// Sets the *delegate* property to the given value.
4962 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FeedCreateCall<'a, C> {
4963 self._delegate = Some(new_value);
4964 self
4965 }
4966
4967 /// Set any additional parameter of the query string used in the request.
4968 /// It should be used to set parameters which are not yet available through their own
4969 /// setters.
4970 ///
4971 /// Please note that this method must not be used to set any of the known parameters
4972 /// which have their own setter method. If done anyway, the request will fail.
4973 ///
4974 /// # Additional Parameters
4975 ///
4976 /// * *$.xgafv* (query-string) - V1 error format.
4977 /// * *access_token* (query-string) - OAuth access token.
4978 /// * *alt* (query-string) - Data format for response.
4979 /// * *callback* (query-string) - JSONP
4980 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4981 /// * *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.
4982 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4983 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4984 /// * *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.
4985 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4986 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4987 pub fn param<T>(mut self, name: T, value: T) -> FeedCreateCall<'a, C>
4988 where
4989 T: AsRef<str>,
4990 {
4991 self._additional_params
4992 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4993 self
4994 }
4995
4996 /// Identifies the authorization scope for the method you are building.
4997 ///
4998 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4999 /// [`Scope::CloudPlatform`].
5000 ///
5001 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5002 /// tokens for more than one scope.
5003 ///
5004 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5005 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5006 /// sufficient, a read-write scope will do as well.
5007 pub fn add_scope<St>(mut self, scope: St) -> FeedCreateCall<'a, C>
5008 where
5009 St: AsRef<str>,
5010 {
5011 self._scopes.insert(String::from(scope.as_ref()));
5012 self
5013 }
5014 /// Identifies the authorization scope(s) for the method you are building.
5015 ///
5016 /// See [`Self::add_scope()`] for details.
5017 pub fn add_scopes<I, St>(mut self, scopes: I) -> FeedCreateCall<'a, C>
5018 where
5019 I: IntoIterator<Item = St>,
5020 St: AsRef<str>,
5021 {
5022 self._scopes
5023 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5024 self
5025 }
5026
5027 /// Removes all scopes, and no default scope will be used either.
5028 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5029 /// for details).
5030 pub fn clear_scopes(mut self) -> FeedCreateCall<'a, C> {
5031 self._scopes.clear();
5032 self
5033 }
5034}
5035
5036/// Deletes an asset feed.
5037///
5038/// A builder for the *delete* method supported by a *feed* resource.
5039/// It is not used directly, but through a [`FeedMethods`] instance.
5040///
5041/// # Example
5042///
5043/// Instantiate a resource method builder
5044///
5045/// ```test_harness,no_run
5046/// # extern crate hyper;
5047/// # extern crate hyper_rustls;
5048/// # extern crate google_cloudasset1 as cloudasset1;
5049/// # async fn dox() {
5050/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5051///
5052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5054/// # .with_native_roots()
5055/// # .unwrap()
5056/// # .https_only()
5057/// # .enable_http2()
5058/// # .build();
5059///
5060/// # let executor = hyper_util::rt::TokioExecutor::new();
5061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5062/// # secret,
5063/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5064/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5065/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5066/// # ),
5067/// # ).build().await.unwrap();
5068///
5069/// # let client = hyper_util::client::legacy::Client::builder(
5070/// # hyper_util::rt::TokioExecutor::new()
5071/// # )
5072/// # .build(
5073/// # hyper_rustls::HttpsConnectorBuilder::new()
5074/// # .with_native_roots()
5075/// # .unwrap()
5076/// # .https_or_http()
5077/// # .enable_http2()
5078/// # .build()
5079/// # );
5080/// # let mut hub = CloudAsset::new(client, auth);
5081/// // You can configure optional parameters by calling the respective setters at will, and
5082/// // execute the final call using `doit()`.
5083/// // Values shown here are possibly random and not representative !
5084/// let result = hub.feeds().delete("name")
5085/// .doit().await;
5086/// # }
5087/// ```
5088pub struct FeedDeleteCall<'a, C>
5089where
5090 C: 'a,
5091{
5092 hub: &'a CloudAsset<C>,
5093 _name: String,
5094 _delegate: Option<&'a mut dyn common::Delegate>,
5095 _additional_params: HashMap<String, String>,
5096 _scopes: BTreeSet<String>,
5097}
5098
5099impl<'a, C> common::CallBuilder for FeedDeleteCall<'a, C> {}
5100
5101impl<'a, C> FeedDeleteCall<'a, C>
5102where
5103 C: common::Connector,
5104{
5105 /// Perform the operation you have build so far.
5106 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5107 use std::borrow::Cow;
5108 use std::io::{Read, Seek};
5109
5110 use common::{url::Params, ToParts};
5111 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5112
5113 let mut dd = common::DefaultDelegate;
5114 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5115 dlg.begin(common::MethodInfo {
5116 id: "cloudasset.feeds.delete",
5117 http_method: hyper::Method::DELETE,
5118 });
5119
5120 for &field in ["alt", "name"].iter() {
5121 if self._additional_params.contains_key(field) {
5122 dlg.finished(false);
5123 return Err(common::Error::FieldClash(field));
5124 }
5125 }
5126
5127 let mut params = Params::with_capacity(3 + self._additional_params.len());
5128 params.push("name", self._name);
5129
5130 params.extend(self._additional_params.iter());
5131
5132 params.push("alt", "json");
5133 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5134 if self._scopes.is_empty() {
5135 self._scopes
5136 .insert(Scope::CloudPlatform.as_ref().to_string());
5137 }
5138
5139 #[allow(clippy::single_element_loop)]
5140 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5141 url = params.uri_replacement(url, param_name, find_this, true);
5142 }
5143 {
5144 let to_remove = ["name"];
5145 params.remove_params(&to_remove);
5146 }
5147
5148 let url = params.parse_with_url(&url);
5149
5150 loop {
5151 let token = match self
5152 .hub
5153 .auth
5154 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5155 .await
5156 {
5157 Ok(token) => token,
5158 Err(e) => match dlg.token(e) {
5159 Ok(token) => token,
5160 Err(e) => {
5161 dlg.finished(false);
5162 return Err(common::Error::MissingToken(e));
5163 }
5164 },
5165 };
5166 let mut req_result = {
5167 let client = &self.hub.client;
5168 dlg.pre_request();
5169 let mut req_builder = hyper::Request::builder()
5170 .method(hyper::Method::DELETE)
5171 .uri(url.as_str())
5172 .header(USER_AGENT, self.hub._user_agent.clone());
5173
5174 if let Some(token) = token.as_ref() {
5175 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5176 }
5177
5178 let request = req_builder
5179 .header(CONTENT_LENGTH, 0_u64)
5180 .body(common::to_body::<String>(None));
5181
5182 client.request(request.unwrap()).await
5183 };
5184
5185 match req_result {
5186 Err(err) => {
5187 if let common::Retry::After(d) = dlg.http_error(&err) {
5188 sleep(d).await;
5189 continue;
5190 }
5191 dlg.finished(false);
5192 return Err(common::Error::HttpError(err));
5193 }
5194 Ok(res) => {
5195 let (mut parts, body) = res.into_parts();
5196 let mut body = common::Body::new(body);
5197 if !parts.status.is_success() {
5198 let bytes = common::to_bytes(body).await.unwrap_or_default();
5199 let error = serde_json::from_str(&common::to_string(&bytes));
5200 let response = common::to_response(parts, bytes.into());
5201
5202 if let common::Retry::After(d) =
5203 dlg.http_failure(&response, error.as_ref().ok())
5204 {
5205 sleep(d).await;
5206 continue;
5207 }
5208
5209 dlg.finished(false);
5210
5211 return Err(match error {
5212 Ok(value) => common::Error::BadRequest(value),
5213 _ => common::Error::Failure(response),
5214 });
5215 }
5216 let response = {
5217 let bytes = common::to_bytes(body).await.unwrap_or_default();
5218 let encoded = common::to_string(&bytes);
5219 match serde_json::from_str(&encoded) {
5220 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5221 Err(error) => {
5222 dlg.response_json_decode_error(&encoded, &error);
5223 return Err(common::Error::JsonDecodeError(
5224 encoded.to_string(),
5225 error,
5226 ));
5227 }
5228 }
5229 };
5230
5231 dlg.finished(true);
5232 return Ok(response);
5233 }
5234 }
5235 }
5236 }
5237
5238 /// Required. The name of the feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
5239 ///
5240 /// Sets the *name* path property to the given value.
5241 ///
5242 /// Even though the property as already been set when instantiating this call,
5243 /// we provide this method for API completeness.
5244 pub fn name(mut self, new_value: &str) -> FeedDeleteCall<'a, C> {
5245 self._name = new_value.to_string();
5246 self
5247 }
5248 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5249 /// while executing the actual API request.
5250 ///
5251 /// ````text
5252 /// It should be used to handle progress information, and to implement a certain level of resilience.
5253 /// ````
5254 ///
5255 /// Sets the *delegate* property to the given value.
5256 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FeedDeleteCall<'a, C> {
5257 self._delegate = Some(new_value);
5258 self
5259 }
5260
5261 /// Set any additional parameter of the query string used in the request.
5262 /// It should be used to set parameters which are not yet available through their own
5263 /// setters.
5264 ///
5265 /// Please note that this method must not be used to set any of the known parameters
5266 /// which have their own setter method. If done anyway, the request will fail.
5267 ///
5268 /// # Additional Parameters
5269 ///
5270 /// * *$.xgafv* (query-string) - V1 error format.
5271 /// * *access_token* (query-string) - OAuth access token.
5272 /// * *alt* (query-string) - Data format for response.
5273 /// * *callback* (query-string) - JSONP
5274 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5275 /// * *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.
5276 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5277 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5278 /// * *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.
5279 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5280 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5281 pub fn param<T>(mut self, name: T, value: T) -> FeedDeleteCall<'a, C>
5282 where
5283 T: AsRef<str>,
5284 {
5285 self._additional_params
5286 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5287 self
5288 }
5289
5290 /// Identifies the authorization scope for the method you are building.
5291 ///
5292 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5293 /// [`Scope::CloudPlatform`].
5294 ///
5295 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5296 /// tokens for more than one scope.
5297 ///
5298 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5299 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5300 /// sufficient, a read-write scope will do as well.
5301 pub fn add_scope<St>(mut self, scope: St) -> FeedDeleteCall<'a, C>
5302 where
5303 St: AsRef<str>,
5304 {
5305 self._scopes.insert(String::from(scope.as_ref()));
5306 self
5307 }
5308 /// Identifies the authorization scope(s) for the method you are building.
5309 ///
5310 /// See [`Self::add_scope()`] for details.
5311 pub fn add_scopes<I, St>(mut self, scopes: I) -> FeedDeleteCall<'a, C>
5312 where
5313 I: IntoIterator<Item = St>,
5314 St: AsRef<str>,
5315 {
5316 self._scopes
5317 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5318 self
5319 }
5320
5321 /// Removes all scopes, and no default scope will be used either.
5322 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5323 /// for details).
5324 pub fn clear_scopes(mut self) -> FeedDeleteCall<'a, C> {
5325 self._scopes.clear();
5326 self
5327 }
5328}
5329
5330/// Gets details about an asset feed.
5331///
5332/// A builder for the *get* method supported by a *feed* resource.
5333/// It is not used directly, but through a [`FeedMethods`] instance.
5334///
5335/// # Example
5336///
5337/// Instantiate a resource method builder
5338///
5339/// ```test_harness,no_run
5340/// # extern crate hyper;
5341/// # extern crate hyper_rustls;
5342/// # extern crate google_cloudasset1 as cloudasset1;
5343/// # async fn dox() {
5344/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5345///
5346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5348/// # .with_native_roots()
5349/// # .unwrap()
5350/// # .https_only()
5351/// # .enable_http2()
5352/// # .build();
5353///
5354/// # let executor = hyper_util::rt::TokioExecutor::new();
5355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5356/// # secret,
5357/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5358/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5359/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5360/// # ),
5361/// # ).build().await.unwrap();
5362///
5363/// # let client = hyper_util::client::legacy::Client::builder(
5364/// # hyper_util::rt::TokioExecutor::new()
5365/// # )
5366/// # .build(
5367/// # hyper_rustls::HttpsConnectorBuilder::new()
5368/// # .with_native_roots()
5369/// # .unwrap()
5370/// # .https_or_http()
5371/// # .enable_http2()
5372/// # .build()
5373/// # );
5374/// # let mut hub = CloudAsset::new(client, auth);
5375/// // You can configure optional parameters by calling the respective setters at will, and
5376/// // execute the final call using `doit()`.
5377/// // Values shown here are possibly random and not representative !
5378/// let result = hub.feeds().get("name")
5379/// .doit().await;
5380/// # }
5381/// ```
5382pub struct FeedGetCall<'a, C>
5383where
5384 C: 'a,
5385{
5386 hub: &'a CloudAsset<C>,
5387 _name: String,
5388 _delegate: Option<&'a mut dyn common::Delegate>,
5389 _additional_params: HashMap<String, String>,
5390 _scopes: BTreeSet<String>,
5391}
5392
5393impl<'a, C> common::CallBuilder for FeedGetCall<'a, C> {}
5394
5395impl<'a, C> FeedGetCall<'a, C>
5396where
5397 C: common::Connector,
5398{
5399 /// Perform the operation you have build so far.
5400 pub async fn doit(mut self) -> common::Result<(common::Response, Feed)> {
5401 use std::borrow::Cow;
5402 use std::io::{Read, Seek};
5403
5404 use common::{url::Params, ToParts};
5405 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5406
5407 let mut dd = common::DefaultDelegate;
5408 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5409 dlg.begin(common::MethodInfo {
5410 id: "cloudasset.feeds.get",
5411 http_method: hyper::Method::GET,
5412 });
5413
5414 for &field in ["alt", "name"].iter() {
5415 if self._additional_params.contains_key(field) {
5416 dlg.finished(false);
5417 return Err(common::Error::FieldClash(field));
5418 }
5419 }
5420
5421 let mut params = Params::with_capacity(3 + self._additional_params.len());
5422 params.push("name", self._name);
5423
5424 params.extend(self._additional_params.iter());
5425
5426 params.push("alt", "json");
5427 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5428 if self._scopes.is_empty() {
5429 self._scopes
5430 .insert(Scope::CloudPlatform.as_ref().to_string());
5431 }
5432
5433 #[allow(clippy::single_element_loop)]
5434 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5435 url = params.uri_replacement(url, param_name, find_this, true);
5436 }
5437 {
5438 let to_remove = ["name"];
5439 params.remove_params(&to_remove);
5440 }
5441
5442 let url = params.parse_with_url(&url);
5443
5444 loop {
5445 let token = match self
5446 .hub
5447 .auth
5448 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5449 .await
5450 {
5451 Ok(token) => token,
5452 Err(e) => match dlg.token(e) {
5453 Ok(token) => token,
5454 Err(e) => {
5455 dlg.finished(false);
5456 return Err(common::Error::MissingToken(e));
5457 }
5458 },
5459 };
5460 let mut req_result = {
5461 let client = &self.hub.client;
5462 dlg.pre_request();
5463 let mut req_builder = hyper::Request::builder()
5464 .method(hyper::Method::GET)
5465 .uri(url.as_str())
5466 .header(USER_AGENT, self.hub._user_agent.clone());
5467
5468 if let Some(token) = token.as_ref() {
5469 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5470 }
5471
5472 let request = req_builder
5473 .header(CONTENT_LENGTH, 0_u64)
5474 .body(common::to_body::<String>(None));
5475
5476 client.request(request.unwrap()).await
5477 };
5478
5479 match req_result {
5480 Err(err) => {
5481 if let common::Retry::After(d) = dlg.http_error(&err) {
5482 sleep(d).await;
5483 continue;
5484 }
5485 dlg.finished(false);
5486 return Err(common::Error::HttpError(err));
5487 }
5488 Ok(res) => {
5489 let (mut parts, body) = res.into_parts();
5490 let mut body = common::Body::new(body);
5491 if !parts.status.is_success() {
5492 let bytes = common::to_bytes(body).await.unwrap_or_default();
5493 let error = serde_json::from_str(&common::to_string(&bytes));
5494 let response = common::to_response(parts, bytes.into());
5495
5496 if let common::Retry::After(d) =
5497 dlg.http_failure(&response, error.as_ref().ok())
5498 {
5499 sleep(d).await;
5500 continue;
5501 }
5502
5503 dlg.finished(false);
5504
5505 return Err(match error {
5506 Ok(value) => common::Error::BadRequest(value),
5507 _ => common::Error::Failure(response),
5508 });
5509 }
5510 let response = {
5511 let bytes = common::to_bytes(body).await.unwrap_or_default();
5512 let encoded = common::to_string(&bytes);
5513 match serde_json::from_str(&encoded) {
5514 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5515 Err(error) => {
5516 dlg.response_json_decode_error(&encoded, &error);
5517 return Err(common::Error::JsonDecodeError(
5518 encoded.to_string(),
5519 error,
5520 ));
5521 }
5522 }
5523 };
5524
5525 dlg.finished(true);
5526 return Ok(response);
5527 }
5528 }
5529 }
5530 }
5531
5532 /// Required. The name of the Feed and it must be in the format of: projects/project_number/feeds/feed_id folders/folder_number/feeds/feed_id organizations/organization_number/feeds/feed_id
5533 ///
5534 /// Sets the *name* path property to the given value.
5535 ///
5536 /// Even though the property as already been set when instantiating this call,
5537 /// we provide this method for API completeness.
5538 pub fn name(mut self, new_value: &str) -> FeedGetCall<'a, C> {
5539 self._name = new_value.to_string();
5540 self
5541 }
5542 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5543 /// while executing the actual API request.
5544 ///
5545 /// ````text
5546 /// It should be used to handle progress information, and to implement a certain level of resilience.
5547 /// ````
5548 ///
5549 /// Sets the *delegate* property to the given value.
5550 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FeedGetCall<'a, C> {
5551 self._delegate = Some(new_value);
5552 self
5553 }
5554
5555 /// Set any additional parameter of the query string used in the request.
5556 /// It should be used to set parameters which are not yet available through their own
5557 /// setters.
5558 ///
5559 /// Please note that this method must not be used to set any of the known parameters
5560 /// which have their own setter method. If done anyway, the request will fail.
5561 ///
5562 /// # Additional Parameters
5563 ///
5564 /// * *$.xgafv* (query-string) - V1 error format.
5565 /// * *access_token* (query-string) - OAuth access token.
5566 /// * *alt* (query-string) - Data format for response.
5567 /// * *callback* (query-string) - JSONP
5568 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5569 /// * *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.
5570 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5571 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5572 /// * *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.
5573 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5574 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5575 pub fn param<T>(mut self, name: T, value: T) -> FeedGetCall<'a, C>
5576 where
5577 T: AsRef<str>,
5578 {
5579 self._additional_params
5580 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5581 self
5582 }
5583
5584 /// Identifies the authorization scope for the method you are building.
5585 ///
5586 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5587 /// [`Scope::CloudPlatform`].
5588 ///
5589 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5590 /// tokens for more than one scope.
5591 ///
5592 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5593 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5594 /// sufficient, a read-write scope will do as well.
5595 pub fn add_scope<St>(mut self, scope: St) -> FeedGetCall<'a, C>
5596 where
5597 St: AsRef<str>,
5598 {
5599 self._scopes.insert(String::from(scope.as_ref()));
5600 self
5601 }
5602 /// Identifies the authorization scope(s) for the method you are building.
5603 ///
5604 /// See [`Self::add_scope()`] for details.
5605 pub fn add_scopes<I, St>(mut self, scopes: I) -> FeedGetCall<'a, C>
5606 where
5607 I: IntoIterator<Item = St>,
5608 St: AsRef<str>,
5609 {
5610 self._scopes
5611 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5612 self
5613 }
5614
5615 /// Removes all scopes, and no default scope will be used either.
5616 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5617 /// for details).
5618 pub fn clear_scopes(mut self) -> FeedGetCall<'a, C> {
5619 self._scopes.clear();
5620 self
5621 }
5622}
5623
5624/// Lists all asset feeds in a parent project/folder/organization.
5625///
5626/// A builder for the *list* method supported by a *feed* resource.
5627/// It is not used directly, but through a [`FeedMethods`] instance.
5628///
5629/// # Example
5630///
5631/// Instantiate a resource method builder
5632///
5633/// ```test_harness,no_run
5634/// # extern crate hyper;
5635/// # extern crate hyper_rustls;
5636/// # extern crate google_cloudasset1 as cloudasset1;
5637/// # async fn dox() {
5638/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5639///
5640/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5641/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5642/// # .with_native_roots()
5643/// # .unwrap()
5644/// # .https_only()
5645/// # .enable_http2()
5646/// # .build();
5647///
5648/// # let executor = hyper_util::rt::TokioExecutor::new();
5649/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5650/// # secret,
5651/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5652/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5653/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5654/// # ),
5655/// # ).build().await.unwrap();
5656///
5657/// # let client = hyper_util::client::legacy::Client::builder(
5658/// # hyper_util::rt::TokioExecutor::new()
5659/// # )
5660/// # .build(
5661/// # hyper_rustls::HttpsConnectorBuilder::new()
5662/// # .with_native_roots()
5663/// # .unwrap()
5664/// # .https_or_http()
5665/// # .enable_http2()
5666/// # .build()
5667/// # );
5668/// # let mut hub = CloudAsset::new(client, auth);
5669/// // You can configure optional parameters by calling the respective setters at will, and
5670/// // execute the final call using `doit()`.
5671/// // Values shown here are possibly random and not representative !
5672/// let result = hub.feeds().list("parent")
5673/// .doit().await;
5674/// # }
5675/// ```
5676pub struct FeedListCall<'a, C>
5677where
5678 C: 'a,
5679{
5680 hub: &'a CloudAsset<C>,
5681 _parent: String,
5682 _delegate: Option<&'a mut dyn common::Delegate>,
5683 _additional_params: HashMap<String, String>,
5684 _scopes: BTreeSet<String>,
5685}
5686
5687impl<'a, C> common::CallBuilder for FeedListCall<'a, C> {}
5688
5689impl<'a, C> FeedListCall<'a, C>
5690where
5691 C: common::Connector,
5692{
5693 /// Perform the operation you have build so far.
5694 pub async fn doit(mut self) -> common::Result<(common::Response, ListFeedsResponse)> {
5695 use std::borrow::Cow;
5696 use std::io::{Read, Seek};
5697
5698 use common::{url::Params, ToParts};
5699 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5700
5701 let mut dd = common::DefaultDelegate;
5702 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5703 dlg.begin(common::MethodInfo {
5704 id: "cloudasset.feeds.list",
5705 http_method: hyper::Method::GET,
5706 });
5707
5708 for &field in ["alt", "parent"].iter() {
5709 if self._additional_params.contains_key(field) {
5710 dlg.finished(false);
5711 return Err(common::Error::FieldClash(field));
5712 }
5713 }
5714
5715 let mut params = Params::with_capacity(3 + self._additional_params.len());
5716 params.push("parent", self._parent);
5717
5718 params.extend(self._additional_params.iter());
5719
5720 params.push("alt", "json");
5721 let mut url = self.hub._base_url.clone() + "v1/{+parent}/feeds";
5722 if self._scopes.is_empty() {
5723 self._scopes
5724 .insert(Scope::CloudPlatform.as_ref().to_string());
5725 }
5726
5727 #[allow(clippy::single_element_loop)]
5728 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5729 url = params.uri_replacement(url, param_name, find_this, true);
5730 }
5731 {
5732 let to_remove = ["parent"];
5733 params.remove_params(&to_remove);
5734 }
5735
5736 let url = params.parse_with_url(&url);
5737
5738 loop {
5739 let token = match self
5740 .hub
5741 .auth
5742 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5743 .await
5744 {
5745 Ok(token) => token,
5746 Err(e) => match dlg.token(e) {
5747 Ok(token) => token,
5748 Err(e) => {
5749 dlg.finished(false);
5750 return Err(common::Error::MissingToken(e));
5751 }
5752 },
5753 };
5754 let mut req_result = {
5755 let client = &self.hub.client;
5756 dlg.pre_request();
5757 let mut req_builder = hyper::Request::builder()
5758 .method(hyper::Method::GET)
5759 .uri(url.as_str())
5760 .header(USER_AGENT, self.hub._user_agent.clone());
5761
5762 if let Some(token) = token.as_ref() {
5763 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5764 }
5765
5766 let request = req_builder
5767 .header(CONTENT_LENGTH, 0_u64)
5768 .body(common::to_body::<String>(None));
5769
5770 client.request(request.unwrap()).await
5771 };
5772
5773 match req_result {
5774 Err(err) => {
5775 if let common::Retry::After(d) = dlg.http_error(&err) {
5776 sleep(d).await;
5777 continue;
5778 }
5779 dlg.finished(false);
5780 return Err(common::Error::HttpError(err));
5781 }
5782 Ok(res) => {
5783 let (mut parts, body) = res.into_parts();
5784 let mut body = common::Body::new(body);
5785 if !parts.status.is_success() {
5786 let bytes = common::to_bytes(body).await.unwrap_or_default();
5787 let error = serde_json::from_str(&common::to_string(&bytes));
5788 let response = common::to_response(parts, bytes.into());
5789
5790 if let common::Retry::After(d) =
5791 dlg.http_failure(&response, error.as_ref().ok())
5792 {
5793 sleep(d).await;
5794 continue;
5795 }
5796
5797 dlg.finished(false);
5798
5799 return Err(match error {
5800 Ok(value) => common::Error::BadRequest(value),
5801 _ => common::Error::Failure(response),
5802 });
5803 }
5804 let response = {
5805 let bytes = common::to_bytes(body).await.unwrap_or_default();
5806 let encoded = common::to_string(&bytes);
5807 match serde_json::from_str(&encoded) {
5808 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5809 Err(error) => {
5810 dlg.response_json_decode_error(&encoded, &error);
5811 return Err(common::Error::JsonDecodeError(
5812 encoded.to_string(),
5813 error,
5814 ));
5815 }
5816 }
5817 };
5818
5819 dlg.finished(true);
5820 return Ok(response);
5821 }
5822 }
5823 }
5824 }
5825
5826 /// Required. The parent project/folder/organization whose feeds are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
5827 ///
5828 /// Sets the *parent* path property to the given value.
5829 ///
5830 /// Even though the property as already been set when instantiating this call,
5831 /// we provide this method for API completeness.
5832 pub fn parent(mut self, new_value: &str) -> FeedListCall<'a, C> {
5833 self._parent = new_value.to_string();
5834 self
5835 }
5836 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5837 /// while executing the actual API request.
5838 ///
5839 /// ````text
5840 /// It should be used to handle progress information, and to implement a certain level of resilience.
5841 /// ````
5842 ///
5843 /// Sets the *delegate* property to the given value.
5844 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FeedListCall<'a, C> {
5845 self._delegate = Some(new_value);
5846 self
5847 }
5848
5849 /// Set any additional parameter of the query string used in the request.
5850 /// It should be used to set parameters which are not yet available through their own
5851 /// setters.
5852 ///
5853 /// Please note that this method must not be used to set any of the known parameters
5854 /// which have their own setter method. If done anyway, the request will fail.
5855 ///
5856 /// # Additional Parameters
5857 ///
5858 /// * *$.xgafv* (query-string) - V1 error format.
5859 /// * *access_token* (query-string) - OAuth access token.
5860 /// * *alt* (query-string) - Data format for response.
5861 /// * *callback* (query-string) - JSONP
5862 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5863 /// * *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.
5864 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5865 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5866 /// * *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.
5867 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5868 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5869 pub fn param<T>(mut self, name: T, value: T) -> FeedListCall<'a, C>
5870 where
5871 T: AsRef<str>,
5872 {
5873 self._additional_params
5874 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5875 self
5876 }
5877
5878 /// Identifies the authorization scope for the method you are building.
5879 ///
5880 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5881 /// [`Scope::CloudPlatform`].
5882 ///
5883 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5884 /// tokens for more than one scope.
5885 ///
5886 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5887 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5888 /// sufficient, a read-write scope will do as well.
5889 pub fn add_scope<St>(mut self, scope: St) -> FeedListCall<'a, C>
5890 where
5891 St: AsRef<str>,
5892 {
5893 self._scopes.insert(String::from(scope.as_ref()));
5894 self
5895 }
5896 /// Identifies the authorization scope(s) for the method you are building.
5897 ///
5898 /// See [`Self::add_scope()`] for details.
5899 pub fn add_scopes<I, St>(mut self, scopes: I) -> FeedListCall<'a, C>
5900 where
5901 I: IntoIterator<Item = St>,
5902 St: AsRef<str>,
5903 {
5904 self._scopes
5905 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5906 self
5907 }
5908
5909 /// Removes all scopes, and no default scope will be used either.
5910 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5911 /// for details).
5912 pub fn clear_scopes(mut self) -> FeedListCall<'a, C> {
5913 self._scopes.clear();
5914 self
5915 }
5916}
5917
5918/// Updates an asset feed configuration.
5919///
5920/// A builder for the *patch* method supported by a *feed* resource.
5921/// It is not used directly, but through a [`FeedMethods`] instance.
5922///
5923/// # Example
5924///
5925/// Instantiate a resource method builder
5926///
5927/// ```test_harness,no_run
5928/// # extern crate hyper;
5929/// # extern crate hyper_rustls;
5930/// # extern crate google_cloudasset1 as cloudasset1;
5931/// use cloudasset1::api::UpdateFeedRequest;
5932/// # async fn dox() {
5933/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5934///
5935/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5936/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5937/// # .with_native_roots()
5938/// # .unwrap()
5939/// # .https_only()
5940/// # .enable_http2()
5941/// # .build();
5942///
5943/// # let executor = hyper_util::rt::TokioExecutor::new();
5944/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5945/// # secret,
5946/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5947/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5948/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5949/// # ),
5950/// # ).build().await.unwrap();
5951///
5952/// # let client = hyper_util::client::legacy::Client::builder(
5953/// # hyper_util::rt::TokioExecutor::new()
5954/// # )
5955/// # .build(
5956/// # hyper_rustls::HttpsConnectorBuilder::new()
5957/// # .with_native_roots()
5958/// # .unwrap()
5959/// # .https_or_http()
5960/// # .enable_http2()
5961/// # .build()
5962/// # );
5963/// # let mut hub = CloudAsset::new(client, auth);
5964/// // As the method needs a request, you would usually fill it with the desired information
5965/// // into the respective structure. Some of the parts shown here might not be applicable !
5966/// // Values shown here are possibly random and not representative !
5967/// let mut req = UpdateFeedRequest::default();
5968///
5969/// // You can configure optional parameters by calling the respective setters at will, and
5970/// // execute the final call using `doit()`.
5971/// // Values shown here are possibly random and not representative !
5972/// let result = hub.feeds().patch(req, "name")
5973/// .doit().await;
5974/// # }
5975/// ```
5976pub struct FeedPatchCall<'a, C>
5977where
5978 C: 'a,
5979{
5980 hub: &'a CloudAsset<C>,
5981 _request: UpdateFeedRequest,
5982 _name: String,
5983 _delegate: Option<&'a mut dyn common::Delegate>,
5984 _additional_params: HashMap<String, String>,
5985 _scopes: BTreeSet<String>,
5986}
5987
5988impl<'a, C> common::CallBuilder for FeedPatchCall<'a, C> {}
5989
5990impl<'a, C> FeedPatchCall<'a, C>
5991where
5992 C: common::Connector,
5993{
5994 /// Perform the operation you have build so far.
5995 pub async fn doit(mut self) -> common::Result<(common::Response, Feed)> {
5996 use std::borrow::Cow;
5997 use std::io::{Read, Seek};
5998
5999 use common::{url::Params, ToParts};
6000 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6001
6002 let mut dd = common::DefaultDelegate;
6003 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6004 dlg.begin(common::MethodInfo {
6005 id: "cloudasset.feeds.patch",
6006 http_method: hyper::Method::PATCH,
6007 });
6008
6009 for &field in ["alt", "name"].iter() {
6010 if self._additional_params.contains_key(field) {
6011 dlg.finished(false);
6012 return Err(common::Error::FieldClash(field));
6013 }
6014 }
6015
6016 let mut params = Params::with_capacity(4 + self._additional_params.len());
6017 params.push("name", self._name);
6018
6019 params.extend(self._additional_params.iter());
6020
6021 params.push("alt", "json");
6022 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6023 if self._scopes.is_empty() {
6024 self._scopes
6025 .insert(Scope::CloudPlatform.as_ref().to_string());
6026 }
6027
6028 #[allow(clippy::single_element_loop)]
6029 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6030 url = params.uri_replacement(url, param_name, find_this, true);
6031 }
6032 {
6033 let to_remove = ["name"];
6034 params.remove_params(&to_remove);
6035 }
6036
6037 let url = params.parse_with_url(&url);
6038
6039 let mut json_mime_type = mime::APPLICATION_JSON;
6040 let mut request_value_reader = {
6041 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6042 common::remove_json_null_values(&mut value);
6043 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6044 serde_json::to_writer(&mut dst, &value).unwrap();
6045 dst
6046 };
6047 let request_size = request_value_reader
6048 .seek(std::io::SeekFrom::End(0))
6049 .unwrap();
6050 request_value_reader
6051 .seek(std::io::SeekFrom::Start(0))
6052 .unwrap();
6053
6054 loop {
6055 let token = match self
6056 .hub
6057 .auth
6058 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6059 .await
6060 {
6061 Ok(token) => token,
6062 Err(e) => match dlg.token(e) {
6063 Ok(token) => token,
6064 Err(e) => {
6065 dlg.finished(false);
6066 return Err(common::Error::MissingToken(e));
6067 }
6068 },
6069 };
6070 request_value_reader
6071 .seek(std::io::SeekFrom::Start(0))
6072 .unwrap();
6073 let mut req_result = {
6074 let client = &self.hub.client;
6075 dlg.pre_request();
6076 let mut req_builder = hyper::Request::builder()
6077 .method(hyper::Method::PATCH)
6078 .uri(url.as_str())
6079 .header(USER_AGENT, self.hub._user_agent.clone());
6080
6081 if let Some(token) = token.as_ref() {
6082 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6083 }
6084
6085 let request = req_builder
6086 .header(CONTENT_TYPE, json_mime_type.to_string())
6087 .header(CONTENT_LENGTH, request_size as u64)
6088 .body(common::to_body(
6089 request_value_reader.get_ref().clone().into(),
6090 ));
6091
6092 client.request(request.unwrap()).await
6093 };
6094
6095 match req_result {
6096 Err(err) => {
6097 if let common::Retry::After(d) = dlg.http_error(&err) {
6098 sleep(d).await;
6099 continue;
6100 }
6101 dlg.finished(false);
6102 return Err(common::Error::HttpError(err));
6103 }
6104 Ok(res) => {
6105 let (mut parts, body) = res.into_parts();
6106 let mut body = common::Body::new(body);
6107 if !parts.status.is_success() {
6108 let bytes = common::to_bytes(body).await.unwrap_or_default();
6109 let error = serde_json::from_str(&common::to_string(&bytes));
6110 let response = common::to_response(parts, bytes.into());
6111
6112 if let common::Retry::After(d) =
6113 dlg.http_failure(&response, error.as_ref().ok())
6114 {
6115 sleep(d).await;
6116 continue;
6117 }
6118
6119 dlg.finished(false);
6120
6121 return Err(match error {
6122 Ok(value) => common::Error::BadRequest(value),
6123 _ => common::Error::Failure(response),
6124 });
6125 }
6126 let response = {
6127 let bytes = common::to_bytes(body).await.unwrap_or_default();
6128 let encoded = common::to_string(&bytes);
6129 match serde_json::from_str(&encoded) {
6130 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6131 Err(error) => {
6132 dlg.response_json_decode_error(&encoded, &error);
6133 return Err(common::Error::JsonDecodeError(
6134 encoded.to_string(),
6135 error,
6136 ));
6137 }
6138 }
6139 };
6140
6141 dlg.finished(true);
6142 return Ok(response);
6143 }
6144 }
6145 }
6146 }
6147
6148 ///
6149 /// Sets the *request* property to the given value.
6150 ///
6151 /// Even though the property as already been set when instantiating this call,
6152 /// we provide this method for API completeness.
6153 pub fn request(mut self, new_value: UpdateFeedRequest) -> FeedPatchCall<'a, C> {
6154 self._request = new_value;
6155 self
6156 }
6157 /// Required. The format will be projects/{project_number}/feeds/{client-assigned_feed_identifier} or folders/{folder_number}/feeds/{client-assigned_feed_identifier} or organizations/{organization_number}/feeds/{client-assigned_feed_identifier} The client-assigned feed identifier must be unique within the parent project/folder/organization.
6158 ///
6159 /// Sets the *name* path property to the given value.
6160 ///
6161 /// Even though the property as already been set when instantiating this call,
6162 /// we provide this method for API completeness.
6163 pub fn name(mut self, new_value: &str) -> FeedPatchCall<'a, C> {
6164 self._name = new_value.to_string();
6165 self
6166 }
6167 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6168 /// while executing the actual API request.
6169 ///
6170 /// ````text
6171 /// It should be used to handle progress information, and to implement a certain level of resilience.
6172 /// ````
6173 ///
6174 /// Sets the *delegate* property to the given value.
6175 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FeedPatchCall<'a, C> {
6176 self._delegate = Some(new_value);
6177 self
6178 }
6179
6180 /// Set any additional parameter of the query string used in the request.
6181 /// It should be used to set parameters which are not yet available through their own
6182 /// setters.
6183 ///
6184 /// Please note that this method must not be used to set any of the known parameters
6185 /// which have their own setter method. If done anyway, the request will fail.
6186 ///
6187 /// # Additional Parameters
6188 ///
6189 /// * *$.xgafv* (query-string) - V1 error format.
6190 /// * *access_token* (query-string) - OAuth access token.
6191 /// * *alt* (query-string) - Data format for response.
6192 /// * *callback* (query-string) - JSONP
6193 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6194 /// * *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.
6195 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6196 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6197 /// * *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.
6198 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6199 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6200 pub fn param<T>(mut self, name: T, value: T) -> FeedPatchCall<'a, C>
6201 where
6202 T: AsRef<str>,
6203 {
6204 self._additional_params
6205 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6206 self
6207 }
6208
6209 /// Identifies the authorization scope for the method you are building.
6210 ///
6211 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6212 /// [`Scope::CloudPlatform`].
6213 ///
6214 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6215 /// tokens for more than one scope.
6216 ///
6217 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6218 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6219 /// sufficient, a read-write scope will do as well.
6220 pub fn add_scope<St>(mut self, scope: St) -> FeedPatchCall<'a, C>
6221 where
6222 St: AsRef<str>,
6223 {
6224 self._scopes.insert(String::from(scope.as_ref()));
6225 self
6226 }
6227 /// Identifies the authorization scope(s) for the method you are building.
6228 ///
6229 /// See [`Self::add_scope()`] for details.
6230 pub fn add_scopes<I, St>(mut self, scopes: I) -> FeedPatchCall<'a, C>
6231 where
6232 I: IntoIterator<Item = St>,
6233 St: AsRef<str>,
6234 {
6235 self._scopes
6236 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6237 self
6238 }
6239
6240 /// Removes all scopes, and no default scope will be used either.
6241 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6242 /// for details).
6243 pub fn clear_scopes(mut self) -> FeedPatchCall<'a, C> {
6244 self._scopes.clear();
6245 self
6246 }
6247}
6248
6249/// 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.
6250///
6251/// A builder for the *get* method supported by a *operation* resource.
6252/// It is not used directly, but through a [`OperationMethods`] instance.
6253///
6254/// # Example
6255///
6256/// Instantiate a resource method builder
6257///
6258/// ```test_harness,no_run
6259/// # extern crate hyper;
6260/// # extern crate hyper_rustls;
6261/// # extern crate google_cloudasset1 as cloudasset1;
6262/// # async fn dox() {
6263/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6264///
6265/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6266/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6267/// # .with_native_roots()
6268/// # .unwrap()
6269/// # .https_only()
6270/// # .enable_http2()
6271/// # .build();
6272///
6273/// # let executor = hyper_util::rt::TokioExecutor::new();
6274/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6275/// # secret,
6276/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6277/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6278/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6279/// # ),
6280/// # ).build().await.unwrap();
6281///
6282/// # let client = hyper_util::client::legacy::Client::builder(
6283/// # hyper_util::rt::TokioExecutor::new()
6284/// # )
6285/// # .build(
6286/// # hyper_rustls::HttpsConnectorBuilder::new()
6287/// # .with_native_roots()
6288/// # .unwrap()
6289/// # .https_or_http()
6290/// # .enable_http2()
6291/// # .build()
6292/// # );
6293/// # let mut hub = CloudAsset::new(client, auth);
6294/// // You can configure optional parameters by calling the respective setters at will, and
6295/// // execute the final call using `doit()`.
6296/// // Values shown here are possibly random and not representative !
6297/// let result = hub.operations().get("name")
6298/// .doit().await;
6299/// # }
6300/// ```
6301pub struct OperationGetCall<'a, C>
6302where
6303 C: 'a,
6304{
6305 hub: &'a CloudAsset<C>,
6306 _name: String,
6307 _delegate: Option<&'a mut dyn common::Delegate>,
6308 _additional_params: HashMap<String, String>,
6309 _scopes: BTreeSet<String>,
6310}
6311
6312impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
6313
6314impl<'a, C> OperationGetCall<'a, C>
6315where
6316 C: common::Connector,
6317{
6318 /// Perform the operation you have build so far.
6319 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6320 use std::borrow::Cow;
6321 use std::io::{Read, Seek};
6322
6323 use common::{url::Params, ToParts};
6324 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6325
6326 let mut dd = common::DefaultDelegate;
6327 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6328 dlg.begin(common::MethodInfo {
6329 id: "cloudasset.operations.get",
6330 http_method: hyper::Method::GET,
6331 });
6332
6333 for &field in ["alt", "name"].iter() {
6334 if self._additional_params.contains_key(field) {
6335 dlg.finished(false);
6336 return Err(common::Error::FieldClash(field));
6337 }
6338 }
6339
6340 let mut params = Params::with_capacity(3 + self._additional_params.len());
6341 params.push("name", self._name);
6342
6343 params.extend(self._additional_params.iter());
6344
6345 params.push("alt", "json");
6346 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6347 if self._scopes.is_empty() {
6348 self._scopes
6349 .insert(Scope::CloudPlatform.as_ref().to_string());
6350 }
6351
6352 #[allow(clippy::single_element_loop)]
6353 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6354 url = params.uri_replacement(url, param_name, find_this, true);
6355 }
6356 {
6357 let to_remove = ["name"];
6358 params.remove_params(&to_remove);
6359 }
6360
6361 let url = params.parse_with_url(&url);
6362
6363 loop {
6364 let token = match self
6365 .hub
6366 .auth
6367 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6368 .await
6369 {
6370 Ok(token) => token,
6371 Err(e) => match dlg.token(e) {
6372 Ok(token) => token,
6373 Err(e) => {
6374 dlg.finished(false);
6375 return Err(common::Error::MissingToken(e));
6376 }
6377 },
6378 };
6379 let mut req_result = {
6380 let client = &self.hub.client;
6381 dlg.pre_request();
6382 let mut req_builder = hyper::Request::builder()
6383 .method(hyper::Method::GET)
6384 .uri(url.as_str())
6385 .header(USER_AGENT, self.hub._user_agent.clone());
6386
6387 if let Some(token) = token.as_ref() {
6388 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6389 }
6390
6391 let request = req_builder
6392 .header(CONTENT_LENGTH, 0_u64)
6393 .body(common::to_body::<String>(None));
6394
6395 client.request(request.unwrap()).await
6396 };
6397
6398 match req_result {
6399 Err(err) => {
6400 if let common::Retry::After(d) = dlg.http_error(&err) {
6401 sleep(d).await;
6402 continue;
6403 }
6404 dlg.finished(false);
6405 return Err(common::Error::HttpError(err));
6406 }
6407 Ok(res) => {
6408 let (mut parts, body) = res.into_parts();
6409 let mut body = common::Body::new(body);
6410 if !parts.status.is_success() {
6411 let bytes = common::to_bytes(body).await.unwrap_or_default();
6412 let error = serde_json::from_str(&common::to_string(&bytes));
6413 let response = common::to_response(parts, bytes.into());
6414
6415 if let common::Retry::After(d) =
6416 dlg.http_failure(&response, error.as_ref().ok())
6417 {
6418 sleep(d).await;
6419 continue;
6420 }
6421
6422 dlg.finished(false);
6423
6424 return Err(match error {
6425 Ok(value) => common::Error::BadRequest(value),
6426 _ => common::Error::Failure(response),
6427 });
6428 }
6429 let response = {
6430 let bytes = common::to_bytes(body).await.unwrap_or_default();
6431 let encoded = common::to_string(&bytes);
6432 match serde_json::from_str(&encoded) {
6433 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6434 Err(error) => {
6435 dlg.response_json_decode_error(&encoded, &error);
6436 return Err(common::Error::JsonDecodeError(
6437 encoded.to_string(),
6438 error,
6439 ));
6440 }
6441 }
6442 };
6443
6444 dlg.finished(true);
6445 return Ok(response);
6446 }
6447 }
6448 }
6449 }
6450
6451 /// The name of the operation resource.
6452 ///
6453 /// Sets the *name* path property to the given value.
6454 ///
6455 /// Even though the property as already been set when instantiating this call,
6456 /// we provide this method for API completeness.
6457 pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
6458 self._name = new_value.to_string();
6459 self
6460 }
6461 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6462 /// while executing the actual API request.
6463 ///
6464 /// ````text
6465 /// It should be used to handle progress information, and to implement a certain level of resilience.
6466 /// ````
6467 ///
6468 /// Sets the *delegate* property to the given value.
6469 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
6470 self._delegate = Some(new_value);
6471 self
6472 }
6473
6474 /// Set any additional parameter of the query string used in the request.
6475 /// It should be used to set parameters which are not yet available through their own
6476 /// setters.
6477 ///
6478 /// Please note that this method must not be used to set any of the known parameters
6479 /// which have their own setter method. If done anyway, the request will fail.
6480 ///
6481 /// # Additional Parameters
6482 ///
6483 /// * *$.xgafv* (query-string) - V1 error format.
6484 /// * *access_token* (query-string) - OAuth access token.
6485 /// * *alt* (query-string) - Data format for response.
6486 /// * *callback* (query-string) - JSONP
6487 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6488 /// * *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.
6489 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6490 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6491 /// * *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.
6492 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6493 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6494 pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
6495 where
6496 T: AsRef<str>,
6497 {
6498 self._additional_params
6499 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6500 self
6501 }
6502
6503 /// Identifies the authorization scope for the method you are building.
6504 ///
6505 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6506 /// [`Scope::CloudPlatform`].
6507 ///
6508 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6509 /// tokens for more than one scope.
6510 ///
6511 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6512 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6513 /// sufficient, a read-write scope will do as well.
6514 pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
6515 where
6516 St: AsRef<str>,
6517 {
6518 self._scopes.insert(String::from(scope.as_ref()));
6519 self
6520 }
6521 /// Identifies the authorization scope(s) for the method you are building.
6522 ///
6523 /// See [`Self::add_scope()`] for details.
6524 pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
6525 where
6526 I: IntoIterator<Item = St>,
6527 St: AsRef<str>,
6528 {
6529 self._scopes
6530 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6531 self
6532 }
6533
6534 /// Removes all scopes, and no default scope will be used either.
6535 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6536 /// for details).
6537 pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
6538 self._scopes.clear();
6539 self
6540 }
6541}
6542
6543/// Creates a saved query in a parent project/folder/organization.
6544///
6545/// A builder for the *create* method supported by a *savedQuery* resource.
6546/// It is not used directly, but through a [`SavedQueryMethods`] instance.
6547///
6548/// # Example
6549///
6550/// Instantiate a resource method builder
6551///
6552/// ```test_harness,no_run
6553/// # extern crate hyper;
6554/// # extern crate hyper_rustls;
6555/// # extern crate google_cloudasset1 as cloudasset1;
6556/// use cloudasset1::api::SavedQuery;
6557/// # async fn dox() {
6558/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6559///
6560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6561/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6562/// # .with_native_roots()
6563/// # .unwrap()
6564/// # .https_only()
6565/// # .enable_http2()
6566/// # .build();
6567///
6568/// # let executor = hyper_util::rt::TokioExecutor::new();
6569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6570/// # secret,
6571/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6572/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6573/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6574/// # ),
6575/// # ).build().await.unwrap();
6576///
6577/// # let client = hyper_util::client::legacy::Client::builder(
6578/// # hyper_util::rt::TokioExecutor::new()
6579/// # )
6580/// # .build(
6581/// # hyper_rustls::HttpsConnectorBuilder::new()
6582/// # .with_native_roots()
6583/// # .unwrap()
6584/// # .https_or_http()
6585/// # .enable_http2()
6586/// # .build()
6587/// # );
6588/// # let mut hub = CloudAsset::new(client, auth);
6589/// // As the method needs a request, you would usually fill it with the desired information
6590/// // into the respective structure. Some of the parts shown here might not be applicable !
6591/// // Values shown here are possibly random and not representative !
6592/// let mut req = SavedQuery::default();
6593///
6594/// // You can configure optional parameters by calling the respective setters at will, and
6595/// // execute the final call using `doit()`.
6596/// // Values shown here are possibly random and not representative !
6597/// let result = hub.saved_queries().create(req, "parent")
6598/// .saved_query_id("ea")
6599/// .doit().await;
6600/// # }
6601/// ```
6602pub struct SavedQueryCreateCall<'a, C>
6603where
6604 C: 'a,
6605{
6606 hub: &'a CloudAsset<C>,
6607 _request: SavedQuery,
6608 _parent: String,
6609 _saved_query_id: Option<String>,
6610 _delegate: Option<&'a mut dyn common::Delegate>,
6611 _additional_params: HashMap<String, String>,
6612 _scopes: BTreeSet<String>,
6613}
6614
6615impl<'a, C> common::CallBuilder for SavedQueryCreateCall<'a, C> {}
6616
6617impl<'a, C> SavedQueryCreateCall<'a, C>
6618where
6619 C: common::Connector,
6620{
6621 /// Perform the operation you have build so far.
6622 pub async fn doit(mut self) -> common::Result<(common::Response, SavedQuery)> {
6623 use std::borrow::Cow;
6624 use std::io::{Read, Seek};
6625
6626 use common::{url::Params, ToParts};
6627 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6628
6629 let mut dd = common::DefaultDelegate;
6630 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6631 dlg.begin(common::MethodInfo {
6632 id: "cloudasset.savedQueries.create",
6633 http_method: hyper::Method::POST,
6634 });
6635
6636 for &field in ["alt", "parent", "savedQueryId"].iter() {
6637 if self._additional_params.contains_key(field) {
6638 dlg.finished(false);
6639 return Err(common::Error::FieldClash(field));
6640 }
6641 }
6642
6643 let mut params = Params::with_capacity(5 + self._additional_params.len());
6644 params.push("parent", self._parent);
6645 if let Some(value) = self._saved_query_id.as_ref() {
6646 params.push("savedQueryId", value);
6647 }
6648
6649 params.extend(self._additional_params.iter());
6650
6651 params.push("alt", "json");
6652 let mut url = self.hub._base_url.clone() + "v1/{+parent}/savedQueries";
6653 if self._scopes.is_empty() {
6654 self._scopes
6655 .insert(Scope::CloudPlatform.as_ref().to_string());
6656 }
6657
6658 #[allow(clippy::single_element_loop)]
6659 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6660 url = params.uri_replacement(url, param_name, find_this, true);
6661 }
6662 {
6663 let to_remove = ["parent"];
6664 params.remove_params(&to_remove);
6665 }
6666
6667 let url = params.parse_with_url(&url);
6668
6669 let mut json_mime_type = mime::APPLICATION_JSON;
6670 let mut request_value_reader = {
6671 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6672 common::remove_json_null_values(&mut value);
6673 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6674 serde_json::to_writer(&mut dst, &value).unwrap();
6675 dst
6676 };
6677 let request_size = request_value_reader
6678 .seek(std::io::SeekFrom::End(0))
6679 .unwrap();
6680 request_value_reader
6681 .seek(std::io::SeekFrom::Start(0))
6682 .unwrap();
6683
6684 loop {
6685 let token = match self
6686 .hub
6687 .auth
6688 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6689 .await
6690 {
6691 Ok(token) => token,
6692 Err(e) => match dlg.token(e) {
6693 Ok(token) => token,
6694 Err(e) => {
6695 dlg.finished(false);
6696 return Err(common::Error::MissingToken(e));
6697 }
6698 },
6699 };
6700 request_value_reader
6701 .seek(std::io::SeekFrom::Start(0))
6702 .unwrap();
6703 let mut req_result = {
6704 let client = &self.hub.client;
6705 dlg.pre_request();
6706 let mut req_builder = hyper::Request::builder()
6707 .method(hyper::Method::POST)
6708 .uri(url.as_str())
6709 .header(USER_AGENT, self.hub._user_agent.clone());
6710
6711 if let Some(token) = token.as_ref() {
6712 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6713 }
6714
6715 let request = req_builder
6716 .header(CONTENT_TYPE, json_mime_type.to_string())
6717 .header(CONTENT_LENGTH, request_size as u64)
6718 .body(common::to_body(
6719 request_value_reader.get_ref().clone().into(),
6720 ));
6721
6722 client.request(request.unwrap()).await
6723 };
6724
6725 match req_result {
6726 Err(err) => {
6727 if let common::Retry::After(d) = dlg.http_error(&err) {
6728 sleep(d).await;
6729 continue;
6730 }
6731 dlg.finished(false);
6732 return Err(common::Error::HttpError(err));
6733 }
6734 Ok(res) => {
6735 let (mut parts, body) = res.into_parts();
6736 let mut body = common::Body::new(body);
6737 if !parts.status.is_success() {
6738 let bytes = common::to_bytes(body).await.unwrap_or_default();
6739 let error = serde_json::from_str(&common::to_string(&bytes));
6740 let response = common::to_response(parts, bytes.into());
6741
6742 if let common::Retry::After(d) =
6743 dlg.http_failure(&response, error.as_ref().ok())
6744 {
6745 sleep(d).await;
6746 continue;
6747 }
6748
6749 dlg.finished(false);
6750
6751 return Err(match error {
6752 Ok(value) => common::Error::BadRequest(value),
6753 _ => common::Error::Failure(response),
6754 });
6755 }
6756 let response = {
6757 let bytes = common::to_bytes(body).await.unwrap_or_default();
6758 let encoded = common::to_string(&bytes);
6759 match serde_json::from_str(&encoded) {
6760 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6761 Err(error) => {
6762 dlg.response_json_decode_error(&encoded, &error);
6763 return Err(common::Error::JsonDecodeError(
6764 encoded.to_string(),
6765 error,
6766 ));
6767 }
6768 }
6769 };
6770
6771 dlg.finished(true);
6772 return Ok(response);
6773 }
6774 }
6775 }
6776 }
6777
6778 ///
6779 /// Sets the *request* property to the given value.
6780 ///
6781 /// Even though the property as already been set when instantiating this call,
6782 /// we provide this method for API completeness.
6783 pub fn request(mut self, new_value: SavedQuery) -> SavedQueryCreateCall<'a, C> {
6784 self._request = new_value;
6785 self
6786 }
6787 /// Required. The name of the project/folder/organization where this saved_query should be created in. It can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345").
6788 ///
6789 /// Sets the *parent* path property to the given value.
6790 ///
6791 /// Even though the property as already been set when instantiating this call,
6792 /// we provide this method for API completeness.
6793 pub fn parent(mut self, new_value: &str) -> SavedQueryCreateCall<'a, C> {
6794 self._parent = new_value.to_string();
6795 self
6796 }
6797 /// Required. The ID to use for the saved query, which must be unique in the specified parent. It will become the final component of the saved query's resource name. This value should be 4-63 characters, and valid characters are `a-z-`. Notice that this field is required in the saved query creation, and the `name` field of the `saved_query` will be ignored.
6798 ///
6799 /// Sets the *saved query id* query property to the given value.
6800 pub fn saved_query_id(mut self, new_value: &str) -> SavedQueryCreateCall<'a, C> {
6801 self._saved_query_id = Some(new_value.to_string());
6802 self
6803 }
6804 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6805 /// while executing the actual API request.
6806 ///
6807 /// ````text
6808 /// It should be used to handle progress information, and to implement a certain level of resilience.
6809 /// ````
6810 ///
6811 /// Sets the *delegate* property to the given value.
6812 pub fn delegate(
6813 mut self,
6814 new_value: &'a mut dyn common::Delegate,
6815 ) -> SavedQueryCreateCall<'a, C> {
6816 self._delegate = Some(new_value);
6817 self
6818 }
6819
6820 /// Set any additional parameter of the query string used in the request.
6821 /// It should be used to set parameters which are not yet available through their own
6822 /// setters.
6823 ///
6824 /// Please note that this method must not be used to set any of the known parameters
6825 /// which have their own setter method. If done anyway, the request will fail.
6826 ///
6827 /// # Additional Parameters
6828 ///
6829 /// * *$.xgafv* (query-string) - V1 error format.
6830 /// * *access_token* (query-string) - OAuth access token.
6831 /// * *alt* (query-string) - Data format for response.
6832 /// * *callback* (query-string) - JSONP
6833 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6834 /// * *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.
6835 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6836 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6837 /// * *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.
6838 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6839 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6840 pub fn param<T>(mut self, name: T, value: T) -> SavedQueryCreateCall<'a, C>
6841 where
6842 T: AsRef<str>,
6843 {
6844 self._additional_params
6845 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6846 self
6847 }
6848
6849 /// Identifies the authorization scope for the method you are building.
6850 ///
6851 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6852 /// [`Scope::CloudPlatform`].
6853 ///
6854 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6855 /// tokens for more than one scope.
6856 ///
6857 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6858 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6859 /// sufficient, a read-write scope will do as well.
6860 pub fn add_scope<St>(mut self, scope: St) -> SavedQueryCreateCall<'a, C>
6861 where
6862 St: AsRef<str>,
6863 {
6864 self._scopes.insert(String::from(scope.as_ref()));
6865 self
6866 }
6867 /// Identifies the authorization scope(s) for the method you are building.
6868 ///
6869 /// See [`Self::add_scope()`] for details.
6870 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedQueryCreateCall<'a, C>
6871 where
6872 I: IntoIterator<Item = St>,
6873 St: AsRef<str>,
6874 {
6875 self._scopes
6876 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6877 self
6878 }
6879
6880 /// Removes all scopes, and no default scope will be used either.
6881 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6882 /// for details).
6883 pub fn clear_scopes(mut self) -> SavedQueryCreateCall<'a, C> {
6884 self._scopes.clear();
6885 self
6886 }
6887}
6888
6889/// Deletes a saved query.
6890///
6891/// A builder for the *delete* method supported by a *savedQuery* resource.
6892/// It is not used directly, but through a [`SavedQueryMethods`] instance.
6893///
6894/// # Example
6895///
6896/// Instantiate a resource method builder
6897///
6898/// ```test_harness,no_run
6899/// # extern crate hyper;
6900/// # extern crate hyper_rustls;
6901/// # extern crate google_cloudasset1 as cloudasset1;
6902/// # async fn dox() {
6903/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6904///
6905/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6906/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6907/// # .with_native_roots()
6908/// # .unwrap()
6909/// # .https_only()
6910/// # .enable_http2()
6911/// # .build();
6912///
6913/// # let executor = hyper_util::rt::TokioExecutor::new();
6914/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6915/// # secret,
6916/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6917/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6918/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6919/// # ),
6920/// # ).build().await.unwrap();
6921///
6922/// # let client = hyper_util::client::legacy::Client::builder(
6923/// # hyper_util::rt::TokioExecutor::new()
6924/// # )
6925/// # .build(
6926/// # hyper_rustls::HttpsConnectorBuilder::new()
6927/// # .with_native_roots()
6928/// # .unwrap()
6929/// # .https_or_http()
6930/// # .enable_http2()
6931/// # .build()
6932/// # );
6933/// # let mut hub = CloudAsset::new(client, auth);
6934/// // You can configure optional parameters by calling the respective setters at will, and
6935/// // execute the final call using `doit()`.
6936/// // Values shown here are possibly random and not representative !
6937/// let result = hub.saved_queries().delete("name")
6938/// .doit().await;
6939/// # }
6940/// ```
6941pub struct SavedQueryDeleteCall<'a, C>
6942where
6943 C: 'a,
6944{
6945 hub: &'a CloudAsset<C>,
6946 _name: String,
6947 _delegate: Option<&'a mut dyn common::Delegate>,
6948 _additional_params: HashMap<String, String>,
6949 _scopes: BTreeSet<String>,
6950}
6951
6952impl<'a, C> common::CallBuilder for SavedQueryDeleteCall<'a, C> {}
6953
6954impl<'a, C> SavedQueryDeleteCall<'a, C>
6955where
6956 C: common::Connector,
6957{
6958 /// Perform the operation you have build so far.
6959 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6960 use std::borrow::Cow;
6961 use std::io::{Read, Seek};
6962
6963 use common::{url::Params, ToParts};
6964 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6965
6966 let mut dd = common::DefaultDelegate;
6967 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6968 dlg.begin(common::MethodInfo {
6969 id: "cloudasset.savedQueries.delete",
6970 http_method: hyper::Method::DELETE,
6971 });
6972
6973 for &field in ["alt", "name"].iter() {
6974 if self._additional_params.contains_key(field) {
6975 dlg.finished(false);
6976 return Err(common::Error::FieldClash(field));
6977 }
6978 }
6979
6980 let mut params = Params::with_capacity(3 + self._additional_params.len());
6981 params.push("name", self._name);
6982
6983 params.extend(self._additional_params.iter());
6984
6985 params.push("alt", "json");
6986 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6987 if self._scopes.is_empty() {
6988 self._scopes
6989 .insert(Scope::CloudPlatform.as_ref().to_string());
6990 }
6991
6992 #[allow(clippy::single_element_loop)]
6993 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6994 url = params.uri_replacement(url, param_name, find_this, true);
6995 }
6996 {
6997 let to_remove = ["name"];
6998 params.remove_params(&to_remove);
6999 }
7000
7001 let url = params.parse_with_url(&url);
7002
7003 loop {
7004 let token = match self
7005 .hub
7006 .auth
7007 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7008 .await
7009 {
7010 Ok(token) => token,
7011 Err(e) => match dlg.token(e) {
7012 Ok(token) => token,
7013 Err(e) => {
7014 dlg.finished(false);
7015 return Err(common::Error::MissingToken(e));
7016 }
7017 },
7018 };
7019 let mut req_result = {
7020 let client = &self.hub.client;
7021 dlg.pre_request();
7022 let mut req_builder = hyper::Request::builder()
7023 .method(hyper::Method::DELETE)
7024 .uri(url.as_str())
7025 .header(USER_AGENT, self.hub._user_agent.clone());
7026
7027 if let Some(token) = token.as_ref() {
7028 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7029 }
7030
7031 let request = req_builder
7032 .header(CONTENT_LENGTH, 0_u64)
7033 .body(common::to_body::<String>(None));
7034
7035 client.request(request.unwrap()).await
7036 };
7037
7038 match req_result {
7039 Err(err) => {
7040 if let common::Retry::After(d) = dlg.http_error(&err) {
7041 sleep(d).await;
7042 continue;
7043 }
7044 dlg.finished(false);
7045 return Err(common::Error::HttpError(err));
7046 }
7047 Ok(res) => {
7048 let (mut parts, body) = res.into_parts();
7049 let mut body = common::Body::new(body);
7050 if !parts.status.is_success() {
7051 let bytes = common::to_bytes(body).await.unwrap_or_default();
7052 let error = serde_json::from_str(&common::to_string(&bytes));
7053 let response = common::to_response(parts, bytes.into());
7054
7055 if let common::Retry::After(d) =
7056 dlg.http_failure(&response, error.as_ref().ok())
7057 {
7058 sleep(d).await;
7059 continue;
7060 }
7061
7062 dlg.finished(false);
7063
7064 return Err(match error {
7065 Ok(value) => common::Error::BadRequest(value),
7066 _ => common::Error::Failure(response),
7067 });
7068 }
7069 let response = {
7070 let bytes = common::to_bytes(body).await.unwrap_or_default();
7071 let encoded = common::to_string(&bytes);
7072 match serde_json::from_str(&encoded) {
7073 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7074 Err(error) => {
7075 dlg.response_json_decode_error(&encoded, &error);
7076 return Err(common::Error::JsonDecodeError(
7077 encoded.to_string(),
7078 error,
7079 ));
7080 }
7081 }
7082 };
7083
7084 dlg.finished(true);
7085 return Ok(response);
7086 }
7087 }
7088 }
7089 }
7090
7091 /// Required. The name of the saved query to delete. It must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
7092 ///
7093 /// Sets the *name* path property to the given value.
7094 ///
7095 /// Even though the property as already been set when instantiating this call,
7096 /// we provide this method for API completeness.
7097 pub fn name(mut self, new_value: &str) -> SavedQueryDeleteCall<'a, C> {
7098 self._name = new_value.to_string();
7099 self
7100 }
7101 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7102 /// while executing the actual API request.
7103 ///
7104 /// ````text
7105 /// It should be used to handle progress information, and to implement a certain level of resilience.
7106 /// ````
7107 ///
7108 /// Sets the *delegate* property to the given value.
7109 pub fn delegate(
7110 mut self,
7111 new_value: &'a mut dyn common::Delegate,
7112 ) -> SavedQueryDeleteCall<'a, C> {
7113 self._delegate = Some(new_value);
7114 self
7115 }
7116
7117 /// Set any additional parameter of the query string used in the request.
7118 /// It should be used to set parameters which are not yet available through their own
7119 /// setters.
7120 ///
7121 /// Please note that this method must not be used to set any of the known parameters
7122 /// which have their own setter method. If done anyway, the request will fail.
7123 ///
7124 /// # Additional Parameters
7125 ///
7126 /// * *$.xgafv* (query-string) - V1 error format.
7127 /// * *access_token* (query-string) - OAuth access token.
7128 /// * *alt* (query-string) - Data format for response.
7129 /// * *callback* (query-string) - JSONP
7130 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7131 /// * *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.
7132 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7133 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7134 /// * *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.
7135 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7136 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7137 pub fn param<T>(mut self, name: T, value: T) -> SavedQueryDeleteCall<'a, C>
7138 where
7139 T: AsRef<str>,
7140 {
7141 self._additional_params
7142 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7143 self
7144 }
7145
7146 /// Identifies the authorization scope for the method you are building.
7147 ///
7148 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7149 /// [`Scope::CloudPlatform`].
7150 ///
7151 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7152 /// tokens for more than one scope.
7153 ///
7154 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7155 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7156 /// sufficient, a read-write scope will do as well.
7157 pub fn add_scope<St>(mut self, scope: St) -> SavedQueryDeleteCall<'a, C>
7158 where
7159 St: AsRef<str>,
7160 {
7161 self._scopes.insert(String::from(scope.as_ref()));
7162 self
7163 }
7164 /// Identifies the authorization scope(s) for the method you are building.
7165 ///
7166 /// See [`Self::add_scope()`] for details.
7167 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedQueryDeleteCall<'a, C>
7168 where
7169 I: IntoIterator<Item = St>,
7170 St: AsRef<str>,
7171 {
7172 self._scopes
7173 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7174 self
7175 }
7176
7177 /// Removes all scopes, and no default scope will be used either.
7178 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7179 /// for details).
7180 pub fn clear_scopes(mut self) -> SavedQueryDeleteCall<'a, C> {
7181 self._scopes.clear();
7182 self
7183 }
7184}
7185
7186/// Gets details about a saved query.
7187///
7188/// A builder for the *get* method supported by a *savedQuery* resource.
7189/// It is not used directly, but through a [`SavedQueryMethods`] instance.
7190///
7191/// # Example
7192///
7193/// Instantiate a resource method builder
7194///
7195/// ```test_harness,no_run
7196/// # extern crate hyper;
7197/// # extern crate hyper_rustls;
7198/// # extern crate google_cloudasset1 as cloudasset1;
7199/// # async fn dox() {
7200/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7201///
7202/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7203/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7204/// # .with_native_roots()
7205/// # .unwrap()
7206/// # .https_only()
7207/// # .enable_http2()
7208/// # .build();
7209///
7210/// # let executor = hyper_util::rt::TokioExecutor::new();
7211/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7212/// # secret,
7213/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7214/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7215/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7216/// # ),
7217/// # ).build().await.unwrap();
7218///
7219/// # let client = hyper_util::client::legacy::Client::builder(
7220/// # hyper_util::rt::TokioExecutor::new()
7221/// # )
7222/// # .build(
7223/// # hyper_rustls::HttpsConnectorBuilder::new()
7224/// # .with_native_roots()
7225/// # .unwrap()
7226/// # .https_or_http()
7227/// # .enable_http2()
7228/// # .build()
7229/// # );
7230/// # let mut hub = CloudAsset::new(client, auth);
7231/// // You can configure optional parameters by calling the respective setters at will, and
7232/// // execute the final call using `doit()`.
7233/// // Values shown here are possibly random and not representative !
7234/// let result = hub.saved_queries().get("name")
7235/// .doit().await;
7236/// # }
7237/// ```
7238pub struct SavedQueryGetCall<'a, C>
7239where
7240 C: 'a,
7241{
7242 hub: &'a CloudAsset<C>,
7243 _name: String,
7244 _delegate: Option<&'a mut dyn common::Delegate>,
7245 _additional_params: HashMap<String, String>,
7246 _scopes: BTreeSet<String>,
7247}
7248
7249impl<'a, C> common::CallBuilder for SavedQueryGetCall<'a, C> {}
7250
7251impl<'a, C> SavedQueryGetCall<'a, C>
7252where
7253 C: common::Connector,
7254{
7255 /// Perform the operation you have build so far.
7256 pub async fn doit(mut self) -> common::Result<(common::Response, SavedQuery)> {
7257 use std::borrow::Cow;
7258 use std::io::{Read, Seek};
7259
7260 use common::{url::Params, ToParts};
7261 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7262
7263 let mut dd = common::DefaultDelegate;
7264 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7265 dlg.begin(common::MethodInfo {
7266 id: "cloudasset.savedQueries.get",
7267 http_method: hyper::Method::GET,
7268 });
7269
7270 for &field in ["alt", "name"].iter() {
7271 if self._additional_params.contains_key(field) {
7272 dlg.finished(false);
7273 return Err(common::Error::FieldClash(field));
7274 }
7275 }
7276
7277 let mut params = Params::with_capacity(3 + self._additional_params.len());
7278 params.push("name", self._name);
7279
7280 params.extend(self._additional_params.iter());
7281
7282 params.push("alt", "json");
7283 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7284 if self._scopes.is_empty() {
7285 self._scopes
7286 .insert(Scope::CloudPlatform.as_ref().to_string());
7287 }
7288
7289 #[allow(clippy::single_element_loop)]
7290 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7291 url = params.uri_replacement(url, param_name, find_this, true);
7292 }
7293 {
7294 let to_remove = ["name"];
7295 params.remove_params(&to_remove);
7296 }
7297
7298 let url = params.parse_with_url(&url);
7299
7300 loop {
7301 let token = match self
7302 .hub
7303 .auth
7304 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7305 .await
7306 {
7307 Ok(token) => token,
7308 Err(e) => match dlg.token(e) {
7309 Ok(token) => token,
7310 Err(e) => {
7311 dlg.finished(false);
7312 return Err(common::Error::MissingToken(e));
7313 }
7314 },
7315 };
7316 let mut req_result = {
7317 let client = &self.hub.client;
7318 dlg.pre_request();
7319 let mut req_builder = hyper::Request::builder()
7320 .method(hyper::Method::GET)
7321 .uri(url.as_str())
7322 .header(USER_AGENT, self.hub._user_agent.clone());
7323
7324 if let Some(token) = token.as_ref() {
7325 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7326 }
7327
7328 let request = req_builder
7329 .header(CONTENT_LENGTH, 0_u64)
7330 .body(common::to_body::<String>(None));
7331
7332 client.request(request.unwrap()).await
7333 };
7334
7335 match req_result {
7336 Err(err) => {
7337 if let common::Retry::After(d) = dlg.http_error(&err) {
7338 sleep(d).await;
7339 continue;
7340 }
7341 dlg.finished(false);
7342 return Err(common::Error::HttpError(err));
7343 }
7344 Ok(res) => {
7345 let (mut parts, body) = res.into_parts();
7346 let mut body = common::Body::new(body);
7347 if !parts.status.is_success() {
7348 let bytes = common::to_bytes(body).await.unwrap_or_default();
7349 let error = serde_json::from_str(&common::to_string(&bytes));
7350 let response = common::to_response(parts, bytes.into());
7351
7352 if let common::Retry::After(d) =
7353 dlg.http_failure(&response, error.as_ref().ok())
7354 {
7355 sleep(d).await;
7356 continue;
7357 }
7358
7359 dlg.finished(false);
7360
7361 return Err(match error {
7362 Ok(value) => common::Error::BadRequest(value),
7363 _ => common::Error::Failure(response),
7364 });
7365 }
7366 let response = {
7367 let bytes = common::to_bytes(body).await.unwrap_or_default();
7368 let encoded = common::to_string(&bytes);
7369 match serde_json::from_str(&encoded) {
7370 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7371 Err(error) => {
7372 dlg.response_json_decode_error(&encoded, &error);
7373 return Err(common::Error::JsonDecodeError(
7374 encoded.to_string(),
7375 error,
7376 ));
7377 }
7378 }
7379 };
7380
7381 dlg.finished(true);
7382 return Ok(response);
7383 }
7384 }
7385 }
7386 }
7387
7388 /// Required. The name of the saved query and it must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
7389 ///
7390 /// Sets the *name* path property to the given value.
7391 ///
7392 /// Even though the property as already been set when instantiating this call,
7393 /// we provide this method for API completeness.
7394 pub fn name(mut self, new_value: &str) -> SavedQueryGetCall<'a, C> {
7395 self._name = new_value.to_string();
7396 self
7397 }
7398 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7399 /// while executing the actual API request.
7400 ///
7401 /// ````text
7402 /// It should be used to handle progress information, and to implement a certain level of resilience.
7403 /// ````
7404 ///
7405 /// Sets the *delegate* property to the given value.
7406 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> SavedQueryGetCall<'a, C> {
7407 self._delegate = Some(new_value);
7408 self
7409 }
7410
7411 /// Set any additional parameter of the query string used in the request.
7412 /// It should be used to set parameters which are not yet available through their own
7413 /// setters.
7414 ///
7415 /// Please note that this method must not be used to set any of the known parameters
7416 /// which have their own setter method. If done anyway, the request will fail.
7417 ///
7418 /// # Additional Parameters
7419 ///
7420 /// * *$.xgafv* (query-string) - V1 error format.
7421 /// * *access_token* (query-string) - OAuth access token.
7422 /// * *alt* (query-string) - Data format for response.
7423 /// * *callback* (query-string) - JSONP
7424 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7425 /// * *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.
7426 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7427 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7428 /// * *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.
7429 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7430 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7431 pub fn param<T>(mut self, name: T, value: T) -> SavedQueryGetCall<'a, C>
7432 where
7433 T: AsRef<str>,
7434 {
7435 self._additional_params
7436 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7437 self
7438 }
7439
7440 /// Identifies the authorization scope for the method you are building.
7441 ///
7442 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7443 /// [`Scope::CloudPlatform`].
7444 ///
7445 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7446 /// tokens for more than one scope.
7447 ///
7448 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7449 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7450 /// sufficient, a read-write scope will do as well.
7451 pub fn add_scope<St>(mut self, scope: St) -> SavedQueryGetCall<'a, C>
7452 where
7453 St: AsRef<str>,
7454 {
7455 self._scopes.insert(String::from(scope.as_ref()));
7456 self
7457 }
7458 /// Identifies the authorization scope(s) for the method you are building.
7459 ///
7460 /// See [`Self::add_scope()`] for details.
7461 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedQueryGetCall<'a, C>
7462 where
7463 I: IntoIterator<Item = St>,
7464 St: AsRef<str>,
7465 {
7466 self._scopes
7467 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7468 self
7469 }
7470
7471 /// Removes all scopes, and no default scope will be used either.
7472 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7473 /// for details).
7474 pub fn clear_scopes(mut self) -> SavedQueryGetCall<'a, C> {
7475 self._scopes.clear();
7476 self
7477 }
7478}
7479
7480/// Lists all saved queries in a parent project/folder/organization.
7481///
7482/// A builder for the *list* method supported by a *savedQuery* resource.
7483/// It is not used directly, but through a [`SavedQueryMethods`] instance.
7484///
7485/// # Example
7486///
7487/// Instantiate a resource method builder
7488///
7489/// ```test_harness,no_run
7490/// # extern crate hyper;
7491/// # extern crate hyper_rustls;
7492/// # extern crate google_cloudasset1 as cloudasset1;
7493/// # async fn dox() {
7494/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7495///
7496/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7497/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7498/// # .with_native_roots()
7499/// # .unwrap()
7500/// # .https_only()
7501/// # .enable_http2()
7502/// # .build();
7503///
7504/// # let executor = hyper_util::rt::TokioExecutor::new();
7505/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7506/// # secret,
7507/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7508/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7509/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7510/// # ),
7511/// # ).build().await.unwrap();
7512///
7513/// # let client = hyper_util::client::legacy::Client::builder(
7514/// # hyper_util::rt::TokioExecutor::new()
7515/// # )
7516/// # .build(
7517/// # hyper_rustls::HttpsConnectorBuilder::new()
7518/// # .with_native_roots()
7519/// # .unwrap()
7520/// # .https_or_http()
7521/// # .enable_http2()
7522/// # .build()
7523/// # );
7524/// # let mut hub = CloudAsset::new(client, auth);
7525/// // You can configure optional parameters by calling the respective setters at will, and
7526/// // execute the final call using `doit()`.
7527/// // Values shown here are possibly random and not representative !
7528/// let result = hub.saved_queries().list("parent")
7529/// .page_token("duo")
7530/// .page_size(-50)
7531/// .filter("sed")
7532/// .doit().await;
7533/// # }
7534/// ```
7535pub struct SavedQueryListCall<'a, C>
7536where
7537 C: 'a,
7538{
7539 hub: &'a CloudAsset<C>,
7540 _parent: String,
7541 _page_token: Option<String>,
7542 _page_size: Option<i32>,
7543 _filter: Option<String>,
7544 _delegate: Option<&'a mut dyn common::Delegate>,
7545 _additional_params: HashMap<String, String>,
7546 _scopes: BTreeSet<String>,
7547}
7548
7549impl<'a, C> common::CallBuilder for SavedQueryListCall<'a, C> {}
7550
7551impl<'a, C> SavedQueryListCall<'a, C>
7552where
7553 C: common::Connector,
7554{
7555 /// Perform the operation you have build so far.
7556 pub async fn doit(mut self) -> common::Result<(common::Response, ListSavedQueriesResponse)> {
7557 use std::borrow::Cow;
7558 use std::io::{Read, Seek};
7559
7560 use common::{url::Params, ToParts};
7561 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7562
7563 let mut dd = common::DefaultDelegate;
7564 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7565 dlg.begin(common::MethodInfo {
7566 id: "cloudasset.savedQueries.list",
7567 http_method: hyper::Method::GET,
7568 });
7569
7570 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
7571 if self._additional_params.contains_key(field) {
7572 dlg.finished(false);
7573 return Err(common::Error::FieldClash(field));
7574 }
7575 }
7576
7577 let mut params = Params::with_capacity(6 + self._additional_params.len());
7578 params.push("parent", self._parent);
7579 if let Some(value) = self._page_token.as_ref() {
7580 params.push("pageToken", value);
7581 }
7582 if let Some(value) = self._page_size.as_ref() {
7583 params.push("pageSize", value.to_string());
7584 }
7585 if let Some(value) = self._filter.as_ref() {
7586 params.push("filter", value);
7587 }
7588
7589 params.extend(self._additional_params.iter());
7590
7591 params.push("alt", "json");
7592 let mut url = self.hub._base_url.clone() + "v1/{+parent}/savedQueries";
7593 if self._scopes.is_empty() {
7594 self._scopes
7595 .insert(Scope::CloudPlatform.as_ref().to_string());
7596 }
7597
7598 #[allow(clippy::single_element_loop)]
7599 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7600 url = params.uri_replacement(url, param_name, find_this, true);
7601 }
7602 {
7603 let to_remove = ["parent"];
7604 params.remove_params(&to_remove);
7605 }
7606
7607 let url = params.parse_with_url(&url);
7608
7609 loop {
7610 let token = match self
7611 .hub
7612 .auth
7613 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7614 .await
7615 {
7616 Ok(token) => token,
7617 Err(e) => match dlg.token(e) {
7618 Ok(token) => token,
7619 Err(e) => {
7620 dlg.finished(false);
7621 return Err(common::Error::MissingToken(e));
7622 }
7623 },
7624 };
7625 let mut req_result = {
7626 let client = &self.hub.client;
7627 dlg.pre_request();
7628 let mut req_builder = hyper::Request::builder()
7629 .method(hyper::Method::GET)
7630 .uri(url.as_str())
7631 .header(USER_AGENT, self.hub._user_agent.clone());
7632
7633 if let Some(token) = token.as_ref() {
7634 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7635 }
7636
7637 let request = req_builder
7638 .header(CONTENT_LENGTH, 0_u64)
7639 .body(common::to_body::<String>(None));
7640
7641 client.request(request.unwrap()).await
7642 };
7643
7644 match req_result {
7645 Err(err) => {
7646 if let common::Retry::After(d) = dlg.http_error(&err) {
7647 sleep(d).await;
7648 continue;
7649 }
7650 dlg.finished(false);
7651 return Err(common::Error::HttpError(err));
7652 }
7653 Ok(res) => {
7654 let (mut parts, body) = res.into_parts();
7655 let mut body = common::Body::new(body);
7656 if !parts.status.is_success() {
7657 let bytes = common::to_bytes(body).await.unwrap_or_default();
7658 let error = serde_json::from_str(&common::to_string(&bytes));
7659 let response = common::to_response(parts, bytes.into());
7660
7661 if let common::Retry::After(d) =
7662 dlg.http_failure(&response, error.as_ref().ok())
7663 {
7664 sleep(d).await;
7665 continue;
7666 }
7667
7668 dlg.finished(false);
7669
7670 return Err(match error {
7671 Ok(value) => common::Error::BadRequest(value),
7672 _ => common::Error::Failure(response),
7673 });
7674 }
7675 let response = {
7676 let bytes = common::to_bytes(body).await.unwrap_or_default();
7677 let encoded = common::to_string(&bytes);
7678 match serde_json::from_str(&encoded) {
7679 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7680 Err(error) => {
7681 dlg.response_json_decode_error(&encoded, &error);
7682 return Err(common::Error::JsonDecodeError(
7683 encoded.to_string(),
7684 error,
7685 ));
7686 }
7687 }
7688 };
7689
7690 dlg.finished(true);
7691 return Ok(response);
7692 }
7693 }
7694 }
7695 }
7696
7697 /// Required. The parent project/folder/organization whose savedQueries are to be listed. It can only be using project/folder/organization number (such as "folders/12345")", or a project ID (such as "projects/my-project-id").
7698 ///
7699 /// Sets the *parent* path property to the given value.
7700 ///
7701 /// Even though the property as already been set when instantiating this call,
7702 /// we provide this method for API completeness.
7703 pub fn parent(mut self, new_value: &str) -> SavedQueryListCall<'a, C> {
7704 self._parent = new_value.to_string();
7705 self
7706 }
7707 /// Optional. A page token, received from a previous `ListSavedQueries` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListSavedQueries` must match the call that provided the page token.
7708 ///
7709 /// Sets the *page token* query property to the given value.
7710 pub fn page_token(mut self, new_value: &str) -> SavedQueryListCall<'a, C> {
7711 self._page_token = Some(new_value.to_string());
7712 self
7713 }
7714 /// Optional. The maximum number of saved queries to return per page. The service may return fewer than this value. If unspecified, at most 50 will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
7715 ///
7716 /// Sets the *page size* query property to the given value.
7717 pub fn page_size(mut self, new_value: i32) -> SavedQueryListCall<'a, C> {
7718 self._page_size = Some(new_value);
7719 self
7720 }
7721 /// Optional. The expression to filter resources. The expression is a list of zero or more restrictions combined via logical operators `AND` and `OR`. When `AND` and `OR` are both used in the expression, parentheses must be appropriately used to group the combinations. The expression may also contain regular expressions. See https://google.aip.dev/160 for more information on the grammar.
7722 ///
7723 /// Sets the *filter* query property to the given value.
7724 pub fn filter(mut self, new_value: &str) -> SavedQueryListCall<'a, C> {
7725 self._filter = Some(new_value.to_string());
7726 self
7727 }
7728 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7729 /// while executing the actual API request.
7730 ///
7731 /// ````text
7732 /// It should be used to handle progress information, and to implement a certain level of resilience.
7733 /// ````
7734 ///
7735 /// Sets the *delegate* property to the given value.
7736 pub fn delegate(
7737 mut self,
7738 new_value: &'a mut dyn common::Delegate,
7739 ) -> SavedQueryListCall<'a, C> {
7740 self._delegate = Some(new_value);
7741 self
7742 }
7743
7744 /// Set any additional parameter of the query string used in the request.
7745 /// It should be used to set parameters which are not yet available through their own
7746 /// setters.
7747 ///
7748 /// Please note that this method must not be used to set any of the known parameters
7749 /// which have their own setter method. If done anyway, the request will fail.
7750 ///
7751 /// # Additional Parameters
7752 ///
7753 /// * *$.xgafv* (query-string) - V1 error format.
7754 /// * *access_token* (query-string) - OAuth access token.
7755 /// * *alt* (query-string) - Data format for response.
7756 /// * *callback* (query-string) - JSONP
7757 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7758 /// * *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.
7759 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7760 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7761 /// * *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.
7762 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7763 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7764 pub fn param<T>(mut self, name: T, value: T) -> SavedQueryListCall<'a, C>
7765 where
7766 T: AsRef<str>,
7767 {
7768 self._additional_params
7769 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7770 self
7771 }
7772
7773 /// Identifies the authorization scope for the method you are building.
7774 ///
7775 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7776 /// [`Scope::CloudPlatform`].
7777 ///
7778 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7779 /// tokens for more than one scope.
7780 ///
7781 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7782 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7783 /// sufficient, a read-write scope will do as well.
7784 pub fn add_scope<St>(mut self, scope: St) -> SavedQueryListCall<'a, C>
7785 where
7786 St: AsRef<str>,
7787 {
7788 self._scopes.insert(String::from(scope.as_ref()));
7789 self
7790 }
7791 /// Identifies the authorization scope(s) for the method you are building.
7792 ///
7793 /// See [`Self::add_scope()`] for details.
7794 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedQueryListCall<'a, C>
7795 where
7796 I: IntoIterator<Item = St>,
7797 St: AsRef<str>,
7798 {
7799 self._scopes
7800 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7801 self
7802 }
7803
7804 /// Removes all scopes, and no default scope will be used either.
7805 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7806 /// for details).
7807 pub fn clear_scopes(mut self) -> SavedQueryListCall<'a, C> {
7808 self._scopes.clear();
7809 self
7810 }
7811}
7812
7813/// Updates a saved query.
7814///
7815/// A builder for the *patch* method supported by a *savedQuery* resource.
7816/// It is not used directly, but through a [`SavedQueryMethods`] instance.
7817///
7818/// # Example
7819///
7820/// Instantiate a resource method builder
7821///
7822/// ```test_harness,no_run
7823/// # extern crate hyper;
7824/// # extern crate hyper_rustls;
7825/// # extern crate google_cloudasset1 as cloudasset1;
7826/// use cloudasset1::api::SavedQuery;
7827/// # async fn dox() {
7828/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7829///
7830/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7831/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7832/// # .with_native_roots()
7833/// # .unwrap()
7834/// # .https_only()
7835/// # .enable_http2()
7836/// # .build();
7837///
7838/// # let executor = hyper_util::rt::TokioExecutor::new();
7839/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7840/// # secret,
7841/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7842/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7843/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7844/// # ),
7845/// # ).build().await.unwrap();
7846///
7847/// # let client = hyper_util::client::legacy::Client::builder(
7848/// # hyper_util::rt::TokioExecutor::new()
7849/// # )
7850/// # .build(
7851/// # hyper_rustls::HttpsConnectorBuilder::new()
7852/// # .with_native_roots()
7853/// # .unwrap()
7854/// # .https_or_http()
7855/// # .enable_http2()
7856/// # .build()
7857/// # );
7858/// # let mut hub = CloudAsset::new(client, auth);
7859/// // As the method needs a request, you would usually fill it with the desired information
7860/// // into the respective structure. Some of the parts shown here might not be applicable !
7861/// // Values shown here are possibly random and not representative !
7862/// let mut req = SavedQuery::default();
7863///
7864/// // You can configure optional parameters by calling the respective setters at will, and
7865/// // execute the final call using `doit()`.
7866/// // Values shown here are possibly random and not representative !
7867/// let result = hub.saved_queries().patch(req, "name")
7868/// .update_mask(FieldMask::new::<&str>(&[]))
7869/// .doit().await;
7870/// # }
7871/// ```
7872pub struct SavedQueryPatchCall<'a, C>
7873where
7874 C: 'a,
7875{
7876 hub: &'a CloudAsset<C>,
7877 _request: SavedQuery,
7878 _name: String,
7879 _update_mask: Option<common::FieldMask>,
7880 _delegate: Option<&'a mut dyn common::Delegate>,
7881 _additional_params: HashMap<String, String>,
7882 _scopes: BTreeSet<String>,
7883}
7884
7885impl<'a, C> common::CallBuilder for SavedQueryPatchCall<'a, C> {}
7886
7887impl<'a, C> SavedQueryPatchCall<'a, C>
7888where
7889 C: common::Connector,
7890{
7891 /// Perform the operation you have build so far.
7892 pub async fn doit(mut self) -> common::Result<(common::Response, SavedQuery)> {
7893 use std::borrow::Cow;
7894 use std::io::{Read, Seek};
7895
7896 use common::{url::Params, ToParts};
7897 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7898
7899 let mut dd = common::DefaultDelegate;
7900 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7901 dlg.begin(common::MethodInfo {
7902 id: "cloudasset.savedQueries.patch",
7903 http_method: hyper::Method::PATCH,
7904 });
7905
7906 for &field in ["alt", "name", "updateMask"].iter() {
7907 if self._additional_params.contains_key(field) {
7908 dlg.finished(false);
7909 return Err(common::Error::FieldClash(field));
7910 }
7911 }
7912
7913 let mut params = Params::with_capacity(5 + self._additional_params.len());
7914 params.push("name", self._name);
7915 if let Some(value) = self._update_mask.as_ref() {
7916 params.push("updateMask", value.to_string());
7917 }
7918
7919 params.extend(self._additional_params.iter());
7920
7921 params.push("alt", "json");
7922 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7923 if self._scopes.is_empty() {
7924 self._scopes
7925 .insert(Scope::CloudPlatform.as_ref().to_string());
7926 }
7927
7928 #[allow(clippy::single_element_loop)]
7929 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7930 url = params.uri_replacement(url, param_name, find_this, true);
7931 }
7932 {
7933 let to_remove = ["name"];
7934 params.remove_params(&to_remove);
7935 }
7936
7937 let url = params.parse_with_url(&url);
7938
7939 let mut json_mime_type = mime::APPLICATION_JSON;
7940 let mut request_value_reader = {
7941 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7942 common::remove_json_null_values(&mut value);
7943 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7944 serde_json::to_writer(&mut dst, &value).unwrap();
7945 dst
7946 };
7947 let request_size = request_value_reader
7948 .seek(std::io::SeekFrom::End(0))
7949 .unwrap();
7950 request_value_reader
7951 .seek(std::io::SeekFrom::Start(0))
7952 .unwrap();
7953
7954 loop {
7955 let token = match self
7956 .hub
7957 .auth
7958 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7959 .await
7960 {
7961 Ok(token) => token,
7962 Err(e) => match dlg.token(e) {
7963 Ok(token) => token,
7964 Err(e) => {
7965 dlg.finished(false);
7966 return Err(common::Error::MissingToken(e));
7967 }
7968 },
7969 };
7970 request_value_reader
7971 .seek(std::io::SeekFrom::Start(0))
7972 .unwrap();
7973 let mut req_result = {
7974 let client = &self.hub.client;
7975 dlg.pre_request();
7976 let mut req_builder = hyper::Request::builder()
7977 .method(hyper::Method::PATCH)
7978 .uri(url.as_str())
7979 .header(USER_AGENT, self.hub._user_agent.clone());
7980
7981 if let Some(token) = token.as_ref() {
7982 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7983 }
7984
7985 let request = req_builder
7986 .header(CONTENT_TYPE, json_mime_type.to_string())
7987 .header(CONTENT_LENGTH, request_size as u64)
7988 .body(common::to_body(
7989 request_value_reader.get_ref().clone().into(),
7990 ));
7991
7992 client.request(request.unwrap()).await
7993 };
7994
7995 match req_result {
7996 Err(err) => {
7997 if let common::Retry::After(d) = dlg.http_error(&err) {
7998 sleep(d).await;
7999 continue;
8000 }
8001 dlg.finished(false);
8002 return Err(common::Error::HttpError(err));
8003 }
8004 Ok(res) => {
8005 let (mut parts, body) = res.into_parts();
8006 let mut body = common::Body::new(body);
8007 if !parts.status.is_success() {
8008 let bytes = common::to_bytes(body).await.unwrap_or_default();
8009 let error = serde_json::from_str(&common::to_string(&bytes));
8010 let response = common::to_response(parts, bytes.into());
8011
8012 if let common::Retry::After(d) =
8013 dlg.http_failure(&response, error.as_ref().ok())
8014 {
8015 sleep(d).await;
8016 continue;
8017 }
8018
8019 dlg.finished(false);
8020
8021 return Err(match error {
8022 Ok(value) => common::Error::BadRequest(value),
8023 _ => common::Error::Failure(response),
8024 });
8025 }
8026 let response = {
8027 let bytes = common::to_bytes(body).await.unwrap_or_default();
8028 let encoded = common::to_string(&bytes);
8029 match serde_json::from_str(&encoded) {
8030 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8031 Err(error) => {
8032 dlg.response_json_decode_error(&encoded, &error);
8033 return Err(common::Error::JsonDecodeError(
8034 encoded.to_string(),
8035 error,
8036 ));
8037 }
8038 }
8039 };
8040
8041 dlg.finished(true);
8042 return Ok(response);
8043 }
8044 }
8045 }
8046 }
8047
8048 ///
8049 /// Sets the *request* property to the given value.
8050 ///
8051 /// Even though the property as already been set when instantiating this call,
8052 /// we provide this method for API completeness.
8053 pub fn request(mut self, new_value: SavedQuery) -> SavedQueryPatchCall<'a, C> {
8054 self._request = new_value;
8055 self
8056 }
8057 /// The resource name of the saved query. The format must be: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
8058 ///
8059 /// Sets the *name* path property to the given value.
8060 ///
8061 /// Even though the property as already been set when instantiating this call,
8062 /// we provide this method for API completeness.
8063 pub fn name(mut self, new_value: &str) -> SavedQueryPatchCall<'a, C> {
8064 self._name = new_value.to_string();
8065 self
8066 }
8067 /// Required. The list of fields to update.
8068 ///
8069 /// Sets the *update mask* query property to the given value.
8070 pub fn update_mask(mut self, new_value: common::FieldMask) -> SavedQueryPatchCall<'a, C> {
8071 self._update_mask = Some(new_value);
8072 self
8073 }
8074 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8075 /// while executing the actual API request.
8076 ///
8077 /// ````text
8078 /// It should be used to handle progress information, and to implement a certain level of resilience.
8079 /// ````
8080 ///
8081 /// Sets the *delegate* property to the given value.
8082 pub fn delegate(
8083 mut self,
8084 new_value: &'a mut dyn common::Delegate,
8085 ) -> SavedQueryPatchCall<'a, C> {
8086 self._delegate = Some(new_value);
8087 self
8088 }
8089
8090 /// Set any additional parameter of the query string used in the request.
8091 /// It should be used to set parameters which are not yet available through their own
8092 /// setters.
8093 ///
8094 /// Please note that this method must not be used to set any of the known parameters
8095 /// which have their own setter method. If done anyway, the request will fail.
8096 ///
8097 /// # Additional Parameters
8098 ///
8099 /// * *$.xgafv* (query-string) - V1 error format.
8100 /// * *access_token* (query-string) - OAuth access token.
8101 /// * *alt* (query-string) - Data format for response.
8102 /// * *callback* (query-string) - JSONP
8103 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8104 /// * *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.
8105 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8106 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8107 /// * *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.
8108 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8109 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8110 pub fn param<T>(mut self, name: T, value: T) -> SavedQueryPatchCall<'a, C>
8111 where
8112 T: AsRef<str>,
8113 {
8114 self._additional_params
8115 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8116 self
8117 }
8118
8119 /// Identifies the authorization scope for the method you are building.
8120 ///
8121 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8122 /// [`Scope::CloudPlatform`].
8123 ///
8124 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8125 /// tokens for more than one scope.
8126 ///
8127 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8128 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8129 /// sufficient, a read-write scope will do as well.
8130 pub fn add_scope<St>(mut self, scope: St) -> SavedQueryPatchCall<'a, C>
8131 where
8132 St: AsRef<str>,
8133 {
8134 self._scopes.insert(String::from(scope.as_ref()));
8135 self
8136 }
8137 /// Identifies the authorization scope(s) for the method you are building.
8138 ///
8139 /// See [`Self::add_scope()`] for details.
8140 pub fn add_scopes<I, St>(mut self, scopes: I) -> SavedQueryPatchCall<'a, C>
8141 where
8142 I: IntoIterator<Item = St>,
8143 St: AsRef<str>,
8144 {
8145 self._scopes
8146 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8147 self
8148 }
8149
8150 /// Removes all scopes, and no default scope will be used either.
8151 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8152 /// for details).
8153 pub fn clear_scopes(mut self) -> SavedQueryPatchCall<'a, C> {
8154 self._scopes.clear();
8155 self
8156 }
8157}
8158
8159/// Analyzes IAM policies to answer which identities have what accesses on which resources.
8160///
8161/// A builder for the *analyzeIamPolicy* method.
8162/// It is not used directly, but through a [`MethodMethods`] instance.
8163///
8164/// # Example
8165///
8166/// Instantiate a resource method builder
8167///
8168/// ```test_harness,no_run
8169/// # extern crate hyper;
8170/// # extern crate hyper_rustls;
8171/// # extern crate google_cloudasset1 as cloudasset1;
8172/// # async fn dox() {
8173/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8174///
8175/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8176/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8177/// # .with_native_roots()
8178/// # .unwrap()
8179/// # .https_only()
8180/// # .enable_http2()
8181/// # .build();
8182///
8183/// # let executor = hyper_util::rt::TokioExecutor::new();
8184/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8185/// # secret,
8186/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8187/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8188/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8189/// # ),
8190/// # ).build().await.unwrap();
8191///
8192/// # let client = hyper_util::client::legacy::Client::builder(
8193/// # hyper_util::rt::TokioExecutor::new()
8194/// # )
8195/// # .build(
8196/// # hyper_rustls::HttpsConnectorBuilder::new()
8197/// # .with_native_roots()
8198/// # .unwrap()
8199/// # .https_or_http()
8200/// # .enable_http2()
8201/// # .build()
8202/// # );
8203/// # let mut hub = CloudAsset::new(client, auth);
8204/// // You can configure optional parameters by calling the respective setters at will, and
8205/// // execute the final call using `doit()`.
8206/// // Values shown here are possibly random and not representative !
8207/// let result = hub.methods().analyze_iam_policy("scope")
8208/// .saved_analysis_query("rebum.")
8209/// .execution_timeout(chrono::Duration::seconds(5840181))
8210/// .analysis_query_resource_selector_full_resource_name("ipsum")
8211/// .analysis_query_options_output_resource_edges(true)
8212/// .analysis_query_options_output_group_edges(true)
8213/// .analysis_query_options_expand_roles(false)
8214/// .analysis_query_options_expand_resources(true)
8215/// .analysis_query_options_expand_groups(false)
8216/// .analysis_query_options_analyze_service_account_impersonation(true)
8217/// .analysis_query_identity_selector_identity("duo")
8218/// .analysis_query_condition_context_access_time(chrono::Utc::now())
8219/// .add_analysis_query_access_selector_roles("sed")
8220/// .add_analysis_query_access_selector_permissions("no")
8221/// .doit().await;
8222/// # }
8223/// ```
8224pub struct MethodAnalyzeIamPolicyCall<'a, C>
8225where
8226 C: 'a,
8227{
8228 hub: &'a CloudAsset<C>,
8229 _scope: String,
8230 _saved_analysis_query: Option<String>,
8231 _execution_timeout: Option<chrono::Duration>,
8232 _analysis_query_resource_selector_full_resource_name: Option<String>,
8233 _analysis_query_options_output_resource_edges: Option<bool>,
8234 _analysis_query_options_output_group_edges: Option<bool>,
8235 _analysis_query_options_expand_roles: Option<bool>,
8236 _analysis_query_options_expand_resources: Option<bool>,
8237 _analysis_query_options_expand_groups: Option<bool>,
8238 _analysis_query_options_analyze_service_account_impersonation: Option<bool>,
8239 _analysis_query_identity_selector_identity: Option<String>,
8240 _analysis_query_condition_context_access_time: Option<chrono::DateTime<chrono::offset::Utc>>,
8241 _analysis_query_access_selector_roles: Vec<String>,
8242 _analysis_query_access_selector_permissions: Vec<String>,
8243 _delegate: Option<&'a mut dyn common::Delegate>,
8244 _additional_params: HashMap<String, String>,
8245 _scopes: BTreeSet<String>,
8246}
8247
8248impl<'a, C> common::CallBuilder for MethodAnalyzeIamPolicyCall<'a, C> {}
8249
8250impl<'a, C> MethodAnalyzeIamPolicyCall<'a, C>
8251where
8252 C: common::Connector,
8253{
8254 /// Perform the operation you have build so far.
8255 pub async fn doit(mut self) -> common::Result<(common::Response, AnalyzeIamPolicyResponse)> {
8256 use std::borrow::Cow;
8257 use std::io::{Read, Seek};
8258
8259 use common::{url::Params, ToParts};
8260 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8261
8262 let mut dd = common::DefaultDelegate;
8263 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8264 dlg.begin(common::MethodInfo {
8265 id: "cloudasset.analyzeIamPolicy",
8266 http_method: hyper::Method::GET,
8267 });
8268
8269 for &field in [
8270 "alt",
8271 "scope",
8272 "savedAnalysisQuery",
8273 "executionTimeout",
8274 "analysisQuery.resourceSelector.fullResourceName",
8275 "analysisQuery.options.outputResourceEdges",
8276 "analysisQuery.options.outputGroupEdges",
8277 "analysisQuery.options.expandRoles",
8278 "analysisQuery.options.expandResources",
8279 "analysisQuery.options.expandGroups",
8280 "analysisQuery.options.analyzeServiceAccountImpersonation",
8281 "analysisQuery.identitySelector.identity",
8282 "analysisQuery.conditionContext.accessTime",
8283 "analysisQuery.accessSelector.roles",
8284 "analysisQuery.accessSelector.permissions",
8285 ]
8286 .iter()
8287 {
8288 if self._additional_params.contains_key(field) {
8289 dlg.finished(false);
8290 return Err(common::Error::FieldClash(field));
8291 }
8292 }
8293
8294 let mut params = Params::with_capacity(16 + self._additional_params.len());
8295 params.push("scope", self._scope);
8296 if let Some(value) = self._saved_analysis_query.as_ref() {
8297 params.push("savedAnalysisQuery", value);
8298 }
8299 if let Some(value) = self._execution_timeout.as_ref() {
8300 params.push(
8301 "executionTimeout",
8302 common::serde::duration::to_string(&value),
8303 );
8304 }
8305 if let Some(value) = self
8306 ._analysis_query_resource_selector_full_resource_name
8307 .as_ref()
8308 {
8309 params.push("analysisQuery.resourceSelector.fullResourceName", value);
8310 }
8311 if let Some(value) = self._analysis_query_options_output_resource_edges.as_ref() {
8312 params.push(
8313 "analysisQuery.options.outputResourceEdges",
8314 value.to_string(),
8315 );
8316 }
8317 if let Some(value) = self._analysis_query_options_output_group_edges.as_ref() {
8318 params.push("analysisQuery.options.outputGroupEdges", value.to_string());
8319 }
8320 if let Some(value) = self._analysis_query_options_expand_roles.as_ref() {
8321 params.push("analysisQuery.options.expandRoles", value.to_string());
8322 }
8323 if let Some(value) = self._analysis_query_options_expand_resources.as_ref() {
8324 params.push("analysisQuery.options.expandResources", value.to_string());
8325 }
8326 if let Some(value) = self._analysis_query_options_expand_groups.as_ref() {
8327 params.push("analysisQuery.options.expandGroups", value.to_string());
8328 }
8329 if let Some(value) = self
8330 ._analysis_query_options_analyze_service_account_impersonation
8331 .as_ref()
8332 {
8333 params.push(
8334 "analysisQuery.options.analyzeServiceAccountImpersonation",
8335 value.to_string(),
8336 );
8337 }
8338 if let Some(value) = self._analysis_query_identity_selector_identity.as_ref() {
8339 params.push("analysisQuery.identitySelector.identity", value);
8340 }
8341 if let Some(value) = self._analysis_query_condition_context_access_time.as_ref() {
8342 params.push(
8343 "analysisQuery.conditionContext.accessTime",
8344 common::serde::datetime_to_string(&value),
8345 );
8346 }
8347 if !self._analysis_query_access_selector_roles.is_empty() {
8348 for f in self._analysis_query_access_selector_roles.iter() {
8349 params.push("analysisQuery.accessSelector.roles", f);
8350 }
8351 }
8352 if !self._analysis_query_access_selector_permissions.is_empty() {
8353 for f in self._analysis_query_access_selector_permissions.iter() {
8354 params.push("analysisQuery.accessSelector.permissions", f);
8355 }
8356 }
8357
8358 params.extend(self._additional_params.iter());
8359
8360 params.push("alt", "json");
8361 let mut url = self.hub._base_url.clone() + "v1/{+scope}:analyzeIamPolicy";
8362 if self._scopes.is_empty() {
8363 self._scopes
8364 .insert(Scope::CloudPlatform.as_ref().to_string());
8365 }
8366
8367 #[allow(clippy::single_element_loop)]
8368 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
8369 url = params.uri_replacement(url, param_name, find_this, true);
8370 }
8371 {
8372 let to_remove = ["scope"];
8373 params.remove_params(&to_remove);
8374 }
8375
8376 let url = params.parse_with_url(&url);
8377
8378 loop {
8379 let token = match self
8380 .hub
8381 .auth
8382 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8383 .await
8384 {
8385 Ok(token) => token,
8386 Err(e) => match dlg.token(e) {
8387 Ok(token) => token,
8388 Err(e) => {
8389 dlg.finished(false);
8390 return Err(common::Error::MissingToken(e));
8391 }
8392 },
8393 };
8394 let mut req_result = {
8395 let client = &self.hub.client;
8396 dlg.pre_request();
8397 let mut req_builder = hyper::Request::builder()
8398 .method(hyper::Method::GET)
8399 .uri(url.as_str())
8400 .header(USER_AGENT, self.hub._user_agent.clone());
8401
8402 if let Some(token) = token.as_ref() {
8403 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8404 }
8405
8406 let request = req_builder
8407 .header(CONTENT_LENGTH, 0_u64)
8408 .body(common::to_body::<String>(None));
8409
8410 client.request(request.unwrap()).await
8411 };
8412
8413 match req_result {
8414 Err(err) => {
8415 if let common::Retry::After(d) = dlg.http_error(&err) {
8416 sleep(d).await;
8417 continue;
8418 }
8419 dlg.finished(false);
8420 return Err(common::Error::HttpError(err));
8421 }
8422 Ok(res) => {
8423 let (mut parts, body) = res.into_parts();
8424 let mut body = common::Body::new(body);
8425 if !parts.status.is_success() {
8426 let bytes = common::to_bytes(body).await.unwrap_or_default();
8427 let error = serde_json::from_str(&common::to_string(&bytes));
8428 let response = common::to_response(parts, bytes.into());
8429
8430 if let common::Retry::After(d) =
8431 dlg.http_failure(&response, error.as_ref().ok())
8432 {
8433 sleep(d).await;
8434 continue;
8435 }
8436
8437 dlg.finished(false);
8438
8439 return Err(match error {
8440 Ok(value) => common::Error::BadRequest(value),
8441 _ => common::Error::Failure(response),
8442 });
8443 }
8444 let response = {
8445 let bytes = common::to_bytes(body).await.unwrap_or_default();
8446 let encoded = common::to_string(&bytes);
8447 match serde_json::from_str(&encoded) {
8448 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8449 Err(error) => {
8450 dlg.response_json_decode_error(&encoded, &error);
8451 return Err(common::Error::JsonDecodeError(
8452 encoded.to_string(),
8453 error,
8454 ));
8455 }
8456 }
8457 };
8458
8459 dlg.finished(true);
8460 return Ok(response);
8461 }
8462 }
8463 }
8464 }
8465
8466 /// Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
8467 ///
8468 /// Sets the *scope* path property to the given value.
8469 ///
8470 /// Even though the property as already been set when instantiating this call,
8471 /// we provide this method for API completeness.
8472 pub fn scope(mut self, new_value: &str) -> MethodAnalyzeIamPolicyCall<'a, C> {
8473 self._scope = new_value.to_string();
8474 self
8475 }
8476 /// Optional. The name of a saved query, which must be in the format of: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id If both `analysis_query` and `saved_analysis_query` are provided, they will be merged together with the `saved_analysis_query` as base and the `analysis_query` as overrides. For more details of the merge behavior, refer to the [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) page. Note that you cannot override primitive fields with default value, such as 0 or empty string, etc., because we use proto3, which doesn't support field presence yet.
8477 ///
8478 /// Sets the *saved analysis query* query property to the given value.
8479 pub fn saved_analysis_query(mut self, new_value: &str) -> MethodAnalyzeIamPolicyCall<'a, C> {
8480 self._saved_analysis_query = Some(new_value.to_string());
8481 self
8482 }
8483 /// Optional. Amount of time executable has to complete. See JSON representation of [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json). If this field is set with a value less than the RPC deadline, and the execution of your query hasn't finished in the specified execution timeout, you will get a response with partial result. Otherwise, your query's execution will continue until the RPC deadline. If it's not finished until then, you will get a DEADLINE_EXCEEDED error. Default is empty.
8484 ///
8485 /// Sets the *execution timeout* query property to the given value.
8486 pub fn execution_timeout(
8487 mut self,
8488 new_value: chrono::Duration,
8489 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8490 self._execution_timeout = Some(new_value);
8491 self
8492 }
8493 /// Required. The [full resource name] (https://cloud.google.com/asset-inventory/docs/resource-name-format) of a resource of [supported resource types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types).
8494 ///
8495 /// Sets the *analysis query.resource selector.full resource name* query property to the given value.
8496 pub fn analysis_query_resource_selector_full_resource_name(
8497 mut self,
8498 new_value: &str,
8499 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8500 self._analysis_query_resource_selector_full_resource_name = Some(new_value.to_string());
8501 self
8502 }
8503 /// Optional. If true, the result will output the relevant parent/child relationships between resources. Default is false.
8504 ///
8505 /// Sets the *analysis query.options.output resource edges* query property to the given value.
8506 pub fn analysis_query_options_output_resource_edges(
8507 mut self,
8508 new_value: bool,
8509 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8510 self._analysis_query_options_output_resource_edges = Some(new_value);
8511 self
8512 }
8513 /// Optional. If true, the result will output the relevant membership relationships between groups and other groups, and between groups and principals. Default is false.
8514 ///
8515 /// Sets the *analysis query.options.output group edges* query property to the given value.
8516 pub fn analysis_query_options_output_group_edges(
8517 mut self,
8518 new_value: bool,
8519 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8520 self._analysis_query_options_output_group_edges = Some(new_value);
8521 self
8522 }
8523 /// Optional. If true, the access section of result will expand any roles appearing in IAM policy bindings to include their permissions. If IamPolicyAnalysisQuery.access_selector is specified, the access section of the result will be determined by the selector, and this flag is not allowed to set. Default is false.
8524 ///
8525 /// Sets the *analysis query.options.expand roles* query property to the given value.
8526 pub fn analysis_query_options_expand_roles(
8527 mut self,
8528 new_value: bool,
8529 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8530 self._analysis_query_options_expand_roles = Some(new_value);
8531 self
8532 }
8533 /// Optional. If true and IamPolicyAnalysisQuery.resource_selector is not specified, the resource section of the result will expand any resource attached to an IAM policy to include resources lower in the resource hierarchy. For example, if the request analyzes for which resources user A has permission P, and the results include an IAM policy with P on a Google Cloud folder, the results will also include resources in that folder with permission P. If true and IamPolicyAnalysisQuery.resource_selector is specified, the resource section of the result will expand the specified resource to include resources lower in the resource hierarchy. Only project or lower resources are supported. Folder and organization resources cannot be used together with this option. For example, if the request analyzes for which users have permission P on a Google Cloud project with this option enabled, the results will include all users who have permission P on that project or any lower resource. If true, the default max expansion per resource is 1000 for AssetService.AnalyzeIamPolicy][] and 100000 for AssetService.AnalyzeIamPolicyLongrunning][]. Default is false.
8534 ///
8535 /// Sets the *analysis query.options.expand resources* query property to the given value.
8536 pub fn analysis_query_options_expand_resources(
8537 mut self,
8538 new_value: bool,
8539 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8540 self._analysis_query_options_expand_resources = Some(new_value);
8541 self
8542 }
8543 /// Optional. If true, the identities section of the result will expand any Google groups appearing in an IAM policy binding. If IamPolicyAnalysisQuery.identity_selector is specified, the identity in the result will be determined by the selector, and this flag is not allowed to set. If true, the default max expansion per group is 1000 for AssetService.AnalyzeIamPolicy][]. Default is false.
8544 ///
8545 /// Sets the *analysis query.options.expand groups* query property to the given value.
8546 pub fn analysis_query_options_expand_groups(
8547 mut self,
8548 new_value: bool,
8549 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8550 self._analysis_query_options_expand_groups = Some(new_value);
8551 self
8552 }
8553 /// Optional. If true, the response will include access analysis from identities to resources via service account impersonation. This is a very expensive operation, because many derived queries will be executed. We highly recommend you use AssetService.AnalyzeIamPolicyLongrunning RPC instead. For example, if the request analyzes for which resources user A has permission P, and there's an IAM policy states user A has iam.serviceAccounts.getAccessToken permission to a service account SA, and there's another IAM policy states service account SA has permission P to a Google Cloud folder F, then user A potentially has access to the Google Cloud folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis. Another example, if the request analyzes for who has permission P to a Google Cloud folder F, and there's an IAM policy states user A has iam.serviceAccounts.actAs permission to a service account SA, and there's another IAM policy states service account SA has permission P to the Google Cloud folder F, then user A potentially has access to the Google Cloud folder F. And those advanced analysis results will be included in AnalyzeIamPolicyResponse.service_account_impersonation_analysis. Only the following permissions are considered in this analysis: * `iam.serviceAccounts.actAs` * `iam.serviceAccounts.signBlob` * `iam.serviceAccounts.signJwt` * `iam.serviceAccounts.getAccessToken` * `iam.serviceAccounts.getOpenIdToken` * `iam.serviceAccounts.implicitDelegation` Default is false.
8554 ///
8555 /// Sets the *analysis query.options.analyze service account impersonation* query property to the given value.
8556 pub fn analysis_query_options_analyze_service_account_impersonation(
8557 mut self,
8558 new_value: bool,
8559 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8560 self._analysis_query_options_analyze_service_account_impersonation = Some(new_value);
8561 self
8562 }
8563 /// Required. The identity appear in the form of principals in [IAM policy binding](https://cloud.google.com/iam/reference/rest/v1/Binding). The examples of supported forms are: "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com". Notice that wildcard characters (such as * and ?) are not supported. You must give a specific identity.
8564 ///
8565 /// Sets the *analysis query.identity selector.identity* query property to the given value.
8566 pub fn analysis_query_identity_selector_identity(
8567 mut self,
8568 new_value: &str,
8569 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8570 self._analysis_query_identity_selector_identity = Some(new_value.to_string());
8571 self
8572 }
8573 /// The hypothetical access timestamp to evaluate IAM conditions. Note that this value must not be earlier than the current time; otherwise, an INVALID_ARGUMENT error will be returned.
8574 ///
8575 /// Sets the *analysis query.condition context.access time* query property to the given value.
8576 pub fn analysis_query_condition_context_access_time(
8577 mut self,
8578 new_value: chrono::DateTime<chrono::offset::Utc>,
8579 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8580 self._analysis_query_condition_context_access_time = Some(new_value);
8581 self
8582 }
8583 /// Optional. The roles to appear in result.
8584 ///
8585 /// Append the given value to the *analysis query.access selector.roles* query property.
8586 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8587 pub fn add_analysis_query_access_selector_roles(
8588 mut self,
8589 new_value: &str,
8590 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8591 self._analysis_query_access_selector_roles
8592 .push(new_value.to_string());
8593 self
8594 }
8595 /// Optional. The permissions to appear in result.
8596 ///
8597 /// Append the given value to the *analysis query.access selector.permissions* query property.
8598 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
8599 pub fn add_analysis_query_access_selector_permissions(
8600 mut self,
8601 new_value: &str,
8602 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8603 self._analysis_query_access_selector_permissions
8604 .push(new_value.to_string());
8605 self
8606 }
8607 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8608 /// while executing the actual API request.
8609 ///
8610 /// ````text
8611 /// It should be used to handle progress information, and to implement a certain level of resilience.
8612 /// ````
8613 ///
8614 /// Sets the *delegate* property to the given value.
8615 pub fn delegate(
8616 mut self,
8617 new_value: &'a mut dyn common::Delegate,
8618 ) -> MethodAnalyzeIamPolicyCall<'a, C> {
8619 self._delegate = Some(new_value);
8620 self
8621 }
8622
8623 /// Set any additional parameter of the query string used in the request.
8624 /// It should be used to set parameters which are not yet available through their own
8625 /// setters.
8626 ///
8627 /// Please note that this method must not be used to set any of the known parameters
8628 /// which have their own setter method. If done anyway, the request will fail.
8629 ///
8630 /// # Additional Parameters
8631 ///
8632 /// * *$.xgafv* (query-string) - V1 error format.
8633 /// * *access_token* (query-string) - OAuth access token.
8634 /// * *alt* (query-string) - Data format for response.
8635 /// * *callback* (query-string) - JSONP
8636 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8637 /// * *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.
8638 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8639 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8640 /// * *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.
8641 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8642 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8643 pub fn param<T>(mut self, name: T, value: T) -> MethodAnalyzeIamPolicyCall<'a, C>
8644 where
8645 T: AsRef<str>,
8646 {
8647 self._additional_params
8648 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8649 self
8650 }
8651
8652 /// Identifies the authorization scope for the method you are building.
8653 ///
8654 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8655 /// [`Scope::CloudPlatform`].
8656 ///
8657 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8658 /// tokens for more than one scope.
8659 ///
8660 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8661 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8662 /// sufficient, a read-write scope will do as well.
8663 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeIamPolicyCall<'a, C>
8664 where
8665 St: AsRef<str>,
8666 {
8667 self._scopes.insert(String::from(scope.as_ref()));
8668 self
8669 }
8670 /// Identifies the authorization scope(s) for the method you are building.
8671 ///
8672 /// See [`Self::add_scope()`] for details.
8673 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodAnalyzeIamPolicyCall<'a, C>
8674 where
8675 I: IntoIterator<Item = St>,
8676 St: AsRef<str>,
8677 {
8678 self._scopes
8679 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8680 self
8681 }
8682
8683 /// Removes all scopes, and no default scope will be used either.
8684 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8685 /// for details).
8686 pub fn clear_scopes(mut self) -> MethodAnalyzeIamPolicyCall<'a, C> {
8687 self._scopes.clear();
8688 self
8689 }
8690}
8691
8692/// Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a AnalyzeIamPolicyResponse. This method implements the google.longrunning.Operation, which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.
8693///
8694/// A builder for the *analyzeIamPolicyLongrunning* method.
8695/// It is not used directly, but through a [`MethodMethods`] instance.
8696///
8697/// # Example
8698///
8699/// Instantiate a resource method builder
8700///
8701/// ```test_harness,no_run
8702/// # extern crate hyper;
8703/// # extern crate hyper_rustls;
8704/// # extern crate google_cloudasset1 as cloudasset1;
8705/// use cloudasset1::api::AnalyzeIamPolicyLongrunningRequest;
8706/// # async fn dox() {
8707/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8708///
8709/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8710/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8711/// # .with_native_roots()
8712/// # .unwrap()
8713/// # .https_only()
8714/// # .enable_http2()
8715/// # .build();
8716///
8717/// # let executor = hyper_util::rt::TokioExecutor::new();
8718/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8719/// # secret,
8720/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8721/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8722/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8723/// # ),
8724/// # ).build().await.unwrap();
8725///
8726/// # let client = hyper_util::client::legacy::Client::builder(
8727/// # hyper_util::rt::TokioExecutor::new()
8728/// # )
8729/// # .build(
8730/// # hyper_rustls::HttpsConnectorBuilder::new()
8731/// # .with_native_roots()
8732/// # .unwrap()
8733/// # .https_or_http()
8734/// # .enable_http2()
8735/// # .build()
8736/// # );
8737/// # let mut hub = CloudAsset::new(client, auth);
8738/// // As the method needs a request, you would usually fill it with the desired information
8739/// // into the respective structure. Some of the parts shown here might not be applicable !
8740/// // Values shown here are possibly random and not representative !
8741/// let mut req = AnalyzeIamPolicyLongrunningRequest::default();
8742///
8743/// // You can configure optional parameters by calling the respective setters at will, and
8744/// // execute the final call using `doit()`.
8745/// // Values shown here are possibly random and not representative !
8746/// let result = hub.methods().analyze_iam_policy_longrunning(req, "scope")
8747/// .doit().await;
8748/// # }
8749/// ```
8750pub struct MethodAnalyzeIamPolicyLongrunningCall<'a, C>
8751where
8752 C: 'a,
8753{
8754 hub: &'a CloudAsset<C>,
8755 _request: AnalyzeIamPolicyLongrunningRequest,
8756 _scope: String,
8757 _delegate: Option<&'a mut dyn common::Delegate>,
8758 _additional_params: HashMap<String, String>,
8759 _scopes: BTreeSet<String>,
8760}
8761
8762impl<'a, C> common::CallBuilder for MethodAnalyzeIamPolicyLongrunningCall<'a, C> {}
8763
8764impl<'a, C> MethodAnalyzeIamPolicyLongrunningCall<'a, C>
8765where
8766 C: common::Connector,
8767{
8768 /// Perform the operation you have build so far.
8769 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8770 use std::borrow::Cow;
8771 use std::io::{Read, Seek};
8772
8773 use common::{url::Params, ToParts};
8774 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8775
8776 let mut dd = common::DefaultDelegate;
8777 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8778 dlg.begin(common::MethodInfo {
8779 id: "cloudasset.analyzeIamPolicyLongrunning",
8780 http_method: hyper::Method::POST,
8781 });
8782
8783 for &field in ["alt", "scope"].iter() {
8784 if self._additional_params.contains_key(field) {
8785 dlg.finished(false);
8786 return Err(common::Error::FieldClash(field));
8787 }
8788 }
8789
8790 let mut params = Params::with_capacity(4 + self._additional_params.len());
8791 params.push("scope", self._scope);
8792
8793 params.extend(self._additional_params.iter());
8794
8795 params.push("alt", "json");
8796 let mut url = self.hub._base_url.clone() + "v1/{+scope}:analyzeIamPolicyLongrunning";
8797 if self._scopes.is_empty() {
8798 self._scopes
8799 .insert(Scope::CloudPlatform.as_ref().to_string());
8800 }
8801
8802 #[allow(clippy::single_element_loop)]
8803 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
8804 url = params.uri_replacement(url, param_name, find_this, true);
8805 }
8806 {
8807 let to_remove = ["scope"];
8808 params.remove_params(&to_remove);
8809 }
8810
8811 let url = params.parse_with_url(&url);
8812
8813 let mut json_mime_type = mime::APPLICATION_JSON;
8814 let mut request_value_reader = {
8815 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8816 common::remove_json_null_values(&mut value);
8817 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8818 serde_json::to_writer(&mut dst, &value).unwrap();
8819 dst
8820 };
8821 let request_size = request_value_reader
8822 .seek(std::io::SeekFrom::End(0))
8823 .unwrap();
8824 request_value_reader
8825 .seek(std::io::SeekFrom::Start(0))
8826 .unwrap();
8827
8828 loop {
8829 let token = match self
8830 .hub
8831 .auth
8832 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8833 .await
8834 {
8835 Ok(token) => token,
8836 Err(e) => match dlg.token(e) {
8837 Ok(token) => token,
8838 Err(e) => {
8839 dlg.finished(false);
8840 return Err(common::Error::MissingToken(e));
8841 }
8842 },
8843 };
8844 request_value_reader
8845 .seek(std::io::SeekFrom::Start(0))
8846 .unwrap();
8847 let mut req_result = {
8848 let client = &self.hub.client;
8849 dlg.pre_request();
8850 let mut req_builder = hyper::Request::builder()
8851 .method(hyper::Method::POST)
8852 .uri(url.as_str())
8853 .header(USER_AGENT, self.hub._user_agent.clone());
8854
8855 if let Some(token) = token.as_ref() {
8856 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8857 }
8858
8859 let request = req_builder
8860 .header(CONTENT_TYPE, json_mime_type.to_string())
8861 .header(CONTENT_LENGTH, request_size as u64)
8862 .body(common::to_body(
8863 request_value_reader.get_ref().clone().into(),
8864 ));
8865
8866 client.request(request.unwrap()).await
8867 };
8868
8869 match req_result {
8870 Err(err) => {
8871 if let common::Retry::After(d) = dlg.http_error(&err) {
8872 sleep(d).await;
8873 continue;
8874 }
8875 dlg.finished(false);
8876 return Err(common::Error::HttpError(err));
8877 }
8878 Ok(res) => {
8879 let (mut parts, body) = res.into_parts();
8880 let mut body = common::Body::new(body);
8881 if !parts.status.is_success() {
8882 let bytes = common::to_bytes(body).await.unwrap_or_default();
8883 let error = serde_json::from_str(&common::to_string(&bytes));
8884 let response = common::to_response(parts, bytes.into());
8885
8886 if let common::Retry::After(d) =
8887 dlg.http_failure(&response, error.as_ref().ok())
8888 {
8889 sleep(d).await;
8890 continue;
8891 }
8892
8893 dlg.finished(false);
8894
8895 return Err(match error {
8896 Ok(value) => common::Error::BadRequest(value),
8897 _ => common::Error::Failure(response),
8898 });
8899 }
8900 let response = {
8901 let bytes = common::to_bytes(body).await.unwrap_or_default();
8902 let encoded = common::to_string(&bytes);
8903 match serde_json::from_str(&encoded) {
8904 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8905 Err(error) => {
8906 dlg.response_json_decode_error(&encoded, &error);
8907 return Err(common::Error::JsonDecodeError(
8908 encoded.to_string(),
8909 error,
8910 ));
8911 }
8912 }
8913 };
8914
8915 dlg.finished(true);
8916 return Ok(response);
8917 }
8918 }
8919 }
8920 }
8921
8922 ///
8923 /// Sets the *request* property to the given value.
8924 ///
8925 /// Even though the property as already been set when instantiating this call,
8926 /// we provide this method for API completeness.
8927 pub fn request(
8928 mut self,
8929 new_value: AnalyzeIamPolicyLongrunningRequest,
8930 ) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C> {
8931 self._request = new_value;
8932 self
8933 }
8934 /// Required. The relative name of the root asset. Only resources and IAM policies within the scope will be analyzed. This can only be an organization number (such as "organizations/123"), a folder number (such as "folders/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"). To know how to get organization ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). To know how to get folder or project ID, visit [here ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
8935 ///
8936 /// Sets the *scope* path property to the given value.
8937 ///
8938 /// Even though the property as already been set when instantiating this call,
8939 /// we provide this method for API completeness.
8940 pub fn scope(mut self, new_value: &str) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C> {
8941 self._scope = new_value.to_string();
8942 self
8943 }
8944 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8945 /// while executing the actual API request.
8946 ///
8947 /// ````text
8948 /// It should be used to handle progress information, and to implement a certain level of resilience.
8949 /// ````
8950 ///
8951 /// Sets the *delegate* property to the given value.
8952 pub fn delegate(
8953 mut self,
8954 new_value: &'a mut dyn common::Delegate,
8955 ) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C> {
8956 self._delegate = Some(new_value);
8957 self
8958 }
8959
8960 /// Set any additional parameter of the query string used in the request.
8961 /// It should be used to set parameters which are not yet available through their own
8962 /// setters.
8963 ///
8964 /// Please note that this method must not be used to set any of the known parameters
8965 /// which have their own setter method. If done anyway, the request will fail.
8966 ///
8967 /// # Additional Parameters
8968 ///
8969 /// * *$.xgafv* (query-string) - V1 error format.
8970 /// * *access_token* (query-string) - OAuth access token.
8971 /// * *alt* (query-string) - Data format for response.
8972 /// * *callback* (query-string) - JSONP
8973 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8974 /// * *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.
8975 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8976 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8977 /// * *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.
8978 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8979 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8980 pub fn param<T>(mut self, name: T, value: T) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C>
8981 where
8982 T: AsRef<str>,
8983 {
8984 self._additional_params
8985 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8986 self
8987 }
8988
8989 /// Identifies the authorization scope for the method you are building.
8990 ///
8991 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8992 /// [`Scope::CloudPlatform`].
8993 ///
8994 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8995 /// tokens for more than one scope.
8996 ///
8997 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8998 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8999 /// sufficient, a read-write scope will do as well.
9000 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C>
9001 where
9002 St: AsRef<str>,
9003 {
9004 self._scopes.insert(String::from(scope.as_ref()));
9005 self
9006 }
9007 /// Identifies the authorization scope(s) for the method you are building.
9008 ///
9009 /// See [`Self::add_scope()`] for details.
9010 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C>
9011 where
9012 I: IntoIterator<Item = St>,
9013 St: AsRef<str>,
9014 {
9015 self._scopes
9016 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9017 self
9018 }
9019
9020 /// Removes all scopes, and no default scope will be used either.
9021 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9022 /// for details).
9023 pub fn clear_scopes(mut self) -> MethodAnalyzeIamPolicyLongrunningCall<'a, C> {
9024 self._scopes.clear();
9025 self
9026 }
9027}
9028
9029/// Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.
9030///
9031/// A builder for the *analyzeMove* method.
9032/// It is not used directly, but through a [`MethodMethods`] instance.
9033///
9034/// # Example
9035///
9036/// Instantiate a resource method builder
9037///
9038/// ```test_harness,no_run
9039/// # extern crate hyper;
9040/// # extern crate hyper_rustls;
9041/// # extern crate google_cloudasset1 as cloudasset1;
9042/// # async fn dox() {
9043/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9044///
9045/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9046/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9047/// # .with_native_roots()
9048/// # .unwrap()
9049/// # .https_only()
9050/// # .enable_http2()
9051/// # .build();
9052///
9053/// # let executor = hyper_util::rt::TokioExecutor::new();
9054/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9055/// # secret,
9056/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9057/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9058/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9059/// # ),
9060/// # ).build().await.unwrap();
9061///
9062/// # let client = hyper_util::client::legacy::Client::builder(
9063/// # hyper_util::rt::TokioExecutor::new()
9064/// # )
9065/// # .build(
9066/// # hyper_rustls::HttpsConnectorBuilder::new()
9067/// # .with_native_roots()
9068/// # .unwrap()
9069/// # .https_or_http()
9070/// # .enable_http2()
9071/// # .build()
9072/// # );
9073/// # let mut hub = CloudAsset::new(client, auth);
9074/// // You can configure optional parameters by calling the respective setters at will, and
9075/// // execute the final call using `doit()`.
9076/// // Values shown here are possibly random and not representative !
9077/// let result = hub.methods().analyze_move("resource")
9078/// .view("et")
9079/// .destination_parent("sed")
9080/// .doit().await;
9081/// # }
9082/// ```
9083pub struct MethodAnalyzeMoveCall<'a, C>
9084where
9085 C: 'a,
9086{
9087 hub: &'a CloudAsset<C>,
9088 _resource: String,
9089 _view: Option<String>,
9090 _destination_parent: Option<String>,
9091 _delegate: Option<&'a mut dyn common::Delegate>,
9092 _additional_params: HashMap<String, String>,
9093 _scopes: BTreeSet<String>,
9094}
9095
9096impl<'a, C> common::CallBuilder for MethodAnalyzeMoveCall<'a, C> {}
9097
9098impl<'a, C> MethodAnalyzeMoveCall<'a, C>
9099where
9100 C: common::Connector,
9101{
9102 /// Perform the operation you have build so far.
9103 pub async fn doit(mut self) -> common::Result<(common::Response, AnalyzeMoveResponse)> {
9104 use std::borrow::Cow;
9105 use std::io::{Read, Seek};
9106
9107 use common::{url::Params, ToParts};
9108 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9109
9110 let mut dd = common::DefaultDelegate;
9111 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9112 dlg.begin(common::MethodInfo {
9113 id: "cloudasset.analyzeMove",
9114 http_method: hyper::Method::GET,
9115 });
9116
9117 for &field in ["alt", "resource", "view", "destinationParent"].iter() {
9118 if self._additional_params.contains_key(field) {
9119 dlg.finished(false);
9120 return Err(common::Error::FieldClash(field));
9121 }
9122 }
9123
9124 let mut params = Params::with_capacity(5 + self._additional_params.len());
9125 params.push("resource", self._resource);
9126 if let Some(value) = self._view.as_ref() {
9127 params.push("view", value);
9128 }
9129 if let Some(value) = self._destination_parent.as_ref() {
9130 params.push("destinationParent", value);
9131 }
9132
9133 params.extend(self._additional_params.iter());
9134
9135 params.push("alt", "json");
9136 let mut url = self.hub._base_url.clone() + "v1/{+resource}:analyzeMove";
9137 if self._scopes.is_empty() {
9138 self._scopes
9139 .insert(Scope::CloudPlatform.as_ref().to_string());
9140 }
9141
9142 #[allow(clippy::single_element_loop)]
9143 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9144 url = params.uri_replacement(url, param_name, find_this, true);
9145 }
9146 {
9147 let to_remove = ["resource"];
9148 params.remove_params(&to_remove);
9149 }
9150
9151 let url = params.parse_with_url(&url);
9152
9153 loop {
9154 let token = match self
9155 .hub
9156 .auth
9157 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9158 .await
9159 {
9160 Ok(token) => token,
9161 Err(e) => match dlg.token(e) {
9162 Ok(token) => token,
9163 Err(e) => {
9164 dlg.finished(false);
9165 return Err(common::Error::MissingToken(e));
9166 }
9167 },
9168 };
9169 let mut req_result = {
9170 let client = &self.hub.client;
9171 dlg.pre_request();
9172 let mut req_builder = hyper::Request::builder()
9173 .method(hyper::Method::GET)
9174 .uri(url.as_str())
9175 .header(USER_AGENT, self.hub._user_agent.clone());
9176
9177 if let Some(token) = token.as_ref() {
9178 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9179 }
9180
9181 let request = req_builder
9182 .header(CONTENT_LENGTH, 0_u64)
9183 .body(common::to_body::<String>(None));
9184
9185 client.request(request.unwrap()).await
9186 };
9187
9188 match req_result {
9189 Err(err) => {
9190 if let common::Retry::After(d) = dlg.http_error(&err) {
9191 sleep(d).await;
9192 continue;
9193 }
9194 dlg.finished(false);
9195 return Err(common::Error::HttpError(err));
9196 }
9197 Ok(res) => {
9198 let (mut parts, body) = res.into_parts();
9199 let mut body = common::Body::new(body);
9200 if !parts.status.is_success() {
9201 let bytes = common::to_bytes(body).await.unwrap_or_default();
9202 let error = serde_json::from_str(&common::to_string(&bytes));
9203 let response = common::to_response(parts, bytes.into());
9204
9205 if let common::Retry::After(d) =
9206 dlg.http_failure(&response, error.as_ref().ok())
9207 {
9208 sleep(d).await;
9209 continue;
9210 }
9211
9212 dlg.finished(false);
9213
9214 return Err(match error {
9215 Ok(value) => common::Error::BadRequest(value),
9216 _ => common::Error::Failure(response),
9217 });
9218 }
9219 let response = {
9220 let bytes = common::to_bytes(body).await.unwrap_or_default();
9221 let encoded = common::to_string(&bytes);
9222 match serde_json::from_str(&encoded) {
9223 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9224 Err(error) => {
9225 dlg.response_json_decode_error(&encoded, &error);
9226 return Err(common::Error::JsonDecodeError(
9227 encoded.to_string(),
9228 error,
9229 ));
9230 }
9231 }
9232 };
9233
9234 dlg.finished(true);
9235 return Ok(response);
9236 }
9237 }
9238 }
9239 }
9240
9241 /// Required. Name of the resource to perform the analysis against. Only Google Cloud projects are supported as of today. Hence, this can only be a project ID (such as "projects/my-project-id") or a project number (such as "projects/12345").
9242 ///
9243 /// Sets the *resource* path property to the given value.
9244 ///
9245 /// Even though the property as already been set when instantiating this call,
9246 /// we provide this method for API completeness.
9247 pub fn resource(mut self, new_value: &str) -> MethodAnalyzeMoveCall<'a, C> {
9248 self._resource = new_value.to_string();
9249 self
9250 }
9251 /// Analysis view indicating what information should be included in the analysis response. If unspecified, the default view is FULL.
9252 ///
9253 /// Sets the *view* query property to the given value.
9254 pub fn view(mut self, new_value: &str) -> MethodAnalyzeMoveCall<'a, C> {
9255 self._view = Some(new_value.to_string());
9256 self
9257 }
9258 /// Required. Name of the Google Cloud folder or organization to reparent the target resource. The analysis will be performed against hypothetically moving the resource to this specified destination parent. This can only be a folder number (such as "folders/123") or an organization number (such as "organizations/123").
9259 ///
9260 /// Sets the *destination parent* query property to the given value.
9261 pub fn destination_parent(mut self, new_value: &str) -> MethodAnalyzeMoveCall<'a, C> {
9262 self._destination_parent = Some(new_value.to_string());
9263 self
9264 }
9265 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9266 /// while executing the actual API request.
9267 ///
9268 /// ````text
9269 /// It should be used to handle progress information, and to implement a certain level of resilience.
9270 /// ````
9271 ///
9272 /// Sets the *delegate* property to the given value.
9273 pub fn delegate(
9274 mut self,
9275 new_value: &'a mut dyn common::Delegate,
9276 ) -> MethodAnalyzeMoveCall<'a, C> {
9277 self._delegate = Some(new_value);
9278 self
9279 }
9280
9281 /// Set any additional parameter of the query string used in the request.
9282 /// It should be used to set parameters which are not yet available through their own
9283 /// setters.
9284 ///
9285 /// Please note that this method must not be used to set any of the known parameters
9286 /// which have their own setter method. If done anyway, the request will fail.
9287 ///
9288 /// # Additional Parameters
9289 ///
9290 /// * *$.xgafv* (query-string) - V1 error format.
9291 /// * *access_token* (query-string) - OAuth access token.
9292 /// * *alt* (query-string) - Data format for response.
9293 /// * *callback* (query-string) - JSONP
9294 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9295 /// * *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.
9296 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9297 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9298 /// * *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.
9299 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9300 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9301 pub fn param<T>(mut self, name: T, value: T) -> MethodAnalyzeMoveCall<'a, C>
9302 where
9303 T: AsRef<str>,
9304 {
9305 self._additional_params
9306 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9307 self
9308 }
9309
9310 /// Identifies the authorization scope for the method you are building.
9311 ///
9312 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9313 /// [`Scope::CloudPlatform`].
9314 ///
9315 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9316 /// tokens for more than one scope.
9317 ///
9318 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9319 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9320 /// sufficient, a read-write scope will do as well.
9321 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeMoveCall<'a, C>
9322 where
9323 St: AsRef<str>,
9324 {
9325 self._scopes.insert(String::from(scope.as_ref()));
9326 self
9327 }
9328 /// Identifies the authorization scope(s) for the method you are building.
9329 ///
9330 /// See [`Self::add_scope()`] for details.
9331 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodAnalyzeMoveCall<'a, C>
9332 where
9333 I: IntoIterator<Item = St>,
9334 St: AsRef<str>,
9335 {
9336 self._scopes
9337 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9338 self
9339 }
9340
9341 /// Removes all scopes, and no default scope will be used either.
9342 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9343 /// for details).
9344 pub fn clear_scopes(mut self) -> MethodAnalyzeMoveCall<'a, C> {
9345 self._scopes.clear();
9346 self
9347 }
9348}
9349
9350/// Analyzes organization policies under a scope.
9351///
9352/// A builder for the *analyzeOrgPolicies* method.
9353/// It is not used directly, but through a [`MethodMethods`] instance.
9354///
9355/// # Example
9356///
9357/// Instantiate a resource method builder
9358///
9359/// ```test_harness,no_run
9360/// # extern crate hyper;
9361/// # extern crate hyper_rustls;
9362/// # extern crate google_cloudasset1 as cloudasset1;
9363/// # async fn dox() {
9364/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9365///
9366/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9367/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9368/// # .with_native_roots()
9369/// # .unwrap()
9370/// # .https_only()
9371/// # .enable_http2()
9372/// # .build();
9373///
9374/// # let executor = hyper_util::rt::TokioExecutor::new();
9375/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9376/// # secret,
9377/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9378/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9379/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9380/// # ),
9381/// # ).build().await.unwrap();
9382///
9383/// # let client = hyper_util::client::legacy::Client::builder(
9384/// # hyper_util::rt::TokioExecutor::new()
9385/// # )
9386/// # .build(
9387/// # hyper_rustls::HttpsConnectorBuilder::new()
9388/// # .with_native_roots()
9389/// # .unwrap()
9390/// # .https_or_http()
9391/// # .enable_http2()
9392/// # .build()
9393/// # );
9394/// # let mut hub = CloudAsset::new(client, auth);
9395/// // You can configure optional parameters by calling the respective setters at will, and
9396/// // execute the final call using `doit()`.
9397/// // Values shown here are possibly random and not representative !
9398/// let result = hub.methods().analyze_org_policies("scope")
9399/// .page_token("et")
9400/// .page_size(-76)
9401/// .filter("erat")
9402/// .constraint("sed")
9403/// .doit().await;
9404/// # }
9405/// ```
9406pub struct MethodAnalyzeOrgPolicyCall<'a, C>
9407where
9408 C: 'a,
9409{
9410 hub: &'a CloudAsset<C>,
9411 _scope: String,
9412 _page_token: Option<String>,
9413 _page_size: Option<i32>,
9414 _filter: Option<String>,
9415 _constraint: Option<String>,
9416 _delegate: Option<&'a mut dyn common::Delegate>,
9417 _additional_params: HashMap<String, String>,
9418 _scopes: BTreeSet<String>,
9419}
9420
9421impl<'a, C> common::CallBuilder for MethodAnalyzeOrgPolicyCall<'a, C> {}
9422
9423impl<'a, C> MethodAnalyzeOrgPolicyCall<'a, C>
9424where
9425 C: common::Connector,
9426{
9427 /// Perform the operation you have build so far.
9428 pub async fn doit(mut self) -> common::Result<(common::Response, AnalyzeOrgPoliciesResponse)> {
9429 use std::borrow::Cow;
9430 use std::io::{Read, Seek};
9431
9432 use common::{url::Params, ToParts};
9433 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9434
9435 let mut dd = common::DefaultDelegate;
9436 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9437 dlg.begin(common::MethodInfo {
9438 id: "cloudasset.analyzeOrgPolicies",
9439 http_method: hyper::Method::GET,
9440 });
9441
9442 for &field in [
9443 "alt",
9444 "scope",
9445 "pageToken",
9446 "pageSize",
9447 "filter",
9448 "constraint",
9449 ]
9450 .iter()
9451 {
9452 if self._additional_params.contains_key(field) {
9453 dlg.finished(false);
9454 return Err(common::Error::FieldClash(field));
9455 }
9456 }
9457
9458 let mut params = Params::with_capacity(7 + self._additional_params.len());
9459 params.push("scope", self._scope);
9460 if let Some(value) = self._page_token.as_ref() {
9461 params.push("pageToken", value);
9462 }
9463 if let Some(value) = self._page_size.as_ref() {
9464 params.push("pageSize", value.to_string());
9465 }
9466 if let Some(value) = self._filter.as_ref() {
9467 params.push("filter", value);
9468 }
9469 if let Some(value) = self._constraint.as_ref() {
9470 params.push("constraint", value);
9471 }
9472
9473 params.extend(self._additional_params.iter());
9474
9475 params.push("alt", "json");
9476 let mut url = self.hub._base_url.clone() + "v1/{+scope}:analyzeOrgPolicies";
9477 if self._scopes.is_empty() {
9478 self._scopes
9479 .insert(Scope::CloudPlatform.as_ref().to_string());
9480 }
9481
9482 #[allow(clippy::single_element_loop)]
9483 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
9484 url = params.uri_replacement(url, param_name, find_this, true);
9485 }
9486 {
9487 let to_remove = ["scope"];
9488 params.remove_params(&to_remove);
9489 }
9490
9491 let url = params.parse_with_url(&url);
9492
9493 loop {
9494 let token = match self
9495 .hub
9496 .auth
9497 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9498 .await
9499 {
9500 Ok(token) => token,
9501 Err(e) => match dlg.token(e) {
9502 Ok(token) => token,
9503 Err(e) => {
9504 dlg.finished(false);
9505 return Err(common::Error::MissingToken(e));
9506 }
9507 },
9508 };
9509 let mut req_result = {
9510 let client = &self.hub.client;
9511 dlg.pre_request();
9512 let mut req_builder = hyper::Request::builder()
9513 .method(hyper::Method::GET)
9514 .uri(url.as_str())
9515 .header(USER_AGENT, self.hub._user_agent.clone());
9516
9517 if let Some(token) = token.as_ref() {
9518 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9519 }
9520
9521 let request = req_builder
9522 .header(CONTENT_LENGTH, 0_u64)
9523 .body(common::to_body::<String>(None));
9524
9525 client.request(request.unwrap()).await
9526 };
9527
9528 match req_result {
9529 Err(err) => {
9530 if let common::Retry::After(d) = dlg.http_error(&err) {
9531 sleep(d).await;
9532 continue;
9533 }
9534 dlg.finished(false);
9535 return Err(common::Error::HttpError(err));
9536 }
9537 Ok(res) => {
9538 let (mut parts, body) = res.into_parts();
9539 let mut body = common::Body::new(body);
9540 if !parts.status.is_success() {
9541 let bytes = common::to_bytes(body).await.unwrap_or_default();
9542 let error = serde_json::from_str(&common::to_string(&bytes));
9543 let response = common::to_response(parts, bytes.into());
9544
9545 if let common::Retry::After(d) =
9546 dlg.http_failure(&response, error.as_ref().ok())
9547 {
9548 sleep(d).await;
9549 continue;
9550 }
9551
9552 dlg.finished(false);
9553
9554 return Err(match error {
9555 Ok(value) => common::Error::BadRequest(value),
9556 _ => common::Error::Failure(response),
9557 });
9558 }
9559 let response = {
9560 let bytes = common::to_bytes(body).await.unwrap_or_default();
9561 let encoded = common::to_string(&bytes);
9562 match serde_json::from_str(&encoded) {
9563 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9564 Err(error) => {
9565 dlg.response_json_decode_error(&encoded, &error);
9566 return Err(common::Error::JsonDecodeError(
9567 encoded.to_string(),
9568 error,
9569 ));
9570 }
9571 }
9572 };
9573
9574 dlg.finished(true);
9575 return Ok(response);
9576 }
9577 }
9578 }
9579 }
9580
9581 /// Required. The organization to scope the request. Only organization policies within the scope will be analyzed. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
9582 ///
9583 /// Sets the *scope* path property to the given value.
9584 ///
9585 /// Even though the property as already been set when instantiating this call,
9586 /// we provide this method for API completeness.
9587 pub fn scope(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9588 self._scope = new_value.to_string();
9589 self
9590 }
9591 /// The pagination token to retrieve the next page.
9592 ///
9593 /// Sets the *page token* query property to the given value.
9594 pub fn page_token(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9595 self._page_token = Some(new_value.to_string());
9596 self
9597 }
9598 /// The maximum number of items to return per page. If unspecified, AnalyzeOrgPoliciesResponse.org_policy_results will contain 20 items with a maximum of 200.
9599 ///
9600 /// Sets the *page size* query property to the given value.
9601 pub fn page_size(mut self, new_value: i32) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9602 self._page_size = Some(new_value);
9603 self
9604 }
9605 /// The expression to filter AnalyzeOrgPoliciesResponse.org_policy_results. Filtering is currently available for bare literal values and the following fields: * consolidated_policy.attached_resource * consolidated_policy.rules.enforce When filtering by a specific field, the only supported operator is `=`. For example, filtering by consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001" will return all the Organization Policy results attached to "folders/001".
9606 ///
9607 /// Sets the *filter* query property to the given value.
9608 pub fn filter(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9609 self._filter = Some(new_value.to_string());
9610 self
9611 }
9612 /// Required. The name of the constraint to analyze organization policies for. The response only contains analyzed organization policies for the provided constraint.
9613 ///
9614 /// Sets the *constraint* query property to the given value.
9615 pub fn constraint(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9616 self._constraint = Some(new_value.to_string());
9617 self
9618 }
9619 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9620 /// while executing the actual API request.
9621 ///
9622 /// ````text
9623 /// It should be used to handle progress information, and to implement a certain level of resilience.
9624 /// ````
9625 ///
9626 /// Sets the *delegate* property to the given value.
9627 pub fn delegate(
9628 mut self,
9629 new_value: &'a mut dyn common::Delegate,
9630 ) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9631 self._delegate = Some(new_value);
9632 self
9633 }
9634
9635 /// Set any additional parameter of the query string used in the request.
9636 /// It should be used to set parameters which are not yet available through their own
9637 /// setters.
9638 ///
9639 /// Please note that this method must not be used to set any of the known parameters
9640 /// which have their own setter method. If done anyway, the request will fail.
9641 ///
9642 /// # Additional Parameters
9643 ///
9644 /// * *$.xgafv* (query-string) - V1 error format.
9645 /// * *access_token* (query-string) - OAuth access token.
9646 /// * *alt* (query-string) - Data format for response.
9647 /// * *callback* (query-string) - JSONP
9648 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9649 /// * *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.
9650 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9651 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9652 /// * *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.
9653 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9654 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9655 pub fn param<T>(mut self, name: T, value: T) -> MethodAnalyzeOrgPolicyCall<'a, C>
9656 where
9657 T: AsRef<str>,
9658 {
9659 self._additional_params
9660 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9661 self
9662 }
9663
9664 /// Identifies the authorization scope for the method you are building.
9665 ///
9666 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9667 /// [`Scope::CloudPlatform`].
9668 ///
9669 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9670 /// tokens for more than one scope.
9671 ///
9672 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9673 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9674 /// sufficient, a read-write scope will do as well.
9675 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeOrgPolicyCall<'a, C>
9676 where
9677 St: AsRef<str>,
9678 {
9679 self._scopes.insert(String::from(scope.as_ref()));
9680 self
9681 }
9682 /// Identifies the authorization scope(s) for the method you are building.
9683 ///
9684 /// See [`Self::add_scope()`] for details.
9685 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodAnalyzeOrgPolicyCall<'a, C>
9686 where
9687 I: IntoIterator<Item = St>,
9688 St: AsRef<str>,
9689 {
9690 self._scopes
9691 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9692 self
9693 }
9694
9695 /// Removes all scopes, and no default scope will be used either.
9696 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9697 /// for details).
9698 pub fn clear_scopes(mut self) -> MethodAnalyzeOrgPolicyCall<'a, C> {
9699 self._scopes.clear();
9700 self
9701 }
9702}
9703
9704/// Analyzes organization policies governed assets (Google Cloud resources or policies) under a scope. This RPC supports custom constraints and the following canned constraints: * constraints/ainotebooks.accessMode * constraints/ainotebooks.disableFileDownloads * constraints/ainotebooks.disableRootAccess * constraints/ainotebooks.disableTerminal * constraints/ainotebooks.environmentOptions * constraints/ainotebooks.requireAutoUpgradeSchedule * constraints/ainotebooks.restrictVpcNetworks * constraints/compute.disableGuestAttributesAccess * constraints/compute.disableInstanceDataAccessApis * constraints/compute.disableNestedVirtualization * constraints/compute.disableSerialPortAccess * constraints/compute.disableSerialPortLogging * constraints/compute.disableVpcExternalIpv6 * constraints/compute.requireOsLogin * constraints/compute.requireShieldedVm * constraints/compute.restrictLoadBalancerCreationForTypes * constraints/compute.restrictProtocolForwardingCreationForTypes * constraints/compute.restrictXpnProjectLienRemoval * constraints/compute.setNewProjectDefaultToZonalDNSOnly * constraints/compute.skipDefaultNetworkCreation * constraints/compute.trustedImageProjects * constraints/compute.vmCanIpForward * constraints/compute.vmExternalIpAccess * constraints/gcp.detailedAuditLoggingMode * constraints/gcp.resourceLocations * constraints/iam.allowedPolicyMemberDomains * constraints/iam.automaticIamGrantsForDefaultServiceAccounts * constraints/iam.disableServiceAccountCreation * constraints/iam.disableServiceAccountKeyCreation * constraints/iam.disableServiceAccountKeyUpload * constraints/iam.restrictCrossProjectServiceAccountLienRemoval * constraints/iam.serviceAccountKeyExpiryHours * constraints/resourcemanager.accessBoundaries * constraints/resourcemanager.allowedExportDestinations * constraints/sql.restrictAuthorizedNetworks * constraints/sql.restrictNoncompliantDiagnosticDataAccess * constraints/sql.restrictNoncompliantResourceCreation * constraints/sql.restrictPublicIp * constraints/storage.publicAccessPrevention * constraints/storage.restrictAuthTypes * constraints/storage.uniformBucketLevelAccess This RPC only returns either resources of types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) or IAM policies.
9705///
9706/// A builder for the *analyzeOrgPolicyGovernedAssets* method.
9707/// It is not used directly, but through a [`MethodMethods`] instance.
9708///
9709/// # Example
9710///
9711/// Instantiate a resource method builder
9712///
9713/// ```test_harness,no_run
9714/// # extern crate hyper;
9715/// # extern crate hyper_rustls;
9716/// # extern crate google_cloudasset1 as cloudasset1;
9717/// # async fn dox() {
9718/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9719///
9720/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9721/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9722/// # .with_native_roots()
9723/// # .unwrap()
9724/// # .https_only()
9725/// # .enable_http2()
9726/// # .build();
9727///
9728/// # let executor = hyper_util::rt::TokioExecutor::new();
9729/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9730/// # secret,
9731/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9732/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9733/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9734/// # ),
9735/// # ).build().await.unwrap();
9736///
9737/// # let client = hyper_util::client::legacy::Client::builder(
9738/// # hyper_util::rt::TokioExecutor::new()
9739/// # )
9740/// # .build(
9741/// # hyper_rustls::HttpsConnectorBuilder::new()
9742/// # .with_native_roots()
9743/// # .unwrap()
9744/// # .https_or_http()
9745/// # .enable_http2()
9746/// # .build()
9747/// # );
9748/// # let mut hub = CloudAsset::new(client, auth);
9749/// // You can configure optional parameters by calling the respective setters at will, and
9750/// // execute the final call using `doit()`.
9751/// // Values shown here are possibly random and not representative !
9752/// let result = hub.methods().analyze_org_policy_governed_assets("scope")
9753/// .page_token("dolore")
9754/// .page_size(-22)
9755/// .filter("voluptua.")
9756/// .constraint("amet.")
9757/// .doit().await;
9758/// # }
9759/// ```
9760pub struct MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C>
9761where
9762 C: 'a,
9763{
9764 hub: &'a CloudAsset<C>,
9765 _scope: String,
9766 _page_token: Option<String>,
9767 _page_size: Option<i32>,
9768 _filter: Option<String>,
9769 _constraint: Option<String>,
9770 _delegate: Option<&'a mut dyn common::Delegate>,
9771 _additional_params: HashMap<String, String>,
9772 _scopes: BTreeSet<String>,
9773}
9774
9775impl<'a, C> common::CallBuilder for MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {}
9776
9777impl<'a, C> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C>
9778where
9779 C: common::Connector,
9780{
9781 /// Perform the operation you have build so far.
9782 pub async fn doit(
9783 mut self,
9784 ) -> common::Result<(common::Response, AnalyzeOrgPolicyGovernedAssetsResponse)> {
9785 use std::borrow::Cow;
9786 use std::io::{Read, Seek};
9787
9788 use common::{url::Params, ToParts};
9789 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9790
9791 let mut dd = common::DefaultDelegate;
9792 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9793 dlg.begin(common::MethodInfo {
9794 id: "cloudasset.analyzeOrgPolicyGovernedAssets",
9795 http_method: hyper::Method::GET,
9796 });
9797
9798 for &field in [
9799 "alt",
9800 "scope",
9801 "pageToken",
9802 "pageSize",
9803 "filter",
9804 "constraint",
9805 ]
9806 .iter()
9807 {
9808 if self._additional_params.contains_key(field) {
9809 dlg.finished(false);
9810 return Err(common::Error::FieldClash(field));
9811 }
9812 }
9813
9814 let mut params = Params::with_capacity(7 + self._additional_params.len());
9815 params.push("scope", self._scope);
9816 if let Some(value) = self._page_token.as_ref() {
9817 params.push("pageToken", value);
9818 }
9819 if let Some(value) = self._page_size.as_ref() {
9820 params.push("pageSize", value.to_string());
9821 }
9822 if let Some(value) = self._filter.as_ref() {
9823 params.push("filter", value);
9824 }
9825 if let Some(value) = self._constraint.as_ref() {
9826 params.push("constraint", value);
9827 }
9828
9829 params.extend(self._additional_params.iter());
9830
9831 params.push("alt", "json");
9832 let mut url = self.hub._base_url.clone() + "v1/{+scope}:analyzeOrgPolicyGovernedAssets";
9833 if self._scopes.is_empty() {
9834 self._scopes
9835 .insert(Scope::CloudPlatform.as_ref().to_string());
9836 }
9837
9838 #[allow(clippy::single_element_loop)]
9839 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
9840 url = params.uri_replacement(url, param_name, find_this, true);
9841 }
9842 {
9843 let to_remove = ["scope"];
9844 params.remove_params(&to_remove);
9845 }
9846
9847 let url = params.parse_with_url(&url);
9848
9849 loop {
9850 let token = match self
9851 .hub
9852 .auth
9853 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9854 .await
9855 {
9856 Ok(token) => token,
9857 Err(e) => match dlg.token(e) {
9858 Ok(token) => token,
9859 Err(e) => {
9860 dlg.finished(false);
9861 return Err(common::Error::MissingToken(e));
9862 }
9863 },
9864 };
9865 let mut req_result = {
9866 let client = &self.hub.client;
9867 dlg.pre_request();
9868 let mut req_builder = hyper::Request::builder()
9869 .method(hyper::Method::GET)
9870 .uri(url.as_str())
9871 .header(USER_AGENT, self.hub._user_agent.clone());
9872
9873 if let Some(token) = token.as_ref() {
9874 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9875 }
9876
9877 let request = req_builder
9878 .header(CONTENT_LENGTH, 0_u64)
9879 .body(common::to_body::<String>(None));
9880
9881 client.request(request.unwrap()).await
9882 };
9883
9884 match req_result {
9885 Err(err) => {
9886 if let common::Retry::After(d) = dlg.http_error(&err) {
9887 sleep(d).await;
9888 continue;
9889 }
9890 dlg.finished(false);
9891 return Err(common::Error::HttpError(err));
9892 }
9893 Ok(res) => {
9894 let (mut parts, body) = res.into_parts();
9895 let mut body = common::Body::new(body);
9896 if !parts.status.is_success() {
9897 let bytes = common::to_bytes(body).await.unwrap_or_default();
9898 let error = serde_json::from_str(&common::to_string(&bytes));
9899 let response = common::to_response(parts, bytes.into());
9900
9901 if let common::Retry::After(d) =
9902 dlg.http_failure(&response, error.as_ref().ok())
9903 {
9904 sleep(d).await;
9905 continue;
9906 }
9907
9908 dlg.finished(false);
9909
9910 return Err(match error {
9911 Ok(value) => common::Error::BadRequest(value),
9912 _ => common::Error::Failure(response),
9913 });
9914 }
9915 let response = {
9916 let bytes = common::to_bytes(body).await.unwrap_or_default();
9917 let encoded = common::to_string(&bytes);
9918 match serde_json::from_str(&encoded) {
9919 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9920 Err(error) => {
9921 dlg.response_json_decode_error(&encoded, &error);
9922 return Err(common::Error::JsonDecodeError(
9923 encoded.to_string(),
9924 error,
9925 ));
9926 }
9927 }
9928 };
9929
9930 dlg.finished(true);
9931 return Ok(response);
9932 }
9933 }
9934 }
9935 }
9936
9937 /// Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output assets will also be limited to the ones governed by those in-scope organization policies. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
9938 ///
9939 /// Sets the *scope* path property to the given value.
9940 ///
9941 /// Even though the property as already been set when instantiating this call,
9942 /// we provide this method for API completeness.
9943 pub fn scope(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9944 self._scope = new_value.to_string();
9945 self
9946 }
9947 /// The pagination token to retrieve the next page.
9948 ///
9949 /// Sets the *page token* query property to the given value.
9950 pub fn page_token(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9951 self._page_token = Some(new_value.to_string());
9952 self
9953 }
9954 /// The maximum number of items to return per page. If unspecified, AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets will contain 100 items with a maximum of 200.
9955 ///
9956 /// Sets the *page size* query property to the given value.
9957 pub fn page_size(mut self, new_value: i32) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9958 self._page_size = Some(new_value);
9959 self
9960 }
9961 /// The expression to filter AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets. For governed resources, filtering is currently available for bare literal values and the following fields: * governed_resource.project * governed_resource.folders * consolidated_policy.rules.enforce When filtering by `governed_resource.project` or `consolidated_policy.rules.enforce`, the only supported operator is `=`. When filtering by `governed_resource.folders`, the supported operators are `=` and `:`. For example, filtering by `governed_resource.project="projects/12345678"` will return all the governed resources under "projects/12345678", including the project itself if applicable. For governed IAM policies, filtering is currently available for bare literal values and the following fields: * governed_iam_policy.project * governed_iam_policy.folders * consolidated_policy.rules.enforce When filtering by `governed_iam_policy.project` or `consolidated_policy.rules.enforce`, the only supported operator is `=`. When filtering by `governed_iam_policy.folders`, the supported operators are `=` and `:`. For example, filtering by `governed_iam_policy.folders:"folders/12345678"` will return all the governed IAM policies under "folders/001".
9962 ///
9963 /// Sets the *filter* query property to the given value.
9964 pub fn filter(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9965 self._filter = Some(new_value.to_string());
9966 self
9967 }
9968 /// Required. The name of the constraint to analyze governed assets for. The analysis only contains analyzed organization policies for the provided constraint.
9969 ///
9970 /// Sets the *constraint* query property to the given value.
9971 pub fn constraint(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9972 self._constraint = Some(new_value.to_string());
9973 self
9974 }
9975 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9976 /// while executing the actual API request.
9977 ///
9978 /// ````text
9979 /// It should be used to handle progress information, and to implement a certain level of resilience.
9980 /// ````
9981 ///
9982 /// Sets the *delegate* property to the given value.
9983 pub fn delegate(
9984 mut self,
9985 new_value: &'a mut dyn common::Delegate,
9986 ) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
9987 self._delegate = Some(new_value);
9988 self
9989 }
9990
9991 /// Set any additional parameter of the query string used in the request.
9992 /// It should be used to set parameters which are not yet available through their own
9993 /// setters.
9994 ///
9995 /// Please note that this method must not be used to set any of the known parameters
9996 /// which have their own setter method. If done anyway, the request will fail.
9997 ///
9998 /// # Additional Parameters
9999 ///
10000 /// * *$.xgafv* (query-string) - V1 error format.
10001 /// * *access_token* (query-string) - OAuth access token.
10002 /// * *alt* (query-string) - Data format for response.
10003 /// * *callback* (query-string) - JSONP
10004 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10005 /// * *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.
10006 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10007 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10008 /// * *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.
10009 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10010 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10011 pub fn param<T>(mut self, name: T, value: T) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C>
10012 where
10013 T: AsRef<str>,
10014 {
10015 self._additional_params
10016 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10017 self
10018 }
10019
10020 /// Identifies the authorization scope for the method you are building.
10021 ///
10022 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10023 /// [`Scope::CloudPlatform`].
10024 ///
10025 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10026 /// tokens for more than one scope.
10027 ///
10028 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10029 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10030 /// sufficient, a read-write scope will do as well.
10031 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C>
10032 where
10033 St: AsRef<str>,
10034 {
10035 self._scopes.insert(String::from(scope.as_ref()));
10036 self
10037 }
10038 /// Identifies the authorization scope(s) for the method you are building.
10039 ///
10040 /// See [`Self::add_scope()`] for details.
10041 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C>
10042 where
10043 I: IntoIterator<Item = St>,
10044 St: AsRef<str>,
10045 {
10046 self._scopes
10047 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10048 self
10049 }
10050
10051 /// Removes all scopes, and no default scope will be used either.
10052 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10053 /// for details).
10054 pub fn clear_scopes(mut self) -> MethodAnalyzeOrgPolicyGovernedAssetCall<'a, C> {
10055 self._scopes.clear();
10056 self
10057 }
10058}
10059
10060/// Analyzes organization policies governed containers (projects, folders or organization) under a scope.
10061///
10062/// A builder for the *analyzeOrgPolicyGovernedContainers* method.
10063/// It is not used directly, but through a [`MethodMethods`] instance.
10064///
10065/// # Example
10066///
10067/// Instantiate a resource method builder
10068///
10069/// ```test_harness,no_run
10070/// # extern crate hyper;
10071/// # extern crate hyper_rustls;
10072/// # extern crate google_cloudasset1 as cloudasset1;
10073/// # async fn dox() {
10074/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10075///
10076/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10077/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10078/// # .with_native_roots()
10079/// # .unwrap()
10080/// # .https_only()
10081/// # .enable_http2()
10082/// # .build();
10083///
10084/// # let executor = hyper_util::rt::TokioExecutor::new();
10085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10086/// # secret,
10087/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10088/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10089/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10090/// # ),
10091/// # ).build().await.unwrap();
10092///
10093/// # let client = hyper_util::client::legacy::Client::builder(
10094/// # hyper_util::rt::TokioExecutor::new()
10095/// # )
10096/// # .build(
10097/// # hyper_rustls::HttpsConnectorBuilder::new()
10098/// # .with_native_roots()
10099/// # .unwrap()
10100/// # .https_or_http()
10101/// # .enable_http2()
10102/// # .build()
10103/// # );
10104/// # let mut hub = CloudAsset::new(client, auth);
10105/// // You can configure optional parameters by calling the respective setters at will, and
10106/// // execute the final call using `doit()`.
10107/// // Values shown here are possibly random and not representative !
10108/// let result = hub.methods().analyze_org_policy_governed_containers("scope")
10109/// .page_token("diam")
10110/// .page_size(-49)
10111/// .filter("et")
10112/// .constraint("et")
10113/// .doit().await;
10114/// # }
10115/// ```
10116pub struct MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C>
10117where
10118 C: 'a,
10119{
10120 hub: &'a CloudAsset<C>,
10121 _scope: String,
10122 _page_token: Option<String>,
10123 _page_size: Option<i32>,
10124 _filter: Option<String>,
10125 _constraint: Option<String>,
10126 _delegate: Option<&'a mut dyn common::Delegate>,
10127 _additional_params: HashMap<String, String>,
10128 _scopes: BTreeSet<String>,
10129}
10130
10131impl<'a, C> common::CallBuilder for MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {}
10132
10133impl<'a, C> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C>
10134where
10135 C: common::Connector,
10136{
10137 /// Perform the operation you have build so far.
10138 pub async fn doit(
10139 mut self,
10140 ) -> common::Result<(common::Response, AnalyzeOrgPolicyGovernedContainersResponse)> {
10141 use std::borrow::Cow;
10142 use std::io::{Read, Seek};
10143
10144 use common::{url::Params, ToParts};
10145 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10146
10147 let mut dd = common::DefaultDelegate;
10148 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10149 dlg.begin(common::MethodInfo {
10150 id: "cloudasset.analyzeOrgPolicyGovernedContainers",
10151 http_method: hyper::Method::GET,
10152 });
10153
10154 for &field in [
10155 "alt",
10156 "scope",
10157 "pageToken",
10158 "pageSize",
10159 "filter",
10160 "constraint",
10161 ]
10162 .iter()
10163 {
10164 if self._additional_params.contains_key(field) {
10165 dlg.finished(false);
10166 return Err(common::Error::FieldClash(field));
10167 }
10168 }
10169
10170 let mut params = Params::with_capacity(7 + self._additional_params.len());
10171 params.push("scope", self._scope);
10172 if let Some(value) = self._page_token.as_ref() {
10173 params.push("pageToken", value);
10174 }
10175 if let Some(value) = self._page_size.as_ref() {
10176 params.push("pageSize", value.to_string());
10177 }
10178 if let Some(value) = self._filter.as_ref() {
10179 params.push("filter", value);
10180 }
10181 if let Some(value) = self._constraint.as_ref() {
10182 params.push("constraint", value);
10183 }
10184
10185 params.extend(self._additional_params.iter());
10186
10187 params.push("alt", "json");
10188 let mut url = self.hub._base_url.clone() + "v1/{+scope}:analyzeOrgPolicyGovernedContainers";
10189 if self._scopes.is_empty() {
10190 self._scopes
10191 .insert(Scope::CloudPlatform.as_ref().to_string());
10192 }
10193
10194 #[allow(clippy::single_element_loop)]
10195 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
10196 url = params.uri_replacement(url, param_name, find_this, true);
10197 }
10198 {
10199 let to_remove = ["scope"];
10200 params.remove_params(&to_remove);
10201 }
10202
10203 let url = params.parse_with_url(&url);
10204
10205 loop {
10206 let token = match self
10207 .hub
10208 .auth
10209 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10210 .await
10211 {
10212 Ok(token) => token,
10213 Err(e) => match dlg.token(e) {
10214 Ok(token) => token,
10215 Err(e) => {
10216 dlg.finished(false);
10217 return Err(common::Error::MissingToken(e));
10218 }
10219 },
10220 };
10221 let mut req_result = {
10222 let client = &self.hub.client;
10223 dlg.pre_request();
10224 let mut req_builder = hyper::Request::builder()
10225 .method(hyper::Method::GET)
10226 .uri(url.as_str())
10227 .header(USER_AGENT, self.hub._user_agent.clone());
10228
10229 if let Some(token) = token.as_ref() {
10230 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10231 }
10232
10233 let request = req_builder
10234 .header(CONTENT_LENGTH, 0_u64)
10235 .body(common::to_body::<String>(None));
10236
10237 client.request(request.unwrap()).await
10238 };
10239
10240 match req_result {
10241 Err(err) => {
10242 if let common::Retry::After(d) = dlg.http_error(&err) {
10243 sleep(d).await;
10244 continue;
10245 }
10246 dlg.finished(false);
10247 return Err(common::Error::HttpError(err));
10248 }
10249 Ok(res) => {
10250 let (mut parts, body) = res.into_parts();
10251 let mut body = common::Body::new(body);
10252 if !parts.status.is_success() {
10253 let bytes = common::to_bytes(body).await.unwrap_or_default();
10254 let error = serde_json::from_str(&common::to_string(&bytes));
10255 let response = common::to_response(parts, bytes.into());
10256
10257 if let common::Retry::After(d) =
10258 dlg.http_failure(&response, error.as_ref().ok())
10259 {
10260 sleep(d).await;
10261 continue;
10262 }
10263
10264 dlg.finished(false);
10265
10266 return Err(match error {
10267 Ok(value) => common::Error::BadRequest(value),
10268 _ => common::Error::Failure(response),
10269 });
10270 }
10271 let response = {
10272 let bytes = common::to_bytes(body).await.unwrap_or_default();
10273 let encoded = common::to_string(&bytes);
10274 match serde_json::from_str(&encoded) {
10275 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10276 Err(error) => {
10277 dlg.response_json_decode_error(&encoded, &error);
10278 return Err(common::Error::JsonDecodeError(
10279 encoded.to_string(),
10280 error,
10281 ));
10282 }
10283 }
10284 };
10285
10286 dlg.finished(true);
10287 return Ok(response);
10288 }
10289 }
10290 }
10291 }
10292
10293 /// Required. The organization to scope the request. Only organization policies within the scope will be analyzed. The output containers will also be limited to the ones governed by those in-scope organization policies. * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
10294 ///
10295 /// Sets the *scope* path property to the given value.
10296 ///
10297 /// Even though the property as already been set when instantiating this call,
10298 /// we provide this method for API completeness.
10299 pub fn scope(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10300 self._scope = new_value.to_string();
10301 self
10302 }
10303 /// The pagination token to retrieve the next page.
10304 ///
10305 /// Sets the *page token* query property to the given value.
10306 pub fn page_token(
10307 mut self,
10308 new_value: &str,
10309 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10310 self._page_token = Some(new_value.to_string());
10311 self
10312 }
10313 /// The maximum number of items to return per page. If unspecified, AnalyzeOrgPolicyGovernedContainersResponse.governed_containers will contain 100 items with a maximum of 200.
10314 ///
10315 /// Sets the *page size* query property to the given value.
10316 pub fn page_size(
10317 mut self,
10318 new_value: i32,
10319 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10320 self._page_size = Some(new_value);
10321 self
10322 }
10323 /// The expression to filter AnalyzeOrgPolicyGovernedContainersResponse.governed_containers. Filtering is currently available for bare literal values and the following fields: * parent * consolidated_policy.rules.enforce When filtering by a specific field, the only supported operator is `=`. For example, filtering by parent="//cloudresourcemanager.googleapis.com/folders/001" will return all the containers under "folders/001".
10324 ///
10325 /// Sets the *filter* query property to the given value.
10326 pub fn filter(mut self, new_value: &str) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10327 self._filter = Some(new_value.to_string());
10328 self
10329 }
10330 /// Required. The name of the constraint to analyze governed containers for. The analysis only contains organization policies for the provided constraint.
10331 ///
10332 /// Sets the *constraint* query property to the given value.
10333 pub fn constraint(
10334 mut self,
10335 new_value: &str,
10336 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10337 self._constraint = Some(new_value.to_string());
10338 self
10339 }
10340 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10341 /// while executing the actual API request.
10342 ///
10343 /// ````text
10344 /// It should be used to handle progress information, and to implement a certain level of resilience.
10345 /// ````
10346 ///
10347 /// Sets the *delegate* property to the given value.
10348 pub fn delegate(
10349 mut self,
10350 new_value: &'a mut dyn common::Delegate,
10351 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10352 self._delegate = Some(new_value);
10353 self
10354 }
10355
10356 /// Set any additional parameter of the query string used in the request.
10357 /// It should be used to set parameters which are not yet available through their own
10358 /// setters.
10359 ///
10360 /// Please note that this method must not be used to set any of the known parameters
10361 /// which have their own setter method. If done anyway, the request will fail.
10362 ///
10363 /// # Additional Parameters
10364 ///
10365 /// * *$.xgafv* (query-string) - V1 error format.
10366 /// * *access_token* (query-string) - OAuth access token.
10367 /// * *alt* (query-string) - Data format for response.
10368 /// * *callback* (query-string) - JSONP
10369 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10370 /// * *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.
10371 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10372 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10373 /// * *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.
10374 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10375 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10376 pub fn param<T>(
10377 mut self,
10378 name: T,
10379 value: T,
10380 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C>
10381 where
10382 T: AsRef<str>,
10383 {
10384 self._additional_params
10385 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10386 self
10387 }
10388
10389 /// Identifies the authorization scope for the method you are building.
10390 ///
10391 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10392 /// [`Scope::CloudPlatform`].
10393 ///
10394 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10395 /// tokens for more than one scope.
10396 ///
10397 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10398 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10399 /// sufficient, a read-write scope will do as well.
10400 pub fn add_scope<St>(mut self, scope: St) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C>
10401 where
10402 St: AsRef<str>,
10403 {
10404 self._scopes.insert(String::from(scope.as_ref()));
10405 self
10406 }
10407 /// Identifies the authorization scope(s) for the method you are building.
10408 ///
10409 /// See [`Self::add_scope()`] for details.
10410 pub fn add_scopes<I, St>(
10411 mut self,
10412 scopes: I,
10413 ) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C>
10414 where
10415 I: IntoIterator<Item = St>,
10416 St: AsRef<str>,
10417 {
10418 self._scopes
10419 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10420 self
10421 }
10422
10423 /// Removes all scopes, and no default scope will be used either.
10424 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10425 /// for details).
10426 pub fn clear_scopes(mut self) -> MethodAnalyzeOrgPolicyGovernedContainerCall<'a, C> {
10427 self._scopes.clear();
10428 self
10429 }
10430}
10431
10432/// 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.
10433///
10434/// A builder for the *batchGetAssetsHistory* method.
10435/// It is not used directly, but through a [`MethodMethods`] instance.
10436///
10437/// # Example
10438///
10439/// Instantiate a resource method builder
10440///
10441/// ```test_harness,no_run
10442/// # extern crate hyper;
10443/// # extern crate hyper_rustls;
10444/// # extern crate google_cloudasset1 as cloudasset1;
10445/// # async fn dox() {
10446/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10447///
10448/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10449/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10450/// # .with_native_roots()
10451/// # .unwrap()
10452/// # .https_only()
10453/// # .enable_http2()
10454/// # .build();
10455///
10456/// # let executor = hyper_util::rt::TokioExecutor::new();
10457/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10458/// # secret,
10459/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10460/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10461/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10462/// # ),
10463/// # ).build().await.unwrap();
10464///
10465/// # let client = hyper_util::client::legacy::Client::builder(
10466/// # hyper_util::rt::TokioExecutor::new()
10467/// # )
10468/// # .build(
10469/// # hyper_rustls::HttpsConnectorBuilder::new()
10470/// # .with_native_roots()
10471/// # .unwrap()
10472/// # .https_or_http()
10473/// # .enable_http2()
10474/// # .build()
10475/// # );
10476/// # let mut hub = CloudAsset::new(client, auth);
10477/// // You can configure optional parameters by calling the respective setters at will, and
10478/// // execute the final call using `doit()`.
10479/// // Values shown here are possibly random and not representative !
10480/// let result = hub.methods().batch_get_assets_history("parent")
10481/// .add_relationship_types("Stet")
10482/// .read_time_window_start_time(chrono::Utc::now())
10483/// .read_time_window_end_time(chrono::Utc::now())
10484/// .content_type("dolor")
10485/// .add_asset_names("duo")
10486/// .doit().await;
10487/// # }
10488/// ```
10489pub struct MethodBatchGetAssetsHistoryCall<'a, C>
10490where
10491 C: 'a,
10492{
10493 hub: &'a CloudAsset<C>,
10494 _parent: String,
10495 _relationship_types: Vec<String>,
10496 _read_time_window_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
10497 _read_time_window_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
10498 _content_type: Option<String>,
10499 _asset_names: Vec<String>,
10500 _delegate: Option<&'a mut dyn common::Delegate>,
10501 _additional_params: HashMap<String, String>,
10502 _scopes: BTreeSet<String>,
10503}
10504
10505impl<'a, C> common::CallBuilder for MethodBatchGetAssetsHistoryCall<'a, C> {}
10506
10507impl<'a, C> MethodBatchGetAssetsHistoryCall<'a, C>
10508where
10509 C: common::Connector,
10510{
10511 /// Perform the operation you have build so far.
10512 pub async fn doit(
10513 mut self,
10514 ) -> common::Result<(common::Response, BatchGetAssetsHistoryResponse)> {
10515 use std::borrow::Cow;
10516 use std::io::{Read, Seek};
10517
10518 use common::{url::Params, ToParts};
10519 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10520
10521 let mut dd = common::DefaultDelegate;
10522 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10523 dlg.begin(common::MethodInfo {
10524 id: "cloudasset.batchGetAssetsHistory",
10525 http_method: hyper::Method::GET,
10526 });
10527
10528 for &field in [
10529 "alt",
10530 "parent",
10531 "relationshipTypes",
10532 "readTimeWindow.startTime",
10533 "readTimeWindow.endTime",
10534 "contentType",
10535 "assetNames",
10536 ]
10537 .iter()
10538 {
10539 if self._additional_params.contains_key(field) {
10540 dlg.finished(false);
10541 return Err(common::Error::FieldClash(field));
10542 }
10543 }
10544
10545 let mut params = Params::with_capacity(8 + self._additional_params.len());
10546 params.push("parent", self._parent);
10547 if !self._relationship_types.is_empty() {
10548 for f in self._relationship_types.iter() {
10549 params.push("relationshipTypes", f);
10550 }
10551 }
10552 if let Some(value) = self._read_time_window_start_time.as_ref() {
10553 params.push(
10554 "readTimeWindow.startTime",
10555 common::serde::datetime_to_string(&value),
10556 );
10557 }
10558 if let Some(value) = self._read_time_window_end_time.as_ref() {
10559 params.push(
10560 "readTimeWindow.endTime",
10561 common::serde::datetime_to_string(&value),
10562 );
10563 }
10564 if let Some(value) = self._content_type.as_ref() {
10565 params.push("contentType", value);
10566 }
10567 if !self._asset_names.is_empty() {
10568 for f in self._asset_names.iter() {
10569 params.push("assetNames", f);
10570 }
10571 }
10572
10573 params.extend(self._additional_params.iter());
10574
10575 params.push("alt", "json");
10576 let mut url = self.hub._base_url.clone() + "v1/{+parent}:batchGetAssetsHistory";
10577 if self._scopes.is_empty() {
10578 self._scopes
10579 .insert(Scope::CloudPlatform.as_ref().to_string());
10580 }
10581
10582 #[allow(clippy::single_element_loop)]
10583 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10584 url = params.uri_replacement(url, param_name, find_this, true);
10585 }
10586 {
10587 let to_remove = ["parent"];
10588 params.remove_params(&to_remove);
10589 }
10590
10591 let url = params.parse_with_url(&url);
10592
10593 loop {
10594 let token = match self
10595 .hub
10596 .auth
10597 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10598 .await
10599 {
10600 Ok(token) => token,
10601 Err(e) => match dlg.token(e) {
10602 Ok(token) => token,
10603 Err(e) => {
10604 dlg.finished(false);
10605 return Err(common::Error::MissingToken(e));
10606 }
10607 },
10608 };
10609 let mut req_result = {
10610 let client = &self.hub.client;
10611 dlg.pre_request();
10612 let mut req_builder = hyper::Request::builder()
10613 .method(hyper::Method::GET)
10614 .uri(url.as_str())
10615 .header(USER_AGENT, self.hub._user_agent.clone());
10616
10617 if let Some(token) = token.as_ref() {
10618 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10619 }
10620
10621 let request = req_builder
10622 .header(CONTENT_LENGTH, 0_u64)
10623 .body(common::to_body::<String>(None));
10624
10625 client.request(request.unwrap()).await
10626 };
10627
10628 match req_result {
10629 Err(err) => {
10630 if let common::Retry::After(d) = dlg.http_error(&err) {
10631 sleep(d).await;
10632 continue;
10633 }
10634 dlg.finished(false);
10635 return Err(common::Error::HttpError(err));
10636 }
10637 Ok(res) => {
10638 let (mut parts, body) = res.into_parts();
10639 let mut body = common::Body::new(body);
10640 if !parts.status.is_success() {
10641 let bytes = common::to_bytes(body).await.unwrap_or_default();
10642 let error = serde_json::from_str(&common::to_string(&bytes));
10643 let response = common::to_response(parts, bytes.into());
10644
10645 if let common::Retry::After(d) =
10646 dlg.http_failure(&response, error.as_ref().ok())
10647 {
10648 sleep(d).await;
10649 continue;
10650 }
10651
10652 dlg.finished(false);
10653
10654 return Err(match error {
10655 Ok(value) => common::Error::BadRequest(value),
10656 _ => common::Error::Failure(response),
10657 });
10658 }
10659 let response = {
10660 let bytes = common::to_bytes(body).await.unwrap_or_default();
10661 let encoded = common::to_string(&bytes);
10662 match serde_json::from_str(&encoded) {
10663 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10664 Err(error) => {
10665 dlg.response_json_decode_error(&encoded, &error);
10666 return Err(common::Error::JsonDecodeError(
10667 encoded.to_string(),
10668 error,
10669 ));
10670 }
10671 }
10672 };
10673
10674 dlg.finished(true);
10675 return Ok(response);
10676 }
10677 }
10678 }
10679 }
10680
10681 /// 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").
10682 ///
10683 /// Sets the *parent* path property to the given value.
10684 ///
10685 /// Even though the property as already been set when instantiating this call,
10686 /// we provide this method for API completeness.
10687 pub fn parent(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10688 self._parent = new_value.to_string();
10689 self
10690 }
10691 /// Optional. A list of relationship types to output, for example: `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if content_type=RELATIONSHIP. * If specified: it outputs specified relationships' history on the [asset_names]. It returns an error if any of the [relationship_types] doesn't belong to the supported relationship types of the [asset_names] or if any of the [asset_names]'s types doesn't belong to the source types of the [relationship_types]. * Otherwise: it outputs the supported relationships' history on the [asset_names] or returns an error if any of the [asset_names]'s types has no relationship support. See [Introduction to Cloud Asset Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all supported asset types and relationship types.
10692 ///
10693 /// Append the given value to the *relationship types* query property.
10694 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10695 pub fn add_relationship_types(
10696 mut self,
10697 new_value: &str,
10698 ) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10699 self._relationship_types.push(new_value.to_string());
10700 self
10701 }
10702 /// Start time of the time window (exclusive).
10703 ///
10704 /// Sets the *read time window.start time* query property to the given value.
10705 pub fn read_time_window_start_time(
10706 mut self,
10707 new_value: chrono::DateTime<chrono::offset::Utc>,
10708 ) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10709 self._read_time_window_start_time = Some(new_value);
10710 self
10711 }
10712 /// End time of the time window (inclusive). If not specified, the current timestamp is used instead.
10713 ///
10714 /// Sets the *read time window.end time* query property to the given value.
10715 pub fn read_time_window_end_time(
10716 mut self,
10717 new_value: chrono::DateTime<chrono::offset::Utc>,
10718 ) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10719 self._read_time_window_end_time = Some(new_value);
10720 self
10721 }
10722 /// Optional. The content type.
10723 ///
10724 /// Sets the *content type* query property to the given value.
10725 pub fn content_type(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10726 self._content_type = Some(new_value.to_string());
10727 self
10728 }
10729 /// A list of the full names of the assets. See: https://cloud.google.com/asset-inventory/docs/resource-name-format Example: `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. 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.
10730 ///
10731 /// Append the given value to the *asset names* query property.
10732 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
10733 pub fn add_asset_names(mut self, new_value: &str) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10734 self._asset_names.push(new_value.to_string());
10735 self
10736 }
10737 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10738 /// while executing the actual API request.
10739 ///
10740 /// ````text
10741 /// It should be used to handle progress information, and to implement a certain level of resilience.
10742 /// ````
10743 ///
10744 /// Sets the *delegate* property to the given value.
10745 pub fn delegate(
10746 mut self,
10747 new_value: &'a mut dyn common::Delegate,
10748 ) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10749 self._delegate = Some(new_value);
10750 self
10751 }
10752
10753 /// Set any additional parameter of the query string used in the request.
10754 /// It should be used to set parameters which are not yet available through their own
10755 /// setters.
10756 ///
10757 /// Please note that this method must not be used to set any of the known parameters
10758 /// which have their own setter method. If done anyway, the request will fail.
10759 ///
10760 /// # Additional Parameters
10761 ///
10762 /// * *$.xgafv* (query-string) - V1 error format.
10763 /// * *access_token* (query-string) - OAuth access token.
10764 /// * *alt* (query-string) - Data format for response.
10765 /// * *callback* (query-string) - JSONP
10766 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10767 /// * *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.
10768 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10769 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10770 /// * *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.
10771 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10772 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10773 pub fn param<T>(mut self, name: T, value: T) -> MethodBatchGetAssetsHistoryCall<'a, C>
10774 where
10775 T: AsRef<str>,
10776 {
10777 self._additional_params
10778 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10779 self
10780 }
10781
10782 /// Identifies the authorization scope for the method you are building.
10783 ///
10784 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10785 /// [`Scope::CloudPlatform`].
10786 ///
10787 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10788 /// tokens for more than one scope.
10789 ///
10790 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10791 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10792 /// sufficient, a read-write scope will do as well.
10793 pub fn add_scope<St>(mut self, scope: St) -> MethodBatchGetAssetsHistoryCall<'a, C>
10794 where
10795 St: AsRef<str>,
10796 {
10797 self._scopes.insert(String::from(scope.as_ref()));
10798 self
10799 }
10800 /// Identifies the authorization scope(s) for the method you are building.
10801 ///
10802 /// See [`Self::add_scope()`] for details.
10803 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodBatchGetAssetsHistoryCall<'a, C>
10804 where
10805 I: IntoIterator<Item = St>,
10806 St: AsRef<str>,
10807 {
10808 self._scopes
10809 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10810 self
10811 }
10812
10813 /// Removes all scopes, and no default scope will be used either.
10814 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10815 /// for details).
10816 pub fn clear_scopes(mut self) -> MethodBatchGetAssetsHistoryCall<'a, C> {
10817 self._scopes.clear();
10818 self
10819 }
10820}
10821
10822/// Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a google.cloud.asset.v1.Asset in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the google.longrunning.Operation API, which allows 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.
10823///
10824/// A builder for the *exportAssets* method.
10825/// It is not used directly, but through a [`MethodMethods`] instance.
10826///
10827/// # Example
10828///
10829/// Instantiate a resource method builder
10830///
10831/// ```test_harness,no_run
10832/// # extern crate hyper;
10833/// # extern crate hyper_rustls;
10834/// # extern crate google_cloudasset1 as cloudasset1;
10835/// use cloudasset1::api::ExportAssetsRequest;
10836/// # async fn dox() {
10837/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10838///
10839/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10840/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10841/// # .with_native_roots()
10842/// # .unwrap()
10843/// # .https_only()
10844/// # .enable_http2()
10845/// # .build();
10846///
10847/// # let executor = hyper_util::rt::TokioExecutor::new();
10848/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10849/// # secret,
10850/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10851/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10852/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10853/// # ),
10854/// # ).build().await.unwrap();
10855///
10856/// # let client = hyper_util::client::legacy::Client::builder(
10857/// # hyper_util::rt::TokioExecutor::new()
10858/// # )
10859/// # .build(
10860/// # hyper_rustls::HttpsConnectorBuilder::new()
10861/// # .with_native_roots()
10862/// # .unwrap()
10863/// # .https_or_http()
10864/// # .enable_http2()
10865/// # .build()
10866/// # );
10867/// # let mut hub = CloudAsset::new(client, auth);
10868/// // As the method needs a request, you would usually fill it with the desired information
10869/// // into the respective structure. Some of the parts shown here might not be applicable !
10870/// // Values shown here are possibly random and not representative !
10871/// let mut req = ExportAssetsRequest::default();
10872///
10873/// // You can configure optional parameters by calling the respective setters at will, and
10874/// // execute the final call using `doit()`.
10875/// // Values shown here are possibly random and not representative !
10876/// let result = hub.methods().export_assets(req, "parent")
10877/// .doit().await;
10878/// # }
10879/// ```
10880pub struct MethodExportAssetCall<'a, C>
10881where
10882 C: 'a,
10883{
10884 hub: &'a CloudAsset<C>,
10885 _request: ExportAssetsRequest,
10886 _parent: String,
10887 _delegate: Option<&'a mut dyn common::Delegate>,
10888 _additional_params: HashMap<String, String>,
10889 _scopes: BTreeSet<String>,
10890}
10891
10892impl<'a, C> common::CallBuilder for MethodExportAssetCall<'a, C> {}
10893
10894impl<'a, C> MethodExportAssetCall<'a, C>
10895where
10896 C: common::Connector,
10897{
10898 /// Perform the operation you have build so far.
10899 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10900 use std::borrow::Cow;
10901 use std::io::{Read, Seek};
10902
10903 use common::{url::Params, ToParts};
10904 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10905
10906 let mut dd = common::DefaultDelegate;
10907 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10908 dlg.begin(common::MethodInfo {
10909 id: "cloudasset.exportAssets",
10910 http_method: hyper::Method::POST,
10911 });
10912
10913 for &field in ["alt", "parent"].iter() {
10914 if self._additional_params.contains_key(field) {
10915 dlg.finished(false);
10916 return Err(common::Error::FieldClash(field));
10917 }
10918 }
10919
10920 let mut params = Params::with_capacity(4 + self._additional_params.len());
10921 params.push("parent", self._parent);
10922
10923 params.extend(self._additional_params.iter());
10924
10925 params.push("alt", "json");
10926 let mut url = self.hub._base_url.clone() + "v1/{+parent}:exportAssets";
10927 if self._scopes.is_empty() {
10928 self._scopes
10929 .insert(Scope::CloudPlatform.as_ref().to_string());
10930 }
10931
10932 #[allow(clippy::single_element_loop)]
10933 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10934 url = params.uri_replacement(url, param_name, find_this, true);
10935 }
10936 {
10937 let to_remove = ["parent"];
10938 params.remove_params(&to_remove);
10939 }
10940
10941 let url = params.parse_with_url(&url);
10942
10943 let mut json_mime_type = mime::APPLICATION_JSON;
10944 let mut request_value_reader = {
10945 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10946 common::remove_json_null_values(&mut value);
10947 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10948 serde_json::to_writer(&mut dst, &value).unwrap();
10949 dst
10950 };
10951 let request_size = request_value_reader
10952 .seek(std::io::SeekFrom::End(0))
10953 .unwrap();
10954 request_value_reader
10955 .seek(std::io::SeekFrom::Start(0))
10956 .unwrap();
10957
10958 loop {
10959 let token = match self
10960 .hub
10961 .auth
10962 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10963 .await
10964 {
10965 Ok(token) => token,
10966 Err(e) => match dlg.token(e) {
10967 Ok(token) => token,
10968 Err(e) => {
10969 dlg.finished(false);
10970 return Err(common::Error::MissingToken(e));
10971 }
10972 },
10973 };
10974 request_value_reader
10975 .seek(std::io::SeekFrom::Start(0))
10976 .unwrap();
10977 let mut req_result = {
10978 let client = &self.hub.client;
10979 dlg.pre_request();
10980 let mut req_builder = hyper::Request::builder()
10981 .method(hyper::Method::POST)
10982 .uri(url.as_str())
10983 .header(USER_AGENT, self.hub._user_agent.clone());
10984
10985 if let Some(token) = token.as_ref() {
10986 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10987 }
10988
10989 let request = req_builder
10990 .header(CONTENT_TYPE, json_mime_type.to_string())
10991 .header(CONTENT_LENGTH, request_size as u64)
10992 .body(common::to_body(
10993 request_value_reader.get_ref().clone().into(),
10994 ));
10995
10996 client.request(request.unwrap()).await
10997 };
10998
10999 match req_result {
11000 Err(err) => {
11001 if let common::Retry::After(d) = dlg.http_error(&err) {
11002 sleep(d).await;
11003 continue;
11004 }
11005 dlg.finished(false);
11006 return Err(common::Error::HttpError(err));
11007 }
11008 Ok(res) => {
11009 let (mut parts, body) = res.into_parts();
11010 let mut body = common::Body::new(body);
11011 if !parts.status.is_success() {
11012 let bytes = common::to_bytes(body).await.unwrap_or_default();
11013 let error = serde_json::from_str(&common::to_string(&bytes));
11014 let response = common::to_response(parts, bytes.into());
11015
11016 if let common::Retry::After(d) =
11017 dlg.http_failure(&response, error.as_ref().ok())
11018 {
11019 sleep(d).await;
11020 continue;
11021 }
11022
11023 dlg.finished(false);
11024
11025 return Err(match error {
11026 Ok(value) => common::Error::BadRequest(value),
11027 _ => common::Error::Failure(response),
11028 });
11029 }
11030 let response = {
11031 let bytes = common::to_bytes(body).await.unwrap_or_default();
11032 let encoded = common::to_string(&bytes);
11033 match serde_json::from_str(&encoded) {
11034 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11035 Err(error) => {
11036 dlg.response_json_decode_error(&encoded, &error);
11037 return Err(common::Error::JsonDecodeError(
11038 encoded.to_string(),
11039 error,
11040 ));
11041 }
11042 }
11043 };
11044
11045 dlg.finished(true);
11046 return Ok(response);
11047 }
11048 }
11049 }
11050 }
11051
11052 ///
11053 /// Sets the *request* property to the given value.
11054 ///
11055 /// Even though the property as already been set when instantiating this call,
11056 /// we provide this method for API completeness.
11057 pub fn request(mut self, new_value: ExportAssetsRequest) -> MethodExportAssetCall<'a, C> {
11058 self._request = new_value;
11059 self
11060 }
11061 /// 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"), or a project number (such as "projects/12345"), or a folder number (such as "folders/123").
11062 ///
11063 /// Sets the *parent* path property to the given value.
11064 ///
11065 /// Even though the property as already been set when instantiating this call,
11066 /// we provide this method for API completeness.
11067 pub fn parent(mut self, new_value: &str) -> MethodExportAssetCall<'a, C> {
11068 self._parent = new_value.to_string();
11069 self
11070 }
11071 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11072 /// while executing the actual API request.
11073 ///
11074 /// ````text
11075 /// It should be used to handle progress information, and to implement a certain level of resilience.
11076 /// ````
11077 ///
11078 /// Sets the *delegate* property to the given value.
11079 pub fn delegate(
11080 mut self,
11081 new_value: &'a mut dyn common::Delegate,
11082 ) -> MethodExportAssetCall<'a, C> {
11083 self._delegate = Some(new_value);
11084 self
11085 }
11086
11087 /// Set any additional parameter of the query string used in the request.
11088 /// It should be used to set parameters which are not yet available through their own
11089 /// setters.
11090 ///
11091 /// Please note that this method must not be used to set any of the known parameters
11092 /// which have their own setter method. If done anyway, the request will fail.
11093 ///
11094 /// # Additional Parameters
11095 ///
11096 /// * *$.xgafv* (query-string) - V1 error format.
11097 /// * *access_token* (query-string) - OAuth access token.
11098 /// * *alt* (query-string) - Data format for response.
11099 /// * *callback* (query-string) - JSONP
11100 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11101 /// * *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.
11102 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11103 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11104 /// * *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.
11105 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11106 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11107 pub fn param<T>(mut self, name: T, value: T) -> MethodExportAssetCall<'a, C>
11108 where
11109 T: AsRef<str>,
11110 {
11111 self._additional_params
11112 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11113 self
11114 }
11115
11116 /// Identifies the authorization scope for the method you are building.
11117 ///
11118 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11119 /// [`Scope::CloudPlatform`].
11120 ///
11121 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11122 /// tokens for more than one scope.
11123 ///
11124 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11125 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11126 /// sufficient, a read-write scope will do as well.
11127 pub fn add_scope<St>(mut self, scope: St) -> MethodExportAssetCall<'a, C>
11128 where
11129 St: AsRef<str>,
11130 {
11131 self._scopes.insert(String::from(scope.as_ref()));
11132 self
11133 }
11134 /// Identifies the authorization scope(s) for the method you are building.
11135 ///
11136 /// See [`Self::add_scope()`] for details.
11137 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodExportAssetCall<'a, C>
11138 where
11139 I: IntoIterator<Item = St>,
11140 St: AsRef<str>,
11141 {
11142 self._scopes
11143 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11144 self
11145 }
11146
11147 /// Removes all scopes, and no default scope will be used either.
11148 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11149 /// for details).
11150 pub fn clear_scopes(mut self) -> MethodExportAssetCall<'a, C> {
11151 self._scopes.clear();
11152 self
11153 }
11154}
11155
11156/// Issue a job that queries assets using a SQL statement compatible with [BigQuery SQL](https://cloud.google.com/bigquery/docs/introduction-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by [BigQuery](https://cloud.google.com/bigquery/docs/best-practices-performance-output). Queries return larger results will result in errors.
11157///
11158/// A builder for the *queryAssets* method.
11159/// It is not used directly, but through a [`MethodMethods`] instance.
11160///
11161/// # Example
11162///
11163/// Instantiate a resource method builder
11164///
11165/// ```test_harness,no_run
11166/// # extern crate hyper;
11167/// # extern crate hyper_rustls;
11168/// # extern crate google_cloudasset1 as cloudasset1;
11169/// use cloudasset1::api::QueryAssetsRequest;
11170/// # async fn dox() {
11171/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11172///
11173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11175/// # .with_native_roots()
11176/// # .unwrap()
11177/// # .https_only()
11178/// # .enable_http2()
11179/// # .build();
11180///
11181/// # let executor = hyper_util::rt::TokioExecutor::new();
11182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11183/// # secret,
11184/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11185/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11186/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11187/// # ),
11188/// # ).build().await.unwrap();
11189///
11190/// # let client = hyper_util::client::legacy::Client::builder(
11191/// # hyper_util::rt::TokioExecutor::new()
11192/// # )
11193/// # .build(
11194/// # hyper_rustls::HttpsConnectorBuilder::new()
11195/// # .with_native_roots()
11196/// # .unwrap()
11197/// # .https_or_http()
11198/// # .enable_http2()
11199/// # .build()
11200/// # );
11201/// # let mut hub = CloudAsset::new(client, auth);
11202/// // As the method needs a request, you would usually fill it with the desired information
11203/// // into the respective structure. Some of the parts shown here might not be applicable !
11204/// // Values shown here are possibly random and not representative !
11205/// let mut req = QueryAssetsRequest::default();
11206///
11207/// // You can configure optional parameters by calling the respective setters at will, and
11208/// // execute the final call using `doit()`.
11209/// // Values shown here are possibly random and not representative !
11210/// let result = hub.methods().query_assets(req, "parent")
11211/// .doit().await;
11212/// # }
11213/// ```
11214pub struct MethodQueryAssetCall<'a, C>
11215where
11216 C: 'a,
11217{
11218 hub: &'a CloudAsset<C>,
11219 _request: QueryAssetsRequest,
11220 _parent: String,
11221 _delegate: Option<&'a mut dyn common::Delegate>,
11222 _additional_params: HashMap<String, String>,
11223 _scopes: BTreeSet<String>,
11224}
11225
11226impl<'a, C> common::CallBuilder for MethodQueryAssetCall<'a, C> {}
11227
11228impl<'a, C> MethodQueryAssetCall<'a, C>
11229where
11230 C: common::Connector,
11231{
11232 /// Perform the operation you have build so far.
11233 pub async fn doit(mut self) -> common::Result<(common::Response, QueryAssetsResponse)> {
11234 use std::borrow::Cow;
11235 use std::io::{Read, Seek};
11236
11237 use common::{url::Params, ToParts};
11238 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11239
11240 let mut dd = common::DefaultDelegate;
11241 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11242 dlg.begin(common::MethodInfo {
11243 id: "cloudasset.queryAssets",
11244 http_method: hyper::Method::POST,
11245 });
11246
11247 for &field in ["alt", "parent"].iter() {
11248 if self._additional_params.contains_key(field) {
11249 dlg.finished(false);
11250 return Err(common::Error::FieldClash(field));
11251 }
11252 }
11253
11254 let mut params = Params::with_capacity(4 + self._additional_params.len());
11255 params.push("parent", self._parent);
11256
11257 params.extend(self._additional_params.iter());
11258
11259 params.push("alt", "json");
11260 let mut url = self.hub._base_url.clone() + "v1/{+parent}:queryAssets";
11261 if self._scopes.is_empty() {
11262 self._scopes
11263 .insert(Scope::CloudPlatform.as_ref().to_string());
11264 }
11265
11266 #[allow(clippy::single_element_loop)]
11267 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11268 url = params.uri_replacement(url, param_name, find_this, true);
11269 }
11270 {
11271 let to_remove = ["parent"];
11272 params.remove_params(&to_remove);
11273 }
11274
11275 let url = params.parse_with_url(&url);
11276
11277 let mut json_mime_type = mime::APPLICATION_JSON;
11278 let mut request_value_reader = {
11279 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11280 common::remove_json_null_values(&mut value);
11281 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11282 serde_json::to_writer(&mut dst, &value).unwrap();
11283 dst
11284 };
11285 let request_size = request_value_reader
11286 .seek(std::io::SeekFrom::End(0))
11287 .unwrap();
11288 request_value_reader
11289 .seek(std::io::SeekFrom::Start(0))
11290 .unwrap();
11291
11292 loop {
11293 let token = match self
11294 .hub
11295 .auth
11296 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11297 .await
11298 {
11299 Ok(token) => token,
11300 Err(e) => match dlg.token(e) {
11301 Ok(token) => token,
11302 Err(e) => {
11303 dlg.finished(false);
11304 return Err(common::Error::MissingToken(e));
11305 }
11306 },
11307 };
11308 request_value_reader
11309 .seek(std::io::SeekFrom::Start(0))
11310 .unwrap();
11311 let mut req_result = {
11312 let client = &self.hub.client;
11313 dlg.pre_request();
11314 let mut req_builder = hyper::Request::builder()
11315 .method(hyper::Method::POST)
11316 .uri(url.as_str())
11317 .header(USER_AGENT, self.hub._user_agent.clone());
11318
11319 if let Some(token) = token.as_ref() {
11320 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11321 }
11322
11323 let request = req_builder
11324 .header(CONTENT_TYPE, json_mime_type.to_string())
11325 .header(CONTENT_LENGTH, request_size as u64)
11326 .body(common::to_body(
11327 request_value_reader.get_ref().clone().into(),
11328 ));
11329
11330 client.request(request.unwrap()).await
11331 };
11332
11333 match req_result {
11334 Err(err) => {
11335 if let common::Retry::After(d) = dlg.http_error(&err) {
11336 sleep(d).await;
11337 continue;
11338 }
11339 dlg.finished(false);
11340 return Err(common::Error::HttpError(err));
11341 }
11342 Ok(res) => {
11343 let (mut parts, body) = res.into_parts();
11344 let mut body = common::Body::new(body);
11345 if !parts.status.is_success() {
11346 let bytes = common::to_bytes(body).await.unwrap_or_default();
11347 let error = serde_json::from_str(&common::to_string(&bytes));
11348 let response = common::to_response(parts, bytes.into());
11349
11350 if let common::Retry::After(d) =
11351 dlg.http_failure(&response, error.as_ref().ok())
11352 {
11353 sleep(d).await;
11354 continue;
11355 }
11356
11357 dlg.finished(false);
11358
11359 return Err(match error {
11360 Ok(value) => common::Error::BadRequest(value),
11361 _ => common::Error::Failure(response),
11362 });
11363 }
11364 let response = {
11365 let bytes = common::to_bytes(body).await.unwrap_or_default();
11366 let encoded = common::to_string(&bytes);
11367 match serde_json::from_str(&encoded) {
11368 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11369 Err(error) => {
11370 dlg.response_json_decode_error(&encoded, &error);
11371 return Err(common::Error::JsonDecodeError(
11372 encoded.to_string(),
11373 error,
11374 ));
11375 }
11376 }
11377 };
11378
11379 dlg.finished(true);
11380 return Ok(response);
11381 }
11382 }
11383 }
11384 }
11385
11386 ///
11387 /// Sets the *request* property to the given value.
11388 ///
11389 /// Even though the property as already been set when instantiating this call,
11390 /// we provide this method for API completeness.
11391 pub fn request(mut self, new_value: QueryAssetsRequest) -> MethodQueryAssetCall<'a, C> {
11392 self._request = new_value;
11393 self
11394 }
11395 /// 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"), or a project number (such as "projects/12345"), or a folder number (such as "folders/123"). Only assets belonging to the `parent` will be returned.
11396 ///
11397 /// Sets the *parent* path property to the given value.
11398 ///
11399 /// Even though the property as already been set when instantiating this call,
11400 /// we provide this method for API completeness.
11401 pub fn parent(mut self, new_value: &str) -> MethodQueryAssetCall<'a, C> {
11402 self._parent = new_value.to_string();
11403 self
11404 }
11405 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11406 /// while executing the actual API request.
11407 ///
11408 /// ````text
11409 /// It should be used to handle progress information, and to implement a certain level of resilience.
11410 /// ````
11411 ///
11412 /// Sets the *delegate* property to the given value.
11413 pub fn delegate(
11414 mut self,
11415 new_value: &'a mut dyn common::Delegate,
11416 ) -> MethodQueryAssetCall<'a, C> {
11417 self._delegate = Some(new_value);
11418 self
11419 }
11420
11421 /// Set any additional parameter of the query string used in the request.
11422 /// It should be used to set parameters which are not yet available through their own
11423 /// setters.
11424 ///
11425 /// Please note that this method must not be used to set any of the known parameters
11426 /// which have their own setter method. If done anyway, the request will fail.
11427 ///
11428 /// # Additional Parameters
11429 ///
11430 /// * *$.xgafv* (query-string) - V1 error format.
11431 /// * *access_token* (query-string) - OAuth access token.
11432 /// * *alt* (query-string) - Data format for response.
11433 /// * *callback* (query-string) - JSONP
11434 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11435 /// * *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.
11436 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11437 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11438 /// * *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.
11439 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11440 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11441 pub fn param<T>(mut self, name: T, value: T) -> MethodQueryAssetCall<'a, C>
11442 where
11443 T: AsRef<str>,
11444 {
11445 self._additional_params
11446 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11447 self
11448 }
11449
11450 /// Identifies the authorization scope for the method you are building.
11451 ///
11452 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11453 /// [`Scope::CloudPlatform`].
11454 ///
11455 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11456 /// tokens for more than one scope.
11457 ///
11458 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11459 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11460 /// sufficient, a read-write scope will do as well.
11461 pub fn add_scope<St>(mut self, scope: St) -> MethodQueryAssetCall<'a, C>
11462 where
11463 St: AsRef<str>,
11464 {
11465 self._scopes.insert(String::from(scope.as_ref()));
11466 self
11467 }
11468 /// Identifies the authorization scope(s) for the method you are building.
11469 ///
11470 /// See [`Self::add_scope()`] for details.
11471 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodQueryAssetCall<'a, C>
11472 where
11473 I: IntoIterator<Item = St>,
11474 St: AsRef<str>,
11475 {
11476 self._scopes
11477 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11478 self
11479 }
11480
11481 /// Removes all scopes, and no default scope will be used either.
11482 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11483 /// for details).
11484 pub fn clear_scopes(mut self) -> MethodQueryAssetCall<'a, C> {
11485 self._scopes.clear();
11486 self
11487 }
11488}
11489
11490/// Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.
11491///
11492/// A builder for the *searchAllIamPolicies* method.
11493/// It is not used directly, but through a [`MethodMethods`] instance.
11494///
11495/// # Example
11496///
11497/// Instantiate a resource method builder
11498///
11499/// ```test_harness,no_run
11500/// # extern crate hyper;
11501/// # extern crate hyper_rustls;
11502/// # extern crate google_cloudasset1 as cloudasset1;
11503/// # async fn dox() {
11504/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11505///
11506/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11507/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11508/// # .with_native_roots()
11509/// # .unwrap()
11510/// # .https_only()
11511/// # .enable_http2()
11512/// # .build();
11513///
11514/// # let executor = hyper_util::rt::TokioExecutor::new();
11515/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11516/// # secret,
11517/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11518/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11519/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11520/// # ),
11521/// # ).build().await.unwrap();
11522///
11523/// # let client = hyper_util::client::legacy::Client::builder(
11524/// # hyper_util::rt::TokioExecutor::new()
11525/// # )
11526/// # .build(
11527/// # hyper_rustls::HttpsConnectorBuilder::new()
11528/// # .with_native_roots()
11529/// # .unwrap()
11530/// # .https_or_http()
11531/// # .enable_http2()
11532/// # .build()
11533/// # );
11534/// # let mut hub = CloudAsset::new(client, auth);
11535/// // You can configure optional parameters by calling the respective setters at will, and
11536/// // execute the final call using `doit()`.
11537/// // Values shown here are possibly random and not representative !
11538/// let result = hub.methods().search_all_iam_policies("scope")
11539/// .query("Stet")
11540/// .page_token("vero")
11541/// .page_size(-44)
11542/// .order_by("Lorem")
11543/// .add_asset_types("diam")
11544/// .doit().await;
11545/// # }
11546/// ```
11547pub struct MethodSearchAllIamPolicyCall<'a, C>
11548where
11549 C: 'a,
11550{
11551 hub: &'a CloudAsset<C>,
11552 _scope: String,
11553 _query: Option<String>,
11554 _page_token: Option<String>,
11555 _page_size: Option<i32>,
11556 _order_by: Option<String>,
11557 _asset_types: Vec<String>,
11558 _delegate: Option<&'a mut dyn common::Delegate>,
11559 _additional_params: HashMap<String, String>,
11560 _scopes: BTreeSet<String>,
11561}
11562
11563impl<'a, C> common::CallBuilder for MethodSearchAllIamPolicyCall<'a, C> {}
11564
11565impl<'a, C> MethodSearchAllIamPolicyCall<'a, C>
11566where
11567 C: common::Connector,
11568{
11569 /// Perform the operation you have build so far.
11570 pub async fn doit(
11571 mut self,
11572 ) -> common::Result<(common::Response, SearchAllIamPoliciesResponse)> {
11573 use std::borrow::Cow;
11574 use std::io::{Read, Seek};
11575
11576 use common::{url::Params, ToParts};
11577 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11578
11579 let mut dd = common::DefaultDelegate;
11580 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11581 dlg.begin(common::MethodInfo {
11582 id: "cloudasset.searchAllIamPolicies",
11583 http_method: hyper::Method::GET,
11584 });
11585
11586 for &field in [
11587 "alt",
11588 "scope",
11589 "query",
11590 "pageToken",
11591 "pageSize",
11592 "orderBy",
11593 "assetTypes",
11594 ]
11595 .iter()
11596 {
11597 if self._additional_params.contains_key(field) {
11598 dlg.finished(false);
11599 return Err(common::Error::FieldClash(field));
11600 }
11601 }
11602
11603 let mut params = Params::with_capacity(8 + self._additional_params.len());
11604 params.push("scope", self._scope);
11605 if let Some(value) = self._query.as_ref() {
11606 params.push("query", value);
11607 }
11608 if let Some(value) = self._page_token.as_ref() {
11609 params.push("pageToken", value);
11610 }
11611 if let Some(value) = self._page_size.as_ref() {
11612 params.push("pageSize", value.to_string());
11613 }
11614 if let Some(value) = self._order_by.as_ref() {
11615 params.push("orderBy", value);
11616 }
11617 if !self._asset_types.is_empty() {
11618 for f in self._asset_types.iter() {
11619 params.push("assetTypes", f);
11620 }
11621 }
11622
11623 params.extend(self._additional_params.iter());
11624
11625 params.push("alt", "json");
11626 let mut url = self.hub._base_url.clone() + "v1/{+scope}:searchAllIamPolicies";
11627 if self._scopes.is_empty() {
11628 self._scopes
11629 .insert(Scope::CloudPlatform.as_ref().to_string());
11630 }
11631
11632 #[allow(clippy::single_element_loop)]
11633 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
11634 url = params.uri_replacement(url, param_name, find_this, true);
11635 }
11636 {
11637 let to_remove = ["scope"];
11638 params.remove_params(&to_remove);
11639 }
11640
11641 let url = params.parse_with_url(&url);
11642
11643 loop {
11644 let token = match self
11645 .hub
11646 .auth
11647 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11648 .await
11649 {
11650 Ok(token) => token,
11651 Err(e) => match dlg.token(e) {
11652 Ok(token) => token,
11653 Err(e) => {
11654 dlg.finished(false);
11655 return Err(common::Error::MissingToken(e));
11656 }
11657 },
11658 };
11659 let mut req_result = {
11660 let client = &self.hub.client;
11661 dlg.pre_request();
11662 let mut req_builder = hyper::Request::builder()
11663 .method(hyper::Method::GET)
11664 .uri(url.as_str())
11665 .header(USER_AGENT, self.hub._user_agent.clone());
11666
11667 if let Some(token) = token.as_ref() {
11668 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11669 }
11670
11671 let request = req_builder
11672 .header(CONTENT_LENGTH, 0_u64)
11673 .body(common::to_body::<String>(None));
11674
11675 client.request(request.unwrap()).await
11676 };
11677
11678 match req_result {
11679 Err(err) => {
11680 if let common::Retry::After(d) = dlg.http_error(&err) {
11681 sleep(d).await;
11682 continue;
11683 }
11684 dlg.finished(false);
11685 return Err(common::Error::HttpError(err));
11686 }
11687 Ok(res) => {
11688 let (mut parts, body) = res.into_parts();
11689 let mut body = common::Body::new(body);
11690 if !parts.status.is_success() {
11691 let bytes = common::to_bytes(body).await.unwrap_or_default();
11692 let error = serde_json::from_str(&common::to_string(&bytes));
11693 let response = common::to_response(parts, bytes.into());
11694
11695 if let common::Retry::After(d) =
11696 dlg.http_failure(&response, error.as_ref().ok())
11697 {
11698 sleep(d).await;
11699 continue;
11700 }
11701
11702 dlg.finished(false);
11703
11704 return Err(match error {
11705 Ok(value) => common::Error::BadRequest(value),
11706 _ => common::Error::Failure(response),
11707 });
11708 }
11709 let response = {
11710 let bytes = common::to_bytes(body).await.unwrap_or_default();
11711 let encoded = common::to_string(&bytes);
11712 match serde_json::from_str(&encoded) {
11713 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11714 Err(error) => {
11715 dlg.response_json_decode_error(&encoded, &error);
11716 return Err(common::Error::JsonDecodeError(
11717 encoded.to_string(),
11718 error,
11719 ));
11720 }
11721 }
11722 };
11723
11724 dlg.finished(true);
11725 return Ok(response);
11726 }
11727 }
11728 }
11729 }
11730
11731 /// Required. A scope can be a project, a folder, or an organization. The search is limited to the IAM policies within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope. The allowed values are: * projects/{PROJECT_ID} (e.g., "projects/foo-bar") * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
11732 ///
11733 /// Sets the *scope* path property to the given value.
11734 ///
11735 /// Even though the property as already been set when instantiating this call,
11736 /// we provide this method for API completeness.
11737 pub fn scope(mut self, new_value: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
11738 self._scope = new_value.to_string();
11739 self
11740 }
11741 /// Optional. The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) for more information. If not specified or empty, it will search all the IAM policies within the specified `scope`. Note that the query string is compared against each IAM policy binding, including its principals, roles, and IAM conditions. The returned IAM policies will only contain the bindings that match your query. To learn more about the IAM policy structure, see the [IAM policy documentation](https://cloud.google.com/iam/help/allow-policies/structure). Examples: * `policy:amy@gmail.com` to find IAM policy bindings that specify user "amy@gmail.com". * `policy:roles/compute.admin` to find IAM policy bindings that specify the Compute Admin role. * `policy:comp*` to find IAM policy bindings that contain "comp" as a prefix of any word in the binding. * `policy.role.permissions:storage.buckets.update` to find IAM policy bindings that specify a role containing "storage.buckets.update" permission. Note that if callers don't have `iam.roles.get` access to a role's included permissions, policy bindings that specify this role will be dropped from the search results. * `policy.role.permissions:upd*` to find IAM policy bindings that specify a role containing "upd" as a prefix of any word in the role permission. Note that if callers don't have `iam.roles.get` access to a role's included permissions, policy bindings that specify this role will be dropped from the search results. * `resource:organizations/123456` to find IAM policy bindings that are set on "organizations/123456". * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to find IAM policy bindings that are set on the project named "myproject". * `Important` to find IAM policy bindings that contain "Important" as a word in any of the searchable fields (except for the included permissions). * `resource:(instance1 OR instance2) policy:amy` to find IAM policy bindings that are set on resources "instance1" or "instance2" and also specify user "amy". * `roles:roles/compute.admin` to find IAM policy bindings that specify the Compute Admin role. * `memberTypes:user` to find IAM policy bindings that contain the principal type "user".
11742 ///
11743 /// Sets the *query* query property to the given value.
11744 pub fn query(mut self, new_value: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
11745 self._query = Some(new_value.to_string());
11746 self
11747 }
11748 /// Optional. If present, retrieve the next batch of results from the preceding call to this method. `page_token` must be the value of `next_page_token` from the previous response. The values of all other method parameters must be identical to those in the previous call.
11749 ///
11750 /// Sets the *page token* query property to the given value.
11751 pub fn page_token(mut self, new_value: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
11752 self._page_token = Some(new_value.to_string());
11753 self
11754 }
11755 /// Optional. The page size for search result pagination. Page size is capped at 500 even if a larger value is given. If set to zero or a negative value, server will pick an appropriate default. Returned results may be fewer than requested. When this happens, there could be more results as long as `next_page_token` is returned.
11756 ///
11757 /// Sets the *page size* query property to the given value.
11758 pub fn page_size(mut self, new_value: i32) -> MethodSearchAllIamPolicyCall<'a, C> {
11759 self._page_size = Some(new_value);
11760 self
11761 }
11762 /// Optional. A comma-separated list of fields specifying the sorting order of the results. The default order is ascending. Add " DESC" after the field name to indicate descending order. Redundant space characters are ignored. Example: "assetType DESC, resource". Only singular primitive fields in the response are sortable: * resource * assetType * project All the other fields such as repeated fields (e.g., `folders`) and non-primitive fields (e.g., `policy`) are not supported.
11763 ///
11764 /// Sets the *order by* query property to the given value.
11765 pub fn order_by(mut self, new_value: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
11766 self._order_by = Some(new_value.to_string());
11767 self
11768 }
11769 /// Optional. A list of asset types that the IAM policies are attached to. If empty, it will search the IAM policies that are attached to all the asset types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types) Regular expressions are also supported. For example: * "compute.googleapis.com.*" snapshots IAM policies attached to asset type starts with "compute.googleapis.com". * ".*Instance" snapshots IAM policies attached to asset type ends with "Instance". * ".*Instance.*" snapshots IAM policies attached to asset type contains "Instance". See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned.
11770 ///
11771 /// Append the given value to the *asset types* query property.
11772 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11773 pub fn add_asset_types(mut self, new_value: &str) -> MethodSearchAllIamPolicyCall<'a, C> {
11774 self._asset_types.push(new_value.to_string());
11775 self
11776 }
11777 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11778 /// while executing the actual API request.
11779 ///
11780 /// ````text
11781 /// It should be used to handle progress information, and to implement a certain level of resilience.
11782 /// ````
11783 ///
11784 /// Sets the *delegate* property to the given value.
11785 pub fn delegate(
11786 mut self,
11787 new_value: &'a mut dyn common::Delegate,
11788 ) -> MethodSearchAllIamPolicyCall<'a, C> {
11789 self._delegate = Some(new_value);
11790 self
11791 }
11792
11793 /// Set any additional parameter of the query string used in the request.
11794 /// It should be used to set parameters which are not yet available through their own
11795 /// setters.
11796 ///
11797 /// Please note that this method must not be used to set any of the known parameters
11798 /// which have their own setter method. If done anyway, the request will fail.
11799 ///
11800 /// # Additional Parameters
11801 ///
11802 /// * *$.xgafv* (query-string) - V1 error format.
11803 /// * *access_token* (query-string) - OAuth access token.
11804 /// * *alt* (query-string) - Data format for response.
11805 /// * *callback* (query-string) - JSONP
11806 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11807 /// * *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.
11808 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11809 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11810 /// * *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.
11811 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11812 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11813 pub fn param<T>(mut self, name: T, value: T) -> MethodSearchAllIamPolicyCall<'a, C>
11814 where
11815 T: AsRef<str>,
11816 {
11817 self._additional_params
11818 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11819 self
11820 }
11821
11822 /// Identifies the authorization scope for the method you are building.
11823 ///
11824 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11825 /// [`Scope::CloudPlatform`].
11826 ///
11827 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11828 /// tokens for more than one scope.
11829 ///
11830 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11831 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11832 /// sufficient, a read-write scope will do as well.
11833 pub fn add_scope<St>(mut self, scope: St) -> MethodSearchAllIamPolicyCall<'a, C>
11834 where
11835 St: AsRef<str>,
11836 {
11837 self._scopes.insert(String::from(scope.as_ref()));
11838 self
11839 }
11840 /// Identifies the authorization scope(s) for the method you are building.
11841 ///
11842 /// See [`Self::add_scope()`] for details.
11843 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodSearchAllIamPolicyCall<'a, C>
11844 where
11845 I: IntoIterator<Item = St>,
11846 St: AsRef<str>,
11847 {
11848 self._scopes
11849 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11850 self
11851 }
11852
11853 /// Removes all scopes, and no default scope will be used either.
11854 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11855 /// for details).
11856 pub fn clear_scopes(mut self) -> MethodSearchAllIamPolicyCall<'a, C> {
11857 self._scopes.clear();
11858 self
11859 }
11860}
11861
11862/// Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.
11863///
11864/// A builder for the *searchAllResources* method.
11865/// It is not used directly, but through a [`MethodMethods`] instance.
11866///
11867/// # Example
11868///
11869/// Instantiate a resource method builder
11870///
11871/// ```test_harness,no_run
11872/// # extern crate hyper;
11873/// # extern crate hyper_rustls;
11874/// # extern crate google_cloudasset1 as cloudasset1;
11875/// # async fn dox() {
11876/// # use cloudasset1::{CloudAsset, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11877///
11878/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11879/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11880/// # .with_native_roots()
11881/// # .unwrap()
11882/// # .https_only()
11883/// # .enable_http2()
11884/// # .build();
11885///
11886/// # let executor = hyper_util::rt::TokioExecutor::new();
11887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11888/// # secret,
11889/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11890/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11891/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11892/// # ),
11893/// # ).build().await.unwrap();
11894///
11895/// # let client = hyper_util::client::legacy::Client::builder(
11896/// # hyper_util::rt::TokioExecutor::new()
11897/// # )
11898/// # .build(
11899/// # hyper_rustls::HttpsConnectorBuilder::new()
11900/// # .with_native_roots()
11901/// # .unwrap()
11902/// # .https_or_http()
11903/// # .enable_http2()
11904/// # .build()
11905/// # );
11906/// # let mut hub = CloudAsset::new(client, auth);
11907/// // You can configure optional parameters by calling the respective setters at will, and
11908/// // execute the final call using `doit()`.
11909/// // Values shown here are possibly random and not representative !
11910/// let result = hub.methods().search_all_resources("scope")
11911/// .read_mask(FieldMask::new::<&str>(&[]))
11912/// .query("ipsum")
11913/// .page_token("accusam")
11914/// .page_size(-59)
11915/// .order_by("consetetur")
11916/// .add_asset_types("voluptua.")
11917/// .doit().await;
11918/// # }
11919/// ```
11920pub struct MethodSearchAllResourceCall<'a, C>
11921where
11922 C: 'a,
11923{
11924 hub: &'a CloudAsset<C>,
11925 _scope: String,
11926 _read_mask: Option<common::FieldMask>,
11927 _query: Option<String>,
11928 _page_token: Option<String>,
11929 _page_size: Option<i32>,
11930 _order_by: Option<String>,
11931 _asset_types: Vec<String>,
11932 _delegate: Option<&'a mut dyn common::Delegate>,
11933 _additional_params: HashMap<String, String>,
11934 _scopes: BTreeSet<String>,
11935}
11936
11937impl<'a, C> common::CallBuilder for MethodSearchAllResourceCall<'a, C> {}
11938
11939impl<'a, C> MethodSearchAllResourceCall<'a, C>
11940where
11941 C: common::Connector,
11942{
11943 /// Perform the operation you have build so far.
11944 pub async fn doit(mut self) -> common::Result<(common::Response, SearchAllResourcesResponse)> {
11945 use std::borrow::Cow;
11946 use std::io::{Read, Seek};
11947
11948 use common::{url::Params, ToParts};
11949 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11950
11951 let mut dd = common::DefaultDelegate;
11952 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11953 dlg.begin(common::MethodInfo {
11954 id: "cloudasset.searchAllResources",
11955 http_method: hyper::Method::GET,
11956 });
11957
11958 for &field in [
11959 "alt",
11960 "scope",
11961 "readMask",
11962 "query",
11963 "pageToken",
11964 "pageSize",
11965 "orderBy",
11966 "assetTypes",
11967 ]
11968 .iter()
11969 {
11970 if self._additional_params.contains_key(field) {
11971 dlg.finished(false);
11972 return Err(common::Error::FieldClash(field));
11973 }
11974 }
11975
11976 let mut params = Params::with_capacity(9 + self._additional_params.len());
11977 params.push("scope", self._scope);
11978 if let Some(value) = self._read_mask.as_ref() {
11979 params.push("readMask", value.to_string());
11980 }
11981 if let Some(value) = self._query.as_ref() {
11982 params.push("query", value);
11983 }
11984 if let Some(value) = self._page_token.as_ref() {
11985 params.push("pageToken", value);
11986 }
11987 if let Some(value) = self._page_size.as_ref() {
11988 params.push("pageSize", value.to_string());
11989 }
11990 if let Some(value) = self._order_by.as_ref() {
11991 params.push("orderBy", value);
11992 }
11993 if !self._asset_types.is_empty() {
11994 for f in self._asset_types.iter() {
11995 params.push("assetTypes", f);
11996 }
11997 }
11998
11999 params.extend(self._additional_params.iter());
12000
12001 params.push("alt", "json");
12002 let mut url = self.hub._base_url.clone() + "v1/{+scope}:searchAllResources";
12003 if self._scopes.is_empty() {
12004 self._scopes
12005 .insert(Scope::CloudPlatform.as_ref().to_string());
12006 }
12007
12008 #[allow(clippy::single_element_loop)]
12009 for &(find_this, param_name) in [("{+scope}", "scope")].iter() {
12010 url = params.uri_replacement(url, param_name, find_this, true);
12011 }
12012 {
12013 let to_remove = ["scope"];
12014 params.remove_params(&to_remove);
12015 }
12016
12017 let url = params.parse_with_url(&url);
12018
12019 loop {
12020 let token = match self
12021 .hub
12022 .auth
12023 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12024 .await
12025 {
12026 Ok(token) => token,
12027 Err(e) => match dlg.token(e) {
12028 Ok(token) => token,
12029 Err(e) => {
12030 dlg.finished(false);
12031 return Err(common::Error::MissingToken(e));
12032 }
12033 },
12034 };
12035 let mut req_result = {
12036 let client = &self.hub.client;
12037 dlg.pre_request();
12038 let mut req_builder = hyper::Request::builder()
12039 .method(hyper::Method::GET)
12040 .uri(url.as_str())
12041 .header(USER_AGENT, self.hub._user_agent.clone());
12042
12043 if let Some(token) = token.as_ref() {
12044 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12045 }
12046
12047 let request = req_builder
12048 .header(CONTENT_LENGTH, 0_u64)
12049 .body(common::to_body::<String>(None));
12050
12051 client.request(request.unwrap()).await
12052 };
12053
12054 match req_result {
12055 Err(err) => {
12056 if let common::Retry::After(d) = dlg.http_error(&err) {
12057 sleep(d).await;
12058 continue;
12059 }
12060 dlg.finished(false);
12061 return Err(common::Error::HttpError(err));
12062 }
12063 Ok(res) => {
12064 let (mut parts, body) = res.into_parts();
12065 let mut body = common::Body::new(body);
12066 if !parts.status.is_success() {
12067 let bytes = common::to_bytes(body).await.unwrap_or_default();
12068 let error = serde_json::from_str(&common::to_string(&bytes));
12069 let response = common::to_response(parts, bytes.into());
12070
12071 if let common::Retry::After(d) =
12072 dlg.http_failure(&response, error.as_ref().ok())
12073 {
12074 sleep(d).await;
12075 continue;
12076 }
12077
12078 dlg.finished(false);
12079
12080 return Err(match error {
12081 Ok(value) => common::Error::BadRequest(value),
12082 _ => common::Error::Failure(response),
12083 });
12084 }
12085 let response = {
12086 let bytes = common::to_bytes(body).await.unwrap_or_default();
12087 let encoded = common::to_string(&bytes);
12088 match serde_json::from_str(&encoded) {
12089 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12090 Err(error) => {
12091 dlg.response_json_decode_error(&encoded, &error);
12092 return Err(common::Error::JsonDecodeError(
12093 encoded.to_string(),
12094 error,
12095 ));
12096 }
12097 }
12098 };
12099
12100 dlg.finished(true);
12101 return Ok(response);
12102 }
12103 }
12104 }
12105 }
12106
12107 /// Required. A scope can be a project, a folder, or an organization. The search is limited to the resources within the `scope`. The caller must be granted the [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) permission on the desired scope. The allowed values are: * projects/{PROJECT_ID} (e.g., "projects/foo-bar") * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
12108 ///
12109 /// Sets the *scope* path property to the given value.
12110 ///
12111 /// Even though the property as already been set when instantiating this call,
12112 /// we provide this method for API completeness.
12113 pub fn scope(mut self, new_value: &str) -> MethodSearchAllResourceCall<'a, C> {
12114 self._scope = new_value.to_string();
12115 self
12116 }
12117 /// Optional. A comma-separated list of fields that you want returned in the results. The following fields are returned by default if not specified: * `name` * `assetType` * `project` * `folders` * `organization` * `displayName` * `description` * `location` * `labels` * `tags` * `effectiveTags` * `networkTags` * `kmsKeys` * `createTime` * `updateTime` * `state` * `additionalAttributes` * `parentFullResourceName` * `parentAssetType` Some fields of large size, such as `versionedResources`, `attachedResources`, `effectiveTags` etc., are not returned by default, but you can specify them in the `read_mask` parameter if you want to include them. If `"*"` is specified, all [available fields](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources#resourcesearchresult) are returned. Examples: `"name,location"`, `"name,versionedResources"`, `"*"`. Any invalid field path will trigger INVALID_ARGUMENT error.
12118 ///
12119 /// Sets the *read mask* query property to the given value.
12120 pub fn read_mask(mut self, new_value: common::FieldMask) -> MethodSearchAllResourceCall<'a, C> {
12121 self._read_mask = Some(new_value);
12122 self
12123 }
12124 /// Optional. The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) for more information. If not specified or empty, it will search all the resources within the specified `scope`. Examples: * `name:Important` to find Google Cloud resources whose name contains `Important` as a word. * `name=Important` to find the Google Cloud resource whose name is exactly `Important`. * `displayName:Impor*` to find Google Cloud resources whose display name contains `Impor` as a prefix of any word in the field. * `location:us-west*` to find Google Cloud resources whose location contains both `us` and `west` as prefixes. * `labels:prod` to find Google Cloud resources whose labels contain `prod` as a key or value. * `labels.env:prod` to find Google Cloud resources that have a label `env` and its value is `prod`. * `labels.env:*` to find Google Cloud resources that have a label `env`. * `tagKeys:env` to find Google Cloud resources that have directly attached tags where the [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey) contains `env`. * `tagValues:prod*` to find Google Cloud resources that have directly attached tags where the [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) contains a word prefixed by `prod`. * `tagValueIds=tagValues/123` to find Google Cloud resources that have directly attached tags where the [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) is exactly `tagValues/123`. * `effectiveTagKeys:env` to find Google Cloud resources that have directly attached or inherited tags where the [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey) contains `env`. * `effectiveTagValues:prod*` to find Google Cloud resources that have directly attached or inherited tags where the [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) contains a word prefixed by `prod`. * `effectiveTagValueIds=tagValues/123` to find Google Cloud resources that have directly attached or inherited tags where the [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue) is exactly `tagValues/123`. * `kmsKey:key` to find Google Cloud resources encrypted with a customer-managed encryption key whose name contains `key` as a word. This field is deprecated. Use the `kmsKeys` field to retrieve Cloud KMS key information. * `kmsKeys:key` to find Google Cloud resources encrypted with customer-managed encryption keys whose name contains the word `key`. * `relationships:instance-group-1` to find Google Cloud resources that have relationships with `instance-group-1` in the related resource name. * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine instances that have relationships of type `INSTANCE_TO_INSTANCEGROUP`. * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find Compute Engine instances that have relationships with `instance-group-1` in the Compute Engine instance group resource name, for relationship type `INSTANCE_TO_INSTANCEGROUP`. * `sccSecurityMarks.key=value` to find Cloud resources that are attached with security marks whose key is `key` and value is `value`. * `sccSecurityMarks.key:*` to find Cloud resources that are attached with security marks whose key is `key`. * `state:ACTIVE` to find Google Cloud resources whose state contains `ACTIVE` as a word. * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't contain `ACTIVE` as a word. * `createTime<1609459200` to find Google Cloud resources that were created before `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of `2021-01-01 00:00:00 UTC` in seconds. * `updateTime>1609459200` to find Google Cloud resources that were updated after `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of `2021-01-01 00:00:00 UTC` in seconds. * `Important` to find Google Cloud resources that contain `Important` as a word in any of the searchable fields. * `Impor*` to find Google Cloud resources that contain `Impor` as a prefix of any word in any of the searchable fields. * `Important location:(us-west1 OR global)` to find Google Cloud resources that contain `Important` as a word in any of the searchable fields and are also located in the `us-west1` region or the `global` location.
12125 ///
12126 /// Sets the *query* query property to the given value.
12127 pub fn query(mut self, new_value: &str) -> MethodSearchAllResourceCall<'a, C> {
12128 self._query = Some(new_value.to_string());
12129 self
12130 }
12131 /// Optional. If present, then retrieve the next batch of results from the preceding call to this method. `page_token` must be the value of `next_page_token` from the previous response. The values of all other method parameters, must be identical to those in the previous call.
12132 ///
12133 /// Sets the *page token* query property to the given value.
12134 pub fn page_token(mut self, new_value: &str) -> MethodSearchAllResourceCall<'a, C> {
12135 self._page_token = Some(new_value.to_string());
12136 self
12137 }
12138 /// Optional. The page size for search result pagination. Page size is capped at 500 even if a larger value is given. If set to zero or a negative value, server will pick an appropriate default. Returned results may be fewer than requested. When this happens, there could be more results as long as `next_page_token` is returned.
12139 ///
12140 /// Sets the *page size* query property to the given value.
12141 pub fn page_size(mut self, new_value: i32) -> MethodSearchAllResourceCall<'a, C> {
12142 self._page_size = Some(new_value);
12143 self
12144 }
12145 /// Optional. A comma-separated list of fields specifying the sorting order of the results. The default order is ascending. Add " DESC" after the field name to indicate descending order. Redundant space characters are ignored. Example: "location DESC, name". Only the following fields in the response are sortable: * name * assetType * project * displayName * description * location * createTime * updateTime * state * parentFullResourceName * parentAssetType
12146 ///
12147 /// Sets the *order by* query property to the given value.
12148 pub fn order_by(mut self, new_value: &str) -> MethodSearchAllResourceCall<'a, C> {
12149 self._order_by = Some(new_value.to_string());
12150 self
12151 }
12152 /// Optional. A list of asset types that this request searches for. If empty, it will search all the asset types [supported by search APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types). Regular expressions are also supported. For example: * "compute.googleapis.com.*" snapshots resources whose asset type starts with "compute.googleapis.com". * ".*Instance" snapshots resources whose asset type ends with "Instance". * ".*Instance.*" snapshots resources whose asset type contains "Instance". See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned.
12153 ///
12154 /// Append the given value to the *asset types* query property.
12155 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
12156 pub fn add_asset_types(mut self, new_value: &str) -> MethodSearchAllResourceCall<'a, C> {
12157 self._asset_types.push(new_value.to_string());
12158 self
12159 }
12160 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12161 /// while executing the actual API request.
12162 ///
12163 /// ````text
12164 /// It should be used to handle progress information, and to implement a certain level of resilience.
12165 /// ````
12166 ///
12167 /// Sets the *delegate* property to the given value.
12168 pub fn delegate(
12169 mut self,
12170 new_value: &'a mut dyn common::Delegate,
12171 ) -> MethodSearchAllResourceCall<'a, C> {
12172 self._delegate = Some(new_value);
12173 self
12174 }
12175
12176 /// Set any additional parameter of the query string used in the request.
12177 /// It should be used to set parameters which are not yet available through their own
12178 /// setters.
12179 ///
12180 /// Please note that this method must not be used to set any of the known parameters
12181 /// which have their own setter method. If done anyway, the request will fail.
12182 ///
12183 /// # Additional Parameters
12184 ///
12185 /// * *$.xgafv* (query-string) - V1 error format.
12186 /// * *access_token* (query-string) - OAuth access token.
12187 /// * *alt* (query-string) - Data format for response.
12188 /// * *callback* (query-string) - JSONP
12189 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12190 /// * *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.
12191 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12192 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12193 /// * *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.
12194 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12195 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12196 pub fn param<T>(mut self, name: T, value: T) -> MethodSearchAllResourceCall<'a, C>
12197 where
12198 T: AsRef<str>,
12199 {
12200 self._additional_params
12201 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12202 self
12203 }
12204
12205 /// Identifies the authorization scope for the method you are building.
12206 ///
12207 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12208 /// [`Scope::CloudPlatform`].
12209 ///
12210 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12211 /// tokens for more than one scope.
12212 ///
12213 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12214 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12215 /// sufficient, a read-write scope will do as well.
12216 pub fn add_scope<St>(mut self, scope: St) -> MethodSearchAllResourceCall<'a, C>
12217 where
12218 St: AsRef<str>,
12219 {
12220 self._scopes.insert(String::from(scope.as_ref()));
12221 self
12222 }
12223 /// Identifies the authorization scope(s) for the method you are building.
12224 ///
12225 /// See [`Self::add_scope()`] for details.
12226 pub fn add_scopes<I, St>(mut self, scopes: I) -> MethodSearchAllResourceCall<'a, C>
12227 where
12228 I: IntoIterator<Item = St>,
12229 St: AsRef<str>,
12230 {
12231 self._scopes
12232 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12233 self
12234 }
12235
12236 /// Removes all scopes, and no default scope will be used either.
12237 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12238 /// for details).
12239 pub fn clear_scopes(mut self) -> MethodSearchAllResourceCall<'a, C> {
12240 self._scopes.clear();
12241 self
12242 }
12243}