google_cloud_asset_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate accesscontextmanager_v1;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate gtype;
26extern crate iam_v1;
27extern crate lazy_static;
28extern crate longrunning;
29extern crate lro;
30extern crate orgpolicy_v1;
31extern crate osconfig_v1;
32extern crate reqwest;
33extern crate rpc;
34extern crate serde;
35extern crate serde_json;
36extern crate serde_with;
37extern crate std;
38extern crate tracing;
39extern crate wkt;
40
41mod debug;
42mod deserialize;
43mod serialize;
44
45/// The resource owners information.
46#[derive(Clone, Default, PartialEq)]
47#[non_exhaustive]
48pub struct ResourceOwners {
49 /// List of resource owners.
50 pub resource_owners: std::vec::Vec<std::string::String>,
51
52 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
53}
54
55impl ResourceOwners {
56 pub fn new() -> Self {
57 std::default::Default::default()
58 }
59
60 /// Sets the value of [resource_owners][crate::model::ResourceOwners::resource_owners].
61 pub fn set_resource_owners<T, V>(mut self, v: T) -> Self
62 where
63 T: std::iter::IntoIterator<Item = V>,
64 V: std::convert::Into<std::string::String>,
65 {
66 use std::iter::Iterator;
67 self.resource_owners = v.into_iter().map(|i| i.into()).collect();
68 self
69 }
70}
71
72impl wkt::message::Message for ResourceOwners {
73 fn typename() -> &'static str {
74 "type.googleapis.com/google.cloud.asset.v1.ResourceOwners"
75 }
76}
77
78/// Represents the metadata of the longrunning operation for the
79/// AnalyzeIamPolicyLongrunning RPC.
80#[derive(Clone, Default, PartialEq)]
81#[non_exhaustive]
82pub struct AnalyzeIamPolicyLongrunningMetadata {
83 /// Output only. The time the operation was created.
84 pub create_time: std::option::Option<wkt::Timestamp>,
85
86 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl AnalyzeIamPolicyLongrunningMetadata {
90 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [create_time][crate::model::AnalyzeIamPolicyLongrunningMetadata::create_time].
95 pub fn set_create_time<T>(mut self, v: T) -> Self
96 where
97 T: std::convert::Into<wkt::Timestamp>,
98 {
99 self.create_time = std::option::Option::Some(v.into());
100 self
101 }
102
103 /// Sets or clears the value of [create_time][crate::model::AnalyzeIamPolicyLongrunningMetadata::create_time].
104 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
105 where
106 T: std::convert::Into<wkt::Timestamp>,
107 {
108 self.create_time = v.map(|x| x.into());
109 self
110 }
111}
112
113impl wkt::message::Message for AnalyzeIamPolicyLongrunningMetadata {
114 fn typename() -> &'static str {
115 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata"
116 }
117}
118
119/// Export asset request.
120#[derive(Clone, Default, PartialEq)]
121#[non_exhaustive]
122pub struct ExportAssetsRequest {
123 /// Required. The relative name of the root asset. This can only be an
124 /// organization number (such as "organizations/123"), a project ID (such as
125 /// "projects/my-project-id"), or a project number (such as "projects/12345"),
126 /// or a folder number (such as "folders/123").
127 pub parent: std::string::String,
128
129 /// Timestamp to take an asset snapshot. This can only be set to a timestamp
130 /// between the current time and the current time minus 35 days (inclusive).
131 /// If not specified, the current time will be used. Due to delays in resource
132 /// data collection and indexing, there is a volatile window during which
133 /// running the same query may get different results.
134 pub read_time: std::option::Option<wkt::Timestamp>,
135
136 /// A list of asset types to take a snapshot for. For example:
137 /// "compute.googleapis.com/Disk".
138 ///
139 /// Regular expressions are also supported. For example:
140 ///
141 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
142 /// with "compute.googleapis.com".
143 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
144 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
145 ///
146 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
147 /// regular expression syntax. If the regular expression does not match any
148 /// supported asset type, an INVALID_ARGUMENT error will be returned.
149 ///
150 /// If specified, only matching assets will be returned, otherwise, it will
151 /// snapshot all asset types. See [Introduction to Cloud Asset
152 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
153 /// for all supported asset types.
154 pub asset_types: std::vec::Vec<std::string::String>,
155
156 /// Asset content type. If not specified, no content but the asset name will be
157 /// returned.
158 pub content_type: crate::model::ContentType,
159
160 /// Required. Output configuration indicating where the results will be output
161 /// to.
162 pub output_config: std::option::Option<crate::model::OutputConfig>,
163
164 /// A list of relationship types to export, for example:
165 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
166 /// content_type=RELATIONSHIP.
167 ///
168 /// * If specified:
169 /// it snapshots specified relationships. It returns an error if
170 /// any of the [relationship_types] doesn't belong to the supported
171 /// relationship types of the [asset_types] or if any of the [asset_types]
172 /// doesn't belong to the source types of the [relationship_types].
173 /// * Otherwise:
174 /// it snapshots the supported relationships for all [asset_types] or returns
175 /// an error if any of the [asset_types] has no relationship support.
176 /// An unspecified asset types field means all supported asset_types.
177 /// See [Introduction to Cloud Asset
178 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
179 /// supported asset types and relationship types.
180 pub relationship_types: std::vec::Vec<std::string::String>,
181
182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
183}
184
185impl ExportAssetsRequest {
186 pub fn new() -> Self {
187 std::default::Default::default()
188 }
189
190 /// Sets the value of [parent][crate::model::ExportAssetsRequest::parent].
191 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
192 self.parent = v.into();
193 self
194 }
195
196 /// Sets the value of [read_time][crate::model::ExportAssetsRequest::read_time].
197 pub fn set_read_time<T>(mut self, v: T) -> Self
198 where
199 T: std::convert::Into<wkt::Timestamp>,
200 {
201 self.read_time = std::option::Option::Some(v.into());
202 self
203 }
204
205 /// Sets or clears the value of [read_time][crate::model::ExportAssetsRequest::read_time].
206 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
207 where
208 T: std::convert::Into<wkt::Timestamp>,
209 {
210 self.read_time = v.map(|x| x.into());
211 self
212 }
213
214 /// Sets the value of [asset_types][crate::model::ExportAssetsRequest::asset_types].
215 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
216 where
217 T: std::iter::IntoIterator<Item = V>,
218 V: std::convert::Into<std::string::String>,
219 {
220 use std::iter::Iterator;
221 self.asset_types = v.into_iter().map(|i| i.into()).collect();
222 self
223 }
224
225 /// Sets the value of [content_type][crate::model::ExportAssetsRequest::content_type].
226 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
227 mut self,
228 v: T,
229 ) -> Self {
230 self.content_type = v.into();
231 self
232 }
233
234 /// Sets the value of [output_config][crate::model::ExportAssetsRequest::output_config].
235 pub fn set_output_config<T>(mut self, v: T) -> Self
236 where
237 T: std::convert::Into<crate::model::OutputConfig>,
238 {
239 self.output_config = std::option::Option::Some(v.into());
240 self
241 }
242
243 /// Sets or clears the value of [output_config][crate::model::ExportAssetsRequest::output_config].
244 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
245 where
246 T: std::convert::Into<crate::model::OutputConfig>,
247 {
248 self.output_config = v.map(|x| x.into());
249 self
250 }
251
252 /// Sets the value of [relationship_types][crate::model::ExportAssetsRequest::relationship_types].
253 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
254 where
255 T: std::iter::IntoIterator<Item = V>,
256 V: std::convert::Into<std::string::String>,
257 {
258 use std::iter::Iterator;
259 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
260 self
261 }
262}
263
264impl wkt::message::Message for ExportAssetsRequest {
265 fn typename() -> &'static str {
266 "type.googleapis.com/google.cloud.asset.v1.ExportAssetsRequest"
267 }
268}
269
270/// The export asset response. This message is returned by the
271/// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
272/// method in the returned
273/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
274/// field.
275///
276/// [google.longrunning.Operation.response]: longrunning::model::Operation::result
277#[derive(Clone, Default, PartialEq)]
278#[non_exhaustive]
279pub struct ExportAssetsResponse {
280 /// Time the snapshot was taken.
281 pub read_time: std::option::Option<wkt::Timestamp>,
282
283 /// Output configuration indicating where the results were output to.
284 pub output_config: std::option::Option<crate::model::OutputConfig>,
285
286 /// Output result indicating where the assets were exported to. For example, a
287 /// set of actual Cloud Storage object URIs where the assets are exported to.
288 /// The URIs can be different from what [output_config] has specified, as the
289 /// service will split the output object into multiple ones once it exceeds a
290 /// single Cloud Storage object limit.
291 pub output_result: std::option::Option<crate::model::OutputResult>,
292
293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
294}
295
296impl ExportAssetsResponse {
297 pub fn new() -> Self {
298 std::default::Default::default()
299 }
300
301 /// Sets the value of [read_time][crate::model::ExportAssetsResponse::read_time].
302 pub fn set_read_time<T>(mut self, v: T) -> Self
303 where
304 T: std::convert::Into<wkt::Timestamp>,
305 {
306 self.read_time = std::option::Option::Some(v.into());
307 self
308 }
309
310 /// Sets or clears the value of [read_time][crate::model::ExportAssetsResponse::read_time].
311 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
312 where
313 T: std::convert::Into<wkt::Timestamp>,
314 {
315 self.read_time = v.map(|x| x.into());
316 self
317 }
318
319 /// Sets the value of [output_config][crate::model::ExportAssetsResponse::output_config].
320 pub fn set_output_config<T>(mut self, v: T) -> Self
321 where
322 T: std::convert::Into<crate::model::OutputConfig>,
323 {
324 self.output_config = std::option::Option::Some(v.into());
325 self
326 }
327
328 /// Sets or clears the value of [output_config][crate::model::ExportAssetsResponse::output_config].
329 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
330 where
331 T: std::convert::Into<crate::model::OutputConfig>,
332 {
333 self.output_config = v.map(|x| x.into());
334 self
335 }
336
337 /// Sets the value of [output_result][crate::model::ExportAssetsResponse::output_result].
338 pub fn set_output_result<T>(mut self, v: T) -> Self
339 where
340 T: std::convert::Into<crate::model::OutputResult>,
341 {
342 self.output_result = std::option::Option::Some(v.into());
343 self
344 }
345
346 /// Sets or clears the value of [output_result][crate::model::ExportAssetsResponse::output_result].
347 pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
348 where
349 T: std::convert::Into<crate::model::OutputResult>,
350 {
351 self.output_result = v.map(|x| x.into());
352 self
353 }
354}
355
356impl wkt::message::Message for ExportAssetsResponse {
357 fn typename() -> &'static str {
358 "type.googleapis.com/google.cloud.asset.v1.ExportAssetsResponse"
359 }
360}
361
362/// ListAssets request.
363#[derive(Clone, Default, PartialEq)]
364#[non_exhaustive]
365pub struct ListAssetsRequest {
366 /// Required. Name of the organization, folder, or project the assets belong
367 /// to. Format: "organizations/[organization-number]" (such as
368 /// "organizations/123"), "projects/[project-id]" (such as
369 /// "projects/my-project-id"), "projects/[project-number]" (such as
370 /// "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
371 pub parent: std::string::String,
372
373 /// Timestamp to take an asset snapshot. This can only be set to a timestamp
374 /// between the current time and the current time minus 35 days (inclusive).
375 /// If not specified, the current time will be used. Due to delays in resource
376 /// data collection and indexing, there is a volatile window during which
377 /// running the same query may get different results.
378 pub read_time: std::option::Option<wkt::Timestamp>,
379
380 /// A list of asset types to take a snapshot for. For example:
381 /// "compute.googleapis.com/Disk".
382 ///
383 /// Regular expression is also supported. For example:
384 ///
385 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
386 /// with "compute.googleapis.com".
387 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
388 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
389 ///
390 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
391 /// regular expression syntax. If the regular expression does not match any
392 /// supported asset type, an INVALID_ARGUMENT error will be returned.
393 ///
394 /// If specified, only matching assets will be returned, otherwise, it will
395 /// snapshot all asset types. See [Introduction to Cloud Asset
396 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
397 /// for all supported asset types.
398 pub asset_types: std::vec::Vec<std::string::String>,
399
400 /// Asset content type. If not specified, no content but the asset name will
401 /// be returned.
402 pub content_type: crate::model::ContentType,
403
404 /// The maximum number of assets to be returned in a single response. Default
405 /// is 100, minimum is 1, and maximum is 1000.
406 pub page_size: i32,
407
408 /// The `next_page_token` returned from the previous `ListAssetsResponse`, or
409 /// unspecified for the first `ListAssetsRequest`. It is a continuation of a
410 /// prior `ListAssets` call, and the API should return the next page of assets.
411 pub page_token: std::string::String,
412
413 /// A list of relationship types to output, for example:
414 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
415 /// content_type=RELATIONSHIP.
416 ///
417 /// * If specified:
418 /// it snapshots specified relationships. It returns an error if
419 /// any of the [relationship_types] doesn't belong to the supported
420 /// relationship types of the [asset_types] or if any of the [asset_types]
421 /// doesn't belong to the source types of the [relationship_types].
422 /// * Otherwise:
423 /// it snapshots the supported relationships for all [asset_types] or returns
424 /// an error if any of the [asset_types] has no relationship support.
425 /// An unspecified asset types field means all supported asset_types.
426 /// See [Introduction to Cloud Asset
427 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
428 /// for all supported asset types and relationship types.
429 pub relationship_types: std::vec::Vec<std::string::String>,
430
431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
432}
433
434impl ListAssetsRequest {
435 pub fn new() -> Self {
436 std::default::Default::default()
437 }
438
439 /// Sets the value of [parent][crate::model::ListAssetsRequest::parent].
440 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
441 self.parent = v.into();
442 self
443 }
444
445 /// Sets the value of [read_time][crate::model::ListAssetsRequest::read_time].
446 pub fn set_read_time<T>(mut self, v: T) -> Self
447 where
448 T: std::convert::Into<wkt::Timestamp>,
449 {
450 self.read_time = std::option::Option::Some(v.into());
451 self
452 }
453
454 /// Sets or clears the value of [read_time][crate::model::ListAssetsRequest::read_time].
455 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
456 where
457 T: std::convert::Into<wkt::Timestamp>,
458 {
459 self.read_time = v.map(|x| x.into());
460 self
461 }
462
463 /// Sets the value of [asset_types][crate::model::ListAssetsRequest::asset_types].
464 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
465 where
466 T: std::iter::IntoIterator<Item = V>,
467 V: std::convert::Into<std::string::String>,
468 {
469 use std::iter::Iterator;
470 self.asset_types = v.into_iter().map(|i| i.into()).collect();
471 self
472 }
473
474 /// Sets the value of [content_type][crate::model::ListAssetsRequest::content_type].
475 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
476 mut self,
477 v: T,
478 ) -> Self {
479 self.content_type = v.into();
480 self
481 }
482
483 /// Sets the value of [page_size][crate::model::ListAssetsRequest::page_size].
484 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
485 self.page_size = v.into();
486 self
487 }
488
489 /// Sets the value of [page_token][crate::model::ListAssetsRequest::page_token].
490 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
491 self.page_token = v.into();
492 self
493 }
494
495 /// Sets the value of [relationship_types][crate::model::ListAssetsRequest::relationship_types].
496 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
497 where
498 T: std::iter::IntoIterator<Item = V>,
499 V: std::convert::Into<std::string::String>,
500 {
501 use std::iter::Iterator;
502 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
503 self
504 }
505}
506
507impl wkt::message::Message for ListAssetsRequest {
508 fn typename() -> &'static str {
509 "type.googleapis.com/google.cloud.asset.v1.ListAssetsRequest"
510 }
511}
512
513/// ListAssets response.
514#[derive(Clone, Default, PartialEq)]
515#[non_exhaustive]
516pub struct ListAssetsResponse {
517 /// Time the snapshot was taken.
518 pub read_time: std::option::Option<wkt::Timestamp>,
519
520 /// Assets.
521 pub assets: std::vec::Vec<crate::model::Asset>,
522
523 /// Token to retrieve the next page of results. It expires 72 hours after the
524 /// page token for the first page is generated. Set to empty if there are no
525 /// remaining results.
526 pub next_page_token: std::string::String,
527
528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
529}
530
531impl ListAssetsResponse {
532 pub fn new() -> Self {
533 std::default::Default::default()
534 }
535
536 /// Sets the value of [read_time][crate::model::ListAssetsResponse::read_time].
537 pub fn set_read_time<T>(mut self, v: T) -> Self
538 where
539 T: std::convert::Into<wkt::Timestamp>,
540 {
541 self.read_time = std::option::Option::Some(v.into());
542 self
543 }
544
545 /// Sets or clears the value of [read_time][crate::model::ListAssetsResponse::read_time].
546 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
547 where
548 T: std::convert::Into<wkt::Timestamp>,
549 {
550 self.read_time = v.map(|x| x.into());
551 self
552 }
553
554 /// Sets the value of [assets][crate::model::ListAssetsResponse::assets].
555 pub fn set_assets<T, V>(mut self, v: T) -> Self
556 where
557 T: std::iter::IntoIterator<Item = V>,
558 V: std::convert::Into<crate::model::Asset>,
559 {
560 use std::iter::Iterator;
561 self.assets = v.into_iter().map(|i| i.into()).collect();
562 self
563 }
564
565 /// Sets the value of [next_page_token][crate::model::ListAssetsResponse::next_page_token].
566 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
567 self.next_page_token = v.into();
568 self
569 }
570}
571
572impl wkt::message::Message for ListAssetsResponse {
573 fn typename() -> &'static str {
574 "type.googleapis.com/google.cloud.asset.v1.ListAssetsResponse"
575 }
576}
577
578#[doc(hidden)]
579impl gax::paginator::internal::PageableResponse for ListAssetsResponse {
580 type PageItem = crate::model::Asset;
581
582 fn items(self) -> std::vec::Vec<Self::PageItem> {
583 self.assets
584 }
585
586 fn next_page_token(&self) -> std::string::String {
587 use std::clone::Clone;
588 self.next_page_token.clone()
589 }
590}
591
592/// Batch get assets history request.
593#[derive(Clone, Default, PartialEq)]
594#[non_exhaustive]
595pub struct BatchGetAssetsHistoryRequest {
596 /// Required. The relative name of the root asset. It can only be an
597 /// organization number (such as "organizations/123"), a project ID (such as
598 /// "projects/my-project-id")", or a project number (such as "projects/12345").
599 pub parent: std::string::String,
600
601 /// A list of the full names of the assets.
602 /// See: <https://cloud.google.com/asset-inventory/docs/resource-name-format>
603 /// Example:
604 ///
605 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
606 ///
607 /// The request becomes a no-op if the asset name list is empty, and the max
608 /// size of the asset name list is 100 in one request.
609 pub asset_names: std::vec::Vec<std::string::String>,
610
611 /// Optional. The content type.
612 pub content_type: crate::model::ContentType,
613
614 /// Optional. The time window for the asset history. Both start_time and
615 /// end_time are optional and if set, it must be after the current time minus
616 /// 35 days. If end_time is not set, it is default to current timestamp.
617 /// If start_time is not set, the snapshot of the assets at end_time will be
618 /// returned. The returned results contain all temporal assets whose time
619 /// window overlap with read_time_window.
620 pub read_time_window: std::option::Option<crate::model::TimeWindow>,
621
622 /// Optional. A list of relationship types to output, for example:
623 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
624 /// content_type=RELATIONSHIP.
625 ///
626 /// * If specified:
627 /// it outputs specified relationships' history on the [asset_names]. It
628 /// returns an error if any of the [relationship_types] doesn't belong to the
629 /// supported relationship types of the [asset_names] or if any of the
630 /// [asset_names]'s types doesn't belong to the source types of the
631 /// [relationship_types].
632 /// * Otherwise:
633 /// it outputs the supported relationships' history on the [asset_names] or
634 /// returns an error if any of the [asset_names]'s types has no relationship
635 /// support.
636 /// See [Introduction to Cloud Asset
637 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
638 /// supported asset types and relationship types.
639 pub relationship_types: std::vec::Vec<std::string::String>,
640
641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
642}
643
644impl BatchGetAssetsHistoryRequest {
645 pub fn new() -> Self {
646 std::default::Default::default()
647 }
648
649 /// Sets the value of [parent][crate::model::BatchGetAssetsHistoryRequest::parent].
650 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
651 self.parent = v.into();
652 self
653 }
654
655 /// Sets the value of [asset_names][crate::model::BatchGetAssetsHistoryRequest::asset_names].
656 pub fn set_asset_names<T, V>(mut self, v: T) -> Self
657 where
658 T: std::iter::IntoIterator<Item = V>,
659 V: std::convert::Into<std::string::String>,
660 {
661 use std::iter::Iterator;
662 self.asset_names = v.into_iter().map(|i| i.into()).collect();
663 self
664 }
665
666 /// Sets the value of [content_type][crate::model::BatchGetAssetsHistoryRequest::content_type].
667 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
668 mut self,
669 v: T,
670 ) -> Self {
671 self.content_type = v.into();
672 self
673 }
674
675 /// Sets the value of [read_time_window][crate::model::BatchGetAssetsHistoryRequest::read_time_window].
676 pub fn set_read_time_window<T>(mut self, v: T) -> Self
677 where
678 T: std::convert::Into<crate::model::TimeWindow>,
679 {
680 self.read_time_window = std::option::Option::Some(v.into());
681 self
682 }
683
684 /// Sets or clears the value of [read_time_window][crate::model::BatchGetAssetsHistoryRequest::read_time_window].
685 pub fn set_or_clear_read_time_window<T>(mut self, v: std::option::Option<T>) -> Self
686 where
687 T: std::convert::Into<crate::model::TimeWindow>,
688 {
689 self.read_time_window = v.map(|x| x.into());
690 self
691 }
692
693 /// Sets the value of [relationship_types][crate::model::BatchGetAssetsHistoryRequest::relationship_types].
694 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
695 where
696 T: std::iter::IntoIterator<Item = V>,
697 V: std::convert::Into<std::string::String>,
698 {
699 use std::iter::Iterator;
700 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
701 self
702 }
703}
704
705impl wkt::message::Message for BatchGetAssetsHistoryRequest {
706 fn typename() -> &'static str {
707 "type.googleapis.com/google.cloud.asset.v1.BatchGetAssetsHistoryRequest"
708 }
709}
710
711/// Batch get assets history response.
712#[derive(Clone, Default, PartialEq)]
713#[non_exhaustive]
714pub struct BatchGetAssetsHistoryResponse {
715 /// A list of assets with valid time windows.
716 pub assets: std::vec::Vec<crate::model::TemporalAsset>,
717
718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
719}
720
721impl BatchGetAssetsHistoryResponse {
722 pub fn new() -> Self {
723 std::default::Default::default()
724 }
725
726 /// Sets the value of [assets][crate::model::BatchGetAssetsHistoryResponse::assets].
727 pub fn set_assets<T, V>(mut self, v: T) -> Self
728 where
729 T: std::iter::IntoIterator<Item = V>,
730 V: std::convert::Into<crate::model::TemporalAsset>,
731 {
732 use std::iter::Iterator;
733 self.assets = v.into_iter().map(|i| i.into()).collect();
734 self
735 }
736}
737
738impl wkt::message::Message for BatchGetAssetsHistoryResponse {
739 fn typename() -> &'static str {
740 "type.googleapis.com/google.cloud.asset.v1.BatchGetAssetsHistoryResponse"
741 }
742}
743
744/// Create asset feed request.
745#[derive(Clone, Default, PartialEq)]
746#[non_exhaustive]
747pub struct CreateFeedRequest {
748 /// Required. The name of the project/folder/organization where this feed
749 /// should be created in. It can only be an organization number (such as
750 /// "organizations/123"), a folder number (such as "folders/123"), a project ID
751 /// (such as "projects/my-project-id"), or a project number (such as
752 /// "projects/12345").
753 pub parent: std::string::String,
754
755 /// Required. This is the client-assigned asset feed identifier and it needs to
756 /// be unique under a specific parent project/folder/organization.
757 pub feed_id: std::string::String,
758
759 /// Required. The feed details. The field `name` must be empty and it will be
760 /// generated in the format of: projects/project_number/feeds/feed_id
761 /// folders/folder_number/feeds/feed_id
762 /// organizations/organization_number/feeds/feed_id
763 pub feed: std::option::Option<crate::model::Feed>,
764
765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
766}
767
768impl CreateFeedRequest {
769 pub fn new() -> Self {
770 std::default::Default::default()
771 }
772
773 /// Sets the value of [parent][crate::model::CreateFeedRequest::parent].
774 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
775 self.parent = v.into();
776 self
777 }
778
779 /// Sets the value of [feed_id][crate::model::CreateFeedRequest::feed_id].
780 pub fn set_feed_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
781 self.feed_id = v.into();
782 self
783 }
784
785 /// Sets the value of [feed][crate::model::CreateFeedRequest::feed].
786 pub fn set_feed<T>(mut self, v: T) -> Self
787 where
788 T: std::convert::Into<crate::model::Feed>,
789 {
790 self.feed = std::option::Option::Some(v.into());
791 self
792 }
793
794 /// Sets or clears the value of [feed][crate::model::CreateFeedRequest::feed].
795 pub fn set_or_clear_feed<T>(mut self, v: std::option::Option<T>) -> Self
796 where
797 T: std::convert::Into<crate::model::Feed>,
798 {
799 self.feed = v.map(|x| x.into());
800 self
801 }
802}
803
804impl wkt::message::Message for CreateFeedRequest {
805 fn typename() -> &'static str {
806 "type.googleapis.com/google.cloud.asset.v1.CreateFeedRequest"
807 }
808}
809
810/// Get asset feed request.
811#[derive(Clone, Default, PartialEq)]
812#[non_exhaustive]
813pub struct GetFeedRequest {
814 /// Required. The name of the Feed and it must be in the format of:
815 /// projects/project_number/feeds/feed_id
816 /// folders/folder_number/feeds/feed_id
817 /// organizations/organization_number/feeds/feed_id
818 pub name: std::string::String,
819
820 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
821}
822
823impl GetFeedRequest {
824 pub fn new() -> Self {
825 std::default::Default::default()
826 }
827
828 /// Sets the value of [name][crate::model::GetFeedRequest::name].
829 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
830 self.name = v.into();
831 self
832 }
833}
834
835impl wkt::message::Message for GetFeedRequest {
836 fn typename() -> &'static str {
837 "type.googleapis.com/google.cloud.asset.v1.GetFeedRequest"
838 }
839}
840
841/// List asset feeds request.
842#[derive(Clone, Default, PartialEq)]
843#[non_exhaustive]
844pub struct ListFeedsRequest {
845 /// Required. The parent project/folder/organization whose feeds are to be
846 /// listed. It can only be using project/folder/organization number (such as
847 /// "folders/12345")", or a project ID (such as "projects/my-project-id").
848 pub parent: std::string::String,
849
850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
851}
852
853impl ListFeedsRequest {
854 pub fn new() -> Self {
855 std::default::Default::default()
856 }
857
858 /// Sets the value of [parent][crate::model::ListFeedsRequest::parent].
859 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
860 self.parent = v.into();
861 self
862 }
863}
864
865impl wkt::message::Message for ListFeedsRequest {
866 fn typename() -> &'static str {
867 "type.googleapis.com/google.cloud.asset.v1.ListFeedsRequest"
868 }
869}
870
871#[derive(Clone, Default, PartialEq)]
872#[non_exhaustive]
873pub struct ListFeedsResponse {
874 /// A list of feeds.
875 pub feeds: std::vec::Vec<crate::model::Feed>,
876
877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
878}
879
880impl ListFeedsResponse {
881 pub fn new() -> Self {
882 std::default::Default::default()
883 }
884
885 /// Sets the value of [feeds][crate::model::ListFeedsResponse::feeds].
886 pub fn set_feeds<T, V>(mut self, v: T) -> Self
887 where
888 T: std::iter::IntoIterator<Item = V>,
889 V: std::convert::Into<crate::model::Feed>,
890 {
891 use std::iter::Iterator;
892 self.feeds = v.into_iter().map(|i| i.into()).collect();
893 self
894 }
895}
896
897impl wkt::message::Message for ListFeedsResponse {
898 fn typename() -> &'static str {
899 "type.googleapis.com/google.cloud.asset.v1.ListFeedsResponse"
900 }
901}
902
903/// Update asset feed request.
904#[derive(Clone, Default, PartialEq)]
905#[non_exhaustive]
906pub struct UpdateFeedRequest {
907 /// Required. The new values of feed details. It must match an existing feed
908 /// and the field `name` must be in the format of:
909 /// projects/project_number/feeds/feed_id or
910 /// folders/folder_number/feeds/feed_id or
911 /// organizations/organization_number/feeds/feed_id.
912 pub feed: std::option::Option<crate::model::Feed>,
913
914 /// Required. Only updates the `feed` fields indicated by this mask.
915 /// The field mask must not be empty, and it must not contain fields that
916 /// are immutable or only set by the server.
917 pub update_mask: std::option::Option<wkt::FieldMask>,
918
919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
920}
921
922impl UpdateFeedRequest {
923 pub fn new() -> Self {
924 std::default::Default::default()
925 }
926
927 /// Sets the value of [feed][crate::model::UpdateFeedRequest::feed].
928 pub fn set_feed<T>(mut self, v: T) -> Self
929 where
930 T: std::convert::Into<crate::model::Feed>,
931 {
932 self.feed = std::option::Option::Some(v.into());
933 self
934 }
935
936 /// Sets or clears the value of [feed][crate::model::UpdateFeedRequest::feed].
937 pub fn set_or_clear_feed<T>(mut self, v: std::option::Option<T>) -> Self
938 where
939 T: std::convert::Into<crate::model::Feed>,
940 {
941 self.feed = v.map(|x| x.into());
942 self
943 }
944
945 /// Sets the value of [update_mask][crate::model::UpdateFeedRequest::update_mask].
946 pub fn set_update_mask<T>(mut self, v: T) -> Self
947 where
948 T: std::convert::Into<wkt::FieldMask>,
949 {
950 self.update_mask = std::option::Option::Some(v.into());
951 self
952 }
953
954 /// Sets or clears the value of [update_mask][crate::model::UpdateFeedRequest::update_mask].
955 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
956 where
957 T: std::convert::Into<wkt::FieldMask>,
958 {
959 self.update_mask = v.map(|x| x.into());
960 self
961 }
962}
963
964impl wkt::message::Message for UpdateFeedRequest {
965 fn typename() -> &'static str {
966 "type.googleapis.com/google.cloud.asset.v1.UpdateFeedRequest"
967 }
968}
969
970#[derive(Clone, Default, PartialEq)]
971#[non_exhaustive]
972pub struct DeleteFeedRequest {
973 /// Required. The name of the feed and it must be in the format of:
974 /// projects/project_number/feeds/feed_id
975 /// folders/folder_number/feeds/feed_id
976 /// organizations/organization_number/feeds/feed_id
977 pub name: std::string::String,
978
979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
980}
981
982impl DeleteFeedRequest {
983 pub fn new() -> Self {
984 std::default::Default::default()
985 }
986
987 /// Sets the value of [name][crate::model::DeleteFeedRequest::name].
988 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
989 self.name = v.into();
990 self
991 }
992}
993
994impl wkt::message::Message for DeleteFeedRequest {
995 fn typename() -> &'static str {
996 "type.googleapis.com/google.cloud.asset.v1.DeleteFeedRequest"
997 }
998}
999
1000/// Output configuration for export assets destination.
1001#[derive(Clone, Default, PartialEq)]
1002#[non_exhaustive]
1003pub struct OutputConfig {
1004 /// Asset export destination.
1005 pub destination: std::option::Option<crate::model::output_config::Destination>,
1006
1007 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1008}
1009
1010impl OutputConfig {
1011 pub fn new() -> Self {
1012 std::default::Default::default()
1013 }
1014
1015 /// Sets the value of [destination][crate::model::OutputConfig::destination].
1016 ///
1017 /// Note that all the setters affecting `destination` are mutually
1018 /// exclusive.
1019 pub fn set_destination<
1020 T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
1021 >(
1022 mut self,
1023 v: T,
1024 ) -> Self {
1025 self.destination = v.into();
1026 self
1027 }
1028
1029 /// The value of [destination][crate::model::OutputConfig::destination]
1030 /// if it holds a `GcsDestination`, `None` if the field is not set or
1031 /// holds a different branch.
1032 pub fn gcs_destination(
1033 &self,
1034 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
1035 #[allow(unreachable_patterns)]
1036 self.destination.as_ref().and_then(|v| match v {
1037 crate::model::output_config::Destination::GcsDestination(v) => {
1038 std::option::Option::Some(v)
1039 }
1040 _ => std::option::Option::None,
1041 })
1042 }
1043
1044 /// Sets the value of [destination][crate::model::OutputConfig::destination]
1045 /// to hold a `GcsDestination`.
1046 ///
1047 /// Note that all the setters affecting `destination` are
1048 /// mutually exclusive.
1049 pub fn set_gcs_destination<
1050 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
1051 >(
1052 mut self,
1053 v: T,
1054 ) -> Self {
1055 self.destination = std::option::Option::Some(
1056 crate::model::output_config::Destination::GcsDestination(v.into()),
1057 );
1058 self
1059 }
1060
1061 /// The value of [destination][crate::model::OutputConfig::destination]
1062 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
1063 /// holds a different branch.
1064 pub fn bigquery_destination(
1065 &self,
1066 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQueryDestination>> {
1067 #[allow(unreachable_patterns)]
1068 self.destination.as_ref().and_then(|v| match v {
1069 crate::model::output_config::Destination::BigqueryDestination(v) => {
1070 std::option::Option::Some(v)
1071 }
1072 _ => std::option::Option::None,
1073 })
1074 }
1075
1076 /// Sets the value of [destination][crate::model::OutputConfig::destination]
1077 /// to hold a `BigqueryDestination`.
1078 ///
1079 /// Note that all the setters affecting `destination` are
1080 /// mutually exclusive.
1081 pub fn set_bigquery_destination<
1082 T: std::convert::Into<std::boxed::Box<crate::model::BigQueryDestination>>,
1083 >(
1084 mut self,
1085 v: T,
1086 ) -> Self {
1087 self.destination = std::option::Option::Some(
1088 crate::model::output_config::Destination::BigqueryDestination(v.into()),
1089 );
1090 self
1091 }
1092}
1093
1094impl wkt::message::Message for OutputConfig {
1095 fn typename() -> &'static str {
1096 "type.googleapis.com/google.cloud.asset.v1.OutputConfig"
1097 }
1098}
1099
1100/// Defines additional types related to [OutputConfig].
1101pub mod output_config {
1102 #[allow(unused_imports)]
1103 use super::*;
1104
1105 /// Asset export destination.
1106 #[derive(Clone, Debug, PartialEq)]
1107 #[non_exhaustive]
1108 pub enum Destination {
1109 /// Destination on Cloud Storage.
1110 GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
1111 /// Destination on BigQuery. The output table stores the fields in asset
1112 /// Protobuf as columns in BigQuery.
1113 BigqueryDestination(std::boxed::Box<crate::model::BigQueryDestination>),
1114 }
1115}
1116
1117/// Output result of export assets.
1118#[derive(Clone, Default, PartialEq)]
1119#[non_exhaustive]
1120pub struct OutputResult {
1121 /// Asset export result.
1122 pub result: std::option::Option<crate::model::output_result::Result>,
1123
1124 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1125}
1126
1127impl OutputResult {
1128 pub fn new() -> Self {
1129 std::default::Default::default()
1130 }
1131
1132 /// Sets the value of [result][crate::model::OutputResult::result].
1133 ///
1134 /// Note that all the setters affecting `result` are mutually
1135 /// exclusive.
1136 pub fn set_result<
1137 T: std::convert::Into<std::option::Option<crate::model::output_result::Result>>,
1138 >(
1139 mut self,
1140 v: T,
1141 ) -> Self {
1142 self.result = v.into();
1143 self
1144 }
1145
1146 /// The value of [result][crate::model::OutputResult::result]
1147 /// if it holds a `GcsResult`, `None` if the field is not set or
1148 /// holds a different branch.
1149 pub fn gcs_result(
1150 &self,
1151 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsOutputResult>> {
1152 #[allow(unreachable_patterns)]
1153 self.result.as_ref().and_then(|v| match v {
1154 crate::model::output_result::Result::GcsResult(v) => std::option::Option::Some(v),
1155 _ => std::option::Option::None,
1156 })
1157 }
1158
1159 /// Sets the value of [result][crate::model::OutputResult::result]
1160 /// to hold a `GcsResult`.
1161 ///
1162 /// Note that all the setters affecting `result` are
1163 /// mutually exclusive.
1164 pub fn set_gcs_result<T: std::convert::Into<std::boxed::Box<crate::model::GcsOutputResult>>>(
1165 mut self,
1166 v: T,
1167 ) -> Self {
1168 self.result =
1169 std::option::Option::Some(crate::model::output_result::Result::GcsResult(v.into()));
1170 self
1171 }
1172}
1173
1174impl wkt::message::Message for OutputResult {
1175 fn typename() -> &'static str {
1176 "type.googleapis.com/google.cloud.asset.v1.OutputResult"
1177 }
1178}
1179
1180/// Defines additional types related to [OutputResult].
1181pub mod output_result {
1182 #[allow(unused_imports)]
1183 use super::*;
1184
1185 /// Asset export result.
1186 #[derive(Clone, Debug, PartialEq)]
1187 #[non_exhaustive]
1188 pub enum Result {
1189 /// Export result on Cloud Storage.
1190 GcsResult(std::boxed::Box<crate::model::GcsOutputResult>),
1191 }
1192}
1193
1194/// A Cloud Storage output result.
1195#[derive(Clone, Default, PartialEq)]
1196#[non_exhaustive]
1197pub struct GcsOutputResult {
1198 /// List of URIs of the Cloud Storage objects. Example:
1199 /// "gs://bucket_name/object_name".
1200 pub uris: std::vec::Vec<std::string::String>,
1201
1202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203}
1204
1205impl GcsOutputResult {
1206 pub fn new() -> Self {
1207 std::default::Default::default()
1208 }
1209
1210 /// Sets the value of [uris][crate::model::GcsOutputResult::uris].
1211 pub fn set_uris<T, V>(mut self, v: T) -> Self
1212 where
1213 T: std::iter::IntoIterator<Item = V>,
1214 V: std::convert::Into<std::string::String>,
1215 {
1216 use std::iter::Iterator;
1217 self.uris = v.into_iter().map(|i| i.into()).collect();
1218 self
1219 }
1220}
1221
1222impl wkt::message::Message for GcsOutputResult {
1223 fn typename() -> &'static str {
1224 "type.googleapis.com/google.cloud.asset.v1.GcsOutputResult"
1225 }
1226}
1227
1228/// A Cloud Storage location.
1229#[derive(Clone, Default, PartialEq)]
1230#[non_exhaustive]
1231pub struct GcsDestination {
1232 /// Required.
1233 pub object_uri: std::option::Option<crate::model::gcs_destination::ObjectUri>,
1234
1235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1236}
1237
1238impl GcsDestination {
1239 pub fn new() -> Self {
1240 std::default::Default::default()
1241 }
1242
1243 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri].
1244 ///
1245 /// Note that all the setters affecting `object_uri` are mutually
1246 /// exclusive.
1247 pub fn set_object_uri<
1248 T: std::convert::Into<std::option::Option<crate::model::gcs_destination::ObjectUri>>,
1249 >(
1250 mut self,
1251 v: T,
1252 ) -> Self {
1253 self.object_uri = v.into();
1254 self
1255 }
1256
1257 /// The value of [object_uri][crate::model::GcsDestination::object_uri]
1258 /// if it holds a `Uri`, `None` if the field is not set or
1259 /// holds a different branch.
1260 pub fn uri(&self) -> std::option::Option<&std::string::String> {
1261 #[allow(unreachable_patterns)]
1262 self.object_uri.as_ref().and_then(|v| match v {
1263 crate::model::gcs_destination::ObjectUri::Uri(v) => std::option::Option::Some(v),
1264 _ => std::option::Option::None,
1265 })
1266 }
1267
1268 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri]
1269 /// to hold a `Uri`.
1270 ///
1271 /// Note that all the setters affecting `object_uri` are
1272 /// mutually exclusive.
1273 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1274 self.object_uri =
1275 std::option::Option::Some(crate::model::gcs_destination::ObjectUri::Uri(v.into()));
1276 self
1277 }
1278
1279 /// The value of [object_uri][crate::model::GcsDestination::object_uri]
1280 /// if it holds a `UriPrefix`, `None` if the field is not set or
1281 /// holds a different branch.
1282 pub fn uri_prefix(&self) -> std::option::Option<&std::string::String> {
1283 #[allow(unreachable_patterns)]
1284 self.object_uri.as_ref().and_then(|v| match v {
1285 crate::model::gcs_destination::ObjectUri::UriPrefix(v) => std::option::Option::Some(v),
1286 _ => std::option::Option::None,
1287 })
1288 }
1289
1290 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri]
1291 /// to hold a `UriPrefix`.
1292 ///
1293 /// Note that all the setters affecting `object_uri` are
1294 /// mutually exclusive.
1295 pub fn set_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.object_uri = std::option::Option::Some(
1297 crate::model::gcs_destination::ObjectUri::UriPrefix(v.into()),
1298 );
1299 self
1300 }
1301}
1302
1303impl wkt::message::Message for GcsDestination {
1304 fn typename() -> &'static str {
1305 "type.googleapis.com/google.cloud.asset.v1.GcsDestination"
1306 }
1307}
1308
1309/// Defines additional types related to [GcsDestination].
1310pub mod gcs_destination {
1311 #[allow(unused_imports)]
1312 use super::*;
1313
1314 /// Required.
1315 #[derive(Clone, Debug, PartialEq)]
1316 #[non_exhaustive]
1317 pub enum ObjectUri {
1318 /// The URI of the Cloud Storage object. It's the same URI that is used by
1319 /// gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
1320 /// Editing Object
1321 /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
1322 /// for more information.
1323 ///
1324 /// If the specified Cloud Storage object already exists and there is no
1325 /// [hold](https://cloud.google.com/storage/docs/object-holds), it will be
1326 /// overwritten with the exported result.
1327 Uri(std::string::String),
1328 /// The URI prefix of all generated Cloud Storage objects. Example:
1329 /// "gs://bucket_name/object_name_prefix". Each object URI is in format:
1330 /// "gs://bucket_name/object_name_prefix/\<asset type\>/\<shard number\> and only
1331 /// contains assets for that type. \<shard number\> starts from 0. Example:
1332 /// "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is
1333 /// the first shard of output objects containing all
1334 /// compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be
1335 /// returned if file with the same name "gs://bucket_name/object_name_prefix"
1336 /// already exists.
1337 UriPrefix(std::string::String),
1338 }
1339}
1340
1341/// A BigQuery destination for exporting assets to.
1342#[derive(Clone, Default, PartialEq)]
1343#[non_exhaustive]
1344pub struct BigQueryDestination {
1345 /// Required. The BigQuery dataset in format
1346 /// "projects/projectId/datasets/datasetId", to which the snapshot result
1347 /// should be exported. If this dataset does not exist, the export call returns
1348 /// an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets`
1349 /// determines the
1350 /// [schema](/asset-inventory/docs/exporting-to-bigquery#bigquery-schema)
1351 /// of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also
1352 /// influences the schema.
1353 pub dataset: std::string::String,
1354
1355 /// Required. The BigQuery table to which the snapshot result should be
1356 /// written. If this table does not exist, a new table with the given name
1357 /// will be created.
1358 pub table: std::string::String,
1359
1360 /// If the destination table already exists and this flag is `TRUE`, the
1361 /// table will be overwritten by the contents of assets snapshot. If the flag
1362 /// is `FALSE` or unset and the destination table already exists, the export
1363 /// call returns an INVALID_ARGUMEMT error.
1364 pub force: bool,
1365
1366 /// [partition_spec] determines whether to export to partitioned table(s) and
1367 /// how to partition the data.
1368 ///
1369 /// If [partition_spec] is unset or [partition_spec.partition_key] is unset or
1370 /// `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to
1371 /// non-partitioned table(s). [force] will decide whether to overwrite existing
1372 /// table(s).
1373 ///
1374 /// If [partition_spec] is specified. First, the snapshot results will be
1375 /// written to partitioned table(s) with two additional timestamp columns,
1376 /// readTime and requestTime, one of which will be the partition key. Secondly,
1377 /// in the case when any destination table already exists, it will first try to
1378 /// update existing table's schema as necessary by appending additional
1379 /// columns. Then, if [force] is `TRUE`, the corresponding partition will be
1380 /// overwritten by the snapshot results (data in different partitions will
1381 /// remain intact); if [force] is unset or `FALSE`, it will append the data. An
1382 /// error will be returned if the schema update or data appension fails.
1383 pub partition_spec: std::option::Option<crate::model::PartitionSpec>,
1384
1385 /// If this flag is `TRUE`, the snapshot results will be written to one or
1386 /// multiple tables, each of which contains results of one asset type. The
1387 /// [force] and [partition_spec] fields will apply to each of them.
1388 ///
1389 /// Field [table] will be concatenated with "_" and the asset type names (see
1390 /// <https://cloud.google.com/asset-inventory/docs/supported-asset-types> for
1391 /// supported asset types) to construct per-asset-type table names, in which
1392 /// all non-alphanumeric characters like "." and "/" will be substituted by
1393 /// "_". Example: if field [table] is "mytable" and snapshot results
1394 /// contain "storage.googleapis.com/Bucket" assets, the corresponding table
1395 /// name will be "mytable_storage_googleapis_com_Bucket". If any of these
1396 /// tables does not exist, a new table with the concatenated name will be
1397 /// created.
1398 ///
1399 /// When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of
1400 /// each table will include RECORD-type columns mapped to the nested fields in
1401 /// the Asset.resource.data field of that asset type (up to the 15 nested level
1402 /// BigQuery supports
1403 /// (<https://cloud.google.com/bigquery/docs/nested-repeated#limitations>)). The
1404 /// fields in >15 nested levels will be stored in JSON format string as a child
1405 /// column of its parent RECORD column.
1406 ///
1407 /// If error occurs when exporting to any table, the whole export call will
1408 /// return an error but the export results that already succeed will persist.
1409 /// Example: if exporting to table_type_A succeeds when exporting to
1410 /// table_type_B fails during one export call, the results in table_type_A will
1411 /// persist and there will not be partial results persisting in a table.
1412 pub separate_tables_per_asset_type: bool,
1413
1414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1415}
1416
1417impl BigQueryDestination {
1418 pub fn new() -> Self {
1419 std::default::Default::default()
1420 }
1421
1422 /// Sets the value of [dataset][crate::model::BigQueryDestination::dataset].
1423 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1424 self.dataset = v.into();
1425 self
1426 }
1427
1428 /// Sets the value of [table][crate::model::BigQueryDestination::table].
1429 pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1430 self.table = v.into();
1431 self
1432 }
1433
1434 /// Sets the value of [force][crate::model::BigQueryDestination::force].
1435 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1436 self.force = v.into();
1437 self
1438 }
1439
1440 /// Sets the value of [partition_spec][crate::model::BigQueryDestination::partition_spec].
1441 pub fn set_partition_spec<T>(mut self, v: T) -> Self
1442 where
1443 T: std::convert::Into<crate::model::PartitionSpec>,
1444 {
1445 self.partition_spec = std::option::Option::Some(v.into());
1446 self
1447 }
1448
1449 /// Sets or clears the value of [partition_spec][crate::model::BigQueryDestination::partition_spec].
1450 pub fn set_or_clear_partition_spec<T>(mut self, v: std::option::Option<T>) -> Self
1451 where
1452 T: std::convert::Into<crate::model::PartitionSpec>,
1453 {
1454 self.partition_spec = v.map(|x| x.into());
1455 self
1456 }
1457
1458 /// Sets the value of [separate_tables_per_asset_type][crate::model::BigQueryDestination::separate_tables_per_asset_type].
1459 pub fn set_separate_tables_per_asset_type<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1460 self.separate_tables_per_asset_type = v.into();
1461 self
1462 }
1463}
1464
1465impl wkt::message::Message for BigQueryDestination {
1466 fn typename() -> &'static str {
1467 "type.googleapis.com/google.cloud.asset.v1.BigQueryDestination"
1468 }
1469}
1470
1471/// Specifications of BigQuery partitioned table as export destination.
1472#[derive(Clone, Default, PartialEq)]
1473#[non_exhaustive]
1474pub struct PartitionSpec {
1475 /// The partition key for BigQuery partitioned table.
1476 pub partition_key: crate::model::partition_spec::PartitionKey,
1477
1478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1479}
1480
1481impl PartitionSpec {
1482 pub fn new() -> Self {
1483 std::default::Default::default()
1484 }
1485
1486 /// Sets the value of [partition_key][crate::model::PartitionSpec::partition_key].
1487 pub fn set_partition_key<T: std::convert::Into<crate::model::partition_spec::PartitionKey>>(
1488 mut self,
1489 v: T,
1490 ) -> Self {
1491 self.partition_key = v.into();
1492 self
1493 }
1494}
1495
1496impl wkt::message::Message for PartitionSpec {
1497 fn typename() -> &'static str {
1498 "type.googleapis.com/google.cloud.asset.v1.PartitionSpec"
1499 }
1500}
1501
1502/// Defines additional types related to [PartitionSpec].
1503pub mod partition_spec {
1504 #[allow(unused_imports)]
1505 use super::*;
1506
1507 /// This enum is used to determine the partition key column when exporting
1508 /// assets to BigQuery partitioned table(s). Note that, if the partition key is
1509 /// a timestamp column, the actual partition is based on its date value
1510 /// (expressed in UTC. see details in
1511 /// <https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables>).
1512 ///
1513 /// # Working with unknown values
1514 ///
1515 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1516 /// additional enum variants at any time. Adding new variants is not considered
1517 /// a breaking change. Applications should write their code in anticipation of:
1518 ///
1519 /// - New values appearing in future releases of the client library, **and**
1520 /// - New values received dynamically, without application changes.
1521 ///
1522 /// Please consult the [Working with enums] section in the user guide for some
1523 /// guidelines.
1524 ///
1525 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1526 #[derive(Clone, Debug, PartialEq)]
1527 #[non_exhaustive]
1528 pub enum PartitionKey {
1529 /// Unspecified partition key. If used, it means using non-partitioned table.
1530 Unspecified,
1531 /// The time when the snapshot is taken. If specified as partition key, the
1532 /// result table(s) is partitioned by the additional timestamp column,
1533 /// readTime. If [read_time] in ExportAssetsRequest is specified, the
1534 /// readTime column's value will be the same as it. Otherwise, its value will
1535 /// be the current time that is used to take the snapshot.
1536 ReadTime,
1537 /// The time when the request is received and started to be processed. If
1538 /// specified as partition key, the result table(s) is partitioned by the
1539 /// requestTime column, an additional timestamp column representing when the
1540 /// request was received.
1541 RequestTime,
1542 /// If set, the enum was initialized with an unknown value.
1543 ///
1544 /// Applications can examine the value using [PartitionKey::value] or
1545 /// [PartitionKey::name].
1546 UnknownValue(partition_key::UnknownValue),
1547 }
1548
1549 #[doc(hidden)]
1550 pub mod partition_key {
1551 #[allow(unused_imports)]
1552 use super::*;
1553 #[derive(Clone, Debug, PartialEq)]
1554 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1555 }
1556
1557 impl PartitionKey {
1558 /// Gets the enum value.
1559 ///
1560 /// Returns `None` if the enum contains an unknown value deserialized from
1561 /// the string representation of enums.
1562 pub fn value(&self) -> std::option::Option<i32> {
1563 match self {
1564 Self::Unspecified => std::option::Option::Some(0),
1565 Self::ReadTime => std::option::Option::Some(1),
1566 Self::RequestTime => std::option::Option::Some(2),
1567 Self::UnknownValue(u) => u.0.value(),
1568 }
1569 }
1570
1571 /// Gets the enum value as a string.
1572 ///
1573 /// Returns `None` if the enum contains an unknown value deserialized from
1574 /// the integer representation of enums.
1575 pub fn name(&self) -> std::option::Option<&str> {
1576 match self {
1577 Self::Unspecified => std::option::Option::Some("PARTITION_KEY_UNSPECIFIED"),
1578 Self::ReadTime => std::option::Option::Some("READ_TIME"),
1579 Self::RequestTime => std::option::Option::Some("REQUEST_TIME"),
1580 Self::UnknownValue(u) => u.0.name(),
1581 }
1582 }
1583 }
1584
1585 impl std::default::Default for PartitionKey {
1586 fn default() -> Self {
1587 use std::convert::From;
1588 Self::from(0)
1589 }
1590 }
1591
1592 impl std::fmt::Display for PartitionKey {
1593 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1594 wkt::internal::display_enum(f, self.name(), self.value())
1595 }
1596 }
1597
1598 impl std::convert::From<i32> for PartitionKey {
1599 fn from(value: i32) -> Self {
1600 match value {
1601 0 => Self::Unspecified,
1602 1 => Self::ReadTime,
1603 2 => Self::RequestTime,
1604 _ => Self::UnknownValue(partition_key::UnknownValue(
1605 wkt::internal::UnknownEnumValue::Integer(value),
1606 )),
1607 }
1608 }
1609 }
1610
1611 impl std::convert::From<&str> for PartitionKey {
1612 fn from(value: &str) -> Self {
1613 use std::string::ToString;
1614 match value {
1615 "PARTITION_KEY_UNSPECIFIED" => Self::Unspecified,
1616 "READ_TIME" => Self::ReadTime,
1617 "REQUEST_TIME" => Self::RequestTime,
1618 _ => Self::UnknownValue(partition_key::UnknownValue(
1619 wkt::internal::UnknownEnumValue::String(value.to_string()),
1620 )),
1621 }
1622 }
1623 }
1624
1625 impl serde::ser::Serialize for PartitionKey {
1626 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1627 where
1628 S: serde::Serializer,
1629 {
1630 match self {
1631 Self::Unspecified => serializer.serialize_i32(0),
1632 Self::ReadTime => serializer.serialize_i32(1),
1633 Self::RequestTime => serializer.serialize_i32(2),
1634 Self::UnknownValue(u) => u.0.serialize(serializer),
1635 }
1636 }
1637 }
1638
1639 impl<'de> serde::de::Deserialize<'de> for PartitionKey {
1640 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1641 where
1642 D: serde::Deserializer<'de>,
1643 {
1644 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PartitionKey>::new(
1645 ".google.cloud.asset.v1.PartitionSpec.PartitionKey",
1646 ))
1647 }
1648 }
1649}
1650
1651/// A Pub/Sub destination.
1652#[derive(Clone, Default, PartialEq)]
1653#[non_exhaustive]
1654pub struct PubsubDestination {
1655 /// The name of the Pub/Sub topic to publish to.
1656 /// Example: `projects/PROJECT_ID/topics/TOPIC_ID`.
1657 pub topic: std::string::String,
1658
1659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1660}
1661
1662impl PubsubDestination {
1663 pub fn new() -> Self {
1664 std::default::Default::default()
1665 }
1666
1667 /// Sets the value of [topic][crate::model::PubsubDestination::topic].
1668 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1669 self.topic = v.into();
1670 self
1671 }
1672}
1673
1674impl wkt::message::Message for PubsubDestination {
1675 fn typename() -> &'static str {
1676 "type.googleapis.com/google.cloud.asset.v1.PubsubDestination"
1677 }
1678}
1679
1680/// Output configuration for asset feed destination.
1681#[derive(Clone, Default, PartialEq)]
1682#[non_exhaustive]
1683pub struct FeedOutputConfig {
1684 /// Asset feed destination.
1685 pub destination: std::option::Option<crate::model::feed_output_config::Destination>,
1686
1687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1688}
1689
1690impl FeedOutputConfig {
1691 pub fn new() -> Self {
1692 std::default::Default::default()
1693 }
1694
1695 /// Sets the value of [destination][crate::model::FeedOutputConfig::destination].
1696 ///
1697 /// Note that all the setters affecting `destination` are mutually
1698 /// exclusive.
1699 pub fn set_destination<
1700 T: std::convert::Into<std::option::Option<crate::model::feed_output_config::Destination>>,
1701 >(
1702 mut self,
1703 v: T,
1704 ) -> Self {
1705 self.destination = v.into();
1706 self
1707 }
1708
1709 /// The value of [destination][crate::model::FeedOutputConfig::destination]
1710 /// if it holds a `PubsubDestination`, `None` if the field is not set or
1711 /// holds a different branch.
1712 pub fn pubsub_destination(
1713 &self,
1714 ) -> std::option::Option<&std::boxed::Box<crate::model::PubsubDestination>> {
1715 #[allow(unreachable_patterns)]
1716 self.destination.as_ref().and_then(|v| match v {
1717 crate::model::feed_output_config::Destination::PubsubDestination(v) => {
1718 std::option::Option::Some(v)
1719 }
1720 _ => std::option::Option::None,
1721 })
1722 }
1723
1724 /// Sets the value of [destination][crate::model::FeedOutputConfig::destination]
1725 /// to hold a `PubsubDestination`.
1726 ///
1727 /// Note that all the setters affecting `destination` are
1728 /// mutually exclusive.
1729 pub fn set_pubsub_destination<
1730 T: std::convert::Into<std::boxed::Box<crate::model::PubsubDestination>>,
1731 >(
1732 mut self,
1733 v: T,
1734 ) -> Self {
1735 self.destination = std::option::Option::Some(
1736 crate::model::feed_output_config::Destination::PubsubDestination(v.into()),
1737 );
1738 self
1739 }
1740}
1741
1742impl wkt::message::Message for FeedOutputConfig {
1743 fn typename() -> &'static str {
1744 "type.googleapis.com/google.cloud.asset.v1.FeedOutputConfig"
1745 }
1746}
1747
1748/// Defines additional types related to [FeedOutputConfig].
1749pub mod feed_output_config {
1750 #[allow(unused_imports)]
1751 use super::*;
1752
1753 /// Asset feed destination.
1754 #[derive(Clone, Debug, PartialEq)]
1755 #[non_exhaustive]
1756 pub enum Destination {
1757 /// Destination on Pub/Sub.
1758 PubsubDestination(std::boxed::Box<crate::model::PubsubDestination>),
1759 }
1760}
1761
1762/// An asset feed used to export asset updates to a destinations.
1763/// An asset feed filter controls what updates are exported.
1764/// The asset feed must be created within a project, organization, or
1765/// folder. Supported destinations are:
1766/// Pub/Sub topics.
1767#[derive(Clone, Default, PartialEq)]
1768#[non_exhaustive]
1769pub struct Feed {
1770 /// Required. The format will be
1771 /// projects/{project_number}/feeds/{client-assigned_feed_identifier} or
1772 /// folders/{folder_number}/feeds/{client-assigned_feed_identifier} or
1773 /// organizations/{organization_number}/feeds/{client-assigned_feed_identifier}
1774 ///
1775 /// The client-assigned feed identifier must be unique within the parent
1776 /// project/folder/organization.
1777 pub name: std::string::String,
1778
1779 /// A list of the full names of the assets to receive updates. You must specify
1780 /// either or both of asset_names and asset_types. Only asset updates matching
1781 /// specified asset_names or asset_types are exported to the feed.
1782 /// Example:
1783 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
1784 /// For a list of the full names for supported asset types, see [Resource
1785 /// name format](/asset-inventory/docs/resource-name-format).
1786 pub asset_names: std::vec::Vec<std::string::String>,
1787
1788 /// A list of types of the assets to receive updates. You must specify either
1789 /// or both of asset_names and asset_types. Only asset updates matching
1790 /// specified asset_names or asset_types are exported to the feed.
1791 /// Example: `"compute.googleapis.com/Disk"`
1792 ///
1793 /// For a list of all supported asset types, see
1794 /// [Supported asset types](/asset-inventory/docs/supported-asset-types).
1795 pub asset_types: std::vec::Vec<std::string::String>,
1796
1797 /// Asset content type. If not specified, no content but the asset name and
1798 /// type will be returned.
1799 pub content_type: crate::model::ContentType,
1800
1801 /// Required. Feed output configuration defining where the asset updates are
1802 /// published to.
1803 pub feed_output_config: std::option::Option<crate::model::FeedOutputConfig>,
1804
1805 /// A condition which determines whether an asset update should be published.
1806 /// If specified, an asset will be returned only when the expression evaluates
1807 /// to true.
1808 /// When set, `expression` field in the `Expr` must be a valid [CEL expression]
1809 /// (<https://github.com/google/cel-spec>) on a TemporalAsset with name
1810 /// `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted
1811 /// == true") will only publish Asset deletions. Other fields of `Expr` are
1812 /// optional.
1813 ///
1814 /// See our [user
1815 /// guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition)
1816 /// for detailed instructions.
1817 pub condition: std::option::Option<gtype::model::Expr>,
1818
1819 /// A list of relationship types to output, for example:
1820 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
1821 /// content_type=RELATIONSHIP.
1822 ///
1823 /// * If specified:
1824 /// it outputs specified relationship updates on the [asset_names] or the
1825 /// [asset_types]. It returns an error if any of the [relationship_types]
1826 /// doesn't belong to the supported relationship types of the [asset_names] or
1827 /// [asset_types], or any of the [asset_names] or the [asset_types] doesn't
1828 /// belong to the source types of the [relationship_types].
1829 /// * Otherwise:
1830 /// it outputs the supported relationships of the types of [asset_names] and
1831 /// [asset_types] or returns an error if any of the [asset_names] or the
1832 /// [asset_types] has no replationship support.
1833 /// See [Introduction to Cloud Asset
1834 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
1835 /// for all supported asset types and relationship types.
1836 pub relationship_types: std::vec::Vec<std::string::String>,
1837
1838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1839}
1840
1841impl Feed {
1842 pub fn new() -> Self {
1843 std::default::Default::default()
1844 }
1845
1846 /// Sets the value of [name][crate::model::Feed::name].
1847 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1848 self.name = v.into();
1849 self
1850 }
1851
1852 /// Sets the value of [asset_names][crate::model::Feed::asset_names].
1853 pub fn set_asset_names<T, V>(mut self, v: T) -> Self
1854 where
1855 T: std::iter::IntoIterator<Item = V>,
1856 V: std::convert::Into<std::string::String>,
1857 {
1858 use std::iter::Iterator;
1859 self.asset_names = v.into_iter().map(|i| i.into()).collect();
1860 self
1861 }
1862
1863 /// Sets the value of [asset_types][crate::model::Feed::asset_types].
1864 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
1865 where
1866 T: std::iter::IntoIterator<Item = V>,
1867 V: std::convert::Into<std::string::String>,
1868 {
1869 use std::iter::Iterator;
1870 self.asset_types = v.into_iter().map(|i| i.into()).collect();
1871 self
1872 }
1873
1874 /// Sets the value of [content_type][crate::model::Feed::content_type].
1875 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
1876 mut self,
1877 v: T,
1878 ) -> Self {
1879 self.content_type = v.into();
1880 self
1881 }
1882
1883 /// Sets the value of [feed_output_config][crate::model::Feed::feed_output_config].
1884 pub fn set_feed_output_config<T>(mut self, v: T) -> Self
1885 where
1886 T: std::convert::Into<crate::model::FeedOutputConfig>,
1887 {
1888 self.feed_output_config = std::option::Option::Some(v.into());
1889 self
1890 }
1891
1892 /// Sets or clears the value of [feed_output_config][crate::model::Feed::feed_output_config].
1893 pub fn set_or_clear_feed_output_config<T>(mut self, v: std::option::Option<T>) -> Self
1894 where
1895 T: std::convert::Into<crate::model::FeedOutputConfig>,
1896 {
1897 self.feed_output_config = v.map(|x| x.into());
1898 self
1899 }
1900
1901 /// Sets the value of [condition][crate::model::Feed::condition].
1902 pub fn set_condition<T>(mut self, v: T) -> Self
1903 where
1904 T: std::convert::Into<gtype::model::Expr>,
1905 {
1906 self.condition = std::option::Option::Some(v.into());
1907 self
1908 }
1909
1910 /// Sets or clears the value of [condition][crate::model::Feed::condition].
1911 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
1912 where
1913 T: std::convert::Into<gtype::model::Expr>,
1914 {
1915 self.condition = v.map(|x| x.into());
1916 self
1917 }
1918
1919 /// Sets the value of [relationship_types][crate::model::Feed::relationship_types].
1920 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
1921 where
1922 T: std::iter::IntoIterator<Item = V>,
1923 V: std::convert::Into<std::string::String>,
1924 {
1925 use std::iter::Iterator;
1926 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
1927 self
1928 }
1929}
1930
1931impl wkt::message::Message for Feed {
1932 fn typename() -> &'static str {
1933 "type.googleapis.com/google.cloud.asset.v1.Feed"
1934 }
1935}
1936
1937/// Search all resources request.
1938#[derive(Clone, Default, PartialEq)]
1939#[non_exhaustive]
1940pub struct SearchAllResourcesRequest {
1941 /// Required. A scope can be a project, a folder, or an organization. The
1942 /// search is limited to the resources within the `scope`. The caller must be
1943 /// granted the
1944 /// [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
1945 /// permission on the desired scope.
1946 ///
1947 /// The allowed values are:
1948 ///
1949 /// * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
1950 /// * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
1951 /// * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
1952 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
1953 pub scope: std::string::String,
1954
1955 /// Optional. The query statement. See [how to construct a
1956 /// query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
1957 /// for more information. If not specified or empty, it will search all the
1958 /// resources within the specified `scope`.
1959 ///
1960 /// Examples:
1961 ///
1962 /// * `name:Important` to find Google Cloud resources whose name contains
1963 /// `Important` as a word.
1964 /// * `name=Important` to find the Google Cloud resource whose name is exactly
1965 /// `Important`.
1966 /// * `displayName:Impor*` to find Google Cloud resources whose display name
1967 /// contains `Impor` as a prefix of any word in the field.
1968 /// * `location:us-west*` to find Google Cloud resources whose location
1969 /// contains both `us` and `west` as prefixes.
1970 /// * `labels:prod` to find Google Cloud resources whose labels contain `prod`
1971 /// as a key or value.
1972 /// * `labels.env:prod` to find Google Cloud resources that have a label `env`
1973 /// and its value is `prod`.
1974 /// * `labels.env:*` to find Google Cloud resources that have a label `env`.
1975 /// * `tagKeys:env` to find Google Cloud resources that have directly
1976 /// attached tags where the
1977 /// [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
1978 /// contains `env`.
1979 /// * `tagValues:prod*` to find Google Cloud resources that have directly
1980 /// attached tags where the
1981 /// [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
1982 /// contains a word prefixed by `prod`.
1983 /// * `tagValueIds=tagValues/123` to find Google Cloud resources that have
1984 /// directly attached tags where the
1985 /// [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
1986 /// is exactly `tagValues/123`.
1987 /// * `effectiveTagKeys:env` to find Google Cloud resources that have
1988 /// directly attached or inherited tags where the
1989 /// [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
1990 /// contains `env`.
1991 /// * `effectiveTagValues:prod*` to find Google Cloud resources that have
1992 /// directly attached or inherited tags where the
1993 /// [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
1994 /// contains a word prefixed by `prod`.
1995 /// * `effectiveTagValueIds=tagValues/123` to find Google Cloud resources that
1996 /// have directly attached or inherited tags where the
1997 /// [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
1998 /// is exactly `tagValues/123`.
1999 /// * `kmsKey:key` to find Google Cloud resources encrypted with a
2000 /// customer-managed encryption key whose name contains `key` as a word. This
2001 /// field is deprecated. Use the `kmsKeys` field to retrieve Cloud KMS
2002 /// key information.
2003 /// * `kmsKeys:key` to find Google Cloud resources encrypted with
2004 /// customer-managed encryption keys whose name contains the word `key`.
2005 /// * `relationships:instance-group-1` to find Google Cloud resources that have
2006 /// relationships with `instance-group-1` in the related resource name.
2007 /// * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine
2008 /// instances that have relationships of type `INSTANCE_TO_INSTANCEGROUP`.
2009 /// * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find
2010 /// Compute Engine instances that have relationships with `instance-group-1`
2011 /// in the Compute Engine instance group resource name, for relationship type
2012 /// `INSTANCE_TO_INSTANCEGROUP`.
2013 /// * `sccSecurityMarks.key=value` to find Cloud resources that are attached
2014 /// with security marks whose key is `key` and value is `value`.
2015 /// * `sccSecurityMarks.key:*` to find Cloud resources that are attached with
2016 /// security marks whose key is `key`.
2017 /// * `state:ACTIVE` to find Google Cloud resources whose state contains
2018 /// `ACTIVE` as a word.
2019 /// * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't
2020 /// contain `ACTIVE` as a word.
2021 /// * `createTime<1609459200` to find Google Cloud resources that were created
2022 /// before `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of
2023 /// `2021-01-01 00:00:00 UTC` in seconds.
2024 /// * `updateTime>1609459200` to find Google Cloud resources that were updated
2025 /// after `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of
2026 /// `2021-01-01 00:00:00 UTC` in seconds.
2027 /// * `Important` to find Google Cloud resources that contain `Important` as a
2028 /// word in any of the searchable fields.
2029 /// * `Impor*` to find Google Cloud resources that contain `Impor` as a prefix
2030 /// of any word in any of the searchable fields.
2031 /// * `Important location:(us-west1 OR global)` to find Google Cloud
2032 /// resources that contain `Important` as a word in any of the searchable
2033 /// fields and are also located in the `us-west1` region or the `global`
2034 /// location.
2035 pub query: std::string::String,
2036
2037 /// Optional. A list of asset types that this request searches for. If empty,
2038 /// it will search all the asset types [supported by search
2039 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
2040 ///
2041 /// Regular expressions are also supported. For example:
2042 ///
2043 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
2044 /// with "compute.googleapis.com".
2045 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
2046 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
2047 ///
2048 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
2049 /// regular expression syntax. If the regular expression does not match any
2050 /// supported asset type, an INVALID_ARGUMENT error will be returned.
2051 pub asset_types: std::vec::Vec<std::string::String>,
2052
2053 /// Optional. The page size for search result pagination. Page size is capped
2054 /// at 500 even if a larger value is given. If set to zero or a negative value,
2055 /// server will pick an appropriate default. Returned results may be fewer than
2056 /// requested. When this happens, there could be more results as long as
2057 /// `next_page_token` is returned.
2058 pub page_size: i32,
2059
2060 /// Optional. If present, then retrieve the next batch of results from the
2061 /// preceding call to this method. `page_token` must be the value of
2062 /// `next_page_token` from the previous response. The values of all other
2063 /// method parameters, must be identical to those in the previous call.
2064 pub page_token: std::string::String,
2065
2066 /// Optional. A comma-separated list of fields specifying the sorting order of
2067 /// the results. The default order is ascending. Add " DESC" after the field
2068 /// name to indicate descending order. Redundant space characters are ignored.
2069 /// Example: "location DESC, name".
2070 /// Only the following fields in the response are sortable:
2071 ///
2072 /// * name
2073 /// * assetType
2074 /// * project
2075 /// * displayName
2076 /// * description
2077 /// * location
2078 /// * createTime
2079 /// * updateTime
2080 /// * state
2081 /// * parentFullResourceName
2082 /// * parentAssetType
2083 pub order_by: std::string::String,
2084
2085 /// Optional. A comma-separated list of fields that you want returned in the
2086 /// results. The following fields are returned by default if not specified:
2087 ///
2088 /// * `name`
2089 /// * `assetType`
2090 /// * `project`
2091 /// * `folders`
2092 /// * `organization`
2093 /// * `displayName`
2094 /// * `description`
2095 /// * `location`
2096 /// * `labels`
2097 /// * `tags`
2098 /// * `effectiveTags`
2099 /// * `networkTags`
2100 /// * `kmsKeys`
2101 /// * `createTime`
2102 /// * `updateTime`
2103 /// * `state`
2104 /// * `additionalAttributes`
2105 /// * `parentFullResourceName`
2106 /// * `parentAssetType`
2107 ///
2108 /// Some fields of large size, such as `versionedResources`,
2109 /// `attachedResources`, `effectiveTags` etc., are not returned by default, but
2110 /// you can specify them in the `read_mask` parameter if you want to include
2111 /// them. If `"*"` is specified, all [available
2112 /// fields](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources#resourcesearchresult)
2113 /// are returned.
2114 /// Examples: `"name,location"`, `"name,versionedResources"`, `"*"`.
2115 /// Any invalid field path will trigger INVALID_ARGUMENT error.
2116 pub read_mask: std::option::Option<wkt::FieldMask>,
2117
2118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2119}
2120
2121impl SearchAllResourcesRequest {
2122 pub fn new() -> Self {
2123 std::default::Default::default()
2124 }
2125
2126 /// Sets the value of [scope][crate::model::SearchAllResourcesRequest::scope].
2127 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2128 self.scope = v.into();
2129 self
2130 }
2131
2132 /// Sets the value of [query][crate::model::SearchAllResourcesRequest::query].
2133 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2134 self.query = v.into();
2135 self
2136 }
2137
2138 /// Sets the value of [asset_types][crate::model::SearchAllResourcesRequest::asset_types].
2139 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
2140 where
2141 T: std::iter::IntoIterator<Item = V>,
2142 V: std::convert::Into<std::string::String>,
2143 {
2144 use std::iter::Iterator;
2145 self.asset_types = v.into_iter().map(|i| i.into()).collect();
2146 self
2147 }
2148
2149 /// Sets the value of [page_size][crate::model::SearchAllResourcesRequest::page_size].
2150 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2151 self.page_size = v.into();
2152 self
2153 }
2154
2155 /// Sets the value of [page_token][crate::model::SearchAllResourcesRequest::page_token].
2156 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2157 self.page_token = v.into();
2158 self
2159 }
2160
2161 /// Sets the value of [order_by][crate::model::SearchAllResourcesRequest::order_by].
2162 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2163 self.order_by = v.into();
2164 self
2165 }
2166
2167 /// Sets the value of [read_mask][crate::model::SearchAllResourcesRequest::read_mask].
2168 pub fn set_read_mask<T>(mut self, v: T) -> Self
2169 where
2170 T: std::convert::Into<wkt::FieldMask>,
2171 {
2172 self.read_mask = std::option::Option::Some(v.into());
2173 self
2174 }
2175
2176 /// Sets or clears the value of [read_mask][crate::model::SearchAllResourcesRequest::read_mask].
2177 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2178 where
2179 T: std::convert::Into<wkt::FieldMask>,
2180 {
2181 self.read_mask = v.map(|x| x.into());
2182 self
2183 }
2184}
2185
2186impl wkt::message::Message for SearchAllResourcesRequest {
2187 fn typename() -> &'static str {
2188 "type.googleapis.com/google.cloud.asset.v1.SearchAllResourcesRequest"
2189 }
2190}
2191
2192/// Search all resources response.
2193#[derive(Clone, Default, PartialEq)]
2194#[non_exhaustive]
2195pub struct SearchAllResourcesResponse {
2196 /// A list of Resources that match the search query. It contains the resource
2197 /// standard metadata information.
2198 pub results: std::vec::Vec<crate::model::ResourceSearchResult>,
2199
2200 /// If there are more results than those appearing in this response, then
2201 /// `next_page_token` is included. To get the next set of results, call this
2202 /// method again using the value of `next_page_token` as `page_token`.
2203 pub next_page_token: std::string::String,
2204
2205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2206}
2207
2208impl SearchAllResourcesResponse {
2209 pub fn new() -> Self {
2210 std::default::Default::default()
2211 }
2212
2213 /// Sets the value of [results][crate::model::SearchAllResourcesResponse::results].
2214 pub fn set_results<T, V>(mut self, v: T) -> Self
2215 where
2216 T: std::iter::IntoIterator<Item = V>,
2217 V: std::convert::Into<crate::model::ResourceSearchResult>,
2218 {
2219 use std::iter::Iterator;
2220 self.results = v.into_iter().map(|i| i.into()).collect();
2221 self
2222 }
2223
2224 /// Sets the value of [next_page_token][crate::model::SearchAllResourcesResponse::next_page_token].
2225 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2226 self.next_page_token = v.into();
2227 self
2228 }
2229}
2230
2231impl wkt::message::Message for SearchAllResourcesResponse {
2232 fn typename() -> &'static str {
2233 "type.googleapis.com/google.cloud.asset.v1.SearchAllResourcesResponse"
2234 }
2235}
2236
2237#[doc(hidden)]
2238impl gax::paginator::internal::PageableResponse for SearchAllResourcesResponse {
2239 type PageItem = crate::model::ResourceSearchResult;
2240
2241 fn items(self) -> std::vec::Vec<Self::PageItem> {
2242 self.results
2243 }
2244
2245 fn next_page_token(&self) -> std::string::String {
2246 use std::clone::Clone;
2247 self.next_page_token.clone()
2248 }
2249}
2250
2251/// Search all IAM policies request.
2252#[derive(Clone, Default, PartialEq)]
2253#[non_exhaustive]
2254pub struct SearchAllIamPoliciesRequest {
2255 /// Required. A scope can be a project, a folder, or an organization. The
2256 /// search is limited to the IAM policies within the `scope`. The caller must
2257 /// be granted the
2258 /// [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
2259 /// permission on the desired scope.
2260 ///
2261 /// The allowed values are:
2262 ///
2263 /// * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
2264 /// * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
2265 /// * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
2266 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2267 pub scope: std::string::String,
2268
2269 /// Optional. The query statement. See [how to construct a
2270 /// query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
2271 /// for more information. If not specified or empty, it will search all the
2272 /// IAM policies within the specified `scope`. Note that the query string is
2273 /// compared against each IAM policy binding, including its principals,
2274 /// roles, and IAM conditions. The returned IAM policies will only
2275 /// contain the bindings that match your query. To learn more about the IAM
2276 /// policy structure, see the [IAM policy
2277 /// documentation](https://cloud.google.com/iam/help/allow-policies/structure).
2278 ///
2279 /// Examples:
2280 ///
2281 /// * `policy:amy@gmail.com` to find IAM policy bindings that specify user
2282 /// "amy@gmail.com".
2283 /// * `policy:roles/compute.admin` to find IAM policy bindings that specify
2284 /// the Compute Admin role.
2285 /// * `policy:comp*` to find IAM policy bindings that contain "comp" as a
2286 /// prefix of any word in the binding.
2287 /// * `policy.role.permissions:storage.buckets.update` to find IAM policy
2288 /// bindings that specify a role containing "storage.buckets.update"
2289 /// permission. Note that if callers don't have `iam.roles.get` access to a
2290 /// role's included permissions, policy bindings that specify this role will
2291 /// be dropped from the search results.
2292 /// * `policy.role.permissions:upd*` to find IAM policy bindings that specify a
2293 /// role containing "upd" as a prefix of any word in the role permission.
2294 /// Note that if callers don't have `iam.roles.get` access to a role's
2295 /// included permissions, policy bindings that specify this role will be
2296 /// dropped from the search results.
2297 /// * `resource:organizations/123456` to find IAM policy bindings
2298 /// that are set on "organizations/123456".
2299 /// * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to
2300 /// find IAM policy bindings that are set on the project named "myproject".
2301 /// * `Important` to find IAM policy bindings that contain "Important" as a
2302 /// word in any of the searchable fields (except for the included
2303 /// permissions).
2304 /// * `resource:(instance1 OR instance2) policy:amy` to find
2305 /// IAM policy bindings that are set on resources "instance1" or
2306 /// "instance2" and also specify user "amy".
2307 /// * `roles:roles/compute.admin` to find IAM policy bindings that specify the
2308 /// Compute Admin role.
2309 /// * `memberTypes:user` to find IAM policy bindings that contain the
2310 /// principal type "user".
2311 pub query: std::string::String,
2312
2313 /// Optional. The page size for search result pagination. Page size is capped
2314 /// at 500 even if a larger value is given. If set to zero or a negative value,
2315 /// server will pick an appropriate default. Returned results may be fewer than
2316 /// requested. When this happens, there could be more results as long as
2317 /// `next_page_token` is returned.
2318 pub page_size: i32,
2319
2320 /// Optional. If present, retrieve the next batch of results from the preceding
2321 /// call to this method. `page_token` must be the value of `next_page_token`
2322 /// from the previous response. The values of all other method parameters must
2323 /// be identical to those in the previous call.
2324 pub page_token: std::string::String,
2325
2326 /// Optional. A list of asset types that the IAM policies are attached to. If
2327 /// empty, it will search the IAM policies that are attached to all the asset
2328 /// types [supported by search
2329 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
2330 ///
2331 /// Regular expressions are also supported. For example:
2332 ///
2333 /// * "compute.googleapis.com.*" snapshots IAM policies attached to asset type
2334 /// starts with "compute.googleapis.com".
2335 /// * ".*Instance" snapshots IAM policies attached to asset type ends with
2336 /// "Instance".
2337 /// * ".*Instance.*" snapshots IAM policies attached to asset type contains
2338 /// "Instance".
2339 ///
2340 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
2341 /// regular expression syntax. If the regular expression does not match any
2342 /// supported asset type, an INVALID_ARGUMENT error will be returned.
2343 pub asset_types: std::vec::Vec<std::string::String>,
2344
2345 /// Optional. A comma-separated list of fields specifying the sorting order of
2346 /// the results. The default order is ascending. Add " DESC" after the field
2347 /// name to indicate descending order. Redundant space characters are ignored.
2348 /// Example: "assetType DESC, resource".
2349 /// Only singular primitive fields in the response are sortable:
2350 ///
2351 /// * resource
2352 /// * assetType
2353 /// * project
2354 /// All the other fields such as repeated fields (e.g., `folders`) and
2355 /// non-primitive fields (e.g., `policy`) are not supported.
2356 pub order_by: std::string::String,
2357
2358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2359}
2360
2361impl SearchAllIamPoliciesRequest {
2362 pub fn new() -> Self {
2363 std::default::Default::default()
2364 }
2365
2366 /// Sets the value of [scope][crate::model::SearchAllIamPoliciesRequest::scope].
2367 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2368 self.scope = v.into();
2369 self
2370 }
2371
2372 /// Sets the value of [query][crate::model::SearchAllIamPoliciesRequest::query].
2373 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2374 self.query = v.into();
2375 self
2376 }
2377
2378 /// Sets the value of [page_size][crate::model::SearchAllIamPoliciesRequest::page_size].
2379 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2380 self.page_size = v.into();
2381 self
2382 }
2383
2384 /// Sets the value of [page_token][crate::model::SearchAllIamPoliciesRequest::page_token].
2385 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2386 self.page_token = v.into();
2387 self
2388 }
2389
2390 /// Sets the value of [asset_types][crate::model::SearchAllIamPoliciesRequest::asset_types].
2391 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
2392 where
2393 T: std::iter::IntoIterator<Item = V>,
2394 V: std::convert::Into<std::string::String>,
2395 {
2396 use std::iter::Iterator;
2397 self.asset_types = v.into_iter().map(|i| i.into()).collect();
2398 self
2399 }
2400
2401 /// Sets the value of [order_by][crate::model::SearchAllIamPoliciesRequest::order_by].
2402 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2403 self.order_by = v.into();
2404 self
2405 }
2406}
2407
2408impl wkt::message::Message for SearchAllIamPoliciesRequest {
2409 fn typename() -> &'static str {
2410 "type.googleapis.com/google.cloud.asset.v1.SearchAllIamPoliciesRequest"
2411 }
2412}
2413
2414/// Search all IAM policies response.
2415#[derive(Clone, Default, PartialEq)]
2416#[non_exhaustive]
2417pub struct SearchAllIamPoliciesResponse {
2418 /// A list of IAM policies that match the search query. Related information
2419 /// such as the associated resource is returned along with the policy.
2420 pub results: std::vec::Vec<crate::model::IamPolicySearchResult>,
2421
2422 /// Set if there are more results than those appearing in this response; to get
2423 /// the next set of results, call this method again, using this value as the
2424 /// `page_token`.
2425 pub next_page_token: std::string::String,
2426
2427 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2428}
2429
2430impl SearchAllIamPoliciesResponse {
2431 pub fn new() -> Self {
2432 std::default::Default::default()
2433 }
2434
2435 /// Sets the value of [results][crate::model::SearchAllIamPoliciesResponse::results].
2436 pub fn set_results<T, V>(mut self, v: T) -> Self
2437 where
2438 T: std::iter::IntoIterator<Item = V>,
2439 V: std::convert::Into<crate::model::IamPolicySearchResult>,
2440 {
2441 use std::iter::Iterator;
2442 self.results = v.into_iter().map(|i| i.into()).collect();
2443 self
2444 }
2445
2446 /// Sets the value of [next_page_token][crate::model::SearchAllIamPoliciesResponse::next_page_token].
2447 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2448 self.next_page_token = v.into();
2449 self
2450 }
2451}
2452
2453impl wkt::message::Message for SearchAllIamPoliciesResponse {
2454 fn typename() -> &'static str {
2455 "type.googleapis.com/google.cloud.asset.v1.SearchAllIamPoliciesResponse"
2456 }
2457}
2458
2459#[doc(hidden)]
2460impl gax::paginator::internal::PageableResponse for SearchAllIamPoliciesResponse {
2461 type PageItem = crate::model::IamPolicySearchResult;
2462
2463 fn items(self) -> std::vec::Vec<Self::PageItem> {
2464 self.results
2465 }
2466
2467 fn next_page_token(&self) -> std::string::String {
2468 use std::clone::Clone;
2469 self.next_page_token.clone()
2470 }
2471}
2472
2473/// IAM policy analysis query message.
2474#[derive(Clone, Default, PartialEq)]
2475#[non_exhaustive]
2476pub struct IamPolicyAnalysisQuery {
2477 /// Required. The relative name of the root asset. Only resources and IAM
2478 /// policies within the scope will be analyzed.
2479 ///
2480 /// This can only be an organization number (such as "organizations/123"), a
2481 /// folder number (such as "folders/123"), a project ID (such as
2482 /// "projects/my-project-id"), or a project number (such as "projects/12345").
2483 ///
2484 /// To know how to get organization ID, visit [here
2485 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
2486 ///
2487 /// To know how to get folder or project ID, visit [here
2488 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
2489 pub scope: std::string::String,
2490
2491 /// Optional. Specifies a resource for analysis.
2492 pub resource_selector:
2493 std::option::Option<crate::model::iam_policy_analysis_query::ResourceSelector>,
2494
2495 /// Optional. Specifies an identity for analysis.
2496 pub identity_selector:
2497 std::option::Option<crate::model::iam_policy_analysis_query::IdentitySelector>,
2498
2499 /// Optional. Specifies roles or permissions for analysis. This is optional.
2500 pub access_selector:
2501 std::option::Option<crate::model::iam_policy_analysis_query::AccessSelector>,
2502
2503 /// Optional. The query options.
2504 pub options: std::option::Option<crate::model::iam_policy_analysis_query::Options>,
2505
2506 /// Optional. The hypothetical context for IAM conditions evaluation.
2507 pub condition_context:
2508 std::option::Option<crate::model::iam_policy_analysis_query::ConditionContext>,
2509
2510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2511}
2512
2513impl IamPolicyAnalysisQuery {
2514 pub fn new() -> Self {
2515 std::default::Default::default()
2516 }
2517
2518 /// Sets the value of [scope][crate::model::IamPolicyAnalysisQuery::scope].
2519 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2520 self.scope = v.into();
2521 self
2522 }
2523
2524 /// Sets the value of [resource_selector][crate::model::IamPolicyAnalysisQuery::resource_selector].
2525 pub fn set_resource_selector<T>(mut self, v: T) -> Self
2526 where
2527 T: std::convert::Into<crate::model::iam_policy_analysis_query::ResourceSelector>,
2528 {
2529 self.resource_selector = std::option::Option::Some(v.into());
2530 self
2531 }
2532
2533 /// Sets or clears the value of [resource_selector][crate::model::IamPolicyAnalysisQuery::resource_selector].
2534 pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
2535 where
2536 T: std::convert::Into<crate::model::iam_policy_analysis_query::ResourceSelector>,
2537 {
2538 self.resource_selector = v.map(|x| x.into());
2539 self
2540 }
2541
2542 /// Sets the value of [identity_selector][crate::model::IamPolicyAnalysisQuery::identity_selector].
2543 pub fn set_identity_selector<T>(mut self, v: T) -> Self
2544 where
2545 T: std::convert::Into<crate::model::iam_policy_analysis_query::IdentitySelector>,
2546 {
2547 self.identity_selector = std::option::Option::Some(v.into());
2548 self
2549 }
2550
2551 /// Sets or clears the value of [identity_selector][crate::model::IamPolicyAnalysisQuery::identity_selector].
2552 pub fn set_or_clear_identity_selector<T>(mut self, v: std::option::Option<T>) -> Self
2553 where
2554 T: std::convert::Into<crate::model::iam_policy_analysis_query::IdentitySelector>,
2555 {
2556 self.identity_selector = v.map(|x| x.into());
2557 self
2558 }
2559
2560 /// Sets the value of [access_selector][crate::model::IamPolicyAnalysisQuery::access_selector].
2561 pub fn set_access_selector<T>(mut self, v: T) -> Self
2562 where
2563 T: std::convert::Into<crate::model::iam_policy_analysis_query::AccessSelector>,
2564 {
2565 self.access_selector = std::option::Option::Some(v.into());
2566 self
2567 }
2568
2569 /// Sets or clears the value of [access_selector][crate::model::IamPolicyAnalysisQuery::access_selector].
2570 pub fn set_or_clear_access_selector<T>(mut self, v: std::option::Option<T>) -> Self
2571 where
2572 T: std::convert::Into<crate::model::iam_policy_analysis_query::AccessSelector>,
2573 {
2574 self.access_selector = v.map(|x| x.into());
2575 self
2576 }
2577
2578 /// Sets the value of [options][crate::model::IamPolicyAnalysisQuery::options].
2579 pub fn set_options<T>(mut self, v: T) -> Self
2580 where
2581 T: std::convert::Into<crate::model::iam_policy_analysis_query::Options>,
2582 {
2583 self.options = std::option::Option::Some(v.into());
2584 self
2585 }
2586
2587 /// Sets or clears the value of [options][crate::model::IamPolicyAnalysisQuery::options].
2588 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2589 where
2590 T: std::convert::Into<crate::model::iam_policy_analysis_query::Options>,
2591 {
2592 self.options = v.map(|x| x.into());
2593 self
2594 }
2595
2596 /// Sets the value of [condition_context][crate::model::IamPolicyAnalysisQuery::condition_context].
2597 pub fn set_condition_context<T>(mut self, v: T) -> Self
2598 where
2599 T: std::convert::Into<crate::model::iam_policy_analysis_query::ConditionContext>,
2600 {
2601 self.condition_context = std::option::Option::Some(v.into());
2602 self
2603 }
2604
2605 /// Sets or clears the value of [condition_context][crate::model::IamPolicyAnalysisQuery::condition_context].
2606 pub fn set_or_clear_condition_context<T>(mut self, v: std::option::Option<T>) -> Self
2607 where
2608 T: std::convert::Into<crate::model::iam_policy_analysis_query::ConditionContext>,
2609 {
2610 self.condition_context = v.map(|x| x.into());
2611 self
2612 }
2613}
2614
2615impl wkt::message::Message for IamPolicyAnalysisQuery {
2616 fn typename() -> &'static str {
2617 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery"
2618 }
2619}
2620
2621/// Defines additional types related to [IamPolicyAnalysisQuery].
2622pub mod iam_policy_analysis_query {
2623 #[allow(unused_imports)]
2624 use super::*;
2625
2626 /// Specifies the resource to analyze for access policies, which may be set
2627 /// directly on the resource, or on ancestors such as organizations, folders or
2628 /// projects.
2629 #[derive(Clone, Default, PartialEq)]
2630 #[non_exhaustive]
2631 pub struct ResourceSelector {
2632 /// Required. The [full resource name]
2633 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
2634 /// of a resource of [supported resource
2635 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types).
2636 pub full_resource_name: std::string::String,
2637
2638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2639 }
2640
2641 impl ResourceSelector {
2642 pub fn new() -> Self {
2643 std::default::Default::default()
2644 }
2645
2646 /// Sets the value of [full_resource_name][crate::model::iam_policy_analysis_query::ResourceSelector::full_resource_name].
2647 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
2648 mut self,
2649 v: T,
2650 ) -> Self {
2651 self.full_resource_name = v.into();
2652 self
2653 }
2654 }
2655
2656 impl wkt::message::Message for ResourceSelector {
2657 fn typename() -> &'static str {
2658 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector"
2659 }
2660 }
2661
2662 /// Specifies an identity for which to determine resource access, based on
2663 /// roles assigned either directly to them or to the groups they belong to,
2664 /// directly or indirectly.
2665 #[derive(Clone, Default, PartialEq)]
2666 #[non_exhaustive]
2667 pub struct IdentitySelector {
2668 /// Required. The identity appear in the form of principals in
2669 /// [IAM policy
2670 /// binding](https://cloud.google.com/iam/reference/rest/v1/Binding).
2671 ///
2672 /// The examples of supported forms are:
2673 /// "user:mike@example.com",
2674 /// "group:admins@example.com",
2675 /// "domain:google.com",
2676 /// "serviceAccount:my-project-id@appspot.gserviceaccount.com".
2677 ///
2678 /// Notice that wildcard characters (such as * and ?) are not supported.
2679 /// You must give a specific identity.
2680 pub identity: std::string::String,
2681
2682 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2683 }
2684
2685 impl IdentitySelector {
2686 pub fn new() -> Self {
2687 std::default::Default::default()
2688 }
2689
2690 /// Sets the value of [identity][crate::model::iam_policy_analysis_query::IdentitySelector::identity].
2691 pub fn set_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.identity = v.into();
2693 self
2694 }
2695 }
2696
2697 impl wkt::message::Message for IdentitySelector {
2698 fn typename() -> &'static str {
2699 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.IdentitySelector"
2700 }
2701 }
2702
2703 /// Specifies roles and/or permissions to analyze, to determine both the
2704 /// identities possessing them and the resources they control. If multiple
2705 /// values are specified, results will include roles or permissions matching
2706 /// any of them. The total number of roles and permissions should be equal or
2707 /// less than 10.
2708 #[derive(Clone, Default, PartialEq)]
2709 #[non_exhaustive]
2710 pub struct AccessSelector {
2711 /// Optional. The roles to appear in result.
2712 pub roles: std::vec::Vec<std::string::String>,
2713
2714 /// Optional. The permissions to appear in result.
2715 pub permissions: std::vec::Vec<std::string::String>,
2716
2717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2718 }
2719
2720 impl AccessSelector {
2721 pub fn new() -> Self {
2722 std::default::Default::default()
2723 }
2724
2725 /// Sets the value of [roles][crate::model::iam_policy_analysis_query::AccessSelector::roles].
2726 pub fn set_roles<T, V>(mut self, v: T) -> Self
2727 where
2728 T: std::iter::IntoIterator<Item = V>,
2729 V: std::convert::Into<std::string::String>,
2730 {
2731 use std::iter::Iterator;
2732 self.roles = v.into_iter().map(|i| i.into()).collect();
2733 self
2734 }
2735
2736 /// Sets the value of [permissions][crate::model::iam_policy_analysis_query::AccessSelector::permissions].
2737 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2738 where
2739 T: std::iter::IntoIterator<Item = V>,
2740 V: std::convert::Into<std::string::String>,
2741 {
2742 use std::iter::Iterator;
2743 self.permissions = v.into_iter().map(|i| i.into()).collect();
2744 self
2745 }
2746 }
2747
2748 impl wkt::message::Message for AccessSelector {
2749 fn typename() -> &'static str {
2750 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.AccessSelector"
2751 }
2752 }
2753
2754 /// Contains query options.
2755 #[derive(Clone, Default, PartialEq)]
2756 #[non_exhaustive]
2757 pub struct Options {
2758 /// Optional. If true, the identities section of the result will expand any
2759 /// Google groups appearing in an IAM policy binding.
2760 ///
2761 /// If
2762 /// [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector]
2763 /// is specified, the identity in the result will be determined by the
2764 /// selector, and this flag is not allowed to set.
2765 ///
2766 /// If true, the default max expansion per group is 1000 for
2767 /// AssetService.AnalyzeIamPolicy][].
2768 ///
2769 /// Default is false.
2770 ///
2771 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector]: crate::model::IamPolicyAnalysisQuery::identity_selector
2772 pub expand_groups: bool,
2773
2774 /// Optional. If true, the access section of result will expand any roles
2775 /// appearing in IAM policy bindings to include their permissions.
2776 ///
2777 /// If
2778 /// [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector]
2779 /// is specified, the access section of the result will be determined by the
2780 /// selector, and this flag is not allowed to set.
2781 ///
2782 /// Default is false.
2783 ///
2784 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector]: crate::model::IamPolicyAnalysisQuery::access_selector
2785 pub expand_roles: bool,
2786
2787 /// Optional. If true and
2788 /// [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]
2789 /// is not specified, the resource section of the result will expand any
2790 /// resource attached to an IAM policy to include resources lower in the
2791 /// resource hierarchy.
2792 ///
2793 /// For example, if the request analyzes for which resources user A has
2794 /// permission P, and the results include an IAM policy with P on a Google
2795 /// Cloud folder, the results will also include resources in that folder with
2796 /// permission P.
2797 ///
2798 /// If true and
2799 /// [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]
2800 /// is specified, the resource section of the result will expand the
2801 /// specified resource to include resources lower in the resource hierarchy.
2802 /// Only project or lower resources are supported. Folder and organization
2803 /// resources cannot be used together with this option.
2804 ///
2805 /// For example, if the request analyzes for which users have permission P on
2806 /// a Google Cloud project with this option enabled, the results will include
2807 /// all users who have permission P on that project or any lower resource.
2808 ///
2809 /// If true, the default max expansion per resource is 1000 for
2810 /// AssetService.AnalyzeIamPolicy][] and 100000 for
2811 /// AssetService.AnalyzeIamPolicyLongrunning][].
2812 ///
2813 /// Default is false.
2814 ///
2815 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]: crate::model::IamPolicyAnalysisQuery::resource_selector
2816 pub expand_resources: bool,
2817
2818 /// Optional. If true, the result will output the relevant parent/child
2819 /// relationships between resources. Default is false.
2820 pub output_resource_edges: bool,
2821
2822 /// Optional. If true, the result will output the relevant membership
2823 /// relationships between groups and other groups, and between groups and
2824 /// principals. Default is false.
2825 pub output_group_edges: bool,
2826
2827 /// Optional. If true, the response will include access analysis from
2828 /// identities to resources via service account impersonation. This is a very
2829 /// expensive operation, because many derived queries will be executed. We
2830 /// highly recommend you use
2831 /// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]
2832 /// RPC instead.
2833 ///
2834 /// For example, if the request analyzes for which resources user A has
2835 /// permission P, and there's an IAM policy states user A has
2836 /// iam.serviceAccounts.getAccessToken permission to a service account SA,
2837 /// and there's another IAM policy states service account SA has permission P
2838 /// to a Google Cloud folder F, then user A potentially has access to the
2839 /// Google Cloud folder F. And those advanced analysis results will be
2840 /// included in
2841 /// [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
2842 ///
2843 /// Another example, if the request analyzes for who has
2844 /// permission P to a Google Cloud folder F, and there's an IAM policy states
2845 /// user A has iam.serviceAccounts.actAs permission to a service account SA,
2846 /// and there's another IAM policy states service account SA has permission P
2847 /// to the Google Cloud folder F, then user A potentially has access to the
2848 /// Google Cloud folder F. And those advanced analysis results will be
2849 /// included in
2850 /// [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
2851 ///
2852 /// Only the following permissions are considered in this analysis:
2853 ///
2854 /// * `iam.serviceAccounts.actAs`
2855 /// * `iam.serviceAccounts.signBlob`
2856 /// * `iam.serviceAccounts.signJwt`
2857 /// * `iam.serviceAccounts.getAccessToken`
2858 /// * `iam.serviceAccounts.getOpenIdToken`
2859 /// * `iam.serviceAccounts.implicitDelegation`
2860 ///
2861 /// Default is false.
2862 ///
2863 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]: crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis
2864 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
2865 pub analyze_service_account_impersonation: bool,
2866
2867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2868 }
2869
2870 impl Options {
2871 pub fn new() -> Self {
2872 std::default::Default::default()
2873 }
2874
2875 /// Sets the value of [expand_groups][crate::model::iam_policy_analysis_query::Options::expand_groups].
2876 pub fn set_expand_groups<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2877 self.expand_groups = v.into();
2878 self
2879 }
2880
2881 /// Sets the value of [expand_roles][crate::model::iam_policy_analysis_query::Options::expand_roles].
2882 pub fn set_expand_roles<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2883 self.expand_roles = v.into();
2884 self
2885 }
2886
2887 /// Sets the value of [expand_resources][crate::model::iam_policy_analysis_query::Options::expand_resources].
2888 pub fn set_expand_resources<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2889 self.expand_resources = v.into();
2890 self
2891 }
2892
2893 /// Sets the value of [output_resource_edges][crate::model::iam_policy_analysis_query::Options::output_resource_edges].
2894 pub fn set_output_resource_edges<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2895 self.output_resource_edges = v.into();
2896 self
2897 }
2898
2899 /// Sets the value of [output_group_edges][crate::model::iam_policy_analysis_query::Options::output_group_edges].
2900 pub fn set_output_group_edges<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2901 self.output_group_edges = v.into();
2902 self
2903 }
2904
2905 /// Sets the value of [analyze_service_account_impersonation][crate::model::iam_policy_analysis_query::Options::analyze_service_account_impersonation].
2906 pub fn set_analyze_service_account_impersonation<T: std::convert::Into<bool>>(
2907 mut self,
2908 v: T,
2909 ) -> Self {
2910 self.analyze_service_account_impersonation = v.into();
2911 self
2912 }
2913 }
2914
2915 impl wkt::message::Message for Options {
2916 fn typename() -> &'static str {
2917 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.Options"
2918 }
2919 }
2920
2921 /// The IAM conditions context.
2922 #[derive(Clone, Default, PartialEq)]
2923 #[non_exhaustive]
2924 pub struct ConditionContext {
2925 /// The IAM conditions time context.
2926 pub time_context: std::option::Option<
2927 crate::model::iam_policy_analysis_query::condition_context::TimeContext,
2928 >,
2929
2930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2931 }
2932
2933 impl ConditionContext {
2934 pub fn new() -> Self {
2935 std::default::Default::default()
2936 }
2937
2938 /// Sets the value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context].
2939 ///
2940 /// Note that all the setters affecting `time_context` are mutually
2941 /// exclusive.
2942 pub fn set_time_context<
2943 T: std::convert::Into<
2944 std::option::Option<
2945 crate::model::iam_policy_analysis_query::condition_context::TimeContext,
2946 >,
2947 >,
2948 >(
2949 mut self,
2950 v: T,
2951 ) -> Self {
2952 self.time_context = v.into();
2953 self
2954 }
2955
2956 /// The value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context]
2957 /// if it holds a `AccessTime`, `None` if the field is not set or
2958 /// holds a different branch.
2959 pub fn access_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
2960 #[allow(unreachable_patterns)]
2961 self.time_context.as_ref().and_then(|v| match v {
2962 crate::model::iam_policy_analysis_query::condition_context::TimeContext::AccessTime(v) => std::option::Option::Some(v),
2963 _ => std::option::Option::None,
2964 })
2965 }
2966
2967 /// Sets the value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context]
2968 /// to hold a `AccessTime`.
2969 ///
2970 /// Note that all the setters affecting `time_context` are
2971 /// mutually exclusive.
2972 pub fn set_access_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2973 mut self,
2974 v: T,
2975 ) -> Self {
2976 self.time_context = std::option::Option::Some(
2977 crate::model::iam_policy_analysis_query::condition_context::TimeContext::AccessTime(
2978 v.into(),
2979 ),
2980 );
2981 self
2982 }
2983 }
2984
2985 impl wkt::message::Message for ConditionContext {
2986 fn typename() -> &'static str {
2987 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.ConditionContext"
2988 }
2989 }
2990
2991 /// Defines additional types related to [ConditionContext].
2992 pub mod condition_context {
2993 #[allow(unused_imports)]
2994 use super::*;
2995
2996 /// The IAM conditions time context.
2997 #[derive(Clone, Debug, PartialEq)]
2998 #[non_exhaustive]
2999 pub enum TimeContext {
3000 /// The hypothetical access timestamp to evaluate IAM conditions. Note that
3001 /// this value must not be earlier than the current time; otherwise, an
3002 /// INVALID_ARGUMENT error will be returned.
3003 AccessTime(std::boxed::Box<wkt::Timestamp>),
3004 }
3005 }
3006}
3007
3008/// A request message for
3009/// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
3010///
3011/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
3012#[derive(Clone, Default, PartialEq)]
3013#[non_exhaustive]
3014pub struct AnalyzeIamPolicyRequest {
3015 /// Required. The request query.
3016 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
3017
3018 /// Optional. The name of a saved query, which must be in the format of:
3019 ///
3020 /// * projects/project_number/savedQueries/saved_query_id
3021 /// * folders/folder_number/savedQueries/saved_query_id
3022 /// * organizations/organization_number/savedQueries/saved_query_id
3023 ///
3024 /// If both `analysis_query` and `saved_analysis_query` are provided, they
3025 /// will be merged together with the `saved_analysis_query` as base and
3026 /// the `analysis_query` as overrides. For more details of the merge behavior,
3027 /// refer to the
3028 /// [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
3029 /// page.
3030 ///
3031 /// Note that you cannot override primitive fields with default value, such as
3032 /// 0 or empty string, etc., because we use proto3, which doesn't support field
3033 /// presence yet.
3034 pub saved_analysis_query: std::string::String,
3035
3036 /// Optional. Amount of time executable has to complete. See JSON
3037 /// representation of
3038 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
3039 ///
3040 /// If this field is set with a value less than the RPC deadline, and the
3041 /// execution of your query hasn't finished in the specified
3042 /// execution timeout, you will get a response with partial result.
3043 /// Otherwise, your query's execution will continue until the RPC deadline.
3044 /// If it's not finished until then, you will get a DEADLINE_EXCEEDED error.
3045 ///
3046 /// Default is empty.
3047 pub execution_timeout: std::option::Option<wkt::Duration>,
3048
3049 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3050}
3051
3052impl AnalyzeIamPolicyRequest {
3053 pub fn new() -> Self {
3054 std::default::Default::default()
3055 }
3056
3057 /// Sets the value of [analysis_query][crate::model::AnalyzeIamPolicyRequest::analysis_query].
3058 pub fn set_analysis_query<T>(mut self, v: T) -> Self
3059 where
3060 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3061 {
3062 self.analysis_query = std::option::Option::Some(v.into());
3063 self
3064 }
3065
3066 /// Sets or clears the value of [analysis_query][crate::model::AnalyzeIamPolicyRequest::analysis_query].
3067 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
3068 where
3069 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3070 {
3071 self.analysis_query = v.map(|x| x.into());
3072 self
3073 }
3074
3075 /// Sets the value of [saved_analysis_query][crate::model::AnalyzeIamPolicyRequest::saved_analysis_query].
3076 pub fn set_saved_analysis_query<T: std::convert::Into<std::string::String>>(
3077 mut self,
3078 v: T,
3079 ) -> Self {
3080 self.saved_analysis_query = v.into();
3081 self
3082 }
3083
3084 /// Sets the value of [execution_timeout][crate::model::AnalyzeIamPolicyRequest::execution_timeout].
3085 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
3086 where
3087 T: std::convert::Into<wkt::Duration>,
3088 {
3089 self.execution_timeout = std::option::Option::Some(v.into());
3090 self
3091 }
3092
3093 /// Sets or clears the value of [execution_timeout][crate::model::AnalyzeIamPolicyRequest::execution_timeout].
3094 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3095 where
3096 T: std::convert::Into<wkt::Duration>,
3097 {
3098 self.execution_timeout = v.map(|x| x.into());
3099 self
3100 }
3101}
3102
3103impl wkt::message::Message for AnalyzeIamPolicyRequest {
3104 fn typename() -> &'static str {
3105 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyRequest"
3106 }
3107}
3108
3109/// A response message for
3110/// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
3111///
3112/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
3113#[derive(Clone, Default, PartialEq)]
3114#[non_exhaustive]
3115pub struct AnalyzeIamPolicyResponse {
3116 /// The main analysis that matches the original request.
3117 pub main_analysis:
3118 std::option::Option<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3119
3120 /// The service account impersonation analysis if
3121 /// [IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation][google.cloud.asset.v1.IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation]
3122 /// is enabled.
3123 ///
3124 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation]: crate::model::iam_policy_analysis_query::Options::analyze_service_account_impersonation
3125 pub service_account_impersonation_analysis:
3126 std::vec::Vec<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3127
3128 /// Represents whether all entries in the
3129 /// [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis]
3130 /// and
3131 /// [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]
3132 /// have been fully explored to answer the query in the request.
3133 ///
3134 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis]: crate::model::AnalyzeIamPolicyResponse::main_analysis
3135 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]: crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis
3136 pub fully_explored: bool,
3137
3138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3139}
3140
3141impl AnalyzeIamPolicyResponse {
3142 pub fn new() -> Self {
3143 std::default::Default::default()
3144 }
3145
3146 /// Sets the value of [main_analysis][crate::model::AnalyzeIamPolicyResponse::main_analysis].
3147 pub fn set_main_analysis<T>(mut self, v: T) -> Self
3148 where
3149 T: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3150 {
3151 self.main_analysis = std::option::Option::Some(v.into());
3152 self
3153 }
3154
3155 /// Sets or clears the value of [main_analysis][crate::model::AnalyzeIamPolicyResponse::main_analysis].
3156 pub fn set_or_clear_main_analysis<T>(mut self, v: std::option::Option<T>) -> Self
3157 where
3158 T: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3159 {
3160 self.main_analysis = v.map(|x| x.into());
3161 self
3162 }
3163
3164 /// Sets the value of [service_account_impersonation_analysis][crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis].
3165 pub fn set_service_account_impersonation_analysis<T, V>(mut self, v: T) -> Self
3166 where
3167 T: std::iter::IntoIterator<Item = V>,
3168 V: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3169 {
3170 use std::iter::Iterator;
3171 self.service_account_impersonation_analysis = v.into_iter().map(|i| i.into()).collect();
3172 self
3173 }
3174
3175 /// Sets the value of [fully_explored][crate::model::AnalyzeIamPolicyResponse::fully_explored].
3176 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3177 self.fully_explored = v.into();
3178 self
3179 }
3180}
3181
3182impl wkt::message::Message for AnalyzeIamPolicyResponse {
3183 fn typename() -> &'static str {
3184 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyResponse"
3185 }
3186}
3187
3188/// Defines additional types related to [AnalyzeIamPolicyResponse].
3189pub mod analyze_iam_policy_response {
3190 #[allow(unused_imports)]
3191 use super::*;
3192
3193 /// An analysis message to group the query and results.
3194 #[derive(Clone, Default, PartialEq)]
3195 #[non_exhaustive]
3196 pub struct IamPolicyAnalysis {
3197 /// The analysis query.
3198 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
3199
3200 /// A list of
3201 /// [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult]
3202 /// that matches the analysis query, or empty if no result is found.
3203 ///
3204 /// [google.cloud.asset.v1.IamPolicyAnalysisResult]: crate::model::IamPolicyAnalysisResult
3205 pub analysis_results: std::vec::Vec<crate::model::IamPolicyAnalysisResult>,
3206
3207 /// Represents whether all entries in the
3208 /// [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results]
3209 /// have been fully explored to answer the query.
3210 ///
3211 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results]: crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_results
3212 pub fully_explored: bool,
3213
3214 /// A list of non-critical errors happened during the query handling.
3215 pub non_critical_errors: std::vec::Vec<crate::model::IamPolicyAnalysisState>,
3216
3217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3218 }
3219
3220 impl IamPolicyAnalysis {
3221 pub fn new() -> Self {
3222 std::default::Default::default()
3223 }
3224
3225 /// Sets the value of [analysis_query][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_query].
3226 pub fn set_analysis_query<T>(mut self, v: T) -> Self
3227 where
3228 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3229 {
3230 self.analysis_query = std::option::Option::Some(v.into());
3231 self
3232 }
3233
3234 /// Sets or clears the value of [analysis_query][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_query].
3235 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
3236 where
3237 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3238 {
3239 self.analysis_query = v.map(|x| x.into());
3240 self
3241 }
3242
3243 /// Sets the value of [analysis_results][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_results].
3244 pub fn set_analysis_results<T, V>(mut self, v: T) -> Self
3245 where
3246 T: std::iter::IntoIterator<Item = V>,
3247 V: std::convert::Into<crate::model::IamPolicyAnalysisResult>,
3248 {
3249 use std::iter::Iterator;
3250 self.analysis_results = v.into_iter().map(|i| i.into()).collect();
3251 self
3252 }
3253
3254 /// Sets the value of [fully_explored][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::fully_explored].
3255 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3256 self.fully_explored = v.into();
3257 self
3258 }
3259
3260 /// Sets the value of [non_critical_errors][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::non_critical_errors].
3261 pub fn set_non_critical_errors<T, V>(mut self, v: T) -> Self
3262 where
3263 T: std::iter::IntoIterator<Item = V>,
3264 V: std::convert::Into<crate::model::IamPolicyAnalysisState>,
3265 {
3266 use std::iter::Iterator;
3267 self.non_critical_errors = v.into_iter().map(|i| i.into()).collect();
3268 self
3269 }
3270 }
3271
3272 impl wkt::message::Message for IamPolicyAnalysis {
3273 fn typename() -> &'static str {
3274 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis"
3275 }
3276 }
3277}
3278
3279/// Output configuration for export IAM policy analysis destination.
3280#[derive(Clone, Default, PartialEq)]
3281#[non_exhaustive]
3282pub struct IamPolicyAnalysisOutputConfig {
3283 /// IAM policy analysis export destination.
3284 pub destination:
3285 std::option::Option<crate::model::iam_policy_analysis_output_config::Destination>,
3286
3287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3288}
3289
3290impl IamPolicyAnalysisOutputConfig {
3291 pub fn new() -> Self {
3292 std::default::Default::default()
3293 }
3294
3295 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination].
3296 ///
3297 /// Note that all the setters affecting `destination` are mutually
3298 /// exclusive.
3299 pub fn set_destination<
3300 T: std::convert::Into<
3301 std::option::Option<crate::model::iam_policy_analysis_output_config::Destination>,
3302 >,
3303 >(
3304 mut self,
3305 v: T,
3306 ) -> Self {
3307 self.destination = v.into();
3308 self
3309 }
3310
3311 /// The value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
3312 /// if it holds a `GcsDestination`, `None` if the field is not set or
3313 /// holds a different branch.
3314 pub fn gcs_destination(
3315 &self,
3316 ) -> std::option::Option<
3317 &std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
3318 > {
3319 #[allow(unreachable_patterns)]
3320 self.destination.as_ref().and_then(|v| match v {
3321 crate::model::iam_policy_analysis_output_config::Destination::GcsDestination(v) => {
3322 std::option::Option::Some(v)
3323 }
3324 _ => std::option::Option::None,
3325 })
3326 }
3327
3328 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
3329 /// to hold a `GcsDestination`.
3330 ///
3331 /// Note that all the setters affecting `destination` are
3332 /// mutually exclusive.
3333 pub fn set_gcs_destination<
3334 T: std::convert::Into<
3335 std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
3336 >,
3337 >(
3338 mut self,
3339 v: T,
3340 ) -> Self {
3341 self.destination = std::option::Option::Some(
3342 crate::model::iam_policy_analysis_output_config::Destination::GcsDestination(v.into()),
3343 );
3344 self
3345 }
3346
3347 /// The value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
3348 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
3349 /// holds a different branch.
3350 pub fn bigquery_destination(
3351 &self,
3352 ) -> std::option::Option<
3353 &std::boxed::Box<crate::model::iam_policy_analysis_output_config::BigQueryDestination>,
3354 > {
3355 #[allow(unreachable_patterns)]
3356 self.destination.as_ref().and_then(|v| match v {
3357 crate::model::iam_policy_analysis_output_config::Destination::BigqueryDestination(
3358 v,
3359 ) => std::option::Option::Some(v),
3360 _ => std::option::Option::None,
3361 })
3362 }
3363
3364 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
3365 /// to hold a `BigqueryDestination`.
3366 ///
3367 /// Note that all the setters affecting `destination` are
3368 /// mutually exclusive.
3369 pub fn set_bigquery_destination<
3370 T: std::convert::Into<
3371 std::boxed::Box<
3372 crate::model::iam_policy_analysis_output_config::BigQueryDestination,
3373 >,
3374 >,
3375 >(
3376 mut self,
3377 v: T,
3378 ) -> Self {
3379 self.destination = std::option::Option::Some(
3380 crate::model::iam_policy_analysis_output_config::Destination::BigqueryDestination(
3381 v.into(),
3382 ),
3383 );
3384 self
3385 }
3386}
3387
3388impl wkt::message::Message for IamPolicyAnalysisOutputConfig {
3389 fn typename() -> &'static str {
3390 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig"
3391 }
3392}
3393
3394/// Defines additional types related to [IamPolicyAnalysisOutputConfig].
3395pub mod iam_policy_analysis_output_config {
3396 #[allow(unused_imports)]
3397 use super::*;
3398
3399 /// A Cloud Storage location.
3400 #[derive(Clone, Default, PartialEq)]
3401 #[non_exhaustive]
3402 pub struct GcsDestination {
3403 /// Required. The URI of the Cloud Storage object. It's the same URI that is
3404 /// used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
3405 /// Editing Object
3406 /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
3407 /// for more information.
3408 ///
3409 /// If the specified Cloud Storage object already exists and there is no
3410 /// [hold](https://cloud.google.com/storage/docs/object-holds), it will be
3411 /// overwritten with the analysis result.
3412 pub uri: std::string::String,
3413
3414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3415 }
3416
3417 impl GcsDestination {
3418 pub fn new() -> Self {
3419 std::default::Default::default()
3420 }
3421
3422 /// Sets the value of [uri][crate::model::iam_policy_analysis_output_config::GcsDestination::uri].
3423 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3424 self.uri = v.into();
3425 self
3426 }
3427 }
3428
3429 impl wkt::message::Message for GcsDestination {
3430 fn typename() -> &'static str {
3431 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.GcsDestination"
3432 }
3433 }
3434
3435 /// A BigQuery destination.
3436 #[derive(Clone, Default, PartialEq)]
3437 #[non_exhaustive]
3438 pub struct BigQueryDestination {
3439 /// Required. The BigQuery dataset in format
3440 /// "projects/projectId/datasets/datasetId", to which the analysis results
3441 /// should be exported. If this dataset does not exist, the export call will
3442 /// return an INVALID_ARGUMENT error.
3443 pub dataset: std::string::String,
3444
3445 /// Required. The prefix of the BigQuery tables to which the analysis results
3446 /// will be written. Tables will be created based on this table_prefix if not
3447 /// exist:
3448 ///
3449 /// * <table_prefix>_analysis table will contain export operation's metadata.
3450 /// * <table_prefix>_analysis_result will contain all the
3451 /// [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult].
3452 /// When [partition_key] is specified, both tables will be partitioned based
3453 /// on the [partition_key].
3454 ///
3455 /// [google.cloud.asset.v1.IamPolicyAnalysisResult]: crate::model::IamPolicyAnalysisResult
3456 pub table_prefix: std::string::String,
3457
3458 /// The partition key for BigQuery partitioned table.
3459 pub partition_key:
3460 crate::model::iam_policy_analysis_output_config::big_query_destination::PartitionKey,
3461
3462 /// Optional. Specifies the action that occurs if the destination table or
3463 /// partition already exists. The following values are supported:
3464 ///
3465 /// * WRITE_TRUNCATE: If the table or partition already exists, BigQuery
3466 /// overwrites the entire table or all the partitions data.
3467 /// * WRITE_APPEND: If the table or partition already exists, BigQuery
3468 /// appends the data to the table or the latest partition.
3469 /// * WRITE_EMPTY: If the table already exists and contains data, an error is
3470 /// returned.
3471 ///
3472 /// The default value is WRITE_APPEND. Each action is atomic and only occurs
3473 /// if BigQuery is able to complete the job successfully. Details are at
3474 /// <https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file>.
3475 pub write_disposition: std::string::String,
3476
3477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3478 }
3479
3480 impl BigQueryDestination {
3481 pub fn new() -> Self {
3482 std::default::Default::default()
3483 }
3484
3485 /// Sets the value of [dataset][crate::model::iam_policy_analysis_output_config::BigQueryDestination::dataset].
3486 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3487 self.dataset = v.into();
3488 self
3489 }
3490
3491 /// Sets the value of [table_prefix][crate::model::iam_policy_analysis_output_config::BigQueryDestination::table_prefix].
3492 pub fn set_table_prefix<T: std::convert::Into<std::string::String>>(
3493 mut self,
3494 v: T,
3495 ) -> Self {
3496 self.table_prefix = v.into();
3497 self
3498 }
3499
3500 /// Sets the value of [partition_key][crate::model::iam_policy_analysis_output_config::BigQueryDestination::partition_key].
3501 pub fn set_partition_key<T: std::convert::Into<crate::model::iam_policy_analysis_output_config::big_query_destination::PartitionKey>>(mut self, v: T) -> Self{
3502 self.partition_key = v.into();
3503 self
3504 }
3505
3506 /// Sets the value of [write_disposition][crate::model::iam_policy_analysis_output_config::BigQueryDestination::write_disposition].
3507 pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
3508 mut self,
3509 v: T,
3510 ) -> Self {
3511 self.write_disposition = v.into();
3512 self
3513 }
3514 }
3515
3516 impl wkt::message::Message for BigQueryDestination {
3517 fn typename() -> &'static str {
3518 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.BigQueryDestination"
3519 }
3520 }
3521
3522 /// Defines additional types related to [BigQueryDestination].
3523 pub mod big_query_destination {
3524 #[allow(unused_imports)]
3525 use super::*;
3526
3527 /// This enum determines the partition key column for the bigquery tables.
3528 /// Partitioning can improve query performance and reduce query cost by
3529 /// filtering partitions. Refer to
3530 /// <https://cloud.google.com/bigquery/docs/partitioned-tables> for details.
3531 ///
3532 /// # Working with unknown values
3533 ///
3534 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3535 /// additional enum variants at any time. Adding new variants is not considered
3536 /// a breaking change. Applications should write their code in anticipation of:
3537 ///
3538 /// - New values appearing in future releases of the client library, **and**
3539 /// - New values received dynamically, without application changes.
3540 ///
3541 /// Please consult the [Working with enums] section in the user guide for some
3542 /// guidelines.
3543 ///
3544 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3545 #[derive(Clone, Debug, PartialEq)]
3546 #[non_exhaustive]
3547 pub enum PartitionKey {
3548 /// Unspecified partition key. Tables won't be partitioned using this
3549 /// option.
3550 Unspecified,
3551 /// The time when the request is received. If specified as partition key,
3552 /// the result table(s) is partitioned by the RequestTime column, an
3553 /// additional timestamp column representing when the request was received.
3554 RequestTime,
3555 /// If set, the enum was initialized with an unknown value.
3556 ///
3557 /// Applications can examine the value using [PartitionKey::value] or
3558 /// [PartitionKey::name].
3559 UnknownValue(partition_key::UnknownValue),
3560 }
3561
3562 #[doc(hidden)]
3563 pub mod partition_key {
3564 #[allow(unused_imports)]
3565 use super::*;
3566 #[derive(Clone, Debug, PartialEq)]
3567 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3568 }
3569
3570 impl PartitionKey {
3571 /// Gets the enum value.
3572 ///
3573 /// Returns `None` if the enum contains an unknown value deserialized from
3574 /// the string representation of enums.
3575 pub fn value(&self) -> std::option::Option<i32> {
3576 match self {
3577 Self::Unspecified => std::option::Option::Some(0),
3578 Self::RequestTime => std::option::Option::Some(1),
3579 Self::UnknownValue(u) => u.0.value(),
3580 }
3581 }
3582
3583 /// Gets the enum value as a string.
3584 ///
3585 /// Returns `None` if the enum contains an unknown value deserialized from
3586 /// the integer representation of enums.
3587 pub fn name(&self) -> std::option::Option<&str> {
3588 match self {
3589 Self::Unspecified => std::option::Option::Some("PARTITION_KEY_UNSPECIFIED"),
3590 Self::RequestTime => std::option::Option::Some("REQUEST_TIME"),
3591 Self::UnknownValue(u) => u.0.name(),
3592 }
3593 }
3594 }
3595
3596 impl std::default::Default for PartitionKey {
3597 fn default() -> Self {
3598 use std::convert::From;
3599 Self::from(0)
3600 }
3601 }
3602
3603 impl std::fmt::Display for PartitionKey {
3604 fn fmt(
3605 &self,
3606 f: &mut std::fmt::Formatter<'_>,
3607 ) -> std::result::Result<(), std::fmt::Error> {
3608 wkt::internal::display_enum(f, self.name(), self.value())
3609 }
3610 }
3611
3612 impl std::convert::From<i32> for PartitionKey {
3613 fn from(value: i32) -> Self {
3614 match value {
3615 0 => Self::Unspecified,
3616 1 => Self::RequestTime,
3617 _ => Self::UnknownValue(partition_key::UnknownValue(
3618 wkt::internal::UnknownEnumValue::Integer(value),
3619 )),
3620 }
3621 }
3622 }
3623
3624 impl std::convert::From<&str> for PartitionKey {
3625 fn from(value: &str) -> Self {
3626 use std::string::ToString;
3627 match value {
3628 "PARTITION_KEY_UNSPECIFIED" => Self::Unspecified,
3629 "REQUEST_TIME" => Self::RequestTime,
3630 _ => Self::UnknownValue(partition_key::UnknownValue(
3631 wkt::internal::UnknownEnumValue::String(value.to_string()),
3632 )),
3633 }
3634 }
3635 }
3636
3637 impl serde::ser::Serialize for PartitionKey {
3638 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3639 where
3640 S: serde::Serializer,
3641 {
3642 match self {
3643 Self::Unspecified => serializer.serialize_i32(0),
3644 Self::RequestTime => serializer.serialize_i32(1),
3645 Self::UnknownValue(u) => u.0.serialize(serializer),
3646 }
3647 }
3648 }
3649
3650 impl<'de> serde::de::Deserialize<'de> for PartitionKey {
3651 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3652 where
3653 D: serde::Deserializer<'de>,
3654 {
3655 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PartitionKey>::new(
3656 ".google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.BigQueryDestination.PartitionKey"))
3657 }
3658 }
3659 }
3660
3661 /// IAM policy analysis export destination.
3662 #[derive(Clone, Debug, PartialEq)]
3663 #[non_exhaustive]
3664 pub enum Destination {
3665 /// Destination on Cloud Storage.
3666 GcsDestination(
3667 std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
3668 ),
3669 /// Destination on BigQuery.
3670 BigqueryDestination(
3671 std::boxed::Box<crate::model::iam_policy_analysis_output_config::BigQueryDestination>,
3672 ),
3673 }
3674}
3675
3676/// A request message for
3677/// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
3678///
3679/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
3680#[derive(Clone, Default, PartialEq)]
3681#[non_exhaustive]
3682pub struct AnalyzeIamPolicyLongrunningRequest {
3683 /// Required. The request query.
3684 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
3685
3686 /// Optional. The name of a saved query, which must be in the format of:
3687 ///
3688 /// * projects/project_number/savedQueries/saved_query_id
3689 /// * folders/folder_number/savedQueries/saved_query_id
3690 /// * organizations/organization_number/savedQueries/saved_query_id
3691 ///
3692 /// If both `analysis_query` and `saved_analysis_query` are provided, they
3693 /// will be merged together with the `saved_analysis_query` as base and
3694 /// the `analysis_query` as overrides. For more details of the merge behavior,
3695 /// refer to the
3696 /// [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
3697 /// doc.
3698 ///
3699 /// Note that you cannot override primitive fields with default value, such as
3700 /// 0 or empty string, etc., because we use proto3, which doesn't support field
3701 /// presence yet.
3702 pub saved_analysis_query: std::string::String,
3703
3704 /// Required. Output configuration indicating where the results will be output
3705 /// to.
3706 pub output_config: std::option::Option<crate::model::IamPolicyAnalysisOutputConfig>,
3707
3708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3709}
3710
3711impl AnalyzeIamPolicyLongrunningRequest {
3712 pub fn new() -> Self {
3713 std::default::Default::default()
3714 }
3715
3716 /// Sets the value of [analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::analysis_query].
3717 pub fn set_analysis_query<T>(mut self, v: T) -> Self
3718 where
3719 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3720 {
3721 self.analysis_query = std::option::Option::Some(v.into());
3722 self
3723 }
3724
3725 /// Sets or clears the value of [analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::analysis_query].
3726 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
3727 where
3728 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3729 {
3730 self.analysis_query = v.map(|x| x.into());
3731 self
3732 }
3733
3734 /// Sets the value of [saved_analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::saved_analysis_query].
3735 pub fn set_saved_analysis_query<T: std::convert::Into<std::string::String>>(
3736 mut self,
3737 v: T,
3738 ) -> Self {
3739 self.saved_analysis_query = v.into();
3740 self
3741 }
3742
3743 /// Sets the value of [output_config][crate::model::AnalyzeIamPolicyLongrunningRequest::output_config].
3744 pub fn set_output_config<T>(mut self, v: T) -> Self
3745 where
3746 T: std::convert::Into<crate::model::IamPolicyAnalysisOutputConfig>,
3747 {
3748 self.output_config = std::option::Option::Some(v.into());
3749 self
3750 }
3751
3752 /// Sets or clears the value of [output_config][crate::model::AnalyzeIamPolicyLongrunningRequest::output_config].
3753 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3754 where
3755 T: std::convert::Into<crate::model::IamPolicyAnalysisOutputConfig>,
3756 {
3757 self.output_config = v.map(|x| x.into());
3758 self
3759 }
3760}
3761
3762impl wkt::message::Message for AnalyzeIamPolicyLongrunningRequest {
3763 fn typename() -> &'static str {
3764 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest"
3765 }
3766}
3767
3768/// A response message for
3769/// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
3770///
3771/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
3772#[derive(Clone, Default, PartialEq)]
3773#[non_exhaustive]
3774pub struct AnalyzeIamPolicyLongrunningResponse {
3775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3776}
3777
3778impl AnalyzeIamPolicyLongrunningResponse {
3779 pub fn new() -> Self {
3780 std::default::Default::default()
3781 }
3782}
3783
3784impl wkt::message::Message for AnalyzeIamPolicyLongrunningResponse {
3785 fn typename() -> &'static str {
3786 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse"
3787 }
3788}
3789
3790/// A saved query which can be shared with others or used later.
3791#[derive(Clone, Default, PartialEq)]
3792#[non_exhaustive]
3793pub struct SavedQuery {
3794 /// The resource name of the saved query. The format must be:
3795 ///
3796 /// * projects/project_number/savedQueries/saved_query_id
3797 /// * folders/folder_number/savedQueries/saved_query_id
3798 /// * organizations/organization_number/savedQueries/saved_query_id
3799 pub name: std::string::String,
3800
3801 /// The description of this saved query. This value should be fewer than 255
3802 /// characters.
3803 pub description: std::string::String,
3804
3805 /// Output only. The create time of this saved query.
3806 pub create_time: std::option::Option<wkt::Timestamp>,
3807
3808 /// Output only. The account's email address who has created this saved query.
3809 pub creator: std::string::String,
3810
3811 /// Output only. The last update time of this saved query.
3812 pub last_update_time: std::option::Option<wkt::Timestamp>,
3813
3814 /// Output only. The account's email address who has updated this saved query
3815 /// most recently.
3816 pub last_updater: std::string::String,
3817
3818 /// Labels applied on the resource.
3819 /// This value should not contain more than 10 entries. The key and value of
3820 /// each entry must be non-empty and fewer than 64 characters.
3821 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3822
3823 /// The query content.
3824 pub content: std::option::Option<crate::model::saved_query::QueryContent>,
3825
3826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3827}
3828
3829impl SavedQuery {
3830 pub fn new() -> Self {
3831 std::default::Default::default()
3832 }
3833
3834 /// Sets the value of [name][crate::model::SavedQuery::name].
3835 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3836 self.name = v.into();
3837 self
3838 }
3839
3840 /// Sets the value of [description][crate::model::SavedQuery::description].
3841 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3842 self.description = v.into();
3843 self
3844 }
3845
3846 /// Sets the value of [create_time][crate::model::SavedQuery::create_time].
3847 pub fn set_create_time<T>(mut self, v: T) -> Self
3848 where
3849 T: std::convert::Into<wkt::Timestamp>,
3850 {
3851 self.create_time = std::option::Option::Some(v.into());
3852 self
3853 }
3854
3855 /// Sets or clears the value of [create_time][crate::model::SavedQuery::create_time].
3856 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3857 where
3858 T: std::convert::Into<wkt::Timestamp>,
3859 {
3860 self.create_time = v.map(|x| x.into());
3861 self
3862 }
3863
3864 /// Sets the value of [creator][crate::model::SavedQuery::creator].
3865 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3866 self.creator = v.into();
3867 self
3868 }
3869
3870 /// Sets the value of [last_update_time][crate::model::SavedQuery::last_update_time].
3871 pub fn set_last_update_time<T>(mut self, v: T) -> Self
3872 where
3873 T: std::convert::Into<wkt::Timestamp>,
3874 {
3875 self.last_update_time = std::option::Option::Some(v.into());
3876 self
3877 }
3878
3879 /// Sets or clears the value of [last_update_time][crate::model::SavedQuery::last_update_time].
3880 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3881 where
3882 T: std::convert::Into<wkt::Timestamp>,
3883 {
3884 self.last_update_time = v.map(|x| x.into());
3885 self
3886 }
3887
3888 /// Sets the value of [last_updater][crate::model::SavedQuery::last_updater].
3889 pub fn set_last_updater<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3890 self.last_updater = v.into();
3891 self
3892 }
3893
3894 /// Sets the value of [labels][crate::model::SavedQuery::labels].
3895 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3896 where
3897 T: std::iter::IntoIterator<Item = (K, V)>,
3898 K: std::convert::Into<std::string::String>,
3899 V: std::convert::Into<std::string::String>,
3900 {
3901 use std::iter::Iterator;
3902 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3903 self
3904 }
3905
3906 /// Sets the value of [content][crate::model::SavedQuery::content].
3907 pub fn set_content<T>(mut self, v: T) -> Self
3908 where
3909 T: std::convert::Into<crate::model::saved_query::QueryContent>,
3910 {
3911 self.content = std::option::Option::Some(v.into());
3912 self
3913 }
3914
3915 /// Sets or clears the value of [content][crate::model::SavedQuery::content].
3916 pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
3917 where
3918 T: std::convert::Into<crate::model::saved_query::QueryContent>,
3919 {
3920 self.content = v.map(|x| x.into());
3921 self
3922 }
3923}
3924
3925impl wkt::message::Message for SavedQuery {
3926 fn typename() -> &'static str {
3927 "type.googleapis.com/google.cloud.asset.v1.SavedQuery"
3928 }
3929}
3930
3931/// Defines additional types related to [SavedQuery].
3932pub mod saved_query {
3933 #[allow(unused_imports)]
3934 use super::*;
3935
3936 /// The query content.
3937 #[derive(Clone, Default, PartialEq)]
3938 #[non_exhaustive]
3939 pub struct QueryContent {
3940 pub query_content:
3941 std::option::Option<crate::model::saved_query::query_content::QueryContent>,
3942
3943 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3944 }
3945
3946 impl QueryContent {
3947 pub fn new() -> Self {
3948 std::default::Default::default()
3949 }
3950
3951 /// Sets the value of [query_content][crate::model::saved_query::QueryContent::query_content].
3952 ///
3953 /// Note that all the setters affecting `query_content` are mutually
3954 /// exclusive.
3955 pub fn set_query_content<
3956 T: std::convert::Into<
3957 std::option::Option<crate::model::saved_query::query_content::QueryContent>,
3958 >,
3959 >(
3960 mut self,
3961 v: T,
3962 ) -> Self {
3963 self.query_content = v.into();
3964 self
3965 }
3966
3967 /// The value of [query_content][crate::model::saved_query::QueryContent::query_content]
3968 /// if it holds a `IamPolicyAnalysisQuery`, `None` if the field is not set or
3969 /// holds a different branch.
3970 pub fn iam_policy_analysis_query(
3971 &self,
3972 ) -> std::option::Option<&std::boxed::Box<crate::model::IamPolicyAnalysisQuery>> {
3973 #[allow(unreachable_patterns)]
3974 self.query_content.as_ref().and_then(|v| match v {
3975 crate::model::saved_query::query_content::QueryContent::IamPolicyAnalysisQuery(
3976 v,
3977 ) => std::option::Option::Some(v),
3978 _ => std::option::Option::None,
3979 })
3980 }
3981
3982 /// Sets the value of [query_content][crate::model::saved_query::QueryContent::query_content]
3983 /// to hold a `IamPolicyAnalysisQuery`.
3984 ///
3985 /// Note that all the setters affecting `query_content` are
3986 /// mutually exclusive.
3987 pub fn set_iam_policy_analysis_query<
3988 T: std::convert::Into<std::boxed::Box<crate::model::IamPolicyAnalysisQuery>>,
3989 >(
3990 mut self,
3991 v: T,
3992 ) -> Self {
3993 self.query_content = std::option::Option::Some(
3994 crate::model::saved_query::query_content::QueryContent::IamPolicyAnalysisQuery(
3995 v.into(),
3996 ),
3997 );
3998 self
3999 }
4000 }
4001
4002 impl wkt::message::Message for QueryContent {
4003 fn typename() -> &'static str {
4004 "type.googleapis.com/google.cloud.asset.v1.SavedQuery.QueryContent"
4005 }
4006 }
4007
4008 /// Defines additional types related to [QueryContent].
4009 pub mod query_content {
4010 #[allow(unused_imports)]
4011 use super::*;
4012
4013 #[derive(Clone, Debug, PartialEq)]
4014 #[non_exhaustive]
4015 pub enum QueryContent {
4016 /// An IAM Policy Analysis query, which could be used in
4017 /// the
4018 /// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]
4019 /// RPC or the
4020 /// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]
4021 /// RPC.
4022 ///
4023 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
4024 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
4025 IamPolicyAnalysisQuery(std::boxed::Box<crate::model::IamPolicyAnalysisQuery>),
4026 }
4027 }
4028}
4029
4030/// Request to create a saved query.
4031#[derive(Clone, Default, PartialEq)]
4032#[non_exhaustive]
4033pub struct CreateSavedQueryRequest {
4034 /// Required. The name of the project/folder/organization where this
4035 /// saved_query should be created in. It can only be an organization number
4036 /// (such as "organizations/123"), a folder number (such as "folders/123"), a
4037 /// project ID (such as "projects/my-project-id"), or a project number (such as
4038 /// "projects/12345").
4039 pub parent: std::string::String,
4040
4041 /// Required. The saved_query details. The `name` field must be empty as it
4042 /// will be generated based on the parent and saved_query_id.
4043 pub saved_query: std::option::Option<crate::model::SavedQuery>,
4044
4045 /// Required. The ID to use for the saved query, which must be unique in the
4046 /// specified parent. It will become the final component of the saved query's
4047 /// resource name.
4048 ///
4049 /// This value should be 4-63 characters, and valid characters
4050 /// are `[a-z][0-9]-`.
4051 ///
4052 /// Notice that this field is required in the saved query creation, and the
4053 /// `name` field of the `saved_query` will be ignored.
4054 pub saved_query_id: std::string::String,
4055
4056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4057}
4058
4059impl CreateSavedQueryRequest {
4060 pub fn new() -> Self {
4061 std::default::Default::default()
4062 }
4063
4064 /// Sets the value of [parent][crate::model::CreateSavedQueryRequest::parent].
4065 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4066 self.parent = v.into();
4067 self
4068 }
4069
4070 /// Sets the value of [saved_query][crate::model::CreateSavedQueryRequest::saved_query].
4071 pub fn set_saved_query<T>(mut self, v: T) -> Self
4072 where
4073 T: std::convert::Into<crate::model::SavedQuery>,
4074 {
4075 self.saved_query = std::option::Option::Some(v.into());
4076 self
4077 }
4078
4079 /// Sets or clears the value of [saved_query][crate::model::CreateSavedQueryRequest::saved_query].
4080 pub fn set_or_clear_saved_query<T>(mut self, v: std::option::Option<T>) -> Self
4081 where
4082 T: std::convert::Into<crate::model::SavedQuery>,
4083 {
4084 self.saved_query = v.map(|x| x.into());
4085 self
4086 }
4087
4088 /// Sets the value of [saved_query_id][crate::model::CreateSavedQueryRequest::saved_query_id].
4089 pub fn set_saved_query_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4090 self.saved_query_id = v.into();
4091 self
4092 }
4093}
4094
4095impl wkt::message::Message for CreateSavedQueryRequest {
4096 fn typename() -> &'static str {
4097 "type.googleapis.com/google.cloud.asset.v1.CreateSavedQueryRequest"
4098 }
4099}
4100
4101/// Request to get a saved query.
4102#[derive(Clone, Default, PartialEq)]
4103#[non_exhaustive]
4104pub struct GetSavedQueryRequest {
4105 /// Required. The name of the saved query and it must be in the format of:
4106 ///
4107 /// * projects/project_number/savedQueries/saved_query_id
4108 /// * folders/folder_number/savedQueries/saved_query_id
4109 /// * organizations/organization_number/savedQueries/saved_query_id
4110 pub name: std::string::String,
4111
4112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4113}
4114
4115impl GetSavedQueryRequest {
4116 pub fn new() -> Self {
4117 std::default::Default::default()
4118 }
4119
4120 /// Sets the value of [name][crate::model::GetSavedQueryRequest::name].
4121 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4122 self.name = v.into();
4123 self
4124 }
4125}
4126
4127impl wkt::message::Message for GetSavedQueryRequest {
4128 fn typename() -> &'static str {
4129 "type.googleapis.com/google.cloud.asset.v1.GetSavedQueryRequest"
4130 }
4131}
4132
4133/// Request to list saved queries.
4134#[derive(Clone, Default, PartialEq)]
4135#[non_exhaustive]
4136pub struct ListSavedQueriesRequest {
4137 /// Required. The parent project/folder/organization whose savedQueries are to
4138 /// be listed. It can only be using project/folder/organization number (such as
4139 /// "folders/12345")", or a project ID (such as "projects/my-project-id").
4140 pub parent: std::string::String,
4141
4142 /// Optional. The expression to filter resources.
4143 /// The expression is a list of zero or more restrictions combined via logical
4144 /// operators `AND` and `OR`. When `AND` and `OR` are both used in the
4145 /// expression, parentheses must be appropriately used to group the
4146 /// combinations. The expression may also contain regular expressions.
4147 ///
4148 /// See <https://google.aip.dev/160> for more information on the grammar.
4149 pub filter: std::string::String,
4150
4151 /// Optional. The maximum number of saved queries to return per page. The
4152 /// service may return fewer than this value. If unspecified, at most 50 will
4153 /// be returned. The maximum value is 1000; values above 1000 will be coerced
4154 /// to 1000.
4155 pub page_size: i32,
4156
4157 /// Optional. A page token, received from a previous `ListSavedQueries` call.
4158 /// Provide this to retrieve the subsequent page.
4159 ///
4160 /// When paginating, all other parameters provided to `ListSavedQueries` must
4161 /// match the call that provided the page token.
4162 pub page_token: std::string::String,
4163
4164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4165}
4166
4167impl ListSavedQueriesRequest {
4168 pub fn new() -> Self {
4169 std::default::Default::default()
4170 }
4171
4172 /// Sets the value of [parent][crate::model::ListSavedQueriesRequest::parent].
4173 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174 self.parent = v.into();
4175 self
4176 }
4177
4178 /// Sets the value of [filter][crate::model::ListSavedQueriesRequest::filter].
4179 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4180 self.filter = v.into();
4181 self
4182 }
4183
4184 /// Sets the value of [page_size][crate::model::ListSavedQueriesRequest::page_size].
4185 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4186 self.page_size = v.into();
4187 self
4188 }
4189
4190 /// Sets the value of [page_token][crate::model::ListSavedQueriesRequest::page_token].
4191 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4192 self.page_token = v.into();
4193 self
4194 }
4195}
4196
4197impl wkt::message::Message for ListSavedQueriesRequest {
4198 fn typename() -> &'static str {
4199 "type.googleapis.com/google.cloud.asset.v1.ListSavedQueriesRequest"
4200 }
4201}
4202
4203/// Response of listing saved queries.
4204#[derive(Clone, Default, PartialEq)]
4205#[non_exhaustive]
4206pub struct ListSavedQueriesResponse {
4207 /// A list of savedQueries.
4208 pub saved_queries: std::vec::Vec<crate::model::SavedQuery>,
4209
4210 /// A token, which can be sent as `page_token` to retrieve the next page.
4211 /// If this field is omitted, there are no subsequent pages.
4212 pub next_page_token: std::string::String,
4213
4214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4215}
4216
4217impl ListSavedQueriesResponse {
4218 pub fn new() -> Self {
4219 std::default::Default::default()
4220 }
4221
4222 /// Sets the value of [saved_queries][crate::model::ListSavedQueriesResponse::saved_queries].
4223 pub fn set_saved_queries<T, V>(mut self, v: T) -> Self
4224 where
4225 T: std::iter::IntoIterator<Item = V>,
4226 V: std::convert::Into<crate::model::SavedQuery>,
4227 {
4228 use std::iter::Iterator;
4229 self.saved_queries = v.into_iter().map(|i| i.into()).collect();
4230 self
4231 }
4232
4233 /// Sets the value of [next_page_token][crate::model::ListSavedQueriesResponse::next_page_token].
4234 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4235 self.next_page_token = v.into();
4236 self
4237 }
4238}
4239
4240impl wkt::message::Message for ListSavedQueriesResponse {
4241 fn typename() -> &'static str {
4242 "type.googleapis.com/google.cloud.asset.v1.ListSavedQueriesResponse"
4243 }
4244}
4245
4246#[doc(hidden)]
4247impl gax::paginator::internal::PageableResponse for ListSavedQueriesResponse {
4248 type PageItem = crate::model::SavedQuery;
4249
4250 fn items(self) -> std::vec::Vec<Self::PageItem> {
4251 self.saved_queries
4252 }
4253
4254 fn next_page_token(&self) -> std::string::String {
4255 use std::clone::Clone;
4256 self.next_page_token.clone()
4257 }
4258}
4259
4260/// Request to update a saved query.
4261#[derive(Clone, Default, PartialEq)]
4262#[non_exhaustive]
4263pub struct UpdateSavedQueryRequest {
4264 /// Required. The saved query to update.
4265 ///
4266 /// The saved query's `name` field is used to identify the one to update,
4267 /// which has format as below:
4268 ///
4269 /// * projects/project_number/savedQueries/saved_query_id
4270 /// * folders/folder_number/savedQueries/saved_query_id
4271 /// * organizations/organization_number/savedQueries/saved_query_id
4272 pub saved_query: std::option::Option<crate::model::SavedQuery>,
4273
4274 /// Required. The list of fields to update.
4275 pub update_mask: std::option::Option<wkt::FieldMask>,
4276
4277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4278}
4279
4280impl UpdateSavedQueryRequest {
4281 pub fn new() -> Self {
4282 std::default::Default::default()
4283 }
4284
4285 /// Sets the value of [saved_query][crate::model::UpdateSavedQueryRequest::saved_query].
4286 pub fn set_saved_query<T>(mut self, v: T) -> Self
4287 where
4288 T: std::convert::Into<crate::model::SavedQuery>,
4289 {
4290 self.saved_query = std::option::Option::Some(v.into());
4291 self
4292 }
4293
4294 /// Sets or clears the value of [saved_query][crate::model::UpdateSavedQueryRequest::saved_query].
4295 pub fn set_or_clear_saved_query<T>(mut self, v: std::option::Option<T>) -> Self
4296 where
4297 T: std::convert::Into<crate::model::SavedQuery>,
4298 {
4299 self.saved_query = v.map(|x| x.into());
4300 self
4301 }
4302
4303 /// Sets the value of [update_mask][crate::model::UpdateSavedQueryRequest::update_mask].
4304 pub fn set_update_mask<T>(mut self, v: T) -> Self
4305 where
4306 T: std::convert::Into<wkt::FieldMask>,
4307 {
4308 self.update_mask = std::option::Option::Some(v.into());
4309 self
4310 }
4311
4312 /// Sets or clears the value of [update_mask][crate::model::UpdateSavedQueryRequest::update_mask].
4313 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4314 where
4315 T: std::convert::Into<wkt::FieldMask>,
4316 {
4317 self.update_mask = v.map(|x| x.into());
4318 self
4319 }
4320}
4321
4322impl wkt::message::Message for UpdateSavedQueryRequest {
4323 fn typename() -> &'static str {
4324 "type.googleapis.com/google.cloud.asset.v1.UpdateSavedQueryRequest"
4325 }
4326}
4327
4328/// Request to delete a saved query.
4329#[derive(Clone, Default, PartialEq)]
4330#[non_exhaustive]
4331pub struct DeleteSavedQueryRequest {
4332 /// Required. The name of the saved query to delete. It must be in the format
4333 /// of:
4334 ///
4335 /// * projects/project_number/savedQueries/saved_query_id
4336 /// * folders/folder_number/savedQueries/saved_query_id
4337 /// * organizations/organization_number/savedQueries/saved_query_id
4338 pub name: std::string::String,
4339
4340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4341}
4342
4343impl DeleteSavedQueryRequest {
4344 pub fn new() -> Self {
4345 std::default::Default::default()
4346 }
4347
4348 /// Sets the value of [name][crate::model::DeleteSavedQueryRequest::name].
4349 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4350 self.name = v.into();
4351 self
4352 }
4353}
4354
4355impl wkt::message::Message for DeleteSavedQueryRequest {
4356 fn typename() -> &'static str {
4357 "type.googleapis.com/google.cloud.asset.v1.DeleteSavedQueryRequest"
4358 }
4359}
4360
4361/// The request message for performing resource move analysis.
4362#[derive(Clone, Default, PartialEq)]
4363#[non_exhaustive]
4364pub struct AnalyzeMoveRequest {
4365 /// Required. Name of the resource to perform the analysis against.
4366 /// Only Google Cloud projects are supported as of today. Hence, this can only
4367 /// be a project ID (such as "projects/my-project-id") or a project number
4368 /// (such as "projects/12345").
4369 pub resource: std::string::String,
4370
4371 /// Required. Name of the Google Cloud folder or organization to reparent the
4372 /// target resource. The analysis will be performed against hypothetically
4373 /// moving the resource to this specified destination parent. This can only be
4374 /// a folder number (such as "folders/123") or an organization number (such as
4375 /// "organizations/123").
4376 pub destination_parent: std::string::String,
4377
4378 /// Analysis view indicating what information should be included in the
4379 /// analysis response. If unspecified, the default view is FULL.
4380 pub view: crate::model::analyze_move_request::AnalysisView,
4381
4382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4383}
4384
4385impl AnalyzeMoveRequest {
4386 pub fn new() -> Self {
4387 std::default::Default::default()
4388 }
4389
4390 /// Sets the value of [resource][crate::model::AnalyzeMoveRequest::resource].
4391 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4392 self.resource = v.into();
4393 self
4394 }
4395
4396 /// Sets the value of [destination_parent][crate::model::AnalyzeMoveRequest::destination_parent].
4397 pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
4398 mut self,
4399 v: T,
4400 ) -> Self {
4401 self.destination_parent = v.into();
4402 self
4403 }
4404
4405 /// Sets the value of [view][crate::model::AnalyzeMoveRequest::view].
4406 pub fn set_view<T: std::convert::Into<crate::model::analyze_move_request::AnalysisView>>(
4407 mut self,
4408 v: T,
4409 ) -> Self {
4410 self.view = v.into();
4411 self
4412 }
4413}
4414
4415impl wkt::message::Message for AnalyzeMoveRequest {
4416 fn typename() -> &'static str {
4417 "type.googleapis.com/google.cloud.asset.v1.AnalyzeMoveRequest"
4418 }
4419}
4420
4421/// Defines additional types related to [AnalyzeMoveRequest].
4422pub mod analyze_move_request {
4423 #[allow(unused_imports)]
4424 use super::*;
4425
4426 /// View enum for supporting partial analysis responses.
4427 ///
4428 /// # Working with unknown values
4429 ///
4430 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4431 /// additional enum variants at any time. Adding new variants is not considered
4432 /// a breaking change. Applications should write their code in anticipation of:
4433 ///
4434 /// - New values appearing in future releases of the client library, **and**
4435 /// - New values received dynamically, without application changes.
4436 ///
4437 /// Please consult the [Working with enums] section in the user guide for some
4438 /// guidelines.
4439 ///
4440 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4441 #[derive(Clone, Debug, PartialEq)]
4442 #[non_exhaustive]
4443 pub enum AnalysisView {
4444 /// The default/unset value.
4445 /// The API will default to the FULL view.
4446 Unspecified,
4447 /// Full analysis including all level of impacts of the specified resource
4448 /// move.
4449 Full,
4450 /// Basic analysis only including blockers which will prevent the specified
4451 /// resource move at runtime.
4452 Basic,
4453 /// If set, the enum was initialized with an unknown value.
4454 ///
4455 /// Applications can examine the value using [AnalysisView::value] or
4456 /// [AnalysisView::name].
4457 UnknownValue(analysis_view::UnknownValue),
4458 }
4459
4460 #[doc(hidden)]
4461 pub mod analysis_view {
4462 #[allow(unused_imports)]
4463 use super::*;
4464 #[derive(Clone, Debug, PartialEq)]
4465 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4466 }
4467
4468 impl AnalysisView {
4469 /// Gets the enum value.
4470 ///
4471 /// Returns `None` if the enum contains an unknown value deserialized from
4472 /// the string representation of enums.
4473 pub fn value(&self) -> std::option::Option<i32> {
4474 match self {
4475 Self::Unspecified => std::option::Option::Some(0),
4476 Self::Full => std::option::Option::Some(1),
4477 Self::Basic => std::option::Option::Some(2),
4478 Self::UnknownValue(u) => u.0.value(),
4479 }
4480 }
4481
4482 /// Gets the enum value as a string.
4483 ///
4484 /// Returns `None` if the enum contains an unknown value deserialized from
4485 /// the integer representation of enums.
4486 pub fn name(&self) -> std::option::Option<&str> {
4487 match self {
4488 Self::Unspecified => std::option::Option::Some("ANALYSIS_VIEW_UNSPECIFIED"),
4489 Self::Full => std::option::Option::Some("FULL"),
4490 Self::Basic => std::option::Option::Some("BASIC"),
4491 Self::UnknownValue(u) => u.0.name(),
4492 }
4493 }
4494 }
4495
4496 impl std::default::Default for AnalysisView {
4497 fn default() -> Self {
4498 use std::convert::From;
4499 Self::from(0)
4500 }
4501 }
4502
4503 impl std::fmt::Display for AnalysisView {
4504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4505 wkt::internal::display_enum(f, self.name(), self.value())
4506 }
4507 }
4508
4509 impl std::convert::From<i32> for AnalysisView {
4510 fn from(value: i32) -> Self {
4511 match value {
4512 0 => Self::Unspecified,
4513 1 => Self::Full,
4514 2 => Self::Basic,
4515 _ => Self::UnknownValue(analysis_view::UnknownValue(
4516 wkt::internal::UnknownEnumValue::Integer(value),
4517 )),
4518 }
4519 }
4520 }
4521
4522 impl std::convert::From<&str> for AnalysisView {
4523 fn from(value: &str) -> Self {
4524 use std::string::ToString;
4525 match value {
4526 "ANALYSIS_VIEW_UNSPECIFIED" => Self::Unspecified,
4527 "FULL" => Self::Full,
4528 "BASIC" => Self::Basic,
4529 _ => Self::UnknownValue(analysis_view::UnknownValue(
4530 wkt::internal::UnknownEnumValue::String(value.to_string()),
4531 )),
4532 }
4533 }
4534 }
4535
4536 impl serde::ser::Serialize for AnalysisView {
4537 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4538 where
4539 S: serde::Serializer,
4540 {
4541 match self {
4542 Self::Unspecified => serializer.serialize_i32(0),
4543 Self::Full => serializer.serialize_i32(1),
4544 Self::Basic => serializer.serialize_i32(2),
4545 Self::UnknownValue(u) => u.0.serialize(serializer),
4546 }
4547 }
4548 }
4549
4550 impl<'de> serde::de::Deserialize<'de> for AnalysisView {
4551 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4552 where
4553 D: serde::Deserializer<'de>,
4554 {
4555 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnalysisView>::new(
4556 ".google.cloud.asset.v1.AnalyzeMoveRequest.AnalysisView",
4557 ))
4558 }
4559 }
4560}
4561
4562/// The response message for resource move analysis.
4563#[derive(Clone, Default, PartialEq)]
4564#[non_exhaustive]
4565pub struct AnalyzeMoveResponse {
4566 /// The list of analyses returned from performing the intended resource move
4567 /// analysis. The analysis is grouped by different Google Cloud services.
4568 pub move_analysis: std::vec::Vec<crate::model::MoveAnalysis>,
4569
4570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4571}
4572
4573impl AnalyzeMoveResponse {
4574 pub fn new() -> Self {
4575 std::default::Default::default()
4576 }
4577
4578 /// Sets the value of [move_analysis][crate::model::AnalyzeMoveResponse::move_analysis].
4579 pub fn set_move_analysis<T, V>(mut self, v: T) -> Self
4580 where
4581 T: std::iter::IntoIterator<Item = V>,
4582 V: std::convert::Into<crate::model::MoveAnalysis>,
4583 {
4584 use std::iter::Iterator;
4585 self.move_analysis = v.into_iter().map(|i| i.into()).collect();
4586 self
4587 }
4588}
4589
4590impl wkt::message::Message for AnalyzeMoveResponse {
4591 fn typename() -> &'static str {
4592 "type.googleapis.com/google.cloud.asset.v1.AnalyzeMoveResponse"
4593 }
4594}
4595
4596/// A message to group the analysis information.
4597#[derive(Clone, Default, PartialEq)]
4598#[non_exhaustive]
4599pub struct MoveAnalysis {
4600 /// The user friendly display name of the analysis. E.g. IAM, organization
4601 /// policy etc.
4602 pub display_name: std::string::String,
4603
4604 pub result: std::option::Option<crate::model::move_analysis::Result>,
4605
4606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4607}
4608
4609impl MoveAnalysis {
4610 pub fn new() -> Self {
4611 std::default::Default::default()
4612 }
4613
4614 /// Sets the value of [display_name][crate::model::MoveAnalysis::display_name].
4615 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4616 self.display_name = v.into();
4617 self
4618 }
4619
4620 /// Sets the value of [result][crate::model::MoveAnalysis::result].
4621 ///
4622 /// Note that all the setters affecting `result` are mutually
4623 /// exclusive.
4624 pub fn set_result<
4625 T: std::convert::Into<std::option::Option<crate::model::move_analysis::Result>>,
4626 >(
4627 mut self,
4628 v: T,
4629 ) -> Self {
4630 self.result = v.into();
4631 self
4632 }
4633
4634 /// The value of [result][crate::model::MoveAnalysis::result]
4635 /// if it holds a `Analysis`, `None` if the field is not set or
4636 /// holds a different branch.
4637 pub fn analysis(
4638 &self,
4639 ) -> std::option::Option<&std::boxed::Box<crate::model::MoveAnalysisResult>> {
4640 #[allow(unreachable_patterns)]
4641 self.result.as_ref().and_then(|v| match v {
4642 crate::model::move_analysis::Result::Analysis(v) => std::option::Option::Some(v),
4643 _ => std::option::Option::None,
4644 })
4645 }
4646
4647 /// Sets the value of [result][crate::model::MoveAnalysis::result]
4648 /// to hold a `Analysis`.
4649 ///
4650 /// Note that all the setters affecting `result` are
4651 /// mutually exclusive.
4652 pub fn set_analysis<
4653 T: std::convert::Into<std::boxed::Box<crate::model::MoveAnalysisResult>>,
4654 >(
4655 mut self,
4656 v: T,
4657 ) -> Self {
4658 self.result =
4659 std::option::Option::Some(crate::model::move_analysis::Result::Analysis(v.into()));
4660 self
4661 }
4662
4663 /// The value of [result][crate::model::MoveAnalysis::result]
4664 /// if it holds a `Error`, `None` if the field is not set or
4665 /// holds a different branch.
4666 pub fn error(&self) -> std::option::Option<&std::boxed::Box<rpc::model::Status>> {
4667 #[allow(unreachable_patterns)]
4668 self.result.as_ref().and_then(|v| match v {
4669 crate::model::move_analysis::Result::Error(v) => std::option::Option::Some(v),
4670 _ => std::option::Option::None,
4671 })
4672 }
4673
4674 /// Sets the value of [result][crate::model::MoveAnalysis::result]
4675 /// to hold a `Error`.
4676 ///
4677 /// Note that all the setters affecting `result` are
4678 /// mutually exclusive.
4679 pub fn set_error<T: std::convert::Into<std::boxed::Box<rpc::model::Status>>>(
4680 mut self,
4681 v: T,
4682 ) -> Self {
4683 self.result =
4684 std::option::Option::Some(crate::model::move_analysis::Result::Error(v.into()));
4685 self
4686 }
4687}
4688
4689impl wkt::message::Message for MoveAnalysis {
4690 fn typename() -> &'static str {
4691 "type.googleapis.com/google.cloud.asset.v1.MoveAnalysis"
4692 }
4693}
4694
4695/// Defines additional types related to [MoveAnalysis].
4696pub mod move_analysis {
4697 #[allow(unused_imports)]
4698 use super::*;
4699
4700 #[derive(Clone, Debug, PartialEq)]
4701 #[non_exhaustive]
4702 pub enum Result {
4703 /// Analysis result of moving the target resource.
4704 Analysis(std::boxed::Box<crate::model::MoveAnalysisResult>),
4705 /// Description of error encountered when performing the analysis.
4706 Error(std::boxed::Box<rpc::model::Status>),
4707 }
4708}
4709
4710/// An analysis result including blockers and warnings.
4711#[derive(Clone, Default, PartialEq)]
4712#[non_exhaustive]
4713pub struct MoveAnalysisResult {
4714 /// Blocking information that would prevent the target resource from moving
4715 /// to the specified destination at runtime.
4716 pub blockers: std::vec::Vec<crate::model::MoveImpact>,
4717
4718 /// Warning information indicating that moving the target resource to the
4719 /// specified destination might be unsafe. This can include important policy
4720 /// information and configuration changes, but will not block moves at runtime.
4721 pub warnings: std::vec::Vec<crate::model::MoveImpact>,
4722
4723 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4724}
4725
4726impl MoveAnalysisResult {
4727 pub fn new() -> Self {
4728 std::default::Default::default()
4729 }
4730
4731 /// Sets the value of [blockers][crate::model::MoveAnalysisResult::blockers].
4732 pub fn set_blockers<T, V>(mut self, v: T) -> Self
4733 where
4734 T: std::iter::IntoIterator<Item = V>,
4735 V: std::convert::Into<crate::model::MoveImpact>,
4736 {
4737 use std::iter::Iterator;
4738 self.blockers = v.into_iter().map(|i| i.into()).collect();
4739 self
4740 }
4741
4742 /// Sets the value of [warnings][crate::model::MoveAnalysisResult::warnings].
4743 pub fn set_warnings<T, V>(mut self, v: T) -> Self
4744 where
4745 T: std::iter::IntoIterator<Item = V>,
4746 V: std::convert::Into<crate::model::MoveImpact>,
4747 {
4748 use std::iter::Iterator;
4749 self.warnings = v.into_iter().map(|i| i.into()).collect();
4750 self
4751 }
4752}
4753
4754impl wkt::message::Message for MoveAnalysisResult {
4755 fn typename() -> &'static str {
4756 "type.googleapis.com/google.cloud.asset.v1.MoveAnalysisResult"
4757 }
4758}
4759
4760/// A message to group impacts of moving the target resource.
4761#[derive(Clone, Default, PartialEq)]
4762#[non_exhaustive]
4763pub struct MoveImpact {
4764 /// User friendly impact detail in a free form message.
4765 pub detail: std::string::String,
4766
4767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4768}
4769
4770impl MoveImpact {
4771 pub fn new() -> Self {
4772 std::default::Default::default()
4773 }
4774
4775 /// Sets the value of [detail][crate::model::MoveImpact::detail].
4776 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4777 self.detail = v.into();
4778 self
4779 }
4780}
4781
4782impl wkt::message::Message for MoveImpact {
4783 fn typename() -> &'static str {
4784 "type.googleapis.com/google.cloud.asset.v1.MoveImpact"
4785 }
4786}
4787
4788/// Output configuration query assets.
4789#[derive(Clone, Default, PartialEq)]
4790#[non_exhaustive]
4791pub struct QueryAssetsOutputConfig {
4792 /// BigQuery destination where the query results will be saved.
4793 pub bigquery_destination:
4794 std::option::Option<crate::model::query_assets_output_config::BigQueryDestination>,
4795
4796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4797}
4798
4799impl QueryAssetsOutputConfig {
4800 pub fn new() -> Self {
4801 std::default::Default::default()
4802 }
4803
4804 /// Sets the value of [bigquery_destination][crate::model::QueryAssetsOutputConfig::bigquery_destination].
4805 pub fn set_bigquery_destination<T>(mut self, v: T) -> Self
4806 where
4807 T: std::convert::Into<crate::model::query_assets_output_config::BigQueryDestination>,
4808 {
4809 self.bigquery_destination = std::option::Option::Some(v.into());
4810 self
4811 }
4812
4813 /// Sets or clears the value of [bigquery_destination][crate::model::QueryAssetsOutputConfig::bigquery_destination].
4814 pub fn set_or_clear_bigquery_destination<T>(mut self, v: std::option::Option<T>) -> Self
4815 where
4816 T: std::convert::Into<crate::model::query_assets_output_config::BigQueryDestination>,
4817 {
4818 self.bigquery_destination = v.map(|x| x.into());
4819 self
4820 }
4821}
4822
4823impl wkt::message::Message for QueryAssetsOutputConfig {
4824 fn typename() -> &'static str {
4825 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsOutputConfig"
4826 }
4827}
4828
4829/// Defines additional types related to [QueryAssetsOutputConfig].
4830pub mod query_assets_output_config {
4831 #[allow(unused_imports)]
4832 use super::*;
4833
4834 /// BigQuery destination.
4835 #[derive(Clone, Default, PartialEq)]
4836 #[non_exhaustive]
4837 pub struct BigQueryDestination {
4838 /// Required. The BigQuery dataset where the query results will be saved. It
4839 /// has the format of "projects/{projectId}/datasets/{datasetId}".
4840 pub dataset: std::string::String,
4841
4842 /// Required. The BigQuery table where the query results will be saved. If
4843 /// this table does not exist, a new table with the given name will be
4844 /// created.
4845 pub table: std::string::String,
4846
4847 /// Specifies the action that occurs if the destination table or partition
4848 /// already exists. The following values are supported:
4849 ///
4850 /// * WRITE_TRUNCATE: If the table or partition already exists, BigQuery
4851 /// overwrites the entire table or all the partitions data.
4852 /// * WRITE_APPEND: If the table or partition already exists, BigQuery
4853 /// appends the data to the table or the latest partition.
4854 /// * WRITE_EMPTY: If the table already exists and contains data, a
4855 /// 'duplicate' error is returned in the job result.
4856 ///
4857 /// The default value is WRITE_EMPTY.
4858 pub write_disposition: std::string::String,
4859
4860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4861 }
4862
4863 impl BigQueryDestination {
4864 pub fn new() -> Self {
4865 std::default::Default::default()
4866 }
4867
4868 /// Sets the value of [dataset][crate::model::query_assets_output_config::BigQueryDestination::dataset].
4869 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4870 self.dataset = v.into();
4871 self
4872 }
4873
4874 /// Sets the value of [table][crate::model::query_assets_output_config::BigQueryDestination::table].
4875 pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4876 self.table = v.into();
4877 self
4878 }
4879
4880 /// Sets the value of [write_disposition][crate::model::query_assets_output_config::BigQueryDestination::write_disposition].
4881 pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
4882 mut self,
4883 v: T,
4884 ) -> Self {
4885 self.write_disposition = v.into();
4886 self
4887 }
4888 }
4889
4890 impl wkt::message::Message for BigQueryDestination {
4891 fn typename() -> &'static str {
4892 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination"
4893 }
4894 }
4895}
4896
4897/// QueryAssets request.
4898#[derive(Clone, Default, PartialEq)]
4899#[non_exhaustive]
4900pub struct QueryAssetsRequest {
4901 /// Required. The relative name of the root asset. This can only be an
4902 /// organization number (such as "organizations/123"), a project ID (such as
4903 /// "projects/my-project-id"), or a project number (such as "projects/12345"),
4904 /// or a folder number (such as "folders/123").
4905 ///
4906 /// Only assets belonging to the `parent` will be returned.
4907 pub parent: std::string::String,
4908
4909 /// Optional. The maximum number of rows to return in the results. Responses
4910 /// are limited to 10 MB and 1000 rows.
4911 ///
4912 /// By default, the maximum row count is 1000. When the byte or row count limit
4913 /// is reached, the rest of the query results will be paginated.
4914 ///
4915 /// The field will be ignored when [output_config] is specified.
4916 pub page_size: i32,
4917
4918 /// Optional. A page token received from previous `QueryAssets`.
4919 ///
4920 /// The field will be ignored when [output_config] is specified.
4921 pub page_token: std::string::String,
4922
4923 /// Optional. Specifies the maximum amount of time that the client is willing
4924 /// to wait for the query to complete. By default, this limit is 5 min for the
4925 /// first query, and 1 minute for the following queries. If the query is
4926 /// complete, the `done` field in the `QueryAssetsResponse` is true, otherwise
4927 /// false.
4928 ///
4929 /// Like BigQuery [jobs.query
4930 /// API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest)
4931 /// The call is not guaranteed to wait for the specified timeout; it typically
4932 /// returns after around 200 seconds (200,000 milliseconds), even if the query
4933 /// is not complete.
4934 ///
4935 /// The field will be ignored when [output_config] is specified.
4936 pub timeout: std::option::Option<wkt::Duration>,
4937
4938 /// Optional. Destination where the query results will be saved.
4939 ///
4940 /// When this field is specified, the query results won't be saved in the
4941 /// [QueryAssetsResponse.query_result]. Instead
4942 /// [QueryAssetsResponse.output_config] will be set.
4943 ///
4944 /// Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used
4945 /// to check the status of the query job when passed to a following
4946 /// [QueryAssets] API call.
4947 pub output_config: std::option::Option<crate::model::QueryAssetsOutputConfig>,
4948
4949 pub query: std::option::Option<crate::model::query_assets_request::Query>,
4950
4951 /// Specifies what time period or point in time to query asset metadata at.
4952 ///
4953 /// * unset - query asset metadata as it is right now
4954 /// * [read_time_window] - query asset metadata as it was at any point in time
4955 /// between [start_time] and [end_time].
4956 /// * [read_time] - query asset metadata as it was at that point in time.
4957 /// If data for the timestamp/date range selected does not exist,
4958 /// it will simply return a valid response with no rows.
4959 pub time: std::option::Option<crate::model::query_assets_request::Time>,
4960
4961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4962}
4963
4964impl QueryAssetsRequest {
4965 pub fn new() -> Self {
4966 std::default::Default::default()
4967 }
4968
4969 /// Sets the value of [parent][crate::model::QueryAssetsRequest::parent].
4970 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4971 self.parent = v.into();
4972 self
4973 }
4974
4975 /// Sets the value of [page_size][crate::model::QueryAssetsRequest::page_size].
4976 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4977 self.page_size = v.into();
4978 self
4979 }
4980
4981 /// Sets the value of [page_token][crate::model::QueryAssetsRequest::page_token].
4982 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4983 self.page_token = v.into();
4984 self
4985 }
4986
4987 /// Sets the value of [timeout][crate::model::QueryAssetsRequest::timeout].
4988 pub fn set_timeout<T>(mut self, v: T) -> Self
4989 where
4990 T: std::convert::Into<wkt::Duration>,
4991 {
4992 self.timeout = std::option::Option::Some(v.into());
4993 self
4994 }
4995
4996 /// Sets or clears the value of [timeout][crate::model::QueryAssetsRequest::timeout].
4997 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4998 where
4999 T: std::convert::Into<wkt::Duration>,
5000 {
5001 self.timeout = v.map(|x| x.into());
5002 self
5003 }
5004
5005 /// Sets the value of [output_config][crate::model::QueryAssetsRequest::output_config].
5006 pub fn set_output_config<T>(mut self, v: T) -> Self
5007 where
5008 T: std::convert::Into<crate::model::QueryAssetsOutputConfig>,
5009 {
5010 self.output_config = std::option::Option::Some(v.into());
5011 self
5012 }
5013
5014 /// Sets or clears the value of [output_config][crate::model::QueryAssetsRequest::output_config].
5015 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
5016 where
5017 T: std::convert::Into<crate::model::QueryAssetsOutputConfig>,
5018 {
5019 self.output_config = v.map(|x| x.into());
5020 self
5021 }
5022
5023 /// Sets the value of [query][crate::model::QueryAssetsRequest::query].
5024 ///
5025 /// Note that all the setters affecting `query` are mutually
5026 /// exclusive.
5027 pub fn set_query<
5028 T: std::convert::Into<std::option::Option<crate::model::query_assets_request::Query>>,
5029 >(
5030 mut self,
5031 v: T,
5032 ) -> Self {
5033 self.query = v.into();
5034 self
5035 }
5036
5037 /// The value of [query][crate::model::QueryAssetsRequest::query]
5038 /// if it holds a `Statement`, `None` if the field is not set or
5039 /// holds a different branch.
5040 pub fn statement(&self) -> std::option::Option<&std::string::String> {
5041 #[allow(unreachable_patterns)]
5042 self.query.as_ref().and_then(|v| match v {
5043 crate::model::query_assets_request::Query::Statement(v) => std::option::Option::Some(v),
5044 _ => std::option::Option::None,
5045 })
5046 }
5047
5048 /// Sets the value of [query][crate::model::QueryAssetsRequest::query]
5049 /// to hold a `Statement`.
5050 ///
5051 /// Note that all the setters affecting `query` are
5052 /// mutually exclusive.
5053 pub fn set_statement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5054 self.query = std::option::Option::Some(
5055 crate::model::query_assets_request::Query::Statement(v.into()),
5056 );
5057 self
5058 }
5059
5060 /// The value of [query][crate::model::QueryAssetsRequest::query]
5061 /// if it holds a `JobReference`, `None` if the field is not set or
5062 /// holds a different branch.
5063 pub fn job_reference(&self) -> std::option::Option<&std::string::String> {
5064 #[allow(unreachable_patterns)]
5065 self.query.as_ref().and_then(|v| match v {
5066 crate::model::query_assets_request::Query::JobReference(v) => {
5067 std::option::Option::Some(v)
5068 }
5069 _ => std::option::Option::None,
5070 })
5071 }
5072
5073 /// Sets the value of [query][crate::model::QueryAssetsRequest::query]
5074 /// to hold a `JobReference`.
5075 ///
5076 /// Note that all the setters affecting `query` are
5077 /// mutually exclusive.
5078 pub fn set_job_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5079 self.query = std::option::Option::Some(
5080 crate::model::query_assets_request::Query::JobReference(v.into()),
5081 );
5082 self
5083 }
5084
5085 /// Sets the value of [time][crate::model::QueryAssetsRequest::time].
5086 ///
5087 /// Note that all the setters affecting `time` are mutually
5088 /// exclusive.
5089 pub fn set_time<
5090 T: std::convert::Into<std::option::Option<crate::model::query_assets_request::Time>>,
5091 >(
5092 mut self,
5093 v: T,
5094 ) -> Self {
5095 self.time = v.into();
5096 self
5097 }
5098
5099 /// The value of [time][crate::model::QueryAssetsRequest::time]
5100 /// if it holds a `ReadTimeWindow`, `None` if the field is not set or
5101 /// holds a different branch.
5102 pub fn read_time_window(
5103 &self,
5104 ) -> std::option::Option<&std::boxed::Box<crate::model::TimeWindow>> {
5105 #[allow(unreachable_patterns)]
5106 self.time.as_ref().and_then(|v| match v {
5107 crate::model::query_assets_request::Time::ReadTimeWindow(v) => {
5108 std::option::Option::Some(v)
5109 }
5110 _ => std::option::Option::None,
5111 })
5112 }
5113
5114 /// Sets the value of [time][crate::model::QueryAssetsRequest::time]
5115 /// to hold a `ReadTimeWindow`.
5116 ///
5117 /// Note that all the setters affecting `time` are
5118 /// mutually exclusive.
5119 pub fn set_read_time_window<
5120 T: std::convert::Into<std::boxed::Box<crate::model::TimeWindow>>,
5121 >(
5122 mut self,
5123 v: T,
5124 ) -> Self {
5125 self.time = std::option::Option::Some(
5126 crate::model::query_assets_request::Time::ReadTimeWindow(v.into()),
5127 );
5128 self
5129 }
5130
5131 /// The value of [time][crate::model::QueryAssetsRequest::time]
5132 /// if it holds a `ReadTime`, `None` if the field is not set or
5133 /// holds a different branch.
5134 pub fn read_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
5135 #[allow(unreachable_patterns)]
5136 self.time.as_ref().and_then(|v| match v {
5137 crate::model::query_assets_request::Time::ReadTime(v) => std::option::Option::Some(v),
5138 _ => std::option::Option::None,
5139 })
5140 }
5141
5142 /// Sets the value of [time][crate::model::QueryAssetsRequest::time]
5143 /// to hold a `ReadTime`.
5144 ///
5145 /// Note that all the setters affecting `time` are
5146 /// mutually exclusive.
5147 pub fn set_read_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
5148 mut self,
5149 v: T,
5150 ) -> Self {
5151 self.time =
5152 std::option::Option::Some(crate::model::query_assets_request::Time::ReadTime(v.into()));
5153 self
5154 }
5155}
5156
5157impl wkt::message::Message for QueryAssetsRequest {
5158 fn typename() -> &'static str {
5159 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsRequest"
5160 }
5161}
5162
5163/// Defines additional types related to [QueryAssetsRequest].
5164pub mod query_assets_request {
5165 #[allow(unused_imports)]
5166 use super::*;
5167
5168 #[derive(Clone, Debug, PartialEq)]
5169 #[non_exhaustive]
5170 pub enum Query {
5171 /// Optional. A SQL statement that's compatible with [BigQuery
5172 /// SQL](https://cloud.google.com/bigquery/docs/introduction-sql).
5173 Statement(std::string::String),
5174 /// Optional. Reference to the query job, which is from the
5175 /// `QueryAssetsResponse` of previous `QueryAssets` call.
5176 JobReference(std::string::String),
5177 }
5178
5179 /// Specifies what time period or point in time to query asset metadata at.
5180 ///
5181 /// * unset - query asset metadata as it is right now
5182 /// * [read_time_window] - query asset metadata as it was at any point in time
5183 /// between [start_time] and [end_time].
5184 /// * [read_time] - query asset metadata as it was at that point in time.
5185 /// If data for the timestamp/date range selected does not exist,
5186 /// it will simply return a valid response with no rows.
5187 #[derive(Clone, Debug, PartialEq)]
5188 #[non_exhaustive]
5189 pub enum Time {
5190 /// Optional. [start_time] is required. [start_time] must be less than
5191 /// [end_time] Defaults [end_time] to now if [start_time] is set and
5192 /// [end_time] isn't. Maximum permitted time range is 7 days.
5193 ReadTimeWindow(std::boxed::Box<crate::model::TimeWindow>),
5194 /// Optional. Queries cloud assets as they appeared at the specified point in
5195 /// time.
5196 ReadTime(std::boxed::Box<wkt::Timestamp>),
5197 }
5198}
5199
5200/// QueryAssets response.
5201#[derive(Clone, Default, PartialEq)]
5202#[non_exhaustive]
5203pub struct QueryAssetsResponse {
5204 /// Reference to a query job.
5205 pub job_reference: std::string::String,
5206
5207 /// The query response, which can be either an `error` or a valid `response`.
5208 ///
5209 /// If `done` == `false` and the query result is being saved in an output, the
5210 /// output_config field will be set.
5211 /// If `done` == `true`, exactly one of
5212 /// `error`, `query_result` or `output_config` will be set.
5213 /// [done] is unset unless the [QueryAssetsResponse] contains a
5214 /// [QueryAssetsResponse.job_reference].
5215 pub done: bool,
5216
5217 pub response: std::option::Option<crate::model::query_assets_response::Response>,
5218
5219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5220}
5221
5222impl QueryAssetsResponse {
5223 pub fn new() -> Self {
5224 std::default::Default::default()
5225 }
5226
5227 /// Sets the value of [job_reference][crate::model::QueryAssetsResponse::job_reference].
5228 pub fn set_job_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5229 self.job_reference = v.into();
5230 self
5231 }
5232
5233 /// Sets the value of [done][crate::model::QueryAssetsResponse::done].
5234 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5235 self.done = v.into();
5236 self
5237 }
5238
5239 /// Sets the value of [response][crate::model::QueryAssetsResponse::response].
5240 ///
5241 /// Note that all the setters affecting `response` are mutually
5242 /// exclusive.
5243 pub fn set_response<
5244 T: std::convert::Into<std::option::Option<crate::model::query_assets_response::Response>>,
5245 >(
5246 mut self,
5247 v: T,
5248 ) -> Self {
5249 self.response = v.into();
5250 self
5251 }
5252
5253 /// The value of [response][crate::model::QueryAssetsResponse::response]
5254 /// if it holds a `Error`, `None` if the field is not set or
5255 /// holds a different branch.
5256 pub fn error(&self) -> std::option::Option<&std::boxed::Box<rpc::model::Status>> {
5257 #[allow(unreachable_patterns)]
5258 self.response.as_ref().and_then(|v| match v {
5259 crate::model::query_assets_response::Response::Error(v) => std::option::Option::Some(v),
5260 _ => std::option::Option::None,
5261 })
5262 }
5263
5264 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
5265 /// to hold a `Error`.
5266 ///
5267 /// Note that all the setters affecting `response` are
5268 /// mutually exclusive.
5269 pub fn set_error<T: std::convert::Into<std::boxed::Box<rpc::model::Status>>>(
5270 mut self,
5271 v: T,
5272 ) -> Self {
5273 self.response = std::option::Option::Some(
5274 crate::model::query_assets_response::Response::Error(v.into()),
5275 );
5276 self
5277 }
5278
5279 /// The value of [response][crate::model::QueryAssetsResponse::response]
5280 /// if it holds a `QueryResult`, `None` if the field is not set or
5281 /// holds a different branch.
5282 pub fn query_result(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryResult>> {
5283 #[allow(unreachable_patterns)]
5284 self.response.as_ref().and_then(|v| match v {
5285 crate::model::query_assets_response::Response::QueryResult(v) => {
5286 std::option::Option::Some(v)
5287 }
5288 _ => std::option::Option::None,
5289 })
5290 }
5291
5292 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
5293 /// to hold a `QueryResult`.
5294 ///
5295 /// Note that all the setters affecting `response` are
5296 /// mutually exclusive.
5297 pub fn set_query_result<T: std::convert::Into<std::boxed::Box<crate::model::QueryResult>>>(
5298 mut self,
5299 v: T,
5300 ) -> Self {
5301 self.response = std::option::Option::Some(
5302 crate::model::query_assets_response::Response::QueryResult(v.into()),
5303 );
5304 self
5305 }
5306
5307 /// The value of [response][crate::model::QueryAssetsResponse::response]
5308 /// if it holds a `OutputConfig`, `None` if the field is not set or
5309 /// holds a different branch.
5310 pub fn output_config(
5311 &self,
5312 ) -> std::option::Option<&std::boxed::Box<crate::model::QueryAssetsOutputConfig>> {
5313 #[allow(unreachable_patterns)]
5314 self.response.as_ref().and_then(|v| match v {
5315 crate::model::query_assets_response::Response::OutputConfig(v) => {
5316 std::option::Option::Some(v)
5317 }
5318 _ => std::option::Option::None,
5319 })
5320 }
5321
5322 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
5323 /// to hold a `OutputConfig`.
5324 ///
5325 /// Note that all the setters affecting `response` are
5326 /// mutually exclusive.
5327 pub fn set_output_config<
5328 T: std::convert::Into<std::boxed::Box<crate::model::QueryAssetsOutputConfig>>,
5329 >(
5330 mut self,
5331 v: T,
5332 ) -> Self {
5333 self.response = std::option::Option::Some(
5334 crate::model::query_assets_response::Response::OutputConfig(v.into()),
5335 );
5336 self
5337 }
5338}
5339
5340impl wkt::message::Message for QueryAssetsResponse {
5341 fn typename() -> &'static str {
5342 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsResponse"
5343 }
5344}
5345
5346/// Defines additional types related to [QueryAssetsResponse].
5347pub mod query_assets_response {
5348 #[allow(unused_imports)]
5349 use super::*;
5350
5351 #[derive(Clone, Debug, PartialEq)]
5352 #[non_exhaustive]
5353 pub enum Response {
5354 /// Error status.
5355 Error(std::boxed::Box<rpc::model::Status>),
5356 /// Result of the query.
5357 QueryResult(std::boxed::Box<crate::model::QueryResult>),
5358 /// Output configuration, which indicates that instead of being returned in
5359 /// an API response on the fly, the query result will be saved in a specific
5360 /// output.
5361 OutputConfig(std::boxed::Box<crate::model::QueryAssetsOutputConfig>),
5362 }
5363}
5364
5365/// Execution results of the query.
5366///
5367/// The result is formatted as rows represented by BigQuery compatible [schema].
5368/// When pagination is necessary, it will contains the page token to retrieve
5369/// the results of following pages.
5370#[derive(Clone, Default, PartialEq)]
5371#[non_exhaustive]
5372pub struct QueryResult {
5373 /// Each row hold a query result in the format of `Struct`.
5374 pub rows: std::vec::Vec<wkt::Struct>,
5375
5376 /// Describes the format of the [rows].
5377 pub schema: std::option::Option<crate::model::TableSchema>,
5378
5379 /// Token to retrieve the next page of the results.
5380 pub next_page_token: std::string::String,
5381
5382 /// Total rows of the whole query results.
5383 pub total_rows: i64,
5384
5385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5386}
5387
5388impl QueryResult {
5389 pub fn new() -> Self {
5390 std::default::Default::default()
5391 }
5392
5393 /// Sets the value of [rows][crate::model::QueryResult::rows].
5394 pub fn set_rows<T, V>(mut self, v: T) -> Self
5395 where
5396 T: std::iter::IntoIterator<Item = V>,
5397 V: std::convert::Into<wkt::Struct>,
5398 {
5399 use std::iter::Iterator;
5400 self.rows = v.into_iter().map(|i| i.into()).collect();
5401 self
5402 }
5403
5404 /// Sets the value of [schema][crate::model::QueryResult::schema].
5405 pub fn set_schema<T>(mut self, v: T) -> Self
5406 where
5407 T: std::convert::Into<crate::model::TableSchema>,
5408 {
5409 self.schema = std::option::Option::Some(v.into());
5410 self
5411 }
5412
5413 /// Sets or clears the value of [schema][crate::model::QueryResult::schema].
5414 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
5415 where
5416 T: std::convert::Into<crate::model::TableSchema>,
5417 {
5418 self.schema = v.map(|x| x.into());
5419 self
5420 }
5421
5422 /// Sets the value of [next_page_token][crate::model::QueryResult::next_page_token].
5423 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5424 self.next_page_token = v.into();
5425 self
5426 }
5427
5428 /// Sets the value of [total_rows][crate::model::QueryResult::total_rows].
5429 pub fn set_total_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5430 self.total_rows = v.into();
5431 self
5432 }
5433}
5434
5435impl wkt::message::Message for QueryResult {
5436 fn typename() -> &'static str {
5437 "type.googleapis.com/google.cloud.asset.v1.QueryResult"
5438 }
5439}
5440
5441/// BigQuery Compatible table schema.
5442#[derive(Clone, Default, PartialEq)]
5443#[non_exhaustive]
5444pub struct TableSchema {
5445 /// Describes the fields in a table.
5446 pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
5447
5448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5449}
5450
5451impl TableSchema {
5452 pub fn new() -> Self {
5453 std::default::Default::default()
5454 }
5455
5456 /// Sets the value of [fields][crate::model::TableSchema::fields].
5457 pub fn set_fields<T, V>(mut self, v: T) -> Self
5458 where
5459 T: std::iter::IntoIterator<Item = V>,
5460 V: std::convert::Into<crate::model::TableFieldSchema>,
5461 {
5462 use std::iter::Iterator;
5463 self.fields = v.into_iter().map(|i| i.into()).collect();
5464 self
5465 }
5466}
5467
5468impl wkt::message::Message for TableSchema {
5469 fn typename() -> &'static str {
5470 "type.googleapis.com/google.cloud.asset.v1.TableSchema"
5471 }
5472}
5473
5474/// A field in TableSchema.
5475#[derive(Clone, Default, PartialEq)]
5476#[non_exhaustive]
5477pub struct TableFieldSchema {
5478 /// The field name. The name must contain only letters (a-z, A-Z),
5479 /// numbers (0-9), or underscores (_), and must start with a letter or
5480 /// underscore. The maximum length is 128 characters.
5481 pub field: std::string::String,
5482
5483 /// The field data type. Possible values include
5484 ///
5485 /// * STRING
5486 /// * BYTES
5487 /// * INTEGER
5488 /// * FLOAT
5489 /// * BOOLEAN
5490 /// * TIMESTAMP
5491 /// * DATE
5492 /// * TIME
5493 /// * DATETIME
5494 /// * GEOGRAPHY,
5495 /// * NUMERIC,
5496 /// * BIGNUMERIC,
5497 /// * RECORD
5498 /// (where RECORD indicates that the field contains a nested schema).
5499 pub r#type: std::string::String,
5500
5501 /// The field mode. Possible values include NULLABLE, REQUIRED and
5502 /// REPEATED. The default value is NULLABLE.
5503 pub mode: std::string::String,
5504
5505 /// Describes the nested schema fields if the type property is set
5506 /// to RECORD.
5507 pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
5508
5509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5510}
5511
5512impl TableFieldSchema {
5513 pub fn new() -> Self {
5514 std::default::Default::default()
5515 }
5516
5517 /// Sets the value of [field][crate::model::TableFieldSchema::field].
5518 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5519 self.field = v.into();
5520 self
5521 }
5522
5523 /// Sets the value of [r#type][crate::model::TableFieldSchema::type].
5524 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5525 self.r#type = v.into();
5526 self
5527 }
5528
5529 /// Sets the value of [mode][crate::model::TableFieldSchema::mode].
5530 pub fn set_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5531 self.mode = v.into();
5532 self
5533 }
5534
5535 /// Sets the value of [fields][crate::model::TableFieldSchema::fields].
5536 pub fn set_fields<T, V>(mut self, v: T) -> Self
5537 where
5538 T: std::iter::IntoIterator<Item = V>,
5539 V: std::convert::Into<crate::model::TableFieldSchema>,
5540 {
5541 use std::iter::Iterator;
5542 self.fields = v.into_iter().map(|i| i.into()).collect();
5543 self
5544 }
5545}
5546
5547impl wkt::message::Message for TableFieldSchema {
5548 fn typename() -> &'static str {
5549 "type.googleapis.com/google.cloud.asset.v1.TableFieldSchema"
5550 }
5551}
5552
5553/// A request message for
5554/// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies].
5555///
5556/// [google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]: crate::client::AssetService::batch_get_effective_iam_policies
5557#[derive(Clone, Default, PartialEq)]
5558#[non_exhaustive]
5559pub struct BatchGetEffectiveIamPoliciesRequest {
5560 /// Required. Only IAM policies on or below the scope will be returned.
5561 ///
5562 /// This can only be an organization number (such as "organizations/123"), a
5563 /// folder number (such as "folders/123"), a project ID (such as
5564 /// "projects/my-project-id"), or a project number (such as "projects/12345").
5565 ///
5566 /// To know how to get organization ID, visit [here
5567 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
5568 ///
5569 /// To know how to get folder or project ID, visit [here
5570 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
5571 pub scope: std::string::String,
5572
5573 /// Required. The names refer to the [full_resource_names]
5574 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
5575 /// of the asset types [supported by search
5576 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
5577 /// A maximum of 20 resources' effective policies can be retrieved in a batch.
5578 pub names: std::vec::Vec<std::string::String>,
5579
5580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5581}
5582
5583impl BatchGetEffectiveIamPoliciesRequest {
5584 pub fn new() -> Self {
5585 std::default::Default::default()
5586 }
5587
5588 /// Sets the value of [scope][crate::model::BatchGetEffectiveIamPoliciesRequest::scope].
5589 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5590 self.scope = v.into();
5591 self
5592 }
5593
5594 /// Sets the value of [names][crate::model::BatchGetEffectiveIamPoliciesRequest::names].
5595 pub fn set_names<T, V>(mut self, v: T) -> Self
5596 where
5597 T: std::iter::IntoIterator<Item = V>,
5598 V: std::convert::Into<std::string::String>,
5599 {
5600 use std::iter::Iterator;
5601 self.names = v.into_iter().map(|i| i.into()).collect();
5602 self
5603 }
5604}
5605
5606impl wkt::message::Message for BatchGetEffectiveIamPoliciesRequest {
5607 fn typename() -> &'static str {
5608 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest"
5609 }
5610}
5611
5612/// A response message for
5613/// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies].
5614///
5615/// [google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]: crate::client::AssetService::batch_get_effective_iam_policies
5616#[derive(Clone, Default, PartialEq)]
5617#[non_exhaustive]
5618pub struct BatchGetEffectiveIamPoliciesResponse {
5619 /// The effective policies for a batch of resources. Note that the results
5620 /// order is the same as the order of
5621 /// [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names].
5622 /// When a resource does not have any effective IAM policies, its corresponding
5623 /// policy_result will contain empty
5624 /// [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies].
5625 ///
5626 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]: crate::model::BatchGetEffectiveIamPoliciesRequest::names
5627 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies
5628 pub policy_results:
5629 std::vec::Vec<crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy>,
5630
5631 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5632}
5633
5634impl BatchGetEffectiveIamPoliciesResponse {
5635 pub fn new() -> Self {
5636 std::default::Default::default()
5637 }
5638
5639 /// Sets the value of [policy_results][crate::model::BatchGetEffectiveIamPoliciesResponse::policy_results].
5640 pub fn set_policy_results<T, V>(mut self, v: T) -> Self
5641 where
5642 T: std::iter::IntoIterator<Item = V>,
5643 V: std::convert::Into<
5644 crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy,
5645 >,
5646 {
5647 use std::iter::Iterator;
5648 self.policy_results = v.into_iter().map(|i| i.into()).collect();
5649 self
5650 }
5651}
5652
5653impl wkt::message::Message for BatchGetEffectiveIamPoliciesResponse {
5654 fn typename() -> &'static str {
5655 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse"
5656 }
5657}
5658
5659/// Defines additional types related to [BatchGetEffectiveIamPoliciesResponse].
5660pub mod batch_get_effective_iam_policies_response {
5661 #[allow(unused_imports)]
5662 use super::*;
5663
5664 /// The effective IAM policies on one resource.
5665 #[derive(Clone, Default, PartialEq)]
5666 #[non_exhaustive]
5667 pub struct EffectiveIamPolicy {
5668
5669 /// The [full_resource_name]
5670 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
5671 /// for which the
5672 /// [policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]
5673 /// are computed. This is one of the
5674 /// [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]
5675 /// the caller provides in the request.
5676 ///
5677 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]: crate::model::BatchGetEffectiveIamPoliciesRequest::names
5678 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies
5679 pub full_resource_name: std::string::String,
5680
5681 /// The effective policies for the
5682 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name].
5683 ///
5684 /// These policies include the policy set on the
5685 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]
5686 /// and those set on its parents and ancestors up to the
5687 /// [BatchGetEffectiveIamPoliciesRequest.scope][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope].
5688 /// Note that these policies are not filtered according to the resource type
5689 /// of the
5690 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name].
5691 ///
5692 /// These policies are hierarchically ordered by
5693 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]
5694 /// starting from
5695 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]
5696 /// itself to its parents and ancestors, such that policies[i]'s
5697 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]
5698 /// is the child of policies[i+1]'s
5699 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource],
5700 /// if policies[i+1] exists.
5701 ///
5702 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope]: crate::model::BatchGetEffectiveIamPoliciesRequest::scope
5703 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource
5704 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::full_resource_name
5705 pub policies: std::vec::Vec<crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo>,
5706
5707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5708 }
5709
5710 impl EffectiveIamPolicy {
5711 pub fn new() -> Self {
5712 std::default::Default::default()
5713 }
5714
5715 /// Sets the value of [full_resource_name][crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::full_resource_name].
5716 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
5717 mut self,
5718 v: T,
5719 ) -> Self {
5720 self.full_resource_name = v.into();
5721 self
5722 }
5723
5724 /// Sets the value of [policies][crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies].
5725 pub fn set_policies<T, V>(mut self, v: T) -> Self
5726 where
5727 T: std::iter::IntoIterator<Item = V>,
5728 V: std::convert::Into<crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo>
5729 {
5730 use std::iter::Iterator;
5731 self.policies = v.into_iter().map(|i| i.into()).collect();
5732 self
5733 }
5734 }
5735
5736 impl wkt::message::Message for EffectiveIamPolicy {
5737 fn typename() -> &'static str {
5738 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy"
5739 }
5740 }
5741
5742 /// Defines additional types related to [EffectiveIamPolicy].
5743 pub mod effective_iam_policy {
5744 #[allow(unused_imports)]
5745 use super::*;
5746
5747 /// The IAM policy and its attached resource.
5748 #[derive(Clone, Default, PartialEq)]
5749 #[non_exhaustive]
5750 pub struct PolicyInfo {
5751 /// The full resource name the
5752 /// [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
5753 /// is directly attached to.
5754 ///
5755 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy
5756 pub attached_resource: std::string::String,
5757
5758 /// The IAM policy that's directly attached to the
5759 /// [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
5760 ///
5761 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource
5762 pub policy: std::option::Option<iam_v1::model::Policy>,
5763
5764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5765 }
5766
5767 impl PolicyInfo {
5768 pub fn new() -> Self {
5769 std::default::Default::default()
5770 }
5771
5772 /// Sets the value of [attached_resource][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource].
5773 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
5774 mut self,
5775 v: T,
5776 ) -> Self {
5777 self.attached_resource = v.into();
5778 self
5779 }
5780
5781 /// Sets the value of [policy][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy].
5782 pub fn set_policy<T>(mut self, v: T) -> Self
5783 where
5784 T: std::convert::Into<iam_v1::model::Policy>,
5785 {
5786 self.policy = std::option::Option::Some(v.into());
5787 self
5788 }
5789
5790 /// Sets or clears the value of [policy][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy].
5791 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5792 where
5793 T: std::convert::Into<iam_v1::model::Policy>,
5794 {
5795 self.policy = v.map(|x| x.into());
5796 self
5797 }
5798 }
5799
5800 impl wkt::message::Message for PolicyInfo {
5801 fn typename() -> &'static str {
5802 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo"
5803 }
5804 }
5805 }
5806}
5807
5808/// This organization policy message is a modified version of the one defined in
5809/// the Organization Policy system. This message contains several fields defined
5810/// in the original organization policy with some new fields for analysis
5811/// purpose.
5812#[derive(Clone, Default, PartialEq)]
5813#[non_exhaustive]
5814pub struct AnalyzerOrgPolicy {
5815 /// The [full resource name]
5816 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
5817 /// an organization/folder/project resource where this organization policy is
5818 /// set.
5819 ///
5820 /// Notice that some type of constraints are defined with default policy. This
5821 /// field will be empty for them.
5822 pub attached_resource: std::string::String,
5823
5824 /// The [full resource name]
5825 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
5826 /// an organization/folder/project resource where this organization policy
5827 /// applies to.
5828 ///
5829 /// For any user defined org policies, this field has the same value as
5830 /// the [attached_resource] field. Only for default policy, this field has
5831 /// the different value.
5832 pub applied_resource: std::string::String,
5833
5834 /// List of rules for this organization policy.
5835 pub rules: std::vec::Vec<crate::model::analyzer_org_policy::Rule>,
5836
5837 /// If `inherit_from_parent` is true, Rules set higher up in the
5838 /// hierarchy (up to the closest root) are inherited and present in the
5839 /// effective policy. If it is false, then no rules are inherited, and this
5840 /// policy becomes the effective root for evaluation.
5841 pub inherit_from_parent: bool,
5842
5843 /// Ignores policies set above this resource and restores the default behavior
5844 /// of the constraint at this resource.
5845 /// This field can be set in policies for either list or boolean
5846 /// constraints. If set, `rules` must be empty and `inherit_from_parent`
5847 /// must be set to false.
5848 pub reset: bool,
5849
5850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5851}
5852
5853impl AnalyzerOrgPolicy {
5854 pub fn new() -> Self {
5855 std::default::Default::default()
5856 }
5857
5858 /// Sets the value of [attached_resource][crate::model::AnalyzerOrgPolicy::attached_resource].
5859 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
5860 mut self,
5861 v: T,
5862 ) -> Self {
5863 self.attached_resource = v.into();
5864 self
5865 }
5866
5867 /// Sets the value of [applied_resource][crate::model::AnalyzerOrgPolicy::applied_resource].
5868 pub fn set_applied_resource<T: std::convert::Into<std::string::String>>(
5869 mut self,
5870 v: T,
5871 ) -> Self {
5872 self.applied_resource = v.into();
5873 self
5874 }
5875
5876 /// Sets the value of [rules][crate::model::AnalyzerOrgPolicy::rules].
5877 pub fn set_rules<T, V>(mut self, v: T) -> Self
5878 where
5879 T: std::iter::IntoIterator<Item = V>,
5880 V: std::convert::Into<crate::model::analyzer_org_policy::Rule>,
5881 {
5882 use std::iter::Iterator;
5883 self.rules = v.into_iter().map(|i| i.into()).collect();
5884 self
5885 }
5886
5887 /// Sets the value of [inherit_from_parent][crate::model::AnalyzerOrgPolicy::inherit_from_parent].
5888 pub fn set_inherit_from_parent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5889 self.inherit_from_parent = v.into();
5890 self
5891 }
5892
5893 /// Sets the value of [reset][crate::model::AnalyzerOrgPolicy::reset].
5894 pub fn set_reset<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5895 self.reset = v.into();
5896 self
5897 }
5898}
5899
5900impl wkt::message::Message for AnalyzerOrgPolicy {
5901 fn typename() -> &'static str {
5902 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy"
5903 }
5904}
5905
5906/// Defines additional types related to [AnalyzerOrgPolicy].
5907pub mod analyzer_org_policy {
5908 #[allow(unused_imports)]
5909 use super::*;
5910
5911 /// This rule message is a customized version of the one defined in the
5912 /// Organization Policy system. In addition to the fields defined in the
5913 /// original organization policy, it contains additional field(s) under
5914 /// specific circumstances to support analysis results.
5915 #[derive(Clone, Default, PartialEq)]
5916 #[non_exhaustive]
5917 pub struct Rule {
5918 /// The evaluating condition for this rule.
5919 pub condition: std::option::Option<gtype::model::Expr>,
5920
5921 /// The condition evaluation result for this rule.
5922 /// Only populated if it meets all the following criteria:
5923 ///
5924 /// * There is a
5925 /// [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
5926 /// defined for this rule.
5927 /// * This rule is within
5928 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
5929 /// or
5930 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
5931 /// when the
5932 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
5933 /// has
5934 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
5935 ///
5936 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset
5937 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy
5938 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset
5939 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy
5940 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]: crate::model::analyzer_org_policy::Rule::condition
5941 pub condition_evaluation: std::option::Option<crate::model::ConditionEvaluation>,
5942
5943 pub kind: std::option::Option<crate::model::analyzer_org_policy::rule::Kind>,
5944
5945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5946 }
5947
5948 impl Rule {
5949 pub fn new() -> Self {
5950 std::default::Default::default()
5951 }
5952
5953 /// Sets the value of [condition][crate::model::analyzer_org_policy::Rule::condition].
5954 pub fn set_condition<T>(mut self, v: T) -> Self
5955 where
5956 T: std::convert::Into<gtype::model::Expr>,
5957 {
5958 self.condition = std::option::Option::Some(v.into());
5959 self
5960 }
5961
5962 /// Sets or clears the value of [condition][crate::model::analyzer_org_policy::Rule::condition].
5963 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
5964 where
5965 T: std::convert::Into<gtype::model::Expr>,
5966 {
5967 self.condition = v.map(|x| x.into());
5968 self
5969 }
5970
5971 /// Sets the value of [condition_evaluation][crate::model::analyzer_org_policy::Rule::condition_evaluation].
5972 pub fn set_condition_evaluation<T>(mut self, v: T) -> Self
5973 where
5974 T: std::convert::Into<crate::model::ConditionEvaluation>,
5975 {
5976 self.condition_evaluation = std::option::Option::Some(v.into());
5977 self
5978 }
5979
5980 /// Sets or clears the value of [condition_evaluation][crate::model::analyzer_org_policy::Rule::condition_evaluation].
5981 pub fn set_or_clear_condition_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
5982 where
5983 T: std::convert::Into<crate::model::ConditionEvaluation>,
5984 {
5985 self.condition_evaluation = v.map(|x| x.into());
5986 self
5987 }
5988
5989 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind].
5990 ///
5991 /// Note that all the setters affecting `kind` are mutually
5992 /// exclusive.
5993 pub fn set_kind<
5994 T: std::convert::Into<std::option::Option<crate::model::analyzer_org_policy::rule::Kind>>,
5995 >(
5996 mut self,
5997 v: T,
5998 ) -> Self {
5999 self.kind = v.into();
6000 self
6001 }
6002
6003 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6004 /// if it holds a `Values`, `None` if the field is not set or
6005 /// holds a different branch.
6006 pub fn values(
6007 &self,
6008 ) -> std::option::Option<
6009 &std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>,
6010 > {
6011 #[allow(unreachable_patterns)]
6012 self.kind.as_ref().and_then(|v| match v {
6013 crate::model::analyzer_org_policy::rule::Kind::Values(v) => {
6014 std::option::Option::Some(v)
6015 }
6016 _ => std::option::Option::None,
6017 })
6018 }
6019
6020 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6021 /// to hold a `Values`.
6022 ///
6023 /// Note that all the setters affecting `kind` are
6024 /// mutually exclusive.
6025 pub fn set_values<
6026 T: std::convert::Into<
6027 std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>,
6028 >,
6029 >(
6030 mut self,
6031 v: T,
6032 ) -> Self {
6033 self.kind = std::option::Option::Some(
6034 crate::model::analyzer_org_policy::rule::Kind::Values(v.into()),
6035 );
6036 self
6037 }
6038
6039 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6040 /// if it holds a `AllowAll`, `None` if the field is not set or
6041 /// holds a different branch.
6042 pub fn allow_all(&self) -> std::option::Option<&bool> {
6043 #[allow(unreachable_patterns)]
6044 self.kind.as_ref().and_then(|v| match v {
6045 crate::model::analyzer_org_policy::rule::Kind::AllowAll(v) => {
6046 std::option::Option::Some(v)
6047 }
6048 _ => std::option::Option::None,
6049 })
6050 }
6051
6052 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6053 /// to hold a `AllowAll`.
6054 ///
6055 /// Note that all the setters affecting `kind` are
6056 /// mutually exclusive.
6057 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6058 self.kind = std::option::Option::Some(
6059 crate::model::analyzer_org_policy::rule::Kind::AllowAll(v.into()),
6060 );
6061 self
6062 }
6063
6064 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6065 /// if it holds a `DenyAll`, `None` if the field is not set or
6066 /// holds a different branch.
6067 pub fn deny_all(&self) -> std::option::Option<&bool> {
6068 #[allow(unreachable_patterns)]
6069 self.kind.as_ref().and_then(|v| match v {
6070 crate::model::analyzer_org_policy::rule::Kind::DenyAll(v) => {
6071 std::option::Option::Some(v)
6072 }
6073 _ => std::option::Option::None,
6074 })
6075 }
6076
6077 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6078 /// to hold a `DenyAll`.
6079 ///
6080 /// Note that all the setters affecting `kind` are
6081 /// mutually exclusive.
6082 pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6083 self.kind = std::option::Option::Some(
6084 crate::model::analyzer_org_policy::rule::Kind::DenyAll(v.into()),
6085 );
6086 self
6087 }
6088
6089 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6090 /// if it holds a `Enforce`, `None` if the field is not set or
6091 /// holds a different branch.
6092 pub fn enforce(&self) -> std::option::Option<&bool> {
6093 #[allow(unreachable_patterns)]
6094 self.kind.as_ref().and_then(|v| match v {
6095 crate::model::analyzer_org_policy::rule::Kind::Enforce(v) => {
6096 std::option::Option::Some(v)
6097 }
6098 _ => std::option::Option::None,
6099 })
6100 }
6101
6102 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
6103 /// to hold a `Enforce`.
6104 ///
6105 /// Note that all the setters affecting `kind` are
6106 /// mutually exclusive.
6107 pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6108 self.kind = std::option::Option::Some(
6109 crate::model::analyzer_org_policy::rule::Kind::Enforce(v.into()),
6110 );
6111 self
6112 }
6113 }
6114
6115 impl wkt::message::Message for Rule {
6116 fn typename() -> &'static str {
6117 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy.Rule"
6118 }
6119 }
6120
6121 /// Defines additional types related to [Rule].
6122 pub mod rule {
6123 #[allow(unused_imports)]
6124 use super::*;
6125
6126 /// The string values for the list constraints.
6127 #[derive(Clone, Default, PartialEq)]
6128 #[non_exhaustive]
6129 pub struct StringValues {
6130 /// List of values allowed at this resource.
6131 pub allowed_values: std::vec::Vec<std::string::String>,
6132
6133 /// List of values denied at this resource.
6134 pub denied_values: std::vec::Vec<std::string::String>,
6135
6136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6137 }
6138
6139 impl StringValues {
6140 pub fn new() -> Self {
6141 std::default::Default::default()
6142 }
6143
6144 /// Sets the value of [allowed_values][crate::model::analyzer_org_policy::rule::StringValues::allowed_values].
6145 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
6146 where
6147 T: std::iter::IntoIterator<Item = V>,
6148 V: std::convert::Into<std::string::String>,
6149 {
6150 use std::iter::Iterator;
6151 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
6152 self
6153 }
6154
6155 /// Sets the value of [denied_values][crate::model::analyzer_org_policy::rule::StringValues::denied_values].
6156 pub fn set_denied_values<T, V>(mut self, v: T) -> Self
6157 where
6158 T: std::iter::IntoIterator<Item = V>,
6159 V: std::convert::Into<std::string::String>,
6160 {
6161 use std::iter::Iterator;
6162 self.denied_values = v.into_iter().map(|i| i.into()).collect();
6163 self
6164 }
6165 }
6166
6167 impl wkt::message::Message for StringValues {
6168 fn typename() -> &'static str {
6169 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues"
6170 }
6171 }
6172
6173 #[derive(Clone, Debug, PartialEq)]
6174 #[non_exhaustive]
6175 pub enum Kind {
6176 /// List of values to be used for this policy rule. This field can be set
6177 /// only in policies for list constraints.
6178 Values(std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>),
6179 /// Setting this to true means that all values are allowed. This field can
6180 /// be set only in Policies for list constraints.
6181 AllowAll(bool),
6182 /// Setting this to true means that all values are denied. This field can
6183 /// be set only in Policies for list constraints.
6184 DenyAll(bool),
6185 /// If `true`, then the `Policy` is enforced. If `false`, then any
6186 /// configuration is acceptable.
6187 /// This field can be set only in Policies for boolean constraints.
6188 Enforce(bool),
6189 }
6190 }
6191}
6192
6193/// The organization policy constraint definition.
6194#[derive(Clone, Default, PartialEq)]
6195#[non_exhaustive]
6196pub struct AnalyzerOrgPolicyConstraint {
6197 pub constraint_definition:
6198 std::option::Option<crate::model::analyzer_org_policy_constraint::ConstraintDefinition>,
6199
6200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6201}
6202
6203impl AnalyzerOrgPolicyConstraint {
6204 pub fn new() -> Self {
6205 std::default::Default::default()
6206 }
6207
6208 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition].
6209 ///
6210 /// Note that all the setters affecting `constraint_definition` are mutually
6211 /// exclusive.
6212 pub fn set_constraint_definition<
6213 T: std::convert::Into<
6214 std::option::Option<
6215 crate::model::analyzer_org_policy_constraint::ConstraintDefinition,
6216 >,
6217 >,
6218 >(
6219 mut self,
6220 v: T,
6221 ) -> Self {
6222 self.constraint_definition = v.into();
6223 self
6224 }
6225
6226 /// The value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
6227 /// if it holds a `GoogleDefinedConstraint`, `None` if the field is not set or
6228 /// holds a different branch.
6229 pub fn google_defined_constraint(
6230 &self,
6231 ) -> std::option::Option<
6232 &std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
6233 > {
6234 #[allow(unreachable_patterns)]
6235 self.constraint_definition.as_ref().and_then(|v| match v {
6236 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::GoogleDefinedConstraint(v) => std::option::Option::Some(v),
6237 _ => std::option::Option::None,
6238 })
6239 }
6240
6241 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
6242 /// to hold a `GoogleDefinedConstraint`.
6243 ///
6244 /// Note that all the setters affecting `constraint_definition` are
6245 /// mutually exclusive.
6246 pub fn set_google_defined_constraint<
6247 T: std::convert::Into<
6248 std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
6249 >,
6250 >(
6251 mut self,
6252 v: T,
6253 ) -> Self {
6254 self.constraint_definition = std::option::Option::Some(
6255 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::GoogleDefinedConstraint(
6256 v.into()
6257 )
6258 );
6259 self
6260 }
6261
6262 /// The value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
6263 /// if it holds a `CustomConstraint`, `None` if the field is not set or
6264 /// holds a different branch.
6265 pub fn custom_constraint(
6266 &self,
6267 ) -> std::option::Option<
6268 &std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
6269 > {
6270 #[allow(unreachable_patterns)]
6271 self.constraint_definition.as_ref().and_then(|v| match v {
6272 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::CustomConstraint(v) => std::option::Option::Some(v),
6273 _ => std::option::Option::None,
6274 })
6275 }
6276
6277 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
6278 /// to hold a `CustomConstraint`.
6279 ///
6280 /// Note that all the setters affecting `constraint_definition` are
6281 /// mutually exclusive.
6282 pub fn set_custom_constraint<
6283 T: std::convert::Into<
6284 std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
6285 >,
6286 >(
6287 mut self,
6288 v: T,
6289 ) -> Self {
6290 self.constraint_definition = std::option::Option::Some(
6291 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::CustomConstraint(
6292 v.into(),
6293 ),
6294 );
6295 self
6296 }
6297}
6298
6299impl wkt::message::Message for AnalyzerOrgPolicyConstraint {
6300 fn typename() -> &'static str {
6301 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint"
6302 }
6303}
6304
6305/// Defines additional types related to [AnalyzerOrgPolicyConstraint].
6306pub mod analyzer_org_policy_constraint {
6307 #[allow(unused_imports)]
6308 use super::*;
6309
6310 /// The definition of a constraint.
6311 #[derive(Clone, Default, PartialEq)]
6312 #[non_exhaustive]
6313 pub struct Constraint {
6314 /// The unique name of the constraint. Format of the name should be
6315 ///
6316 /// * `constraints/{constraint_name}`
6317 ///
6318 /// For example, `constraints/compute.disableSerialPortAccess`.
6319 pub name: std::string::String,
6320
6321 /// The human readable name of the constraint.
6322 pub display_name: std::string::String,
6323
6324 /// Detailed description of what this `Constraint` controls as well as how
6325 /// and where it is enforced.
6326 pub description: std::string::String,
6327
6328 /// The evaluation behavior of this constraint in the absence of 'Policy'.
6329 pub constraint_default:
6330 crate::model::analyzer_org_policy_constraint::constraint::ConstraintDefault,
6331
6332 /// The type of restrictions for this `Constraint`.
6333 ///
6334 /// Immutable after creation.
6335 pub constraint_type: std::option::Option<
6336 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType,
6337 >,
6338
6339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6340 }
6341
6342 impl Constraint {
6343 pub fn new() -> Self {
6344 std::default::Default::default()
6345 }
6346
6347 /// Sets the value of [name][crate::model::analyzer_org_policy_constraint::Constraint::name].
6348 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6349 self.name = v.into();
6350 self
6351 }
6352
6353 /// Sets the value of [display_name][crate::model::analyzer_org_policy_constraint::Constraint::display_name].
6354 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
6355 mut self,
6356 v: T,
6357 ) -> Self {
6358 self.display_name = v.into();
6359 self
6360 }
6361
6362 /// Sets the value of [description][crate::model::analyzer_org_policy_constraint::Constraint::description].
6363 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6364 self.description = v.into();
6365 self
6366 }
6367
6368 /// Sets the value of [constraint_default][crate::model::analyzer_org_policy_constraint::Constraint::constraint_default].
6369 pub fn set_constraint_default<
6370 T: std::convert::Into<
6371 crate::model::analyzer_org_policy_constraint::constraint::ConstraintDefault,
6372 >,
6373 >(
6374 mut self,
6375 v: T,
6376 ) -> Self {
6377 self.constraint_default = v.into();
6378 self
6379 }
6380
6381 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type].
6382 ///
6383 /// Note that all the setters affecting `constraint_type` are mutually
6384 /// exclusive.
6385 pub fn set_constraint_type<
6386 T: std::convert::Into<
6387 std::option::Option<
6388 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType,
6389 >,
6390 >,
6391 >(
6392 mut self,
6393 v: T,
6394 ) -> Self {
6395 self.constraint_type = v.into();
6396 self
6397 }
6398
6399 /// The value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
6400 /// if it holds a `ListConstraint`, `None` if the field is not set or
6401 /// holds a different branch.
6402 pub fn list_constraint(
6403 &self,
6404 ) -> std::option::Option<
6405 &std::boxed::Box<
6406 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
6407 >,
6408 > {
6409 #[allow(unreachable_patterns)]
6410 self.constraint_type.as_ref().and_then(|v| match v {
6411 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::ListConstraint(v) => std::option::Option::Some(v),
6412 _ => std::option::Option::None,
6413 })
6414 }
6415
6416 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
6417 /// to hold a `ListConstraint`.
6418 ///
6419 /// Note that all the setters affecting `constraint_type` are
6420 /// mutually exclusive.
6421 pub fn set_list_constraint<
6422 T: std::convert::Into<
6423 std::boxed::Box<
6424 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
6425 >,
6426 >,
6427 >(
6428 mut self,
6429 v: T,
6430 ) -> Self {
6431 self.constraint_type = std::option::Option::Some(
6432 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::ListConstraint(
6433 v.into()
6434 )
6435 );
6436 self
6437 }
6438
6439 /// The value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
6440 /// if it holds a `BooleanConstraint`, `None` if the field is not set or
6441 /// holds a different branch.
6442 pub fn boolean_constraint(
6443 &self,
6444 ) -> std::option::Option<
6445 &std::boxed::Box<
6446 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
6447 >,
6448 > {
6449 #[allow(unreachable_patterns)]
6450 self.constraint_type.as_ref().and_then(|v| match v {
6451 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::BooleanConstraint(v) => std::option::Option::Some(v),
6452 _ => std::option::Option::None,
6453 })
6454 }
6455
6456 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
6457 /// to hold a `BooleanConstraint`.
6458 ///
6459 /// Note that all the setters affecting `constraint_type` are
6460 /// mutually exclusive.
6461 pub fn set_boolean_constraint<
6462 T: std::convert::Into<
6463 std::boxed::Box<
6464 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
6465 >,
6466 >,
6467 >(
6468 mut self,
6469 v: T,
6470 ) -> Self {
6471 self.constraint_type = std::option::Option::Some(
6472 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::BooleanConstraint(
6473 v.into()
6474 )
6475 );
6476 self
6477 }
6478 }
6479
6480 impl wkt::message::Message for Constraint {
6481 fn typename() -> &'static str {
6482 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint"
6483 }
6484 }
6485
6486 /// Defines additional types related to [Constraint].
6487 pub mod constraint {
6488 #[allow(unused_imports)]
6489 use super::*;
6490
6491 /// A `Constraint` that allows or disallows a list of string values, which
6492 /// are configured by an organization's policy administrator with a `Policy`.
6493 #[derive(Clone, Default, PartialEq)]
6494 #[non_exhaustive]
6495 pub struct ListConstraint {
6496 /// Indicates whether values grouped into categories can be used in
6497 /// `Policy.allowed_values` and `Policy.denied_values`. For example,
6498 /// `"in:Python"` would match any value in the 'Python' group.
6499 pub supports_in: bool,
6500
6501 /// Indicates whether subtrees of Cloud Resource Manager resource hierarchy
6502 /// can be used in `Policy.allowed_values` and `Policy.denied_values`. For
6503 /// example, `"under:folders/123"` would match any resource under the
6504 /// 'folders/123' folder.
6505 pub supports_under: bool,
6506
6507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6508 }
6509
6510 impl ListConstraint {
6511 pub fn new() -> Self {
6512 std::default::Default::default()
6513 }
6514
6515 /// Sets the value of [supports_in][crate::model::analyzer_org_policy_constraint::constraint::ListConstraint::supports_in].
6516 pub fn set_supports_in<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6517 self.supports_in = v.into();
6518 self
6519 }
6520
6521 /// Sets the value of [supports_under][crate::model::analyzer_org_policy_constraint::constraint::ListConstraint::supports_under].
6522 pub fn set_supports_under<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6523 self.supports_under = v.into();
6524 self
6525 }
6526 }
6527
6528 impl wkt::message::Message for ListConstraint {
6529 fn typename() -> &'static str {
6530 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ListConstraint"
6531 }
6532 }
6533
6534 /// A `Constraint` that is either enforced or not.
6535 ///
6536 /// For example a constraint `constraints/compute.disableSerialPortAccess`.
6537 /// If it is enforced on a VM instance, serial port connections will not be
6538 /// opened to that instance.
6539 #[derive(Clone, Default, PartialEq)]
6540 #[non_exhaustive]
6541 pub struct BooleanConstraint {
6542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6543 }
6544
6545 impl BooleanConstraint {
6546 pub fn new() -> Self {
6547 std::default::Default::default()
6548 }
6549 }
6550
6551 impl wkt::message::Message for BooleanConstraint {
6552 fn typename() -> &'static str {
6553 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.BooleanConstraint"
6554 }
6555 }
6556
6557 /// Specifies the default behavior in the absence of any `Policy` for the
6558 /// `Constraint`. This must not be `CONSTRAINT_DEFAULT_UNSPECIFIED`.
6559 ///
6560 /// # Working with unknown values
6561 ///
6562 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6563 /// additional enum variants at any time. Adding new variants is not considered
6564 /// a breaking change. Applications should write their code in anticipation of:
6565 ///
6566 /// - New values appearing in future releases of the client library, **and**
6567 /// - New values received dynamically, without application changes.
6568 ///
6569 /// Please consult the [Working with enums] section in the user guide for some
6570 /// guidelines.
6571 ///
6572 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6573 #[derive(Clone, Debug, PartialEq)]
6574 #[non_exhaustive]
6575 pub enum ConstraintDefault {
6576 /// This is only used for distinguishing unset values and should never be
6577 /// used.
6578 Unspecified,
6579 /// Indicate that all values are allowed for list constraints.
6580 /// Indicate that enforcement is off for boolean constraints.
6581 Allow,
6582 /// Indicate that all values are denied for list constraints.
6583 /// Indicate that enforcement is on for boolean constraints.
6584 Deny,
6585 /// If set, the enum was initialized with an unknown value.
6586 ///
6587 /// Applications can examine the value using [ConstraintDefault::value] or
6588 /// [ConstraintDefault::name].
6589 UnknownValue(constraint_default::UnknownValue),
6590 }
6591
6592 #[doc(hidden)]
6593 pub mod constraint_default {
6594 #[allow(unused_imports)]
6595 use super::*;
6596 #[derive(Clone, Debug, PartialEq)]
6597 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6598 }
6599
6600 impl ConstraintDefault {
6601 /// Gets the enum value.
6602 ///
6603 /// Returns `None` if the enum contains an unknown value deserialized from
6604 /// the string representation of enums.
6605 pub fn value(&self) -> std::option::Option<i32> {
6606 match self {
6607 Self::Unspecified => std::option::Option::Some(0),
6608 Self::Allow => std::option::Option::Some(1),
6609 Self::Deny => std::option::Option::Some(2),
6610 Self::UnknownValue(u) => u.0.value(),
6611 }
6612 }
6613
6614 /// Gets the enum value as a string.
6615 ///
6616 /// Returns `None` if the enum contains an unknown value deserialized from
6617 /// the integer representation of enums.
6618 pub fn name(&self) -> std::option::Option<&str> {
6619 match self {
6620 Self::Unspecified => {
6621 std::option::Option::Some("CONSTRAINT_DEFAULT_UNSPECIFIED")
6622 }
6623 Self::Allow => std::option::Option::Some("ALLOW"),
6624 Self::Deny => std::option::Option::Some("DENY"),
6625 Self::UnknownValue(u) => u.0.name(),
6626 }
6627 }
6628 }
6629
6630 impl std::default::Default for ConstraintDefault {
6631 fn default() -> Self {
6632 use std::convert::From;
6633 Self::from(0)
6634 }
6635 }
6636
6637 impl std::fmt::Display for ConstraintDefault {
6638 fn fmt(
6639 &self,
6640 f: &mut std::fmt::Formatter<'_>,
6641 ) -> std::result::Result<(), std::fmt::Error> {
6642 wkt::internal::display_enum(f, self.name(), self.value())
6643 }
6644 }
6645
6646 impl std::convert::From<i32> for ConstraintDefault {
6647 fn from(value: i32) -> Self {
6648 match value {
6649 0 => Self::Unspecified,
6650 1 => Self::Allow,
6651 2 => Self::Deny,
6652 _ => Self::UnknownValue(constraint_default::UnknownValue(
6653 wkt::internal::UnknownEnumValue::Integer(value),
6654 )),
6655 }
6656 }
6657 }
6658
6659 impl std::convert::From<&str> for ConstraintDefault {
6660 fn from(value: &str) -> Self {
6661 use std::string::ToString;
6662 match value {
6663 "CONSTRAINT_DEFAULT_UNSPECIFIED" => Self::Unspecified,
6664 "ALLOW" => Self::Allow,
6665 "DENY" => Self::Deny,
6666 _ => Self::UnknownValue(constraint_default::UnknownValue(
6667 wkt::internal::UnknownEnumValue::String(value.to_string()),
6668 )),
6669 }
6670 }
6671 }
6672
6673 impl serde::ser::Serialize for ConstraintDefault {
6674 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6675 where
6676 S: serde::Serializer,
6677 {
6678 match self {
6679 Self::Unspecified => serializer.serialize_i32(0),
6680 Self::Allow => serializer.serialize_i32(1),
6681 Self::Deny => serializer.serialize_i32(2),
6682 Self::UnknownValue(u) => u.0.serialize(serializer),
6683 }
6684 }
6685 }
6686
6687 impl<'de> serde::de::Deserialize<'de> for ConstraintDefault {
6688 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6689 where
6690 D: serde::Deserializer<'de>,
6691 {
6692 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConstraintDefault>::new(
6693 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ConstraintDefault"))
6694 }
6695 }
6696
6697 /// The type of restrictions for this `Constraint`.
6698 ///
6699 /// Immutable after creation.
6700 #[derive(Clone, Debug, PartialEq)]
6701 #[non_exhaustive]
6702 pub enum ConstraintType {
6703 /// Defines this constraint as being a ListConstraint.
6704 ListConstraint(
6705 std::boxed::Box<
6706 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
6707 >,
6708 ),
6709 /// Defines this constraint as being a BooleanConstraint.
6710 BooleanConstraint(
6711 std::boxed::Box<
6712 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
6713 >,
6714 ),
6715 }
6716 }
6717
6718 /// The definition of a custom constraint.
6719 #[derive(Clone, Default, PartialEq)]
6720 #[non_exhaustive]
6721 pub struct CustomConstraint {
6722 /// Name of the constraint. This is unique within the organization. Format of
6723 /// the name should be
6724 ///
6725 /// * `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
6726 ///
6727 /// Example :
6728 /// "organizations/123/customConstraints/custom.createOnlyE2TypeVms"
6729 pub name: std::string::String,
6730
6731 /// The Resource Instance type on which this policy applies to. Format will
6732 /// be of the form : "\<canonical service name\>/\<type\>" Example:
6733 ///
6734 /// * `compute.googleapis.com/Instance`.
6735 pub resource_types: std::vec::Vec<std::string::String>,
6736
6737 /// All the operations being applied for this constraint.
6738 pub method_types: std::vec::Vec<
6739 crate::model::analyzer_org_policy_constraint::custom_constraint::MethodType,
6740 >,
6741
6742 /// Organization Policy condition/expression. For example:
6743 /// `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
6744 /// `resource.management.auto_upgrade == true`
6745 pub condition: std::string::String,
6746
6747 /// Allow or deny type.
6748 pub action_type:
6749 crate::model::analyzer_org_policy_constraint::custom_constraint::ActionType,
6750
6751 /// One line display name for the UI.
6752 pub display_name: std::string::String,
6753
6754 /// Detailed information about this custom policy constraint.
6755 pub description: std::string::String,
6756
6757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6758 }
6759
6760 impl CustomConstraint {
6761 pub fn new() -> Self {
6762 std::default::Default::default()
6763 }
6764
6765 /// Sets the value of [name][crate::model::analyzer_org_policy_constraint::CustomConstraint::name].
6766 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6767 self.name = v.into();
6768 self
6769 }
6770
6771 /// Sets the value of [resource_types][crate::model::analyzer_org_policy_constraint::CustomConstraint::resource_types].
6772 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
6773 where
6774 T: std::iter::IntoIterator<Item = V>,
6775 V: std::convert::Into<std::string::String>,
6776 {
6777 use std::iter::Iterator;
6778 self.resource_types = v.into_iter().map(|i| i.into()).collect();
6779 self
6780 }
6781
6782 /// Sets the value of [method_types][crate::model::analyzer_org_policy_constraint::CustomConstraint::method_types].
6783 pub fn set_method_types<T, V>(mut self, v: T) -> Self
6784 where
6785 T: std::iter::IntoIterator<Item = V>,
6786 V: std::convert::Into<
6787 crate::model::analyzer_org_policy_constraint::custom_constraint::MethodType,
6788 >,
6789 {
6790 use std::iter::Iterator;
6791 self.method_types = v.into_iter().map(|i| i.into()).collect();
6792 self
6793 }
6794
6795 /// Sets the value of [condition][crate::model::analyzer_org_policy_constraint::CustomConstraint::condition].
6796 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6797 self.condition = v.into();
6798 self
6799 }
6800
6801 /// Sets the value of [action_type][crate::model::analyzer_org_policy_constraint::CustomConstraint::action_type].
6802 pub fn set_action_type<
6803 T: std::convert::Into<
6804 crate::model::analyzer_org_policy_constraint::custom_constraint::ActionType,
6805 >,
6806 >(
6807 mut self,
6808 v: T,
6809 ) -> Self {
6810 self.action_type = v.into();
6811 self
6812 }
6813
6814 /// Sets the value of [display_name][crate::model::analyzer_org_policy_constraint::CustomConstraint::display_name].
6815 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
6816 mut self,
6817 v: T,
6818 ) -> Self {
6819 self.display_name = v.into();
6820 self
6821 }
6822
6823 /// Sets the value of [description][crate::model::analyzer_org_policy_constraint::CustomConstraint::description].
6824 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6825 self.description = v.into();
6826 self
6827 }
6828 }
6829
6830 impl wkt::message::Message for CustomConstraint {
6831 fn typename() -> &'static str {
6832 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint"
6833 }
6834 }
6835
6836 /// Defines additional types related to [CustomConstraint].
6837 pub mod custom_constraint {
6838 #[allow(unused_imports)]
6839 use super::*;
6840
6841 /// The operation in which this constraint will be applied. For example:
6842 /// If the constraint applies only when create VMs, the method_types will be
6843 /// "CREATE" only. If the constraint applied when create or delete VMs, the
6844 /// method_types will be "CREATE" and "DELETE".
6845 ///
6846 /// # Working with unknown values
6847 ///
6848 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6849 /// additional enum variants at any time. Adding new variants is not considered
6850 /// a breaking change. Applications should write their code in anticipation of:
6851 ///
6852 /// - New values appearing in future releases of the client library, **and**
6853 /// - New values received dynamically, without application changes.
6854 ///
6855 /// Please consult the [Working with enums] section in the user guide for some
6856 /// guidelines.
6857 ///
6858 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6859 #[derive(Clone, Debug, PartialEq)]
6860 #[non_exhaustive]
6861 pub enum MethodType {
6862 /// Unspecified. Will results in user error.
6863 Unspecified,
6864 /// Constraint applied when creating the resource.
6865 Create,
6866 /// Constraint applied when updating the resource.
6867 Update,
6868 /// Constraint applied when deleting the resource.
6869 Delete,
6870 /// Constraint applied when removing an IAM grant.
6871 RemoveGrant,
6872 /// Constraint applied when enforcing forced tagging.
6873 GovernTags,
6874 /// If set, the enum was initialized with an unknown value.
6875 ///
6876 /// Applications can examine the value using [MethodType::value] or
6877 /// [MethodType::name].
6878 UnknownValue(method_type::UnknownValue),
6879 }
6880
6881 #[doc(hidden)]
6882 pub mod method_type {
6883 #[allow(unused_imports)]
6884 use super::*;
6885 #[derive(Clone, Debug, PartialEq)]
6886 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6887 }
6888
6889 impl MethodType {
6890 /// Gets the enum value.
6891 ///
6892 /// Returns `None` if the enum contains an unknown value deserialized from
6893 /// the string representation of enums.
6894 pub fn value(&self) -> std::option::Option<i32> {
6895 match self {
6896 Self::Unspecified => std::option::Option::Some(0),
6897 Self::Create => std::option::Option::Some(1),
6898 Self::Update => std::option::Option::Some(2),
6899 Self::Delete => std::option::Option::Some(3),
6900 Self::RemoveGrant => std::option::Option::Some(4),
6901 Self::GovernTags => std::option::Option::Some(5),
6902 Self::UnknownValue(u) => u.0.value(),
6903 }
6904 }
6905
6906 /// Gets the enum value as a string.
6907 ///
6908 /// Returns `None` if the enum contains an unknown value deserialized from
6909 /// the integer representation of enums.
6910 pub fn name(&self) -> std::option::Option<&str> {
6911 match self {
6912 Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
6913 Self::Create => std::option::Option::Some("CREATE"),
6914 Self::Update => std::option::Option::Some("UPDATE"),
6915 Self::Delete => std::option::Option::Some("DELETE"),
6916 Self::RemoveGrant => std::option::Option::Some("REMOVE_GRANT"),
6917 Self::GovernTags => std::option::Option::Some("GOVERN_TAGS"),
6918 Self::UnknownValue(u) => u.0.name(),
6919 }
6920 }
6921 }
6922
6923 impl std::default::Default for MethodType {
6924 fn default() -> Self {
6925 use std::convert::From;
6926 Self::from(0)
6927 }
6928 }
6929
6930 impl std::fmt::Display for MethodType {
6931 fn fmt(
6932 &self,
6933 f: &mut std::fmt::Formatter<'_>,
6934 ) -> std::result::Result<(), std::fmt::Error> {
6935 wkt::internal::display_enum(f, self.name(), self.value())
6936 }
6937 }
6938
6939 impl std::convert::From<i32> for MethodType {
6940 fn from(value: i32) -> Self {
6941 match value {
6942 0 => Self::Unspecified,
6943 1 => Self::Create,
6944 2 => Self::Update,
6945 3 => Self::Delete,
6946 4 => Self::RemoveGrant,
6947 5 => Self::GovernTags,
6948 _ => Self::UnknownValue(method_type::UnknownValue(
6949 wkt::internal::UnknownEnumValue::Integer(value),
6950 )),
6951 }
6952 }
6953 }
6954
6955 impl std::convert::From<&str> for MethodType {
6956 fn from(value: &str) -> Self {
6957 use std::string::ToString;
6958 match value {
6959 "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
6960 "CREATE" => Self::Create,
6961 "UPDATE" => Self::Update,
6962 "DELETE" => Self::Delete,
6963 "REMOVE_GRANT" => Self::RemoveGrant,
6964 "GOVERN_TAGS" => Self::GovernTags,
6965 _ => Self::UnknownValue(method_type::UnknownValue(
6966 wkt::internal::UnknownEnumValue::String(value.to_string()),
6967 )),
6968 }
6969 }
6970 }
6971
6972 impl serde::ser::Serialize for MethodType {
6973 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6974 where
6975 S: serde::Serializer,
6976 {
6977 match self {
6978 Self::Unspecified => serializer.serialize_i32(0),
6979 Self::Create => serializer.serialize_i32(1),
6980 Self::Update => serializer.serialize_i32(2),
6981 Self::Delete => serializer.serialize_i32(3),
6982 Self::RemoveGrant => serializer.serialize_i32(4),
6983 Self::GovernTags => serializer.serialize_i32(5),
6984 Self::UnknownValue(u) => u.0.serialize(serializer),
6985 }
6986 }
6987 }
6988
6989 impl<'de> serde::de::Deserialize<'de> for MethodType {
6990 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6991 where
6992 D: serde::Deserializer<'de>,
6993 {
6994 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
6995 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.MethodType"))
6996 }
6997 }
6998
6999 /// Allow or deny type.
7000 ///
7001 /// # Working with unknown values
7002 ///
7003 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7004 /// additional enum variants at any time. Adding new variants is not considered
7005 /// a breaking change. Applications should write their code in anticipation of:
7006 ///
7007 /// - New values appearing in future releases of the client library, **and**
7008 /// - New values received dynamically, without application changes.
7009 ///
7010 /// Please consult the [Working with enums] section in the user guide for some
7011 /// guidelines.
7012 ///
7013 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7014 #[derive(Clone, Debug, PartialEq)]
7015 #[non_exhaustive]
7016 pub enum ActionType {
7017 /// Unspecified. Will results in user error.
7018 Unspecified,
7019 /// Allowed action type.
7020 Allow,
7021 /// Deny action type.
7022 Deny,
7023 /// If set, the enum was initialized with an unknown value.
7024 ///
7025 /// Applications can examine the value using [ActionType::value] or
7026 /// [ActionType::name].
7027 UnknownValue(action_type::UnknownValue),
7028 }
7029
7030 #[doc(hidden)]
7031 pub mod action_type {
7032 #[allow(unused_imports)]
7033 use super::*;
7034 #[derive(Clone, Debug, PartialEq)]
7035 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7036 }
7037
7038 impl ActionType {
7039 /// Gets the enum value.
7040 ///
7041 /// Returns `None` if the enum contains an unknown value deserialized from
7042 /// the string representation of enums.
7043 pub fn value(&self) -> std::option::Option<i32> {
7044 match self {
7045 Self::Unspecified => std::option::Option::Some(0),
7046 Self::Allow => std::option::Option::Some(1),
7047 Self::Deny => std::option::Option::Some(2),
7048 Self::UnknownValue(u) => u.0.value(),
7049 }
7050 }
7051
7052 /// Gets the enum value as a string.
7053 ///
7054 /// Returns `None` if the enum contains an unknown value deserialized from
7055 /// the integer representation of enums.
7056 pub fn name(&self) -> std::option::Option<&str> {
7057 match self {
7058 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
7059 Self::Allow => std::option::Option::Some("ALLOW"),
7060 Self::Deny => std::option::Option::Some("DENY"),
7061 Self::UnknownValue(u) => u.0.name(),
7062 }
7063 }
7064 }
7065
7066 impl std::default::Default for ActionType {
7067 fn default() -> Self {
7068 use std::convert::From;
7069 Self::from(0)
7070 }
7071 }
7072
7073 impl std::fmt::Display for ActionType {
7074 fn fmt(
7075 &self,
7076 f: &mut std::fmt::Formatter<'_>,
7077 ) -> std::result::Result<(), std::fmt::Error> {
7078 wkt::internal::display_enum(f, self.name(), self.value())
7079 }
7080 }
7081
7082 impl std::convert::From<i32> for ActionType {
7083 fn from(value: i32) -> Self {
7084 match value {
7085 0 => Self::Unspecified,
7086 1 => Self::Allow,
7087 2 => Self::Deny,
7088 _ => Self::UnknownValue(action_type::UnknownValue(
7089 wkt::internal::UnknownEnumValue::Integer(value),
7090 )),
7091 }
7092 }
7093 }
7094
7095 impl std::convert::From<&str> for ActionType {
7096 fn from(value: &str) -> Self {
7097 use std::string::ToString;
7098 match value {
7099 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
7100 "ALLOW" => Self::Allow,
7101 "DENY" => Self::Deny,
7102 _ => Self::UnknownValue(action_type::UnknownValue(
7103 wkt::internal::UnknownEnumValue::String(value.to_string()),
7104 )),
7105 }
7106 }
7107 }
7108
7109 impl serde::ser::Serialize for ActionType {
7110 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7111 where
7112 S: serde::Serializer,
7113 {
7114 match self {
7115 Self::Unspecified => serializer.serialize_i32(0),
7116 Self::Allow => serializer.serialize_i32(1),
7117 Self::Deny => serializer.serialize_i32(2),
7118 Self::UnknownValue(u) => u.0.serialize(serializer),
7119 }
7120 }
7121 }
7122
7123 impl<'de> serde::de::Deserialize<'de> for ActionType {
7124 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7125 where
7126 D: serde::Deserializer<'de>,
7127 {
7128 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
7129 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType"))
7130 }
7131 }
7132 }
7133
7134 #[derive(Clone, Debug, PartialEq)]
7135 #[non_exhaustive]
7136 pub enum ConstraintDefinition {
7137 /// The definition of the canned constraint defined by Google.
7138 GoogleDefinedConstraint(
7139 std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
7140 ),
7141 /// The definition of the custom constraint.
7142 CustomConstraint(
7143 std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
7144 ),
7145 }
7146}
7147
7148/// A request message for
7149/// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies].
7150///
7151/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]: crate::client::AssetService::analyze_org_policies
7152#[derive(Clone, Default, PartialEq)]
7153#[non_exhaustive]
7154pub struct AnalyzeOrgPoliciesRequest {
7155 /// Required. The organization to scope the request. Only organization
7156 /// policies within the scope will be analyzed.
7157 ///
7158 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
7159 pub scope: std::string::String,
7160
7161 /// Required. The name of the constraint to analyze organization policies for.
7162 /// The response only contains analyzed organization policies for the provided
7163 /// constraint.
7164 pub constraint: std::string::String,
7165
7166 /// The expression to filter
7167 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results].
7168 /// Filtering is currently available for bare literal values and the following
7169 /// fields:
7170 ///
7171 /// * consolidated_policy.attached_resource
7172 /// * consolidated_policy.rules.enforce
7173 ///
7174 /// When filtering by a specific field, the only supported operator is `=`.
7175 /// For example, filtering by
7176 /// consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001"
7177 /// will return all the Organization Policy results attached to "folders/001".
7178 ///
7179 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
7180 pub filter: std::string::String,
7181
7182 /// The maximum number of items to return per page. If unspecified,
7183 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]
7184 /// will contain 20 items with a maximum of 200.
7185 ///
7186 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
7187 pub page_size: std::option::Option<i32>,
7188
7189 /// The pagination token to retrieve the next page.
7190 pub page_token: std::string::String,
7191
7192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7193}
7194
7195impl AnalyzeOrgPoliciesRequest {
7196 pub fn new() -> Self {
7197 std::default::Default::default()
7198 }
7199
7200 /// Sets the value of [scope][crate::model::AnalyzeOrgPoliciesRequest::scope].
7201 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7202 self.scope = v.into();
7203 self
7204 }
7205
7206 /// Sets the value of [constraint][crate::model::AnalyzeOrgPoliciesRequest::constraint].
7207 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7208 self.constraint = v.into();
7209 self
7210 }
7211
7212 /// Sets the value of [filter][crate::model::AnalyzeOrgPoliciesRequest::filter].
7213 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7214 self.filter = v.into();
7215 self
7216 }
7217
7218 /// Sets the value of [page_size][crate::model::AnalyzeOrgPoliciesRequest::page_size].
7219 pub fn set_page_size<T>(mut self, v: T) -> Self
7220 where
7221 T: std::convert::Into<i32>,
7222 {
7223 self.page_size = std::option::Option::Some(v.into());
7224 self
7225 }
7226
7227 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPoliciesRequest::page_size].
7228 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
7229 where
7230 T: std::convert::Into<i32>,
7231 {
7232 self.page_size = v.map(|x| x.into());
7233 self
7234 }
7235
7236 /// Sets the value of [page_token][crate::model::AnalyzeOrgPoliciesRequest::page_token].
7237 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7238 self.page_token = v.into();
7239 self
7240 }
7241}
7242
7243impl wkt::message::Message for AnalyzeOrgPoliciesRequest {
7244 fn typename() -> &'static str {
7245 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesRequest"
7246 }
7247}
7248
7249/// The response message for
7250/// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies].
7251///
7252/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]: crate::client::AssetService::analyze_org_policies
7253#[derive(Clone, Default, PartialEq)]
7254#[non_exhaustive]
7255pub struct AnalyzeOrgPoliciesResponse {
7256 /// The organization policies under the
7257 /// [AnalyzeOrgPoliciesRequest.scope][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope]
7258 /// with the
7259 /// [AnalyzeOrgPoliciesRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint].
7260 ///
7261 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint]: crate::model::AnalyzeOrgPoliciesRequest::constraint
7262 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope]: crate::model::AnalyzeOrgPoliciesRequest::scope
7263 pub org_policy_results:
7264 std::vec::Vec<crate::model::analyze_org_policies_response::OrgPolicyResult>,
7265
7266 /// The definition of the constraint in the request.
7267 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
7268
7269 /// The page token to fetch the next page for
7270 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results].
7271 ///
7272 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
7273 pub next_page_token: std::string::String,
7274
7275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7276}
7277
7278impl AnalyzeOrgPoliciesResponse {
7279 pub fn new() -> Self {
7280 std::default::Default::default()
7281 }
7282
7283 /// Sets the value of [org_policy_results][crate::model::AnalyzeOrgPoliciesResponse::org_policy_results].
7284 pub fn set_org_policy_results<T, V>(mut self, v: T) -> Self
7285 where
7286 T: std::iter::IntoIterator<Item = V>,
7287 V: std::convert::Into<crate::model::analyze_org_policies_response::OrgPolicyResult>,
7288 {
7289 use std::iter::Iterator;
7290 self.org_policy_results = v.into_iter().map(|i| i.into()).collect();
7291 self
7292 }
7293
7294 /// Sets the value of [constraint][crate::model::AnalyzeOrgPoliciesResponse::constraint].
7295 pub fn set_constraint<T>(mut self, v: T) -> Self
7296 where
7297 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7298 {
7299 self.constraint = std::option::Option::Some(v.into());
7300 self
7301 }
7302
7303 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPoliciesResponse::constraint].
7304 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
7305 where
7306 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7307 {
7308 self.constraint = v.map(|x| x.into());
7309 self
7310 }
7311
7312 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPoliciesResponse::next_page_token].
7313 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7314 self.next_page_token = v.into();
7315 self
7316 }
7317}
7318
7319impl wkt::message::Message for AnalyzeOrgPoliciesResponse {
7320 fn typename() -> &'static str {
7321 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesResponse"
7322 }
7323}
7324
7325#[doc(hidden)]
7326impl gax::paginator::internal::PageableResponse for AnalyzeOrgPoliciesResponse {
7327 type PageItem = crate::model::analyze_org_policies_response::OrgPolicyResult;
7328
7329 fn items(self) -> std::vec::Vec<Self::PageItem> {
7330 self.org_policy_results
7331 }
7332
7333 fn next_page_token(&self) -> std::string::String {
7334 use std::clone::Clone;
7335 self.next_page_token.clone()
7336 }
7337}
7338
7339/// Defines additional types related to [AnalyzeOrgPoliciesResponse].
7340pub mod analyze_org_policies_response {
7341 #[allow(unused_imports)]
7342 use super::*;
7343
7344 /// The organization policy result to the query.
7345 #[derive(Clone, Default, PartialEq)]
7346 #[non_exhaustive]
7347 pub struct OrgPolicyResult {
7348 /// The consolidated organization policy for the analyzed resource. The
7349 /// consolidated organization policy is computed by merging and evaluating
7350 /// [policy_bundle][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult.policy_bundle].
7351 /// The evaluation will respect the organization policy [hierarchy
7352 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
7353 ///
7354 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult.policy_bundle]: crate::model::analyze_org_policies_response::OrgPolicyResult::policy_bundle
7355 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
7356
7357 /// The ordered list of all organization policies from the
7358 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
7359 /// to the scope specified in the request.
7360 ///
7361 /// If the constraint is defined with default policy, it will also appear in
7362 /// the list.
7363 ///
7364 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
7365 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
7366
7367 /// The project that this consolidated policy belongs to, in the format of
7368 /// projects/{PROJECT_NUMBER}. This field is available when the consolidated
7369 /// policy belongs to a project.
7370 pub project: std::string::String,
7371
7372 /// The folder(s) that this consolidated policy belongs to, in the format of
7373 /// folders/{FOLDER_NUMBER}. This field is available when the consolidated
7374 /// policy belongs (directly or cascadingly) to one or more folders.
7375 pub folders: std::vec::Vec<std::string::String>,
7376
7377 /// The organization that this consolidated policy belongs to, in the format
7378 /// of organizations/{ORGANIZATION_NUMBER}. This field is available when the
7379 /// consolidated policy belongs (directly or cascadingly) to an organization.
7380 pub organization: std::string::String,
7381
7382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7383 }
7384
7385 impl OrgPolicyResult {
7386 pub fn new() -> Self {
7387 std::default::Default::default()
7388 }
7389
7390 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policies_response::OrgPolicyResult::consolidated_policy].
7391 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
7392 where
7393 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7394 {
7395 self.consolidated_policy = std::option::Option::Some(v.into());
7396 self
7397 }
7398
7399 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policies_response::OrgPolicyResult::consolidated_policy].
7400 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
7401 where
7402 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7403 {
7404 self.consolidated_policy = v.map(|x| x.into());
7405 self
7406 }
7407
7408 /// Sets the value of [policy_bundle][crate::model::analyze_org_policies_response::OrgPolicyResult::policy_bundle].
7409 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
7410 where
7411 T: std::iter::IntoIterator<Item = V>,
7412 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7413 {
7414 use std::iter::Iterator;
7415 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
7416 self
7417 }
7418
7419 /// Sets the value of [project][crate::model::analyze_org_policies_response::OrgPolicyResult::project].
7420 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7421 self.project = v.into();
7422 self
7423 }
7424
7425 /// Sets the value of [folders][crate::model::analyze_org_policies_response::OrgPolicyResult::folders].
7426 pub fn set_folders<T, V>(mut self, v: T) -> Self
7427 where
7428 T: std::iter::IntoIterator<Item = V>,
7429 V: std::convert::Into<std::string::String>,
7430 {
7431 use std::iter::Iterator;
7432 self.folders = v.into_iter().map(|i| i.into()).collect();
7433 self
7434 }
7435
7436 /// Sets the value of [organization][crate::model::analyze_org_policies_response::OrgPolicyResult::organization].
7437 pub fn set_organization<T: std::convert::Into<std::string::String>>(
7438 mut self,
7439 v: T,
7440 ) -> Self {
7441 self.organization = v.into();
7442 self
7443 }
7444 }
7445
7446 impl wkt::message::Message for OrgPolicyResult {
7447 fn typename() -> &'static str {
7448 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult"
7449 }
7450 }
7451}
7452
7453/// A request message for
7454/// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers].
7455///
7456/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]: crate::client::AssetService::analyze_org_policy_governed_containers
7457#[derive(Clone, Default, PartialEq)]
7458#[non_exhaustive]
7459pub struct AnalyzeOrgPolicyGovernedContainersRequest {
7460 /// Required. The organization to scope the request. Only organization
7461 /// policies within the scope will be analyzed. The output containers will
7462 /// also be limited to the ones governed by those in-scope organization
7463 /// policies.
7464 ///
7465 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
7466 pub scope: std::string::String,
7467
7468 /// Required. The name of the constraint to analyze governed containers for.
7469 /// The analysis only contains organization policies for the provided
7470 /// constraint.
7471 pub constraint: std::string::String,
7472
7473 /// The expression to filter
7474 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers].
7475 /// Filtering is currently available for bare literal values and the following
7476 /// fields:
7477 ///
7478 /// * parent
7479 /// * consolidated_policy.rules.enforce
7480 ///
7481 /// When filtering by a specific field, the only supported operator is `=`.
7482 /// For example, filtering by
7483 /// parent="//cloudresourcemanager.googleapis.com/folders/001"
7484 /// will return all the containers under "folders/001".
7485 ///
7486 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
7487 pub filter: std::string::String,
7488
7489 /// The maximum number of items to return per page. If unspecified,
7490 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]
7491 /// will contain 100 items with a maximum of 200.
7492 ///
7493 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
7494 pub page_size: std::option::Option<i32>,
7495
7496 /// The pagination token to retrieve the next page.
7497 pub page_token: std::string::String,
7498
7499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7500}
7501
7502impl AnalyzeOrgPolicyGovernedContainersRequest {
7503 pub fn new() -> Self {
7504 std::default::Default::default()
7505 }
7506
7507 /// Sets the value of [scope][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::scope].
7508 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7509 self.scope = v.into();
7510 self
7511 }
7512
7513 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::constraint].
7514 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7515 self.constraint = v.into();
7516 self
7517 }
7518
7519 /// Sets the value of [filter][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::filter].
7520 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7521 self.filter = v.into();
7522 self
7523 }
7524
7525 /// Sets the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_size].
7526 pub fn set_page_size<T>(mut self, v: T) -> Self
7527 where
7528 T: std::convert::Into<i32>,
7529 {
7530 self.page_size = std::option::Option::Some(v.into());
7531 self
7532 }
7533
7534 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_size].
7535 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
7536 where
7537 T: std::convert::Into<i32>,
7538 {
7539 self.page_size = v.map(|x| x.into());
7540 self
7541 }
7542
7543 /// Sets the value of [page_token][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_token].
7544 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7545 self.page_token = v.into();
7546 self
7547 }
7548}
7549
7550impl wkt::message::Message for AnalyzeOrgPolicyGovernedContainersRequest {
7551 fn typename() -> &'static str {
7552 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest"
7553 }
7554}
7555
7556/// The response message for
7557/// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers].
7558///
7559/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]: crate::client::AssetService::analyze_org_policy_governed_containers
7560#[derive(Clone, Default, PartialEq)]
7561#[non_exhaustive]
7562pub struct AnalyzeOrgPolicyGovernedContainersResponse {
7563 /// The list of the analyzed governed containers.
7564 pub governed_containers: std::vec::Vec<
7565 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer,
7566 >,
7567
7568 /// The definition of the constraint in the request.
7569 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
7570
7571 /// The page token to fetch the next page for
7572 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers].
7573 ///
7574 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
7575 pub next_page_token: std::string::String,
7576
7577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7578}
7579
7580impl AnalyzeOrgPolicyGovernedContainersResponse {
7581 pub fn new() -> Self {
7582 std::default::Default::default()
7583 }
7584
7585 /// Sets the value of [governed_containers][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers].
7586 pub fn set_governed_containers<T, V>(mut self, v: T) -> Self
7587 where
7588 T: std::iter::IntoIterator<Item = V>,
7589 V: std::convert::Into<
7590 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer,
7591 >,
7592 {
7593 use std::iter::Iterator;
7594 self.governed_containers = v.into_iter().map(|i| i.into()).collect();
7595 self
7596 }
7597
7598 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::constraint].
7599 pub fn set_constraint<T>(mut self, v: T) -> Self
7600 where
7601 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7602 {
7603 self.constraint = std::option::Option::Some(v.into());
7604 self
7605 }
7606
7607 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::constraint].
7608 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
7609 where
7610 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7611 {
7612 self.constraint = v.map(|x| x.into());
7613 self
7614 }
7615
7616 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::next_page_token].
7617 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7618 self.next_page_token = v.into();
7619 self
7620 }
7621}
7622
7623impl wkt::message::Message for AnalyzeOrgPolicyGovernedContainersResponse {
7624 fn typename() -> &'static str {
7625 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse"
7626 }
7627}
7628
7629#[doc(hidden)]
7630impl gax::paginator::internal::PageableResponse for AnalyzeOrgPolicyGovernedContainersResponse {
7631 type PageItem =
7632 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer;
7633
7634 fn items(self) -> std::vec::Vec<Self::PageItem> {
7635 self.governed_containers
7636 }
7637
7638 fn next_page_token(&self) -> std::string::String {
7639 use std::clone::Clone;
7640 self.next_page_token.clone()
7641 }
7642}
7643
7644/// Defines additional types related to [AnalyzeOrgPolicyGovernedContainersResponse].
7645pub mod analyze_org_policy_governed_containers_response {
7646 #[allow(unused_imports)]
7647 use super::*;
7648
7649 /// The organization/folder/project resource governed by organization policies
7650 /// of
7651 /// [AnalyzeOrgPolicyGovernedContainersRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest.constraint].
7652 ///
7653 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedContainersRequest::constraint
7654 #[derive(Clone, Default, PartialEq)]
7655 #[non_exhaustive]
7656 pub struct GovernedContainer {
7657 /// The [full resource name]
7658 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
7659 /// an organization/folder/project resource.
7660 pub full_resource_name: std::string::String,
7661
7662 /// The [full resource name]
7663 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
7664 /// the parent of
7665 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name].
7666 ///
7667 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::full_resource_name
7668 pub parent: std::string::String,
7669
7670 /// The consolidated organization policy for the analyzed resource. The
7671 /// consolidated organization policy is computed by merging and evaluating
7672 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle].
7673 /// The evaluation will respect the organization policy [hierarchy
7674 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
7675 ///
7676 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::policy_bundle
7677 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
7678
7679 /// The ordered list of all organization policies from the
7680 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
7681 /// to the scope specified in the request.
7682 ///
7683 /// If the constraint is defined with default policy, it will also appear in
7684 /// the list.
7685 ///
7686 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
7687 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
7688
7689 /// The project that this resource belongs to, in the format of
7690 /// projects/{PROJECT_NUMBER}. This field is available when the resource
7691 /// belongs to a project.
7692 pub project: std::string::String,
7693
7694 /// The folder(s) that this resource belongs to, in the format of
7695 /// folders/{FOLDER_NUMBER}. This field is available when the resource
7696 /// belongs (directly or cascadingly) to one or more folders.
7697 pub folders: std::vec::Vec<std::string::String>,
7698
7699 /// The organization that this resource belongs to, in the format of
7700 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
7701 /// resource belongs (directly or cascadingly) to an organization.
7702 pub organization: std::string::String,
7703
7704 /// The effective tags on this resource.
7705 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
7706
7707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7708 }
7709
7710 impl GovernedContainer {
7711 pub fn new() -> Self {
7712 std::default::Default::default()
7713 }
7714
7715 /// Sets the value of [full_resource_name][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::full_resource_name].
7716 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
7717 mut self,
7718 v: T,
7719 ) -> Self {
7720 self.full_resource_name = v.into();
7721 self
7722 }
7723
7724 /// Sets the value of [parent][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::parent].
7725 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7726 self.parent = v.into();
7727 self
7728 }
7729
7730 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy].
7731 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
7732 where
7733 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7734 {
7735 self.consolidated_policy = std::option::Option::Some(v.into());
7736 self
7737 }
7738
7739 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy].
7740 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
7741 where
7742 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7743 {
7744 self.consolidated_policy = v.map(|x| x.into());
7745 self
7746 }
7747
7748 /// Sets the value of [policy_bundle][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::policy_bundle].
7749 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
7750 where
7751 T: std::iter::IntoIterator<Item = V>,
7752 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
7753 {
7754 use std::iter::Iterator;
7755 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
7756 self
7757 }
7758
7759 /// Sets the value of [project][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::project].
7760 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7761 self.project = v.into();
7762 self
7763 }
7764
7765 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::folders].
7766 pub fn set_folders<T, V>(mut self, v: T) -> Self
7767 where
7768 T: std::iter::IntoIterator<Item = V>,
7769 V: std::convert::Into<std::string::String>,
7770 {
7771 use std::iter::Iterator;
7772 self.folders = v.into_iter().map(|i| i.into()).collect();
7773 self
7774 }
7775
7776 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::organization].
7777 pub fn set_organization<T: std::convert::Into<std::string::String>>(
7778 mut self,
7779 v: T,
7780 ) -> Self {
7781 self.organization = v.into();
7782 self
7783 }
7784
7785 /// Sets the value of [effective_tags][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::effective_tags].
7786 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
7787 where
7788 T: std::iter::IntoIterator<Item = V>,
7789 V: std::convert::Into<crate::model::EffectiveTagDetails>,
7790 {
7791 use std::iter::Iterator;
7792 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
7793 self
7794 }
7795 }
7796
7797 impl wkt::message::Message for GovernedContainer {
7798 fn typename() -> &'static str {
7799 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer"
7800 }
7801 }
7802}
7803
7804/// A request message for
7805/// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets].
7806///
7807/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]: crate::client::AssetService::analyze_org_policy_governed_assets
7808#[derive(Clone, Default, PartialEq)]
7809#[non_exhaustive]
7810pub struct AnalyzeOrgPolicyGovernedAssetsRequest {
7811 /// Required. The organization to scope the request. Only organization
7812 /// policies within the scope will be analyzed. The output assets will
7813 /// also be limited to the ones governed by those in-scope organization
7814 /// policies.
7815 ///
7816 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
7817 pub scope: std::string::String,
7818
7819 /// Required. The name of the constraint to analyze governed assets for. The
7820 /// analysis only contains analyzed organization policies for the provided
7821 /// constraint.
7822 pub constraint: std::string::String,
7823
7824 /// The expression to filter
7825 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets].
7826 ///
7827 /// For governed resources, filtering is currently available for bare literal
7828 /// values and the following fields:
7829 ///
7830 /// * governed_resource.project
7831 /// * governed_resource.folders
7832 /// * consolidated_policy.rules.enforce
7833 /// When filtering by `governed_resource.project` or
7834 /// `consolidated_policy.rules.enforce`, the only supported operator is `=`.
7835 /// When filtering by `governed_resource.folders`, the supported operators
7836 /// are `=` and `:`.
7837 /// For example, filtering by `governed_resource.project="projects/12345678"`
7838 /// will return all the governed resources under "projects/12345678",
7839 /// including the project itself if applicable.
7840 ///
7841 /// For governed IAM policies, filtering is currently available for bare
7842 /// literal values and the following fields:
7843 ///
7844 /// * governed_iam_policy.project
7845 /// * governed_iam_policy.folders
7846 /// * consolidated_policy.rules.enforce
7847 /// When filtering by `governed_iam_policy.project` or
7848 /// `consolidated_policy.rules.enforce`, the only supported operator is `=`.
7849 /// When filtering by `governed_iam_policy.folders`, the supported operators
7850 /// are `=` and `:`.
7851 /// For example, filtering by `governed_iam_policy.folders:"folders/12345678"`
7852 /// will return all the governed IAM policies under "folders/001".
7853 ///
7854 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
7855 pub filter: std::string::String,
7856
7857 /// The maximum number of items to return per page. If unspecified,
7858 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]
7859 /// will contain 100 items with a maximum of 200.
7860 ///
7861 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
7862 pub page_size: std::option::Option<i32>,
7863
7864 /// The pagination token to retrieve the next page.
7865 pub page_token: std::string::String,
7866
7867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7868}
7869
7870impl AnalyzeOrgPolicyGovernedAssetsRequest {
7871 pub fn new() -> Self {
7872 std::default::Default::default()
7873 }
7874
7875 /// Sets the value of [scope][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::scope].
7876 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7877 self.scope = v.into();
7878 self
7879 }
7880
7881 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint].
7882 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7883 self.constraint = v.into();
7884 self
7885 }
7886
7887 /// Sets the value of [filter][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::filter].
7888 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7889 self.filter = v.into();
7890 self
7891 }
7892
7893 /// Sets the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_size].
7894 pub fn set_page_size<T>(mut self, v: T) -> Self
7895 where
7896 T: std::convert::Into<i32>,
7897 {
7898 self.page_size = std::option::Option::Some(v.into());
7899 self
7900 }
7901
7902 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_size].
7903 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
7904 where
7905 T: std::convert::Into<i32>,
7906 {
7907 self.page_size = v.map(|x| x.into());
7908 self
7909 }
7910
7911 /// Sets the value of [page_token][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_token].
7912 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7913 self.page_token = v.into();
7914 self
7915 }
7916}
7917
7918impl wkt::message::Message for AnalyzeOrgPolicyGovernedAssetsRequest {
7919 fn typename() -> &'static str {
7920 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest"
7921 }
7922}
7923
7924/// The response message for
7925/// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets].
7926///
7927/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]: crate::client::AssetService::analyze_org_policy_governed_assets
7928#[derive(Clone, Default, PartialEq)]
7929#[non_exhaustive]
7930pub struct AnalyzeOrgPolicyGovernedAssetsResponse {
7931 /// The list of the analyzed governed assets.
7932 pub governed_assets:
7933 std::vec::Vec<crate::model::analyze_org_policy_governed_assets_response::GovernedAsset>,
7934
7935 /// The definition of the constraint in the request.
7936 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
7937
7938 /// The page token to fetch the next page for
7939 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets].
7940 ///
7941 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
7942 pub next_page_token: std::string::String,
7943
7944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7945}
7946
7947impl AnalyzeOrgPolicyGovernedAssetsResponse {
7948 pub fn new() -> Self {
7949 std::default::Default::default()
7950 }
7951
7952 /// Sets the value of [governed_assets][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets].
7953 pub fn set_governed_assets<T, V>(mut self, v: T) -> Self
7954 where
7955 T: std::iter::IntoIterator<Item = V>,
7956 V: std::convert::Into<
7957 crate::model::analyze_org_policy_governed_assets_response::GovernedAsset,
7958 >,
7959 {
7960 use std::iter::Iterator;
7961 self.governed_assets = v.into_iter().map(|i| i.into()).collect();
7962 self
7963 }
7964
7965 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::constraint].
7966 pub fn set_constraint<T>(mut self, v: T) -> Self
7967 where
7968 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7969 {
7970 self.constraint = std::option::Option::Some(v.into());
7971 self
7972 }
7973
7974 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::constraint].
7975 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
7976 where
7977 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
7978 {
7979 self.constraint = v.map(|x| x.into());
7980 self
7981 }
7982
7983 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::next_page_token].
7984 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7985 self.next_page_token = v.into();
7986 self
7987 }
7988}
7989
7990impl wkt::message::Message for AnalyzeOrgPolicyGovernedAssetsResponse {
7991 fn typename() -> &'static str {
7992 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse"
7993 }
7994}
7995
7996#[doc(hidden)]
7997impl gax::paginator::internal::PageableResponse for AnalyzeOrgPolicyGovernedAssetsResponse {
7998 type PageItem = crate::model::analyze_org_policy_governed_assets_response::GovernedAsset;
7999
8000 fn items(self) -> std::vec::Vec<Self::PageItem> {
8001 self.governed_assets
8002 }
8003
8004 fn next_page_token(&self) -> std::string::String {
8005 use std::clone::Clone;
8006 self.next_page_token.clone()
8007 }
8008}
8009
8010/// Defines additional types related to [AnalyzeOrgPolicyGovernedAssetsResponse].
8011pub mod analyze_org_policy_governed_assets_response {
8012 #[allow(unused_imports)]
8013 use super::*;
8014
8015 /// The Google Cloud resources governed by the organization policies of the
8016 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
8017 ///
8018 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
8019 #[derive(Clone, Default, PartialEq)]
8020 #[non_exhaustive]
8021 pub struct GovernedResource {
8022 /// The [full resource name]
8023 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
8024 /// the Google Cloud resource.
8025 pub full_resource_name: std::string::String,
8026
8027 /// The [full resource name]
8028 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
8029 /// the parent of
8030 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name].
8031 ///
8032 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]: crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name
8033 pub parent: std::string::String,
8034
8035 /// The project that this resource belongs to, in the format of
8036 /// projects/{PROJECT_NUMBER}. This field is available when the resource
8037 /// belongs to a project.
8038 pub project: std::string::String,
8039
8040 /// The folder(s) that this resource belongs to, in the format of
8041 /// folders/{FOLDER_NUMBER}. This field is available when the resource
8042 /// belongs (directly or cascadingly) to one or more folders.
8043 pub folders: std::vec::Vec<std::string::String>,
8044
8045 /// The organization that this resource belongs to, in the format of
8046 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
8047 /// resource belongs (directly or cascadingly) to an organization.
8048 pub organization: std::string::String,
8049
8050 /// The asset type of the
8051 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]
8052 /// Example:
8053 /// `cloudresourcemanager.googleapis.com/Project`
8054 /// See [Cloud Asset Inventory Supported Asset
8055 /// Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
8056 /// for all supported asset types.
8057 ///
8058 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]: crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name
8059 pub asset_type: std::string::String,
8060
8061 /// The effective tags on this resource.
8062 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
8063
8064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8065 }
8066
8067 impl GovernedResource {
8068 pub fn new() -> Self {
8069 std::default::Default::default()
8070 }
8071
8072 /// Sets the value of [full_resource_name][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name].
8073 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
8074 mut self,
8075 v: T,
8076 ) -> Self {
8077 self.full_resource_name = v.into();
8078 self
8079 }
8080
8081 /// Sets the value of [parent][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::parent].
8082 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8083 self.parent = v.into();
8084 self
8085 }
8086
8087 /// Sets the value of [project][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::project].
8088 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8089 self.project = v.into();
8090 self
8091 }
8092
8093 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::folders].
8094 pub fn set_folders<T, V>(mut self, v: T) -> Self
8095 where
8096 T: std::iter::IntoIterator<Item = V>,
8097 V: std::convert::Into<std::string::String>,
8098 {
8099 use std::iter::Iterator;
8100 self.folders = v.into_iter().map(|i| i.into()).collect();
8101 self
8102 }
8103
8104 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::organization].
8105 pub fn set_organization<T: std::convert::Into<std::string::String>>(
8106 mut self,
8107 v: T,
8108 ) -> Self {
8109 self.organization = v.into();
8110 self
8111 }
8112
8113 /// Sets the value of [asset_type][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::asset_type].
8114 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8115 self.asset_type = v.into();
8116 self
8117 }
8118
8119 /// Sets the value of [effective_tags][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::effective_tags].
8120 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
8121 where
8122 T: std::iter::IntoIterator<Item = V>,
8123 V: std::convert::Into<crate::model::EffectiveTagDetails>,
8124 {
8125 use std::iter::Iterator;
8126 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
8127 self
8128 }
8129 }
8130
8131 impl wkt::message::Message for GovernedResource {
8132 fn typename() -> &'static str {
8133 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource"
8134 }
8135 }
8136
8137 /// The IAM policies governed by the organization policies of the
8138 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
8139 ///
8140 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
8141 #[derive(Clone, Default, PartialEq)]
8142 #[non_exhaustive]
8143 pub struct GovernedIamPolicy {
8144 /// The full resource name of the resource on which this IAM policy is set.
8145 /// Example:
8146 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
8147 /// See [Cloud Asset Inventory Resource Name
8148 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
8149 /// for more information.
8150 pub attached_resource: std::string::String,
8151
8152 /// The IAM policy directly set on the given resource.
8153 pub policy: std::option::Option<iam_v1::model::Policy>,
8154
8155 /// The project that this IAM policy belongs to, in the format of
8156 /// projects/{PROJECT_NUMBER}. This field is available when the IAM policy
8157 /// belongs to a project.
8158 pub project: std::string::String,
8159
8160 /// The folder(s) that this IAM policy belongs to, in the format of
8161 /// folders/{FOLDER_NUMBER}. This field is available when the IAM policy
8162 /// belongs (directly or cascadingly) to one or more folders.
8163 pub folders: std::vec::Vec<std::string::String>,
8164
8165 /// The organization that this IAM policy belongs to, in the format of
8166 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
8167 /// IAM policy belongs (directly or cascadingly) to an organization.
8168 pub organization: std::string::String,
8169
8170 /// The asset type of the
8171 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource].
8172 /// Example:
8173 /// `cloudresourcemanager.googleapis.com/Project`
8174 /// See [Cloud Asset Inventory Supported Asset
8175 /// Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
8176 /// for all supported asset types.
8177 ///
8178 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource]: crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::attached_resource
8179 pub asset_type: std::string::String,
8180
8181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8182 }
8183
8184 impl GovernedIamPolicy {
8185 pub fn new() -> Self {
8186 std::default::Default::default()
8187 }
8188
8189 /// Sets the value of [attached_resource][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::attached_resource].
8190 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
8191 mut self,
8192 v: T,
8193 ) -> Self {
8194 self.attached_resource = v.into();
8195 self
8196 }
8197
8198 /// Sets the value of [policy][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::policy].
8199 pub fn set_policy<T>(mut self, v: T) -> Self
8200 where
8201 T: std::convert::Into<iam_v1::model::Policy>,
8202 {
8203 self.policy = std::option::Option::Some(v.into());
8204 self
8205 }
8206
8207 /// Sets or clears the value of [policy][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::policy].
8208 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
8209 where
8210 T: std::convert::Into<iam_v1::model::Policy>,
8211 {
8212 self.policy = v.map(|x| x.into());
8213 self
8214 }
8215
8216 /// Sets the value of [project][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::project].
8217 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8218 self.project = v.into();
8219 self
8220 }
8221
8222 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::folders].
8223 pub fn set_folders<T, V>(mut self, v: T) -> Self
8224 where
8225 T: std::iter::IntoIterator<Item = V>,
8226 V: std::convert::Into<std::string::String>,
8227 {
8228 use std::iter::Iterator;
8229 self.folders = v.into_iter().map(|i| i.into()).collect();
8230 self
8231 }
8232
8233 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::organization].
8234 pub fn set_organization<T: std::convert::Into<std::string::String>>(
8235 mut self,
8236 v: T,
8237 ) -> Self {
8238 self.organization = v.into();
8239 self
8240 }
8241
8242 /// Sets the value of [asset_type][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::asset_type].
8243 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8244 self.asset_type = v.into();
8245 self
8246 }
8247 }
8248
8249 impl wkt::message::Message for GovernedIamPolicy {
8250 fn typename() -> &'static str {
8251 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy"
8252 }
8253 }
8254
8255 /// Represents a Google Cloud asset(resource or IAM policy) governed by the
8256 /// organization policies of the
8257 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
8258 ///
8259 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
8260 #[derive(Clone, Default, PartialEq)]
8261 #[non_exhaustive]
8262 pub struct GovernedAsset {
8263
8264 /// The consolidated policy for the analyzed asset. The consolidated
8265 /// policy is computed by merging and evaluating
8266 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle].
8267 /// The evaluation will respect the organization policy [hierarchy
8268 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
8269 ///
8270 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::policy_bundle
8271 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
8272
8273 /// The ordered list of all organization policies from the
8274 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]
8275 /// to the scope specified in the request.
8276 ///
8277 /// If the constraint is defined with default policy, it will also appear in
8278 /// the list.
8279 ///
8280 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
8281 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
8282
8283 pub governed_asset: std::option::Option<crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset>,
8284
8285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8286 }
8287
8288 impl GovernedAsset {
8289 pub fn new() -> Self {
8290 std::default::Default::default()
8291 }
8292
8293 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy].
8294 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
8295 where
8296 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
8297 {
8298 self.consolidated_policy = std::option::Option::Some(v.into());
8299 self
8300 }
8301
8302 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy].
8303 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
8304 where
8305 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
8306 {
8307 self.consolidated_policy = v.map(|x| x.into());
8308 self
8309 }
8310
8311 /// Sets the value of [policy_bundle][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::policy_bundle].
8312 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
8313 where
8314 T: std::iter::IntoIterator<Item = V>,
8315 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
8316 {
8317 use std::iter::Iterator;
8318 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
8319 self
8320 }
8321
8322 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset].
8323 ///
8324 /// Note that all the setters affecting `governed_asset` are mutually
8325 /// exclusive.
8326 pub fn set_governed_asset<T: std::convert::Into<std::option::Option<crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset>>>(mut self, v: T) -> Self
8327 {
8328 self.governed_asset = v.into();
8329 self
8330 }
8331
8332 /// The value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
8333 /// if it holds a `GovernedResource`, `None` if the field is not set or
8334 /// holds a different branch.
8335 pub fn governed_resource(
8336 &self,
8337 ) -> std::option::Option<
8338 &std::boxed::Box<
8339 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
8340 >,
8341 > {
8342 #[allow(unreachable_patterns)]
8343 self.governed_asset.as_ref().and_then(|v| match v {
8344 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedResource(v) => std::option::Option::Some(v),
8345 _ => std::option::Option::None,
8346 })
8347 }
8348
8349 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
8350 /// to hold a `GovernedResource`.
8351 ///
8352 /// Note that all the setters affecting `governed_asset` are
8353 /// mutually exclusive.
8354 pub fn set_governed_resource<
8355 T: std::convert::Into<
8356 std::boxed::Box<
8357 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
8358 >,
8359 >,
8360 >(
8361 mut self,
8362 v: T,
8363 ) -> Self {
8364 self.governed_asset = std::option::Option::Some(
8365 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedResource(
8366 v.into()
8367 )
8368 );
8369 self
8370 }
8371
8372 /// The value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
8373 /// if it holds a `GovernedIamPolicy`, `None` if the field is not set or
8374 /// holds a different branch.
8375 pub fn governed_iam_policy(
8376 &self,
8377 ) -> std::option::Option<
8378 &std::boxed::Box<
8379 crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy,
8380 >,
8381 > {
8382 #[allow(unreachable_patterns)]
8383 self.governed_asset.as_ref().and_then(|v| match v {
8384 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedIamPolicy(v) => std::option::Option::Some(v),
8385 _ => std::option::Option::None,
8386 })
8387 }
8388
8389 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
8390 /// to hold a `GovernedIamPolicy`.
8391 ///
8392 /// Note that all the setters affecting `governed_asset` are
8393 /// mutually exclusive.
8394 pub fn set_governed_iam_policy<T: std::convert::Into<std::boxed::Box<crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy>>>(mut self, v: T) -> Self{
8395 self.governed_asset = std::option::Option::Some(
8396 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedIamPolicy(
8397 v.into()
8398 )
8399 );
8400 self
8401 }
8402 }
8403
8404 impl wkt::message::Message for GovernedAsset {
8405 fn typename() -> &'static str {
8406 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset"
8407 }
8408 }
8409
8410 /// Defines additional types related to [GovernedAsset].
8411 pub mod governed_asset {
8412 #[allow(unused_imports)]
8413 use super::*;
8414
8415 #[derive(Clone, Debug, PartialEq)]
8416 #[non_exhaustive]
8417 pub enum GovernedAsset {
8418 /// A Google Cloud resource governed by the organization
8419 /// policies of the
8420 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
8421 ///
8422 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
8423 GovernedResource(
8424 std::boxed::Box<
8425 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
8426 >,
8427 ),
8428 /// An IAM policy governed by the organization
8429 /// policies of the
8430 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
8431 ///
8432 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
8433 GovernedIamPolicy(
8434 std::boxed::Box<
8435 crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy,
8436 >,
8437 ),
8438 }
8439 }
8440}
8441
8442/// An asset in Google Cloud and its temporal metadata, including the time window
8443/// when it was observed and its status during that window.
8444#[derive(Clone, Default, PartialEq)]
8445#[non_exhaustive]
8446pub struct TemporalAsset {
8447 /// The time window when the asset data and state was observed.
8448 pub window: std::option::Option<crate::model::TimeWindow>,
8449
8450 /// Whether the asset has been deleted or not.
8451 pub deleted: bool,
8452
8453 /// An asset in Google Cloud.
8454 pub asset: std::option::Option<crate::model::Asset>,
8455
8456 /// State of prior_asset.
8457 pub prior_asset_state: crate::model::temporal_asset::PriorAssetState,
8458
8459 /// Prior copy of the asset. Populated if prior_asset_state is PRESENT.
8460 /// Currently this is only set for responses in Real-Time Feed.
8461 pub prior_asset: std::option::Option<crate::model::Asset>,
8462
8463 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8464}
8465
8466impl TemporalAsset {
8467 pub fn new() -> Self {
8468 std::default::Default::default()
8469 }
8470
8471 /// Sets the value of [window][crate::model::TemporalAsset::window].
8472 pub fn set_window<T>(mut self, v: T) -> Self
8473 where
8474 T: std::convert::Into<crate::model::TimeWindow>,
8475 {
8476 self.window = std::option::Option::Some(v.into());
8477 self
8478 }
8479
8480 /// Sets or clears the value of [window][crate::model::TemporalAsset::window].
8481 pub fn set_or_clear_window<T>(mut self, v: std::option::Option<T>) -> Self
8482 where
8483 T: std::convert::Into<crate::model::TimeWindow>,
8484 {
8485 self.window = v.map(|x| x.into());
8486 self
8487 }
8488
8489 /// Sets the value of [deleted][crate::model::TemporalAsset::deleted].
8490 pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8491 self.deleted = v.into();
8492 self
8493 }
8494
8495 /// Sets the value of [asset][crate::model::TemporalAsset::asset].
8496 pub fn set_asset<T>(mut self, v: T) -> Self
8497 where
8498 T: std::convert::Into<crate::model::Asset>,
8499 {
8500 self.asset = std::option::Option::Some(v.into());
8501 self
8502 }
8503
8504 /// Sets or clears the value of [asset][crate::model::TemporalAsset::asset].
8505 pub fn set_or_clear_asset<T>(mut self, v: std::option::Option<T>) -> Self
8506 where
8507 T: std::convert::Into<crate::model::Asset>,
8508 {
8509 self.asset = v.map(|x| x.into());
8510 self
8511 }
8512
8513 /// Sets the value of [prior_asset_state][crate::model::TemporalAsset::prior_asset_state].
8514 pub fn set_prior_asset_state<
8515 T: std::convert::Into<crate::model::temporal_asset::PriorAssetState>,
8516 >(
8517 mut self,
8518 v: T,
8519 ) -> Self {
8520 self.prior_asset_state = v.into();
8521 self
8522 }
8523
8524 /// Sets the value of [prior_asset][crate::model::TemporalAsset::prior_asset].
8525 pub fn set_prior_asset<T>(mut self, v: T) -> Self
8526 where
8527 T: std::convert::Into<crate::model::Asset>,
8528 {
8529 self.prior_asset = std::option::Option::Some(v.into());
8530 self
8531 }
8532
8533 /// Sets or clears the value of [prior_asset][crate::model::TemporalAsset::prior_asset].
8534 pub fn set_or_clear_prior_asset<T>(mut self, v: std::option::Option<T>) -> Self
8535 where
8536 T: std::convert::Into<crate::model::Asset>,
8537 {
8538 self.prior_asset = v.map(|x| x.into());
8539 self
8540 }
8541}
8542
8543impl wkt::message::Message for TemporalAsset {
8544 fn typename() -> &'static str {
8545 "type.googleapis.com/google.cloud.asset.v1.TemporalAsset"
8546 }
8547}
8548
8549/// Defines additional types related to [TemporalAsset].
8550pub mod temporal_asset {
8551 #[allow(unused_imports)]
8552 use super::*;
8553
8554 /// State of prior asset.
8555 ///
8556 /// # Working with unknown values
8557 ///
8558 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8559 /// additional enum variants at any time. Adding new variants is not considered
8560 /// a breaking change. Applications should write their code in anticipation of:
8561 ///
8562 /// - New values appearing in future releases of the client library, **and**
8563 /// - New values received dynamically, without application changes.
8564 ///
8565 /// Please consult the [Working with enums] section in the user guide for some
8566 /// guidelines.
8567 ///
8568 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8569 #[derive(Clone, Debug, PartialEq)]
8570 #[non_exhaustive]
8571 pub enum PriorAssetState {
8572 /// prior_asset is not applicable for the current asset.
8573 Unspecified,
8574 /// prior_asset is populated correctly.
8575 Present,
8576 /// Failed to set prior_asset.
8577 Invalid,
8578 /// Current asset is the first known state.
8579 DoesNotExist,
8580 /// prior_asset is a deletion.
8581 Deleted,
8582 /// If set, the enum was initialized with an unknown value.
8583 ///
8584 /// Applications can examine the value using [PriorAssetState::value] or
8585 /// [PriorAssetState::name].
8586 UnknownValue(prior_asset_state::UnknownValue),
8587 }
8588
8589 #[doc(hidden)]
8590 pub mod prior_asset_state {
8591 #[allow(unused_imports)]
8592 use super::*;
8593 #[derive(Clone, Debug, PartialEq)]
8594 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8595 }
8596
8597 impl PriorAssetState {
8598 /// Gets the enum value.
8599 ///
8600 /// Returns `None` if the enum contains an unknown value deserialized from
8601 /// the string representation of enums.
8602 pub fn value(&self) -> std::option::Option<i32> {
8603 match self {
8604 Self::Unspecified => std::option::Option::Some(0),
8605 Self::Present => std::option::Option::Some(1),
8606 Self::Invalid => std::option::Option::Some(2),
8607 Self::DoesNotExist => std::option::Option::Some(3),
8608 Self::Deleted => std::option::Option::Some(4),
8609 Self::UnknownValue(u) => u.0.value(),
8610 }
8611 }
8612
8613 /// Gets the enum value as a string.
8614 ///
8615 /// Returns `None` if the enum contains an unknown value deserialized from
8616 /// the integer representation of enums.
8617 pub fn name(&self) -> std::option::Option<&str> {
8618 match self {
8619 Self::Unspecified => std::option::Option::Some("PRIOR_ASSET_STATE_UNSPECIFIED"),
8620 Self::Present => std::option::Option::Some("PRESENT"),
8621 Self::Invalid => std::option::Option::Some("INVALID"),
8622 Self::DoesNotExist => std::option::Option::Some("DOES_NOT_EXIST"),
8623 Self::Deleted => std::option::Option::Some("DELETED"),
8624 Self::UnknownValue(u) => u.0.name(),
8625 }
8626 }
8627 }
8628
8629 impl std::default::Default for PriorAssetState {
8630 fn default() -> Self {
8631 use std::convert::From;
8632 Self::from(0)
8633 }
8634 }
8635
8636 impl std::fmt::Display for PriorAssetState {
8637 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8638 wkt::internal::display_enum(f, self.name(), self.value())
8639 }
8640 }
8641
8642 impl std::convert::From<i32> for PriorAssetState {
8643 fn from(value: i32) -> Self {
8644 match value {
8645 0 => Self::Unspecified,
8646 1 => Self::Present,
8647 2 => Self::Invalid,
8648 3 => Self::DoesNotExist,
8649 4 => Self::Deleted,
8650 _ => Self::UnknownValue(prior_asset_state::UnknownValue(
8651 wkt::internal::UnknownEnumValue::Integer(value),
8652 )),
8653 }
8654 }
8655 }
8656
8657 impl std::convert::From<&str> for PriorAssetState {
8658 fn from(value: &str) -> Self {
8659 use std::string::ToString;
8660 match value {
8661 "PRIOR_ASSET_STATE_UNSPECIFIED" => Self::Unspecified,
8662 "PRESENT" => Self::Present,
8663 "INVALID" => Self::Invalid,
8664 "DOES_NOT_EXIST" => Self::DoesNotExist,
8665 "DELETED" => Self::Deleted,
8666 _ => Self::UnknownValue(prior_asset_state::UnknownValue(
8667 wkt::internal::UnknownEnumValue::String(value.to_string()),
8668 )),
8669 }
8670 }
8671 }
8672
8673 impl serde::ser::Serialize for PriorAssetState {
8674 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8675 where
8676 S: serde::Serializer,
8677 {
8678 match self {
8679 Self::Unspecified => serializer.serialize_i32(0),
8680 Self::Present => serializer.serialize_i32(1),
8681 Self::Invalid => serializer.serialize_i32(2),
8682 Self::DoesNotExist => serializer.serialize_i32(3),
8683 Self::Deleted => serializer.serialize_i32(4),
8684 Self::UnknownValue(u) => u.0.serialize(serializer),
8685 }
8686 }
8687 }
8688
8689 impl<'de> serde::de::Deserialize<'de> for PriorAssetState {
8690 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8691 where
8692 D: serde::Deserializer<'de>,
8693 {
8694 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PriorAssetState>::new(
8695 ".google.cloud.asset.v1.TemporalAsset.PriorAssetState",
8696 ))
8697 }
8698 }
8699}
8700
8701/// A time window specified by its `start_time` and `end_time`.
8702#[derive(Clone, Default, PartialEq)]
8703#[non_exhaustive]
8704pub struct TimeWindow {
8705 /// Start time of the time window (exclusive).
8706 pub start_time: std::option::Option<wkt::Timestamp>,
8707
8708 /// End time of the time window (inclusive). If not specified, the current
8709 /// timestamp is used instead.
8710 pub end_time: std::option::Option<wkt::Timestamp>,
8711
8712 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8713}
8714
8715impl TimeWindow {
8716 pub fn new() -> Self {
8717 std::default::Default::default()
8718 }
8719
8720 /// Sets the value of [start_time][crate::model::TimeWindow::start_time].
8721 pub fn set_start_time<T>(mut self, v: T) -> Self
8722 where
8723 T: std::convert::Into<wkt::Timestamp>,
8724 {
8725 self.start_time = std::option::Option::Some(v.into());
8726 self
8727 }
8728
8729 /// Sets or clears the value of [start_time][crate::model::TimeWindow::start_time].
8730 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8731 where
8732 T: std::convert::Into<wkt::Timestamp>,
8733 {
8734 self.start_time = v.map(|x| x.into());
8735 self
8736 }
8737
8738 /// Sets the value of [end_time][crate::model::TimeWindow::end_time].
8739 pub fn set_end_time<T>(mut self, v: T) -> Self
8740 where
8741 T: std::convert::Into<wkt::Timestamp>,
8742 {
8743 self.end_time = std::option::Option::Some(v.into());
8744 self
8745 }
8746
8747 /// Sets or clears the value of [end_time][crate::model::TimeWindow::end_time].
8748 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
8749 where
8750 T: std::convert::Into<wkt::Timestamp>,
8751 {
8752 self.end_time = v.map(|x| x.into());
8753 self
8754 }
8755}
8756
8757impl wkt::message::Message for TimeWindow {
8758 fn typename() -> &'static str {
8759 "type.googleapis.com/google.cloud.asset.v1.TimeWindow"
8760 }
8761}
8762
8763/// The enhanced metadata information for a resource.
8764#[derive(Clone, Default, PartialEq)]
8765#[non_exhaustive]
8766pub struct AssetEnrichment {
8767 pub enrichment_data: std::option::Option<crate::model::asset_enrichment::EnrichmentData>,
8768
8769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8770}
8771
8772impl AssetEnrichment {
8773 pub fn new() -> Self {
8774 std::default::Default::default()
8775 }
8776
8777 /// Sets the value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data].
8778 ///
8779 /// Note that all the setters affecting `enrichment_data` are mutually
8780 /// exclusive.
8781 pub fn set_enrichment_data<
8782 T: std::convert::Into<std::option::Option<crate::model::asset_enrichment::EnrichmentData>>,
8783 >(
8784 mut self,
8785 v: T,
8786 ) -> Self {
8787 self.enrichment_data = v.into();
8788 self
8789 }
8790
8791 /// The value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data]
8792 /// if it holds a `ResourceOwners`, `None` if the field is not set or
8793 /// holds a different branch.
8794 pub fn resource_owners(
8795 &self,
8796 ) -> std::option::Option<&std::boxed::Box<crate::model::ResourceOwners>> {
8797 #[allow(unreachable_patterns)]
8798 self.enrichment_data.as_ref().and_then(|v| match v {
8799 crate::model::asset_enrichment::EnrichmentData::ResourceOwners(v) => {
8800 std::option::Option::Some(v)
8801 }
8802 _ => std::option::Option::None,
8803 })
8804 }
8805
8806 /// Sets the value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data]
8807 /// to hold a `ResourceOwners`.
8808 ///
8809 /// Note that all the setters affecting `enrichment_data` are
8810 /// mutually exclusive.
8811 pub fn set_resource_owners<
8812 T: std::convert::Into<std::boxed::Box<crate::model::ResourceOwners>>,
8813 >(
8814 mut self,
8815 v: T,
8816 ) -> Self {
8817 self.enrichment_data = std::option::Option::Some(
8818 crate::model::asset_enrichment::EnrichmentData::ResourceOwners(v.into()),
8819 );
8820 self
8821 }
8822}
8823
8824impl wkt::message::Message for AssetEnrichment {
8825 fn typename() -> &'static str {
8826 "type.googleapis.com/google.cloud.asset.v1.AssetEnrichment"
8827 }
8828}
8829
8830/// Defines additional types related to [AssetEnrichment].
8831pub mod asset_enrichment {
8832 #[allow(unused_imports)]
8833 use super::*;
8834
8835 #[derive(Clone, Debug, PartialEq)]
8836 #[non_exhaustive]
8837 pub enum EnrichmentData {
8838 /// The resource owners for a resource.
8839 ///
8840 /// Note that this field only contains the members that have "roles/owner"
8841 /// role in the resource's IAM Policy.
8842 ResourceOwners(std::boxed::Box<crate::model::ResourceOwners>),
8843 }
8844}
8845
8846/// An asset in Google Cloud. An asset can be any resource in the Google Cloud
8847/// [resource
8848/// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
8849/// a resource outside the Google Cloud resource hierarchy (such as Google
8850/// Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy),
8851/// or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship).
8852/// See [Supported asset
8853/// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
8854/// for more information.
8855#[derive(Clone, Default, PartialEq)]
8856#[non_exhaustive]
8857pub struct Asset {
8858 /// The last update timestamp of an asset. update_time is updated when
8859 /// create/update/delete operation is performed.
8860 pub update_time: std::option::Option<wkt::Timestamp>,
8861
8862 /// The full name of the asset. Example:
8863 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
8864 ///
8865 /// See [Resource
8866 /// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
8867 /// for more information.
8868 pub name: std::string::String,
8869
8870 /// The type of the asset. Example: `compute.googleapis.com/Disk`
8871 ///
8872 /// See [Supported asset
8873 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
8874 /// for more information.
8875 pub asset_type: std::string::String,
8876
8877 /// A representation of the resource.
8878 pub resource: std::option::Option<crate::model::Resource>,
8879
8880 /// A representation of the IAM policy set on a Google Cloud resource.
8881 /// There can be a maximum of one IAM policy set on any given resource.
8882 /// In addition, IAM policies inherit their granted access scope from any
8883 /// policies set on parent resources in the resource hierarchy. Therefore, the
8884 /// effectively policy is the union of both the policy set on this resource
8885 /// and each policy set on all of the resource's ancestry resource levels in
8886 /// the hierarchy. See
8887 /// [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance)
8888 /// for more information.
8889 pub iam_policy: std::option::Option<iam_v1::model::Policy>,
8890
8891 /// A representation of an [organization
8892 /// policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy).
8893 /// There can be more than one organization policy with different constraints
8894 /// set on a given resource.
8895 pub org_policy: std::vec::Vec<orgpolicy_v1::model::Policy>,
8896
8897 /// A representation of runtime OS Inventory information. See [this
8898 /// topic](https://cloud.google.com/compute/docs/instances/os-inventory-management)
8899 /// for more information.
8900 pub os_inventory: std::option::Option<osconfig_v1::model::Inventory>,
8901
8902 /// DEPRECATED. This field only presents for the purpose of
8903 /// backward-compatibility. The server will never generate responses with this
8904 /// field.
8905 /// The related assets of the asset of one relationship type. One asset
8906 /// only represents one type of relationship.
8907 #[deprecated]
8908 pub related_assets: std::option::Option<crate::model::RelatedAssets>,
8909
8910 /// One related asset of the current asset.
8911 pub related_asset: std::option::Option<crate::model::RelatedAsset>,
8912
8913 /// The ancestry path of an asset in Google Cloud [resource
8914 /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
8915 /// represented as a list of relative resource names. An ancestry path starts
8916 /// with the closest ancestor in the hierarchy and ends at root. If the asset
8917 /// is a project, folder, or organization, the ancestry path starts from the
8918 /// asset itself.
8919 ///
8920 /// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
8921 pub ancestors: std::vec::Vec<std::string::String>,
8922
8923 /// A representation of an [access
8924 /// policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
8925 pub access_context_policy: std::option::Option<crate::model::asset::AccessContextPolicy>,
8926
8927 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8928}
8929
8930impl Asset {
8931 pub fn new() -> Self {
8932 std::default::Default::default()
8933 }
8934
8935 /// Sets the value of [update_time][crate::model::Asset::update_time].
8936 pub fn set_update_time<T>(mut self, v: T) -> Self
8937 where
8938 T: std::convert::Into<wkt::Timestamp>,
8939 {
8940 self.update_time = std::option::Option::Some(v.into());
8941 self
8942 }
8943
8944 /// Sets or clears the value of [update_time][crate::model::Asset::update_time].
8945 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8946 where
8947 T: std::convert::Into<wkt::Timestamp>,
8948 {
8949 self.update_time = v.map(|x| x.into());
8950 self
8951 }
8952
8953 /// Sets the value of [name][crate::model::Asset::name].
8954 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8955 self.name = v.into();
8956 self
8957 }
8958
8959 /// Sets the value of [asset_type][crate::model::Asset::asset_type].
8960 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8961 self.asset_type = v.into();
8962 self
8963 }
8964
8965 /// Sets the value of [resource][crate::model::Asset::resource].
8966 pub fn set_resource<T>(mut self, v: T) -> Self
8967 where
8968 T: std::convert::Into<crate::model::Resource>,
8969 {
8970 self.resource = std::option::Option::Some(v.into());
8971 self
8972 }
8973
8974 /// Sets or clears the value of [resource][crate::model::Asset::resource].
8975 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
8976 where
8977 T: std::convert::Into<crate::model::Resource>,
8978 {
8979 self.resource = v.map(|x| x.into());
8980 self
8981 }
8982
8983 /// Sets the value of [iam_policy][crate::model::Asset::iam_policy].
8984 pub fn set_iam_policy<T>(mut self, v: T) -> Self
8985 where
8986 T: std::convert::Into<iam_v1::model::Policy>,
8987 {
8988 self.iam_policy = std::option::Option::Some(v.into());
8989 self
8990 }
8991
8992 /// Sets or clears the value of [iam_policy][crate::model::Asset::iam_policy].
8993 pub fn set_or_clear_iam_policy<T>(mut self, v: std::option::Option<T>) -> Self
8994 where
8995 T: std::convert::Into<iam_v1::model::Policy>,
8996 {
8997 self.iam_policy = v.map(|x| x.into());
8998 self
8999 }
9000
9001 /// Sets the value of [org_policy][crate::model::Asset::org_policy].
9002 pub fn set_org_policy<T, V>(mut self, v: T) -> Self
9003 where
9004 T: std::iter::IntoIterator<Item = V>,
9005 V: std::convert::Into<orgpolicy_v1::model::Policy>,
9006 {
9007 use std::iter::Iterator;
9008 self.org_policy = v.into_iter().map(|i| i.into()).collect();
9009 self
9010 }
9011
9012 /// Sets the value of [os_inventory][crate::model::Asset::os_inventory].
9013 pub fn set_os_inventory<T>(mut self, v: T) -> Self
9014 where
9015 T: std::convert::Into<osconfig_v1::model::Inventory>,
9016 {
9017 self.os_inventory = std::option::Option::Some(v.into());
9018 self
9019 }
9020
9021 /// Sets or clears the value of [os_inventory][crate::model::Asset::os_inventory].
9022 pub fn set_or_clear_os_inventory<T>(mut self, v: std::option::Option<T>) -> Self
9023 where
9024 T: std::convert::Into<osconfig_v1::model::Inventory>,
9025 {
9026 self.os_inventory = v.map(|x| x.into());
9027 self
9028 }
9029
9030 /// Sets the value of [related_assets][crate::model::Asset::related_assets].
9031 #[deprecated]
9032 pub fn set_related_assets<T>(mut self, v: T) -> Self
9033 where
9034 T: std::convert::Into<crate::model::RelatedAssets>,
9035 {
9036 self.related_assets = std::option::Option::Some(v.into());
9037 self
9038 }
9039
9040 /// Sets or clears the value of [related_assets][crate::model::Asset::related_assets].
9041 #[deprecated]
9042 pub fn set_or_clear_related_assets<T>(mut self, v: std::option::Option<T>) -> Self
9043 where
9044 T: std::convert::Into<crate::model::RelatedAssets>,
9045 {
9046 self.related_assets = v.map(|x| x.into());
9047 self
9048 }
9049
9050 /// Sets the value of [related_asset][crate::model::Asset::related_asset].
9051 pub fn set_related_asset<T>(mut self, v: T) -> Self
9052 where
9053 T: std::convert::Into<crate::model::RelatedAsset>,
9054 {
9055 self.related_asset = std::option::Option::Some(v.into());
9056 self
9057 }
9058
9059 /// Sets or clears the value of [related_asset][crate::model::Asset::related_asset].
9060 pub fn set_or_clear_related_asset<T>(mut self, v: std::option::Option<T>) -> Self
9061 where
9062 T: std::convert::Into<crate::model::RelatedAsset>,
9063 {
9064 self.related_asset = v.map(|x| x.into());
9065 self
9066 }
9067
9068 /// Sets the value of [ancestors][crate::model::Asset::ancestors].
9069 pub fn set_ancestors<T, V>(mut self, v: T) -> Self
9070 where
9071 T: std::iter::IntoIterator<Item = V>,
9072 V: std::convert::Into<std::string::String>,
9073 {
9074 use std::iter::Iterator;
9075 self.ancestors = v.into_iter().map(|i| i.into()).collect();
9076 self
9077 }
9078
9079 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy].
9080 ///
9081 /// Note that all the setters affecting `access_context_policy` are mutually
9082 /// exclusive.
9083 pub fn set_access_context_policy<
9084 T: std::convert::Into<std::option::Option<crate::model::asset::AccessContextPolicy>>,
9085 >(
9086 mut self,
9087 v: T,
9088 ) -> Self {
9089 self.access_context_policy = v.into();
9090 self
9091 }
9092
9093 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
9094 /// if it holds a `AccessPolicy`, `None` if the field is not set or
9095 /// holds a different branch.
9096 pub fn access_policy(
9097 &self,
9098 ) -> std::option::Option<&std::boxed::Box<accesscontextmanager_v1::model::AccessPolicy>> {
9099 #[allow(unreachable_patterns)]
9100 self.access_context_policy.as_ref().and_then(|v| match v {
9101 crate::model::asset::AccessContextPolicy::AccessPolicy(v) => {
9102 std::option::Option::Some(v)
9103 }
9104 _ => std::option::Option::None,
9105 })
9106 }
9107
9108 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
9109 /// to hold a `AccessPolicy`.
9110 ///
9111 /// Note that all the setters affecting `access_context_policy` are
9112 /// mutually exclusive.
9113 pub fn set_access_policy<
9114 T: std::convert::Into<std::boxed::Box<accesscontextmanager_v1::model::AccessPolicy>>,
9115 >(
9116 mut self,
9117 v: T,
9118 ) -> Self {
9119 self.access_context_policy = std::option::Option::Some(
9120 crate::model::asset::AccessContextPolicy::AccessPolicy(v.into()),
9121 );
9122 self
9123 }
9124
9125 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
9126 /// if it holds a `AccessLevel`, `None` if the field is not set or
9127 /// holds a different branch.
9128 pub fn access_level(
9129 &self,
9130 ) -> std::option::Option<&std::boxed::Box<accesscontextmanager_v1::model::AccessLevel>> {
9131 #[allow(unreachable_patterns)]
9132 self.access_context_policy.as_ref().and_then(|v| match v {
9133 crate::model::asset::AccessContextPolicy::AccessLevel(v) => {
9134 std::option::Option::Some(v)
9135 }
9136 _ => std::option::Option::None,
9137 })
9138 }
9139
9140 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
9141 /// to hold a `AccessLevel`.
9142 ///
9143 /// Note that all the setters affecting `access_context_policy` are
9144 /// mutually exclusive.
9145 pub fn set_access_level<
9146 T: std::convert::Into<std::boxed::Box<accesscontextmanager_v1::model::AccessLevel>>,
9147 >(
9148 mut self,
9149 v: T,
9150 ) -> Self {
9151 self.access_context_policy = std::option::Option::Some(
9152 crate::model::asset::AccessContextPolicy::AccessLevel(v.into()),
9153 );
9154 self
9155 }
9156
9157 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
9158 /// if it holds a `ServicePerimeter`, `None` if the field is not set or
9159 /// holds a different branch.
9160 pub fn service_perimeter(
9161 &self,
9162 ) -> std::option::Option<&std::boxed::Box<accesscontextmanager_v1::model::ServicePerimeter>>
9163 {
9164 #[allow(unreachable_patterns)]
9165 self.access_context_policy.as_ref().and_then(|v| match v {
9166 crate::model::asset::AccessContextPolicy::ServicePerimeter(v) => {
9167 std::option::Option::Some(v)
9168 }
9169 _ => std::option::Option::None,
9170 })
9171 }
9172
9173 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
9174 /// to hold a `ServicePerimeter`.
9175 ///
9176 /// Note that all the setters affecting `access_context_policy` are
9177 /// mutually exclusive.
9178 pub fn set_service_perimeter<
9179 T: std::convert::Into<std::boxed::Box<accesscontextmanager_v1::model::ServicePerimeter>>,
9180 >(
9181 mut self,
9182 v: T,
9183 ) -> Self {
9184 self.access_context_policy = std::option::Option::Some(
9185 crate::model::asset::AccessContextPolicy::ServicePerimeter(v.into()),
9186 );
9187 self
9188 }
9189}
9190
9191impl wkt::message::Message for Asset {
9192 fn typename() -> &'static str {
9193 "type.googleapis.com/google.cloud.asset.v1.Asset"
9194 }
9195}
9196
9197/// Defines additional types related to [Asset].
9198pub mod asset {
9199 #[allow(unused_imports)]
9200 use super::*;
9201
9202 /// A representation of an [access
9203 /// policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
9204 #[derive(Clone, Debug, PartialEq)]
9205 #[non_exhaustive]
9206 pub enum AccessContextPolicy {
9207 /// Also refer to the [access policy user
9208 /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
9209 AccessPolicy(std::boxed::Box<accesscontextmanager_v1::model::AccessPolicy>),
9210 /// Also refer to the [access level user
9211 /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).
9212 AccessLevel(std::boxed::Box<accesscontextmanager_v1::model::AccessLevel>),
9213 /// Also refer to the [service perimeter user
9214 /// guide](https://cloud.google.com/vpc-service-controls/docs/overview).
9215 ServicePerimeter(std::boxed::Box<accesscontextmanager_v1::model::ServicePerimeter>),
9216 }
9217}
9218
9219/// A representation of a Google Cloud resource.
9220#[derive(Clone, Default, PartialEq)]
9221#[non_exhaustive]
9222pub struct Resource {
9223 /// The API version. Example: `v1`
9224 pub version: std::string::String,
9225
9226 /// The URL of the discovery document containing the resource's JSON schema.
9227 /// Example:
9228 /// `<https://www.googleapis.com/discovery/v1/apis/compute/v1/rest>`
9229 ///
9230 /// This value is unspecified for resources that do not have an API based on a
9231 /// discovery document, such as Cloud Bigtable.
9232 pub discovery_document_uri: std::string::String,
9233
9234 /// The JSON schema name listed in the discovery document. Example:
9235 /// `Project`
9236 ///
9237 /// This value is unspecified for resources that do not have an API based on a
9238 /// discovery document, such as Cloud Bigtable.
9239 pub discovery_name: std::string::String,
9240
9241 /// The REST URL for accessing the resource. An HTTP `GET` request using this
9242 /// URL returns the resource itself. Example:
9243 /// `<https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123>`
9244 ///
9245 /// This value is unspecified for resources without a REST API.
9246 pub resource_url: std::string::String,
9247
9248 /// The full name of the immediate parent of this resource. See
9249 /// [Resource
9250 /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
9251 /// for more information.
9252 ///
9253 /// For Google Cloud assets, this value is the parent resource defined in the
9254 /// [IAM policy
9255 /// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy).
9256 /// Example:
9257 /// `//cloudresourcemanager.googleapis.com/projects/my_project_123`
9258 pub parent: std::string::String,
9259
9260 /// The content of the resource, in which some sensitive fields are removed
9261 /// and may not be present.
9262 pub data: std::option::Option<wkt::Struct>,
9263
9264 /// The location of the resource in Google Cloud, such as its zone and region.
9265 /// For more information, see <https://cloud.google.com/about/locations/>.
9266 pub location: std::string::String,
9267
9268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9269}
9270
9271impl Resource {
9272 pub fn new() -> Self {
9273 std::default::Default::default()
9274 }
9275
9276 /// Sets the value of [version][crate::model::Resource::version].
9277 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9278 self.version = v.into();
9279 self
9280 }
9281
9282 /// Sets the value of [discovery_document_uri][crate::model::Resource::discovery_document_uri].
9283 pub fn set_discovery_document_uri<T: std::convert::Into<std::string::String>>(
9284 mut self,
9285 v: T,
9286 ) -> Self {
9287 self.discovery_document_uri = v.into();
9288 self
9289 }
9290
9291 /// Sets the value of [discovery_name][crate::model::Resource::discovery_name].
9292 pub fn set_discovery_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9293 self.discovery_name = v.into();
9294 self
9295 }
9296
9297 /// Sets the value of [resource_url][crate::model::Resource::resource_url].
9298 pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9299 self.resource_url = v.into();
9300 self
9301 }
9302
9303 /// Sets the value of [parent][crate::model::Resource::parent].
9304 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9305 self.parent = v.into();
9306 self
9307 }
9308
9309 /// Sets the value of [data][crate::model::Resource::data].
9310 pub fn set_data<T>(mut self, v: T) -> Self
9311 where
9312 T: std::convert::Into<wkt::Struct>,
9313 {
9314 self.data = std::option::Option::Some(v.into());
9315 self
9316 }
9317
9318 /// Sets or clears the value of [data][crate::model::Resource::data].
9319 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
9320 where
9321 T: std::convert::Into<wkt::Struct>,
9322 {
9323 self.data = v.map(|x| x.into());
9324 self
9325 }
9326
9327 /// Sets the value of [location][crate::model::Resource::location].
9328 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9329 self.location = v.into();
9330 self
9331 }
9332}
9333
9334impl wkt::message::Message for Resource {
9335 fn typename() -> &'static str {
9336 "type.googleapis.com/google.cloud.asset.v1.Resource"
9337 }
9338}
9339
9340/// DEPRECATED. This message only presents for the purpose of
9341/// backward-compatibility. The server will never populate this message in
9342/// responses.
9343/// The detailed related assets with the `relationship_type`.
9344#[derive(Clone, Default, PartialEq)]
9345#[non_exhaustive]
9346#[deprecated]
9347pub struct RelatedAssets {
9348 /// The detailed relationship attributes.
9349 pub relationship_attributes: std::option::Option<crate::model::RelationshipAttributes>,
9350
9351 /// The peer resources of the relationship.
9352 pub assets: std::vec::Vec<crate::model::RelatedAsset>,
9353
9354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9355}
9356
9357impl RelatedAssets {
9358 pub fn new() -> Self {
9359 std::default::Default::default()
9360 }
9361
9362 /// Sets the value of [relationship_attributes][crate::model::RelatedAssets::relationship_attributes].
9363 pub fn set_relationship_attributes<T>(mut self, v: T) -> Self
9364 where
9365 T: std::convert::Into<crate::model::RelationshipAttributes>,
9366 {
9367 self.relationship_attributes = std::option::Option::Some(v.into());
9368 self
9369 }
9370
9371 /// Sets or clears the value of [relationship_attributes][crate::model::RelatedAssets::relationship_attributes].
9372 pub fn set_or_clear_relationship_attributes<T>(mut self, v: std::option::Option<T>) -> Self
9373 where
9374 T: std::convert::Into<crate::model::RelationshipAttributes>,
9375 {
9376 self.relationship_attributes = v.map(|x| x.into());
9377 self
9378 }
9379
9380 /// Sets the value of [assets][crate::model::RelatedAssets::assets].
9381 pub fn set_assets<T, V>(mut self, v: T) -> Self
9382 where
9383 T: std::iter::IntoIterator<Item = V>,
9384 V: std::convert::Into<crate::model::RelatedAsset>,
9385 {
9386 use std::iter::Iterator;
9387 self.assets = v.into_iter().map(|i| i.into()).collect();
9388 self
9389 }
9390}
9391
9392impl wkt::message::Message for RelatedAssets {
9393 fn typename() -> &'static str {
9394 "type.googleapis.com/google.cloud.asset.v1.RelatedAssets"
9395 }
9396}
9397
9398/// DEPRECATED. This message only presents for the purpose of
9399/// backward-compatibility. The server will never populate this message in
9400/// responses.
9401/// The relationship attributes which include `type`, `source_resource_type`,
9402/// `target_resource_type` and `action`.
9403#[derive(Clone, Default, PartialEq)]
9404#[non_exhaustive]
9405#[deprecated]
9406pub struct RelationshipAttributes {
9407 /// The unique identifier of the relationship type. Example:
9408 /// `INSTANCE_TO_INSTANCEGROUP`
9409 pub r#type: std::string::String,
9410
9411 /// The source asset type. Example: `compute.googleapis.com/Instance`
9412 pub source_resource_type: std::string::String,
9413
9414 /// The target asset type. Example: `compute.googleapis.com/Disk`
9415 pub target_resource_type: std::string::String,
9416
9417 /// The detail of the relationship, e.g. `contains`, `attaches`
9418 pub action: std::string::String,
9419
9420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9421}
9422
9423impl RelationshipAttributes {
9424 pub fn new() -> Self {
9425 std::default::Default::default()
9426 }
9427
9428 /// Sets the value of [r#type][crate::model::RelationshipAttributes::type].
9429 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9430 self.r#type = v.into();
9431 self
9432 }
9433
9434 /// Sets the value of [source_resource_type][crate::model::RelationshipAttributes::source_resource_type].
9435 pub fn set_source_resource_type<T: std::convert::Into<std::string::String>>(
9436 mut self,
9437 v: T,
9438 ) -> Self {
9439 self.source_resource_type = v.into();
9440 self
9441 }
9442
9443 /// Sets the value of [target_resource_type][crate::model::RelationshipAttributes::target_resource_type].
9444 pub fn set_target_resource_type<T: std::convert::Into<std::string::String>>(
9445 mut self,
9446 v: T,
9447 ) -> Self {
9448 self.target_resource_type = v.into();
9449 self
9450 }
9451
9452 /// Sets the value of [action][crate::model::RelationshipAttributes::action].
9453 pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9454 self.action = v.into();
9455 self
9456 }
9457}
9458
9459impl wkt::message::Message for RelationshipAttributes {
9460 fn typename() -> &'static str {
9461 "type.googleapis.com/google.cloud.asset.v1.RelationshipAttributes"
9462 }
9463}
9464
9465/// An asset identifier in Google Cloud which contains its name, type and
9466/// ancestors. An asset can be any resource in the Google Cloud [resource
9467/// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
9468/// a resource outside the Google Cloud resource hierarchy (such as Google
9469/// Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy).
9470/// See [Supported asset
9471/// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
9472/// for more information.
9473#[derive(Clone, Default, PartialEq)]
9474#[non_exhaustive]
9475pub struct RelatedAsset {
9476 /// The full name of the asset. Example:
9477 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
9478 ///
9479 /// See [Resource
9480 /// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
9481 /// for more information.
9482 pub asset: std::string::String,
9483
9484 /// The type of the asset. Example: `compute.googleapis.com/Disk`
9485 ///
9486 /// See [Supported asset
9487 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
9488 /// for more information.
9489 pub asset_type: std::string::String,
9490
9491 /// The ancestors of an asset in Google Cloud [resource
9492 /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
9493 /// represented as a list of relative resource names. An ancestry path starts
9494 /// with the closest ancestor in the hierarchy and ends at root.
9495 ///
9496 /// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
9497 pub ancestors: std::vec::Vec<std::string::String>,
9498
9499 /// The unique identifier of the relationship type. Example:
9500 /// `INSTANCE_TO_INSTANCEGROUP`
9501 pub relationship_type: std::string::String,
9502
9503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9504}
9505
9506impl RelatedAsset {
9507 pub fn new() -> Self {
9508 std::default::Default::default()
9509 }
9510
9511 /// Sets the value of [asset][crate::model::RelatedAsset::asset].
9512 pub fn set_asset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9513 self.asset = v.into();
9514 self
9515 }
9516
9517 /// Sets the value of [asset_type][crate::model::RelatedAsset::asset_type].
9518 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9519 self.asset_type = v.into();
9520 self
9521 }
9522
9523 /// Sets the value of [ancestors][crate::model::RelatedAsset::ancestors].
9524 pub fn set_ancestors<T, V>(mut self, v: T) -> Self
9525 where
9526 T: std::iter::IntoIterator<Item = V>,
9527 V: std::convert::Into<std::string::String>,
9528 {
9529 use std::iter::Iterator;
9530 self.ancestors = v.into_iter().map(|i| i.into()).collect();
9531 self
9532 }
9533
9534 /// Sets the value of [relationship_type][crate::model::RelatedAsset::relationship_type].
9535 pub fn set_relationship_type<T: std::convert::Into<std::string::String>>(
9536 mut self,
9537 v: T,
9538 ) -> Self {
9539 self.relationship_type = v.into();
9540 self
9541 }
9542}
9543
9544impl wkt::message::Message for RelatedAsset {
9545 fn typename() -> &'static str {
9546 "type.googleapis.com/google.cloud.asset.v1.RelatedAsset"
9547 }
9548}
9549
9550/// The key and value for a
9551/// [tag](https://cloud.google.com/resource-manager/docs/tags/tags-overview).
9552#[derive(Clone, Default, PartialEq)]
9553#[non_exhaustive]
9554pub struct Tag {
9555 /// TagKey namespaced name, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}.
9556 pub tag_key: std::option::Option<std::string::String>,
9557
9558 /// TagKey ID, in the format of tagKeys/{TAG_KEY_ID}.
9559 pub tag_key_id: std::option::Option<std::string::String>,
9560
9561 /// TagValue namespaced name, in the format of
9562 /// {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}.
9563 pub tag_value: std::option::Option<std::string::String>,
9564
9565 /// TagValue ID, in the format of tagValues/{TAG_VALUE_ID}.
9566 pub tag_value_id: std::option::Option<std::string::String>,
9567
9568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9569}
9570
9571impl Tag {
9572 pub fn new() -> Self {
9573 std::default::Default::default()
9574 }
9575
9576 /// Sets the value of [tag_key][crate::model::Tag::tag_key].
9577 pub fn set_tag_key<T>(mut self, v: T) -> Self
9578 where
9579 T: std::convert::Into<std::string::String>,
9580 {
9581 self.tag_key = std::option::Option::Some(v.into());
9582 self
9583 }
9584
9585 /// Sets or clears the value of [tag_key][crate::model::Tag::tag_key].
9586 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
9587 where
9588 T: std::convert::Into<std::string::String>,
9589 {
9590 self.tag_key = v.map(|x| x.into());
9591 self
9592 }
9593
9594 /// Sets the value of [tag_key_id][crate::model::Tag::tag_key_id].
9595 pub fn set_tag_key_id<T>(mut self, v: T) -> Self
9596 where
9597 T: std::convert::Into<std::string::String>,
9598 {
9599 self.tag_key_id = std::option::Option::Some(v.into());
9600 self
9601 }
9602
9603 /// Sets or clears the value of [tag_key_id][crate::model::Tag::tag_key_id].
9604 pub fn set_or_clear_tag_key_id<T>(mut self, v: std::option::Option<T>) -> Self
9605 where
9606 T: std::convert::Into<std::string::String>,
9607 {
9608 self.tag_key_id = v.map(|x| x.into());
9609 self
9610 }
9611
9612 /// Sets the value of [tag_value][crate::model::Tag::tag_value].
9613 pub fn set_tag_value<T>(mut self, v: T) -> Self
9614 where
9615 T: std::convert::Into<std::string::String>,
9616 {
9617 self.tag_value = std::option::Option::Some(v.into());
9618 self
9619 }
9620
9621 /// Sets or clears the value of [tag_value][crate::model::Tag::tag_value].
9622 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
9623 where
9624 T: std::convert::Into<std::string::String>,
9625 {
9626 self.tag_value = v.map(|x| x.into());
9627 self
9628 }
9629
9630 /// Sets the value of [tag_value_id][crate::model::Tag::tag_value_id].
9631 pub fn set_tag_value_id<T>(mut self, v: T) -> Self
9632 where
9633 T: std::convert::Into<std::string::String>,
9634 {
9635 self.tag_value_id = std::option::Option::Some(v.into());
9636 self
9637 }
9638
9639 /// Sets or clears the value of [tag_value_id][crate::model::Tag::tag_value_id].
9640 pub fn set_or_clear_tag_value_id<T>(mut self, v: std::option::Option<T>) -> Self
9641 where
9642 T: std::convert::Into<std::string::String>,
9643 {
9644 self.tag_value_id = v.map(|x| x.into());
9645 self
9646 }
9647}
9648
9649impl wkt::message::Message for Tag {
9650 fn typename() -> &'static str {
9651 "type.googleapis.com/google.cloud.asset.v1.Tag"
9652 }
9653}
9654
9655/// The effective tags and the ancestor resources from which they were inherited.
9656#[derive(Clone, Default, PartialEq)]
9657#[non_exhaustive]
9658pub struct EffectiveTagDetails {
9659 /// The [full resource
9660 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
9661 /// of the ancestor from which
9662 /// [effective_tags][google.cloud.asset.v1.EffectiveTagDetails.effective_tags]
9663 /// are inherited, according to [tag
9664 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
9665 ///
9666 /// [google.cloud.asset.v1.EffectiveTagDetails.effective_tags]: crate::model::EffectiveTagDetails::effective_tags
9667 pub attached_resource: std::option::Option<std::string::String>,
9668
9669 /// The effective tags inherited from the
9670 /// [attached_resource][google.cloud.asset.v1.EffectiveTagDetails.attached_resource].
9671 /// Note that tags with the same key but different values may attach to
9672 /// resources at a different hierarchy levels. The lower hierarchy tag value
9673 /// will overwrite the higher hierarchy tag value of the same tag key. In this
9674 /// case, the tag value at the higher hierarchy level will be removed. For more
9675 /// information, see [tag
9676 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
9677 ///
9678 /// [google.cloud.asset.v1.EffectiveTagDetails.attached_resource]: crate::model::EffectiveTagDetails::attached_resource
9679 pub effective_tags: std::vec::Vec<crate::model::Tag>,
9680
9681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9682}
9683
9684impl EffectiveTagDetails {
9685 pub fn new() -> Self {
9686 std::default::Default::default()
9687 }
9688
9689 /// Sets the value of [attached_resource][crate::model::EffectiveTagDetails::attached_resource].
9690 pub fn set_attached_resource<T>(mut self, v: T) -> Self
9691 where
9692 T: std::convert::Into<std::string::String>,
9693 {
9694 self.attached_resource = std::option::Option::Some(v.into());
9695 self
9696 }
9697
9698 /// Sets or clears the value of [attached_resource][crate::model::EffectiveTagDetails::attached_resource].
9699 pub fn set_or_clear_attached_resource<T>(mut self, v: std::option::Option<T>) -> Self
9700 where
9701 T: std::convert::Into<std::string::String>,
9702 {
9703 self.attached_resource = v.map(|x| x.into());
9704 self
9705 }
9706
9707 /// Sets the value of [effective_tags][crate::model::EffectiveTagDetails::effective_tags].
9708 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
9709 where
9710 T: std::iter::IntoIterator<Item = V>,
9711 V: std::convert::Into<crate::model::Tag>,
9712 {
9713 use std::iter::Iterator;
9714 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
9715 self
9716 }
9717}
9718
9719impl wkt::message::Message for EffectiveTagDetails {
9720 fn typename() -> &'static str {
9721 "type.googleapis.com/google.cloud.asset.v1.EffectiveTagDetails"
9722 }
9723}
9724
9725/// A result of Resource Search, containing information of a cloud resource.
9726#[derive(Clone, Default, PartialEq)]
9727#[non_exhaustive]
9728pub struct ResourceSearchResult {
9729 /// The full resource name of this resource. Example:
9730 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
9731 /// See [Cloud Asset Inventory Resource Name
9732 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
9733 /// for more information.
9734 ///
9735 /// To search against the `name`:
9736 ///
9737 /// * Use a field query. Example: `name:instance1`
9738 /// * Use a free text query. Example: `instance1`
9739 pub name: std::string::String,
9740
9741 /// The type of this resource. Example: `compute.googleapis.com/Disk`.
9742 ///
9743 /// To search against the `asset_type`:
9744 ///
9745 /// * Specify the `asset_type` field in your search request.
9746 pub asset_type: std::string::String,
9747
9748 /// The project that this resource belongs to, in the form of
9749 /// projects/{PROJECT_NUMBER}. This field is available when the resource
9750 /// belongs to a project.
9751 ///
9752 /// To search against `project`:
9753 ///
9754 /// * Use a field query. Example: `project:12345`
9755 /// * Use a free text query. Example: `12345`
9756 /// * Specify the `scope` field as this project in your search request.
9757 pub project: std::string::String,
9758
9759 /// The folder(s) that this resource belongs to, in the form of
9760 /// folders/{FOLDER_NUMBER}. This field is available when the resource
9761 /// belongs to one or more folders.
9762 ///
9763 /// To search against `folders`:
9764 ///
9765 /// * Use a field query. Example: `folders:(123 OR 456)`
9766 /// * Use a free text query. Example: `123`
9767 /// * Specify the `scope` field as this folder in your search request.
9768 pub folders: std::vec::Vec<std::string::String>,
9769
9770 /// The organization that this resource belongs to, in the form of
9771 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
9772 /// resource belongs to an organization.
9773 ///
9774 /// To search against `organization`:
9775 ///
9776 /// * Use a field query. Example: `organization:123`
9777 /// * Use a free text query. Example: `123`
9778 /// * Specify the `scope` field as this organization in your search request.
9779 pub organization: std::string::String,
9780
9781 /// The display name of this resource. This field is available only when the
9782 /// resource's Protobuf contains it.
9783 ///
9784 /// To search against the `display_name`:
9785 ///
9786 /// * Use a field query. Example: `displayName:"My Instance"`
9787 /// * Use a free text query. Example: `"My Instance"`
9788 pub display_name: std::string::String,
9789
9790 /// One or more paragraphs of text description of this resource. Maximum length
9791 /// could be up to 1M bytes. This field is available only when the resource's
9792 /// Protobuf contains it.
9793 ///
9794 /// To search against the `description`:
9795 ///
9796 /// * Use a field query. Example: `description:"important instance"`
9797 /// * Use a free text query. Example: `"important instance"`
9798 pub description: std::string::String,
9799
9800 /// Location can be `global`, regional like `us-east1`, or zonal like
9801 /// `us-west1-b`. This field is available only when the resource's Protobuf
9802 /// contains it.
9803 ///
9804 /// To search against the `location`:
9805 ///
9806 /// * Use a field query. Example: `location:us-west*`
9807 /// * Use a free text query. Example: `us-west*`
9808 pub location: std::string::String,
9809
9810 /// User labels associated with this resource. See [Labelling and grouping
9811 /// Google Cloud
9812 /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
9813 /// for more information. This field is available only when the resource's
9814 /// Protobuf contains it.
9815 ///
9816 /// To search against the `labels`:
9817 ///
9818 /// * Use a field query:
9819 /// - query on any label's key or value. Example: `labels:prod`
9820 /// - query by a given label. Example: `labels.env:prod`
9821 /// - query by a given label's existence. Example: `labels.env:*`
9822 /// * Use a free text query. Example: `prod`
9823 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9824
9825 /// Network tags associated with this resource. Like labels, network tags are a
9826 /// type of annotations used to group Google Cloud resources. See [Labelling
9827 /// Google Cloud
9828 /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
9829 /// for more information. This field is available only when the resource's
9830 /// Protobuf contains it.
9831 ///
9832 /// To search against the `network_tags`:
9833 ///
9834 /// * Use a field query. Example: `networkTags:internal`
9835 /// * Use a free text query. Example: `internal`
9836 pub network_tags: std::vec::Vec<std::string::String>,
9837
9838 /// The Cloud KMS
9839 /// [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys)
9840 /// name or
9841 /// [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions)
9842 /// name.
9843 ///
9844 /// This field only presents for the purpose of backward compatibility.
9845 /// Use the `kms_keys` field to retrieve Cloud KMS key information. This field
9846 /// is available only when the resource's Protobuf contains it and will only be
9847 /// populated for [these resource
9848 /// types](https://cloud.google.com/asset-inventory/docs/legacy-field-names#resource_types_with_the_to_be_deprecated_kmskey_field)
9849 /// for backward compatible purposes.
9850 ///
9851 /// To search against the `kms_key`:
9852 ///
9853 /// * Use a field query. Example: `kmsKey:key`
9854 /// * Use a free text query. Example: `key`
9855 #[deprecated]
9856 pub kms_key: std::string::String,
9857
9858 /// The Cloud KMS
9859 /// [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys)
9860 /// names or
9861 /// [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions)
9862 /// names. This field is available only when the resource's Protobuf contains
9863 /// it.
9864 ///
9865 /// To search against the `kms_keys`:
9866 ///
9867 /// * Use a field query. Example: `kmsKeys:key`
9868 /// * Use a free text query. Example: `key`
9869 pub kms_keys: std::vec::Vec<std::string::String>,
9870
9871 /// The create timestamp of this resource, at which the resource was created.
9872 /// The granularity is in seconds. Timestamp.nanos will always be 0. This field
9873 /// is available only when the resource's Protobuf contains it.
9874 ///
9875 /// To search against `create_time`:
9876 ///
9877 /// * Use a field query.
9878 /// - value in seconds since unix epoch. Example: `createTime > 1609459200`
9879 /// - value in date string. Example: `createTime > 2021-01-01`
9880 /// - value in date-time string (must be quoted). Example: `createTime >
9881 /// "2021-01-01T00:00:00"`
9882 pub create_time: std::option::Option<wkt::Timestamp>,
9883
9884 /// The last update timestamp of this resource, at which the resource was last
9885 /// modified or deleted. The granularity is in seconds. Timestamp.nanos will
9886 /// always be 0. This field is available only when the resource's Protobuf
9887 /// contains it.
9888 ///
9889 /// To search against `update_time`:
9890 ///
9891 /// * Use a field query.
9892 /// - value in seconds since unix epoch. Example: `updateTime < 1609459200`
9893 /// - value in date string. Example: `updateTime < 2021-01-01`
9894 /// - value in date-time string (must be quoted). Example: `updateTime <
9895 /// "2021-01-01T00:00:00"`
9896 pub update_time: std::option::Option<wkt::Timestamp>,
9897
9898 /// The state of this resource. Different resources types have different state
9899 /// definitions that are mapped from various fields of different resource
9900 /// types. This field is available only when the resource's Protobuf contains
9901 /// it.
9902 ///
9903 /// Example:
9904 /// If the resource is an instance provided by Compute Engine,
9905 /// its state will include PROVISIONING, STAGING, RUNNING, STOPPING,
9906 /// SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See `status` definition
9907 /// in [API
9908 /// Reference](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
9909 /// If the resource is a project provided by Resource Manager, its state
9910 /// will include LIFECYCLE_STATE_UNSPECIFIED, ACTIVE, DELETE_REQUESTED and
9911 /// DELETE_IN_PROGRESS. See `lifecycleState` definition in [API
9912 /// Reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects).
9913 ///
9914 /// To search against the `state`:
9915 ///
9916 /// * Use a field query. Example: `state:RUNNING`
9917 /// * Use a free text query. Example: `RUNNING`
9918 pub state: std::string::String,
9919
9920 /// The additional searchable attributes of this resource. The attributes may
9921 /// vary from one resource type to another. Examples: `projectId` for Project,
9922 /// `dnsName` for DNS ManagedZone. This field contains a subset of the resource
9923 /// metadata fields that are returned by the List or Get APIs provided by the
9924 /// corresponding Google Cloud service (e.g., Compute Engine). see [API
9925 /// references and supported searchable
9926 /// attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
9927 /// to see which fields are included.
9928 ///
9929 /// You can search values of these fields through free text search. However,
9930 /// you should not consume the field programically as the field names and
9931 /// values may change as the Google Cloud service updates to a new incompatible
9932 /// API version.
9933 ///
9934 /// To search against the `additional_attributes`:
9935 ///
9936 /// * Use a free text query to match the attributes values. Example: to search
9937 /// `additional_attributes = { dnsName: "foobar" }`, you can issue a query
9938 /// `foobar`.
9939 pub additional_attributes: std::option::Option<wkt::Struct>,
9940
9941 /// The full resource name of this resource's parent, if it has one.
9942 /// To search against the `parent_full_resource_name`:
9943 ///
9944 /// * Use a field query. Example:
9945 /// `parentFullResourceName:"project-name"`
9946 /// * Use a free text query. Example:
9947 /// `project-name`
9948 pub parent_full_resource_name: std::string::String,
9949
9950 /// Versioned resource representations of this resource. This is repeated
9951 /// because there could be multiple versions of resource representations during
9952 /// version migration.
9953 ///
9954 /// This `versioned_resources` field is not searchable. Some attributes of the
9955 /// resource representations are exposed in `additional_attributes` field, so
9956 /// as to allow users to search on them.
9957 pub versioned_resources: std::vec::Vec<crate::model::VersionedResource>,
9958
9959 /// Attached resources of this resource. For example, an OSConfig
9960 /// Inventory is an attached resource of a Compute Instance. This field is
9961 /// repeated because a resource could have multiple attached resources.
9962 ///
9963 /// This `attached_resources` field is not searchable. Some attributes
9964 /// of the attached resources are exposed in `additional_attributes` field, so
9965 /// as to allow users to search on them.
9966 pub attached_resources: std::vec::Vec<crate::model::AttachedResource>,
9967
9968 /// A map of related resources of this resource, keyed by the
9969 /// relationship type. A relationship type is in the format of
9970 /// {SourceType}_{ACTION}_{DestType}. Example: `DISK_TO_INSTANCE`,
9971 /// `DISK_TO_NETWORK`, `INSTANCE_TO_INSTANCEGROUP`.
9972 /// See [supported relationship
9973 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types).
9974 pub relationships:
9975 std::collections::HashMap<std::string::String, crate::model::RelatedResources>,
9976
9977 /// This field is only present for the purpose of backward compatibility.
9978 /// Use the `tags` field instead.
9979 ///
9980 /// TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}.
9981 /// To search against the `tagKeys`:
9982 ///
9983 /// * Use a field query. Example:
9984 ///
9985 /// - `tagKeys:"123456789/env*"`
9986 /// - `tagKeys="123456789/env"`
9987 /// - `tagKeys:"env"`
9988 /// * Use a free text query. Example:
9989 ///
9990 /// - `env`
9991 #[deprecated]
9992 pub tag_keys: std::vec::Vec<std::string::String>,
9993
9994 /// This field is only present for the purpose of backward compatibility.
9995 /// Use the `tags` field instead.
9996 ///
9997 /// TagValue namespaced names, in the format of
9998 /// {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}.
9999 /// To search against the `tagValues`:
10000 ///
10001 /// * Use a field query. Example:
10002 ///
10003 /// - `tagValues:"env"`
10004 /// - `tagValues:"env/prod"`
10005 /// - `tagValues:"123456789/env/prod*"`
10006 /// - `tagValues="123456789/env/prod"`
10007 /// * Use a free text query. Example:
10008 ///
10009 /// - `prod`
10010 #[deprecated]
10011 pub tag_values: std::vec::Vec<std::string::String>,
10012
10013 /// This field is only present for the purpose of backward compatibility.
10014 /// Use the `tags` field instead.
10015 ///
10016 /// TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}.
10017 /// To search against the `tagValueIds`:
10018 ///
10019 /// * Use a field query. Example:
10020 ///
10021 /// - `tagValueIds="tagValues/456"`
10022 /// * Use a free text query. Example:
10023 ///
10024 /// - `456`
10025 #[deprecated]
10026 pub tag_value_ids: std::vec::Vec<std::string::String>,
10027
10028 /// The tags directly attached to this resource.
10029 ///
10030 /// To search against the `tags`:
10031 ///
10032 /// * Use a field query. Example:
10033 ///
10034 /// - `tagKeys:"123456789/env*"`
10035 /// - `tagKeys="123456789/env"`
10036 /// - `tagKeys:"env"`
10037 /// - `tagKeyIds="tagKeys/123"`
10038 /// - `tagValues:"env"`
10039 /// - `tagValues:"env/prod"`
10040 /// - `tagValues:"123456789/env/prod*"`
10041 /// - `tagValues="123456789/env/prod"`
10042 /// - `tagValueIds="tagValues/456"`
10043 /// * Use a free text query. Example:
10044 ///
10045 /// - `env/prod`
10046 pub tags: std::vec::Vec<crate::model::Tag>,
10047
10048 /// The effective tags on this resource. All of the tags that are both attached
10049 /// to and inherited by a resource are collectively called the effective
10050 /// tags. For more information, see [tag
10051 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
10052 ///
10053 /// To search against the `effective_tags`:
10054 ///
10055 /// * Use a field query. Example:
10056 /// - `effectiveTagKeys:"123456789/env*"`
10057 /// - `effectiveTagKeys="123456789/env"`
10058 /// - `effectiveTagKeys:"env"`
10059 /// - `effectiveTagKeyIds="tagKeys/123"`
10060 /// - `effectiveTagValues:"env"`
10061 /// - `effectiveTagValues:"env/prod"`
10062 /// - `effectiveTagValues:"123456789/env/prod*"`
10063 /// - `effectiveTagValues="123456789/env/prod"`
10064 /// - `effectiveTagValueIds="tagValues/456"`
10065 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
10066
10067 /// Enrichments of the asset. Currently supported enrichment types with
10068 /// SearchAllResources API:
10069 ///
10070 /// * RESOURCE_OWNERS
10071 ///
10072 /// The corresponding read masks in order to get the enrichment:
10073 ///
10074 /// * enrichments.resource_owners
10075 ///
10076 /// The corresponding required permissions:
10077 ///
10078 /// * cloudasset.assets.searchEnrichmentResourceOwners
10079 ///
10080 /// Example query to get resource owner enrichment:
10081 ///
10082 /// ```norust
10083 /// scope: "projects/my-project"
10084 /// query: "name: my-project"
10085 /// assetTypes: "cloudresourcemanager.googleapis.com/Project"
10086 /// readMask: {
10087 /// paths: "asset_type"
10088 /// paths: "name"
10089 /// paths: "enrichments.resource_owners"
10090 /// }
10091 /// ```
10092 pub enrichments: std::vec::Vec<crate::model::AssetEnrichment>,
10093
10094 /// The type of this resource's immediate parent, if there is one.
10095 ///
10096 /// To search against the `parent_asset_type`:
10097 ///
10098 /// * Use a field query. Example:
10099 /// `parentAssetType:"cloudresourcemanager.googleapis.com/Project"`
10100 /// * Use a free text query. Example:
10101 /// `cloudresourcemanager.googleapis.com/Project`
10102 pub parent_asset_type: std::string::String,
10103
10104 /// The actual content of Security Command Center security marks associated
10105 /// with the asset.
10106 ///
10107 /// To search against SCC SecurityMarks field:
10108 ///
10109 /// * Use a field query:
10110 /// - query by a given key value pair. Example: `sccSecurityMarks.foo=bar`
10111 /// - query by a given key's existence. Example: `sccSecurityMarks.foo:*`
10112 pub scc_security_marks: std::collections::HashMap<std::string::String, std::string::String>,
10113
10114 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10115}
10116
10117impl ResourceSearchResult {
10118 pub fn new() -> Self {
10119 std::default::Default::default()
10120 }
10121
10122 /// Sets the value of [name][crate::model::ResourceSearchResult::name].
10123 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10124 self.name = v.into();
10125 self
10126 }
10127
10128 /// Sets the value of [asset_type][crate::model::ResourceSearchResult::asset_type].
10129 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10130 self.asset_type = v.into();
10131 self
10132 }
10133
10134 /// Sets the value of [project][crate::model::ResourceSearchResult::project].
10135 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10136 self.project = v.into();
10137 self
10138 }
10139
10140 /// Sets the value of [folders][crate::model::ResourceSearchResult::folders].
10141 pub fn set_folders<T, V>(mut self, v: T) -> Self
10142 where
10143 T: std::iter::IntoIterator<Item = V>,
10144 V: std::convert::Into<std::string::String>,
10145 {
10146 use std::iter::Iterator;
10147 self.folders = v.into_iter().map(|i| i.into()).collect();
10148 self
10149 }
10150
10151 /// Sets the value of [organization][crate::model::ResourceSearchResult::organization].
10152 pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10153 self.organization = v.into();
10154 self
10155 }
10156
10157 /// Sets the value of [display_name][crate::model::ResourceSearchResult::display_name].
10158 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10159 self.display_name = v.into();
10160 self
10161 }
10162
10163 /// Sets the value of [description][crate::model::ResourceSearchResult::description].
10164 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10165 self.description = v.into();
10166 self
10167 }
10168
10169 /// Sets the value of [location][crate::model::ResourceSearchResult::location].
10170 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10171 self.location = v.into();
10172 self
10173 }
10174
10175 /// Sets the value of [labels][crate::model::ResourceSearchResult::labels].
10176 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10177 where
10178 T: std::iter::IntoIterator<Item = (K, V)>,
10179 K: std::convert::Into<std::string::String>,
10180 V: std::convert::Into<std::string::String>,
10181 {
10182 use std::iter::Iterator;
10183 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10184 self
10185 }
10186
10187 /// Sets the value of [network_tags][crate::model::ResourceSearchResult::network_tags].
10188 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
10189 where
10190 T: std::iter::IntoIterator<Item = V>,
10191 V: std::convert::Into<std::string::String>,
10192 {
10193 use std::iter::Iterator;
10194 self.network_tags = v.into_iter().map(|i| i.into()).collect();
10195 self
10196 }
10197
10198 /// Sets the value of [kms_key][crate::model::ResourceSearchResult::kms_key].
10199 #[deprecated]
10200 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10201 self.kms_key = v.into();
10202 self
10203 }
10204
10205 /// Sets the value of [kms_keys][crate::model::ResourceSearchResult::kms_keys].
10206 pub fn set_kms_keys<T, V>(mut self, v: T) -> Self
10207 where
10208 T: std::iter::IntoIterator<Item = V>,
10209 V: std::convert::Into<std::string::String>,
10210 {
10211 use std::iter::Iterator;
10212 self.kms_keys = v.into_iter().map(|i| i.into()).collect();
10213 self
10214 }
10215
10216 /// Sets the value of [create_time][crate::model::ResourceSearchResult::create_time].
10217 pub fn set_create_time<T>(mut self, v: T) -> Self
10218 where
10219 T: std::convert::Into<wkt::Timestamp>,
10220 {
10221 self.create_time = std::option::Option::Some(v.into());
10222 self
10223 }
10224
10225 /// Sets or clears the value of [create_time][crate::model::ResourceSearchResult::create_time].
10226 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10227 where
10228 T: std::convert::Into<wkt::Timestamp>,
10229 {
10230 self.create_time = v.map(|x| x.into());
10231 self
10232 }
10233
10234 /// Sets the value of [update_time][crate::model::ResourceSearchResult::update_time].
10235 pub fn set_update_time<T>(mut self, v: T) -> Self
10236 where
10237 T: std::convert::Into<wkt::Timestamp>,
10238 {
10239 self.update_time = std::option::Option::Some(v.into());
10240 self
10241 }
10242
10243 /// Sets or clears the value of [update_time][crate::model::ResourceSearchResult::update_time].
10244 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10245 where
10246 T: std::convert::Into<wkt::Timestamp>,
10247 {
10248 self.update_time = v.map(|x| x.into());
10249 self
10250 }
10251
10252 /// Sets the value of [state][crate::model::ResourceSearchResult::state].
10253 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10254 self.state = v.into();
10255 self
10256 }
10257
10258 /// Sets the value of [additional_attributes][crate::model::ResourceSearchResult::additional_attributes].
10259 pub fn set_additional_attributes<T>(mut self, v: T) -> Self
10260 where
10261 T: std::convert::Into<wkt::Struct>,
10262 {
10263 self.additional_attributes = std::option::Option::Some(v.into());
10264 self
10265 }
10266
10267 /// Sets or clears the value of [additional_attributes][crate::model::ResourceSearchResult::additional_attributes].
10268 pub fn set_or_clear_additional_attributes<T>(mut self, v: std::option::Option<T>) -> Self
10269 where
10270 T: std::convert::Into<wkt::Struct>,
10271 {
10272 self.additional_attributes = v.map(|x| x.into());
10273 self
10274 }
10275
10276 /// Sets the value of [parent_full_resource_name][crate::model::ResourceSearchResult::parent_full_resource_name].
10277 pub fn set_parent_full_resource_name<T: std::convert::Into<std::string::String>>(
10278 mut self,
10279 v: T,
10280 ) -> Self {
10281 self.parent_full_resource_name = v.into();
10282 self
10283 }
10284
10285 /// Sets the value of [versioned_resources][crate::model::ResourceSearchResult::versioned_resources].
10286 pub fn set_versioned_resources<T, V>(mut self, v: T) -> Self
10287 where
10288 T: std::iter::IntoIterator<Item = V>,
10289 V: std::convert::Into<crate::model::VersionedResource>,
10290 {
10291 use std::iter::Iterator;
10292 self.versioned_resources = v.into_iter().map(|i| i.into()).collect();
10293 self
10294 }
10295
10296 /// Sets the value of [attached_resources][crate::model::ResourceSearchResult::attached_resources].
10297 pub fn set_attached_resources<T, V>(mut self, v: T) -> Self
10298 where
10299 T: std::iter::IntoIterator<Item = V>,
10300 V: std::convert::Into<crate::model::AttachedResource>,
10301 {
10302 use std::iter::Iterator;
10303 self.attached_resources = v.into_iter().map(|i| i.into()).collect();
10304 self
10305 }
10306
10307 /// Sets the value of [relationships][crate::model::ResourceSearchResult::relationships].
10308 pub fn set_relationships<T, K, V>(mut self, v: T) -> Self
10309 where
10310 T: std::iter::IntoIterator<Item = (K, V)>,
10311 K: std::convert::Into<std::string::String>,
10312 V: std::convert::Into<crate::model::RelatedResources>,
10313 {
10314 use std::iter::Iterator;
10315 self.relationships = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10316 self
10317 }
10318
10319 /// Sets the value of [tag_keys][crate::model::ResourceSearchResult::tag_keys].
10320 #[deprecated]
10321 pub fn set_tag_keys<T, V>(mut self, v: T) -> Self
10322 where
10323 T: std::iter::IntoIterator<Item = V>,
10324 V: std::convert::Into<std::string::String>,
10325 {
10326 use std::iter::Iterator;
10327 self.tag_keys = v.into_iter().map(|i| i.into()).collect();
10328 self
10329 }
10330
10331 /// Sets the value of [tag_values][crate::model::ResourceSearchResult::tag_values].
10332 #[deprecated]
10333 pub fn set_tag_values<T, V>(mut self, v: T) -> Self
10334 where
10335 T: std::iter::IntoIterator<Item = V>,
10336 V: std::convert::Into<std::string::String>,
10337 {
10338 use std::iter::Iterator;
10339 self.tag_values = v.into_iter().map(|i| i.into()).collect();
10340 self
10341 }
10342
10343 /// Sets the value of [tag_value_ids][crate::model::ResourceSearchResult::tag_value_ids].
10344 #[deprecated]
10345 pub fn set_tag_value_ids<T, V>(mut self, v: T) -> Self
10346 where
10347 T: std::iter::IntoIterator<Item = V>,
10348 V: std::convert::Into<std::string::String>,
10349 {
10350 use std::iter::Iterator;
10351 self.tag_value_ids = v.into_iter().map(|i| i.into()).collect();
10352 self
10353 }
10354
10355 /// Sets the value of [tags][crate::model::ResourceSearchResult::tags].
10356 pub fn set_tags<T, V>(mut self, v: T) -> Self
10357 where
10358 T: std::iter::IntoIterator<Item = V>,
10359 V: std::convert::Into<crate::model::Tag>,
10360 {
10361 use std::iter::Iterator;
10362 self.tags = v.into_iter().map(|i| i.into()).collect();
10363 self
10364 }
10365
10366 /// Sets the value of [effective_tags][crate::model::ResourceSearchResult::effective_tags].
10367 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
10368 where
10369 T: std::iter::IntoIterator<Item = V>,
10370 V: std::convert::Into<crate::model::EffectiveTagDetails>,
10371 {
10372 use std::iter::Iterator;
10373 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
10374 self
10375 }
10376
10377 /// Sets the value of [enrichments][crate::model::ResourceSearchResult::enrichments].
10378 pub fn set_enrichments<T, V>(mut self, v: T) -> Self
10379 where
10380 T: std::iter::IntoIterator<Item = V>,
10381 V: std::convert::Into<crate::model::AssetEnrichment>,
10382 {
10383 use std::iter::Iterator;
10384 self.enrichments = v.into_iter().map(|i| i.into()).collect();
10385 self
10386 }
10387
10388 /// Sets the value of [parent_asset_type][crate::model::ResourceSearchResult::parent_asset_type].
10389 pub fn set_parent_asset_type<T: std::convert::Into<std::string::String>>(
10390 mut self,
10391 v: T,
10392 ) -> Self {
10393 self.parent_asset_type = v.into();
10394 self
10395 }
10396
10397 /// Sets the value of [scc_security_marks][crate::model::ResourceSearchResult::scc_security_marks].
10398 pub fn set_scc_security_marks<T, K, V>(mut self, v: T) -> Self
10399 where
10400 T: std::iter::IntoIterator<Item = (K, V)>,
10401 K: std::convert::Into<std::string::String>,
10402 V: std::convert::Into<std::string::String>,
10403 {
10404 use std::iter::Iterator;
10405 self.scc_security_marks = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10406 self
10407 }
10408}
10409
10410impl wkt::message::Message for ResourceSearchResult {
10411 fn typename() -> &'static str {
10412 "type.googleapis.com/google.cloud.asset.v1.ResourceSearchResult"
10413 }
10414}
10415
10416/// Resource representation as defined by the corresponding service providing the
10417/// resource for a given API version.
10418#[derive(Clone, Default, PartialEq)]
10419#[non_exhaustive]
10420pub struct VersionedResource {
10421 /// API version of the resource.
10422 ///
10423 /// Example:
10424 /// If the resource is an instance provided by Compute Engine v1 API as defined
10425 /// in `<https://cloud.google.com/compute/docs/reference/rest/v1/instances>`,
10426 /// version will be "v1".
10427 pub version: std::string::String,
10428
10429 /// JSON representation of the resource as defined by the corresponding
10430 /// service providing this resource.
10431 ///
10432 /// Example:
10433 /// If the resource is an instance provided by Compute Engine, this field will
10434 /// contain the JSON representation of the instance as defined by Compute
10435 /// Engine:
10436 /// `<https://cloud.google.com/compute/docs/reference/rest/v1/instances>`.
10437 ///
10438 /// You can find the resource definition for each supported resource type in
10439 /// this table:
10440 /// `<https://cloud.google.com/asset-inventory/docs/supported-asset-types>`
10441 pub resource: std::option::Option<wkt::Struct>,
10442
10443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10444}
10445
10446impl VersionedResource {
10447 pub fn new() -> Self {
10448 std::default::Default::default()
10449 }
10450
10451 /// Sets the value of [version][crate::model::VersionedResource::version].
10452 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10453 self.version = v.into();
10454 self
10455 }
10456
10457 /// Sets the value of [resource][crate::model::VersionedResource::resource].
10458 pub fn set_resource<T>(mut self, v: T) -> Self
10459 where
10460 T: std::convert::Into<wkt::Struct>,
10461 {
10462 self.resource = std::option::Option::Some(v.into());
10463 self
10464 }
10465
10466 /// Sets or clears the value of [resource][crate::model::VersionedResource::resource].
10467 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
10468 where
10469 T: std::convert::Into<wkt::Struct>,
10470 {
10471 self.resource = v.map(|x| x.into());
10472 self
10473 }
10474}
10475
10476impl wkt::message::Message for VersionedResource {
10477 fn typename() -> &'static str {
10478 "type.googleapis.com/google.cloud.asset.v1.VersionedResource"
10479 }
10480}
10481
10482/// Attached resource representation, which is defined by the corresponding
10483/// service provider. It represents an attached resource's payload.
10484#[derive(Clone, Default, PartialEq)]
10485#[non_exhaustive]
10486pub struct AttachedResource {
10487 /// The type of this attached resource.
10488 ///
10489 /// Example: `osconfig.googleapis.com/Inventory`
10490 ///
10491 /// You can find the supported attached asset types of each resource in this
10492 /// table:
10493 /// `<https://cloud.google.com/asset-inventory/docs/supported-asset-types>`
10494 pub asset_type: std::string::String,
10495
10496 /// Versioned resource representations of this attached resource. This is
10497 /// repeated because there could be multiple versions of the attached resource
10498 /// representations during version migration.
10499 pub versioned_resources: std::vec::Vec<crate::model::VersionedResource>,
10500
10501 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10502}
10503
10504impl AttachedResource {
10505 pub fn new() -> Self {
10506 std::default::Default::default()
10507 }
10508
10509 /// Sets the value of [asset_type][crate::model::AttachedResource::asset_type].
10510 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10511 self.asset_type = v.into();
10512 self
10513 }
10514
10515 /// Sets the value of [versioned_resources][crate::model::AttachedResource::versioned_resources].
10516 pub fn set_versioned_resources<T, V>(mut self, v: T) -> Self
10517 where
10518 T: std::iter::IntoIterator<Item = V>,
10519 V: std::convert::Into<crate::model::VersionedResource>,
10520 {
10521 use std::iter::Iterator;
10522 self.versioned_resources = v.into_iter().map(|i| i.into()).collect();
10523 self
10524 }
10525}
10526
10527impl wkt::message::Message for AttachedResource {
10528 fn typename() -> &'static str {
10529 "type.googleapis.com/google.cloud.asset.v1.AttachedResource"
10530 }
10531}
10532
10533/// The related resources of the primary resource.
10534#[derive(Clone, Default, PartialEq)]
10535#[non_exhaustive]
10536pub struct RelatedResources {
10537 /// The detailed related resources of the primary resource.
10538 pub related_resources: std::vec::Vec<crate::model::RelatedResource>,
10539
10540 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10541}
10542
10543impl RelatedResources {
10544 pub fn new() -> Self {
10545 std::default::Default::default()
10546 }
10547
10548 /// Sets the value of [related_resources][crate::model::RelatedResources::related_resources].
10549 pub fn set_related_resources<T, V>(mut self, v: T) -> Self
10550 where
10551 T: std::iter::IntoIterator<Item = V>,
10552 V: std::convert::Into<crate::model::RelatedResource>,
10553 {
10554 use std::iter::Iterator;
10555 self.related_resources = v.into_iter().map(|i| i.into()).collect();
10556 self
10557 }
10558}
10559
10560impl wkt::message::Message for RelatedResources {
10561 fn typename() -> &'static str {
10562 "type.googleapis.com/google.cloud.asset.v1.RelatedResources"
10563 }
10564}
10565
10566/// The detailed related resource.
10567#[derive(Clone, Default, PartialEq)]
10568#[non_exhaustive]
10569pub struct RelatedResource {
10570 /// The type of the asset. Example: `compute.googleapis.com/Instance`
10571 pub asset_type: std::string::String,
10572
10573 /// The full resource name of the related resource. Example:
10574 /// `//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123`
10575 pub full_resource_name: std::string::String,
10576
10577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10578}
10579
10580impl RelatedResource {
10581 pub fn new() -> Self {
10582 std::default::Default::default()
10583 }
10584
10585 /// Sets the value of [asset_type][crate::model::RelatedResource::asset_type].
10586 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10587 self.asset_type = v.into();
10588 self
10589 }
10590
10591 /// Sets the value of [full_resource_name][crate::model::RelatedResource::full_resource_name].
10592 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
10593 mut self,
10594 v: T,
10595 ) -> Self {
10596 self.full_resource_name = v.into();
10597 self
10598 }
10599}
10600
10601impl wkt::message::Message for RelatedResource {
10602 fn typename() -> &'static str {
10603 "type.googleapis.com/google.cloud.asset.v1.RelatedResource"
10604 }
10605}
10606
10607/// A result of IAM Policy search, containing information of an IAM policy.
10608#[derive(Clone, Default, PartialEq)]
10609#[non_exhaustive]
10610pub struct IamPolicySearchResult {
10611 /// The full resource name of the resource associated with this IAM policy.
10612 /// Example:
10613 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
10614 /// See [Cloud Asset Inventory Resource Name
10615 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
10616 /// for more information.
10617 ///
10618 /// To search against the `resource`:
10619 ///
10620 /// * use a field query. Example: `resource:organizations/123`
10621 pub resource: std::string::String,
10622
10623 /// The type of the resource associated with this IAM policy. Example:
10624 /// `compute.googleapis.com/Disk`.
10625 ///
10626 /// To search against the `asset_type`:
10627 ///
10628 /// * specify the `asset_types` field in your search request.
10629 pub asset_type: std::string::String,
10630
10631 /// The project that the associated Google Cloud resource belongs to, in the
10632 /// form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
10633 /// (like VM instance, Cloud Storage bucket), the project field will indicate
10634 /// the project that contains the resource. If an IAM policy is set on a folder
10635 /// or organization, this field will be empty.
10636 ///
10637 /// To search against the `project`:
10638 ///
10639 /// * specify the `scope` field as this project in your search request.
10640 pub project: std::string::String,
10641
10642 /// The folder(s) that the IAM policy belongs to, in the form of
10643 /// folders/{FOLDER_NUMBER}. This field is available when the IAM policy
10644 /// belongs to one or more folders.
10645 ///
10646 /// To search against `folders`:
10647 ///
10648 /// * use a field query. Example: `folders:(123 OR 456)`
10649 /// * use a free text query. Example: `123`
10650 /// * specify the `scope` field as this folder in your search request.
10651 pub folders: std::vec::Vec<std::string::String>,
10652
10653 /// The organization that the IAM policy belongs to, in the form
10654 /// of organizations/{ORGANIZATION_NUMBER}. This field is available when the
10655 /// IAM policy belongs to an organization.
10656 ///
10657 /// To search against `organization`:
10658 ///
10659 /// * use a field query. Example: `organization:123`
10660 /// * use a free text query. Example: `123`
10661 /// * specify the `scope` field as this organization in your search request.
10662 pub organization: std::string::String,
10663
10664 /// The IAM policy directly set on the given resource. Note that the original
10665 /// IAM policy can contain multiple bindings. This only contains the bindings
10666 /// that match the given query. For queries that don't contain a constrain on
10667 /// policies (e.g., an empty query), this contains all the bindings.
10668 ///
10669 /// To search against the `policy` bindings:
10670 ///
10671 /// * use a field query:
10672 /// - query by the policy contained members. Example:
10673 /// `policy:amy@gmail.com`
10674 /// - query by the policy contained roles. Example:
10675 /// `policy:roles/compute.admin`
10676 /// - query by the policy contained roles' included permissions. Example:
10677 /// `policy.role.permissions:compute.instances.create`
10678 pub policy: std::option::Option<iam_v1::model::Policy>,
10679
10680 /// Explanation about the IAM policy search result. It contains additional
10681 /// information to explain why the search result matches the query.
10682 pub explanation: std::option::Option<crate::model::iam_policy_search_result::Explanation>,
10683
10684 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10685}
10686
10687impl IamPolicySearchResult {
10688 pub fn new() -> Self {
10689 std::default::Default::default()
10690 }
10691
10692 /// Sets the value of [resource][crate::model::IamPolicySearchResult::resource].
10693 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10694 self.resource = v.into();
10695 self
10696 }
10697
10698 /// Sets the value of [asset_type][crate::model::IamPolicySearchResult::asset_type].
10699 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10700 self.asset_type = v.into();
10701 self
10702 }
10703
10704 /// Sets the value of [project][crate::model::IamPolicySearchResult::project].
10705 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10706 self.project = v.into();
10707 self
10708 }
10709
10710 /// Sets the value of [folders][crate::model::IamPolicySearchResult::folders].
10711 pub fn set_folders<T, V>(mut self, v: T) -> Self
10712 where
10713 T: std::iter::IntoIterator<Item = V>,
10714 V: std::convert::Into<std::string::String>,
10715 {
10716 use std::iter::Iterator;
10717 self.folders = v.into_iter().map(|i| i.into()).collect();
10718 self
10719 }
10720
10721 /// Sets the value of [organization][crate::model::IamPolicySearchResult::organization].
10722 pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10723 self.organization = v.into();
10724 self
10725 }
10726
10727 /// Sets the value of [policy][crate::model::IamPolicySearchResult::policy].
10728 pub fn set_policy<T>(mut self, v: T) -> Self
10729 where
10730 T: std::convert::Into<iam_v1::model::Policy>,
10731 {
10732 self.policy = std::option::Option::Some(v.into());
10733 self
10734 }
10735
10736 /// Sets or clears the value of [policy][crate::model::IamPolicySearchResult::policy].
10737 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
10738 where
10739 T: std::convert::Into<iam_v1::model::Policy>,
10740 {
10741 self.policy = v.map(|x| x.into());
10742 self
10743 }
10744
10745 /// Sets the value of [explanation][crate::model::IamPolicySearchResult::explanation].
10746 pub fn set_explanation<T>(mut self, v: T) -> Self
10747 where
10748 T: std::convert::Into<crate::model::iam_policy_search_result::Explanation>,
10749 {
10750 self.explanation = std::option::Option::Some(v.into());
10751 self
10752 }
10753
10754 /// Sets or clears the value of [explanation][crate::model::IamPolicySearchResult::explanation].
10755 pub fn set_or_clear_explanation<T>(mut self, v: std::option::Option<T>) -> Self
10756 where
10757 T: std::convert::Into<crate::model::iam_policy_search_result::Explanation>,
10758 {
10759 self.explanation = v.map(|x| x.into());
10760 self
10761 }
10762}
10763
10764impl wkt::message::Message for IamPolicySearchResult {
10765 fn typename() -> &'static str {
10766 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult"
10767 }
10768}
10769
10770/// Defines additional types related to [IamPolicySearchResult].
10771pub mod iam_policy_search_result {
10772 #[allow(unused_imports)]
10773 use super::*;
10774
10775 /// Explanation about the IAM policy search result.
10776 #[derive(Clone, Default, PartialEq)]
10777 #[non_exhaustive]
10778 pub struct Explanation {
10779 /// The map from roles to their included permissions that match the
10780 /// permission query (i.e., a query containing `policy.role.permissions:`).
10781 /// Example: if query `policy.role.permissions:compute.disk.get`
10782 /// matches a policy binding that contains owner role, the
10783 /// matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
10784 /// roles can also be found in the returned `policy` bindings. Note that the
10785 /// map is populated only for requests with permission queries.
10786 pub matched_permissions: std::collections::HashMap<
10787 std::string::String,
10788 crate::model::iam_policy_search_result::explanation::Permissions,
10789 >,
10790
10791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10792 }
10793
10794 impl Explanation {
10795 pub fn new() -> Self {
10796 std::default::Default::default()
10797 }
10798
10799 /// Sets the value of [matched_permissions][crate::model::iam_policy_search_result::Explanation::matched_permissions].
10800 pub fn set_matched_permissions<T, K, V>(mut self, v: T) -> Self
10801 where
10802 T: std::iter::IntoIterator<Item = (K, V)>,
10803 K: std::convert::Into<std::string::String>,
10804 V: std::convert::Into<crate::model::iam_policy_search_result::explanation::Permissions>,
10805 {
10806 use std::iter::Iterator;
10807 self.matched_permissions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10808 self
10809 }
10810 }
10811
10812 impl wkt::message::Message for Explanation {
10813 fn typename() -> &'static str {
10814 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult.Explanation"
10815 }
10816 }
10817
10818 /// Defines additional types related to [Explanation].
10819 pub mod explanation {
10820 #[allow(unused_imports)]
10821 use super::*;
10822
10823 /// IAM permissions
10824 #[derive(Clone, Default, PartialEq)]
10825 #[non_exhaustive]
10826 pub struct Permissions {
10827 /// A list of permissions. A sample permission string: `compute.disk.get`.
10828 pub permissions: std::vec::Vec<std::string::String>,
10829
10830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10831 }
10832
10833 impl Permissions {
10834 pub fn new() -> Self {
10835 std::default::Default::default()
10836 }
10837
10838 /// Sets the value of [permissions][crate::model::iam_policy_search_result::explanation::Permissions::permissions].
10839 pub fn set_permissions<T, V>(mut self, v: T) -> Self
10840 where
10841 T: std::iter::IntoIterator<Item = V>,
10842 V: std::convert::Into<std::string::String>,
10843 {
10844 use std::iter::Iterator;
10845 self.permissions = v.into_iter().map(|i| i.into()).collect();
10846 self
10847 }
10848 }
10849
10850 impl wkt::message::Message for Permissions {
10851 fn typename() -> &'static str {
10852 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions"
10853 }
10854 }
10855 }
10856}
10857
10858/// Represents the detailed state of an entity under analysis, such as a
10859/// resource, an identity or an access.
10860#[derive(Clone, Default, PartialEq)]
10861#[non_exhaustive]
10862pub struct IamPolicyAnalysisState {
10863 /// The Google standard error code that best describes the state.
10864 /// For example:
10865 ///
10866 /// - OK means the analysis on this entity has been successfully finished;
10867 /// - PERMISSION_DENIED means an access denied error is encountered;
10868 /// - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started
10869 /// in time;
10870 pub code: rpc::model::Code,
10871
10872 /// The human-readable description of the cause of failure.
10873 pub cause: std::string::String,
10874
10875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10876}
10877
10878impl IamPolicyAnalysisState {
10879 pub fn new() -> Self {
10880 std::default::Default::default()
10881 }
10882
10883 /// Sets the value of [code][crate::model::IamPolicyAnalysisState::code].
10884 pub fn set_code<T: std::convert::Into<rpc::model::Code>>(mut self, v: T) -> Self {
10885 self.code = v.into();
10886 self
10887 }
10888
10889 /// Sets the value of [cause][crate::model::IamPolicyAnalysisState::cause].
10890 pub fn set_cause<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10891 self.cause = v.into();
10892 self
10893 }
10894}
10895
10896impl wkt::message::Message for IamPolicyAnalysisState {
10897 fn typename() -> &'static str {
10898 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisState"
10899 }
10900}
10901
10902/// The condition evaluation.
10903#[derive(Clone, Default, PartialEq)]
10904#[non_exhaustive]
10905pub struct ConditionEvaluation {
10906 /// The evaluation result.
10907 pub evaluation_value: crate::model::condition_evaluation::EvaluationValue,
10908
10909 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10910}
10911
10912impl ConditionEvaluation {
10913 pub fn new() -> Self {
10914 std::default::Default::default()
10915 }
10916
10917 /// Sets the value of [evaluation_value][crate::model::ConditionEvaluation::evaluation_value].
10918 pub fn set_evaluation_value<
10919 T: std::convert::Into<crate::model::condition_evaluation::EvaluationValue>,
10920 >(
10921 mut self,
10922 v: T,
10923 ) -> Self {
10924 self.evaluation_value = v.into();
10925 self
10926 }
10927}
10928
10929impl wkt::message::Message for ConditionEvaluation {
10930 fn typename() -> &'static str {
10931 "type.googleapis.com/google.cloud.asset.v1.ConditionEvaluation"
10932 }
10933}
10934
10935/// Defines additional types related to [ConditionEvaluation].
10936pub mod condition_evaluation {
10937 #[allow(unused_imports)]
10938 use super::*;
10939
10940 /// Value of this expression.
10941 ///
10942 /// # Working with unknown values
10943 ///
10944 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10945 /// additional enum variants at any time. Adding new variants is not considered
10946 /// a breaking change. Applications should write their code in anticipation of:
10947 ///
10948 /// - New values appearing in future releases of the client library, **and**
10949 /// - New values received dynamically, without application changes.
10950 ///
10951 /// Please consult the [Working with enums] section in the user guide for some
10952 /// guidelines.
10953 ///
10954 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10955 #[derive(Clone, Debug, PartialEq)]
10956 #[non_exhaustive]
10957 pub enum EvaluationValue {
10958 /// Reserved for future use.
10959 Unspecified,
10960 /// The evaluation result is `true`.
10961 True,
10962 /// The evaluation result is `false`.
10963 False,
10964 /// The evaluation result is `conditional` when the condition expression
10965 /// contains variables that are either missing input values or have not been
10966 /// supported by Policy Analyzer yet.
10967 Conditional,
10968 /// If set, the enum was initialized with an unknown value.
10969 ///
10970 /// Applications can examine the value using [EvaluationValue::value] or
10971 /// [EvaluationValue::name].
10972 UnknownValue(evaluation_value::UnknownValue),
10973 }
10974
10975 #[doc(hidden)]
10976 pub mod evaluation_value {
10977 #[allow(unused_imports)]
10978 use super::*;
10979 #[derive(Clone, Debug, PartialEq)]
10980 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10981 }
10982
10983 impl EvaluationValue {
10984 /// Gets the enum value.
10985 ///
10986 /// Returns `None` if the enum contains an unknown value deserialized from
10987 /// the string representation of enums.
10988 pub fn value(&self) -> std::option::Option<i32> {
10989 match self {
10990 Self::Unspecified => std::option::Option::Some(0),
10991 Self::True => std::option::Option::Some(1),
10992 Self::False => std::option::Option::Some(2),
10993 Self::Conditional => std::option::Option::Some(3),
10994 Self::UnknownValue(u) => u.0.value(),
10995 }
10996 }
10997
10998 /// Gets the enum value as a string.
10999 ///
11000 /// Returns `None` if the enum contains an unknown value deserialized from
11001 /// the integer representation of enums.
11002 pub fn name(&self) -> std::option::Option<&str> {
11003 match self {
11004 Self::Unspecified => std::option::Option::Some("EVALUATION_VALUE_UNSPECIFIED"),
11005 Self::True => std::option::Option::Some("TRUE"),
11006 Self::False => std::option::Option::Some("FALSE"),
11007 Self::Conditional => std::option::Option::Some("CONDITIONAL"),
11008 Self::UnknownValue(u) => u.0.name(),
11009 }
11010 }
11011 }
11012
11013 impl std::default::Default for EvaluationValue {
11014 fn default() -> Self {
11015 use std::convert::From;
11016 Self::from(0)
11017 }
11018 }
11019
11020 impl std::fmt::Display for EvaluationValue {
11021 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11022 wkt::internal::display_enum(f, self.name(), self.value())
11023 }
11024 }
11025
11026 impl std::convert::From<i32> for EvaluationValue {
11027 fn from(value: i32) -> Self {
11028 match value {
11029 0 => Self::Unspecified,
11030 1 => Self::True,
11031 2 => Self::False,
11032 3 => Self::Conditional,
11033 _ => Self::UnknownValue(evaluation_value::UnknownValue(
11034 wkt::internal::UnknownEnumValue::Integer(value),
11035 )),
11036 }
11037 }
11038 }
11039
11040 impl std::convert::From<&str> for EvaluationValue {
11041 fn from(value: &str) -> Self {
11042 use std::string::ToString;
11043 match value {
11044 "EVALUATION_VALUE_UNSPECIFIED" => Self::Unspecified,
11045 "TRUE" => Self::True,
11046 "FALSE" => Self::False,
11047 "CONDITIONAL" => Self::Conditional,
11048 _ => Self::UnknownValue(evaluation_value::UnknownValue(
11049 wkt::internal::UnknownEnumValue::String(value.to_string()),
11050 )),
11051 }
11052 }
11053 }
11054
11055 impl serde::ser::Serialize for EvaluationValue {
11056 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11057 where
11058 S: serde::Serializer,
11059 {
11060 match self {
11061 Self::Unspecified => serializer.serialize_i32(0),
11062 Self::True => serializer.serialize_i32(1),
11063 Self::False => serializer.serialize_i32(2),
11064 Self::Conditional => serializer.serialize_i32(3),
11065 Self::UnknownValue(u) => u.0.serialize(serializer),
11066 }
11067 }
11068 }
11069
11070 impl<'de> serde::de::Deserialize<'de> for EvaluationValue {
11071 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11072 where
11073 D: serde::Deserializer<'de>,
11074 {
11075 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EvaluationValue>::new(
11076 ".google.cloud.asset.v1.ConditionEvaluation.EvaluationValue",
11077 ))
11078 }
11079 }
11080}
11081
11082/// IAM Policy analysis result, consisting of one IAM policy binding and derived
11083/// access control lists.
11084#[derive(Clone, Default, PartialEq)]
11085#[non_exhaustive]
11086pub struct IamPolicyAnalysisResult {
11087 /// The [full resource
11088 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
11089 /// of the resource to which the
11090 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
11091 /// policy attaches.
11092 ///
11093 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
11094 pub attached_resource_full_name: std::string::String,
11095
11096 /// The IAM policy binding under analysis.
11097 pub iam_binding: std::option::Option<iam_v1::model::Binding>,
11098
11099 /// The access control lists derived from the
11100 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
11101 /// that match or potentially match resource and access selectors specified in
11102 /// the request.
11103 ///
11104 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
11105 pub access_control_lists:
11106 std::vec::Vec<crate::model::iam_policy_analysis_result::AccessControlList>,
11107
11108 /// The identity list derived from members of the
11109 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
11110 /// that match or potentially match identity selector specified in the request.
11111 ///
11112 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
11113 pub identity_list: std::option::Option<crate::model::iam_policy_analysis_result::IdentityList>,
11114
11115 /// Represents whether all analyses on the
11116 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
11117 /// have successfully finished.
11118 ///
11119 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
11120 pub fully_explored: bool,
11121
11122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11123}
11124
11125impl IamPolicyAnalysisResult {
11126 pub fn new() -> Self {
11127 std::default::Default::default()
11128 }
11129
11130 /// Sets the value of [attached_resource_full_name][crate::model::IamPolicyAnalysisResult::attached_resource_full_name].
11131 pub fn set_attached_resource_full_name<T: std::convert::Into<std::string::String>>(
11132 mut self,
11133 v: T,
11134 ) -> Self {
11135 self.attached_resource_full_name = v.into();
11136 self
11137 }
11138
11139 /// Sets the value of [iam_binding][crate::model::IamPolicyAnalysisResult::iam_binding].
11140 pub fn set_iam_binding<T>(mut self, v: T) -> Self
11141 where
11142 T: std::convert::Into<iam_v1::model::Binding>,
11143 {
11144 self.iam_binding = std::option::Option::Some(v.into());
11145 self
11146 }
11147
11148 /// Sets or clears the value of [iam_binding][crate::model::IamPolicyAnalysisResult::iam_binding].
11149 pub fn set_or_clear_iam_binding<T>(mut self, v: std::option::Option<T>) -> Self
11150 where
11151 T: std::convert::Into<iam_v1::model::Binding>,
11152 {
11153 self.iam_binding = v.map(|x| x.into());
11154 self
11155 }
11156
11157 /// Sets the value of [access_control_lists][crate::model::IamPolicyAnalysisResult::access_control_lists].
11158 pub fn set_access_control_lists<T, V>(mut self, v: T) -> Self
11159 where
11160 T: std::iter::IntoIterator<Item = V>,
11161 V: std::convert::Into<crate::model::iam_policy_analysis_result::AccessControlList>,
11162 {
11163 use std::iter::Iterator;
11164 self.access_control_lists = v.into_iter().map(|i| i.into()).collect();
11165 self
11166 }
11167
11168 /// Sets the value of [identity_list][crate::model::IamPolicyAnalysisResult::identity_list].
11169 pub fn set_identity_list<T>(mut self, v: T) -> Self
11170 where
11171 T: std::convert::Into<crate::model::iam_policy_analysis_result::IdentityList>,
11172 {
11173 self.identity_list = std::option::Option::Some(v.into());
11174 self
11175 }
11176
11177 /// Sets or clears the value of [identity_list][crate::model::IamPolicyAnalysisResult::identity_list].
11178 pub fn set_or_clear_identity_list<T>(mut self, v: std::option::Option<T>) -> Self
11179 where
11180 T: std::convert::Into<crate::model::iam_policy_analysis_result::IdentityList>,
11181 {
11182 self.identity_list = v.map(|x| x.into());
11183 self
11184 }
11185
11186 /// Sets the value of [fully_explored][crate::model::IamPolicyAnalysisResult::fully_explored].
11187 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11188 self.fully_explored = v.into();
11189 self
11190 }
11191}
11192
11193impl wkt::message::Message for IamPolicyAnalysisResult {
11194 fn typename() -> &'static str {
11195 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult"
11196 }
11197}
11198
11199/// Defines additional types related to [IamPolicyAnalysisResult].
11200pub mod iam_policy_analysis_result {
11201 #[allow(unused_imports)]
11202 use super::*;
11203
11204 /// A Google Cloud resource under analysis.
11205 #[derive(Clone, Default, PartialEq)]
11206 #[non_exhaustive]
11207 pub struct Resource {
11208 /// The [full resource
11209 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
11210 pub full_resource_name: std::string::String,
11211
11212 /// The analysis state of this resource.
11213 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
11214
11215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11216 }
11217
11218 impl Resource {
11219 pub fn new() -> Self {
11220 std::default::Default::default()
11221 }
11222
11223 /// Sets the value of [full_resource_name][crate::model::iam_policy_analysis_result::Resource::full_resource_name].
11224 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
11225 mut self,
11226 v: T,
11227 ) -> Self {
11228 self.full_resource_name = v.into();
11229 self
11230 }
11231
11232 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Resource::analysis_state].
11233 pub fn set_analysis_state<T>(mut self, v: T) -> Self
11234 where
11235 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11236 {
11237 self.analysis_state = std::option::Option::Some(v.into());
11238 self
11239 }
11240
11241 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Resource::analysis_state].
11242 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
11243 where
11244 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11245 {
11246 self.analysis_state = v.map(|x| x.into());
11247 self
11248 }
11249 }
11250
11251 impl wkt::message::Message for Resource {
11252 fn typename() -> &'static str {
11253 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Resource"
11254 }
11255 }
11256
11257 /// An IAM role or permission under analysis.
11258 #[derive(Clone, Default, PartialEq)]
11259 #[non_exhaustive]
11260 pub struct Access {
11261 /// The analysis state of this access.
11262 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
11263
11264 pub oneof_access:
11265 std::option::Option<crate::model::iam_policy_analysis_result::access::OneofAccess>,
11266
11267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11268 }
11269
11270 impl Access {
11271 pub fn new() -> Self {
11272 std::default::Default::default()
11273 }
11274
11275 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Access::analysis_state].
11276 pub fn set_analysis_state<T>(mut self, v: T) -> Self
11277 where
11278 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11279 {
11280 self.analysis_state = std::option::Option::Some(v.into());
11281 self
11282 }
11283
11284 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Access::analysis_state].
11285 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
11286 where
11287 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11288 {
11289 self.analysis_state = v.map(|x| x.into());
11290 self
11291 }
11292
11293 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access].
11294 ///
11295 /// Note that all the setters affecting `oneof_access` are mutually
11296 /// exclusive.
11297 pub fn set_oneof_access<
11298 T: std::convert::Into<
11299 std::option::Option<
11300 crate::model::iam_policy_analysis_result::access::OneofAccess,
11301 >,
11302 >,
11303 >(
11304 mut self,
11305 v: T,
11306 ) -> Self {
11307 self.oneof_access = v.into();
11308 self
11309 }
11310
11311 /// The value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
11312 /// if it holds a `Role`, `None` if the field is not set or
11313 /// holds a different branch.
11314 pub fn role(&self) -> std::option::Option<&std::string::String> {
11315 #[allow(unreachable_patterns)]
11316 self.oneof_access.as_ref().and_then(|v| match v {
11317 crate::model::iam_policy_analysis_result::access::OneofAccess::Role(v) => {
11318 std::option::Option::Some(v)
11319 }
11320 _ => std::option::Option::None,
11321 })
11322 }
11323
11324 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
11325 /// to hold a `Role`.
11326 ///
11327 /// Note that all the setters affecting `oneof_access` are
11328 /// mutually exclusive.
11329 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11330 self.oneof_access = std::option::Option::Some(
11331 crate::model::iam_policy_analysis_result::access::OneofAccess::Role(v.into()),
11332 );
11333 self
11334 }
11335
11336 /// The value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
11337 /// if it holds a `Permission`, `None` if the field is not set or
11338 /// holds a different branch.
11339 pub fn permission(&self) -> std::option::Option<&std::string::String> {
11340 #[allow(unreachable_patterns)]
11341 self.oneof_access.as_ref().and_then(|v| match v {
11342 crate::model::iam_policy_analysis_result::access::OneofAccess::Permission(v) => {
11343 std::option::Option::Some(v)
11344 }
11345 _ => std::option::Option::None,
11346 })
11347 }
11348
11349 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
11350 /// to hold a `Permission`.
11351 ///
11352 /// Note that all the setters affecting `oneof_access` are
11353 /// mutually exclusive.
11354 pub fn set_permission<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11355 self.oneof_access = std::option::Option::Some(
11356 crate::model::iam_policy_analysis_result::access::OneofAccess::Permission(v.into()),
11357 );
11358 self
11359 }
11360 }
11361
11362 impl wkt::message::Message for Access {
11363 fn typename() -> &'static str {
11364 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Access"
11365 }
11366 }
11367
11368 /// Defines additional types related to [Access].
11369 pub mod access {
11370 #[allow(unused_imports)]
11371 use super::*;
11372
11373 #[derive(Clone, Debug, PartialEq)]
11374 #[non_exhaustive]
11375 pub enum OneofAccess {
11376 /// The role.
11377 Role(std::string::String),
11378 /// The permission.
11379 Permission(std::string::String),
11380 }
11381 }
11382
11383 /// An identity under analysis.
11384 #[derive(Clone, Default, PartialEq)]
11385 #[non_exhaustive]
11386 pub struct Identity {
11387 /// The identity of members, formatted as appear in an
11388 /// [IAM policy
11389 /// binding](https://cloud.google.com/iam/reference/rest/v1/Binding). For
11390 /// example, they might be formatted like the following:
11391 ///
11392 /// - user:foo@google.com
11393 /// - group:group1@google.com
11394 /// - serviceAccount:s1@prj1.iam.gserviceaccount.com
11395 /// - projectOwner:some_project_id
11396 /// - domain:google.com
11397 /// - allUsers
11398 pub name: std::string::String,
11399
11400 /// The analysis state of this identity.
11401 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
11402
11403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11404 }
11405
11406 impl Identity {
11407 pub fn new() -> Self {
11408 std::default::Default::default()
11409 }
11410
11411 /// Sets the value of [name][crate::model::iam_policy_analysis_result::Identity::name].
11412 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11413 self.name = v.into();
11414 self
11415 }
11416
11417 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Identity::analysis_state].
11418 pub fn set_analysis_state<T>(mut self, v: T) -> Self
11419 where
11420 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11421 {
11422 self.analysis_state = std::option::Option::Some(v.into());
11423 self
11424 }
11425
11426 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Identity::analysis_state].
11427 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
11428 where
11429 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
11430 {
11431 self.analysis_state = v.map(|x| x.into());
11432 self
11433 }
11434 }
11435
11436 impl wkt::message::Message for Identity {
11437 fn typename() -> &'static str {
11438 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Identity"
11439 }
11440 }
11441
11442 /// A directional edge.
11443 #[derive(Clone, Default, PartialEq)]
11444 #[non_exhaustive]
11445 pub struct Edge {
11446 /// The source node of the edge. For example, it could be a full resource
11447 /// name for a resource node or an email of an identity.
11448 pub source_node: std::string::String,
11449
11450 /// The target node of the edge. For example, it could be a full resource
11451 /// name for a resource node or an email of an identity.
11452 pub target_node: std::string::String,
11453
11454 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11455 }
11456
11457 impl Edge {
11458 pub fn new() -> Self {
11459 std::default::Default::default()
11460 }
11461
11462 /// Sets the value of [source_node][crate::model::iam_policy_analysis_result::Edge::source_node].
11463 pub fn set_source_node<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11464 self.source_node = v.into();
11465 self
11466 }
11467
11468 /// Sets the value of [target_node][crate::model::iam_policy_analysis_result::Edge::target_node].
11469 pub fn set_target_node<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11470 self.target_node = v.into();
11471 self
11472 }
11473 }
11474
11475 impl wkt::message::Message for Edge {
11476 fn typename() -> &'static str {
11477 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Edge"
11478 }
11479 }
11480
11481 /// An access control list, derived from the above IAM policy binding, which
11482 /// contains a set of resources and accesses. May include one
11483 /// item from each set to compose an access control entry.
11484 ///
11485 /// NOTICE that there could be multiple access control lists for one IAM policy
11486 /// binding. The access control lists are created based on resource and access
11487 /// combinations.
11488 ///
11489 /// For example, assume we have the following cases in one IAM policy binding:
11490 ///
11491 /// - Permission P1 and P2 apply to resource R1 and R2;
11492 /// - Permission P3 applies to resource R2 and R3;
11493 ///
11494 /// This will result in the following access control lists:
11495 ///
11496 /// - AccessControlList 1: [R1, R2], [P1, P2]
11497 /// - AccessControlList 2: [R2, R3], [P3]
11498 #[derive(Clone, Default, PartialEq)]
11499 #[non_exhaustive]
11500 pub struct AccessControlList {
11501 /// The resources that match one of the following conditions:
11502 ///
11503 /// - The resource_selector, if it is specified in request;
11504 /// - Otherwise, resources reachable from the policy attached resource.
11505 pub resources: std::vec::Vec<crate::model::iam_policy_analysis_result::Resource>,
11506
11507 /// The accesses that match one of the following conditions:
11508 ///
11509 /// - The access_selector, if it is specified in request;
11510 /// - Otherwise, access specifiers reachable from the policy binding's role.
11511 pub accesses: std::vec::Vec<crate::model::iam_policy_analysis_result::Access>,
11512
11513 /// Resource edges of the graph starting from the policy attached
11514 /// resource to any descendant resources. The
11515 /// [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]
11516 /// contains the full resource name of a parent resource and
11517 /// [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]
11518 /// contains the full resource name of a child resource. This field is
11519 /// present only if the output_resource_edges option is enabled in request.
11520 ///
11521 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]: crate::model::iam_policy_analysis_result::Edge::source_node
11522 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]: crate::model::iam_policy_analysis_result::Edge::target_node
11523 pub resource_edges: std::vec::Vec<crate::model::iam_policy_analysis_result::Edge>,
11524
11525 /// Condition evaluation for this AccessControlList, if there is a condition
11526 /// defined in the above IAM policy binding.
11527 pub condition_evaluation: std::option::Option<crate::model::ConditionEvaluation>,
11528
11529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11530 }
11531
11532 impl AccessControlList {
11533 pub fn new() -> Self {
11534 std::default::Default::default()
11535 }
11536
11537 /// Sets the value of [resources][crate::model::iam_policy_analysis_result::AccessControlList::resources].
11538 pub fn set_resources<T, V>(mut self, v: T) -> Self
11539 where
11540 T: std::iter::IntoIterator<Item = V>,
11541 V: std::convert::Into<crate::model::iam_policy_analysis_result::Resource>,
11542 {
11543 use std::iter::Iterator;
11544 self.resources = v.into_iter().map(|i| i.into()).collect();
11545 self
11546 }
11547
11548 /// Sets the value of [accesses][crate::model::iam_policy_analysis_result::AccessControlList::accesses].
11549 pub fn set_accesses<T, V>(mut self, v: T) -> Self
11550 where
11551 T: std::iter::IntoIterator<Item = V>,
11552 V: std::convert::Into<crate::model::iam_policy_analysis_result::Access>,
11553 {
11554 use std::iter::Iterator;
11555 self.accesses = v.into_iter().map(|i| i.into()).collect();
11556 self
11557 }
11558
11559 /// Sets the value of [resource_edges][crate::model::iam_policy_analysis_result::AccessControlList::resource_edges].
11560 pub fn set_resource_edges<T, V>(mut self, v: T) -> Self
11561 where
11562 T: std::iter::IntoIterator<Item = V>,
11563 V: std::convert::Into<crate::model::iam_policy_analysis_result::Edge>,
11564 {
11565 use std::iter::Iterator;
11566 self.resource_edges = v.into_iter().map(|i| i.into()).collect();
11567 self
11568 }
11569
11570 /// Sets the value of [condition_evaluation][crate::model::iam_policy_analysis_result::AccessControlList::condition_evaluation].
11571 pub fn set_condition_evaluation<T>(mut self, v: T) -> Self
11572 where
11573 T: std::convert::Into<crate::model::ConditionEvaluation>,
11574 {
11575 self.condition_evaluation = std::option::Option::Some(v.into());
11576 self
11577 }
11578
11579 /// Sets or clears the value of [condition_evaluation][crate::model::iam_policy_analysis_result::AccessControlList::condition_evaluation].
11580 pub fn set_or_clear_condition_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
11581 where
11582 T: std::convert::Into<crate::model::ConditionEvaluation>,
11583 {
11584 self.condition_evaluation = v.map(|x| x.into());
11585 self
11586 }
11587 }
11588
11589 impl wkt::message::Message for AccessControlList {
11590 fn typename() -> &'static str {
11591 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.AccessControlList"
11592 }
11593 }
11594
11595 /// The identities and group edges.
11596 #[derive(Clone, Default, PartialEq)]
11597 #[non_exhaustive]
11598 pub struct IdentityList {
11599 /// Only the identities that match one of the following conditions will be
11600 /// presented:
11601 ///
11602 /// - The identity_selector, if it is specified in request;
11603 /// - Otherwise, identities reachable from the policy binding's members.
11604 pub identities: std::vec::Vec<crate::model::iam_policy_analysis_result::Identity>,
11605
11606 /// Group identity edges of the graph starting from the binding's
11607 /// group members to any node of the
11608 /// [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities].
11609 /// The
11610 /// [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]
11611 /// contains a group, such as `group:parent@google.com`. The
11612 /// [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]
11613 /// contains a member of the group, such as `group:child@google.com` or
11614 /// `user:foo@google.com`. This field is present only if the
11615 /// output_group_edges option is enabled in request.
11616 ///
11617 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]: crate::model::iam_policy_analysis_result::Edge::source_node
11618 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]: crate::model::iam_policy_analysis_result::Edge::target_node
11619 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]: crate::model::iam_policy_analysis_result::IdentityList::identities
11620 pub group_edges: std::vec::Vec<crate::model::iam_policy_analysis_result::Edge>,
11621
11622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11623 }
11624
11625 impl IdentityList {
11626 pub fn new() -> Self {
11627 std::default::Default::default()
11628 }
11629
11630 /// Sets the value of [identities][crate::model::iam_policy_analysis_result::IdentityList::identities].
11631 pub fn set_identities<T, V>(mut self, v: T) -> Self
11632 where
11633 T: std::iter::IntoIterator<Item = V>,
11634 V: std::convert::Into<crate::model::iam_policy_analysis_result::Identity>,
11635 {
11636 use std::iter::Iterator;
11637 self.identities = v.into_iter().map(|i| i.into()).collect();
11638 self
11639 }
11640
11641 /// Sets the value of [group_edges][crate::model::iam_policy_analysis_result::IdentityList::group_edges].
11642 pub fn set_group_edges<T, V>(mut self, v: T) -> Self
11643 where
11644 T: std::iter::IntoIterator<Item = V>,
11645 V: std::convert::Into<crate::model::iam_policy_analysis_result::Edge>,
11646 {
11647 use std::iter::Iterator;
11648 self.group_edges = v.into_iter().map(|i| i.into()).collect();
11649 self
11650 }
11651 }
11652
11653 impl wkt::message::Message for IdentityList {
11654 fn typename() -> &'static str {
11655 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList"
11656 }
11657 }
11658}
11659
11660/// Asset content type.
11661///
11662/// # Working with unknown values
11663///
11664/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11665/// additional enum variants at any time. Adding new variants is not considered
11666/// a breaking change. Applications should write their code in anticipation of:
11667///
11668/// - New values appearing in future releases of the client library, **and**
11669/// - New values received dynamically, without application changes.
11670///
11671/// Please consult the [Working with enums] section in the user guide for some
11672/// guidelines.
11673///
11674/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11675#[derive(Clone, Debug, PartialEq)]
11676#[non_exhaustive]
11677pub enum ContentType {
11678 /// Unspecified content type.
11679 Unspecified,
11680 /// Resource metadata.
11681 Resource,
11682 /// The actual IAM policy set on a resource.
11683 IamPolicy,
11684 /// The organization policy set on an asset.
11685 OrgPolicy,
11686 /// The Access Context Manager policy set on an asset.
11687 AccessPolicy,
11688 /// The runtime OS Inventory information.
11689 OsInventory,
11690 /// The related resources.
11691 Relationship,
11692 /// If set, the enum was initialized with an unknown value.
11693 ///
11694 /// Applications can examine the value using [ContentType::value] or
11695 /// [ContentType::name].
11696 UnknownValue(content_type::UnknownValue),
11697}
11698
11699#[doc(hidden)]
11700pub mod content_type {
11701 #[allow(unused_imports)]
11702 use super::*;
11703 #[derive(Clone, Debug, PartialEq)]
11704 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11705}
11706
11707impl ContentType {
11708 /// Gets the enum value.
11709 ///
11710 /// Returns `None` if the enum contains an unknown value deserialized from
11711 /// the string representation of enums.
11712 pub fn value(&self) -> std::option::Option<i32> {
11713 match self {
11714 Self::Unspecified => std::option::Option::Some(0),
11715 Self::Resource => std::option::Option::Some(1),
11716 Self::IamPolicy => std::option::Option::Some(2),
11717 Self::OrgPolicy => std::option::Option::Some(4),
11718 Self::AccessPolicy => std::option::Option::Some(5),
11719 Self::OsInventory => std::option::Option::Some(6),
11720 Self::Relationship => std::option::Option::Some(7),
11721 Self::UnknownValue(u) => u.0.value(),
11722 }
11723 }
11724
11725 /// Gets the enum value as a string.
11726 ///
11727 /// Returns `None` if the enum contains an unknown value deserialized from
11728 /// the integer representation of enums.
11729 pub fn name(&self) -> std::option::Option<&str> {
11730 match self {
11731 Self::Unspecified => std::option::Option::Some("CONTENT_TYPE_UNSPECIFIED"),
11732 Self::Resource => std::option::Option::Some("RESOURCE"),
11733 Self::IamPolicy => std::option::Option::Some("IAM_POLICY"),
11734 Self::OrgPolicy => std::option::Option::Some("ORG_POLICY"),
11735 Self::AccessPolicy => std::option::Option::Some("ACCESS_POLICY"),
11736 Self::OsInventory => std::option::Option::Some("OS_INVENTORY"),
11737 Self::Relationship => std::option::Option::Some("RELATIONSHIP"),
11738 Self::UnknownValue(u) => u.0.name(),
11739 }
11740 }
11741}
11742
11743impl std::default::Default for ContentType {
11744 fn default() -> Self {
11745 use std::convert::From;
11746 Self::from(0)
11747 }
11748}
11749
11750impl std::fmt::Display for ContentType {
11751 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11752 wkt::internal::display_enum(f, self.name(), self.value())
11753 }
11754}
11755
11756impl std::convert::From<i32> for ContentType {
11757 fn from(value: i32) -> Self {
11758 match value {
11759 0 => Self::Unspecified,
11760 1 => Self::Resource,
11761 2 => Self::IamPolicy,
11762 4 => Self::OrgPolicy,
11763 5 => Self::AccessPolicy,
11764 6 => Self::OsInventory,
11765 7 => Self::Relationship,
11766 _ => Self::UnknownValue(content_type::UnknownValue(
11767 wkt::internal::UnknownEnumValue::Integer(value),
11768 )),
11769 }
11770 }
11771}
11772
11773impl std::convert::From<&str> for ContentType {
11774 fn from(value: &str) -> Self {
11775 use std::string::ToString;
11776 match value {
11777 "CONTENT_TYPE_UNSPECIFIED" => Self::Unspecified,
11778 "RESOURCE" => Self::Resource,
11779 "IAM_POLICY" => Self::IamPolicy,
11780 "ORG_POLICY" => Self::OrgPolicy,
11781 "ACCESS_POLICY" => Self::AccessPolicy,
11782 "OS_INVENTORY" => Self::OsInventory,
11783 "RELATIONSHIP" => Self::Relationship,
11784 _ => Self::UnknownValue(content_type::UnknownValue(
11785 wkt::internal::UnknownEnumValue::String(value.to_string()),
11786 )),
11787 }
11788 }
11789}
11790
11791impl serde::ser::Serialize for ContentType {
11792 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11793 where
11794 S: serde::Serializer,
11795 {
11796 match self {
11797 Self::Unspecified => serializer.serialize_i32(0),
11798 Self::Resource => serializer.serialize_i32(1),
11799 Self::IamPolicy => serializer.serialize_i32(2),
11800 Self::OrgPolicy => serializer.serialize_i32(4),
11801 Self::AccessPolicy => serializer.serialize_i32(5),
11802 Self::OsInventory => serializer.serialize_i32(6),
11803 Self::Relationship => serializer.serialize_i32(7),
11804 Self::UnknownValue(u) => u.0.serialize(serializer),
11805 }
11806 }
11807}
11808
11809impl<'de> serde::de::Deserialize<'de> for ContentType {
11810 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11811 where
11812 D: serde::Deserializer<'de>,
11813 {
11814 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentType>::new(
11815 ".google.cloud.asset.v1.ContentType",
11816 ))
11817 }
11818}