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 async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_identity_accesscontextmanager_v1;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_orgpolicy_v1;
29extern crate google_cloud_osconfig_v1;
30extern crate google_cloud_rpc;
31extern crate google_cloud_type;
32extern crate serde;
33extern crate serde_json;
34extern crate serde_with;
35extern crate std;
36extern crate tracing;
37extern crate wkt;
38
39mod debug;
40mod deserialize;
41mod serialize;
42
43/// The resource owners information.
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct ResourceOwners {
47 /// List of resource owners.
48 pub resource_owners: std::vec::Vec<std::string::String>,
49
50 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
51}
52
53impl ResourceOwners {
54 pub fn new() -> Self {
55 std::default::Default::default()
56 }
57
58 /// Sets the value of [resource_owners][crate::model::ResourceOwners::resource_owners].
59 ///
60 /// # Example
61 /// ```ignore,no_run
62 /// # use google_cloud_asset_v1::model::ResourceOwners;
63 /// let x = ResourceOwners::new().set_resource_owners(["a", "b", "c"]);
64 /// ```
65 pub fn set_resource_owners<T, V>(mut self, v: T) -> Self
66 where
67 T: std::iter::IntoIterator<Item = V>,
68 V: std::convert::Into<std::string::String>,
69 {
70 use std::iter::Iterator;
71 self.resource_owners = v.into_iter().map(|i| i.into()).collect();
72 self
73 }
74}
75
76impl wkt::message::Message for ResourceOwners {
77 fn typename() -> &'static str {
78 "type.googleapis.com/google.cloud.asset.v1.ResourceOwners"
79 }
80}
81
82/// Represents the metadata of the longrunning operation for the
83/// AnalyzeIamPolicyLongrunning RPC.
84#[derive(Clone, Default, PartialEq)]
85#[non_exhaustive]
86pub struct AnalyzeIamPolicyLongrunningMetadata {
87 /// Output only. The time the operation was created.
88 pub create_time: std::option::Option<wkt::Timestamp>,
89
90 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
91}
92
93impl AnalyzeIamPolicyLongrunningMetadata {
94 pub fn new() -> Self {
95 std::default::Default::default()
96 }
97
98 /// Sets the value of [create_time][crate::model::AnalyzeIamPolicyLongrunningMetadata::create_time].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningMetadata;
103 /// use wkt::Timestamp;
104 /// let x = AnalyzeIamPolicyLongrunningMetadata::new().set_create_time(Timestamp::default()/* use setters */);
105 /// ```
106 pub fn set_create_time<T>(mut self, v: T) -> Self
107 where
108 T: std::convert::Into<wkt::Timestamp>,
109 {
110 self.create_time = std::option::Option::Some(v.into());
111 self
112 }
113
114 /// Sets or clears the value of [create_time][crate::model::AnalyzeIamPolicyLongrunningMetadata::create_time].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningMetadata;
119 /// use wkt::Timestamp;
120 /// let x = AnalyzeIamPolicyLongrunningMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
121 /// let x = AnalyzeIamPolicyLongrunningMetadata::new().set_or_clear_create_time(None::<Timestamp>);
122 /// ```
123 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
124 where
125 T: std::convert::Into<wkt::Timestamp>,
126 {
127 self.create_time = v.map(|x| x.into());
128 self
129 }
130}
131
132impl wkt::message::Message for AnalyzeIamPolicyLongrunningMetadata {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata"
135 }
136}
137
138/// Export asset request.
139#[derive(Clone, Default, PartialEq)]
140#[non_exhaustive]
141pub struct ExportAssetsRequest {
142 /// Required. The relative name of the root asset. This can only be an
143 /// organization number (such as "organizations/123"), a project ID (such as
144 /// "projects/my-project-id"), or a project number (such as "projects/12345"),
145 /// or a folder number (such as "folders/123").
146 pub parent: std::string::String,
147
148 /// Timestamp to take an asset snapshot. This can only be set to a timestamp
149 /// between the current time and the current time minus 35 days (inclusive).
150 /// If not specified, the current time will be used. Due to delays in resource
151 /// data collection and indexing, there is a volatile window during which
152 /// running the same query may get different results.
153 pub read_time: std::option::Option<wkt::Timestamp>,
154
155 /// A list of asset types to take a snapshot for. For example:
156 /// "compute.googleapis.com/Disk".
157 ///
158 /// Regular expressions are also supported. For example:
159 ///
160 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
161 /// with "compute.googleapis.com".
162 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
163 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
164 ///
165 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
166 /// regular expression syntax. If the regular expression does not match any
167 /// supported asset type, an INVALID_ARGUMENT error will be returned.
168 ///
169 /// If specified, only matching assets will be returned, otherwise, it will
170 /// snapshot all asset types. See [Introduction to Cloud Asset
171 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
172 /// for all supported asset types.
173 pub asset_types: std::vec::Vec<std::string::String>,
174
175 /// Asset content type. If not specified, no content but the asset name will be
176 /// returned.
177 pub content_type: crate::model::ContentType,
178
179 /// Required. Output configuration indicating where the results will be output
180 /// to.
181 pub output_config: std::option::Option<crate::model::OutputConfig>,
182
183 /// A list of relationship types to export, for example:
184 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
185 /// content_type=RELATIONSHIP.
186 ///
187 /// * If specified:
188 /// it snapshots specified relationships. It returns an error if
189 /// any of the [relationship_types] doesn't belong to the supported
190 /// relationship types of the [asset_types] or if any of the [asset_types]
191 /// doesn't belong to the source types of the [relationship_types].
192 /// * Otherwise:
193 /// it snapshots the supported relationships for all [asset_types] or returns
194 /// an error if any of the [asset_types] has no relationship support.
195 /// An unspecified asset types field means all supported asset_types.
196 /// See [Introduction to Cloud Asset
197 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
198 /// supported asset types and relationship types.
199 pub relationship_types: std::vec::Vec<std::string::String>,
200
201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
202}
203
204impl ExportAssetsRequest {
205 pub fn new() -> Self {
206 std::default::Default::default()
207 }
208
209 /// Sets the value of [parent][crate::model::ExportAssetsRequest::parent].
210 ///
211 /// # Example
212 /// ```ignore,no_run
213 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
214 /// let x = ExportAssetsRequest::new().set_parent("example");
215 /// ```
216 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
217 self.parent = v.into();
218 self
219 }
220
221 /// Sets the value of [read_time][crate::model::ExportAssetsRequest::read_time].
222 ///
223 /// # Example
224 /// ```ignore,no_run
225 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
226 /// use wkt::Timestamp;
227 /// let x = ExportAssetsRequest::new().set_read_time(Timestamp::default()/* use setters */);
228 /// ```
229 pub fn set_read_time<T>(mut self, v: T) -> Self
230 where
231 T: std::convert::Into<wkt::Timestamp>,
232 {
233 self.read_time = std::option::Option::Some(v.into());
234 self
235 }
236
237 /// Sets or clears the value of [read_time][crate::model::ExportAssetsRequest::read_time].
238 ///
239 /// # Example
240 /// ```ignore,no_run
241 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
242 /// use wkt::Timestamp;
243 /// let x = ExportAssetsRequest::new().set_or_clear_read_time(Some(Timestamp::default()/* use setters */));
244 /// let x = ExportAssetsRequest::new().set_or_clear_read_time(None::<Timestamp>);
245 /// ```
246 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
247 where
248 T: std::convert::Into<wkt::Timestamp>,
249 {
250 self.read_time = v.map(|x| x.into());
251 self
252 }
253
254 /// Sets the value of [asset_types][crate::model::ExportAssetsRequest::asset_types].
255 ///
256 /// # Example
257 /// ```ignore,no_run
258 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
259 /// let x = ExportAssetsRequest::new().set_asset_types(["a", "b", "c"]);
260 /// ```
261 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
262 where
263 T: std::iter::IntoIterator<Item = V>,
264 V: std::convert::Into<std::string::String>,
265 {
266 use std::iter::Iterator;
267 self.asset_types = v.into_iter().map(|i| i.into()).collect();
268 self
269 }
270
271 /// Sets the value of [content_type][crate::model::ExportAssetsRequest::content_type].
272 ///
273 /// # Example
274 /// ```ignore,no_run
275 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
276 /// use google_cloud_asset_v1::model::ContentType;
277 /// let x0 = ExportAssetsRequest::new().set_content_type(ContentType::Resource);
278 /// let x1 = ExportAssetsRequest::new().set_content_type(ContentType::IamPolicy);
279 /// let x2 = ExportAssetsRequest::new().set_content_type(ContentType::OrgPolicy);
280 /// ```
281 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
282 mut self,
283 v: T,
284 ) -> Self {
285 self.content_type = v.into();
286 self
287 }
288
289 /// Sets the value of [output_config][crate::model::ExportAssetsRequest::output_config].
290 ///
291 /// # Example
292 /// ```ignore,no_run
293 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
294 /// use google_cloud_asset_v1::model::OutputConfig;
295 /// let x = ExportAssetsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
296 /// ```
297 pub fn set_output_config<T>(mut self, v: T) -> Self
298 where
299 T: std::convert::Into<crate::model::OutputConfig>,
300 {
301 self.output_config = std::option::Option::Some(v.into());
302 self
303 }
304
305 /// Sets or clears the value of [output_config][crate::model::ExportAssetsRequest::output_config].
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
310 /// use google_cloud_asset_v1::model::OutputConfig;
311 /// let x = ExportAssetsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
312 /// let x = ExportAssetsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
313 /// ```
314 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
315 where
316 T: std::convert::Into<crate::model::OutputConfig>,
317 {
318 self.output_config = v.map(|x| x.into());
319 self
320 }
321
322 /// Sets the value of [relationship_types][crate::model::ExportAssetsRequest::relationship_types].
323 ///
324 /// # Example
325 /// ```ignore,no_run
326 /// # use google_cloud_asset_v1::model::ExportAssetsRequest;
327 /// let x = ExportAssetsRequest::new().set_relationship_types(["a", "b", "c"]);
328 /// ```
329 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
330 where
331 T: std::iter::IntoIterator<Item = V>,
332 V: std::convert::Into<std::string::String>,
333 {
334 use std::iter::Iterator;
335 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
336 self
337 }
338}
339
340impl wkt::message::Message for ExportAssetsRequest {
341 fn typename() -> &'static str {
342 "type.googleapis.com/google.cloud.asset.v1.ExportAssetsRequest"
343 }
344}
345
346/// The export asset response. This message is returned by the
347/// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
348/// method in the returned
349/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
350/// field.
351///
352/// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
353#[derive(Clone, Default, PartialEq)]
354#[non_exhaustive]
355pub struct ExportAssetsResponse {
356 /// Time the snapshot was taken.
357 pub read_time: std::option::Option<wkt::Timestamp>,
358
359 /// Output configuration indicating where the results were output to.
360 pub output_config: std::option::Option<crate::model::OutputConfig>,
361
362 /// Output result indicating where the assets were exported to. For example, a
363 /// set of actual Cloud Storage object URIs where the assets are exported to.
364 /// The URIs can be different from what [output_config] has specified, as the
365 /// service will split the output object into multiple ones once it exceeds a
366 /// single Cloud Storage object limit.
367 pub output_result: std::option::Option<crate::model::OutputResult>,
368
369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
370}
371
372impl ExportAssetsResponse {
373 pub fn new() -> Self {
374 std::default::Default::default()
375 }
376
377 /// Sets the value of [read_time][crate::model::ExportAssetsResponse::read_time].
378 ///
379 /// # Example
380 /// ```ignore,no_run
381 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
382 /// use wkt::Timestamp;
383 /// let x = ExportAssetsResponse::new().set_read_time(Timestamp::default()/* use setters */);
384 /// ```
385 pub fn set_read_time<T>(mut self, v: T) -> Self
386 where
387 T: std::convert::Into<wkt::Timestamp>,
388 {
389 self.read_time = std::option::Option::Some(v.into());
390 self
391 }
392
393 /// Sets or clears the value of [read_time][crate::model::ExportAssetsResponse::read_time].
394 ///
395 /// # Example
396 /// ```ignore,no_run
397 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
398 /// use wkt::Timestamp;
399 /// let x = ExportAssetsResponse::new().set_or_clear_read_time(Some(Timestamp::default()/* use setters */));
400 /// let x = ExportAssetsResponse::new().set_or_clear_read_time(None::<Timestamp>);
401 /// ```
402 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
403 where
404 T: std::convert::Into<wkt::Timestamp>,
405 {
406 self.read_time = v.map(|x| x.into());
407 self
408 }
409
410 /// Sets the value of [output_config][crate::model::ExportAssetsResponse::output_config].
411 ///
412 /// # Example
413 /// ```ignore,no_run
414 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
415 /// use google_cloud_asset_v1::model::OutputConfig;
416 /// let x = ExportAssetsResponse::new().set_output_config(OutputConfig::default()/* use setters */);
417 /// ```
418 pub fn set_output_config<T>(mut self, v: T) -> Self
419 where
420 T: std::convert::Into<crate::model::OutputConfig>,
421 {
422 self.output_config = std::option::Option::Some(v.into());
423 self
424 }
425
426 /// Sets or clears the value of [output_config][crate::model::ExportAssetsResponse::output_config].
427 ///
428 /// # Example
429 /// ```ignore,no_run
430 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
431 /// use google_cloud_asset_v1::model::OutputConfig;
432 /// let x = ExportAssetsResponse::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
433 /// let x = ExportAssetsResponse::new().set_or_clear_output_config(None::<OutputConfig>);
434 /// ```
435 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
436 where
437 T: std::convert::Into<crate::model::OutputConfig>,
438 {
439 self.output_config = v.map(|x| x.into());
440 self
441 }
442
443 /// Sets the value of [output_result][crate::model::ExportAssetsResponse::output_result].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
448 /// use google_cloud_asset_v1::model::OutputResult;
449 /// let x = ExportAssetsResponse::new().set_output_result(OutputResult::default()/* use setters */);
450 /// ```
451 pub fn set_output_result<T>(mut self, v: T) -> Self
452 where
453 T: std::convert::Into<crate::model::OutputResult>,
454 {
455 self.output_result = std::option::Option::Some(v.into());
456 self
457 }
458
459 /// Sets or clears the value of [output_result][crate::model::ExportAssetsResponse::output_result].
460 ///
461 /// # Example
462 /// ```ignore,no_run
463 /// # use google_cloud_asset_v1::model::ExportAssetsResponse;
464 /// use google_cloud_asset_v1::model::OutputResult;
465 /// let x = ExportAssetsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
466 /// let x = ExportAssetsResponse::new().set_or_clear_output_result(None::<OutputResult>);
467 /// ```
468 pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
469 where
470 T: std::convert::Into<crate::model::OutputResult>,
471 {
472 self.output_result = v.map(|x| x.into());
473 self
474 }
475}
476
477impl wkt::message::Message for ExportAssetsResponse {
478 fn typename() -> &'static str {
479 "type.googleapis.com/google.cloud.asset.v1.ExportAssetsResponse"
480 }
481}
482
483/// ListAssets request.
484#[derive(Clone, Default, PartialEq)]
485#[non_exhaustive]
486pub struct ListAssetsRequest {
487 /// Required. Name of the organization, folder, or project the assets belong
488 /// to. Format: "organizations/[organization-number]" (such as
489 /// "organizations/123"), "projects/[project-id]" (such as
490 /// "projects/my-project-id"), "projects/[project-number]" (such as
491 /// "projects/12345"), or "folders/[folder-number]" (such as "folders/12345").
492 pub parent: std::string::String,
493
494 /// Timestamp to take an asset snapshot. This can only be set to a timestamp
495 /// between the current time and the current time minus 35 days (inclusive).
496 /// If not specified, the current time will be used. Due to delays in resource
497 /// data collection and indexing, there is a volatile window during which
498 /// running the same query may get different results.
499 pub read_time: std::option::Option<wkt::Timestamp>,
500
501 /// A list of asset types to take a snapshot for. For example:
502 /// "compute.googleapis.com/Disk".
503 ///
504 /// Regular expression is also supported. For example:
505 ///
506 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
507 /// with "compute.googleapis.com".
508 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
509 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
510 ///
511 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
512 /// regular expression syntax. If the regular expression does not match any
513 /// supported asset type, an INVALID_ARGUMENT error will be returned.
514 ///
515 /// If specified, only matching assets will be returned, otherwise, it will
516 /// snapshot all asset types. See [Introduction to Cloud Asset
517 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
518 /// for all supported asset types.
519 pub asset_types: std::vec::Vec<std::string::String>,
520
521 /// Asset content type. If not specified, no content but the asset name will
522 /// be returned.
523 pub content_type: crate::model::ContentType,
524
525 /// The maximum number of assets to be returned in a single response. Default
526 /// is 100, minimum is 1, and maximum is 1000.
527 pub page_size: i32,
528
529 /// The `next_page_token` returned from the previous `ListAssetsResponse`, or
530 /// unspecified for the first `ListAssetsRequest`. It is a continuation of a
531 /// prior `ListAssets` call, and the API should return the next page of assets.
532 pub page_token: std::string::String,
533
534 /// A list of relationship types to output, for example:
535 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
536 /// content_type=RELATIONSHIP.
537 ///
538 /// * If specified:
539 /// it snapshots specified relationships. It returns an error if
540 /// any of the [relationship_types] doesn't belong to the supported
541 /// relationship types of the [asset_types] or if any of the [asset_types]
542 /// doesn't belong to the source types of the [relationship_types].
543 /// * Otherwise:
544 /// it snapshots the supported relationships for all [asset_types] or returns
545 /// an error if any of the [asset_types] has no relationship support.
546 /// An unspecified asset types field means all supported asset_types.
547 /// See [Introduction to Cloud Asset
548 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
549 /// for all supported asset types and relationship types.
550 pub relationship_types: std::vec::Vec<std::string::String>,
551
552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
553}
554
555impl ListAssetsRequest {
556 pub fn new() -> Self {
557 std::default::Default::default()
558 }
559
560 /// Sets the value of [parent][crate::model::ListAssetsRequest::parent].
561 ///
562 /// # Example
563 /// ```ignore,no_run
564 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
565 /// let x = ListAssetsRequest::new().set_parent("example");
566 /// ```
567 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
568 self.parent = v.into();
569 self
570 }
571
572 /// Sets the value of [read_time][crate::model::ListAssetsRequest::read_time].
573 ///
574 /// # Example
575 /// ```ignore,no_run
576 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
577 /// use wkt::Timestamp;
578 /// let x = ListAssetsRequest::new().set_read_time(Timestamp::default()/* use setters */);
579 /// ```
580 pub fn set_read_time<T>(mut self, v: T) -> Self
581 where
582 T: std::convert::Into<wkt::Timestamp>,
583 {
584 self.read_time = std::option::Option::Some(v.into());
585 self
586 }
587
588 /// Sets or clears the value of [read_time][crate::model::ListAssetsRequest::read_time].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
593 /// use wkt::Timestamp;
594 /// let x = ListAssetsRequest::new().set_or_clear_read_time(Some(Timestamp::default()/* use setters */));
595 /// let x = ListAssetsRequest::new().set_or_clear_read_time(None::<Timestamp>);
596 /// ```
597 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
598 where
599 T: std::convert::Into<wkt::Timestamp>,
600 {
601 self.read_time = v.map(|x| x.into());
602 self
603 }
604
605 /// Sets the value of [asset_types][crate::model::ListAssetsRequest::asset_types].
606 ///
607 /// # Example
608 /// ```ignore,no_run
609 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
610 /// let x = ListAssetsRequest::new().set_asset_types(["a", "b", "c"]);
611 /// ```
612 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
613 where
614 T: std::iter::IntoIterator<Item = V>,
615 V: std::convert::Into<std::string::String>,
616 {
617 use std::iter::Iterator;
618 self.asset_types = v.into_iter().map(|i| i.into()).collect();
619 self
620 }
621
622 /// Sets the value of [content_type][crate::model::ListAssetsRequest::content_type].
623 ///
624 /// # Example
625 /// ```ignore,no_run
626 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
627 /// use google_cloud_asset_v1::model::ContentType;
628 /// let x0 = ListAssetsRequest::new().set_content_type(ContentType::Resource);
629 /// let x1 = ListAssetsRequest::new().set_content_type(ContentType::IamPolicy);
630 /// let x2 = ListAssetsRequest::new().set_content_type(ContentType::OrgPolicy);
631 /// ```
632 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
633 mut self,
634 v: T,
635 ) -> Self {
636 self.content_type = v.into();
637 self
638 }
639
640 /// Sets the value of [page_size][crate::model::ListAssetsRequest::page_size].
641 ///
642 /// # Example
643 /// ```ignore,no_run
644 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
645 /// let x = ListAssetsRequest::new().set_page_size(42);
646 /// ```
647 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
648 self.page_size = v.into();
649 self
650 }
651
652 /// Sets the value of [page_token][crate::model::ListAssetsRequest::page_token].
653 ///
654 /// # Example
655 /// ```ignore,no_run
656 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
657 /// let x = ListAssetsRequest::new().set_page_token("example");
658 /// ```
659 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
660 self.page_token = v.into();
661 self
662 }
663
664 /// Sets the value of [relationship_types][crate::model::ListAssetsRequest::relationship_types].
665 ///
666 /// # Example
667 /// ```ignore,no_run
668 /// # use google_cloud_asset_v1::model::ListAssetsRequest;
669 /// let x = ListAssetsRequest::new().set_relationship_types(["a", "b", "c"]);
670 /// ```
671 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
672 where
673 T: std::iter::IntoIterator<Item = V>,
674 V: std::convert::Into<std::string::String>,
675 {
676 use std::iter::Iterator;
677 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
678 self
679 }
680}
681
682impl wkt::message::Message for ListAssetsRequest {
683 fn typename() -> &'static str {
684 "type.googleapis.com/google.cloud.asset.v1.ListAssetsRequest"
685 }
686}
687
688/// ListAssets response.
689#[derive(Clone, Default, PartialEq)]
690#[non_exhaustive]
691pub struct ListAssetsResponse {
692 /// Time the snapshot was taken.
693 pub read_time: std::option::Option<wkt::Timestamp>,
694
695 /// Assets.
696 pub assets: std::vec::Vec<crate::model::Asset>,
697
698 /// Token to retrieve the next page of results. It expires 72 hours after the
699 /// page token for the first page is generated. Set to empty if there are no
700 /// remaining results.
701 pub next_page_token: std::string::String,
702
703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
704}
705
706impl ListAssetsResponse {
707 pub fn new() -> Self {
708 std::default::Default::default()
709 }
710
711 /// Sets the value of [read_time][crate::model::ListAssetsResponse::read_time].
712 ///
713 /// # Example
714 /// ```ignore,no_run
715 /// # use google_cloud_asset_v1::model::ListAssetsResponse;
716 /// use wkt::Timestamp;
717 /// let x = ListAssetsResponse::new().set_read_time(Timestamp::default()/* use setters */);
718 /// ```
719 pub fn set_read_time<T>(mut self, v: T) -> Self
720 where
721 T: std::convert::Into<wkt::Timestamp>,
722 {
723 self.read_time = std::option::Option::Some(v.into());
724 self
725 }
726
727 /// Sets or clears the value of [read_time][crate::model::ListAssetsResponse::read_time].
728 ///
729 /// # Example
730 /// ```ignore,no_run
731 /// # use google_cloud_asset_v1::model::ListAssetsResponse;
732 /// use wkt::Timestamp;
733 /// let x = ListAssetsResponse::new().set_or_clear_read_time(Some(Timestamp::default()/* use setters */));
734 /// let x = ListAssetsResponse::new().set_or_clear_read_time(None::<Timestamp>);
735 /// ```
736 pub fn set_or_clear_read_time<T>(mut self, v: std::option::Option<T>) -> Self
737 where
738 T: std::convert::Into<wkt::Timestamp>,
739 {
740 self.read_time = v.map(|x| x.into());
741 self
742 }
743
744 /// Sets the value of [assets][crate::model::ListAssetsResponse::assets].
745 ///
746 /// # Example
747 /// ```ignore,no_run
748 /// # use google_cloud_asset_v1::model::ListAssetsResponse;
749 /// use google_cloud_asset_v1::model::Asset;
750 /// let x = ListAssetsResponse::new()
751 /// .set_assets([
752 /// Asset::default()/* use setters */,
753 /// Asset::default()/* use (different) setters */,
754 /// ]);
755 /// ```
756 pub fn set_assets<T, V>(mut self, v: T) -> Self
757 where
758 T: std::iter::IntoIterator<Item = V>,
759 V: std::convert::Into<crate::model::Asset>,
760 {
761 use std::iter::Iterator;
762 self.assets = v.into_iter().map(|i| i.into()).collect();
763 self
764 }
765
766 /// Sets the value of [next_page_token][crate::model::ListAssetsResponse::next_page_token].
767 ///
768 /// # Example
769 /// ```ignore,no_run
770 /// # use google_cloud_asset_v1::model::ListAssetsResponse;
771 /// let x = ListAssetsResponse::new().set_next_page_token("example");
772 /// ```
773 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
774 self.next_page_token = v.into();
775 self
776 }
777}
778
779impl wkt::message::Message for ListAssetsResponse {
780 fn typename() -> &'static str {
781 "type.googleapis.com/google.cloud.asset.v1.ListAssetsResponse"
782 }
783}
784
785#[doc(hidden)]
786impl google_cloud_gax::paginator::internal::PageableResponse for ListAssetsResponse {
787 type PageItem = crate::model::Asset;
788
789 fn items(self) -> std::vec::Vec<Self::PageItem> {
790 self.assets
791 }
792
793 fn next_page_token(&self) -> std::string::String {
794 use std::clone::Clone;
795 self.next_page_token.clone()
796 }
797}
798
799/// Batch get assets history request.
800#[derive(Clone, Default, PartialEq)]
801#[non_exhaustive]
802pub struct BatchGetAssetsHistoryRequest {
803 /// Required. The relative name of the root asset. It can only be an
804 /// organization number (such as "organizations/123"), a project ID (such as
805 /// "projects/my-project-id")", or a project number (such as "projects/12345").
806 pub parent: std::string::String,
807
808 /// A list of the full names of the assets.
809 /// See: <https://cloud.google.com/asset-inventory/docs/resource-name-format>
810 /// Example:
811 ///
812 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
813 ///
814 /// The request becomes a no-op if the asset name list is empty, and the max
815 /// size of the asset name list is 100 in one request.
816 pub asset_names: std::vec::Vec<std::string::String>,
817
818 /// Optional. The content type.
819 pub content_type: crate::model::ContentType,
820
821 /// Optional. The time window for the asset history. Both start_time and
822 /// end_time are optional and if set, it must be after the current time minus
823 /// 35 days. If end_time is not set, it is default to current timestamp.
824 /// If start_time is not set, the snapshot of the assets at end_time will be
825 /// returned. The returned results contain all temporal assets whose time
826 /// window overlap with read_time_window.
827 pub read_time_window: std::option::Option<crate::model::TimeWindow>,
828
829 /// Optional. A list of relationship types to output, for example:
830 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
831 /// content_type=RELATIONSHIP.
832 ///
833 /// * If specified:
834 /// it outputs specified relationships' history on the [asset_names]. It
835 /// returns an error if any of the [relationship_types] doesn't belong to the
836 /// supported relationship types of the [asset_names] or if any of the
837 /// [asset_names]'s types doesn't belong to the source types of the
838 /// [relationship_types].
839 /// * Otherwise:
840 /// it outputs the supported relationships' history on the [asset_names] or
841 /// returns an error if any of the [asset_names]'s types has no relationship
842 /// support.
843 /// See [Introduction to Cloud Asset
844 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
845 /// supported asset types and relationship types.
846 pub relationship_types: std::vec::Vec<std::string::String>,
847
848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
849}
850
851impl BatchGetAssetsHistoryRequest {
852 pub fn new() -> Self {
853 std::default::Default::default()
854 }
855
856 /// Sets the value of [parent][crate::model::BatchGetAssetsHistoryRequest::parent].
857 ///
858 /// # Example
859 /// ```ignore,no_run
860 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
861 /// let x = BatchGetAssetsHistoryRequest::new().set_parent("example");
862 /// ```
863 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
864 self.parent = v.into();
865 self
866 }
867
868 /// Sets the value of [asset_names][crate::model::BatchGetAssetsHistoryRequest::asset_names].
869 ///
870 /// # Example
871 /// ```ignore,no_run
872 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
873 /// let x = BatchGetAssetsHistoryRequest::new().set_asset_names(["a", "b", "c"]);
874 /// ```
875 pub fn set_asset_names<T, V>(mut self, v: T) -> Self
876 where
877 T: std::iter::IntoIterator<Item = V>,
878 V: std::convert::Into<std::string::String>,
879 {
880 use std::iter::Iterator;
881 self.asset_names = v.into_iter().map(|i| i.into()).collect();
882 self
883 }
884
885 /// Sets the value of [content_type][crate::model::BatchGetAssetsHistoryRequest::content_type].
886 ///
887 /// # Example
888 /// ```ignore,no_run
889 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
890 /// use google_cloud_asset_v1::model::ContentType;
891 /// let x0 = BatchGetAssetsHistoryRequest::new().set_content_type(ContentType::Resource);
892 /// let x1 = BatchGetAssetsHistoryRequest::new().set_content_type(ContentType::IamPolicy);
893 /// let x2 = BatchGetAssetsHistoryRequest::new().set_content_type(ContentType::OrgPolicy);
894 /// ```
895 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
896 mut self,
897 v: T,
898 ) -> Self {
899 self.content_type = v.into();
900 self
901 }
902
903 /// Sets the value of [read_time_window][crate::model::BatchGetAssetsHistoryRequest::read_time_window].
904 ///
905 /// # Example
906 /// ```ignore,no_run
907 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
908 /// use google_cloud_asset_v1::model::TimeWindow;
909 /// let x = BatchGetAssetsHistoryRequest::new().set_read_time_window(TimeWindow::default()/* use setters */);
910 /// ```
911 pub fn set_read_time_window<T>(mut self, v: T) -> Self
912 where
913 T: std::convert::Into<crate::model::TimeWindow>,
914 {
915 self.read_time_window = std::option::Option::Some(v.into());
916 self
917 }
918
919 /// Sets or clears the value of [read_time_window][crate::model::BatchGetAssetsHistoryRequest::read_time_window].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
924 /// use google_cloud_asset_v1::model::TimeWindow;
925 /// let x = BatchGetAssetsHistoryRequest::new().set_or_clear_read_time_window(Some(TimeWindow::default()/* use setters */));
926 /// let x = BatchGetAssetsHistoryRequest::new().set_or_clear_read_time_window(None::<TimeWindow>);
927 /// ```
928 pub fn set_or_clear_read_time_window<T>(mut self, v: std::option::Option<T>) -> Self
929 where
930 T: std::convert::Into<crate::model::TimeWindow>,
931 {
932 self.read_time_window = v.map(|x| x.into());
933 self
934 }
935
936 /// Sets the value of [relationship_types][crate::model::BatchGetAssetsHistoryRequest::relationship_types].
937 ///
938 /// # Example
939 /// ```ignore,no_run
940 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryRequest;
941 /// let x = BatchGetAssetsHistoryRequest::new().set_relationship_types(["a", "b", "c"]);
942 /// ```
943 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
944 where
945 T: std::iter::IntoIterator<Item = V>,
946 V: std::convert::Into<std::string::String>,
947 {
948 use std::iter::Iterator;
949 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
950 self
951 }
952}
953
954impl wkt::message::Message for BatchGetAssetsHistoryRequest {
955 fn typename() -> &'static str {
956 "type.googleapis.com/google.cloud.asset.v1.BatchGetAssetsHistoryRequest"
957 }
958}
959
960/// Batch get assets history response.
961#[derive(Clone, Default, PartialEq)]
962#[non_exhaustive]
963pub struct BatchGetAssetsHistoryResponse {
964 /// A list of assets with valid time windows.
965 pub assets: std::vec::Vec<crate::model::TemporalAsset>,
966
967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
968}
969
970impl BatchGetAssetsHistoryResponse {
971 pub fn new() -> Self {
972 std::default::Default::default()
973 }
974
975 /// Sets the value of [assets][crate::model::BatchGetAssetsHistoryResponse::assets].
976 ///
977 /// # Example
978 /// ```ignore,no_run
979 /// # use google_cloud_asset_v1::model::BatchGetAssetsHistoryResponse;
980 /// use google_cloud_asset_v1::model::TemporalAsset;
981 /// let x = BatchGetAssetsHistoryResponse::new()
982 /// .set_assets([
983 /// TemporalAsset::default()/* use setters */,
984 /// TemporalAsset::default()/* use (different) setters */,
985 /// ]);
986 /// ```
987 pub fn set_assets<T, V>(mut self, v: T) -> Self
988 where
989 T: std::iter::IntoIterator<Item = V>,
990 V: std::convert::Into<crate::model::TemporalAsset>,
991 {
992 use std::iter::Iterator;
993 self.assets = v.into_iter().map(|i| i.into()).collect();
994 self
995 }
996}
997
998impl wkt::message::Message for BatchGetAssetsHistoryResponse {
999 fn typename() -> &'static str {
1000 "type.googleapis.com/google.cloud.asset.v1.BatchGetAssetsHistoryResponse"
1001 }
1002}
1003
1004/// Create asset feed request.
1005#[derive(Clone, Default, PartialEq)]
1006#[non_exhaustive]
1007pub struct CreateFeedRequest {
1008 /// Required. The name of the project/folder/organization where this feed
1009 /// should be created in. It can only be an organization number (such as
1010 /// "organizations/123"), a folder number (such as "folders/123"), a project ID
1011 /// (such as "projects/my-project-id"), or a project number (such as
1012 /// "projects/12345").
1013 pub parent: std::string::String,
1014
1015 /// Required. This is the client-assigned asset feed identifier and it needs to
1016 /// be unique under a specific parent project/folder/organization.
1017 pub feed_id: std::string::String,
1018
1019 /// Required. The feed details. The field `name` must be empty and it will be
1020 /// generated in the format of: projects/project_number/feeds/feed_id
1021 /// folders/folder_number/feeds/feed_id
1022 /// organizations/organization_number/feeds/feed_id
1023 pub feed: std::option::Option<crate::model::Feed>,
1024
1025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1026}
1027
1028impl CreateFeedRequest {
1029 pub fn new() -> Self {
1030 std::default::Default::default()
1031 }
1032
1033 /// Sets the value of [parent][crate::model::CreateFeedRequest::parent].
1034 ///
1035 /// # Example
1036 /// ```ignore,no_run
1037 /// # use google_cloud_asset_v1::model::CreateFeedRequest;
1038 /// let x = CreateFeedRequest::new().set_parent("example");
1039 /// ```
1040 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1041 self.parent = v.into();
1042 self
1043 }
1044
1045 /// Sets the value of [feed_id][crate::model::CreateFeedRequest::feed_id].
1046 ///
1047 /// # Example
1048 /// ```ignore,no_run
1049 /// # use google_cloud_asset_v1::model::CreateFeedRequest;
1050 /// let x = CreateFeedRequest::new().set_feed_id("example");
1051 /// ```
1052 pub fn set_feed_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1053 self.feed_id = v.into();
1054 self
1055 }
1056
1057 /// Sets the value of [feed][crate::model::CreateFeedRequest::feed].
1058 ///
1059 /// # Example
1060 /// ```ignore,no_run
1061 /// # use google_cloud_asset_v1::model::CreateFeedRequest;
1062 /// use google_cloud_asset_v1::model::Feed;
1063 /// let x = CreateFeedRequest::new().set_feed(Feed::default()/* use setters */);
1064 /// ```
1065 pub fn set_feed<T>(mut self, v: T) -> Self
1066 where
1067 T: std::convert::Into<crate::model::Feed>,
1068 {
1069 self.feed = std::option::Option::Some(v.into());
1070 self
1071 }
1072
1073 /// Sets or clears the value of [feed][crate::model::CreateFeedRequest::feed].
1074 ///
1075 /// # Example
1076 /// ```ignore,no_run
1077 /// # use google_cloud_asset_v1::model::CreateFeedRequest;
1078 /// use google_cloud_asset_v1::model::Feed;
1079 /// let x = CreateFeedRequest::new().set_or_clear_feed(Some(Feed::default()/* use setters */));
1080 /// let x = CreateFeedRequest::new().set_or_clear_feed(None::<Feed>);
1081 /// ```
1082 pub fn set_or_clear_feed<T>(mut self, v: std::option::Option<T>) -> Self
1083 where
1084 T: std::convert::Into<crate::model::Feed>,
1085 {
1086 self.feed = v.map(|x| x.into());
1087 self
1088 }
1089}
1090
1091impl wkt::message::Message for CreateFeedRequest {
1092 fn typename() -> &'static str {
1093 "type.googleapis.com/google.cloud.asset.v1.CreateFeedRequest"
1094 }
1095}
1096
1097/// Get asset feed request.
1098#[derive(Clone, Default, PartialEq)]
1099#[non_exhaustive]
1100pub struct GetFeedRequest {
1101 /// Required. The name of the Feed and it must be in the format of:
1102 /// projects/project_number/feeds/feed_id
1103 /// folders/folder_number/feeds/feed_id
1104 /// organizations/organization_number/feeds/feed_id
1105 pub name: std::string::String,
1106
1107 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1108}
1109
1110impl GetFeedRequest {
1111 pub fn new() -> Self {
1112 std::default::Default::default()
1113 }
1114
1115 /// Sets the value of [name][crate::model::GetFeedRequest::name].
1116 ///
1117 /// # Example
1118 /// ```ignore,no_run
1119 /// # use google_cloud_asset_v1::model::GetFeedRequest;
1120 /// let x = GetFeedRequest::new().set_name("example");
1121 /// ```
1122 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1123 self.name = v.into();
1124 self
1125 }
1126}
1127
1128impl wkt::message::Message for GetFeedRequest {
1129 fn typename() -> &'static str {
1130 "type.googleapis.com/google.cloud.asset.v1.GetFeedRequest"
1131 }
1132}
1133
1134/// List asset feeds request.
1135#[derive(Clone, Default, PartialEq)]
1136#[non_exhaustive]
1137pub struct ListFeedsRequest {
1138 /// Required. The parent project/folder/organization whose feeds are to be
1139 /// listed. It can only be using project/folder/organization number (such as
1140 /// "folders/12345")", or a project ID (such as "projects/my-project-id").
1141 pub parent: std::string::String,
1142
1143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1144}
1145
1146impl ListFeedsRequest {
1147 pub fn new() -> Self {
1148 std::default::Default::default()
1149 }
1150
1151 /// Sets the value of [parent][crate::model::ListFeedsRequest::parent].
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_asset_v1::model::ListFeedsRequest;
1156 /// let x = ListFeedsRequest::new().set_parent("example");
1157 /// ```
1158 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1159 self.parent = v.into();
1160 self
1161 }
1162}
1163
1164impl wkt::message::Message for ListFeedsRequest {
1165 fn typename() -> &'static str {
1166 "type.googleapis.com/google.cloud.asset.v1.ListFeedsRequest"
1167 }
1168}
1169
1170#[derive(Clone, Default, PartialEq)]
1171#[non_exhaustive]
1172pub struct ListFeedsResponse {
1173 /// A list of feeds.
1174 pub feeds: std::vec::Vec<crate::model::Feed>,
1175
1176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1177}
1178
1179impl ListFeedsResponse {
1180 pub fn new() -> Self {
1181 std::default::Default::default()
1182 }
1183
1184 /// Sets the value of [feeds][crate::model::ListFeedsResponse::feeds].
1185 ///
1186 /// # Example
1187 /// ```ignore,no_run
1188 /// # use google_cloud_asset_v1::model::ListFeedsResponse;
1189 /// use google_cloud_asset_v1::model::Feed;
1190 /// let x = ListFeedsResponse::new()
1191 /// .set_feeds([
1192 /// Feed::default()/* use setters */,
1193 /// Feed::default()/* use (different) setters */,
1194 /// ]);
1195 /// ```
1196 pub fn set_feeds<T, V>(mut self, v: T) -> Self
1197 where
1198 T: std::iter::IntoIterator<Item = V>,
1199 V: std::convert::Into<crate::model::Feed>,
1200 {
1201 use std::iter::Iterator;
1202 self.feeds = v.into_iter().map(|i| i.into()).collect();
1203 self
1204 }
1205}
1206
1207impl wkt::message::Message for ListFeedsResponse {
1208 fn typename() -> &'static str {
1209 "type.googleapis.com/google.cloud.asset.v1.ListFeedsResponse"
1210 }
1211}
1212
1213/// Update asset feed request.
1214#[derive(Clone, Default, PartialEq)]
1215#[non_exhaustive]
1216pub struct UpdateFeedRequest {
1217 /// Required. The new values of feed details. It must match an existing feed
1218 /// and the field `name` must be in the format of:
1219 /// projects/project_number/feeds/feed_id or
1220 /// folders/folder_number/feeds/feed_id or
1221 /// organizations/organization_number/feeds/feed_id.
1222 pub feed: std::option::Option<crate::model::Feed>,
1223
1224 /// Required. Only updates the `feed` fields indicated by this mask.
1225 /// The field mask must not be empty, and it must not contain fields that
1226 /// are immutable or only set by the server.
1227 pub update_mask: std::option::Option<wkt::FieldMask>,
1228
1229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1230}
1231
1232impl UpdateFeedRequest {
1233 pub fn new() -> Self {
1234 std::default::Default::default()
1235 }
1236
1237 /// Sets the value of [feed][crate::model::UpdateFeedRequest::feed].
1238 ///
1239 /// # Example
1240 /// ```ignore,no_run
1241 /// # use google_cloud_asset_v1::model::UpdateFeedRequest;
1242 /// use google_cloud_asset_v1::model::Feed;
1243 /// let x = UpdateFeedRequest::new().set_feed(Feed::default()/* use setters */);
1244 /// ```
1245 pub fn set_feed<T>(mut self, v: T) -> Self
1246 where
1247 T: std::convert::Into<crate::model::Feed>,
1248 {
1249 self.feed = std::option::Option::Some(v.into());
1250 self
1251 }
1252
1253 /// Sets or clears the value of [feed][crate::model::UpdateFeedRequest::feed].
1254 ///
1255 /// # Example
1256 /// ```ignore,no_run
1257 /// # use google_cloud_asset_v1::model::UpdateFeedRequest;
1258 /// use google_cloud_asset_v1::model::Feed;
1259 /// let x = UpdateFeedRequest::new().set_or_clear_feed(Some(Feed::default()/* use setters */));
1260 /// let x = UpdateFeedRequest::new().set_or_clear_feed(None::<Feed>);
1261 /// ```
1262 pub fn set_or_clear_feed<T>(mut self, v: std::option::Option<T>) -> Self
1263 where
1264 T: std::convert::Into<crate::model::Feed>,
1265 {
1266 self.feed = v.map(|x| x.into());
1267 self
1268 }
1269
1270 /// Sets the value of [update_mask][crate::model::UpdateFeedRequest::update_mask].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_asset_v1::model::UpdateFeedRequest;
1275 /// use wkt::FieldMask;
1276 /// let x = UpdateFeedRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1277 /// ```
1278 pub fn set_update_mask<T>(mut self, v: T) -> Self
1279 where
1280 T: std::convert::Into<wkt::FieldMask>,
1281 {
1282 self.update_mask = std::option::Option::Some(v.into());
1283 self
1284 }
1285
1286 /// Sets or clears the value of [update_mask][crate::model::UpdateFeedRequest::update_mask].
1287 ///
1288 /// # Example
1289 /// ```ignore,no_run
1290 /// # use google_cloud_asset_v1::model::UpdateFeedRequest;
1291 /// use wkt::FieldMask;
1292 /// let x = UpdateFeedRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1293 /// let x = UpdateFeedRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1294 /// ```
1295 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1296 where
1297 T: std::convert::Into<wkt::FieldMask>,
1298 {
1299 self.update_mask = v.map(|x| x.into());
1300 self
1301 }
1302}
1303
1304impl wkt::message::Message for UpdateFeedRequest {
1305 fn typename() -> &'static str {
1306 "type.googleapis.com/google.cloud.asset.v1.UpdateFeedRequest"
1307 }
1308}
1309
1310#[derive(Clone, Default, PartialEq)]
1311#[non_exhaustive]
1312pub struct DeleteFeedRequest {
1313 /// Required. The name of the feed and it must be in the format of:
1314 /// projects/project_number/feeds/feed_id
1315 /// folders/folder_number/feeds/feed_id
1316 /// organizations/organization_number/feeds/feed_id
1317 pub name: std::string::String,
1318
1319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1320}
1321
1322impl DeleteFeedRequest {
1323 pub fn new() -> Self {
1324 std::default::Default::default()
1325 }
1326
1327 /// Sets the value of [name][crate::model::DeleteFeedRequest::name].
1328 ///
1329 /// # Example
1330 /// ```ignore,no_run
1331 /// # use google_cloud_asset_v1::model::DeleteFeedRequest;
1332 /// let x = DeleteFeedRequest::new().set_name("example");
1333 /// ```
1334 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1335 self.name = v.into();
1336 self
1337 }
1338}
1339
1340impl wkt::message::Message for DeleteFeedRequest {
1341 fn typename() -> &'static str {
1342 "type.googleapis.com/google.cloud.asset.v1.DeleteFeedRequest"
1343 }
1344}
1345
1346/// Output configuration for export assets destination.
1347#[derive(Clone, Default, PartialEq)]
1348#[non_exhaustive]
1349pub struct OutputConfig {
1350 /// Asset export destination.
1351 pub destination: std::option::Option<crate::model::output_config::Destination>,
1352
1353 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1354}
1355
1356impl OutputConfig {
1357 pub fn new() -> Self {
1358 std::default::Default::default()
1359 }
1360
1361 /// Sets the value of [destination][crate::model::OutputConfig::destination].
1362 ///
1363 /// Note that all the setters affecting `destination` are mutually
1364 /// exclusive.
1365 ///
1366 /// # Example
1367 /// ```ignore,no_run
1368 /// # use google_cloud_asset_v1::model::OutputConfig;
1369 /// use google_cloud_asset_v1::model::GcsDestination;
1370 /// let x = OutputConfig::new().set_destination(Some(
1371 /// google_cloud_asset_v1::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
1372 /// ```
1373 pub fn set_destination<
1374 T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
1375 >(
1376 mut self,
1377 v: T,
1378 ) -> Self {
1379 self.destination = v.into();
1380 self
1381 }
1382
1383 /// The value of [destination][crate::model::OutputConfig::destination]
1384 /// if it holds a `GcsDestination`, `None` if the field is not set or
1385 /// holds a different branch.
1386 pub fn gcs_destination(
1387 &self,
1388 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
1389 #[allow(unreachable_patterns)]
1390 self.destination.as_ref().and_then(|v| match v {
1391 crate::model::output_config::Destination::GcsDestination(v) => {
1392 std::option::Option::Some(v)
1393 }
1394 _ => std::option::Option::None,
1395 })
1396 }
1397
1398 /// Sets the value of [destination][crate::model::OutputConfig::destination]
1399 /// to hold a `GcsDestination`.
1400 ///
1401 /// Note that all the setters affecting `destination` are
1402 /// mutually exclusive.
1403 ///
1404 /// # Example
1405 /// ```ignore,no_run
1406 /// # use google_cloud_asset_v1::model::OutputConfig;
1407 /// use google_cloud_asset_v1::model::GcsDestination;
1408 /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
1409 /// assert!(x.gcs_destination().is_some());
1410 /// assert!(x.bigquery_destination().is_none());
1411 /// ```
1412 pub fn set_gcs_destination<
1413 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
1414 >(
1415 mut self,
1416 v: T,
1417 ) -> Self {
1418 self.destination = std::option::Option::Some(
1419 crate::model::output_config::Destination::GcsDestination(v.into()),
1420 );
1421 self
1422 }
1423
1424 /// The value of [destination][crate::model::OutputConfig::destination]
1425 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
1426 /// holds a different branch.
1427 pub fn bigquery_destination(
1428 &self,
1429 ) -> std::option::Option<&std::boxed::Box<crate::model::BigQueryDestination>> {
1430 #[allow(unreachable_patterns)]
1431 self.destination.as_ref().and_then(|v| match v {
1432 crate::model::output_config::Destination::BigqueryDestination(v) => {
1433 std::option::Option::Some(v)
1434 }
1435 _ => std::option::Option::None,
1436 })
1437 }
1438
1439 /// Sets the value of [destination][crate::model::OutputConfig::destination]
1440 /// to hold a `BigqueryDestination`.
1441 ///
1442 /// Note that all the setters affecting `destination` are
1443 /// mutually exclusive.
1444 ///
1445 /// # Example
1446 /// ```ignore,no_run
1447 /// # use google_cloud_asset_v1::model::OutputConfig;
1448 /// use google_cloud_asset_v1::model::BigQueryDestination;
1449 /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
1450 /// assert!(x.bigquery_destination().is_some());
1451 /// assert!(x.gcs_destination().is_none());
1452 /// ```
1453 pub fn set_bigquery_destination<
1454 T: std::convert::Into<std::boxed::Box<crate::model::BigQueryDestination>>,
1455 >(
1456 mut self,
1457 v: T,
1458 ) -> Self {
1459 self.destination = std::option::Option::Some(
1460 crate::model::output_config::Destination::BigqueryDestination(v.into()),
1461 );
1462 self
1463 }
1464}
1465
1466impl wkt::message::Message for OutputConfig {
1467 fn typename() -> &'static str {
1468 "type.googleapis.com/google.cloud.asset.v1.OutputConfig"
1469 }
1470}
1471
1472/// Defines additional types related to [OutputConfig].
1473pub mod output_config {
1474 #[allow(unused_imports)]
1475 use super::*;
1476
1477 /// Asset export destination.
1478 #[derive(Clone, Debug, PartialEq)]
1479 #[non_exhaustive]
1480 pub enum Destination {
1481 /// Destination on Cloud Storage.
1482 GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
1483 /// Destination on BigQuery. The output table stores the fields in asset
1484 /// Protobuf as columns in BigQuery.
1485 BigqueryDestination(std::boxed::Box<crate::model::BigQueryDestination>),
1486 }
1487}
1488
1489/// Output result of export assets.
1490#[derive(Clone, Default, PartialEq)]
1491#[non_exhaustive]
1492pub struct OutputResult {
1493 /// Asset export result.
1494 pub result: std::option::Option<crate::model::output_result::Result>,
1495
1496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1497}
1498
1499impl OutputResult {
1500 pub fn new() -> Self {
1501 std::default::Default::default()
1502 }
1503
1504 /// Sets the value of [result][crate::model::OutputResult::result].
1505 ///
1506 /// Note that all the setters affecting `result` are mutually
1507 /// exclusive.
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_asset_v1::model::OutputResult;
1512 /// use google_cloud_asset_v1::model::GcsOutputResult;
1513 /// let x = OutputResult::new().set_result(Some(
1514 /// google_cloud_asset_v1::model::output_result::Result::GcsResult(GcsOutputResult::default().into())));
1515 /// ```
1516 pub fn set_result<
1517 T: std::convert::Into<std::option::Option<crate::model::output_result::Result>>,
1518 >(
1519 mut self,
1520 v: T,
1521 ) -> Self {
1522 self.result = v.into();
1523 self
1524 }
1525
1526 /// The value of [result][crate::model::OutputResult::result]
1527 /// if it holds a `GcsResult`, `None` if the field is not set or
1528 /// holds a different branch.
1529 pub fn gcs_result(
1530 &self,
1531 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsOutputResult>> {
1532 #[allow(unreachable_patterns)]
1533 self.result.as_ref().and_then(|v| match v {
1534 crate::model::output_result::Result::GcsResult(v) => std::option::Option::Some(v),
1535 _ => std::option::Option::None,
1536 })
1537 }
1538
1539 /// Sets the value of [result][crate::model::OutputResult::result]
1540 /// to hold a `GcsResult`.
1541 ///
1542 /// Note that all the setters affecting `result` are
1543 /// mutually exclusive.
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_asset_v1::model::OutputResult;
1548 /// use google_cloud_asset_v1::model::GcsOutputResult;
1549 /// let x = OutputResult::new().set_gcs_result(GcsOutputResult::default()/* use setters */);
1550 /// assert!(x.gcs_result().is_some());
1551 /// ```
1552 pub fn set_gcs_result<T: std::convert::Into<std::boxed::Box<crate::model::GcsOutputResult>>>(
1553 mut self,
1554 v: T,
1555 ) -> Self {
1556 self.result =
1557 std::option::Option::Some(crate::model::output_result::Result::GcsResult(v.into()));
1558 self
1559 }
1560}
1561
1562impl wkt::message::Message for OutputResult {
1563 fn typename() -> &'static str {
1564 "type.googleapis.com/google.cloud.asset.v1.OutputResult"
1565 }
1566}
1567
1568/// Defines additional types related to [OutputResult].
1569pub mod output_result {
1570 #[allow(unused_imports)]
1571 use super::*;
1572
1573 /// Asset export result.
1574 #[derive(Clone, Debug, PartialEq)]
1575 #[non_exhaustive]
1576 pub enum Result {
1577 /// Export result on Cloud Storage.
1578 GcsResult(std::boxed::Box<crate::model::GcsOutputResult>),
1579 }
1580}
1581
1582/// A Cloud Storage output result.
1583#[derive(Clone, Default, PartialEq)]
1584#[non_exhaustive]
1585pub struct GcsOutputResult {
1586 /// List of URIs of the Cloud Storage objects. Example:
1587 /// "gs://bucket_name/object_name".
1588 pub uris: std::vec::Vec<std::string::String>,
1589
1590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1591}
1592
1593impl GcsOutputResult {
1594 pub fn new() -> Self {
1595 std::default::Default::default()
1596 }
1597
1598 /// Sets the value of [uris][crate::model::GcsOutputResult::uris].
1599 ///
1600 /// # Example
1601 /// ```ignore,no_run
1602 /// # use google_cloud_asset_v1::model::GcsOutputResult;
1603 /// let x = GcsOutputResult::new().set_uris(["a", "b", "c"]);
1604 /// ```
1605 pub fn set_uris<T, V>(mut self, v: T) -> Self
1606 where
1607 T: std::iter::IntoIterator<Item = V>,
1608 V: std::convert::Into<std::string::String>,
1609 {
1610 use std::iter::Iterator;
1611 self.uris = v.into_iter().map(|i| i.into()).collect();
1612 self
1613 }
1614}
1615
1616impl wkt::message::Message for GcsOutputResult {
1617 fn typename() -> &'static str {
1618 "type.googleapis.com/google.cloud.asset.v1.GcsOutputResult"
1619 }
1620}
1621
1622/// A Cloud Storage location.
1623#[derive(Clone, Default, PartialEq)]
1624#[non_exhaustive]
1625pub struct GcsDestination {
1626 /// Required.
1627 pub object_uri: std::option::Option<crate::model::gcs_destination::ObjectUri>,
1628
1629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1630}
1631
1632impl GcsDestination {
1633 pub fn new() -> Self {
1634 std::default::Default::default()
1635 }
1636
1637 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri].
1638 ///
1639 /// Note that all the setters affecting `object_uri` are mutually
1640 /// exclusive.
1641 ///
1642 /// # Example
1643 /// ```ignore,no_run
1644 /// # use google_cloud_asset_v1::model::GcsDestination;
1645 /// use google_cloud_asset_v1::model::gcs_destination::ObjectUri;
1646 /// let x = GcsDestination::new().set_object_uri(Some(ObjectUri::Uri("example".to_string())));
1647 /// ```
1648 pub fn set_object_uri<
1649 T: std::convert::Into<std::option::Option<crate::model::gcs_destination::ObjectUri>>,
1650 >(
1651 mut self,
1652 v: T,
1653 ) -> Self {
1654 self.object_uri = v.into();
1655 self
1656 }
1657
1658 /// The value of [object_uri][crate::model::GcsDestination::object_uri]
1659 /// if it holds a `Uri`, `None` if the field is not set or
1660 /// holds a different branch.
1661 pub fn uri(&self) -> std::option::Option<&std::string::String> {
1662 #[allow(unreachable_patterns)]
1663 self.object_uri.as_ref().and_then(|v| match v {
1664 crate::model::gcs_destination::ObjectUri::Uri(v) => std::option::Option::Some(v),
1665 _ => std::option::Option::None,
1666 })
1667 }
1668
1669 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri]
1670 /// to hold a `Uri`.
1671 ///
1672 /// Note that all the setters affecting `object_uri` are
1673 /// mutually exclusive.
1674 ///
1675 /// # Example
1676 /// ```ignore,no_run
1677 /// # use google_cloud_asset_v1::model::GcsDestination;
1678 /// let x = GcsDestination::new().set_uri("example");
1679 /// assert!(x.uri().is_some());
1680 /// assert!(x.uri_prefix().is_none());
1681 /// ```
1682 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1683 self.object_uri =
1684 std::option::Option::Some(crate::model::gcs_destination::ObjectUri::Uri(v.into()));
1685 self
1686 }
1687
1688 /// The value of [object_uri][crate::model::GcsDestination::object_uri]
1689 /// if it holds a `UriPrefix`, `None` if the field is not set or
1690 /// holds a different branch.
1691 pub fn uri_prefix(&self) -> std::option::Option<&std::string::String> {
1692 #[allow(unreachable_patterns)]
1693 self.object_uri.as_ref().and_then(|v| match v {
1694 crate::model::gcs_destination::ObjectUri::UriPrefix(v) => std::option::Option::Some(v),
1695 _ => std::option::Option::None,
1696 })
1697 }
1698
1699 /// Sets the value of [object_uri][crate::model::GcsDestination::object_uri]
1700 /// to hold a `UriPrefix`.
1701 ///
1702 /// Note that all the setters affecting `object_uri` are
1703 /// mutually exclusive.
1704 ///
1705 /// # Example
1706 /// ```ignore,no_run
1707 /// # use google_cloud_asset_v1::model::GcsDestination;
1708 /// let x = GcsDestination::new().set_uri_prefix("example");
1709 /// assert!(x.uri_prefix().is_some());
1710 /// assert!(x.uri().is_none());
1711 /// ```
1712 pub fn set_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1713 self.object_uri = std::option::Option::Some(
1714 crate::model::gcs_destination::ObjectUri::UriPrefix(v.into()),
1715 );
1716 self
1717 }
1718}
1719
1720impl wkt::message::Message for GcsDestination {
1721 fn typename() -> &'static str {
1722 "type.googleapis.com/google.cloud.asset.v1.GcsDestination"
1723 }
1724}
1725
1726/// Defines additional types related to [GcsDestination].
1727pub mod gcs_destination {
1728 #[allow(unused_imports)]
1729 use super::*;
1730
1731 /// Required.
1732 #[derive(Clone, Debug, PartialEq)]
1733 #[non_exhaustive]
1734 pub enum ObjectUri {
1735 /// The URI of the Cloud Storage object. It's the same URI that is used by
1736 /// gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
1737 /// Editing Object
1738 /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
1739 /// for more information.
1740 ///
1741 /// If the specified Cloud Storage object already exists and there is no
1742 /// [hold](https://cloud.google.com/storage/docs/object-holds), it will be
1743 /// overwritten with the exported result.
1744 Uri(std::string::String),
1745 /// The URI prefix of all generated Cloud Storage objects. Example:
1746 /// "gs://bucket_name/object_name_prefix". Each object URI is in format:
1747 /// "gs://bucket_name/object_name_prefix/\<asset type\>/\<shard number\> and only
1748 /// contains assets for that type. \<shard number\> starts from 0. Example:
1749 /// "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is
1750 /// the first shard of output objects containing all
1751 /// compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be
1752 /// returned if file with the same name "gs://bucket_name/object_name_prefix"
1753 /// already exists.
1754 UriPrefix(std::string::String),
1755 }
1756}
1757
1758/// A BigQuery destination for exporting assets to.
1759#[derive(Clone, Default, PartialEq)]
1760#[non_exhaustive]
1761pub struct BigQueryDestination {
1762 /// Required. The BigQuery dataset in format
1763 /// "projects/projectId/datasets/datasetId", to which the snapshot result
1764 /// should be exported. If this dataset does not exist, the export call returns
1765 /// an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets`
1766 /// determines the
1767 /// [schema](/asset-inventory/docs/exporting-to-bigquery#bigquery-schema)
1768 /// of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also
1769 /// influences the schema.
1770 pub dataset: std::string::String,
1771
1772 /// Required. The BigQuery table to which the snapshot result should be
1773 /// written. If this table does not exist, a new table with the given name
1774 /// will be created.
1775 pub table: std::string::String,
1776
1777 /// If the destination table already exists and this flag is `TRUE`, the
1778 /// table will be overwritten by the contents of assets snapshot. If the flag
1779 /// is `FALSE` or unset and the destination table already exists, the export
1780 /// call returns an INVALID_ARGUMEMT error.
1781 pub force: bool,
1782
1783 /// [partition_spec] determines whether to export to partitioned table(s) and
1784 /// how to partition the data.
1785 ///
1786 /// If [partition_spec] is unset or [partition_spec.partition_key] is unset or
1787 /// `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to
1788 /// non-partitioned table(s). [force] will decide whether to overwrite existing
1789 /// table(s).
1790 ///
1791 /// If [partition_spec] is specified. First, the snapshot results will be
1792 /// written to partitioned table(s) with two additional timestamp columns,
1793 /// readTime and requestTime, one of which will be the partition key. Secondly,
1794 /// in the case when any destination table already exists, it will first try to
1795 /// update existing table's schema as necessary by appending additional
1796 /// columns. Then, if [force] is `TRUE`, the corresponding partition will be
1797 /// overwritten by the snapshot results (data in different partitions will
1798 /// remain intact); if [force] is unset or `FALSE`, it will append the data. An
1799 /// error will be returned if the schema update or data appension fails.
1800 pub partition_spec: std::option::Option<crate::model::PartitionSpec>,
1801
1802 /// If this flag is `TRUE`, the snapshot results will be written to one or
1803 /// multiple tables, each of which contains results of one asset type. The
1804 /// [force] and [partition_spec] fields will apply to each of them.
1805 ///
1806 /// Field [table] will be concatenated with "_" and the asset type names (see
1807 /// <https://cloud.google.com/asset-inventory/docs/supported-asset-types> for
1808 /// supported asset types) to construct per-asset-type table names, in which
1809 /// all non-alphanumeric characters like "." and "/" will be substituted by
1810 /// "_". Example: if field [table] is "mytable" and snapshot results
1811 /// contain "storage.googleapis.com/Bucket" assets, the corresponding table
1812 /// name will be "mytable_storage_googleapis_com_Bucket". If any of these
1813 /// tables does not exist, a new table with the concatenated name will be
1814 /// created.
1815 ///
1816 /// When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of
1817 /// each table will include RECORD-type columns mapped to the nested fields in
1818 /// the Asset.resource.data field of that asset type (up to the 15 nested level
1819 /// BigQuery supports
1820 /// (<https://cloud.google.com/bigquery/docs/nested-repeated#limitations>)). The
1821 /// fields in >15 nested levels will be stored in JSON format string as a child
1822 /// column of its parent RECORD column.
1823 ///
1824 /// If error occurs when exporting to any table, the whole export call will
1825 /// return an error but the export results that already succeed will persist.
1826 /// Example: if exporting to table_type_A succeeds when exporting to
1827 /// table_type_B fails during one export call, the results in table_type_A will
1828 /// persist and there will not be partial results persisting in a table.
1829 pub separate_tables_per_asset_type: bool,
1830
1831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1832}
1833
1834impl BigQueryDestination {
1835 pub fn new() -> Self {
1836 std::default::Default::default()
1837 }
1838
1839 /// Sets the value of [dataset][crate::model::BigQueryDestination::dataset].
1840 ///
1841 /// # Example
1842 /// ```ignore,no_run
1843 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1844 /// let x = BigQueryDestination::new().set_dataset("example");
1845 /// ```
1846 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1847 self.dataset = v.into();
1848 self
1849 }
1850
1851 /// Sets the value of [table][crate::model::BigQueryDestination::table].
1852 ///
1853 /// # Example
1854 /// ```ignore,no_run
1855 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1856 /// let x = BigQueryDestination::new().set_table("example");
1857 /// ```
1858 pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1859 self.table = v.into();
1860 self
1861 }
1862
1863 /// Sets the value of [force][crate::model::BigQueryDestination::force].
1864 ///
1865 /// # Example
1866 /// ```ignore,no_run
1867 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1868 /// let x = BigQueryDestination::new().set_force(true);
1869 /// ```
1870 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1871 self.force = v.into();
1872 self
1873 }
1874
1875 /// Sets the value of [partition_spec][crate::model::BigQueryDestination::partition_spec].
1876 ///
1877 /// # Example
1878 /// ```ignore,no_run
1879 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1880 /// use google_cloud_asset_v1::model::PartitionSpec;
1881 /// let x = BigQueryDestination::new().set_partition_spec(PartitionSpec::default()/* use setters */);
1882 /// ```
1883 pub fn set_partition_spec<T>(mut self, v: T) -> Self
1884 where
1885 T: std::convert::Into<crate::model::PartitionSpec>,
1886 {
1887 self.partition_spec = std::option::Option::Some(v.into());
1888 self
1889 }
1890
1891 /// Sets or clears the value of [partition_spec][crate::model::BigQueryDestination::partition_spec].
1892 ///
1893 /// # Example
1894 /// ```ignore,no_run
1895 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1896 /// use google_cloud_asset_v1::model::PartitionSpec;
1897 /// let x = BigQueryDestination::new().set_or_clear_partition_spec(Some(PartitionSpec::default()/* use setters */));
1898 /// let x = BigQueryDestination::new().set_or_clear_partition_spec(None::<PartitionSpec>);
1899 /// ```
1900 pub fn set_or_clear_partition_spec<T>(mut self, v: std::option::Option<T>) -> Self
1901 where
1902 T: std::convert::Into<crate::model::PartitionSpec>,
1903 {
1904 self.partition_spec = v.map(|x| x.into());
1905 self
1906 }
1907
1908 /// Sets the value of [separate_tables_per_asset_type][crate::model::BigQueryDestination::separate_tables_per_asset_type].
1909 ///
1910 /// # Example
1911 /// ```ignore,no_run
1912 /// # use google_cloud_asset_v1::model::BigQueryDestination;
1913 /// let x = BigQueryDestination::new().set_separate_tables_per_asset_type(true);
1914 /// ```
1915 pub fn set_separate_tables_per_asset_type<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1916 self.separate_tables_per_asset_type = v.into();
1917 self
1918 }
1919}
1920
1921impl wkt::message::Message for BigQueryDestination {
1922 fn typename() -> &'static str {
1923 "type.googleapis.com/google.cloud.asset.v1.BigQueryDestination"
1924 }
1925}
1926
1927/// Specifications of BigQuery partitioned table as export destination.
1928#[derive(Clone, Default, PartialEq)]
1929#[non_exhaustive]
1930pub struct PartitionSpec {
1931 /// The partition key for BigQuery partitioned table.
1932 pub partition_key: crate::model::partition_spec::PartitionKey,
1933
1934 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1935}
1936
1937impl PartitionSpec {
1938 pub fn new() -> Self {
1939 std::default::Default::default()
1940 }
1941
1942 /// Sets the value of [partition_key][crate::model::PartitionSpec::partition_key].
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_asset_v1::model::PartitionSpec;
1947 /// use google_cloud_asset_v1::model::partition_spec::PartitionKey;
1948 /// let x0 = PartitionSpec::new().set_partition_key(PartitionKey::ReadTime);
1949 /// let x1 = PartitionSpec::new().set_partition_key(PartitionKey::RequestTime);
1950 /// ```
1951 pub fn set_partition_key<T: std::convert::Into<crate::model::partition_spec::PartitionKey>>(
1952 mut self,
1953 v: T,
1954 ) -> Self {
1955 self.partition_key = v.into();
1956 self
1957 }
1958}
1959
1960impl wkt::message::Message for PartitionSpec {
1961 fn typename() -> &'static str {
1962 "type.googleapis.com/google.cloud.asset.v1.PartitionSpec"
1963 }
1964}
1965
1966/// Defines additional types related to [PartitionSpec].
1967pub mod partition_spec {
1968 #[allow(unused_imports)]
1969 use super::*;
1970
1971 /// This enum is used to determine the partition key column when exporting
1972 /// assets to BigQuery partitioned table(s). Note that, if the partition key is
1973 /// a timestamp column, the actual partition is based on its date value
1974 /// (expressed in UTC. see details in
1975 /// <https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables>).
1976 ///
1977 /// # Working with unknown values
1978 ///
1979 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1980 /// additional enum variants at any time. Adding new variants is not considered
1981 /// a breaking change. Applications should write their code in anticipation of:
1982 ///
1983 /// - New values appearing in future releases of the client library, **and**
1984 /// - New values received dynamically, without application changes.
1985 ///
1986 /// Please consult the [Working with enums] section in the user guide for some
1987 /// guidelines.
1988 ///
1989 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1990 #[derive(Clone, Debug, PartialEq)]
1991 #[non_exhaustive]
1992 pub enum PartitionKey {
1993 /// Unspecified partition key. If used, it means using non-partitioned table.
1994 Unspecified,
1995 /// The time when the snapshot is taken. If specified as partition key, the
1996 /// result table(s) is partitioned by the additional timestamp column,
1997 /// readTime. If [read_time] in ExportAssetsRequest is specified, the
1998 /// readTime column's value will be the same as it. Otherwise, its value will
1999 /// be the current time that is used to take the snapshot.
2000 ReadTime,
2001 /// The time when the request is received and started to be processed. If
2002 /// specified as partition key, the result table(s) is partitioned by the
2003 /// requestTime column, an additional timestamp column representing when the
2004 /// request was received.
2005 RequestTime,
2006 /// If set, the enum was initialized with an unknown value.
2007 ///
2008 /// Applications can examine the value using [PartitionKey::value] or
2009 /// [PartitionKey::name].
2010 UnknownValue(partition_key::UnknownValue),
2011 }
2012
2013 #[doc(hidden)]
2014 pub mod partition_key {
2015 #[allow(unused_imports)]
2016 use super::*;
2017 #[derive(Clone, Debug, PartialEq)]
2018 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2019 }
2020
2021 impl PartitionKey {
2022 /// Gets the enum value.
2023 ///
2024 /// Returns `None` if the enum contains an unknown value deserialized from
2025 /// the string representation of enums.
2026 pub fn value(&self) -> std::option::Option<i32> {
2027 match self {
2028 Self::Unspecified => std::option::Option::Some(0),
2029 Self::ReadTime => std::option::Option::Some(1),
2030 Self::RequestTime => std::option::Option::Some(2),
2031 Self::UnknownValue(u) => u.0.value(),
2032 }
2033 }
2034
2035 /// Gets the enum value as a string.
2036 ///
2037 /// Returns `None` if the enum contains an unknown value deserialized from
2038 /// the integer representation of enums.
2039 pub fn name(&self) -> std::option::Option<&str> {
2040 match self {
2041 Self::Unspecified => std::option::Option::Some("PARTITION_KEY_UNSPECIFIED"),
2042 Self::ReadTime => std::option::Option::Some("READ_TIME"),
2043 Self::RequestTime => std::option::Option::Some("REQUEST_TIME"),
2044 Self::UnknownValue(u) => u.0.name(),
2045 }
2046 }
2047 }
2048
2049 impl std::default::Default for PartitionKey {
2050 fn default() -> Self {
2051 use std::convert::From;
2052 Self::from(0)
2053 }
2054 }
2055
2056 impl std::fmt::Display for PartitionKey {
2057 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2058 wkt::internal::display_enum(f, self.name(), self.value())
2059 }
2060 }
2061
2062 impl std::convert::From<i32> for PartitionKey {
2063 fn from(value: i32) -> Self {
2064 match value {
2065 0 => Self::Unspecified,
2066 1 => Self::ReadTime,
2067 2 => Self::RequestTime,
2068 _ => Self::UnknownValue(partition_key::UnknownValue(
2069 wkt::internal::UnknownEnumValue::Integer(value),
2070 )),
2071 }
2072 }
2073 }
2074
2075 impl std::convert::From<&str> for PartitionKey {
2076 fn from(value: &str) -> Self {
2077 use std::string::ToString;
2078 match value {
2079 "PARTITION_KEY_UNSPECIFIED" => Self::Unspecified,
2080 "READ_TIME" => Self::ReadTime,
2081 "REQUEST_TIME" => Self::RequestTime,
2082 _ => Self::UnknownValue(partition_key::UnknownValue(
2083 wkt::internal::UnknownEnumValue::String(value.to_string()),
2084 )),
2085 }
2086 }
2087 }
2088
2089 impl serde::ser::Serialize for PartitionKey {
2090 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2091 where
2092 S: serde::Serializer,
2093 {
2094 match self {
2095 Self::Unspecified => serializer.serialize_i32(0),
2096 Self::ReadTime => serializer.serialize_i32(1),
2097 Self::RequestTime => serializer.serialize_i32(2),
2098 Self::UnknownValue(u) => u.0.serialize(serializer),
2099 }
2100 }
2101 }
2102
2103 impl<'de> serde::de::Deserialize<'de> for PartitionKey {
2104 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2105 where
2106 D: serde::Deserializer<'de>,
2107 {
2108 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PartitionKey>::new(
2109 ".google.cloud.asset.v1.PartitionSpec.PartitionKey",
2110 ))
2111 }
2112 }
2113}
2114
2115/// A Pub/Sub destination.
2116#[derive(Clone, Default, PartialEq)]
2117#[non_exhaustive]
2118pub struct PubsubDestination {
2119 /// The name of the Pub/Sub topic to publish to.
2120 /// Example: `projects/PROJECT_ID/topics/TOPIC_ID`.
2121 pub topic: std::string::String,
2122
2123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2124}
2125
2126impl PubsubDestination {
2127 pub fn new() -> Self {
2128 std::default::Default::default()
2129 }
2130
2131 /// Sets the value of [topic][crate::model::PubsubDestination::topic].
2132 ///
2133 /// # Example
2134 /// ```ignore,no_run
2135 /// # use google_cloud_asset_v1::model::PubsubDestination;
2136 /// let x = PubsubDestination::new().set_topic("example");
2137 /// ```
2138 pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2139 self.topic = v.into();
2140 self
2141 }
2142}
2143
2144impl wkt::message::Message for PubsubDestination {
2145 fn typename() -> &'static str {
2146 "type.googleapis.com/google.cloud.asset.v1.PubsubDestination"
2147 }
2148}
2149
2150/// Output configuration for asset feed destination.
2151#[derive(Clone, Default, PartialEq)]
2152#[non_exhaustive]
2153pub struct FeedOutputConfig {
2154 /// Asset feed destination.
2155 pub destination: std::option::Option<crate::model::feed_output_config::Destination>,
2156
2157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2158}
2159
2160impl FeedOutputConfig {
2161 pub fn new() -> Self {
2162 std::default::Default::default()
2163 }
2164
2165 /// Sets the value of [destination][crate::model::FeedOutputConfig::destination].
2166 ///
2167 /// Note that all the setters affecting `destination` are mutually
2168 /// exclusive.
2169 ///
2170 /// # Example
2171 /// ```ignore,no_run
2172 /// # use google_cloud_asset_v1::model::FeedOutputConfig;
2173 /// use google_cloud_asset_v1::model::PubsubDestination;
2174 /// let x = FeedOutputConfig::new().set_destination(Some(
2175 /// google_cloud_asset_v1::model::feed_output_config::Destination::PubsubDestination(PubsubDestination::default().into())));
2176 /// ```
2177 pub fn set_destination<
2178 T: std::convert::Into<std::option::Option<crate::model::feed_output_config::Destination>>,
2179 >(
2180 mut self,
2181 v: T,
2182 ) -> Self {
2183 self.destination = v.into();
2184 self
2185 }
2186
2187 /// The value of [destination][crate::model::FeedOutputConfig::destination]
2188 /// if it holds a `PubsubDestination`, `None` if the field is not set or
2189 /// holds a different branch.
2190 pub fn pubsub_destination(
2191 &self,
2192 ) -> std::option::Option<&std::boxed::Box<crate::model::PubsubDestination>> {
2193 #[allow(unreachable_patterns)]
2194 self.destination.as_ref().and_then(|v| match v {
2195 crate::model::feed_output_config::Destination::PubsubDestination(v) => {
2196 std::option::Option::Some(v)
2197 }
2198 _ => std::option::Option::None,
2199 })
2200 }
2201
2202 /// Sets the value of [destination][crate::model::FeedOutputConfig::destination]
2203 /// to hold a `PubsubDestination`.
2204 ///
2205 /// Note that all the setters affecting `destination` are
2206 /// mutually exclusive.
2207 ///
2208 /// # Example
2209 /// ```ignore,no_run
2210 /// # use google_cloud_asset_v1::model::FeedOutputConfig;
2211 /// use google_cloud_asset_v1::model::PubsubDestination;
2212 /// let x = FeedOutputConfig::new().set_pubsub_destination(PubsubDestination::default()/* use setters */);
2213 /// assert!(x.pubsub_destination().is_some());
2214 /// ```
2215 pub fn set_pubsub_destination<
2216 T: std::convert::Into<std::boxed::Box<crate::model::PubsubDestination>>,
2217 >(
2218 mut self,
2219 v: T,
2220 ) -> Self {
2221 self.destination = std::option::Option::Some(
2222 crate::model::feed_output_config::Destination::PubsubDestination(v.into()),
2223 );
2224 self
2225 }
2226}
2227
2228impl wkt::message::Message for FeedOutputConfig {
2229 fn typename() -> &'static str {
2230 "type.googleapis.com/google.cloud.asset.v1.FeedOutputConfig"
2231 }
2232}
2233
2234/// Defines additional types related to [FeedOutputConfig].
2235pub mod feed_output_config {
2236 #[allow(unused_imports)]
2237 use super::*;
2238
2239 /// Asset feed destination.
2240 #[derive(Clone, Debug, PartialEq)]
2241 #[non_exhaustive]
2242 pub enum Destination {
2243 /// Destination on Pub/Sub.
2244 PubsubDestination(std::boxed::Box<crate::model::PubsubDestination>),
2245 }
2246}
2247
2248/// An asset feed used to export asset updates to a destinations.
2249/// An asset feed filter controls what updates are exported.
2250/// The asset feed must be created within a project, organization, or
2251/// folder. Supported destinations are:
2252/// Pub/Sub topics.
2253#[derive(Clone, Default, PartialEq)]
2254#[non_exhaustive]
2255pub struct Feed {
2256 /// Required. The format will be
2257 /// projects/{project_number}/feeds/{client-assigned_feed_identifier} or
2258 /// folders/{folder_number}/feeds/{client-assigned_feed_identifier} or
2259 /// organizations/{organization_number}/feeds/{client-assigned_feed_identifier}
2260 ///
2261 /// The client-assigned feed identifier must be unique within the parent
2262 /// project/folder/organization.
2263 pub name: std::string::String,
2264
2265 /// A list of the full names of the assets to receive updates. You must specify
2266 /// either or both of asset_names and asset_types. Only asset updates matching
2267 /// specified asset_names or asset_types are exported to the feed.
2268 /// Example:
2269 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
2270 /// For a list of the full names for supported asset types, see [Resource
2271 /// name format](/asset-inventory/docs/resource-name-format).
2272 pub asset_names: std::vec::Vec<std::string::String>,
2273
2274 /// A list of types of the assets to receive updates. You must specify either
2275 /// or both of asset_names and asset_types. Only asset updates matching
2276 /// specified asset_names or asset_types are exported to the feed.
2277 /// Example: `"compute.googleapis.com/Disk"`
2278 ///
2279 /// For a list of all supported asset types, see
2280 /// [Supported asset types](/asset-inventory/docs/supported-asset-types).
2281 pub asset_types: std::vec::Vec<std::string::String>,
2282
2283 /// Asset content type. If not specified, no content but the asset name and
2284 /// type will be returned.
2285 pub content_type: crate::model::ContentType,
2286
2287 /// Required. Feed output configuration defining where the asset updates are
2288 /// published to.
2289 pub feed_output_config: std::option::Option<crate::model::FeedOutputConfig>,
2290
2291 /// A condition which determines whether an asset update should be published.
2292 /// If specified, an asset will be returned only when the expression evaluates
2293 /// to true.
2294 /// When set, `expression` field in the `Expr` must be a valid [CEL expression]
2295 /// (<https://github.com/google/cel-spec>) on a TemporalAsset with name
2296 /// `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted
2297 /// == true") will only publish Asset deletions. Other fields of `Expr` are
2298 /// optional.
2299 ///
2300 /// See our [user
2301 /// guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition)
2302 /// for detailed instructions.
2303 pub condition: std::option::Option<google_cloud_type::model::Expr>,
2304
2305 /// A list of relationship types to output, for example:
2306 /// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
2307 /// content_type=RELATIONSHIP.
2308 ///
2309 /// * If specified:
2310 /// it outputs specified relationship updates on the [asset_names] or the
2311 /// [asset_types]. It returns an error if any of the [relationship_types]
2312 /// doesn't belong to the supported relationship types of the [asset_names] or
2313 /// [asset_types], or any of the [asset_names] or the [asset_types] doesn't
2314 /// belong to the source types of the [relationship_types].
2315 /// * Otherwise:
2316 /// it outputs the supported relationships of the types of [asset_names] and
2317 /// [asset_types] or returns an error if any of the [asset_names] or the
2318 /// [asset_types] has no replationship support.
2319 /// See [Introduction to Cloud Asset
2320 /// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
2321 /// for all supported asset types and relationship types.
2322 pub relationship_types: std::vec::Vec<std::string::String>,
2323
2324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2325}
2326
2327impl Feed {
2328 pub fn new() -> Self {
2329 std::default::Default::default()
2330 }
2331
2332 /// Sets the value of [name][crate::model::Feed::name].
2333 ///
2334 /// # Example
2335 /// ```ignore,no_run
2336 /// # use google_cloud_asset_v1::model::Feed;
2337 /// let x = Feed::new().set_name("example");
2338 /// ```
2339 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2340 self.name = v.into();
2341 self
2342 }
2343
2344 /// Sets the value of [asset_names][crate::model::Feed::asset_names].
2345 ///
2346 /// # Example
2347 /// ```ignore,no_run
2348 /// # use google_cloud_asset_v1::model::Feed;
2349 /// let x = Feed::new().set_asset_names(["a", "b", "c"]);
2350 /// ```
2351 pub fn set_asset_names<T, V>(mut self, v: T) -> Self
2352 where
2353 T: std::iter::IntoIterator<Item = V>,
2354 V: std::convert::Into<std::string::String>,
2355 {
2356 use std::iter::Iterator;
2357 self.asset_names = v.into_iter().map(|i| i.into()).collect();
2358 self
2359 }
2360
2361 /// Sets the value of [asset_types][crate::model::Feed::asset_types].
2362 ///
2363 /// # Example
2364 /// ```ignore,no_run
2365 /// # use google_cloud_asset_v1::model::Feed;
2366 /// let x = Feed::new().set_asset_types(["a", "b", "c"]);
2367 /// ```
2368 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
2369 where
2370 T: std::iter::IntoIterator<Item = V>,
2371 V: std::convert::Into<std::string::String>,
2372 {
2373 use std::iter::Iterator;
2374 self.asset_types = v.into_iter().map(|i| i.into()).collect();
2375 self
2376 }
2377
2378 /// Sets the value of [content_type][crate::model::Feed::content_type].
2379 ///
2380 /// # Example
2381 /// ```ignore,no_run
2382 /// # use google_cloud_asset_v1::model::Feed;
2383 /// use google_cloud_asset_v1::model::ContentType;
2384 /// let x0 = Feed::new().set_content_type(ContentType::Resource);
2385 /// let x1 = Feed::new().set_content_type(ContentType::IamPolicy);
2386 /// let x2 = Feed::new().set_content_type(ContentType::OrgPolicy);
2387 /// ```
2388 pub fn set_content_type<T: std::convert::Into<crate::model::ContentType>>(
2389 mut self,
2390 v: T,
2391 ) -> Self {
2392 self.content_type = v.into();
2393 self
2394 }
2395
2396 /// Sets the value of [feed_output_config][crate::model::Feed::feed_output_config].
2397 ///
2398 /// # Example
2399 /// ```ignore,no_run
2400 /// # use google_cloud_asset_v1::model::Feed;
2401 /// use google_cloud_asset_v1::model::FeedOutputConfig;
2402 /// let x = Feed::new().set_feed_output_config(FeedOutputConfig::default()/* use setters */);
2403 /// ```
2404 pub fn set_feed_output_config<T>(mut self, v: T) -> Self
2405 where
2406 T: std::convert::Into<crate::model::FeedOutputConfig>,
2407 {
2408 self.feed_output_config = std::option::Option::Some(v.into());
2409 self
2410 }
2411
2412 /// Sets or clears the value of [feed_output_config][crate::model::Feed::feed_output_config].
2413 ///
2414 /// # Example
2415 /// ```ignore,no_run
2416 /// # use google_cloud_asset_v1::model::Feed;
2417 /// use google_cloud_asset_v1::model::FeedOutputConfig;
2418 /// let x = Feed::new().set_or_clear_feed_output_config(Some(FeedOutputConfig::default()/* use setters */));
2419 /// let x = Feed::new().set_or_clear_feed_output_config(None::<FeedOutputConfig>);
2420 /// ```
2421 pub fn set_or_clear_feed_output_config<T>(mut self, v: std::option::Option<T>) -> Self
2422 where
2423 T: std::convert::Into<crate::model::FeedOutputConfig>,
2424 {
2425 self.feed_output_config = v.map(|x| x.into());
2426 self
2427 }
2428
2429 /// Sets the value of [condition][crate::model::Feed::condition].
2430 ///
2431 /// # Example
2432 /// ```ignore,no_run
2433 /// # use google_cloud_asset_v1::model::Feed;
2434 /// use google_cloud_type::model::Expr;
2435 /// let x = Feed::new().set_condition(Expr::default()/* use setters */);
2436 /// ```
2437 pub fn set_condition<T>(mut self, v: T) -> Self
2438 where
2439 T: std::convert::Into<google_cloud_type::model::Expr>,
2440 {
2441 self.condition = std::option::Option::Some(v.into());
2442 self
2443 }
2444
2445 /// Sets or clears the value of [condition][crate::model::Feed::condition].
2446 ///
2447 /// # Example
2448 /// ```ignore,no_run
2449 /// # use google_cloud_asset_v1::model::Feed;
2450 /// use google_cloud_type::model::Expr;
2451 /// let x = Feed::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
2452 /// let x = Feed::new().set_or_clear_condition(None::<Expr>);
2453 /// ```
2454 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
2455 where
2456 T: std::convert::Into<google_cloud_type::model::Expr>,
2457 {
2458 self.condition = v.map(|x| x.into());
2459 self
2460 }
2461
2462 /// Sets the value of [relationship_types][crate::model::Feed::relationship_types].
2463 ///
2464 /// # Example
2465 /// ```ignore,no_run
2466 /// # use google_cloud_asset_v1::model::Feed;
2467 /// let x = Feed::new().set_relationship_types(["a", "b", "c"]);
2468 /// ```
2469 pub fn set_relationship_types<T, V>(mut self, v: T) -> Self
2470 where
2471 T: std::iter::IntoIterator<Item = V>,
2472 V: std::convert::Into<std::string::String>,
2473 {
2474 use std::iter::Iterator;
2475 self.relationship_types = v.into_iter().map(|i| i.into()).collect();
2476 self
2477 }
2478}
2479
2480impl wkt::message::Message for Feed {
2481 fn typename() -> &'static str {
2482 "type.googleapis.com/google.cloud.asset.v1.Feed"
2483 }
2484}
2485
2486/// Search all resources request.
2487#[derive(Clone, Default, PartialEq)]
2488#[non_exhaustive]
2489pub struct SearchAllResourcesRequest {
2490 /// Required. A scope can be a project, a folder, or an organization. The
2491 /// search is limited to the resources within the `scope`. The caller must be
2492 /// granted the
2493 /// [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
2494 /// permission on the desired scope.
2495 ///
2496 /// The allowed values are:
2497 ///
2498 /// * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
2499 /// * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
2500 /// * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
2501 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2502 pub scope: std::string::String,
2503
2504 /// Optional. The query statement. See [how to construct a
2505 /// query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
2506 /// for more information. If not specified or empty, it will search all the
2507 /// resources within the specified `scope`.
2508 ///
2509 /// Examples:
2510 ///
2511 /// * `name:Important` to find Google Cloud resources whose name contains
2512 /// `Important` as a word.
2513 /// * `name=Important` to find the Google Cloud resource whose name is exactly
2514 /// `Important`.
2515 /// * `displayName:Impor*` to find Google Cloud resources whose display name
2516 /// contains `Impor` as a prefix of any word in the field.
2517 /// * `location:us-west*` to find Google Cloud resources whose location
2518 /// contains both `us` and `west` as prefixes.
2519 /// * `labels:prod` to find Google Cloud resources whose labels contain `prod`
2520 /// as a key or value.
2521 /// * `labels.env:prod` to find Google Cloud resources that have a label `env`
2522 /// and its value is `prod`.
2523 /// * `labels.env:*` to find Google Cloud resources that have a label `env`.
2524 /// * `tagKeys:env` to find Google Cloud resources that have directly
2525 /// attached tags where the
2526 /// [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
2527 /// contains `env`.
2528 /// * `tagValues:prod*` to find Google Cloud resources that have directly
2529 /// attached tags where the
2530 /// [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
2531 /// contains a word prefixed by `prod`.
2532 /// * `tagValueIds=tagValues/123` to find Google Cloud resources that have
2533 /// directly attached tags where the
2534 /// [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
2535 /// is exactly `tagValues/123`.
2536 /// * `effectiveTagKeys:env` to find Google Cloud resources that have
2537 /// directly attached or inherited tags where the
2538 /// [`TagKey.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagKeys#resource:-tagkey)
2539 /// contains `env`.
2540 /// * `effectiveTagValues:prod*` to find Google Cloud resources that have
2541 /// directly attached or inherited tags where the
2542 /// [`TagValue.namespacedName`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
2543 /// contains a word prefixed by `prod`.
2544 /// * `effectiveTagValueIds=tagValues/123` to find Google Cloud resources that
2545 /// have directly attached or inherited tags where the
2546 /// [`TagValue.name`](https://cloud.google.com/resource-manager/reference/rest/v3/tagValues#resource:-tagvalue)
2547 /// is exactly `tagValues/123`.
2548 /// * `kmsKey:key` to find Google Cloud resources encrypted with a
2549 /// customer-managed encryption key whose name contains `key` as a word. This
2550 /// field is deprecated. Use the `kmsKeys` field to retrieve Cloud KMS
2551 /// key information.
2552 /// * `kmsKeys:key` to find Google Cloud resources encrypted with
2553 /// customer-managed encryption keys whose name contains the word `key`.
2554 /// * `relationships:instance-group-1` to find Google Cloud resources that have
2555 /// relationships with `instance-group-1` in the related resource name.
2556 /// * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine
2557 /// instances that have relationships of type `INSTANCE_TO_INSTANCEGROUP`.
2558 /// * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find
2559 /// Compute Engine instances that have relationships with `instance-group-1`
2560 /// in the Compute Engine instance group resource name, for relationship type
2561 /// `INSTANCE_TO_INSTANCEGROUP`.
2562 /// * `sccSecurityMarks.key=value` to find Cloud resources that are attached
2563 /// with security marks whose key is `key` and value is `value`.
2564 /// * `sccSecurityMarks.key:*` to find Cloud resources that are attached with
2565 /// security marks whose key is `key`.
2566 /// * `state:ACTIVE` to find Google Cloud resources whose state contains
2567 /// `ACTIVE` as a word.
2568 /// * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't
2569 /// contain `ACTIVE` as a word.
2570 /// * `createTime<1609459200` to find Google Cloud resources that were created
2571 /// before `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of
2572 /// `2021-01-01 00:00:00 UTC` in seconds.
2573 /// * `updateTime>1609459200` to find Google Cloud resources that were updated
2574 /// after `2021-01-01 00:00:00 UTC`. `1609459200` is the epoch timestamp of
2575 /// `2021-01-01 00:00:00 UTC` in seconds.
2576 /// * `Important` to find Google Cloud resources that contain `Important` as a
2577 /// word in any of the searchable fields.
2578 /// * `Impor*` to find Google Cloud resources that contain `Impor` as a prefix
2579 /// of any word in any of the searchable fields.
2580 /// * `Important location:(us-west1 OR global)` to find Google Cloud
2581 /// resources that contain `Important` as a word in any of the searchable
2582 /// fields and are also located in the `us-west1` region or the `global`
2583 /// location.
2584 pub query: std::string::String,
2585
2586 /// Optional. A list of asset types that this request searches for. If empty,
2587 /// it will search all the asset types [supported by search
2588 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
2589 ///
2590 /// Regular expressions are also supported. For example:
2591 ///
2592 /// * "compute.googleapis.com.*" snapshots resources whose asset type starts
2593 /// with "compute.googleapis.com".
2594 /// * ".*Instance" snapshots resources whose asset type ends with "Instance".
2595 /// * ".*Instance.*" snapshots resources whose asset type contains "Instance".
2596 ///
2597 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
2598 /// regular expression syntax. If the regular expression does not match any
2599 /// supported asset type, an INVALID_ARGUMENT error will be returned.
2600 pub asset_types: std::vec::Vec<std::string::String>,
2601
2602 /// Optional. The page size for search result pagination. Page size is capped
2603 /// at 500 even if a larger value is given. If set to zero or a negative value,
2604 /// server will pick an appropriate default. Returned results may be fewer than
2605 /// requested. When this happens, there could be more results as long as
2606 /// `next_page_token` is returned.
2607 pub page_size: i32,
2608
2609 /// Optional. If present, then retrieve the next batch of results from the
2610 /// preceding call to this method. `page_token` must be the value of
2611 /// `next_page_token` from the previous response. The values of all other
2612 /// method parameters, must be identical to those in the previous call.
2613 pub page_token: std::string::String,
2614
2615 /// Optional. A comma-separated list of fields specifying the sorting order of
2616 /// the results. The default order is ascending. Add " DESC" after the field
2617 /// name to indicate descending order. Redundant space characters are ignored.
2618 /// Example: "location DESC, name".
2619 /// Only the following fields in the response are sortable:
2620 ///
2621 /// * name
2622 /// * assetType
2623 /// * project
2624 /// * displayName
2625 /// * description
2626 /// * location
2627 /// * createTime
2628 /// * updateTime
2629 /// * state
2630 /// * parentFullResourceName
2631 /// * parentAssetType
2632 pub order_by: std::string::String,
2633
2634 /// Optional. A comma-separated list of fields that you want returned in the
2635 /// results. The following fields are returned by default if not specified:
2636 ///
2637 /// * `name`
2638 /// * `assetType`
2639 /// * `project`
2640 /// * `folders`
2641 /// * `organization`
2642 /// * `displayName`
2643 /// * `description`
2644 /// * `location`
2645 /// * `labels`
2646 /// * `tags`
2647 /// * `effectiveTags`
2648 /// * `networkTags`
2649 /// * `kmsKeys`
2650 /// * `createTime`
2651 /// * `updateTime`
2652 /// * `state`
2653 /// * `additionalAttributes`
2654 /// * `parentFullResourceName`
2655 /// * `parentAssetType`
2656 ///
2657 /// Some fields of large size, such as `versionedResources`,
2658 /// `attachedResources`, `effectiveTags` etc., are not returned by default, but
2659 /// you can specify them in the `read_mask` parameter if you want to include
2660 /// them. If `"*"` is specified, all [available
2661 /// fields](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources#resourcesearchresult)
2662 /// are returned.
2663 /// Examples: `"name,location"`, `"name,versionedResources"`, `"*"`.
2664 /// Any invalid field path will trigger INVALID_ARGUMENT error.
2665 pub read_mask: std::option::Option<wkt::FieldMask>,
2666
2667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2668}
2669
2670impl SearchAllResourcesRequest {
2671 pub fn new() -> Self {
2672 std::default::Default::default()
2673 }
2674
2675 /// Sets the value of [scope][crate::model::SearchAllResourcesRequest::scope].
2676 ///
2677 /// # Example
2678 /// ```ignore,no_run
2679 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2680 /// let x = SearchAllResourcesRequest::new().set_scope("example");
2681 /// ```
2682 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.scope = v.into();
2684 self
2685 }
2686
2687 /// Sets the value of [query][crate::model::SearchAllResourcesRequest::query].
2688 ///
2689 /// # Example
2690 /// ```ignore,no_run
2691 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2692 /// let x = SearchAllResourcesRequest::new().set_query("example");
2693 /// ```
2694 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2695 self.query = v.into();
2696 self
2697 }
2698
2699 /// Sets the value of [asset_types][crate::model::SearchAllResourcesRequest::asset_types].
2700 ///
2701 /// # Example
2702 /// ```ignore,no_run
2703 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2704 /// let x = SearchAllResourcesRequest::new().set_asset_types(["a", "b", "c"]);
2705 /// ```
2706 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
2707 where
2708 T: std::iter::IntoIterator<Item = V>,
2709 V: std::convert::Into<std::string::String>,
2710 {
2711 use std::iter::Iterator;
2712 self.asset_types = v.into_iter().map(|i| i.into()).collect();
2713 self
2714 }
2715
2716 /// Sets the value of [page_size][crate::model::SearchAllResourcesRequest::page_size].
2717 ///
2718 /// # Example
2719 /// ```ignore,no_run
2720 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2721 /// let x = SearchAllResourcesRequest::new().set_page_size(42);
2722 /// ```
2723 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2724 self.page_size = v.into();
2725 self
2726 }
2727
2728 /// Sets the value of [page_token][crate::model::SearchAllResourcesRequest::page_token].
2729 ///
2730 /// # Example
2731 /// ```ignore,no_run
2732 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2733 /// let x = SearchAllResourcesRequest::new().set_page_token("example");
2734 /// ```
2735 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2736 self.page_token = v.into();
2737 self
2738 }
2739
2740 /// Sets the value of [order_by][crate::model::SearchAllResourcesRequest::order_by].
2741 ///
2742 /// # Example
2743 /// ```ignore,no_run
2744 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2745 /// let x = SearchAllResourcesRequest::new().set_order_by("example");
2746 /// ```
2747 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2748 self.order_by = v.into();
2749 self
2750 }
2751
2752 /// Sets the value of [read_mask][crate::model::SearchAllResourcesRequest::read_mask].
2753 ///
2754 /// # Example
2755 /// ```ignore,no_run
2756 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2757 /// use wkt::FieldMask;
2758 /// let x = SearchAllResourcesRequest::new().set_read_mask(FieldMask::default()/* use setters */);
2759 /// ```
2760 pub fn set_read_mask<T>(mut self, v: T) -> Self
2761 where
2762 T: std::convert::Into<wkt::FieldMask>,
2763 {
2764 self.read_mask = std::option::Option::Some(v.into());
2765 self
2766 }
2767
2768 /// Sets or clears the value of [read_mask][crate::model::SearchAllResourcesRequest::read_mask].
2769 ///
2770 /// # Example
2771 /// ```ignore,no_run
2772 /// # use google_cloud_asset_v1::model::SearchAllResourcesRequest;
2773 /// use wkt::FieldMask;
2774 /// let x = SearchAllResourcesRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
2775 /// let x = SearchAllResourcesRequest::new().set_or_clear_read_mask(None::<FieldMask>);
2776 /// ```
2777 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
2778 where
2779 T: std::convert::Into<wkt::FieldMask>,
2780 {
2781 self.read_mask = v.map(|x| x.into());
2782 self
2783 }
2784}
2785
2786impl wkt::message::Message for SearchAllResourcesRequest {
2787 fn typename() -> &'static str {
2788 "type.googleapis.com/google.cloud.asset.v1.SearchAllResourcesRequest"
2789 }
2790}
2791
2792/// Search all resources response.
2793#[derive(Clone, Default, PartialEq)]
2794#[non_exhaustive]
2795pub struct SearchAllResourcesResponse {
2796 /// A list of Resources that match the search query. It contains the resource
2797 /// standard metadata information.
2798 pub results: std::vec::Vec<crate::model::ResourceSearchResult>,
2799
2800 /// If there are more results than those appearing in this response, then
2801 /// `next_page_token` is included. To get the next set of results, call this
2802 /// method again using the value of `next_page_token` as `page_token`.
2803 pub next_page_token: std::string::String,
2804
2805 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2806}
2807
2808impl SearchAllResourcesResponse {
2809 pub fn new() -> Self {
2810 std::default::Default::default()
2811 }
2812
2813 /// Sets the value of [results][crate::model::SearchAllResourcesResponse::results].
2814 ///
2815 /// # Example
2816 /// ```ignore,no_run
2817 /// # use google_cloud_asset_v1::model::SearchAllResourcesResponse;
2818 /// use google_cloud_asset_v1::model::ResourceSearchResult;
2819 /// let x = SearchAllResourcesResponse::new()
2820 /// .set_results([
2821 /// ResourceSearchResult::default()/* use setters */,
2822 /// ResourceSearchResult::default()/* use (different) setters */,
2823 /// ]);
2824 /// ```
2825 pub fn set_results<T, V>(mut self, v: T) -> Self
2826 where
2827 T: std::iter::IntoIterator<Item = V>,
2828 V: std::convert::Into<crate::model::ResourceSearchResult>,
2829 {
2830 use std::iter::Iterator;
2831 self.results = v.into_iter().map(|i| i.into()).collect();
2832 self
2833 }
2834
2835 /// Sets the value of [next_page_token][crate::model::SearchAllResourcesResponse::next_page_token].
2836 ///
2837 /// # Example
2838 /// ```ignore,no_run
2839 /// # use google_cloud_asset_v1::model::SearchAllResourcesResponse;
2840 /// let x = SearchAllResourcesResponse::new().set_next_page_token("example");
2841 /// ```
2842 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2843 self.next_page_token = v.into();
2844 self
2845 }
2846}
2847
2848impl wkt::message::Message for SearchAllResourcesResponse {
2849 fn typename() -> &'static str {
2850 "type.googleapis.com/google.cloud.asset.v1.SearchAllResourcesResponse"
2851 }
2852}
2853
2854#[doc(hidden)]
2855impl google_cloud_gax::paginator::internal::PageableResponse for SearchAllResourcesResponse {
2856 type PageItem = crate::model::ResourceSearchResult;
2857
2858 fn items(self) -> std::vec::Vec<Self::PageItem> {
2859 self.results
2860 }
2861
2862 fn next_page_token(&self) -> std::string::String {
2863 use std::clone::Clone;
2864 self.next_page_token.clone()
2865 }
2866}
2867
2868/// Search all IAM policies request.
2869#[derive(Clone, Default, PartialEq)]
2870#[non_exhaustive]
2871pub struct SearchAllIamPoliciesRequest {
2872 /// Required. A scope can be a project, a folder, or an organization. The
2873 /// search is limited to the IAM policies within the `scope`. The caller must
2874 /// be granted the
2875 /// [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
2876 /// permission on the desired scope.
2877 ///
2878 /// The allowed values are:
2879 ///
2880 /// * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
2881 /// * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
2882 /// * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
2883 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
2884 pub scope: std::string::String,
2885
2886 /// Optional. The query statement. See [how to construct a
2887 /// query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
2888 /// for more information. If not specified or empty, it will search all the
2889 /// IAM policies within the specified `scope`. Note that the query string is
2890 /// compared against each IAM policy binding, including its principals,
2891 /// roles, and IAM conditions. The returned IAM policies will only
2892 /// contain the bindings that match your query. To learn more about the IAM
2893 /// policy structure, see the [IAM policy
2894 /// documentation](https://cloud.google.com/iam/help/allow-policies/structure).
2895 ///
2896 /// Examples:
2897 ///
2898 /// * `policy:amy@gmail.com` to find IAM policy bindings that specify user
2899 /// "amy@gmail.com".
2900 /// * `policy:roles/compute.admin` to find IAM policy bindings that specify
2901 /// the Compute Admin role.
2902 /// * `policy:comp*` to find IAM policy bindings that contain "comp" as a
2903 /// prefix of any word in the binding.
2904 /// * `policy.role.permissions:storage.buckets.update` to find IAM policy
2905 /// bindings that specify a role containing "storage.buckets.update"
2906 /// permission. Note that if callers don't have `iam.roles.get` access to a
2907 /// role's included permissions, policy bindings that specify this role will
2908 /// be dropped from the search results.
2909 /// * `policy.role.permissions:upd*` to find IAM policy bindings that specify a
2910 /// role containing "upd" as a prefix of any word in the role permission.
2911 /// Note that if callers don't have `iam.roles.get` access to a role's
2912 /// included permissions, policy bindings that specify this role will be
2913 /// dropped from the search results.
2914 /// * `resource:organizations/123456` to find IAM policy bindings
2915 /// that are set on "organizations/123456".
2916 /// * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to
2917 /// find IAM policy bindings that are set on the project named "myproject".
2918 /// * `Important` to find IAM policy bindings that contain "Important" as a
2919 /// word in any of the searchable fields (except for the included
2920 /// permissions).
2921 /// * `resource:(instance1 OR instance2) policy:amy` to find
2922 /// IAM policy bindings that are set on resources "instance1" or
2923 /// "instance2" and also specify user "amy".
2924 /// * `roles:roles/compute.admin` to find IAM policy bindings that specify the
2925 /// Compute Admin role.
2926 /// * `memberTypes:user` to find IAM policy bindings that contain the
2927 /// principal type "user".
2928 pub query: std::string::String,
2929
2930 /// Optional. The page size for search result pagination. Page size is capped
2931 /// at 500 even if a larger value is given. If set to zero or a negative value,
2932 /// server will pick an appropriate default. Returned results may be fewer than
2933 /// requested. When this happens, there could be more results as long as
2934 /// `next_page_token` is returned.
2935 pub page_size: i32,
2936
2937 /// Optional. If present, retrieve the next batch of results from the preceding
2938 /// call to this method. `page_token` must be the value of `next_page_token`
2939 /// from the previous response. The values of all other method parameters must
2940 /// be identical to those in the previous call.
2941 pub page_token: std::string::String,
2942
2943 /// Optional. A list of asset types that the IAM policies are attached to. If
2944 /// empty, it will search the IAM policies that are attached to all the asset
2945 /// types [supported by search
2946 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
2947 ///
2948 /// Regular expressions are also supported. For example:
2949 ///
2950 /// * "compute.googleapis.com.*" snapshots IAM policies attached to asset type
2951 /// starts with "compute.googleapis.com".
2952 /// * ".*Instance" snapshots IAM policies attached to asset type ends with
2953 /// "Instance".
2954 /// * ".*Instance.*" snapshots IAM policies attached to asset type contains
2955 /// "Instance".
2956 ///
2957 /// See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
2958 /// regular expression syntax. If the regular expression does not match any
2959 /// supported asset type, an INVALID_ARGUMENT error will be returned.
2960 pub asset_types: std::vec::Vec<std::string::String>,
2961
2962 /// Optional. A comma-separated list of fields specifying the sorting order of
2963 /// the results. The default order is ascending. Add " DESC" after the field
2964 /// name to indicate descending order. Redundant space characters are ignored.
2965 /// Example: "assetType DESC, resource".
2966 /// Only singular primitive fields in the response are sortable:
2967 ///
2968 /// * resource
2969 /// * assetType
2970 /// * project
2971 /// All the other fields such as repeated fields (e.g., `folders`) and
2972 /// non-primitive fields (e.g., `policy`) are not supported.
2973 pub order_by: std::string::String,
2974
2975 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2976}
2977
2978impl SearchAllIamPoliciesRequest {
2979 pub fn new() -> Self {
2980 std::default::Default::default()
2981 }
2982
2983 /// Sets the value of [scope][crate::model::SearchAllIamPoliciesRequest::scope].
2984 ///
2985 /// # Example
2986 /// ```ignore,no_run
2987 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
2988 /// let x = SearchAllIamPoliciesRequest::new().set_scope("example");
2989 /// ```
2990 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2991 self.scope = v.into();
2992 self
2993 }
2994
2995 /// Sets the value of [query][crate::model::SearchAllIamPoliciesRequest::query].
2996 ///
2997 /// # Example
2998 /// ```ignore,no_run
2999 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
3000 /// let x = SearchAllIamPoliciesRequest::new().set_query("example");
3001 /// ```
3002 pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3003 self.query = v.into();
3004 self
3005 }
3006
3007 /// Sets the value of [page_size][crate::model::SearchAllIamPoliciesRequest::page_size].
3008 ///
3009 /// # Example
3010 /// ```ignore,no_run
3011 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
3012 /// let x = SearchAllIamPoliciesRequest::new().set_page_size(42);
3013 /// ```
3014 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3015 self.page_size = v.into();
3016 self
3017 }
3018
3019 /// Sets the value of [page_token][crate::model::SearchAllIamPoliciesRequest::page_token].
3020 ///
3021 /// # Example
3022 /// ```ignore,no_run
3023 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
3024 /// let x = SearchAllIamPoliciesRequest::new().set_page_token("example");
3025 /// ```
3026 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3027 self.page_token = v.into();
3028 self
3029 }
3030
3031 /// Sets the value of [asset_types][crate::model::SearchAllIamPoliciesRequest::asset_types].
3032 ///
3033 /// # Example
3034 /// ```ignore,no_run
3035 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
3036 /// let x = SearchAllIamPoliciesRequest::new().set_asset_types(["a", "b", "c"]);
3037 /// ```
3038 pub fn set_asset_types<T, V>(mut self, v: T) -> Self
3039 where
3040 T: std::iter::IntoIterator<Item = V>,
3041 V: std::convert::Into<std::string::String>,
3042 {
3043 use std::iter::Iterator;
3044 self.asset_types = v.into_iter().map(|i| i.into()).collect();
3045 self
3046 }
3047
3048 /// Sets the value of [order_by][crate::model::SearchAllIamPoliciesRequest::order_by].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesRequest;
3053 /// let x = SearchAllIamPoliciesRequest::new().set_order_by("example");
3054 /// ```
3055 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3056 self.order_by = v.into();
3057 self
3058 }
3059}
3060
3061impl wkt::message::Message for SearchAllIamPoliciesRequest {
3062 fn typename() -> &'static str {
3063 "type.googleapis.com/google.cloud.asset.v1.SearchAllIamPoliciesRequest"
3064 }
3065}
3066
3067/// Search all IAM policies response.
3068#[derive(Clone, Default, PartialEq)]
3069#[non_exhaustive]
3070pub struct SearchAllIamPoliciesResponse {
3071 /// A list of IAM policies that match the search query. Related information
3072 /// such as the associated resource is returned along with the policy.
3073 pub results: std::vec::Vec<crate::model::IamPolicySearchResult>,
3074
3075 /// Set if there are more results than those appearing in this response; to get
3076 /// the next set of results, call this method again, using this value as the
3077 /// `page_token`.
3078 pub next_page_token: std::string::String,
3079
3080 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3081}
3082
3083impl SearchAllIamPoliciesResponse {
3084 pub fn new() -> Self {
3085 std::default::Default::default()
3086 }
3087
3088 /// Sets the value of [results][crate::model::SearchAllIamPoliciesResponse::results].
3089 ///
3090 /// # Example
3091 /// ```ignore,no_run
3092 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesResponse;
3093 /// use google_cloud_asset_v1::model::IamPolicySearchResult;
3094 /// let x = SearchAllIamPoliciesResponse::new()
3095 /// .set_results([
3096 /// IamPolicySearchResult::default()/* use setters */,
3097 /// IamPolicySearchResult::default()/* use (different) setters */,
3098 /// ]);
3099 /// ```
3100 pub fn set_results<T, V>(mut self, v: T) -> Self
3101 where
3102 T: std::iter::IntoIterator<Item = V>,
3103 V: std::convert::Into<crate::model::IamPolicySearchResult>,
3104 {
3105 use std::iter::Iterator;
3106 self.results = v.into_iter().map(|i| i.into()).collect();
3107 self
3108 }
3109
3110 /// Sets the value of [next_page_token][crate::model::SearchAllIamPoliciesResponse::next_page_token].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_asset_v1::model::SearchAllIamPoliciesResponse;
3115 /// let x = SearchAllIamPoliciesResponse::new().set_next_page_token("example");
3116 /// ```
3117 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3118 self.next_page_token = v.into();
3119 self
3120 }
3121}
3122
3123impl wkt::message::Message for SearchAllIamPoliciesResponse {
3124 fn typename() -> &'static str {
3125 "type.googleapis.com/google.cloud.asset.v1.SearchAllIamPoliciesResponse"
3126 }
3127}
3128
3129#[doc(hidden)]
3130impl google_cloud_gax::paginator::internal::PageableResponse for SearchAllIamPoliciesResponse {
3131 type PageItem = crate::model::IamPolicySearchResult;
3132
3133 fn items(self) -> std::vec::Vec<Self::PageItem> {
3134 self.results
3135 }
3136
3137 fn next_page_token(&self) -> std::string::String {
3138 use std::clone::Clone;
3139 self.next_page_token.clone()
3140 }
3141}
3142
3143/// IAM policy analysis query message.
3144#[derive(Clone, Default, PartialEq)]
3145#[non_exhaustive]
3146pub struct IamPolicyAnalysisQuery {
3147 /// Required. The relative name of the root asset. Only resources and IAM
3148 /// policies within the scope will be analyzed.
3149 ///
3150 /// This can only be an organization number (such as "organizations/123"), a
3151 /// folder number (such as "folders/123"), a project ID (such as
3152 /// "projects/my-project-id"), or a project number (such as "projects/12345").
3153 ///
3154 /// To know how to get organization ID, visit [here
3155 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
3156 ///
3157 /// To know how to get folder or project ID, visit [here
3158 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
3159 pub scope: std::string::String,
3160
3161 /// Optional. Specifies a resource for analysis.
3162 pub resource_selector:
3163 std::option::Option<crate::model::iam_policy_analysis_query::ResourceSelector>,
3164
3165 /// Optional. Specifies an identity for analysis.
3166 pub identity_selector:
3167 std::option::Option<crate::model::iam_policy_analysis_query::IdentitySelector>,
3168
3169 /// Optional. Specifies roles or permissions for analysis. This is optional.
3170 pub access_selector:
3171 std::option::Option<crate::model::iam_policy_analysis_query::AccessSelector>,
3172
3173 /// Optional. The query options.
3174 pub options: std::option::Option<crate::model::iam_policy_analysis_query::Options>,
3175
3176 /// Optional. The hypothetical context for IAM conditions evaluation.
3177 pub condition_context:
3178 std::option::Option<crate::model::iam_policy_analysis_query::ConditionContext>,
3179
3180 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3181}
3182
3183impl IamPolicyAnalysisQuery {
3184 pub fn new() -> Self {
3185 std::default::Default::default()
3186 }
3187
3188 /// Sets the value of [scope][crate::model::IamPolicyAnalysisQuery::scope].
3189 ///
3190 /// # Example
3191 /// ```ignore,no_run
3192 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3193 /// let x = IamPolicyAnalysisQuery::new().set_scope("example");
3194 /// ```
3195 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3196 self.scope = v.into();
3197 self
3198 }
3199
3200 /// Sets the value of [resource_selector][crate::model::IamPolicyAnalysisQuery::resource_selector].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3205 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::ResourceSelector;
3206 /// let x = IamPolicyAnalysisQuery::new().set_resource_selector(ResourceSelector::default()/* use setters */);
3207 /// ```
3208 pub fn set_resource_selector<T>(mut self, v: T) -> Self
3209 where
3210 T: std::convert::Into<crate::model::iam_policy_analysis_query::ResourceSelector>,
3211 {
3212 self.resource_selector = std::option::Option::Some(v.into());
3213 self
3214 }
3215
3216 /// Sets or clears the value of [resource_selector][crate::model::IamPolicyAnalysisQuery::resource_selector].
3217 ///
3218 /// # Example
3219 /// ```ignore,no_run
3220 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3221 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::ResourceSelector;
3222 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_resource_selector(Some(ResourceSelector::default()/* use setters */));
3223 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_resource_selector(None::<ResourceSelector>);
3224 /// ```
3225 pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
3226 where
3227 T: std::convert::Into<crate::model::iam_policy_analysis_query::ResourceSelector>,
3228 {
3229 self.resource_selector = v.map(|x| x.into());
3230 self
3231 }
3232
3233 /// Sets the value of [identity_selector][crate::model::IamPolicyAnalysisQuery::identity_selector].
3234 ///
3235 /// # Example
3236 /// ```ignore,no_run
3237 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3238 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::IdentitySelector;
3239 /// let x = IamPolicyAnalysisQuery::new().set_identity_selector(IdentitySelector::default()/* use setters */);
3240 /// ```
3241 pub fn set_identity_selector<T>(mut self, v: T) -> Self
3242 where
3243 T: std::convert::Into<crate::model::iam_policy_analysis_query::IdentitySelector>,
3244 {
3245 self.identity_selector = std::option::Option::Some(v.into());
3246 self
3247 }
3248
3249 /// Sets or clears the value of [identity_selector][crate::model::IamPolicyAnalysisQuery::identity_selector].
3250 ///
3251 /// # Example
3252 /// ```ignore,no_run
3253 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3254 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::IdentitySelector;
3255 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_identity_selector(Some(IdentitySelector::default()/* use setters */));
3256 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_identity_selector(None::<IdentitySelector>);
3257 /// ```
3258 pub fn set_or_clear_identity_selector<T>(mut self, v: std::option::Option<T>) -> Self
3259 where
3260 T: std::convert::Into<crate::model::iam_policy_analysis_query::IdentitySelector>,
3261 {
3262 self.identity_selector = v.map(|x| x.into());
3263 self
3264 }
3265
3266 /// Sets the value of [access_selector][crate::model::IamPolicyAnalysisQuery::access_selector].
3267 ///
3268 /// # Example
3269 /// ```ignore,no_run
3270 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3271 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::AccessSelector;
3272 /// let x = IamPolicyAnalysisQuery::new().set_access_selector(AccessSelector::default()/* use setters */);
3273 /// ```
3274 pub fn set_access_selector<T>(mut self, v: T) -> Self
3275 where
3276 T: std::convert::Into<crate::model::iam_policy_analysis_query::AccessSelector>,
3277 {
3278 self.access_selector = std::option::Option::Some(v.into());
3279 self
3280 }
3281
3282 /// Sets or clears the value of [access_selector][crate::model::IamPolicyAnalysisQuery::access_selector].
3283 ///
3284 /// # Example
3285 /// ```ignore,no_run
3286 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3287 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::AccessSelector;
3288 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_access_selector(Some(AccessSelector::default()/* use setters */));
3289 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_access_selector(None::<AccessSelector>);
3290 /// ```
3291 pub fn set_or_clear_access_selector<T>(mut self, v: std::option::Option<T>) -> Self
3292 where
3293 T: std::convert::Into<crate::model::iam_policy_analysis_query::AccessSelector>,
3294 {
3295 self.access_selector = v.map(|x| x.into());
3296 self
3297 }
3298
3299 /// Sets the value of [options][crate::model::IamPolicyAnalysisQuery::options].
3300 ///
3301 /// # Example
3302 /// ```ignore,no_run
3303 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3304 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3305 /// let x = IamPolicyAnalysisQuery::new().set_options(Options::default()/* use setters */);
3306 /// ```
3307 pub fn set_options<T>(mut self, v: T) -> Self
3308 where
3309 T: std::convert::Into<crate::model::iam_policy_analysis_query::Options>,
3310 {
3311 self.options = std::option::Option::Some(v.into());
3312 self
3313 }
3314
3315 /// Sets or clears the value of [options][crate::model::IamPolicyAnalysisQuery::options].
3316 ///
3317 /// # Example
3318 /// ```ignore,no_run
3319 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3320 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3321 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_options(Some(Options::default()/* use setters */));
3322 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_options(None::<Options>);
3323 /// ```
3324 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3325 where
3326 T: std::convert::Into<crate::model::iam_policy_analysis_query::Options>,
3327 {
3328 self.options = v.map(|x| x.into());
3329 self
3330 }
3331
3332 /// Sets the value of [condition_context][crate::model::IamPolicyAnalysisQuery::condition_context].
3333 ///
3334 /// # Example
3335 /// ```ignore,no_run
3336 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3337 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::ConditionContext;
3338 /// let x = IamPolicyAnalysisQuery::new().set_condition_context(ConditionContext::default()/* use setters */);
3339 /// ```
3340 pub fn set_condition_context<T>(mut self, v: T) -> Self
3341 where
3342 T: std::convert::Into<crate::model::iam_policy_analysis_query::ConditionContext>,
3343 {
3344 self.condition_context = std::option::Option::Some(v.into());
3345 self
3346 }
3347
3348 /// Sets or clears the value of [condition_context][crate::model::IamPolicyAnalysisQuery::condition_context].
3349 ///
3350 /// # Example
3351 /// ```ignore,no_run
3352 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3353 /// use google_cloud_asset_v1::model::iam_policy_analysis_query::ConditionContext;
3354 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_condition_context(Some(ConditionContext::default()/* use setters */));
3355 /// let x = IamPolicyAnalysisQuery::new().set_or_clear_condition_context(None::<ConditionContext>);
3356 /// ```
3357 pub fn set_or_clear_condition_context<T>(mut self, v: std::option::Option<T>) -> Self
3358 where
3359 T: std::convert::Into<crate::model::iam_policy_analysis_query::ConditionContext>,
3360 {
3361 self.condition_context = v.map(|x| x.into());
3362 self
3363 }
3364}
3365
3366impl wkt::message::Message for IamPolicyAnalysisQuery {
3367 fn typename() -> &'static str {
3368 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery"
3369 }
3370}
3371
3372/// Defines additional types related to [IamPolicyAnalysisQuery].
3373pub mod iam_policy_analysis_query {
3374 #[allow(unused_imports)]
3375 use super::*;
3376
3377 /// Specifies the resource to analyze for access policies, which may be set
3378 /// directly on the resource, or on ancestors such as organizations, folders or
3379 /// projects.
3380 #[derive(Clone, Default, PartialEq)]
3381 #[non_exhaustive]
3382 pub struct ResourceSelector {
3383 /// Required. The [full resource name]
3384 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
3385 /// of a resource of [supported resource
3386 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types).
3387 pub full_resource_name: std::string::String,
3388
3389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3390 }
3391
3392 impl ResourceSelector {
3393 pub fn new() -> Self {
3394 std::default::Default::default()
3395 }
3396
3397 /// Sets the value of [full_resource_name][crate::model::iam_policy_analysis_query::ResourceSelector::full_resource_name].
3398 ///
3399 /// # Example
3400 /// ```ignore,no_run
3401 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::ResourceSelector;
3402 /// let x = ResourceSelector::new().set_full_resource_name("example");
3403 /// ```
3404 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
3405 mut self,
3406 v: T,
3407 ) -> Self {
3408 self.full_resource_name = v.into();
3409 self
3410 }
3411 }
3412
3413 impl wkt::message::Message for ResourceSelector {
3414 fn typename() -> &'static str {
3415 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector"
3416 }
3417 }
3418
3419 /// Specifies an identity for which to determine resource access, based on
3420 /// roles assigned either directly to them or to the groups they belong to,
3421 /// directly or indirectly.
3422 #[derive(Clone, Default, PartialEq)]
3423 #[non_exhaustive]
3424 pub struct IdentitySelector {
3425 /// Required. The identity appear in the form of principals in
3426 /// [IAM policy
3427 /// binding](https://cloud.google.com/iam/reference/rest/v1/Binding).
3428 ///
3429 /// The examples of supported forms are:
3430 /// "user:mike@example.com",
3431 /// "group:admins@example.com",
3432 /// "domain:google.com",
3433 /// "serviceAccount:my-project-id@appspot.gserviceaccount.com".
3434 ///
3435 /// Notice that wildcard characters (such as * and ?) are not supported.
3436 /// You must give a specific identity.
3437 pub identity: std::string::String,
3438
3439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3440 }
3441
3442 impl IdentitySelector {
3443 pub fn new() -> Self {
3444 std::default::Default::default()
3445 }
3446
3447 /// Sets the value of [identity][crate::model::iam_policy_analysis_query::IdentitySelector::identity].
3448 ///
3449 /// # Example
3450 /// ```ignore,no_run
3451 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::IdentitySelector;
3452 /// let x = IdentitySelector::new().set_identity("example");
3453 /// ```
3454 pub fn set_identity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3455 self.identity = v.into();
3456 self
3457 }
3458 }
3459
3460 impl wkt::message::Message for IdentitySelector {
3461 fn typename() -> &'static str {
3462 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.IdentitySelector"
3463 }
3464 }
3465
3466 /// Specifies roles and/or permissions to analyze, to determine both the
3467 /// identities possessing them and the resources they control. If multiple
3468 /// values are specified, results will include roles or permissions matching
3469 /// any of them. The total number of roles and permissions should be equal or
3470 /// less than 10.
3471 #[derive(Clone, Default, PartialEq)]
3472 #[non_exhaustive]
3473 pub struct AccessSelector {
3474 /// Optional. The roles to appear in result.
3475 pub roles: std::vec::Vec<std::string::String>,
3476
3477 /// Optional. The permissions to appear in result.
3478 pub permissions: std::vec::Vec<std::string::String>,
3479
3480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3481 }
3482
3483 impl AccessSelector {
3484 pub fn new() -> Self {
3485 std::default::Default::default()
3486 }
3487
3488 /// Sets the value of [roles][crate::model::iam_policy_analysis_query::AccessSelector::roles].
3489 ///
3490 /// # Example
3491 /// ```ignore,no_run
3492 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::AccessSelector;
3493 /// let x = AccessSelector::new().set_roles(["a", "b", "c"]);
3494 /// ```
3495 pub fn set_roles<T, V>(mut self, v: T) -> Self
3496 where
3497 T: std::iter::IntoIterator<Item = V>,
3498 V: std::convert::Into<std::string::String>,
3499 {
3500 use std::iter::Iterator;
3501 self.roles = v.into_iter().map(|i| i.into()).collect();
3502 self
3503 }
3504
3505 /// Sets the value of [permissions][crate::model::iam_policy_analysis_query::AccessSelector::permissions].
3506 ///
3507 /// # Example
3508 /// ```ignore,no_run
3509 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::AccessSelector;
3510 /// let x = AccessSelector::new().set_permissions(["a", "b", "c"]);
3511 /// ```
3512 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3513 where
3514 T: std::iter::IntoIterator<Item = V>,
3515 V: std::convert::Into<std::string::String>,
3516 {
3517 use std::iter::Iterator;
3518 self.permissions = v.into_iter().map(|i| i.into()).collect();
3519 self
3520 }
3521 }
3522
3523 impl wkt::message::Message for AccessSelector {
3524 fn typename() -> &'static str {
3525 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.AccessSelector"
3526 }
3527 }
3528
3529 /// Contains query options.
3530 #[derive(Clone, Default, PartialEq)]
3531 #[non_exhaustive]
3532 pub struct Options {
3533 /// Optional. If true, the identities section of the result will expand any
3534 /// Google groups appearing in an IAM policy binding.
3535 ///
3536 /// If
3537 /// [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector]
3538 /// is specified, the identity in the result will be determined by the
3539 /// selector, and this flag is not allowed to set.
3540 ///
3541 /// If true, the default max expansion per group is 1000 for
3542 /// AssetService.AnalyzeIamPolicy][].
3543 ///
3544 /// Default is false.
3545 ///
3546 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector]: crate::model::IamPolicyAnalysisQuery::identity_selector
3547 pub expand_groups: bool,
3548
3549 /// Optional. If true, the access section of result will expand any roles
3550 /// appearing in IAM policy bindings to include their permissions.
3551 ///
3552 /// If
3553 /// [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector]
3554 /// is specified, the access section of the result will be determined by the
3555 /// selector, and this flag is not allowed to set.
3556 ///
3557 /// Default is false.
3558 ///
3559 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector]: crate::model::IamPolicyAnalysisQuery::access_selector
3560 pub expand_roles: bool,
3561
3562 /// Optional. If true and
3563 /// [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]
3564 /// is not specified, the resource section of the result will expand any
3565 /// resource attached to an IAM policy to include resources lower in the
3566 /// resource hierarchy.
3567 ///
3568 /// For example, if the request analyzes for which resources user A has
3569 /// permission P, and the results include an IAM policy with P on a Google
3570 /// Cloud folder, the results will also include resources in that folder with
3571 /// permission P.
3572 ///
3573 /// If true and
3574 /// [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]
3575 /// is specified, the resource section of the result will expand the
3576 /// specified resource to include resources lower in the resource hierarchy.
3577 /// Only project or lower resources are supported. Folder and organization
3578 /// resources cannot be used together with this option.
3579 ///
3580 /// For example, if the request analyzes for which users have permission P on
3581 /// a Google Cloud project with this option enabled, the results will include
3582 /// all users who have permission P on that project or any lower resource.
3583 ///
3584 /// If true, the default max expansion per resource is 1000 for
3585 /// AssetService.AnalyzeIamPolicy][] and 100000 for
3586 /// AssetService.AnalyzeIamPolicyLongrunning][].
3587 ///
3588 /// Default is false.
3589 ///
3590 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector]: crate::model::IamPolicyAnalysisQuery::resource_selector
3591 pub expand_resources: bool,
3592
3593 /// Optional. If true, the result will output the relevant parent/child
3594 /// relationships between resources. Default is false.
3595 pub output_resource_edges: bool,
3596
3597 /// Optional. If true, the result will output the relevant membership
3598 /// relationships between groups and other groups, and between groups and
3599 /// principals. Default is false.
3600 pub output_group_edges: bool,
3601
3602 /// Optional. If true, the response will include access analysis from
3603 /// identities to resources via service account impersonation. This is a very
3604 /// expensive operation, because many derived queries will be executed. We
3605 /// highly recommend you use
3606 /// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]
3607 /// RPC instead.
3608 ///
3609 /// For example, if the request analyzes for which resources user A has
3610 /// permission P, and there's an IAM policy states user A has
3611 /// iam.serviceAccounts.getAccessToken permission to a service account SA,
3612 /// and there's another IAM policy states service account SA has permission P
3613 /// to a Google Cloud folder F, then user A potentially has access to the
3614 /// Google Cloud folder F. And those advanced analysis results will be
3615 /// included in
3616 /// [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
3617 ///
3618 /// Another example, if the request analyzes for who has
3619 /// permission P to a Google Cloud folder F, and there's an IAM policy states
3620 /// user A has iam.serviceAccounts.actAs permission to a service account SA,
3621 /// and there's another IAM policy states service account SA has permission P
3622 /// to the Google Cloud folder F, then user A potentially has access to the
3623 /// Google Cloud folder F. And those advanced analysis results will be
3624 /// included in
3625 /// [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
3626 ///
3627 /// Only the following permissions are considered in this analysis:
3628 ///
3629 /// * `iam.serviceAccounts.actAs`
3630 /// * `iam.serviceAccounts.signBlob`
3631 /// * `iam.serviceAccounts.signJwt`
3632 /// * `iam.serviceAccounts.getAccessToken`
3633 /// * `iam.serviceAccounts.getOpenIdToken`
3634 /// * `iam.serviceAccounts.implicitDelegation`
3635 ///
3636 /// Default is false.
3637 ///
3638 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]: crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis
3639 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
3640 pub analyze_service_account_impersonation: bool,
3641
3642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3643 }
3644
3645 impl Options {
3646 pub fn new() -> Self {
3647 std::default::Default::default()
3648 }
3649
3650 /// Sets the value of [expand_groups][crate::model::iam_policy_analysis_query::Options::expand_groups].
3651 ///
3652 /// # Example
3653 /// ```ignore,no_run
3654 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3655 /// let x = Options::new().set_expand_groups(true);
3656 /// ```
3657 pub fn set_expand_groups<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3658 self.expand_groups = v.into();
3659 self
3660 }
3661
3662 /// Sets the value of [expand_roles][crate::model::iam_policy_analysis_query::Options::expand_roles].
3663 ///
3664 /// # Example
3665 /// ```ignore,no_run
3666 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3667 /// let x = Options::new().set_expand_roles(true);
3668 /// ```
3669 pub fn set_expand_roles<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3670 self.expand_roles = v.into();
3671 self
3672 }
3673
3674 /// Sets the value of [expand_resources][crate::model::iam_policy_analysis_query::Options::expand_resources].
3675 ///
3676 /// # Example
3677 /// ```ignore,no_run
3678 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3679 /// let x = Options::new().set_expand_resources(true);
3680 /// ```
3681 pub fn set_expand_resources<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3682 self.expand_resources = v.into();
3683 self
3684 }
3685
3686 /// Sets the value of [output_resource_edges][crate::model::iam_policy_analysis_query::Options::output_resource_edges].
3687 ///
3688 /// # Example
3689 /// ```ignore,no_run
3690 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3691 /// let x = Options::new().set_output_resource_edges(true);
3692 /// ```
3693 pub fn set_output_resource_edges<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3694 self.output_resource_edges = v.into();
3695 self
3696 }
3697
3698 /// Sets the value of [output_group_edges][crate::model::iam_policy_analysis_query::Options::output_group_edges].
3699 ///
3700 /// # Example
3701 /// ```ignore,no_run
3702 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3703 /// let x = Options::new().set_output_group_edges(true);
3704 /// ```
3705 pub fn set_output_group_edges<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3706 self.output_group_edges = v.into();
3707 self
3708 }
3709
3710 /// Sets the value of [analyze_service_account_impersonation][crate::model::iam_policy_analysis_query::Options::analyze_service_account_impersonation].
3711 ///
3712 /// # Example
3713 /// ```ignore,no_run
3714 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::Options;
3715 /// let x = Options::new().set_analyze_service_account_impersonation(true);
3716 /// ```
3717 pub fn set_analyze_service_account_impersonation<T: std::convert::Into<bool>>(
3718 mut self,
3719 v: T,
3720 ) -> Self {
3721 self.analyze_service_account_impersonation = v.into();
3722 self
3723 }
3724 }
3725
3726 impl wkt::message::Message for Options {
3727 fn typename() -> &'static str {
3728 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.Options"
3729 }
3730 }
3731
3732 /// The IAM conditions context.
3733 #[derive(Clone, Default, PartialEq)]
3734 #[non_exhaustive]
3735 pub struct ConditionContext {
3736 /// The IAM conditions time context.
3737 pub time_context: std::option::Option<
3738 crate::model::iam_policy_analysis_query::condition_context::TimeContext,
3739 >,
3740
3741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3742 }
3743
3744 impl ConditionContext {
3745 pub fn new() -> Self {
3746 std::default::Default::default()
3747 }
3748
3749 /// Sets the value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context].
3750 ///
3751 /// Note that all the setters affecting `time_context` are mutually
3752 /// exclusive.
3753 ///
3754 /// # Example
3755 /// ```ignore,no_run
3756 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::ConditionContext;
3757 /// use wkt::Timestamp;
3758 /// let x = ConditionContext::new().set_time_context(Some(
3759 /// google_cloud_asset_v1::model::iam_policy_analysis_query::condition_context::TimeContext::AccessTime(Timestamp::default().into())));
3760 /// ```
3761 pub fn set_time_context<
3762 T: std::convert::Into<
3763 std::option::Option<
3764 crate::model::iam_policy_analysis_query::condition_context::TimeContext,
3765 >,
3766 >,
3767 >(
3768 mut self,
3769 v: T,
3770 ) -> Self {
3771 self.time_context = v.into();
3772 self
3773 }
3774
3775 /// The value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context]
3776 /// if it holds a `AccessTime`, `None` if the field is not set or
3777 /// holds a different branch.
3778 pub fn access_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3779 #[allow(unreachable_patterns)]
3780 self.time_context.as_ref().and_then(|v| match v {
3781 crate::model::iam_policy_analysis_query::condition_context::TimeContext::AccessTime(v) => std::option::Option::Some(v),
3782 _ => std::option::Option::None,
3783 })
3784 }
3785
3786 /// Sets the value of [time_context][crate::model::iam_policy_analysis_query::ConditionContext::time_context]
3787 /// to hold a `AccessTime`.
3788 ///
3789 /// Note that all the setters affecting `time_context` are
3790 /// mutually exclusive.
3791 ///
3792 /// # Example
3793 /// ```ignore,no_run
3794 /// # use google_cloud_asset_v1::model::iam_policy_analysis_query::ConditionContext;
3795 /// use wkt::Timestamp;
3796 /// let x = ConditionContext::new().set_access_time(Timestamp::default()/* use setters */);
3797 /// assert!(x.access_time().is_some());
3798 /// ```
3799 pub fn set_access_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3800 mut self,
3801 v: T,
3802 ) -> Self {
3803 self.time_context = std::option::Option::Some(
3804 crate::model::iam_policy_analysis_query::condition_context::TimeContext::AccessTime(
3805 v.into(),
3806 ),
3807 );
3808 self
3809 }
3810 }
3811
3812 impl wkt::message::Message for ConditionContext {
3813 fn typename() -> &'static str {
3814 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisQuery.ConditionContext"
3815 }
3816 }
3817
3818 /// Defines additional types related to [ConditionContext].
3819 pub mod condition_context {
3820 #[allow(unused_imports)]
3821 use super::*;
3822
3823 /// The IAM conditions time context.
3824 #[derive(Clone, Debug, PartialEq)]
3825 #[non_exhaustive]
3826 pub enum TimeContext {
3827 /// The hypothetical access timestamp to evaluate IAM conditions. Note that
3828 /// this value must not be earlier than the current time; otherwise, an
3829 /// INVALID_ARGUMENT error will be returned.
3830 AccessTime(std::boxed::Box<wkt::Timestamp>),
3831 }
3832 }
3833}
3834
3835/// A request message for
3836/// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
3837///
3838/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
3839#[derive(Clone, Default, PartialEq)]
3840#[non_exhaustive]
3841pub struct AnalyzeIamPolicyRequest {
3842 /// Required. The request query.
3843 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
3844
3845 /// Optional. The name of a saved query, which must be in the format of:
3846 ///
3847 /// * projects/project_number/savedQueries/saved_query_id
3848 /// * folders/folder_number/savedQueries/saved_query_id
3849 /// * organizations/organization_number/savedQueries/saved_query_id
3850 ///
3851 /// If both `analysis_query` and `saved_analysis_query` are provided, they
3852 /// will be merged together with the `saved_analysis_query` as base and
3853 /// the `analysis_query` as overrides. For more details of the merge behavior,
3854 /// refer to the
3855 /// [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
3856 /// page.
3857 ///
3858 /// Note that you cannot override primitive fields with default value, such as
3859 /// 0 or empty string, etc., because we use proto3, which doesn't support field
3860 /// presence yet.
3861 pub saved_analysis_query: std::string::String,
3862
3863 /// Optional. Amount of time executable has to complete. See JSON
3864 /// representation of
3865 /// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
3866 ///
3867 /// If this field is set with a value less than the RPC deadline, and the
3868 /// execution of your query hasn't finished in the specified
3869 /// execution timeout, you will get a response with partial result.
3870 /// Otherwise, your query's execution will continue until the RPC deadline.
3871 /// If it's not finished until then, you will get a DEADLINE_EXCEEDED error.
3872 ///
3873 /// Default is empty.
3874 pub execution_timeout: std::option::Option<wkt::Duration>,
3875
3876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3877}
3878
3879impl AnalyzeIamPolicyRequest {
3880 pub fn new() -> Self {
3881 std::default::Default::default()
3882 }
3883
3884 /// Sets the value of [analysis_query][crate::model::AnalyzeIamPolicyRequest::analysis_query].
3885 ///
3886 /// # Example
3887 /// ```ignore,no_run
3888 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyRequest;
3889 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3890 /// let x = AnalyzeIamPolicyRequest::new().set_analysis_query(IamPolicyAnalysisQuery::default()/* use setters */);
3891 /// ```
3892 pub fn set_analysis_query<T>(mut self, v: T) -> Self
3893 where
3894 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3895 {
3896 self.analysis_query = std::option::Option::Some(v.into());
3897 self
3898 }
3899
3900 /// Sets or clears the value of [analysis_query][crate::model::AnalyzeIamPolicyRequest::analysis_query].
3901 ///
3902 /// # Example
3903 /// ```ignore,no_run
3904 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyRequest;
3905 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
3906 /// let x = AnalyzeIamPolicyRequest::new().set_or_clear_analysis_query(Some(IamPolicyAnalysisQuery::default()/* use setters */));
3907 /// let x = AnalyzeIamPolicyRequest::new().set_or_clear_analysis_query(None::<IamPolicyAnalysisQuery>);
3908 /// ```
3909 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
3910 where
3911 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
3912 {
3913 self.analysis_query = v.map(|x| x.into());
3914 self
3915 }
3916
3917 /// Sets the value of [saved_analysis_query][crate::model::AnalyzeIamPolicyRequest::saved_analysis_query].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyRequest;
3922 /// let x = AnalyzeIamPolicyRequest::new().set_saved_analysis_query("example");
3923 /// ```
3924 pub fn set_saved_analysis_query<T: std::convert::Into<std::string::String>>(
3925 mut self,
3926 v: T,
3927 ) -> Self {
3928 self.saved_analysis_query = v.into();
3929 self
3930 }
3931
3932 /// Sets the value of [execution_timeout][crate::model::AnalyzeIamPolicyRequest::execution_timeout].
3933 ///
3934 /// # Example
3935 /// ```ignore,no_run
3936 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyRequest;
3937 /// use wkt::Duration;
3938 /// let x = AnalyzeIamPolicyRequest::new().set_execution_timeout(Duration::default()/* use setters */);
3939 /// ```
3940 pub fn set_execution_timeout<T>(mut self, v: T) -> Self
3941 where
3942 T: std::convert::Into<wkt::Duration>,
3943 {
3944 self.execution_timeout = std::option::Option::Some(v.into());
3945 self
3946 }
3947
3948 /// Sets or clears the value of [execution_timeout][crate::model::AnalyzeIamPolicyRequest::execution_timeout].
3949 ///
3950 /// # Example
3951 /// ```ignore,no_run
3952 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyRequest;
3953 /// use wkt::Duration;
3954 /// let x = AnalyzeIamPolicyRequest::new().set_or_clear_execution_timeout(Some(Duration::default()/* use setters */));
3955 /// let x = AnalyzeIamPolicyRequest::new().set_or_clear_execution_timeout(None::<Duration>);
3956 /// ```
3957 pub fn set_or_clear_execution_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3958 where
3959 T: std::convert::Into<wkt::Duration>,
3960 {
3961 self.execution_timeout = v.map(|x| x.into());
3962 self
3963 }
3964}
3965
3966impl wkt::message::Message for AnalyzeIamPolicyRequest {
3967 fn typename() -> &'static str {
3968 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyRequest"
3969 }
3970}
3971
3972/// A response message for
3973/// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
3974///
3975/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
3976#[derive(Clone, Default, PartialEq)]
3977#[non_exhaustive]
3978pub struct AnalyzeIamPolicyResponse {
3979 /// The main analysis that matches the original request.
3980 pub main_analysis:
3981 std::option::Option<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3982
3983 /// The service account impersonation analysis if
3984 /// [IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation][google.cloud.asset.v1.IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation]
3985 /// is enabled.
3986 ///
3987 /// [google.cloud.asset.v1.IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation]: crate::model::iam_policy_analysis_query::Options::analyze_service_account_impersonation
3988 pub service_account_impersonation_analysis:
3989 std::vec::Vec<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
3990
3991 /// Represents whether all entries in the
3992 /// [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis]
3993 /// and
3994 /// [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]
3995 /// have been fully explored to answer the query in the request.
3996 ///
3997 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis]: crate::model::AnalyzeIamPolicyResponse::main_analysis
3998 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]: crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis
3999 pub fully_explored: bool,
4000
4001 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4002}
4003
4004impl AnalyzeIamPolicyResponse {
4005 pub fn new() -> Self {
4006 std::default::Default::default()
4007 }
4008
4009 /// Sets the value of [main_analysis][crate::model::AnalyzeIamPolicyResponse::main_analysis].
4010 ///
4011 /// # Example
4012 /// ```ignore,no_run
4013 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyResponse;
4014 /// use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4015 /// let x = AnalyzeIamPolicyResponse::new().set_main_analysis(IamPolicyAnalysis::default()/* use setters */);
4016 /// ```
4017 pub fn set_main_analysis<T>(mut self, v: T) -> Self
4018 where
4019 T: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
4020 {
4021 self.main_analysis = std::option::Option::Some(v.into());
4022 self
4023 }
4024
4025 /// Sets or clears the value of [main_analysis][crate::model::AnalyzeIamPolicyResponse::main_analysis].
4026 ///
4027 /// # Example
4028 /// ```ignore,no_run
4029 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyResponse;
4030 /// use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4031 /// let x = AnalyzeIamPolicyResponse::new().set_or_clear_main_analysis(Some(IamPolicyAnalysis::default()/* use setters */));
4032 /// let x = AnalyzeIamPolicyResponse::new().set_or_clear_main_analysis(None::<IamPolicyAnalysis>);
4033 /// ```
4034 pub fn set_or_clear_main_analysis<T>(mut self, v: std::option::Option<T>) -> Self
4035 where
4036 T: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
4037 {
4038 self.main_analysis = v.map(|x| x.into());
4039 self
4040 }
4041
4042 /// Sets the value of [service_account_impersonation_analysis][crate::model::AnalyzeIamPolicyResponse::service_account_impersonation_analysis].
4043 ///
4044 /// # Example
4045 /// ```ignore,no_run
4046 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyResponse;
4047 /// use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4048 /// let x = AnalyzeIamPolicyResponse::new()
4049 /// .set_service_account_impersonation_analysis([
4050 /// IamPolicyAnalysis::default()/* use setters */,
4051 /// IamPolicyAnalysis::default()/* use (different) setters */,
4052 /// ]);
4053 /// ```
4054 pub fn set_service_account_impersonation_analysis<T, V>(mut self, v: T) -> Self
4055 where
4056 T: std::iter::IntoIterator<Item = V>,
4057 V: std::convert::Into<crate::model::analyze_iam_policy_response::IamPolicyAnalysis>,
4058 {
4059 use std::iter::Iterator;
4060 self.service_account_impersonation_analysis = v.into_iter().map(|i| i.into()).collect();
4061 self
4062 }
4063
4064 /// Sets the value of [fully_explored][crate::model::AnalyzeIamPolicyResponse::fully_explored].
4065 ///
4066 /// # Example
4067 /// ```ignore,no_run
4068 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyResponse;
4069 /// let x = AnalyzeIamPolicyResponse::new().set_fully_explored(true);
4070 /// ```
4071 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4072 self.fully_explored = v.into();
4073 self
4074 }
4075}
4076
4077impl wkt::message::Message for AnalyzeIamPolicyResponse {
4078 fn typename() -> &'static str {
4079 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyResponse"
4080 }
4081}
4082
4083/// Defines additional types related to [AnalyzeIamPolicyResponse].
4084pub mod analyze_iam_policy_response {
4085 #[allow(unused_imports)]
4086 use super::*;
4087
4088 /// An analysis message to group the query and results.
4089 #[derive(Clone, Default, PartialEq)]
4090 #[non_exhaustive]
4091 pub struct IamPolicyAnalysis {
4092 /// The analysis query.
4093 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
4094
4095 /// A list of
4096 /// [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult]
4097 /// that matches the analysis query, or empty if no result is found.
4098 ///
4099 /// [google.cloud.asset.v1.IamPolicyAnalysisResult]: crate::model::IamPolicyAnalysisResult
4100 pub analysis_results: std::vec::Vec<crate::model::IamPolicyAnalysisResult>,
4101
4102 /// Represents whether all entries in the
4103 /// [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results]
4104 /// have been fully explored to answer the query.
4105 ///
4106 /// [google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results]: crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_results
4107 pub fully_explored: bool,
4108
4109 /// A list of non-critical errors happened during the query handling.
4110 pub non_critical_errors: std::vec::Vec<crate::model::IamPolicyAnalysisState>,
4111
4112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4113 }
4114
4115 impl IamPolicyAnalysis {
4116 pub fn new() -> Self {
4117 std::default::Default::default()
4118 }
4119
4120 /// Sets the value of [analysis_query][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_query].
4121 ///
4122 /// # Example
4123 /// ```ignore,no_run
4124 /// # use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4125 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
4126 /// let x = IamPolicyAnalysis::new().set_analysis_query(IamPolicyAnalysisQuery::default()/* use setters */);
4127 /// ```
4128 pub fn set_analysis_query<T>(mut self, v: T) -> Self
4129 where
4130 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
4131 {
4132 self.analysis_query = std::option::Option::Some(v.into());
4133 self
4134 }
4135
4136 /// Sets or clears the value of [analysis_query][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_query].
4137 ///
4138 /// # Example
4139 /// ```ignore,no_run
4140 /// # use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4141 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
4142 /// let x = IamPolicyAnalysis::new().set_or_clear_analysis_query(Some(IamPolicyAnalysisQuery::default()/* use setters */));
4143 /// let x = IamPolicyAnalysis::new().set_or_clear_analysis_query(None::<IamPolicyAnalysisQuery>);
4144 /// ```
4145 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
4146 where
4147 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
4148 {
4149 self.analysis_query = v.map(|x| x.into());
4150 self
4151 }
4152
4153 /// Sets the value of [analysis_results][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::analysis_results].
4154 ///
4155 /// # Example
4156 /// ```ignore,no_run
4157 /// # use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4158 /// use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
4159 /// let x = IamPolicyAnalysis::new()
4160 /// .set_analysis_results([
4161 /// IamPolicyAnalysisResult::default()/* use setters */,
4162 /// IamPolicyAnalysisResult::default()/* use (different) setters */,
4163 /// ]);
4164 /// ```
4165 pub fn set_analysis_results<T, V>(mut self, v: T) -> Self
4166 where
4167 T: std::iter::IntoIterator<Item = V>,
4168 V: std::convert::Into<crate::model::IamPolicyAnalysisResult>,
4169 {
4170 use std::iter::Iterator;
4171 self.analysis_results = v.into_iter().map(|i| i.into()).collect();
4172 self
4173 }
4174
4175 /// Sets the value of [fully_explored][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::fully_explored].
4176 ///
4177 /// # Example
4178 /// ```ignore,no_run
4179 /// # use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4180 /// let x = IamPolicyAnalysis::new().set_fully_explored(true);
4181 /// ```
4182 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4183 self.fully_explored = v.into();
4184 self
4185 }
4186
4187 /// Sets the value of [non_critical_errors][crate::model::analyze_iam_policy_response::IamPolicyAnalysis::non_critical_errors].
4188 ///
4189 /// # Example
4190 /// ```ignore,no_run
4191 /// # use google_cloud_asset_v1::model::analyze_iam_policy_response::IamPolicyAnalysis;
4192 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
4193 /// let x = IamPolicyAnalysis::new()
4194 /// .set_non_critical_errors([
4195 /// IamPolicyAnalysisState::default()/* use setters */,
4196 /// IamPolicyAnalysisState::default()/* use (different) setters */,
4197 /// ]);
4198 /// ```
4199 pub fn set_non_critical_errors<T, V>(mut self, v: T) -> Self
4200 where
4201 T: std::iter::IntoIterator<Item = V>,
4202 V: std::convert::Into<crate::model::IamPolicyAnalysisState>,
4203 {
4204 use std::iter::Iterator;
4205 self.non_critical_errors = v.into_iter().map(|i| i.into()).collect();
4206 self
4207 }
4208 }
4209
4210 impl wkt::message::Message for IamPolicyAnalysis {
4211 fn typename() -> &'static str {
4212 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis"
4213 }
4214 }
4215}
4216
4217/// Output configuration for export IAM policy analysis destination.
4218#[derive(Clone, Default, PartialEq)]
4219#[non_exhaustive]
4220pub struct IamPolicyAnalysisOutputConfig {
4221 /// IAM policy analysis export destination.
4222 pub destination:
4223 std::option::Option<crate::model::iam_policy_analysis_output_config::Destination>,
4224
4225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4226}
4227
4228impl IamPolicyAnalysisOutputConfig {
4229 pub fn new() -> Self {
4230 std::default::Default::default()
4231 }
4232
4233 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination].
4234 ///
4235 /// Note that all the setters affecting `destination` are mutually
4236 /// exclusive.
4237 ///
4238 /// # Example
4239 /// ```ignore,no_run
4240 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisOutputConfig;
4241 /// use google_cloud_asset_v1::model::iam_policy_analysis_output_config::GcsDestination;
4242 /// let x = IamPolicyAnalysisOutputConfig::new().set_destination(Some(
4243 /// google_cloud_asset_v1::model::iam_policy_analysis_output_config::Destination::GcsDestination(GcsDestination::default().into())));
4244 /// ```
4245 pub fn set_destination<
4246 T: std::convert::Into<
4247 std::option::Option<crate::model::iam_policy_analysis_output_config::Destination>,
4248 >,
4249 >(
4250 mut self,
4251 v: T,
4252 ) -> Self {
4253 self.destination = v.into();
4254 self
4255 }
4256
4257 /// The value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
4258 /// if it holds a `GcsDestination`, `None` if the field is not set or
4259 /// holds a different branch.
4260 pub fn gcs_destination(
4261 &self,
4262 ) -> std::option::Option<
4263 &std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
4264 > {
4265 #[allow(unreachable_patterns)]
4266 self.destination.as_ref().and_then(|v| match v {
4267 crate::model::iam_policy_analysis_output_config::Destination::GcsDestination(v) => {
4268 std::option::Option::Some(v)
4269 }
4270 _ => std::option::Option::None,
4271 })
4272 }
4273
4274 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
4275 /// to hold a `GcsDestination`.
4276 ///
4277 /// Note that all the setters affecting `destination` are
4278 /// mutually exclusive.
4279 ///
4280 /// # Example
4281 /// ```ignore,no_run
4282 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisOutputConfig;
4283 /// use google_cloud_asset_v1::model::iam_policy_analysis_output_config::GcsDestination;
4284 /// let x = IamPolicyAnalysisOutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
4285 /// assert!(x.gcs_destination().is_some());
4286 /// assert!(x.bigquery_destination().is_none());
4287 /// ```
4288 pub fn set_gcs_destination<
4289 T: std::convert::Into<
4290 std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
4291 >,
4292 >(
4293 mut self,
4294 v: T,
4295 ) -> Self {
4296 self.destination = std::option::Option::Some(
4297 crate::model::iam_policy_analysis_output_config::Destination::GcsDestination(v.into()),
4298 );
4299 self
4300 }
4301
4302 /// The value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
4303 /// if it holds a `BigqueryDestination`, `None` if the field is not set or
4304 /// holds a different branch.
4305 pub fn bigquery_destination(
4306 &self,
4307 ) -> std::option::Option<
4308 &std::boxed::Box<crate::model::iam_policy_analysis_output_config::BigQueryDestination>,
4309 > {
4310 #[allow(unreachable_patterns)]
4311 self.destination.as_ref().and_then(|v| match v {
4312 crate::model::iam_policy_analysis_output_config::Destination::BigqueryDestination(
4313 v,
4314 ) => std::option::Option::Some(v),
4315 _ => std::option::Option::None,
4316 })
4317 }
4318
4319 /// Sets the value of [destination][crate::model::IamPolicyAnalysisOutputConfig::destination]
4320 /// to hold a `BigqueryDestination`.
4321 ///
4322 /// Note that all the setters affecting `destination` are
4323 /// mutually exclusive.
4324 ///
4325 /// # Example
4326 /// ```ignore,no_run
4327 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisOutputConfig;
4328 /// use google_cloud_asset_v1::model::iam_policy_analysis_output_config::BigQueryDestination;
4329 /// let x = IamPolicyAnalysisOutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
4330 /// assert!(x.bigquery_destination().is_some());
4331 /// assert!(x.gcs_destination().is_none());
4332 /// ```
4333 pub fn set_bigquery_destination<
4334 T: std::convert::Into<
4335 std::boxed::Box<
4336 crate::model::iam_policy_analysis_output_config::BigQueryDestination,
4337 >,
4338 >,
4339 >(
4340 mut self,
4341 v: T,
4342 ) -> Self {
4343 self.destination = std::option::Option::Some(
4344 crate::model::iam_policy_analysis_output_config::Destination::BigqueryDestination(
4345 v.into(),
4346 ),
4347 );
4348 self
4349 }
4350}
4351
4352impl wkt::message::Message for IamPolicyAnalysisOutputConfig {
4353 fn typename() -> &'static str {
4354 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig"
4355 }
4356}
4357
4358/// Defines additional types related to [IamPolicyAnalysisOutputConfig].
4359pub mod iam_policy_analysis_output_config {
4360 #[allow(unused_imports)]
4361 use super::*;
4362
4363 /// A Cloud Storage location.
4364 #[derive(Clone, Default, PartialEq)]
4365 #[non_exhaustive]
4366 pub struct GcsDestination {
4367 /// Required. The URI of the Cloud Storage object. It's the same URI that is
4368 /// used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
4369 /// Editing Object
4370 /// Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
4371 /// for more information.
4372 ///
4373 /// If the specified Cloud Storage object already exists and there is no
4374 /// [hold](https://cloud.google.com/storage/docs/object-holds), it will be
4375 /// overwritten with the analysis result.
4376 pub uri: std::string::String,
4377
4378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4379 }
4380
4381 impl GcsDestination {
4382 pub fn new() -> Self {
4383 std::default::Default::default()
4384 }
4385
4386 /// Sets the value of [uri][crate::model::iam_policy_analysis_output_config::GcsDestination::uri].
4387 ///
4388 /// # Example
4389 /// ```ignore,no_run
4390 /// # use google_cloud_asset_v1::model::iam_policy_analysis_output_config::GcsDestination;
4391 /// let x = GcsDestination::new().set_uri("example");
4392 /// ```
4393 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4394 self.uri = v.into();
4395 self
4396 }
4397 }
4398
4399 impl wkt::message::Message for GcsDestination {
4400 fn typename() -> &'static str {
4401 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.GcsDestination"
4402 }
4403 }
4404
4405 /// A BigQuery destination.
4406 #[derive(Clone, Default, PartialEq)]
4407 #[non_exhaustive]
4408 pub struct BigQueryDestination {
4409 /// Required. The BigQuery dataset in format
4410 /// "projects/projectId/datasets/datasetId", to which the analysis results
4411 /// should be exported. If this dataset does not exist, the export call will
4412 /// return an INVALID_ARGUMENT error.
4413 pub dataset: std::string::String,
4414
4415 /// Required. The prefix of the BigQuery tables to which the analysis results
4416 /// will be written. Tables will be created based on this table_prefix if not
4417 /// exist:
4418 ///
4419 /// * <table_prefix>_analysis table will contain export operation's metadata.
4420 /// * <table_prefix>_analysis_result will contain all the
4421 /// [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult].
4422 /// When [partition_key] is specified, both tables will be partitioned based
4423 /// on the [partition_key].
4424 ///
4425 /// [google.cloud.asset.v1.IamPolicyAnalysisResult]: crate::model::IamPolicyAnalysisResult
4426 pub table_prefix: std::string::String,
4427
4428 /// The partition key for BigQuery partitioned table.
4429 pub partition_key:
4430 crate::model::iam_policy_analysis_output_config::big_query_destination::PartitionKey,
4431
4432 /// Optional. Specifies the action that occurs if the destination table or
4433 /// partition already exists. The following values are supported:
4434 ///
4435 /// * WRITE_TRUNCATE: If the table or partition already exists, BigQuery
4436 /// overwrites the entire table or all the partitions data.
4437 /// * WRITE_APPEND: If the table or partition already exists, BigQuery
4438 /// appends the data to the table or the latest partition.
4439 /// * WRITE_EMPTY: If the table already exists and contains data, an error is
4440 /// returned.
4441 ///
4442 /// The default value is WRITE_APPEND. Each action is atomic and only occurs
4443 /// if BigQuery is able to complete the job successfully. Details are at
4444 /// <https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file>.
4445 pub write_disposition: std::string::String,
4446
4447 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4448 }
4449
4450 impl BigQueryDestination {
4451 pub fn new() -> Self {
4452 std::default::Default::default()
4453 }
4454
4455 /// Sets the value of [dataset][crate::model::iam_policy_analysis_output_config::BigQueryDestination::dataset].
4456 ///
4457 /// # Example
4458 /// ```ignore,no_run
4459 /// # use google_cloud_asset_v1::model::iam_policy_analysis_output_config::BigQueryDestination;
4460 /// let x = BigQueryDestination::new().set_dataset("example");
4461 /// ```
4462 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4463 self.dataset = v.into();
4464 self
4465 }
4466
4467 /// Sets the value of [table_prefix][crate::model::iam_policy_analysis_output_config::BigQueryDestination::table_prefix].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_asset_v1::model::iam_policy_analysis_output_config::BigQueryDestination;
4472 /// let x = BigQueryDestination::new().set_table_prefix("example");
4473 /// ```
4474 pub fn set_table_prefix<T: std::convert::Into<std::string::String>>(
4475 mut self,
4476 v: T,
4477 ) -> Self {
4478 self.table_prefix = v.into();
4479 self
4480 }
4481
4482 /// Sets the value of [partition_key][crate::model::iam_policy_analysis_output_config::BigQueryDestination::partition_key].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_asset_v1::model::iam_policy_analysis_output_config::BigQueryDestination;
4487 /// use google_cloud_asset_v1::model::iam_policy_analysis_output_config::big_query_destination::PartitionKey;
4488 /// let x0 = BigQueryDestination::new().set_partition_key(PartitionKey::RequestTime);
4489 /// ```
4490 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{
4491 self.partition_key = v.into();
4492 self
4493 }
4494
4495 /// Sets the value of [write_disposition][crate::model::iam_policy_analysis_output_config::BigQueryDestination::write_disposition].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_asset_v1::model::iam_policy_analysis_output_config::BigQueryDestination;
4500 /// let x = BigQueryDestination::new().set_write_disposition("example");
4501 /// ```
4502 pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
4503 mut self,
4504 v: T,
4505 ) -> Self {
4506 self.write_disposition = v.into();
4507 self
4508 }
4509 }
4510
4511 impl wkt::message::Message for BigQueryDestination {
4512 fn typename() -> &'static str {
4513 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.BigQueryDestination"
4514 }
4515 }
4516
4517 /// Defines additional types related to [BigQueryDestination].
4518 pub mod big_query_destination {
4519 #[allow(unused_imports)]
4520 use super::*;
4521
4522 /// This enum determines the partition key column for the bigquery tables.
4523 /// Partitioning can improve query performance and reduce query cost by
4524 /// filtering partitions. Refer to
4525 /// <https://cloud.google.com/bigquery/docs/partitioned-tables> for details.
4526 ///
4527 /// # Working with unknown values
4528 ///
4529 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4530 /// additional enum variants at any time. Adding new variants is not considered
4531 /// a breaking change. Applications should write their code in anticipation of:
4532 ///
4533 /// - New values appearing in future releases of the client library, **and**
4534 /// - New values received dynamically, without application changes.
4535 ///
4536 /// Please consult the [Working with enums] section in the user guide for some
4537 /// guidelines.
4538 ///
4539 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4540 #[derive(Clone, Debug, PartialEq)]
4541 #[non_exhaustive]
4542 pub enum PartitionKey {
4543 /// Unspecified partition key. Tables won't be partitioned using this
4544 /// option.
4545 Unspecified,
4546 /// The time when the request is received. If specified as partition key,
4547 /// the result table(s) is partitioned by the RequestTime column, an
4548 /// additional timestamp column representing when the request was received.
4549 RequestTime,
4550 /// If set, the enum was initialized with an unknown value.
4551 ///
4552 /// Applications can examine the value using [PartitionKey::value] or
4553 /// [PartitionKey::name].
4554 UnknownValue(partition_key::UnknownValue),
4555 }
4556
4557 #[doc(hidden)]
4558 pub mod partition_key {
4559 #[allow(unused_imports)]
4560 use super::*;
4561 #[derive(Clone, Debug, PartialEq)]
4562 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4563 }
4564
4565 impl PartitionKey {
4566 /// Gets the enum value.
4567 ///
4568 /// Returns `None` if the enum contains an unknown value deserialized from
4569 /// the string representation of enums.
4570 pub fn value(&self) -> std::option::Option<i32> {
4571 match self {
4572 Self::Unspecified => std::option::Option::Some(0),
4573 Self::RequestTime => std::option::Option::Some(1),
4574 Self::UnknownValue(u) => u.0.value(),
4575 }
4576 }
4577
4578 /// Gets the enum value as a string.
4579 ///
4580 /// Returns `None` if the enum contains an unknown value deserialized from
4581 /// the integer representation of enums.
4582 pub fn name(&self) -> std::option::Option<&str> {
4583 match self {
4584 Self::Unspecified => std::option::Option::Some("PARTITION_KEY_UNSPECIFIED"),
4585 Self::RequestTime => std::option::Option::Some("REQUEST_TIME"),
4586 Self::UnknownValue(u) => u.0.name(),
4587 }
4588 }
4589 }
4590
4591 impl std::default::Default for PartitionKey {
4592 fn default() -> Self {
4593 use std::convert::From;
4594 Self::from(0)
4595 }
4596 }
4597
4598 impl std::fmt::Display for PartitionKey {
4599 fn fmt(
4600 &self,
4601 f: &mut std::fmt::Formatter<'_>,
4602 ) -> std::result::Result<(), std::fmt::Error> {
4603 wkt::internal::display_enum(f, self.name(), self.value())
4604 }
4605 }
4606
4607 impl std::convert::From<i32> for PartitionKey {
4608 fn from(value: i32) -> Self {
4609 match value {
4610 0 => Self::Unspecified,
4611 1 => Self::RequestTime,
4612 _ => Self::UnknownValue(partition_key::UnknownValue(
4613 wkt::internal::UnknownEnumValue::Integer(value),
4614 )),
4615 }
4616 }
4617 }
4618
4619 impl std::convert::From<&str> for PartitionKey {
4620 fn from(value: &str) -> Self {
4621 use std::string::ToString;
4622 match value {
4623 "PARTITION_KEY_UNSPECIFIED" => Self::Unspecified,
4624 "REQUEST_TIME" => Self::RequestTime,
4625 _ => Self::UnknownValue(partition_key::UnknownValue(
4626 wkt::internal::UnknownEnumValue::String(value.to_string()),
4627 )),
4628 }
4629 }
4630 }
4631
4632 impl serde::ser::Serialize for PartitionKey {
4633 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4634 where
4635 S: serde::Serializer,
4636 {
4637 match self {
4638 Self::Unspecified => serializer.serialize_i32(0),
4639 Self::RequestTime => serializer.serialize_i32(1),
4640 Self::UnknownValue(u) => u.0.serialize(serializer),
4641 }
4642 }
4643 }
4644
4645 impl<'de> serde::de::Deserialize<'de> for PartitionKey {
4646 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4647 where
4648 D: serde::Deserializer<'de>,
4649 {
4650 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PartitionKey>::new(
4651 ".google.cloud.asset.v1.IamPolicyAnalysisOutputConfig.BigQueryDestination.PartitionKey"))
4652 }
4653 }
4654 }
4655
4656 /// IAM policy analysis export destination.
4657 #[derive(Clone, Debug, PartialEq)]
4658 #[non_exhaustive]
4659 pub enum Destination {
4660 /// Destination on Cloud Storage.
4661 GcsDestination(
4662 std::boxed::Box<crate::model::iam_policy_analysis_output_config::GcsDestination>,
4663 ),
4664 /// Destination on BigQuery.
4665 BigqueryDestination(
4666 std::boxed::Box<crate::model::iam_policy_analysis_output_config::BigQueryDestination>,
4667 ),
4668 }
4669}
4670
4671/// A request message for
4672/// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
4673///
4674/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
4675#[derive(Clone, Default, PartialEq)]
4676#[non_exhaustive]
4677pub struct AnalyzeIamPolicyLongrunningRequest {
4678 /// Required. The request query.
4679 pub analysis_query: std::option::Option<crate::model::IamPolicyAnalysisQuery>,
4680
4681 /// Optional. The name of a saved query, which must be in the format of:
4682 ///
4683 /// * projects/project_number/savedQueries/saved_query_id
4684 /// * folders/folder_number/savedQueries/saved_query_id
4685 /// * organizations/organization_number/savedQueries/saved_query_id
4686 ///
4687 /// If both `analysis_query` and `saved_analysis_query` are provided, they
4688 /// will be merged together with the `saved_analysis_query` as base and
4689 /// the `analysis_query` as overrides. For more details of the merge behavior,
4690 /// refer to the
4691 /// [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details)
4692 /// doc.
4693 ///
4694 /// Note that you cannot override primitive fields with default value, such as
4695 /// 0 or empty string, etc., because we use proto3, which doesn't support field
4696 /// presence yet.
4697 pub saved_analysis_query: std::string::String,
4698
4699 /// Required. Output configuration indicating where the results will be output
4700 /// to.
4701 pub output_config: std::option::Option<crate::model::IamPolicyAnalysisOutputConfig>,
4702
4703 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4704}
4705
4706impl AnalyzeIamPolicyLongrunningRequest {
4707 pub fn new() -> Self {
4708 std::default::Default::default()
4709 }
4710
4711 /// Sets the value of [analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::analysis_query].
4712 ///
4713 /// # Example
4714 /// ```ignore,no_run
4715 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningRequest;
4716 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
4717 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_analysis_query(IamPolicyAnalysisQuery::default()/* use setters */);
4718 /// ```
4719 pub fn set_analysis_query<T>(mut self, v: T) -> Self
4720 where
4721 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
4722 {
4723 self.analysis_query = std::option::Option::Some(v.into());
4724 self
4725 }
4726
4727 /// Sets or clears the value of [analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::analysis_query].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningRequest;
4732 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
4733 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_or_clear_analysis_query(Some(IamPolicyAnalysisQuery::default()/* use setters */));
4734 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_or_clear_analysis_query(None::<IamPolicyAnalysisQuery>);
4735 /// ```
4736 pub fn set_or_clear_analysis_query<T>(mut self, v: std::option::Option<T>) -> Self
4737 where
4738 T: std::convert::Into<crate::model::IamPolicyAnalysisQuery>,
4739 {
4740 self.analysis_query = v.map(|x| x.into());
4741 self
4742 }
4743
4744 /// Sets the value of [saved_analysis_query][crate::model::AnalyzeIamPolicyLongrunningRequest::saved_analysis_query].
4745 ///
4746 /// # Example
4747 /// ```ignore,no_run
4748 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningRequest;
4749 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_saved_analysis_query("example");
4750 /// ```
4751 pub fn set_saved_analysis_query<T: std::convert::Into<std::string::String>>(
4752 mut self,
4753 v: T,
4754 ) -> Self {
4755 self.saved_analysis_query = v.into();
4756 self
4757 }
4758
4759 /// Sets the value of [output_config][crate::model::AnalyzeIamPolicyLongrunningRequest::output_config].
4760 ///
4761 /// # Example
4762 /// ```ignore,no_run
4763 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningRequest;
4764 /// use google_cloud_asset_v1::model::IamPolicyAnalysisOutputConfig;
4765 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_output_config(IamPolicyAnalysisOutputConfig::default()/* use setters */);
4766 /// ```
4767 pub fn set_output_config<T>(mut self, v: T) -> Self
4768 where
4769 T: std::convert::Into<crate::model::IamPolicyAnalysisOutputConfig>,
4770 {
4771 self.output_config = std::option::Option::Some(v.into());
4772 self
4773 }
4774
4775 /// Sets or clears the value of [output_config][crate::model::AnalyzeIamPolicyLongrunningRequest::output_config].
4776 ///
4777 /// # Example
4778 /// ```ignore,no_run
4779 /// # use google_cloud_asset_v1::model::AnalyzeIamPolicyLongrunningRequest;
4780 /// use google_cloud_asset_v1::model::IamPolicyAnalysisOutputConfig;
4781 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_or_clear_output_config(Some(IamPolicyAnalysisOutputConfig::default()/* use setters */));
4782 /// let x = AnalyzeIamPolicyLongrunningRequest::new().set_or_clear_output_config(None::<IamPolicyAnalysisOutputConfig>);
4783 /// ```
4784 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
4785 where
4786 T: std::convert::Into<crate::model::IamPolicyAnalysisOutputConfig>,
4787 {
4788 self.output_config = v.map(|x| x.into());
4789 self
4790 }
4791}
4792
4793impl wkt::message::Message for AnalyzeIamPolicyLongrunningRequest {
4794 fn typename() -> &'static str {
4795 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningRequest"
4796 }
4797}
4798
4799/// A response message for
4800/// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
4801///
4802/// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
4803#[derive(Clone, Default, PartialEq)]
4804#[non_exhaustive]
4805pub struct AnalyzeIamPolicyLongrunningResponse {
4806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4807}
4808
4809impl AnalyzeIamPolicyLongrunningResponse {
4810 pub fn new() -> Self {
4811 std::default::Default::default()
4812 }
4813}
4814
4815impl wkt::message::Message for AnalyzeIamPolicyLongrunningResponse {
4816 fn typename() -> &'static str {
4817 "type.googleapis.com/google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse"
4818 }
4819}
4820
4821/// A saved query which can be shared with others or used later.
4822#[derive(Clone, Default, PartialEq)]
4823#[non_exhaustive]
4824pub struct SavedQuery {
4825 /// The resource name of the saved query. The format must be:
4826 ///
4827 /// * projects/project_number/savedQueries/saved_query_id
4828 /// * folders/folder_number/savedQueries/saved_query_id
4829 /// * organizations/organization_number/savedQueries/saved_query_id
4830 pub name: std::string::String,
4831
4832 /// The description of this saved query. This value should be fewer than 255
4833 /// characters.
4834 pub description: std::string::String,
4835
4836 /// Output only. The create time of this saved query.
4837 pub create_time: std::option::Option<wkt::Timestamp>,
4838
4839 /// Output only. The account's email address who has created this saved query.
4840 pub creator: std::string::String,
4841
4842 /// Output only. The last update time of this saved query.
4843 pub last_update_time: std::option::Option<wkt::Timestamp>,
4844
4845 /// Output only. The account's email address who has updated this saved query
4846 /// most recently.
4847 pub last_updater: std::string::String,
4848
4849 /// Labels applied on the resource.
4850 /// This value should not contain more than 10 entries. The key and value of
4851 /// each entry must be non-empty and fewer than 64 characters.
4852 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4853
4854 /// The query content.
4855 pub content: std::option::Option<crate::model::saved_query::QueryContent>,
4856
4857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4858}
4859
4860impl SavedQuery {
4861 pub fn new() -> Self {
4862 std::default::Default::default()
4863 }
4864
4865 /// Sets the value of [name][crate::model::SavedQuery::name].
4866 ///
4867 /// # Example
4868 /// ```ignore,no_run
4869 /// # use google_cloud_asset_v1::model::SavedQuery;
4870 /// let x = SavedQuery::new().set_name("example");
4871 /// ```
4872 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4873 self.name = v.into();
4874 self
4875 }
4876
4877 /// Sets the value of [description][crate::model::SavedQuery::description].
4878 ///
4879 /// # Example
4880 /// ```ignore,no_run
4881 /// # use google_cloud_asset_v1::model::SavedQuery;
4882 /// let x = SavedQuery::new().set_description("example");
4883 /// ```
4884 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4885 self.description = v.into();
4886 self
4887 }
4888
4889 /// Sets the value of [create_time][crate::model::SavedQuery::create_time].
4890 ///
4891 /// # Example
4892 /// ```ignore,no_run
4893 /// # use google_cloud_asset_v1::model::SavedQuery;
4894 /// use wkt::Timestamp;
4895 /// let x = SavedQuery::new().set_create_time(Timestamp::default()/* use setters */);
4896 /// ```
4897 pub fn set_create_time<T>(mut self, v: T) -> Self
4898 where
4899 T: std::convert::Into<wkt::Timestamp>,
4900 {
4901 self.create_time = std::option::Option::Some(v.into());
4902 self
4903 }
4904
4905 /// Sets or clears the value of [create_time][crate::model::SavedQuery::create_time].
4906 ///
4907 /// # Example
4908 /// ```ignore,no_run
4909 /// # use google_cloud_asset_v1::model::SavedQuery;
4910 /// use wkt::Timestamp;
4911 /// let x = SavedQuery::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4912 /// let x = SavedQuery::new().set_or_clear_create_time(None::<Timestamp>);
4913 /// ```
4914 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4915 where
4916 T: std::convert::Into<wkt::Timestamp>,
4917 {
4918 self.create_time = v.map(|x| x.into());
4919 self
4920 }
4921
4922 /// Sets the value of [creator][crate::model::SavedQuery::creator].
4923 ///
4924 /// # Example
4925 /// ```ignore,no_run
4926 /// # use google_cloud_asset_v1::model::SavedQuery;
4927 /// let x = SavedQuery::new().set_creator("example");
4928 /// ```
4929 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4930 self.creator = v.into();
4931 self
4932 }
4933
4934 /// Sets the value of [last_update_time][crate::model::SavedQuery::last_update_time].
4935 ///
4936 /// # Example
4937 /// ```ignore,no_run
4938 /// # use google_cloud_asset_v1::model::SavedQuery;
4939 /// use wkt::Timestamp;
4940 /// let x = SavedQuery::new().set_last_update_time(Timestamp::default()/* use setters */);
4941 /// ```
4942 pub fn set_last_update_time<T>(mut self, v: T) -> Self
4943 where
4944 T: std::convert::Into<wkt::Timestamp>,
4945 {
4946 self.last_update_time = std::option::Option::Some(v.into());
4947 self
4948 }
4949
4950 /// Sets or clears the value of [last_update_time][crate::model::SavedQuery::last_update_time].
4951 ///
4952 /// # Example
4953 /// ```ignore,no_run
4954 /// # use google_cloud_asset_v1::model::SavedQuery;
4955 /// use wkt::Timestamp;
4956 /// let x = SavedQuery::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
4957 /// let x = SavedQuery::new().set_or_clear_last_update_time(None::<Timestamp>);
4958 /// ```
4959 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4960 where
4961 T: std::convert::Into<wkt::Timestamp>,
4962 {
4963 self.last_update_time = v.map(|x| x.into());
4964 self
4965 }
4966
4967 /// Sets the value of [last_updater][crate::model::SavedQuery::last_updater].
4968 ///
4969 /// # Example
4970 /// ```ignore,no_run
4971 /// # use google_cloud_asset_v1::model::SavedQuery;
4972 /// let x = SavedQuery::new().set_last_updater("example");
4973 /// ```
4974 pub fn set_last_updater<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4975 self.last_updater = v.into();
4976 self
4977 }
4978
4979 /// Sets the value of [labels][crate::model::SavedQuery::labels].
4980 ///
4981 /// # Example
4982 /// ```ignore,no_run
4983 /// # use google_cloud_asset_v1::model::SavedQuery;
4984 /// let x = SavedQuery::new().set_labels([
4985 /// ("key0", "abc"),
4986 /// ("key1", "xyz"),
4987 /// ]);
4988 /// ```
4989 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4990 where
4991 T: std::iter::IntoIterator<Item = (K, V)>,
4992 K: std::convert::Into<std::string::String>,
4993 V: std::convert::Into<std::string::String>,
4994 {
4995 use std::iter::Iterator;
4996 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4997 self
4998 }
4999
5000 /// Sets the value of [content][crate::model::SavedQuery::content].
5001 ///
5002 /// # Example
5003 /// ```ignore,no_run
5004 /// # use google_cloud_asset_v1::model::SavedQuery;
5005 /// use google_cloud_asset_v1::model::saved_query::QueryContent;
5006 /// let x = SavedQuery::new().set_content(QueryContent::default()/* use setters */);
5007 /// ```
5008 pub fn set_content<T>(mut self, v: T) -> Self
5009 where
5010 T: std::convert::Into<crate::model::saved_query::QueryContent>,
5011 {
5012 self.content = std::option::Option::Some(v.into());
5013 self
5014 }
5015
5016 /// Sets or clears the value of [content][crate::model::SavedQuery::content].
5017 ///
5018 /// # Example
5019 /// ```ignore,no_run
5020 /// # use google_cloud_asset_v1::model::SavedQuery;
5021 /// use google_cloud_asset_v1::model::saved_query::QueryContent;
5022 /// let x = SavedQuery::new().set_or_clear_content(Some(QueryContent::default()/* use setters */));
5023 /// let x = SavedQuery::new().set_or_clear_content(None::<QueryContent>);
5024 /// ```
5025 pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
5026 where
5027 T: std::convert::Into<crate::model::saved_query::QueryContent>,
5028 {
5029 self.content = v.map(|x| x.into());
5030 self
5031 }
5032}
5033
5034impl wkt::message::Message for SavedQuery {
5035 fn typename() -> &'static str {
5036 "type.googleapis.com/google.cloud.asset.v1.SavedQuery"
5037 }
5038}
5039
5040/// Defines additional types related to [SavedQuery].
5041pub mod saved_query {
5042 #[allow(unused_imports)]
5043 use super::*;
5044
5045 /// The query content.
5046 #[derive(Clone, Default, PartialEq)]
5047 #[non_exhaustive]
5048 pub struct QueryContent {
5049 pub query_content:
5050 std::option::Option<crate::model::saved_query::query_content::QueryContent>,
5051
5052 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5053 }
5054
5055 impl QueryContent {
5056 pub fn new() -> Self {
5057 std::default::Default::default()
5058 }
5059
5060 /// Sets the value of [query_content][crate::model::saved_query::QueryContent::query_content].
5061 ///
5062 /// Note that all the setters affecting `query_content` are mutually
5063 /// exclusive.
5064 ///
5065 /// # Example
5066 /// ```ignore,no_run
5067 /// # use google_cloud_asset_v1::model::saved_query::QueryContent;
5068 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
5069 /// let x = QueryContent::new().set_query_content(Some(
5070 /// google_cloud_asset_v1::model::saved_query::query_content::QueryContent::IamPolicyAnalysisQuery(IamPolicyAnalysisQuery::default().into())));
5071 /// ```
5072 pub fn set_query_content<
5073 T: std::convert::Into<
5074 std::option::Option<crate::model::saved_query::query_content::QueryContent>,
5075 >,
5076 >(
5077 mut self,
5078 v: T,
5079 ) -> Self {
5080 self.query_content = v.into();
5081 self
5082 }
5083
5084 /// The value of [query_content][crate::model::saved_query::QueryContent::query_content]
5085 /// if it holds a `IamPolicyAnalysisQuery`, `None` if the field is not set or
5086 /// holds a different branch.
5087 pub fn iam_policy_analysis_query(
5088 &self,
5089 ) -> std::option::Option<&std::boxed::Box<crate::model::IamPolicyAnalysisQuery>> {
5090 #[allow(unreachable_patterns)]
5091 self.query_content.as_ref().and_then(|v| match v {
5092 crate::model::saved_query::query_content::QueryContent::IamPolicyAnalysisQuery(
5093 v,
5094 ) => std::option::Option::Some(v),
5095 _ => std::option::Option::None,
5096 })
5097 }
5098
5099 /// Sets the value of [query_content][crate::model::saved_query::QueryContent::query_content]
5100 /// to hold a `IamPolicyAnalysisQuery`.
5101 ///
5102 /// Note that all the setters affecting `query_content` are
5103 /// mutually exclusive.
5104 ///
5105 /// # Example
5106 /// ```ignore,no_run
5107 /// # use google_cloud_asset_v1::model::saved_query::QueryContent;
5108 /// use google_cloud_asset_v1::model::IamPolicyAnalysisQuery;
5109 /// let x = QueryContent::new().set_iam_policy_analysis_query(IamPolicyAnalysisQuery::default()/* use setters */);
5110 /// assert!(x.iam_policy_analysis_query().is_some());
5111 /// ```
5112 pub fn set_iam_policy_analysis_query<
5113 T: std::convert::Into<std::boxed::Box<crate::model::IamPolicyAnalysisQuery>>,
5114 >(
5115 mut self,
5116 v: T,
5117 ) -> Self {
5118 self.query_content = std::option::Option::Some(
5119 crate::model::saved_query::query_content::QueryContent::IamPolicyAnalysisQuery(
5120 v.into(),
5121 ),
5122 );
5123 self
5124 }
5125 }
5126
5127 impl wkt::message::Message for QueryContent {
5128 fn typename() -> &'static str {
5129 "type.googleapis.com/google.cloud.asset.v1.SavedQuery.QueryContent"
5130 }
5131 }
5132
5133 /// Defines additional types related to [QueryContent].
5134 pub mod query_content {
5135 #[allow(unused_imports)]
5136 use super::*;
5137
5138 #[derive(Clone, Debug, PartialEq)]
5139 #[non_exhaustive]
5140 pub enum QueryContent {
5141 /// An IAM Policy Analysis query, which could be used in
5142 /// the
5143 /// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]
5144 /// RPC or the
5145 /// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]
5146 /// RPC.
5147 ///
5148 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]: crate::client::AssetService::analyze_iam_policy
5149 /// [google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]: crate::client::AssetService::analyze_iam_policy_longrunning
5150 IamPolicyAnalysisQuery(std::boxed::Box<crate::model::IamPolicyAnalysisQuery>),
5151 }
5152 }
5153}
5154
5155/// Request to create a saved query.
5156#[derive(Clone, Default, PartialEq)]
5157#[non_exhaustive]
5158pub struct CreateSavedQueryRequest {
5159 /// Required. The name of the project/folder/organization where this
5160 /// saved_query should be created in. It can only be an organization number
5161 /// (such as "organizations/123"), a folder number (such as "folders/123"), a
5162 /// project ID (such as "projects/my-project-id"), or a project number (such as
5163 /// "projects/12345").
5164 pub parent: std::string::String,
5165
5166 /// Required. The saved_query details. The `name` field must be empty as it
5167 /// will be generated based on the parent and saved_query_id.
5168 pub saved_query: std::option::Option<crate::model::SavedQuery>,
5169
5170 /// Required. The ID to use for the saved query, which must be unique in the
5171 /// specified parent. It will become the final component of the saved query's
5172 /// resource name.
5173 ///
5174 /// This value should be 4-63 characters, and valid characters
5175 /// are `[a-z][0-9]-`.
5176 ///
5177 /// Notice that this field is required in the saved query creation, and the
5178 /// `name` field of the `saved_query` will be ignored.
5179 pub saved_query_id: std::string::String,
5180
5181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5182}
5183
5184impl CreateSavedQueryRequest {
5185 pub fn new() -> Self {
5186 std::default::Default::default()
5187 }
5188
5189 /// Sets the value of [parent][crate::model::CreateSavedQueryRequest::parent].
5190 ///
5191 /// # Example
5192 /// ```ignore,no_run
5193 /// # use google_cloud_asset_v1::model::CreateSavedQueryRequest;
5194 /// let x = CreateSavedQueryRequest::new().set_parent("example");
5195 /// ```
5196 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5197 self.parent = v.into();
5198 self
5199 }
5200
5201 /// Sets the value of [saved_query][crate::model::CreateSavedQueryRequest::saved_query].
5202 ///
5203 /// # Example
5204 /// ```ignore,no_run
5205 /// # use google_cloud_asset_v1::model::CreateSavedQueryRequest;
5206 /// use google_cloud_asset_v1::model::SavedQuery;
5207 /// let x = CreateSavedQueryRequest::new().set_saved_query(SavedQuery::default()/* use setters */);
5208 /// ```
5209 pub fn set_saved_query<T>(mut self, v: T) -> Self
5210 where
5211 T: std::convert::Into<crate::model::SavedQuery>,
5212 {
5213 self.saved_query = std::option::Option::Some(v.into());
5214 self
5215 }
5216
5217 /// Sets or clears the value of [saved_query][crate::model::CreateSavedQueryRequest::saved_query].
5218 ///
5219 /// # Example
5220 /// ```ignore,no_run
5221 /// # use google_cloud_asset_v1::model::CreateSavedQueryRequest;
5222 /// use google_cloud_asset_v1::model::SavedQuery;
5223 /// let x = CreateSavedQueryRequest::new().set_or_clear_saved_query(Some(SavedQuery::default()/* use setters */));
5224 /// let x = CreateSavedQueryRequest::new().set_or_clear_saved_query(None::<SavedQuery>);
5225 /// ```
5226 pub fn set_or_clear_saved_query<T>(mut self, v: std::option::Option<T>) -> Self
5227 where
5228 T: std::convert::Into<crate::model::SavedQuery>,
5229 {
5230 self.saved_query = v.map(|x| x.into());
5231 self
5232 }
5233
5234 /// Sets the value of [saved_query_id][crate::model::CreateSavedQueryRequest::saved_query_id].
5235 ///
5236 /// # Example
5237 /// ```ignore,no_run
5238 /// # use google_cloud_asset_v1::model::CreateSavedQueryRequest;
5239 /// let x = CreateSavedQueryRequest::new().set_saved_query_id("example");
5240 /// ```
5241 pub fn set_saved_query_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5242 self.saved_query_id = v.into();
5243 self
5244 }
5245}
5246
5247impl wkt::message::Message for CreateSavedQueryRequest {
5248 fn typename() -> &'static str {
5249 "type.googleapis.com/google.cloud.asset.v1.CreateSavedQueryRequest"
5250 }
5251}
5252
5253/// Request to get a saved query.
5254#[derive(Clone, Default, PartialEq)]
5255#[non_exhaustive]
5256pub struct GetSavedQueryRequest {
5257 /// Required. The name of the saved query and it must be in the format of:
5258 ///
5259 /// * projects/project_number/savedQueries/saved_query_id
5260 /// * folders/folder_number/savedQueries/saved_query_id
5261 /// * organizations/organization_number/savedQueries/saved_query_id
5262 pub name: std::string::String,
5263
5264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5265}
5266
5267impl GetSavedQueryRequest {
5268 pub fn new() -> Self {
5269 std::default::Default::default()
5270 }
5271
5272 /// Sets the value of [name][crate::model::GetSavedQueryRequest::name].
5273 ///
5274 /// # Example
5275 /// ```ignore,no_run
5276 /// # use google_cloud_asset_v1::model::GetSavedQueryRequest;
5277 /// let x = GetSavedQueryRequest::new().set_name("example");
5278 /// ```
5279 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5280 self.name = v.into();
5281 self
5282 }
5283}
5284
5285impl wkt::message::Message for GetSavedQueryRequest {
5286 fn typename() -> &'static str {
5287 "type.googleapis.com/google.cloud.asset.v1.GetSavedQueryRequest"
5288 }
5289}
5290
5291/// Request to list saved queries.
5292#[derive(Clone, Default, PartialEq)]
5293#[non_exhaustive]
5294pub struct ListSavedQueriesRequest {
5295 /// Required. The parent project/folder/organization whose savedQueries are to
5296 /// be listed. It can only be using project/folder/organization number (such as
5297 /// "folders/12345")", or a project ID (such as "projects/my-project-id").
5298 pub parent: std::string::String,
5299
5300 /// Optional. The expression to filter resources.
5301 /// The expression is a list of zero or more restrictions combined via logical
5302 /// operators `AND` and `OR`. When `AND` and `OR` are both used in the
5303 /// expression, parentheses must be appropriately used to group the
5304 /// combinations. The expression may also contain regular expressions.
5305 ///
5306 /// See <https://google.aip.dev/160> for more information on the grammar.
5307 pub filter: std::string::String,
5308
5309 /// Optional. The maximum number of saved queries to return per page. The
5310 /// service may return fewer than this value. If unspecified, at most 50 will
5311 /// be returned. The maximum value is 1000; values above 1000 will be coerced
5312 /// to 1000.
5313 pub page_size: i32,
5314
5315 /// Optional. A page token, received from a previous `ListSavedQueries` call.
5316 /// Provide this to retrieve the subsequent page.
5317 ///
5318 /// When paginating, all other parameters provided to `ListSavedQueries` must
5319 /// match the call that provided the page token.
5320 pub page_token: std::string::String,
5321
5322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5323}
5324
5325impl ListSavedQueriesRequest {
5326 pub fn new() -> Self {
5327 std::default::Default::default()
5328 }
5329
5330 /// Sets the value of [parent][crate::model::ListSavedQueriesRequest::parent].
5331 ///
5332 /// # Example
5333 /// ```ignore,no_run
5334 /// # use google_cloud_asset_v1::model::ListSavedQueriesRequest;
5335 /// let x = ListSavedQueriesRequest::new().set_parent("example");
5336 /// ```
5337 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5338 self.parent = v.into();
5339 self
5340 }
5341
5342 /// Sets the value of [filter][crate::model::ListSavedQueriesRequest::filter].
5343 ///
5344 /// # Example
5345 /// ```ignore,no_run
5346 /// # use google_cloud_asset_v1::model::ListSavedQueriesRequest;
5347 /// let x = ListSavedQueriesRequest::new().set_filter("example");
5348 /// ```
5349 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5350 self.filter = v.into();
5351 self
5352 }
5353
5354 /// Sets the value of [page_size][crate::model::ListSavedQueriesRequest::page_size].
5355 ///
5356 /// # Example
5357 /// ```ignore,no_run
5358 /// # use google_cloud_asset_v1::model::ListSavedQueriesRequest;
5359 /// let x = ListSavedQueriesRequest::new().set_page_size(42);
5360 /// ```
5361 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5362 self.page_size = v.into();
5363 self
5364 }
5365
5366 /// Sets the value of [page_token][crate::model::ListSavedQueriesRequest::page_token].
5367 ///
5368 /// # Example
5369 /// ```ignore,no_run
5370 /// # use google_cloud_asset_v1::model::ListSavedQueriesRequest;
5371 /// let x = ListSavedQueriesRequest::new().set_page_token("example");
5372 /// ```
5373 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5374 self.page_token = v.into();
5375 self
5376 }
5377}
5378
5379impl wkt::message::Message for ListSavedQueriesRequest {
5380 fn typename() -> &'static str {
5381 "type.googleapis.com/google.cloud.asset.v1.ListSavedQueriesRequest"
5382 }
5383}
5384
5385/// Response of listing saved queries.
5386#[derive(Clone, Default, PartialEq)]
5387#[non_exhaustive]
5388pub struct ListSavedQueriesResponse {
5389 /// A list of savedQueries.
5390 pub saved_queries: std::vec::Vec<crate::model::SavedQuery>,
5391
5392 /// A token, which can be sent as `page_token` to retrieve the next page.
5393 /// If this field is omitted, there are no subsequent pages.
5394 pub next_page_token: std::string::String,
5395
5396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5397}
5398
5399impl ListSavedQueriesResponse {
5400 pub fn new() -> Self {
5401 std::default::Default::default()
5402 }
5403
5404 /// Sets the value of [saved_queries][crate::model::ListSavedQueriesResponse::saved_queries].
5405 ///
5406 /// # Example
5407 /// ```ignore,no_run
5408 /// # use google_cloud_asset_v1::model::ListSavedQueriesResponse;
5409 /// use google_cloud_asset_v1::model::SavedQuery;
5410 /// let x = ListSavedQueriesResponse::new()
5411 /// .set_saved_queries([
5412 /// SavedQuery::default()/* use setters */,
5413 /// SavedQuery::default()/* use (different) setters */,
5414 /// ]);
5415 /// ```
5416 pub fn set_saved_queries<T, V>(mut self, v: T) -> Self
5417 where
5418 T: std::iter::IntoIterator<Item = V>,
5419 V: std::convert::Into<crate::model::SavedQuery>,
5420 {
5421 use std::iter::Iterator;
5422 self.saved_queries = v.into_iter().map(|i| i.into()).collect();
5423 self
5424 }
5425
5426 /// Sets the value of [next_page_token][crate::model::ListSavedQueriesResponse::next_page_token].
5427 ///
5428 /// # Example
5429 /// ```ignore,no_run
5430 /// # use google_cloud_asset_v1::model::ListSavedQueriesResponse;
5431 /// let x = ListSavedQueriesResponse::new().set_next_page_token("example");
5432 /// ```
5433 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5434 self.next_page_token = v.into();
5435 self
5436 }
5437}
5438
5439impl wkt::message::Message for ListSavedQueriesResponse {
5440 fn typename() -> &'static str {
5441 "type.googleapis.com/google.cloud.asset.v1.ListSavedQueriesResponse"
5442 }
5443}
5444
5445#[doc(hidden)]
5446impl google_cloud_gax::paginator::internal::PageableResponse for ListSavedQueriesResponse {
5447 type PageItem = crate::model::SavedQuery;
5448
5449 fn items(self) -> std::vec::Vec<Self::PageItem> {
5450 self.saved_queries
5451 }
5452
5453 fn next_page_token(&self) -> std::string::String {
5454 use std::clone::Clone;
5455 self.next_page_token.clone()
5456 }
5457}
5458
5459/// Request to update a saved query.
5460#[derive(Clone, Default, PartialEq)]
5461#[non_exhaustive]
5462pub struct UpdateSavedQueryRequest {
5463 /// Required. The saved query to update.
5464 ///
5465 /// The saved query's `name` field is used to identify the one to update,
5466 /// which has format as below:
5467 ///
5468 /// * projects/project_number/savedQueries/saved_query_id
5469 /// * folders/folder_number/savedQueries/saved_query_id
5470 /// * organizations/organization_number/savedQueries/saved_query_id
5471 pub saved_query: std::option::Option<crate::model::SavedQuery>,
5472
5473 /// Required. The list of fields to update.
5474 pub update_mask: std::option::Option<wkt::FieldMask>,
5475
5476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5477}
5478
5479impl UpdateSavedQueryRequest {
5480 pub fn new() -> Self {
5481 std::default::Default::default()
5482 }
5483
5484 /// Sets the value of [saved_query][crate::model::UpdateSavedQueryRequest::saved_query].
5485 ///
5486 /// # Example
5487 /// ```ignore,no_run
5488 /// # use google_cloud_asset_v1::model::UpdateSavedQueryRequest;
5489 /// use google_cloud_asset_v1::model::SavedQuery;
5490 /// let x = UpdateSavedQueryRequest::new().set_saved_query(SavedQuery::default()/* use setters */);
5491 /// ```
5492 pub fn set_saved_query<T>(mut self, v: T) -> Self
5493 where
5494 T: std::convert::Into<crate::model::SavedQuery>,
5495 {
5496 self.saved_query = std::option::Option::Some(v.into());
5497 self
5498 }
5499
5500 /// Sets or clears the value of [saved_query][crate::model::UpdateSavedQueryRequest::saved_query].
5501 ///
5502 /// # Example
5503 /// ```ignore,no_run
5504 /// # use google_cloud_asset_v1::model::UpdateSavedQueryRequest;
5505 /// use google_cloud_asset_v1::model::SavedQuery;
5506 /// let x = UpdateSavedQueryRequest::new().set_or_clear_saved_query(Some(SavedQuery::default()/* use setters */));
5507 /// let x = UpdateSavedQueryRequest::new().set_or_clear_saved_query(None::<SavedQuery>);
5508 /// ```
5509 pub fn set_or_clear_saved_query<T>(mut self, v: std::option::Option<T>) -> Self
5510 where
5511 T: std::convert::Into<crate::model::SavedQuery>,
5512 {
5513 self.saved_query = v.map(|x| x.into());
5514 self
5515 }
5516
5517 /// Sets the value of [update_mask][crate::model::UpdateSavedQueryRequest::update_mask].
5518 ///
5519 /// # Example
5520 /// ```ignore,no_run
5521 /// # use google_cloud_asset_v1::model::UpdateSavedQueryRequest;
5522 /// use wkt::FieldMask;
5523 /// let x = UpdateSavedQueryRequest::new().set_update_mask(FieldMask::default()/* use setters */);
5524 /// ```
5525 pub fn set_update_mask<T>(mut self, v: T) -> Self
5526 where
5527 T: std::convert::Into<wkt::FieldMask>,
5528 {
5529 self.update_mask = std::option::Option::Some(v.into());
5530 self
5531 }
5532
5533 /// Sets or clears the value of [update_mask][crate::model::UpdateSavedQueryRequest::update_mask].
5534 ///
5535 /// # Example
5536 /// ```ignore,no_run
5537 /// # use google_cloud_asset_v1::model::UpdateSavedQueryRequest;
5538 /// use wkt::FieldMask;
5539 /// let x = UpdateSavedQueryRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
5540 /// let x = UpdateSavedQueryRequest::new().set_or_clear_update_mask(None::<FieldMask>);
5541 /// ```
5542 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5543 where
5544 T: std::convert::Into<wkt::FieldMask>,
5545 {
5546 self.update_mask = v.map(|x| x.into());
5547 self
5548 }
5549}
5550
5551impl wkt::message::Message for UpdateSavedQueryRequest {
5552 fn typename() -> &'static str {
5553 "type.googleapis.com/google.cloud.asset.v1.UpdateSavedQueryRequest"
5554 }
5555}
5556
5557/// Request to delete a saved query.
5558#[derive(Clone, Default, PartialEq)]
5559#[non_exhaustive]
5560pub struct DeleteSavedQueryRequest {
5561 /// Required. The name of the saved query to delete. It must be in the format
5562 /// of:
5563 ///
5564 /// * projects/project_number/savedQueries/saved_query_id
5565 /// * folders/folder_number/savedQueries/saved_query_id
5566 /// * organizations/organization_number/savedQueries/saved_query_id
5567 pub name: std::string::String,
5568
5569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5570}
5571
5572impl DeleteSavedQueryRequest {
5573 pub fn new() -> Self {
5574 std::default::Default::default()
5575 }
5576
5577 /// Sets the value of [name][crate::model::DeleteSavedQueryRequest::name].
5578 ///
5579 /// # Example
5580 /// ```ignore,no_run
5581 /// # use google_cloud_asset_v1::model::DeleteSavedQueryRequest;
5582 /// let x = DeleteSavedQueryRequest::new().set_name("example");
5583 /// ```
5584 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5585 self.name = v.into();
5586 self
5587 }
5588}
5589
5590impl wkt::message::Message for DeleteSavedQueryRequest {
5591 fn typename() -> &'static str {
5592 "type.googleapis.com/google.cloud.asset.v1.DeleteSavedQueryRequest"
5593 }
5594}
5595
5596/// The request message for performing resource move analysis.
5597#[derive(Clone, Default, PartialEq)]
5598#[non_exhaustive]
5599pub struct AnalyzeMoveRequest {
5600 /// Required. Name of the resource to perform the analysis against.
5601 /// Only Google Cloud projects are supported as of today. Hence, this can only
5602 /// be a project ID (such as "projects/my-project-id") or a project number
5603 /// (such as "projects/12345").
5604 pub resource: std::string::String,
5605
5606 /// Required. Name of the Google Cloud folder or organization to reparent the
5607 /// target resource. The analysis will be performed against hypothetically
5608 /// moving the resource to this specified destination parent. This can only be
5609 /// a folder number (such as "folders/123") or an organization number (such as
5610 /// "organizations/123").
5611 pub destination_parent: std::string::String,
5612
5613 /// Analysis view indicating what information should be included in the
5614 /// analysis response. If unspecified, the default view is FULL.
5615 pub view: crate::model::analyze_move_request::AnalysisView,
5616
5617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5618}
5619
5620impl AnalyzeMoveRequest {
5621 pub fn new() -> Self {
5622 std::default::Default::default()
5623 }
5624
5625 /// Sets the value of [resource][crate::model::AnalyzeMoveRequest::resource].
5626 ///
5627 /// # Example
5628 /// ```ignore,no_run
5629 /// # use google_cloud_asset_v1::model::AnalyzeMoveRequest;
5630 /// let x = AnalyzeMoveRequest::new().set_resource("example");
5631 /// ```
5632 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5633 self.resource = v.into();
5634 self
5635 }
5636
5637 /// Sets the value of [destination_parent][crate::model::AnalyzeMoveRequest::destination_parent].
5638 ///
5639 /// # Example
5640 /// ```ignore,no_run
5641 /// # use google_cloud_asset_v1::model::AnalyzeMoveRequest;
5642 /// let x = AnalyzeMoveRequest::new().set_destination_parent("example");
5643 /// ```
5644 pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
5645 mut self,
5646 v: T,
5647 ) -> Self {
5648 self.destination_parent = v.into();
5649 self
5650 }
5651
5652 /// Sets the value of [view][crate::model::AnalyzeMoveRequest::view].
5653 ///
5654 /// # Example
5655 /// ```ignore,no_run
5656 /// # use google_cloud_asset_v1::model::AnalyzeMoveRequest;
5657 /// use google_cloud_asset_v1::model::analyze_move_request::AnalysisView;
5658 /// let x0 = AnalyzeMoveRequest::new().set_view(AnalysisView::Full);
5659 /// let x1 = AnalyzeMoveRequest::new().set_view(AnalysisView::Basic);
5660 /// ```
5661 pub fn set_view<T: std::convert::Into<crate::model::analyze_move_request::AnalysisView>>(
5662 mut self,
5663 v: T,
5664 ) -> Self {
5665 self.view = v.into();
5666 self
5667 }
5668}
5669
5670impl wkt::message::Message for AnalyzeMoveRequest {
5671 fn typename() -> &'static str {
5672 "type.googleapis.com/google.cloud.asset.v1.AnalyzeMoveRequest"
5673 }
5674}
5675
5676/// Defines additional types related to [AnalyzeMoveRequest].
5677pub mod analyze_move_request {
5678 #[allow(unused_imports)]
5679 use super::*;
5680
5681 /// View enum for supporting partial analysis responses.
5682 ///
5683 /// # Working with unknown values
5684 ///
5685 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5686 /// additional enum variants at any time. Adding new variants is not considered
5687 /// a breaking change. Applications should write their code in anticipation of:
5688 ///
5689 /// - New values appearing in future releases of the client library, **and**
5690 /// - New values received dynamically, without application changes.
5691 ///
5692 /// Please consult the [Working with enums] section in the user guide for some
5693 /// guidelines.
5694 ///
5695 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5696 #[derive(Clone, Debug, PartialEq)]
5697 #[non_exhaustive]
5698 pub enum AnalysisView {
5699 /// The default/unset value.
5700 /// The API will default to the FULL view.
5701 Unspecified,
5702 /// Full analysis including all level of impacts of the specified resource
5703 /// move.
5704 Full,
5705 /// Basic analysis only including blockers which will prevent the specified
5706 /// resource move at runtime.
5707 Basic,
5708 /// If set, the enum was initialized with an unknown value.
5709 ///
5710 /// Applications can examine the value using [AnalysisView::value] or
5711 /// [AnalysisView::name].
5712 UnknownValue(analysis_view::UnknownValue),
5713 }
5714
5715 #[doc(hidden)]
5716 pub mod analysis_view {
5717 #[allow(unused_imports)]
5718 use super::*;
5719 #[derive(Clone, Debug, PartialEq)]
5720 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5721 }
5722
5723 impl AnalysisView {
5724 /// Gets the enum value.
5725 ///
5726 /// Returns `None` if the enum contains an unknown value deserialized from
5727 /// the string representation of enums.
5728 pub fn value(&self) -> std::option::Option<i32> {
5729 match self {
5730 Self::Unspecified => std::option::Option::Some(0),
5731 Self::Full => std::option::Option::Some(1),
5732 Self::Basic => std::option::Option::Some(2),
5733 Self::UnknownValue(u) => u.0.value(),
5734 }
5735 }
5736
5737 /// Gets the enum value as a string.
5738 ///
5739 /// Returns `None` if the enum contains an unknown value deserialized from
5740 /// the integer representation of enums.
5741 pub fn name(&self) -> std::option::Option<&str> {
5742 match self {
5743 Self::Unspecified => std::option::Option::Some("ANALYSIS_VIEW_UNSPECIFIED"),
5744 Self::Full => std::option::Option::Some("FULL"),
5745 Self::Basic => std::option::Option::Some("BASIC"),
5746 Self::UnknownValue(u) => u.0.name(),
5747 }
5748 }
5749 }
5750
5751 impl std::default::Default for AnalysisView {
5752 fn default() -> Self {
5753 use std::convert::From;
5754 Self::from(0)
5755 }
5756 }
5757
5758 impl std::fmt::Display for AnalysisView {
5759 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5760 wkt::internal::display_enum(f, self.name(), self.value())
5761 }
5762 }
5763
5764 impl std::convert::From<i32> for AnalysisView {
5765 fn from(value: i32) -> Self {
5766 match value {
5767 0 => Self::Unspecified,
5768 1 => Self::Full,
5769 2 => Self::Basic,
5770 _ => Self::UnknownValue(analysis_view::UnknownValue(
5771 wkt::internal::UnknownEnumValue::Integer(value),
5772 )),
5773 }
5774 }
5775 }
5776
5777 impl std::convert::From<&str> for AnalysisView {
5778 fn from(value: &str) -> Self {
5779 use std::string::ToString;
5780 match value {
5781 "ANALYSIS_VIEW_UNSPECIFIED" => Self::Unspecified,
5782 "FULL" => Self::Full,
5783 "BASIC" => Self::Basic,
5784 _ => Self::UnknownValue(analysis_view::UnknownValue(
5785 wkt::internal::UnknownEnumValue::String(value.to_string()),
5786 )),
5787 }
5788 }
5789 }
5790
5791 impl serde::ser::Serialize for AnalysisView {
5792 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5793 where
5794 S: serde::Serializer,
5795 {
5796 match self {
5797 Self::Unspecified => serializer.serialize_i32(0),
5798 Self::Full => serializer.serialize_i32(1),
5799 Self::Basic => serializer.serialize_i32(2),
5800 Self::UnknownValue(u) => u.0.serialize(serializer),
5801 }
5802 }
5803 }
5804
5805 impl<'de> serde::de::Deserialize<'de> for AnalysisView {
5806 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5807 where
5808 D: serde::Deserializer<'de>,
5809 {
5810 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnalysisView>::new(
5811 ".google.cloud.asset.v1.AnalyzeMoveRequest.AnalysisView",
5812 ))
5813 }
5814 }
5815}
5816
5817/// The response message for resource move analysis.
5818#[derive(Clone, Default, PartialEq)]
5819#[non_exhaustive]
5820pub struct AnalyzeMoveResponse {
5821 /// The list of analyses returned from performing the intended resource move
5822 /// analysis. The analysis is grouped by different Google Cloud services.
5823 pub move_analysis: std::vec::Vec<crate::model::MoveAnalysis>,
5824
5825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5826}
5827
5828impl AnalyzeMoveResponse {
5829 pub fn new() -> Self {
5830 std::default::Default::default()
5831 }
5832
5833 /// Sets the value of [move_analysis][crate::model::AnalyzeMoveResponse::move_analysis].
5834 ///
5835 /// # Example
5836 /// ```ignore,no_run
5837 /// # use google_cloud_asset_v1::model::AnalyzeMoveResponse;
5838 /// use google_cloud_asset_v1::model::MoveAnalysis;
5839 /// let x = AnalyzeMoveResponse::new()
5840 /// .set_move_analysis([
5841 /// MoveAnalysis::default()/* use setters */,
5842 /// MoveAnalysis::default()/* use (different) setters */,
5843 /// ]);
5844 /// ```
5845 pub fn set_move_analysis<T, V>(mut self, v: T) -> Self
5846 where
5847 T: std::iter::IntoIterator<Item = V>,
5848 V: std::convert::Into<crate::model::MoveAnalysis>,
5849 {
5850 use std::iter::Iterator;
5851 self.move_analysis = v.into_iter().map(|i| i.into()).collect();
5852 self
5853 }
5854}
5855
5856impl wkt::message::Message for AnalyzeMoveResponse {
5857 fn typename() -> &'static str {
5858 "type.googleapis.com/google.cloud.asset.v1.AnalyzeMoveResponse"
5859 }
5860}
5861
5862/// A message to group the analysis information.
5863#[derive(Clone, Default, PartialEq)]
5864#[non_exhaustive]
5865pub struct MoveAnalysis {
5866 /// The user friendly display name of the analysis. E.g. IAM, organization
5867 /// policy etc.
5868 pub display_name: std::string::String,
5869
5870 pub result: std::option::Option<crate::model::move_analysis::Result>,
5871
5872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5873}
5874
5875impl MoveAnalysis {
5876 pub fn new() -> Self {
5877 std::default::Default::default()
5878 }
5879
5880 /// Sets the value of [display_name][crate::model::MoveAnalysis::display_name].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_asset_v1::model::MoveAnalysis;
5885 /// let x = MoveAnalysis::new().set_display_name("example");
5886 /// ```
5887 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5888 self.display_name = v.into();
5889 self
5890 }
5891
5892 /// Sets the value of [result][crate::model::MoveAnalysis::result].
5893 ///
5894 /// Note that all the setters affecting `result` are mutually
5895 /// exclusive.
5896 ///
5897 /// # Example
5898 /// ```ignore,no_run
5899 /// # use google_cloud_asset_v1::model::MoveAnalysis;
5900 /// use google_cloud_asset_v1::model::MoveAnalysisResult;
5901 /// let x = MoveAnalysis::new().set_result(Some(
5902 /// google_cloud_asset_v1::model::move_analysis::Result::Analysis(MoveAnalysisResult::default().into())));
5903 /// ```
5904 pub fn set_result<
5905 T: std::convert::Into<std::option::Option<crate::model::move_analysis::Result>>,
5906 >(
5907 mut self,
5908 v: T,
5909 ) -> Self {
5910 self.result = v.into();
5911 self
5912 }
5913
5914 /// The value of [result][crate::model::MoveAnalysis::result]
5915 /// if it holds a `Analysis`, `None` if the field is not set or
5916 /// holds a different branch.
5917 pub fn analysis(
5918 &self,
5919 ) -> std::option::Option<&std::boxed::Box<crate::model::MoveAnalysisResult>> {
5920 #[allow(unreachable_patterns)]
5921 self.result.as_ref().and_then(|v| match v {
5922 crate::model::move_analysis::Result::Analysis(v) => std::option::Option::Some(v),
5923 _ => std::option::Option::None,
5924 })
5925 }
5926
5927 /// Sets the value of [result][crate::model::MoveAnalysis::result]
5928 /// to hold a `Analysis`.
5929 ///
5930 /// Note that all the setters affecting `result` are
5931 /// mutually exclusive.
5932 ///
5933 /// # Example
5934 /// ```ignore,no_run
5935 /// # use google_cloud_asset_v1::model::MoveAnalysis;
5936 /// use google_cloud_asset_v1::model::MoveAnalysisResult;
5937 /// let x = MoveAnalysis::new().set_analysis(MoveAnalysisResult::default()/* use setters */);
5938 /// assert!(x.analysis().is_some());
5939 /// assert!(x.error().is_none());
5940 /// ```
5941 pub fn set_analysis<
5942 T: std::convert::Into<std::boxed::Box<crate::model::MoveAnalysisResult>>,
5943 >(
5944 mut self,
5945 v: T,
5946 ) -> Self {
5947 self.result =
5948 std::option::Option::Some(crate::model::move_analysis::Result::Analysis(v.into()));
5949 self
5950 }
5951
5952 /// The value of [result][crate::model::MoveAnalysis::result]
5953 /// if it holds a `Error`, `None` if the field is not set or
5954 /// holds a different branch.
5955 pub fn error(&self) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>> {
5956 #[allow(unreachable_patterns)]
5957 self.result.as_ref().and_then(|v| match v {
5958 crate::model::move_analysis::Result::Error(v) => std::option::Option::Some(v),
5959 _ => std::option::Option::None,
5960 })
5961 }
5962
5963 /// Sets the value of [result][crate::model::MoveAnalysis::result]
5964 /// to hold a `Error`.
5965 ///
5966 /// Note that all the setters affecting `result` are
5967 /// mutually exclusive.
5968 ///
5969 /// # Example
5970 /// ```ignore,no_run
5971 /// # use google_cloud_asset_v1::model::MoveAnalysis;
5972 /// use google_cloud_rpc::model::Status;
5973 /// let x = MoveAnalysis::new().set_error(Status::default()/* use setters */);
5974 /// assert!(x.error().is_some());
5975 /// assert!(x.analysis().is_none());
5976 /// ```
5977 pub fn set_error<T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>>(
5978 mut self,
5979 v: T,
5980 ) -> Self {
5981 self.result =
5982 std::option::Option::Some(crate::model::move_analysis::Result::Error(v.into()));
5983 self
5984 }
5985}
5986
5987impl wkt::message::Message for MoveAnalysis {
5988 fn typename() -> &'static str {
5989 "type.googleapis.com/google.cloud.asset.v1.MoveAnalysis"
5990 }
5991}
5992
5993/// Defines additional types related to [MoveAnalysis].
5994pub mod move_analysis {
5995 #[allow(unused_imports)]
5996 use super::*;
5997
5998 #[derive(Clone, Debug, PartialEq)]
5999 #[non_exhaustive]
6000 pub enum Result {
6001 /// Analysis result of moving the target resource.
6002 Analysis(std::boxed::Box<crate::model::MoveAnalysisResult>),
6003 /// Description of error encountered when performing the analysis.
6004 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
6005 }
6006}
6007
6008/// An analysis result including blockers and warnings.
6009#[derive(Clone, Default, PartialEq)]
6010#[non_exhaustive]
6011pub struct MoveAnalysisResult {
6012 /// Blocking information that would prevent the target resource from moving
6013 /// to the specified destination at runtime.
6014 pub blockers: std::vec::Vec<crate::model::MoveImpact>,
6015
6016 /// Warning information indicating that moving the target resource to the
6017 /// specified destination might be unsafe. This can include important policy
6018 /// information and configuration changes, but will not block moves at runtime.
6019 pub warnings: std::vec::Vec<crate::model::MoveImpact>,
6020
6021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6022}
6023
6024impl MoveAnalysisResult {
6025 pub fn new() -> Self {
6026 std::default::Default::default()
6027 }
6028
6029 /// Sets the value of [blockers][crate::model::MoveAnalysisResult::blockers].
6030 ///
6031 /// # Example
6032 /// ```ignore,no_run
6033 /// # use google_cloud_asset_v1::model::MoveAnalysisResult;
6034 /// use google_cloud_asset_v1::model::MoveImpact;
6035 /// let x = MoveAnalysisResult::new()
6036 /// .set_blockers([
6037 /// MoveImpact::default()/* use setters */,
6038 /// MoveImpact::default()/* use (different) setters */,
6039 /// ]);
6040 /// ```
6041 pub fn set_blockers<T, V>(mut self, v: T) -> Self
6042 where
6043 T: std::iter::IntoIterator<Item = V>,
6044 V: std::convert::Into<crate::model::MoveImpact>,
6045 {
6046 use std::iter::Iterator;
6047 self.blockers = v.into_iter().map(|i| i.into()).collect();
6048 self
6049 }
6050
6051 /// Sets the value of [warnings][crate::model::MoveAnalysisResult::warnings].
6052 ///
6053 /// # Example
6054 /// ```ignore,no_run
6055 /// # use google_cloud_asset_v1::model::MoveAnalysisResult;
6056 /// use google_cloud_asset_v1::model::MoveImpact;
6057 /// let x = MoveAnalysisResult::new()
6058 /// .set_warnings([
6059 /// MoveImpact::default()/* use setters */,
6060 /// MoveImpact::default()/* use (different) setters */,
6061 /// ]);
6062 /// ```
6063 pub fn set_warnings<T, V>(mut self, v: T) -> Self
6064 where
6065 T: std::iter::IntoIterator<Item = V>,
6066 V: std::convert::Into<crate::model::MoveImpact>,
6067 {
6068 use std::iter::Iterator;
6069 self.warnings = v.into_iter().map(|i| i.into()).collect();
6070 self
6071 }
6072}
6073
6074impl wkt::message::Message for MoveAnalysisResult {
6075 fn typename() -> &'static str {
6076 "type.googleapis.com/google.cloud.asset.v1.MoveAnalysisResult"
6077 }
6078}
6079
6080/// A message to group impacts of moving the target resource.
6081#[derive(Clone, Default, PartialEq)]
6082#[non_exhaustive]
6083pub struct MoveImpact {
6084 /// User friendly impact detail in a free form message.
6085 pub detail: std::string::String,
6086
6087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6088}
6089
6090impl MoveImpact {
6091 pub fn new() -> Self {
6092 std::default::Default::default()
6093 }
6094
6095 /// Sets the value of [detail][crate::model::MoveImpact::detail].
6096 ///
6097 /// # Example
6098 /// ```ignore,no_run
6099 /// # use google_cloud_asset_v1::model::MoveImpact;
6100 /// let x = MoveImpact::new().set_detail("example");
6101 /// ```
6102 pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6103 self.detail = v.into();
6104 self
6105 }
6106}
6107
6108impl wkt::message::Message for MoveImpact {
6109 fn typename() -> &'static str {
6110 "type.googleapis.com/google.cloud.asset.v1.MoveImpact"
6111 }
6112}
6113
6114/// Output configuration query assets.
6115#[derive(Clone, Default, PartialEq)]
6116#[non_exhaustive]
6117pub struct QueryAssetsOutputConfig {
6118 /// BigQuery destination where the query results will be saved.
6119 pub bigquery_destination:
6120 std::option::Option<crate::model::query_assets_output_config::BigQueryDestination>,
6121
6122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6123}
6124
6125impl QueryAssetsOutputConfig {
6126 pub fn new() -> Self {
6127 std::default::Default::default()
6128 }
6129
6130 /// Sets the value of [bigquery_destination][crate::model::QueryAssetsOutputConfig::bigquery_destination].
6131 ///
6132 /// # Example
6133 /// ```ignore,no_run
6134 /// # use google_cloud_asset_v1::model::QueryAssetsOutputConfig;
6135 /// use google_cloud_asset_v1::model::query_assets_output_config::BigQueryDestination;
6136 /// let x = QueryAssetsOutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
6137 /// ```
6138 pub fn set_bigquery_destination<T>(mut self, v: T) -> Self
6139 where
6140 T: std::convert::Into<crate::model::query_assets_output_config::BigQueryDestination>,
6141 {
6142 self.bigquery_destination = std::option::Option::Some(v.into());
6143 self
6144 }
6145
6146 /// Sets or clears the value of [bigquery_destination][crate::model::QueryAssetsOutputConfig::bigquery_destination].
6147 ///
6148 /// # Example
6149 /// ```ignore,no_run
6150 /// # use google_cloud_asset_v1::model::QueryAssetsOutputConfig;
6151 /// use google_cloud_asset_v1::model::query_assets_output_config::BigQueryDestination;
6152 /// let x = QueryAssetsOutputConfig::new().set_or_clear_bigquery_destination(Some(BigQueryDestination::default()/* use setters */));
6153 /// let x = QueryAssetsOutputConfig::new().set_or_clear_bigquery_destination(None::<BigQueryDestination>);
6154 /// ```
6155 pub fn set_or_clear_bigquery_destination<T>(mut self, v: std::option::Option<T>) -> Self
6156 where
6157 T: std::convert::Into<crate::model::query_assets_output_config::BigQueryDestination>,
6158 {
6159 self.bigquery_destination = v.map(|x| x.into());
6160 self
6161 }
6162}
6163
6164impl wkt::message::Message for QueryAssetsOutputConfig {
6165 fn typename() -> &'static str {
6166 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsOutputConfig"
6167 }
6168}
6169
6170/// Defines additional types related to [QueryAssetsOutputConfig].
6171pub mod query_assets_output_config {
6172 #[allow(unused_imports)]
6173 use super::*;
6174
6175 /// BigQuery destination.
6176 #[derive(Clone, Default, PartialEq)]
6177 #[non_exhaustive]
6178 pub struct BigQueryDestination {
6179 /// Required. The BigQuery dataset where the query results will be saved. It
6180 /// has the format of "projects/{projectId}/datasets/{datasetId}".
6181 pub dataset: std::string::String,
6182
6183 /// Required. The BigQuery table where the query results will be saved. If
6184 /// this table does not exist, a new table with the given name will be
6185 /// created.
6186 pub table: std::string::String,
6187
6188 /// Specifies the action that occurs if the destination table or partition
6189 /// already exists. The following values are supported:
6190 ///
6191 /// * WRITE_TRUNCATE: If the table or partition already exists, BigQuery
6192 /// overwrites the entire table or all the partitions data.
6193 /// * WRITE_APPEND: If the table or partition already exists, BigQuery
6194 /// appends the data to the table or the latest partition.
6195 /// * WRITE_EMPTY: If the table already exists and contains data, a
6196 /// 'duplicate' error is returned in the job result.
6197 ///
6198 /// The default value is WRITE_EMPTY.
6199 pub write_disposition: std::string::String,
6200
6201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6202 }
6203
6204 impl BigQueryDestination {
6205 pub fn new() -> Self {
6206 std::default::Default::default()
6207 }
6208
6209 /// Sets the value of [dataset][crate::model::query_assets_output_config::BigQueryDestination::dataset].
6210 ///
6211 /// # Example
6212 /// ```ignore,no_run
6213 /// # use google_cloud_asset_v1::model::query_assets_output_config::BigQueryDestination;
6214 /// let x = BigQueryDestination::new().set_dataset("example");
6215 /// ```
6216 pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6217 self.dataset = v.into();
6218 self
6219 }
6220
6221 /// Sets the value of [table][crate::model::query_assets_output_config::BigQueryDestination::table].
6222 ///
6223 /// # Example
6224 /// ```ignore,no_run
6225 /// # use google_cloud_asset_v1::model::query_assets_output_config::BigQueryDestination;
6226 /// let x = BigQueryDestination::new().set_table("example");
6227 /// ```
6228 pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6229 self.table = v.into();
6230 self
6231 }
6232
6233 /// Sets the value of [write_disposition][crate::model::query_assets_output_config::BigQueryDestination::write_disposition].
6234 ///
6235 /// # Example
6236 /// ```ignore,no_run
6237 /// # use google_cloud_asset_v1::model::query_assets_output_config::BigQueryDestination;
6238 /// let x = BigQueryDestination::new().set_write_disposition("example");
6239 /// ```
6240 pub fn set_write_disposition<T: std::convert::Into<std::string::String>>(
6241 mut self,
6242 v: T,
6243 ) -> Self {
6244 self.write_disposition = v.into();
6245 self
6246 }
6247 }
6248
6249 impl wkt::message::Message for BigQueryDestination {
6250 fn typename() -> &'static str {
6251 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsOutputConfig.BigQueryDestination"
6252 }
6253 }
6254}
6255
6256/// QueryAssets request.
6257#[derive(Clone, Default, PartialEq)]
6258#[non_exhaustive]
6259pub struct QueryAssetsRequest {
6260 /// Required. The relative name of the root asset. This can only be an
6261 /// organization number (such as "organizations/123"), a project ID (such as
6262 /// "projects/my-project-id"), or a project number (such as "projects/12345"),
6263 /// or a folder number (such as "folders/123").
6264 ///
6265 /// Only assets belonging to the `parent` will be returned.
6266 pub parent: std::string::String,
6267
6268 /// Optional. The maximum number of rows to return in the results. Responses
6269 /// are limited to 10 MB and 1000 rows.
6270 ///
6271 /// By default, the maximum row count is 1000. When the byte or row count limit
6272 /// is reached, the rest of the query results will be paginated.
6273 ///
6274 /// The field will be ignored when [output_config] is specified.
6275 pub page_size: i32,
6276
6277 /// Optional. A page token received from previous `QueryAssets`.
6278 ///
6279 /// The field will be ignored when [output_config] is specified.
6280 pub page_token: std::string::String,
6281
6282 /// Optional. Specifies the maximum amount of time that the client is willing
6283 /// to wait for the query to complete. By default, this limit is 5 min for the
6284 /// first query, and 1 minute for the following queries. If the query is
6285 /// complete, the `done` field in the `QueryAssetsResponse` is true, otherwise
6286 /// false.
6287 ///
6288 /// Like BigQuery [jobs.query
6289 /// API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest)
6290 /// The call is not guaranteed to wait for the specified timeout; it typically
6291 /// returns after around 200 seconds (200,000 milliseconds), even if the query
6292 /// is not complete.
6293 ///
6294 /// The field will be ignored when [output_config] is specified.
6295 pub timeout: std::option::Option<wkt::Duration>,
6296
6297 /// Optional. Destination where the query results will be saved.
6298 ///
6299 /// When this field is specified, the query results won't be saved in the
6300 /// [QueryAssetsResponse.query_result]. Instead
6301 /// [QueryAssetsResponse.output_config] will be set.
6302 ///
6303 /// Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used
6304 /// to check the status of the query job when passed to a following
6305 /// [QueryAssets] API call.
6306 pub output_config: std::option::Option<crate::model::QueryAssetsOutputConfig>,
6307
6308 pub query: std::option::Option<crate::model::query_assets_request::Query>,
6309
6310 /// Specifies what time period or point in time to query asset metadata at.
6311 ///
6312 /// * unset - query asset metadata as it is right now
6313 /// * [read_time_window] - query asset metadata as it was at any point in time
6314 /// between [start_time] and [end_time].
6315 /// * [read_time] - query asset metadata as it was at that point in time.
6316 /// If data for the timestamp/date range selected does not exist,
6317 /// it will simply return a valid response with no rows.
6318 pub time: std::option::Option<crate::model::query_assets_request::Time>,
6319
6320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6321}
6322
6323impl QueryAssetsRequest {
6324 pub fn new() -> Self {
6325 std::default::Default::default()
6326 }
6327
6328 /// Sets the value of [parent][crate::model::QueryAssetsRequest::parent].
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6333 /// let x = QueryAssetsRequest::new().set_parent("example");
6334 /// ```
6335 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6336 self.parent = v.into();
6337 self
6338 }
6339
6340 /// Sets the value of [page_size][crate::model::QueryAssetsRequest::page_size].
6341 ///
6342 /// # Example
6343 /// ```ignore,no_run
6344 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6345 /// let x = QueryAssetsRequest::new().set_page_size(42);
6346 /// ```
6347 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6348 self.page_size = v.into();
6349 self
6350 }
6351
6352 /// Sets the value of [page_token][crate::model::QueryAssetsRequest::page_token].
6353 ///
6354 /// # Example
6355 /// ```ignore,no_run
6356 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6357 /// let x = QueryAssetsRequest::new().set_page_token("example");
6358 /// ```
6359 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6360 self.page_token = v.into();
6361 self
6362 }
6363
6364 /// Sets the value of [timeout][crate::model::QueryAssetsRequest::timeout].
6365 ///
6366 /// # Example
6367 /// ```ignore,no_run
6368 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6369 /// use wkt::Duration;
6370 /// let x = QueryAssetsRequest::new().set_timeout(Duration::default()/* use setters */);
6371 /// ```
6372 pub fn set_timeout<T>(mut self, v: T) -> Self
6373 where
6374 T: std::convert::Into<wkt::Duration>,
6375 {
6376 self.timeout = std::option::Option::Some(v.into());
6377 self
6378 }
6379
6380 /// Sets or clears the value of [timeout][crate::model::QueryAssetsRequest::timeout].
6381 ///
6382 /// # Example
6383 /// ```ignore,no_run
6384 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6385 /// use wkt::Duration;
6386 /// let x = QueryAssetsRequest::new().set_or_clear_timeout(Some(Duration::default()/* use setters */));
6387 /// let x = QueryAssetsRequest::new().set_or_clear_timeout(None::<Duration>);
6388 /// ```
6389 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6390 where
6391 T: std::convert::Into<wkt::Duration>,
6392 {
6393 self.timeout = v.map(|x| x.into());
6394 self
6395 }
6396
6397 /// Sets the value of [output_config][crate::model::QueryAssetsRequest::output_config].
6398 ///
6399 /// # Example
6400 /// ```ignore,no_run
6401 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6402 /// use google_cloud_asset_v1::model::QueryAssetsOutputConfig;
6403 /// let x = QueryAssetsRequest::new().set_output_config(QueryAssetsOutputConfig::default()/* use setters */);
6404 /// ```
6405 pub fn set_output_config<T>(mut self, v: T) -> Self
6406 where
6407 T: std::convert::Into<crate::model::QueryAssetsOutputConfig>,
6408 {
6409 self.output_config = std::option::Option::Some(v.into());
6410 self
6411 }
6412
6413 /// Sets or clears the value of [output_config][crate::model::QueryAssetsRequest::output_config].
6414 ///
6415 /// # Example
6416 /// ```ignore,no_run
6417 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6418 /// use google_cloud_asset_v1::model::QueryAssetsOutputConfig;
6419 /// let x = QueryAssetsRequest::new().set_or_clear_output_config(Some(QueryAssetsOutputConfig::default()/* use setters */));
6420 /// let x = QueryAssetsRequest::new().set_or_clear_output_config(None::<QueryAssetsOutputConfig>);
6421 /// ```
6422 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
6423 where
6424 T: std::convert::Into<crate::model::QueryAssetsOutputConfig>,
6425 {
6426 self.output_config = v.map(|x| x.into());
6427 self
6428 }
6429
6430 /// Sets the value of [query][crate::model::QueryAssetsRequest::query].
6431 ///
6432 /// Note that all the setters affecting `query` are mutually
6433 /// exclusive.
6434 ///
6435 /// # Example
6436 /// ```ignore,no_run
6437 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6438 /// use google_cloud_asset_v1::model::query_assets_request::Query;
6439 /// let x = QueryAssetsRequest::new().set_query(Some(Query::Statement("example".to_string())));
6440 /// ```
6441 pub fn set_query<
6442 T: std::convert::Into<std::option::Option<crate::model::query_assets_request::Query>>,
6443 >(
6444 mut self,
6445 v: T,
6446 ) -> Self {
6447 self.query = v.into();
6448 self
6449 }
6450
6451 /// The value of [query][crate::model::QueryAssetsRequest::query]
6452 /// if it holds a `Statement`, `None` if the field is not set or
6453 /// holds a different branch.
6454 pub fn statement(&self) -> std::option::Option<&std::string::String> {
6455 #[allow(unreachable_patterns)]
6456 self.query.as_ref().and_then(|v| match v {
6457 crate::model::query_assets_request::Query::Statement(v) => std::option::Option::Some(v),
6458 _ => std::option::Option::None,
6459 })
6460 }
6461
6462 /// Sets the value of [query][crate::model::QueryAssetsRequest::query]
6463 /// to hold a `Statement`.
6464 ///
6465 /// Note that all the setters affecting `query` are
6466 /// mutually exclusive.
6467 ///
6468 /// # Example
6469 /// ```ignore,no_run
6470 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6471 /// let x = QueryAssetsRequest::new().set_statement("example");
6472 /// assert!(x.statement().is_some());
6473 /// assert!(x.job_reference().is_none());
6474 /// ```
6475 pub fn set_statement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6476 self.query = std::option::Option::Some(
6477 crate::model::query_assets_request::Query::Statement(v.into()),
6478 );
6479 self
6480 }
6481
6482 /// The value of [query][crate::model::QueryAssetsRequest::query]
6483 /// if it holds a `JobReference`, `None` if the field is not set or
6484 /// holds a different branch.
6485 pub fn job_reference(&self) -> std::option::Option<&std::string::String> {
6486 #[allow(unreachable_patterns)]
6487 self.query.as_ref().and_then(|v| match v {
6488 crate::model::query_assets_request::Query::JobReference(v) => {
6489 std::option::Option::Some(v)
6490 }
6491 _ => std::option::Option::None,
6492 })
6493 }
6494
6495 /// Sets the value of [query][crate::model::QueryAssetsRequest::query]
6496 /// to hold a `JobReference`.
6497 ///
6498 /// Note that all the setters affecting `query` are
6499 /// mutually exclusive.
6500 ///
6501 /// # Example
6502 /// ```ignore,no_run
6503 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6504 /// let x = QueryAssetsRequest::new().set_job_reference("example");
6505 /// assert!(x.job_reference().is_some());
6506 /// assert!(x.statement().is_none());
6507 /// ```
6508 pub fn set_job_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6509 self.query = std::option::Option::Some(
6510 crate::model::query_assets_request::Query::JobReference(v.into()),
6511 );
6512 self
6513 }
6514
6515 /// Sets the value of [time][crate::model::QueryAssetsRequest::time].
6516 ///
6517 /// Note that all the setters affecting `time` are mutually
6518 /// exclusive.
6519 ///
6520 /// # Example
6521 /// ```ignore,no_run
6522 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6523 /// use google_cloud_asset_v1::model::TimeWindow;
6524 /// let x = QueryAssetsRequest::new().set_time(Some(
6525 /// google_cloud_asset_v1::model::query_assets_request::Time::ReadTimeWindow(TimeWindow::default().into())));
6526 /// ```
6527 pub fn set_time<
6528 T: std::convert::Into<std::option::Option<crate::model::query_assets_request::Time>>,
6529 >(
6530 mut self,
6531 v: T,
6532 ) -> Self {
6533 self.time = v.into();
6534 self
6535 }
6536
6537 /// The value of [time][crate::model::QueryAssetsRequest::time]
6538 /// if it holds a `ReadTimeWindow`, `None` if the field is not set or
6539 /// holds a different branch.
6540 pub fn read_time_window(
6541 &self,
6542 ) -> std::option::Option<&std::boxed::Box<crate::model::TimeWindow>> {
6543 #[allow(unreachable_patterns)]
6544 self.time.as_ref().and_then(|v| match v {
6545 crate::model::query_assets_request::Time::ReadTimeWindow(v) => {
6546 std::option::Option::Some(v)
6547 }
6548 _ => std::option::Option::None,
6549 })
6550 }
6551
6552 /// Sets the value of [time][crate::model::QueryAssetsRequest::time]
6553 /// to hold a `ReadTimeWindow`.
6554 ///
6555 /// Note that all the setters affecting `time` are
6556 /// mutually exclusive.
6557 ///
6558 /// # Example
6559 /// ```ignore,no_run
6560 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6561 /// use google_cloud_asset_v1::model::TimeWindow;
6562 /// let x = QueryAssetsRequest::new().set_read_time_window(TimeWindow::default()/* use setters */);
6563 /// assert!(x.read_time_window().is_some());
6564 /// assert!(x.read_time().is_none());
6565 /// ```
6566 pub fn set_read_time_window<
6567 T: std::convert::Into<std::boxed::Box<crate::model::TimeWindow>>,
6568 >(
6569 mut self,
6570 v: T,
6571 ) -> Self {
6572 self.time = std::option::Option::Some(
6573 crate::model::query_assets_request::Time::ReadTimeWindow(v.into()),
6574 );
6575 self
6576 }
6577
6578 /// The value of [time][crate::model::QueryAssetsRequest::time]
6579 /// if it holds a `ReadTime`, `None` if the field is not set or
6580 /// holds a different branch.
6581 pub fn read_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
6582 #[allow(unreachable_patterns)]
6583 self.time.as_ref().and_then(|v| match v {
6584 crate::model::query_assets_request::Time::ReadTime(v) => std::option::Option::Some(v),
6585 _ => std::option::Option::None,
6586 })
6587 }
6588
6589 /// Sets the value of [time][crate::model::QueryAssetsRequest::time]
6590 /// to hold a `ReadTime`.
6591 ///
6592 /// Note that all the setters affecting `time` are
6593 /// mutually exclusive.
6594 ///
6595 /// # Example
6596 /// ```ignore,no_run
6597 /// # use google_cloud_asset_v1::model::QueryAssetsRequest;
6598 /// use wkt::Timestamp;
6599 /// let x = QueryAssetsRequest::new().set_read_time(Timestamp::default()/* use setters */);
6600 /// assert!(x.read_time().is_some());
6601 /// assert!(x.read_time_window().is_none());
6602 /// ```
6603 pub fn set_read_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
6604 mut self,
6605 v: T,
6606 ) -> Self {
6607 self.time =
6608 std::option::Option::Some(crate::model::query_assets_request::Time::ReadTime(v.into()));
6609 self
6610 }
6611}
6612
6613impl wkt::message::Message for QueryAssetsRequest {
6614 fn typename() -> &'static str {
6615 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsRequest"
6616 }
6617}
6618
6619/// Defines additional types related to [QueryAssetsRequest].
6620pub mod query_assets_request {
6621 #[allow(unused_imports)]
6622 use super::*;
6623
6624 #[derive(Clone, Debug, PartialEq)]
6625 #[non_exhaustive]
6626 pub enum Query {
6627 /// Optional. A SQL statement that's compatible with [BigQuery
6628 /// SQL](https://cloud.google.com/bigquery/docs/introduction-sql).
6629 Statement(std::string::String),
6630 /// Optional. Reference to the query job, which is from the
6631 /// `QueryAssetsResponse` of previous `QueryAssets` call.
6632 JobReference(std::string::String),
6633 }
6634
6635 /// Specifies what time period or point in time to query asset metadata at.
6636 ///
6637 /// * unset - query asset metadata as it is right now
6638 /// * [read_time_window] - query asset metadata as it was at any point in time
6639 /// between [start_time] and [end_time].
6640 /// * [read_time] - query asset metadata as it was at that point in time.
6641 /// If data for the timestamp/date range selected does not exist,
6642 /// it will simply return a valid response with no rows.
6643 #[derive(Clone, Debug, PartialEq)]
6644 #[non_exhaustive]
6645 pub enum Time {
6646 /// Optional. [start_time] is required. [start_time] must be less than
6647 /// [end_time] Defaults [end_time] to now if [start_time] is set and
6648 /// [end_time] isn't. Maximum permitted time range is 7 days.
6649 ReadTimeWindow(std::boxed::Box<crate::model::TimeWindow>),
6650 /// Optional. Queries cloud assets as they appeared at the specified point in
6651 /// time.
6652 ReadTime(std::boxed::Box<wkt::Timestamp>),
6653 }
6654}
6655
6656/// QueryAssets response.
6657#[derive(Clone, Default, PartialEq)]
6658#[non_exhaustive]
6659pub struct QueryAssetsResponse {
6660 /// Reference to a query job.
6661 pub job_reference: std::string::String,
6662
6663 /// The query response, which can be either an `error` or a valid `response`.
6664 ///
6665 /// If `done` == `false` and the query result is being saved in an output, the
6666 /// output_config field will be set.
6667 /// If `done` == `true`, exactly one of
6668 /// `error`, `query_result` or `output_config` will be set.
6669 /// [done] is unset unless the [QueryAssetsResponse] contains a
6670 /// [QueryAssetsResponse.job_reference].
6671 pub done: bool,
6672
6673 pub response: std::option::Option<crate::model::query_assets_response::Response>,
6674
6675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6676}
6677
6678impl QueryAssetsResponse {
6679 pub fn new() -> Self {
6680 std::default::Default::default()
6681 }
6682
6683 /// Sets the value of [job_reference][crate::model::QueryAssetsResponse::job_reference].
6684 ///
6685 /// # Example
6686 /// ```ignore,no_run
6687 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6688 /// let x = QueryAssetsResponse::new().set_job_reference("example");
6689 /// ```
6690 pub fn set_job_reference<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6691 self.job_reference = v.into();
6692 self
6693 }
6694
6695 /// Sets the value of [done][crate::model::QueryAssetsResponse::done].
6696 ///
6697 /// # Example
6698 /// ```ignore,no_run
6699 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6700 /// let x = QueryAssetsResponse::new().set_done(true);
6701 /// ```
6702 pub fn set_done<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6703 self.done = v.into();
6704 self
6705 }
6706
6707 /// Sets the value of [response][crate::model::QueryAssetsResponse::response].
6708 ///
6709 /// Note that all the setters affecting `response` are mutually
6710 /// exclusive.
6711 ///
6712 /// # Example
6713 /// ```ignore,no_run
6714 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6715 /// use google_cloud_rpc::model::Status;
6716 /// let x = QueryAssetsResponse::new().set_response(Some(
6717 /// google_cloud_asset_v1::model::query_assets_response::Response::Error(Status::default().into())));
6718 /// ```
6719 pub fn set_response<
6720 T: std::convert::Into<std::option::Option<crate::model::query_assets_response::Response>>,
6721 >(
6722 mut self,
6723 v: T,
6724 ) -> Self {
6725 self.response = v.into();
6726 self
6727 }
6728
6729 /// The value of [response][crate::model::QueryAssetsResponse::response]
6730 /// if it holds a `Error`, `None` if the field is not set or
6731 /// holds a different branch.
6732 pub fn error(&self) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>> {
6733 #[allow(unreachable_patterns)]
6734 self.response.as_ref().and_then(|v| match v {
6735 crate::model::query_assets_response::Response::Error(v) => std::option::Option::Some(v),
6736 _ => std::option::Option::None,
6737 })
6738 }
6739
6740 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
6741 /// to hold a `Error`.
6742 ///
6743 /// Note that all the setters affecting `response` are
6744 /// mutually exclusive.
6745 ///
6746 /// # Example
6747 /// ```ignore,no_run
6748 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6749 /// use google_cloud_rpc::model::Status;
6750 /// let x = QueryAssetsResponse::new().set_error(Status::default()/* use setters */);
6751 /// assert!(x.error().is_some());
6752 /// assert!(x.query_result().is_none());
6753 /// assert!(x.output_config().is_none());
6754 /// ```
6755 pub fn set_error<T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>>(
6756 mut self,
6757 v: T,
6758 ) -> Self {
6759 self.response = std::option::Option::Some(
6760 crate::model::query_assets_response::Response::Error(v.into()),
6761 );
6762 self
6763 }
6764
6765 /// The value of [response][crate::model::QueryAssetsResponse::response]
6766 /// if it holds a `QueryResult`, `None` if the field is not set or
6767 /// holds a different branch.
6768 pub fn query_result(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryResult>> {
6769 #[allow(unreachable_patterns)]
6770 self.response.as_ref().and_then(|v| match v {
6771 crate::model::query_assets_response::Response::QueryResult(v) => {
6772 std::option::Option::Some(v)
6773 }
6774 _ => std::option::Option::None,
6775 })
6776 }
6777
6778 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
6779 /// to hold a `QueryResult`.
6780 ///
6781 /// Note that all the setters affecting `response` are
6782 /// mutually exclusive.
6783 ///
6784 /// # Example
6785 /// ```ignore,no_run
6786 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6787 /// use google_cloud_asset_v1::model::QueryResult;
6788 /// let x = QueryAssetsResponse::new().set_query_result(QueryResult::default()/* use setters */);
6789 /// assert!(x.query_result().is_some());
6790 /// assert!(x.error().is_none());
6791 /// assert!(x.output_config().is_none());
6792 /// ```
6793 pub fn set_query_result<T: std::convert::Into<std::boxed::Box<crate::model::QueryResult>>>(
6794 mut self,
6795 v: T,
6796 ) -> Self {
6797 self.response = std::option::Option::Some(
6798 crate::model::query_assets_response::Response::QueryResult(v.into()),
6799 );
6800 self
6801 }
6802
6803 /// The value of [response][crate::model::QueryAssetsResponse::response]
6804 /// if it holds a `OutputConfig`, `None` if the field is not set or
6805 /// holds a different branch.
6806 pub fn output_config(
6807 &self,
6808 ) -> std::option::Option<&std::boxed::Box<crate::model::QueryAssetsOutputConfig>> {
6809 #[allow(unreachable_patterns)]
6810 self.response.as_ref().and_then(|v| match v {
6811 crate::model::query_assets_response::Response::OutputConfig(v) => {
6812 std::option::Option::Some(v)
6813 }
6814 _ => std::option::Option::None,
6815 })
6816 }
6817
6818 /// Sets the value of [response][crate::model::QueryAssetsResponse::response]
6819 /// to hold a `OutputConfig`.
6820 ///
6821 /// Note that all the setters affecting `response` are
6822 /// mutually exclusive.
6823 ///
6824 /// # Example
6825 /// ```ignore,no_run
6826 /// # use google_cloud_asset_v1::model::QueryAssetsResponse;
6827 /// use google_cloud_asset_v1::model::QueryAssetsOutputConfig;
6828 /// let x = QueryAssetsResponse::new().set_output_config(QueryAssetsOutputConfig::default()/* use setters */);
6829 /// assert!(x.output_config().is_some());
6830 /// assert!(x.error().is_none());
6831 /// assert!(x.query_result().is_none());
6832 /// ```
6833 pub fn set_output_config<
6834 T: std::convert::Into<std::boxed::Box<crate::model::QueryAssetsOutputConfig>>,
6835 >(
6836 mut self,
6837 v: T,
6838 ) -> Self {
6839 self.response = std::option::Option::Some(
6840 crate::model::query_assets_response::Response::OutputConfig(v.into()),
6841 );
6842 self
6843 }
6844}
6845
6846impl wkt::message::Message for QueryAssetsResponse {
6847 fn typename() -> &'static str {
6848 "type.googleapis.com/google.cloud.asset.v1.QueryAssetsResponse"
6849 }
6850}
6851
6852/// Defines additional types related to [QueryAssetsResponse].
6853pub mod query_assets_response {
6854 #[allow(unused_imports)]
6855 use super::*;
6856
6857 #[derive(Clone, Debug, PartialEq)]
6858 #[non_exhaustive]
6859 pub enum Response {
6860 /// Error status.
6861 Error(std::boxed::Box<google_cloud_rpc::model::Status>),
6862 /// Result of the query.
6863 QueryResult(std::boxed::Box<crate::model::QueryResult>),
6864 /// Output configuration, which indicates that instead of being returned in
6865 /// an API response on the fly, the query result will be saved in a specific
6866 /// output.
6867 OutputConfig(std::boxed::Box<crate::model::QueryAssetsOutputConfig>),
6868 }
6869}
6870
6871/// Execution results of the query.
6872///
6873/// The result is formatted as rows represented by BigQuery compatible [schema].
6874/// When pagination is necessary, it will contains the page token to retrieve
6875/// the results of following pages.
6876#[derive(Clone, Default, PartialEq)]
6877#[non_exhaustive]
6878pub struct QueryResult {
6879 /// Each row hold a query result in the format of `Struct`.
6880 pub rows: std::vec::Vec<wkt::Struct>,
6881
6882 /// Describes the format of the [rows].
6883 pub schema: std::option::Option<crate::model::TableSchema>,
6884
6885 /// Token to retrieve the next page of the results.
6886 pub next_page_token: std::string::String,
6887
6888 /// Total rows of the whole query results.
6889 pub total_rows: i64,
6890
6891 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6892}
6893
6894impl QueryResult {
6895 pub fn new() -> Self {
6896 std::default::Default::default()
6897 }
6898
6899 /// Sets the value of [rows][crate::model::QueryResult::rows].
6900 ///
6901 /// # Example
6902 /// ```ignore,no_run
6903 /// # use google_cloud_asset_v1::model::QueryResult;
6904 /// use wkt::Struct;
6905 /// let x = QueryResult::new()
6906 /// .set_rows([
6907 /// Struct::default()/* use setters */,
6908 /// Struct::default()/* use (different) setters */,
6909 /// ]);
6910 /// ```
6911 pub fn set_rows<T, V>(mut self, v: T) -> Self
6912 where
6913 T: std::iter::IntoIterator<Item = V>,
6914 V: std::convert::Into<wkt::Struct>,
6915 {
6916 use std::iter::Iterator;
6917 self.rows = v.into_iter().map(|i| i.into()).collect();
6918 self
6919 }
6920
6921 /// Sets the value of [schema][crate::model::QueryResult::schema].
6922 ///
6923 /// # Example
6924 /// ```ignore,no_run
6925 /// # use google_cloud_asset_v1::model::QueryResult;
6926 /// use google_cloud_asset_v1::model::TableSchema;
6927 /// let x = QueryResult::new().set_schema(TableSchema::default()/* use setters */);
6928 /// ```
6929 pub fn set_schema<T>(mut self, v: T) -> Self
6930 where
6931 T: std::convert::Into<crate::model::TableSchema>,
6932 {
6933 self.schema = std::option::Option::Some(v.into());
6934 self
6935 }
6936
6937 /// Sets or clears the value of [schema][crate::model::QueryResult::schema].
6938 ///
6939 /// # Example
6940 /// ```ignore,no_run
6941 /// # use google_cloud_asset_v1::model::QueryResult;
6942 /// use google_cloud_asset_v1::model::TableSchema;
6943 /// let x = QueryResult::new().set_or_clear_schema(Some(TableSchema::default()/* use setters */));
6944 /// let x = QueryResult::new().set_or_clear_schema(None::<TableSchema>);
6945 /// ```
6946 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
6947 where
6948 T: std::convert::Into<crate::model::TableSchema>,
6949 {
6950 self.schema = v.map(|x| x.into());
6951 self
6952 }
6953
6954 /// Sets the value of [next_page_token][crate::model::QueryResult::next_page_token].
6955 ///
6956 /// # Example
6957 /// ```ignore,no_run
6958 /// # use google_cloud_asset_v1::model::QueryResult;
6959 /// let x = QueryResult::new().set_next_page_token("example");
6960 /// ```
6961 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6962 self.next_page_token = v.into();
6963 self
6964 }
6965
6966 /// Sets the value of [total_rows][crate::model::QueryResult::total_rows].
6967 ///
6968 /// # Example
6969 /// ```ignore,no_run
6970 /// # use google_cloud_asset_v1::model::QueryResult;
6971 /// let x = QueryResult::new().set_total_rows(42);
6972 /// ```
6973 pub fn set_total_rows<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
6974 self.total_rows = v.into();
6975 self
6976 }
6977}
6978
6979impl wkt::message::Message for QueryResult {
6980 fn typename() -> &'static str {
6981 "type.googleapis.com/google.cloud.asset.v1.QueryResult"
6982 }
6983}
6984
6985/// BigQuery Compatible table schema.
6986#[derive(Clone, Default, PartialEq)]
6987#[non_exhaustive]
6988pub struct TableSchema {
6989 /// Describes the fields in a table.
6990 pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
6991
6992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6993}
6994
6995impl TableSchema {
6996 pub fn new() -> Self {
6997 std::default::Default::default()
6998 }
6999
7000 /// Sets the value of [fields][crate::model::TableSchema::fields].
7001 ///
7002 /// # Example
7003 /// ```ignore,no_run
7004 /// # use google_cloud_asset_v1::model::TableSchema;
7005 /// use google_cloud_asset_v1::model::TableFieldSchema;
7006 /// let x = TableSchema::new()
7007 /// .set_fields([
7008 /// TableFieldSchema::default()/* use setters */,
7009 /// TableFieldSchema::default()/* use (different) setters */,
7010 /// ]);
7011 /// ```
7012 pub fn set_fields<T, V>(mut self, v: T) -> Self
7013 where
7014 T: std::iter::IntoIterator<Item = V>,
7015 V: std::convert::Into<crate::model::TableFieldSchema>,
7016 {
7017 use std::iter::Iterator;
7018 self.fields = v.into_iter().map(|i| i.into()).collect();
7019 self
7020 }
7021}
7022
7023impl wkt::message::Message for TableSchema {
7024 fn typename() -> &'static str {
7025 "type.googleapis.com/google.cloud.asset.v1.TableSchema"
7026 }
7027}
7028
7029/// A field in TableSchema.
7030#[derive(Clone, Default, PartialEq)]
7031#[non_exhaustive]
7032pub struct TableFieldSchema {
7033 /// The field name. The name must contain only letters (a-z, A-Z),
7034 /// numbers (0-9), or underscores (_), and must start with a letter or
7035 /// underscore. The maximum length is 128 characters.
7036 pub field: std::string::String,
7037
7038 /// The field data type. Possible values include
7039 ///
7040 /// * STRING
7041 /// * BYTES
7042 /// * INTEGER
7043 /// * FLOAT
7044 /// * BOOLEAN
7045 /// * TIMESTAMP
7046 /// * DATE
7047 /// * TIME
7048 /// * DATETIME
7049 /// * GEOGRAPHY,
7050 /// * NUMERIC,
7051 /// * BIGNUMERIC,
7052 /// * RECORD
7053 /// (where RECORD indicates that the field contains a nested schema).
7054 pub r#type: std::string::String,
7055
7056 /// The field mode. Possible values include NULLABLE, REQUIRED and
7057 /// REPEATED. The default value is NULLABLE.
7058 pub mode: std::string::String,
7059
7060 /// Describes the nested schema fields if the type property is set
7061 /// to RECORD.
7062 pub fields: std::vec::Vec<crate::model::TableFieldSchema>,
7063
7064 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7065}
7066
7067impl TableFieldSchema {
7068 pub fn new() -> Self {
7069 std::default::Default::default()
7070 }
7071
7072 /// Sets the value of [field][crate::model::TableFieldSchema::field].
7073 ///
7074 /// # Example
7075 /// ```ignore,no_run
7076 /// # use google_cloud_asset_v1::model::TableFieldSchema;
7077 /// let x = TableFieldSchema::new().set_field("example");
7078 /// ```
7079 pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7080 self.field = v.into();
7081 self
7082 }
7083
7084 /// Sets the value of [r#type][crate::model::TableFieldSchema::type].
7085 ///
7086 /// # Example
7087 /// ```ignore,no_run
7088 /// # use google_cloud_asset_v1::model::TableFieldSchema;
7089 /// let x = TableFieldSchema::new().set_type("example");
7090 /// ```
7091 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7092 self.r#type = v.into();
7093 self
7094 }
7095
7096 /// Sets the value of [mode][crate::model::TableFieldSchema::mode].
7097 ///
7098 /// # Example
7099 /// ```ignore,no_run
7100 /// # use google_cloud_asset_v1::model::TableFieldSchema;
7101 /// let x = TableFieldSchema::new().set_mode("example");
7102 /// ```
7103 pub fn set_mode<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7104 self.mode = v.into();
7105 self
7106 }
7107
7108 /// Sets the value of [fields][crate::model::TableFieldSchema::fields].
7109 ///
7110 /// # Example
7111 /// ```ignore,no_run
7112 /// # use google_cloud_asset_v1::model::TableFieldSchema;
7113 /// let x = TableFieldSchema::new()
7114 /// .set_fields([
7115 /// TableFieldSchema::default()/* use setters */,
7116 /// TableFieldSchema::default()/* use (different) setters */,
7117 /// ]);
7118 /// ```
7119 pub fn set_fields<T, V>(mut self, v: T) -> Self
7120 where
7121 T: std::iter::IntoIterator<Item = V>,
7122 V: std::convert::Into<crate::model::TableFieldSchema>,
7123 {
7124 use std::iter::Iterator;
7125 self.fields = v.into_iter().map(|i| i.into()).collect();
7126 self
7127 }
7128}
7129
7130impl wkt::message::Message for TableFieldSchema {
7131 fn typename() -> &'static str {
7132 "type.googleapis.com/google.cloud.asset.v1.TableFieldSchema"
7133 }
7134}
7135
7136/// A request message for
7137/// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies].
7138///
7139/// [google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]: crate::client::AssetService::batch_get_effective_iam_policies
7140#[derive(Clone, Default, PartialEq)]
7141#[non_exhaustive]
7142pub struct BatchGetEffectiveIamPoliciesRequest {
7143 /// Required. Only IAM policies on or below the scope will be returned.
7144 ///
7145 /// This can only be an organization number (such as "organizations/123"), a
7146 /// folder number (such as "folders/123"), a project ID (such as
7147 /// "projects/my-project-id"), or a project number (such as "projects/12345").
7148 ///
7149 /// To know how to get organization ID, visit [here
7150 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
7151 ///
7152 /// To know how to get folder or project ID, visit [here
7153 /// ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
7154 pub scope: std::string::String,
7155
7156 /// Required. The names refer to the [full_resource_names]
7157 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
7158 /// of the asset types [supported by search
7159 /// APIs](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
7160 /// A maximum of 20 resources' effective policies can be retrieved in a batch.
7161 pub names: std::vec::Vec<std::string::String>,
7162
7163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7164}
7165
7166impl BatchGetEffectiveIamPoliciesRequest {
7167 pub fn new() -> Self {
7168 std::default::Default::default()
7169 }
7170
7171 /// Sets the value of [scope][crate::model::BatchGetEffectiveIamPoliciesRequest::scope].
7172 ///
7173 /// # Example
7174 /// ```ignore,no_run
7175 /// # use google_cloud_asset_v1::model::BatchGetEffectiveIamPoliciesRequest;
7176 /// let x = BatchGetEffectiveIamPoliciesRequest::new().set_scope("example");
7177 /// ```
7178 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7179 self.scope = v.into();
7180 self
7181 }
7182
7183 /// Sets the value of [names][crate::model::BatchGetEffectiveIamPoliciesRequest::names].
7184 ///
7185 /// # Example
7186 /// ```ignore,no_run
7187 /// # use google_cloud_asset_v1::model::BatchGetEffectiveIamPoliciesRequest;
7188 /// let x = BatchGetEffectiveIamPoliciesRequest::new().set_names(["a", "b", "c"]);
7189 /// ```
7190 pub fn set_names<T, V>(mut self, v: T) -> Self
7191 where
7192 T: std::iter::IntoIterator<Item = V>,
7193 V: std::convert::Into<std::string::String>,
7194 {
7195 use std::iter::Iterator;
7196 self.names = v.into_iter().map(|i| i.into()).collect();
7197 self
7198 }
7199}
7200
7201impl wkt::message::Message for BatchGetEffectiveIamPoliciesRequest {
7202 fn typename() -> &'static str {
7203 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest"
7204 }
7205}
7206
7207/// A response message for
7208/// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies].
7209///
7210/// [google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]: crate::client::AssetService::batch_get_effective_iam_policies
7211#[derive(Clone, Default, PartialEq)]
7212#[non_exhaustive]
7213pub struct BatchGetEffectiveIamPoliciesResponse {
7214 /// The effective policies for a batch of resources. Note that the results
7215 /// order is the same as the order of
7216 /// [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names].
7217 /// When a resource does not have any effective IAM policies, its corresponding
7218 /// policy_result will contain empty
7219 /// [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies].
7220 ///
7221 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]: crate::model::BatchGetEffectiveIamPoliciesRequest::names
7222 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies
7223 pub policy_results:
7224 std::vec::Vec<crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy>,
7225
7226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7227}
7228
7229impl BatchGetEffectiveIamPoliciesResponse {
7230 pub fn new() -> Self {
7231 std::default::Default::default()
7232 }
7233
7234 /// Sets the value of [policy_results][crate::model::BatchGetEffectiveIamPoliciesResponse::policy_results].
7235 ///
7236 /// # Example
7237 /// ```ignore,no_run
7238 /// # use google_cloud_asset_v1::model::BatchGetEffectiveIamPoliciesResponse;
7239 /// use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy;
7240 /// let x = BatchGetEffectiveIamPoliciesResponse::new()
7241 /// .set_policy_results([
7242 /// EffectiveIamPolicy::default()/* use setters */,
7243 /// EffectiveIamPolicy::default()/* use (different) setters */,
7244 /// ]);
7245 /// ```
7246 pub fn set_policy_results<T, V>(mut self, v: T) -> Self
7247 where
7248 T: std::iter::IntoIterator<Item = V>,
7249 V: std::convert::Into<
7250 crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy,
7251 >,
7252 {
7253 use std::iter::Iterator;
7254 self.policy_results = v.into_iter().map(|i| i.into()).collect();
7255 self
7256 }
7257}
7258
7259impl wkt::message::Message for BatchGetEffectiveIamPoliciesResponse {
7260 fn typename() -> &'static str {
7261 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse"
7262 }
7263}
7264
7265/// Defines additional types related to [BatchGetEffectiveIamPoliciesResponse].
7266pub mod batch_get_effective_iam_policies_response {
7267 #[allow(unused_imports)]
7268 use super::*;
7269
7270 /// The effective IAM policies on one resource.
7271 #[derive(Clone, Default, PartialEq)]
7272 #[non_exhaustive]
7273 pub struct EffectiveIamPolicy {
7274
7275 /// The [full_resource_name]
7276 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>)
7277 /// for which the
7278 /// [policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]
7279 /// are computed. This is one of the
7280 /// [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]
7281 /// the caller provides in the request.
7282 ///
7283 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]: crate::model::BatchGetEffectiveIamPoliciesRequest::names
7284 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies
7285 pub full_resource_name: std::string::String,
7286
7287 /// The effective policies for the
7288 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name].
7289 ///
7290 /// These policies include the policy set on the
7291 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]
7292 /// and those set on its parents and ancestors up to the
7293 /// [BatchGetEffectiveIamPoliciesRequest.scope][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope].
7294 /// Note that these policies are not filtered according to the resource type
7295 /// of the
7296 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name].
7297 ///
7298 /// These policies are hierarchically ordered by
7299 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]
7300 /// starting from
7301 /// [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]
7302 /// itself to its parents and ancestors, such that policies[i]'s
7303 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]
7304 /// is the child of policies[i+1]'s
7305 /// [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource],
7306 /// if policies[i+1] exists.
7307 ///
7308 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope]: crate::model::BatchGetEffectiveIamPoliciesRequest::scope
7309 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource
7310 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]: crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::full_resource_name
7311 pub policies: std::vec::Vec<crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo>,
7312
7313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7314 }
7315
7316 impl EffectiveIamPolicy {
7317 pub fn new() -> Self {
7318 std::default::Default::default()
7319 }
7320
7321 /// Sets the value of [full_resource_name][crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::full_resource_name].
7322 ///
7323 /// # Example
7324 /// ```ignore,no_run
7325 /// # use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy;
7326 /// let x = EffectiveIamPolicy::new().set_full_resource_name("example");
7327 /// ```
7328 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
7329 mut self,
7330 v: T,
7331 ) -> Self {
7332 self.full_resource_name = v.into();
7333 self
7334 }
7335
7336 /// Sets the value of [policies][crate::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy::policies].
7337 ///
7338 /// # Example
7339 /// ```ignore,no_run
7340 /// # use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::EffectiveIamPolicy;
7341 /// use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo;
7342 /// let x = EffectiveIamPolicy::new()
7343 /// .set_policies([
7344 /// PolicyInfo::default()/* use setters */,
7345 /// PolicyInfo::default()/* use (different) setters */,
7346 /// ]);
7347 /// ```
7348 pub fn set_policies<T, V>(mut self, v: T) -> Self
7349 where
7350 T: std::iter::IntoIterator<Item = V>,
7351 V: std::convert::Into<crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo>
7352 {
7353 use std::iter::Iterator;
7354 self.policies = v.into_iter().map(|i| i.into()).collect();
7355 self
7356 }
7357 }
7358
7359 impl wkt::message::Message for EffectiveIamPolicy {
7360 fn typename() -> &'static str {
7361 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy"
7362 }
7363 }
7364
7365 /// Defines additional types related to [EffectiveIamPolicy].
7366 pub mod effective_iam_policy {
7367 #[allow(unused_imports)]
7368 use super::*;
7369
7370 /// The IAM policy and its attached resource.
7371 #[derive(Clone, Default, PartialEq)]
7372 #[non_exhaustive]
7373 pub struct PolicyInfo {
7374 /// The full resource name the
7375 /// [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]
7376 /// is directly attached to.
7377 ///
7378 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy
7379 pub attached_resource: std::string::String,
7380
7381 /// The IAM policy that's directly attached to the
7382 /// [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource].
7383 ///
7384 /// [google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]: crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource
7385 pub policy: std::option::Option<google_cloud_iam_v1::model::Policy>,
7386
7387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7388 }
7389
7390 impl PolicyInfo {
7391 pub fn new() -> Self {
7392 std::default::Default::default()
7393 }
7394
7395 /// Sets the value of [attached_resource][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::attached_resource].
7396 ///
7397 /// # Example
7398 /// ```ignore,no_run
7399 /// # use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo;
7400 /// let x = PolicyInfo::new().set_attached_resource("example");
7401 /// ```
7402 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
7403 mut self,
7404 v: T,
7405 ) -> Self {
7406 self.attached_resource = v.into();
7407 self
7408 }
7409
7410 /// Sets the value of [policy][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy].
7411 ///
7412 /// # Example
7413 /// ```ignore,no_run
7414 /// # use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo;
7415 /// use google_cloud_iam_v1::model::Policy;
7416 /// let x = PolicyInfo::new().set_policy(Policy::default()/* use setters */);
7417 /// ```
7418 pub fn set_policy<T>(mut self, v: T) -> Self
7419 where
7420 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7421 {
7422 self.policy = std::option::Option::Some(v.into());
7423 self
7424 }
7425
7426 /// Sets or clears the value of [policy][crate::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo::policy].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_asset_v1::model::batch_get_effective_iam_policies_response::effective_iam_policy::PolicyInfo;
7431 /// use google_cloud_iam_v1::model::Policy;
7432 /// let x = PolicyInfo::new().set_or_clear_policy(Some(Policy::default()/* use setters */));
7433 /// let x = PolicyInfo::new().set_or_clear_policy(None::<Policy>);
7434 /// ```
7435 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7436 where
7437 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7438 {
7439 self.policy = v.map(|x| x.into());
7440 self
7441 }
7442 }
7443
7444 impl wkt::message::Message for PolicyInfo {
7445 fn typename() -> &'static str {
7446 "type.googleapis.com/google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo"
7447 }
7448 }
7449 }
7450}
7451
7452/// This organization policy message is a modified version of the one defined in
7453/// the Organization Policy system. This message contains several fields defined
7454/// in the original organization policy with some new fields for analysis
7455/// purpose.
7456#[derive(Clone, Default, PartialEq)]
7457#[non_exhaustive]
7458pub struct AnalyzerOrgPolicy {
7459 /// The [full resource name]
7460 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
7461 /// an organization/folder/project resource where this organization policy is
7462 /// set.
7463 ///
7464 /// Notice that some type of constraints are defined with default policy. This
7465 /// field will be empty for them.
7466 pub attached_resource: std::string::String,
7467
7468 /// The [full resource name]
7469 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
7470 /// an organization/folder/project resource where this organization policy
7471 /// applies to.
7472 ///
7473 /// For any user defined org policies, this field has the same value as
7474 /// the [attached_resource] field. Only for default policy, this field has
7475 /// the different value.
7476 pub applied_resource: std::string::String,
7477
7478 /// List of rules for this organization policy.
7479 pub rules: std::vec::Vec<crate::model::analyzer_org_policy::Rule>,
7480
7481 /// If `inherit_from_parent` is true, Rules set higher up in the
7482 /// hierarchy (up to the closest root) are inherited and present in the
7483 /// effective policy. If it is false, then no rules are inherited, and this
7484 /// policy becomes the effective root for evaluation.
7485 pub inherit_from_parent: bool,
7486
7487 /// Ignores policies set above this resource and restores the default behavior
7488 /// of the constraint at this resource.
7489 /// This field can be set in policies for either list or boolean
7490 /// constraints. If set, `rules` must be empty and `inherit_from_parent`
7491 /// must be set to false.
7492 pub reset: bool,
7493
7494 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7495}
7496
7497impl AnalyzerOrgPolicy {
7498 pub fn new() -> Self {
7499 std::default::Default::default()
7500 }
7501
7502 /// Sets the value of [attached_resource][crate::model::AnalyzerOrgPolicy::attached_resource].
7503 ///
7504 /// # Example
7505 /// ```ignore,no_run
7506 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
7507 /// let x = AnalyzerOrgPolicy::new().set_attached_resource("example");
7508 /// ```
7509 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
7510 mut self,
7511 v: T,
7512 ) -> Self {
7513 self.attached_resource = v.into();
7514 self
7515 }
7516
7517 /// Sets the value of [applied_resource][crate::model::AnalyzerOrgPolicy::applied_resource].
7518 ///
7519 /// # Example
7520 /// ```ignore,no_run
7521 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
7522 /// let x = AnalyzerOrgPolicy::new().set_applied_resource("example");
7523 /// ```
7524 pub fn set_applied_resource<T: std::convert::Into<std::string::String>>(
7525 mut self,
7526 v: T,
7527 ) -> Self {
7528 self.applied_resource = v.into();
7529 self
7530 }
7531
7532 /// Sets the value of [rules][crate::model::AnalyzerOrgPolicy::rules].
7533 ///
7534 /// # Example
7535 /// ```ignore,no_run
7536 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
7537 /// use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7538 /// let x = AnalyzerOrgPolicy::new()
7539 /// .set_rules([
7540 /// Rule::default()/* use setters */,
7541 /// Rule::default()/* use (different) setters */,
7542 /// ]);
7543 /// ```
7544 pub fn set_rules<T, V>(mut self, v: T) -> Self
7545 where
7546 T: std::iter::IntoIterator<Item = V>,
7547 V: std::convert::Into<crate::model::analyzer_org_policy::Rule>,
7548 {
7549 use std::iter::Iterator;
7550 self.rules = v.into_iter().map(|i| i.into()).collect();
7551 self
7552 }
7553
7554 /// Sets the value of [inherit_from_parent][crate::model::AnalyzerOrgPolicy::inherit_from_parent].
7555 ///
7556 /// # Example
7557 /// ```ignore,no_run
7558 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
7559 /// let x = AnalyzerOrgPolicy::new().set_inherit_from_parent(true);
7560 /// ```
7561 pub fn set_inherit_from_parent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7562 self.inherit_from_parent = v.into();
7563 self
7564 }
7565
7566 /// Sets the value of [reset][crate::model::AnalyzerOrgPolicy::reset].
7567 ///
7568 /// # Example
7569 /// ```ignore,no_run
7570 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
7571 /// let x = AnalyzerOrgPolicy::new().set_reset(true);
7572 /// ```
7573 pub fn set_reset<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7574 self.reset = v.into();
7575 self
7576 }
7577}
7578
7579impl wkt::message::Message for AnalyzerOrgPolicy {
7580 fn typename() -> &'static str {
7581 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy"
7582 }
7583}
7584
7585/// Defines additional types related to [AnalyzerOrgPolicy].
7586pub mod analyzer_org_policy {
7587 #[allow(unused_imports)]
7588 use super::*;
7589
7590 /// This rule message is a customized version of the one defined in the
7591 /// Organization Policy system. In addition to the fields defined in the
7592 /// original organization policy, it contains additional field(s) under
7593 /// specific circumstances to support analysis results.
7594 #[derive(Clone, Default, PartialEq)]
7595 #[non_exhaustive]
7596 pub struct Rule {
7597 /// The evaluating condition for this rule.
7598 pub condition: std::option::Option<google_cloud_type::model::Expr>,
7599
7600 /// The condition evaluation result for this rule.
7601 /// Only populated if it meets all the following criteria:
7602 ///
7603 /// * There is a
7604 /// [condition][google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]
7605 /// defined for this rule.
7606 /// * This rule is within
7607 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy],
7608 /// or
7609 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]
7610 /// when the
7611 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]
7612 /// has
7613 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource].
7614 ///
7615 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset
7616 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.consolidated_policy]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy
7617 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.governed_resource]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset
7618 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.consolidated_policy]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy
7619 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.condition]: crate::model::analyzer_org_policy::Rule::condition
7620 pub condition_evaluation: std::option::Option<crate::model::ConditionEvaluation>,
7621
7622 pub kind: std::option::Option<crate::model::analyzer_org_policy::rule::Kind>,
7623
7624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7625 }
7626
7627 impl Rule {
7628 pub fn new() -> Self {
7629 std::default::Default::default()
7630 }
7631
7632 /// Sets the value of [condition][crate::model::analyzer_org_policy::Rule::condition].
7633 ///
7634 /// # Example
7635 /// ```ignore,no_run
7636 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7637 /// use google_cloud_type::model::Expr;
7638 /// let x = Rule::new().set_condition(Expr::default()/* use setters */);
7639 /// ```
7640 pub fn set_condition<T>(mut self, v: T) -> Self
7641 where
7642 T: std::convert::Into<google_cloud_type::model::Expr>,
7643 {
7644 self.condition = std::option::Option::Some(v.into());
7645 self
7646 }
7647
7648 /// Sets or clears the value of [condition][crate::model::analyzer_org_policy::Rule::condition].
7649 ///
7650 /// # Example
7651 /// ```ignore,no_run
7652 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7653 /// use google_cloud_type::model::Expr;
7654 /// let x = Rule::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
7655 /// let x = Rule::new().set_or_clear_condition(None::<Expr>);
7656 /// ```
7657 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
7658 where
7659 T: std::convert::Into<google_cloud_type::model::Expr>,
7660 {
7661 self.condition = v.map(|x| x.into());
7662 self
7663 }
7664
7665 /// Sets the value of [condition_evaluation][crate::model::analyzer_org_policy::Rule::condition_evaluation].
7666 ///
7667 /// # Example
7668 /// ```ignore,no_run
7669 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7670 /// use google_cloud_asset_v1::model::ConditionEvaluation;
7671 /// let x = Rule::new().set_condition_evaluation(ConditionEvaluation::default()/* use setters */);
7672 /// ```
7673 pub fn set_condition_evaluation<T>(mut self, v: T) -> Self
7674 where
7675 T: std::convert::Into<crate::model::ConditionEvaluation>,
7676 {
7677 self.condition_evaluation = std::option::Option::Some(v.into());
7678 self
7679 }
7680
7681 /// Sets or clears the value of [condition_evaluation][crate::model::analyzer_org_policy::Rule::condition_evaluation].
7682 ///
7683 /// # Example
7684 /// ```ignore,no_run
7685 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7686 /// use google_cloud_asset_v1::model::ConditionEvaluation;
7687 /// let x = Rule::new().set_or_clear_condition_evaluation(Some(ConditionEvaluation::default()/* use setters */));
7688 /// let x = Rule::new().set_or_clear_condition_evaluation(None::<ConditionEvaluation>);
7689 /// ```
7690 pub fn set_or_clear_condition_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
7691 where
7692 T: std::convert::Into<crate::model::ConditionEvaluation>,
7693 {
7694 self.condition_evaluation = v.map(|x| x.into());
7695 self
7696 }
7697
7698 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind].
7699 ///
7700 /// Note that all the setters affecting `kind` are mutually
7701 /// exclusive.
7702 ///
7703 /// # Example
7704 /// ```ignore,no_run
7705 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7706 /// use google_cloud_asset_v1::model::analyzer_org_policy::rule::Kind;
7707 /// let x = Rule::new().set_kind(Some(Kind::AllowAll(true)));
7708 /// ```
7709 pub fn set_kind<
7710 T: std::convert::Into<std::option::Option<crate::model::analyzer_org_policy::rule::Kind>>,
7711 >(
7712 mut self,
7713 v: T,
7714 ) -> Self {
7715 self.kind = v.into();
7716 self
7717 }
7718
7719 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7720 /// if it holds a `Values`, `None` if the field is not set or
7721 /// holds a different branch.
7722 pub fn values(
7723 &self,
7724 ) -> std::option::Option<
7725 &std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>,
7726 > {
7727 #[allow(unreachable_patterns)]
7728 self.kind.as_ref().and_then(|v| match v {
7729 crate::model::analyzer_org_policy::rule::Kind::Values(v) => {
7730 std::option::Option::Some(v)
7731 }
7732 _ => std::option::Option::None,
7733 })
7734 }
7735
7736 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7737 /// to hold a `Values`.
7738 ///
7739 /// Note that all the setters affecting `kind` are
7740 /// mutually exclusive.
7741 ///
7742 /// # Example
7743 /// ```ignore,no_run
7744 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7745 /// use google_cloud_asset_v1::model::analyzer_org_policy::rule::StringValues;
7746 /// let x = Rule::new().set_values(StringValues::default()/* use setters */);
7747 /// assert!(x.values().is_some());
7748 /// assert!(x.allow_all().is_none());
7749 /// assert!(x.deny_all().is_none());
7750 /// assert!(x.enforce().is_none());
7751 /// ```
7752 pub fn set_values<
7753 T: std::convert::Into<
7754 std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>,
7755 >,
7756 >(
7757 mut self,
7758 v: T,
7759 ) -> Self {
7760 self.kind = std::option::Option::Some(
7761 crate::model::analyzer_org_policy::rule::Kind::Values(v.into()),
7762 );
7763 self
7764 }
7765
7766 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7767 /// if it holds a `AllowAll`, `None` if the field is not set or
7768 /// holds a different branch.
7769 pub fn allow_all(&self) -> std::option::Option<&bool> {
7770 #[allow(unreachable_patterns)]
7771 self.kind.as_ref().and_then(|v| match v {
7772 crate::model::analyzer_org_policy::rule::Kind::AllowAll(v) => {
7773 std::option::Option::Some(v)
7774 }
7775 _ => std::option::Option::None,
7776 })
7777 }
7778
7779 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7780 /// to hold a `AllowAll`.
7781 ///
7782 /// Note that all the setters affecting `kind` are
7783 /// mutually exclusive.
7784 ///
7785 /// # Example
7786 /// ```ignore,no_run
7787 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7788 /// let x = Rule::new().set_allow_all(true);
7789 /// assert!(x.allow_all().is_some());
7790 /// assert!(x.values().is_none());
7791 /// assert!(x.deny_all().is_none());
7792 /// assert!(x.enforce().is_none());
7793 /// ```
7794 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7795 self.kind = std::option::Option::Some(
7796 crate::model::analyzer_org_policy::rule::Kind::AllowAll(v.into()),
7797 );
7798 self
7799 }
7800
7801 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7802 /// if it holds a `DenyAll`, `None` if the field is not set or
7803 /// holds a different branch.
7804 pub fn deny_all(&self) -> std::option::Option<&bool> {
7805 #[allow(unreachable_patterns)]
7806 self.kind.as_ref().and_then(|v| match v {
7807 crate::model::analyzer_org_policy::rule::Kind::DenyAll(v) => {
7808 std::option::Option::Some(v)
7809 }
7810 _ => std::option::Option::None,
7811 })
7812 }
7813
7814 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7815 /// to hold a `DenyAll`.
7816 ///
7817 /// Note that all the setters affecting `kind` are
7818 /// mutually exclusive.
7819 ///
7820 /// # Example
7821 /// ```ignore,no_run
7822 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7823 /// let x = Rule::new().set_deny_all(true);
7824 /// assert!(x.deny_all().is_some());
7825 /// assert!(x.values().is_none());
7826 /// assert!(x.allow_all().is_none());
7827 /// assert!(x.enforce().is_none());
7828 /// ```
7829 pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7830 self.kind = std::option::Option::Some(
7831 crate::model::analyzer_org_policy::rule::Kind::DenyAll(v.into()),
7832 );
7833 self
7834 }
7835
7836 /// The value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7837 /// if it holds a `Enforce`, `None` if the field is not set or
7838 /// holds a different branch.
7839 pub fn enforce(&self) -> std::option::Option<&bool> {
7840 #[allow(unreachable_patterns)]
7841 self.kind.as_ref().and_then(|v| match v {
7842 crate::model::analyzer_org_policy::rule::Kind::Enforce(v) => {
7843 std::option::Option::Some(v)
7844 }
7845 _ => std::option::Option::None,
7846 })
7847 }
7848
7849 /// Sets the value of [kind][crate::model::analyzer_org_policy::Rule::kind]
7850 /// to hold a `Enforce`.
7851 ///
7852 /// Note that all the setters affecting `kind` are
7853 /// mutually exclusive.
7854 ///
7855 /// # Example
7856 /// ```ignore,no_run
7857 /// # use google_cloud_asset_v1::model::analyzer_org_policy::Rule;
7858 /// let x = Rule::new().set_enforce(true);
7859 /// assert!(x.enforce().is_some());
7860 /// assert!(x.values().is_none());
7861 /// assert!(x.allow_all().is_none());
7862 /// assert!(x.deny_all().is_none());
7863 /// ```
7864 pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7865 self.kind = std::option::Option::Some(
7866 crate::model::analyzer_org_policy::rule::Kind::Enforce(v.into()),
7867 );
7868 self
7869 }
7870 }
7871
7872 impl wkt::message::Message for Rule {
7873 fn typename() -> &'static str {
7874 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy.Rule"
7875 }
7876 }
7877
7878 /// Defines additional types related to [Rule].
7879 pub mod rule {
7880 #[allow(unused_imports)]
7881 use super::*;
7882
7883 /// The string values for the list constraints.
7884 #[derive(Clone, Default, PartialEq)]
7885 #[non_exhaustive]
7886 pub struct StringValues {
7887 /// List of values allowed at this resource.
7888 pub allowed_values: std::vec::Vec<std::string::String>,
7889
7890 /// List of values denied at this resource.
7891 pub denied_values: std::vec::Vec<std::string::String>,
7892
7893 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7894 }
7895
7896 impl StringValues {
7897 pub fn new() -> Self {
7898 std::default::Default::default()
7899 }
7900
7901 /// Sets the value of [allowed_values][crate::model::analyzer_org_policy::rule::StringValues::allowed_values].
7902 ///
7903 /// # Example
7904 /// ```ignore,no_run
7905 /// # use google_cloud_asset_v1::model::analyzer_org_policy::rule::StringValues;
7906 /// let x = StringValues::new().set_allowed_values(["a", "b", "c"]);
7907 /// ```
7908 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
7909 where
7910 T: std::iter::IntoIterator<Item = V>,
7911 V: std::convert::Into<std::string::String>,
7912 {
7913 use std::iter::Iterator;
7914 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
7915 self
7916 }
7917
7918 /// Sets the value of [denied_values][crate::model::analyzer_org_policy::rule::StringValues::denied_values].
7919 ///
7920 /// # Example
7921 /// ```ignore,no_run
7922 /// # use google_cloud_asset_v1::model::analyzer_org_policy::rule::StringValues;
7923 /// let x = StringValues::new().set_denied_values(["a", "b", "c"]);
7924 /// ```
7925 pub fn set_denied_values<T, V>(mut self, v: T) -> Self
7926 where
7927 T: std::iter::IntoIterator<Item = V>,
7928 V: std::convert::Into<std::string::String>,
7929 {
7930 use std::iter::Iterator;
7931 self.denied_values = v.into_iter().map(|i| i.into()).collect();
7932 self
7933 }
7934 }
7935
7936 impl wkt::message::Message for StringValues {
7937 fn typename() -> &'static str {
7938 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues"
7939 }
7940 }
7941
7942 #[derive(Clone, Debug, PartialEq)]
7943 #[non_exhaustive]
7944 pub enum Kind {
7945 /// List of values to be used for this policy rule. This field can be set
7946 /// only in policies for list constraints.
7947 Values(std::boxed::Box<crate::model::analyzer_org_policy::rule::StringValues>),
7948 /// Setting this to true means that all values are allowed. This field can
7949 /// be set only in Policies for list constraints.
7950 AllowAll(bool),
7951 /// Setting this to true means that all values are denied. This field can
7952 /// be set only in Policies for list constraints.
7953 DenyAll(bool),
7954 /// If `true`, then the `Policy` is enforced. If `false`, then any
7955 /// configuration is acceptable.
7956 /// This field can be set only in Policies for boolean constraints.
7957 Enforce(bool),
7958 }
7959 }
7960}
7961
7962/// The organization policy constraint definition.
7963#[derive(Clone, Default, PartialEq)]
7964#[non_exhaustive]
7965pub struct AnalyzerOrgPolicyConstraint {
7966 pub constraint_definition:
7967 std::option::Option<crate::model::analyzer_org_policy_constraint::ConstraintDefinition>,
7968
7969 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7970}
7971
7972impl AnalyzerOrgPolicyConstraint {
7973 pub fn new() -> Self {
7974 std::default::Default::default()
7975 }
7976
7977 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition].
7978 ///
7979 /// Note that all the setters affecting `constraint_definition` are mutually
7980 /// exclusive.
7981 ///
7982 /// # Example
7983 /// ```ignore,no_run
7984 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
7985 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
7986 /// let x = AnalyzerOrgPolicyConstraint::new().set_constraint_definition(Some(
7987 /// google_cloud_asset_v1::model::analyzer_org_policy_constraint::ConstraintDefinition::GoogleDefinedConstraint(Constraint::default().into())));
7988 /// ```
7989 pub fn set_constraint_definition<
7990 T: std::convert::Into<
7991 std::option::Option<
7992 crate::model::analyzer_org_policy_constraint::ConstraintDefinition,
7993 >,
7994 >,
7995 >(
7996 mut self,
7997 v: T,
7998 ) -> Self {
7999 self.constraint_definition = v.into();
8000 self
8001 }
8002
8003 /// The value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
8004 /// if it holds a `GoogleDefinedConstraint`, `None` if the field is not set or
8005 /// holds a different branch.
8006 pub fn google_defined_constraint(
8007 &self,
8008 ) -> std::option::Option<
8009 &std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
8010 > {
8011 #[allow(unreachable_patterns)]
8012 self.constraint_definition.as_ref().and_then(|v| match v {
8013 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::GoogleDefinedConstraint(v) => std::option::Option::Some(v),
8014 _ => std::option::Option::None,
8015 })
8016 }
8017
8018 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
8019 /// to hold a `GoogleDefinedConstraint`.
8020 ///
8021 /// Note that all the setters affecting `constraint_definition` are
8022 /// mutually exclusive.
8023 ///
8024 /// # Example
8025 /// ```ignore,no_run
8026 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
8027 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8028 /// let x = AnalyzerOrgPolicyConstraint::new().set_google_defined_constraint(Constraint::default()/* use setters */);
8029 /// assert!(x.google_defined_constraint().is_some());
8030 /// assert!(x.custom_constraint().is_none());
8031 /// ```
8032 pub fn set_google_defined_constraint<
8033 T: std::convert::Into<
8034 std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
8035 >,
8036 >(
8037 mut self,
8038 v: T,
8039 ) -> Self {
8040 self.constraint_definition = std::option::Option::Some(
8041 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::GoogleDefinedConstraint(
8042 v.into()
8043 )
8044 );
8045 self
8046 }
8047
8048 /// The value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
8049 /// if it holds a `CustomConstraint`, `None` if the field is not set or
8050 /// holds a different branch.
8051 pub fn custom_constraint(
8052 &self,
8053 ) -> std::option::Option<
8054 &std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
8055 > {
8056 #[allow(unreachable_patterns)]
8057 self.constraint_definition.as_ref().and_then(|v| match v {
8058 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::CustomConstraint(v) => std::option::Option::Some(v),
8059 _ => std::option::Option::None,
8060 })
8061 }
8062
8063 /// Sets the value of [constraint_definition][crate::model::AnalyzerOrgPolicyConstraint::constraint_definition]
8064 /// to hold a `CustomConstraint`.
8065 ///
8066 /// Note that all the setters affecting `constraint_definition` are
8067 /// mutually exclusive.
8068 ///
8069 /// # Example
8070 /// ```ignore,no_run
8071 /// # use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
8072 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8073 /// let x = AnalyzerOrgPolicyConstraint::new().set_custom_constraint(CustomConstraint::default()/* use setters */);
8074 /// assert!(x.custom_constraint().is_some());
8075 /// assert!(x.google_defined_constraint().is_none());
8076 /// ```
8077 pub fn set_custom_constraint<
8078 T: std::convert::Into<
8079 std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
8080 >,
8081 >(
8082 mut self,
8083 v: T,
8084 ) -> Self {
8085 self.constraint_definition = std::option::Option::Some(
8086 crate::model::analyzer_org_policy_constraint::ConstraintDefinition::CustomConstraint(
8087 v.into(),
8088 ),
8089 );
8090 self
8091 }
8092}
8093
8094impl wkt::message::Message for AnalyzerOrgPolicyConstraint {
8095 fn typename() -> &'static str {
8096 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint"
8097 }
8098}
8099
8100/// Defines additional types related to [AnalyzerOrgPolicyConstraint].
8101pub mod analyzer_org_policy_constraint {
8102 #[allow(unused_imports)]
8103 use super::*;
8104
8105 /// The definition of a constraint.
8106 #[derive(Clone, Default, PartialEq)]
8107 #[non_exhaustive]
8108 pub struct Constraint {
8109 /// The unique name of the constraint. Format of the name should be
8110 ///
8111 /// * `constraints/{constraint_name}`
8112 ///
8113 /// For example, `constraints/compute.disableSerialPortAccess`.
8114 pub name: std::string::String,
8115
8116 /// The human readable name of the constraint.
8117 pub display_name: std::string::String,
8118
8119 /// Detailed description of what this `Constraint` controls as well as how
8120 /// and where it is enforced.
8121 pub description: std::string::String,
8122
8123 /// The evaluation behavior of this constraint in the absence of 'Policy'.
8124 pub constraint_default:
8125 crate::model::analyzer_org_policy_constraint::constraint::ConstraintDefault,
8126
8127 /// The type of restrictions for this `Constraint`.
8128 ///
8129 /// Immutable after creation.
8130 pub constraint_type: std::option::Option<
8131 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType,
8132 >,
8133
8134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8135 }
8136
8137 impl Constraint {
8138 pub fn new() -> Self {
8139 std::default::Default::default()
8140 }
8141
8142 /// Sets the value of [name][crate::model::analyzer_org_policy_constraint::Constraint::name].
8143 ///
8144 /// # Example
8145 /// ```ignore,no_run
8146 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8147 /// let x = Constraint::new().set_name("example");
8148 /// ```
8149 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8150 self.name = v.into();
8151 self
8152 }
8153
8154 /// Sets the value of [display_name][crate::model::analyzer_org_policy_constraint::Constraint::display_name].
8155 ///
8156 /// # Example
8157 /// ```ignore,no_run
8158 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8159 /// let x = Constraint::new().set_display_name("example");
8160 /// ```
8161 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
8162 mut self,
8163 v: T,
8164 ) -> Self {
8165 self.display_name = v.into();
8166 self
8167 }
8168
8169 /// Sets the value of [description][crate::model::analyzer_org_policy_constraint::Constraint::description].
8170 ///
8171 /// # Example
8172 /// ```ignore,no_run
8173 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8174 /// let x = Constraint::new().set_description("example");
8175 /// ```
8176 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8177 self.description = v.into();
8178 self
8179 }
8180
8181 /// Sets the value of [constraint_default][crate::model::analyzer_org_policy_constraint::Constraint::constraint_default].
8182 ///
8183 /// # Example
8184 /// ```ignore,no_run
8185 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8186 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ConstraintDefault;
8187 /// let x0 = Constraint::new().set_constraint_default(ConstraintDefault::Allow);
8188 /// let x1 = Constraint::new().set_constraint_default(ConstraintDefault::Deny);
8189 /// ```
8190 pub fn set_constraint_default<
8191 T: std::convert::Into<
8192 crate::model::analyzer_org_policy_constraint::constraint::ConstraintDefault,
8193 >,
8194 >(
8195 mut self,
8196 v: T,
8197 ) -> Self {
8198 self.constraint_default = v.into();
8199 self
8200 }
8201
8202 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type].
8203 ///
8204 /// Note that all the setters affecting `constraint_type` are mutually
8205 /// exclusive.
8206 ///
8207 /// # Example
8208 /// ```ignore,no_run
8209 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8210 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ListConstraint;
8211 /// let x = Constraint::new().set_constraint_type(Some(
8212 /// google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ConstraintType::ListConstraint(ListConstraint::default().into())));
8213 /// ```
8214 pub fn set_constraint_type<
8215 T: std::convert::Into<
8216 std::option::Option<
8217 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType,
8218 >,
8219 >,
8220 >(
8221 mut self,
8222 v: T,
8223 ) -> Self {
8224 self.constraint_type = v.into();
8225 self
8226 }
8227
8228 /// The value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
8229 /// if it holds a `ListConstraint`, `None` if the field is not set or
8230 /// holds a different branch.
8231 pub fn list_constraint(
8232 &self,
8233 ) -> std::option::Option<
8234 &std::boxed::Box<
8235 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
8236 >,
8237 > {
8238 #[allow(unreachable_patterns)]
8239 self.constraint_type.as_ref().and_then(|v| match v {
8240 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::ListConstraint(v) => std::option::Option::Some(v),
8241 _ => std::option::Option::None,
8242 })
8243 }
8244
8245 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
8246 /// to hold a `ListConstraint`.
8247 ///
8248 /// Note that all the setters affecting `constraint_type` are
8249 /// mutually exclusive.
8250 ///
8251 /// # Example
8252 /// ```ignore,no_run
8253 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8254 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ListConstraint;
8255 /// let x = Constraint::new().set_list_constraint(ListConstraint::default()/* use setters */);
8256 /// assert!(x.list_constraint().is_some());
8257 /// assert!(x.boolean_constraint().is_none());
8258 /// ```
8259 pub fn set_list_constraint<
8260 T: std::convert::Into<
8261 std::boxed::Box<
8262 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
8263 >,
8264 >,
8265 >(
8266 mut self,
8267 v: T,
8268 ) -> Self {
8269 self.constraint_type = std::option::Option::Some(
8270 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::ListConstraint(
8271 v.into()
8272 )
8273 );
8274 self
8275 }
8276
8277 /// The value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
8278 /// if it holds a `BooleanConstraint`, `None` if the field is not set or
8279 /// holds a different branch.
8280 pub fn boolean_constraint(
8281 &self,
8282 ) -> std::option::Option<
8283 &std::boxed::Box<
8284 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
8285 >,
8286 > {
8287 #[allow(unreachable_patterns)]
8288 self.constraint_type.as_ref().and_then(|v| match v {
8289 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::BooleanConstraint(v) => std::option::Option::Some(v),
8290 _ => std::option::Option::None,
8291 })
8292 }
8293
8294 /// Sets the value of [constraint_type][crate::model::analyzer_org_policy_constraint::Constraint::constraint_type]
8295 /// to hold a `BooleanConstraint`.
8296 ///
8297 /// Note that all the setters affecting `constraint_type` are
8298 /// mutually exclusive.
8299 ///
8300 /// # Example
8301 /// ```ignore,no_run
8302 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::Constraint;
8303 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::BooleanConstraint;
8304 /// let x = Constraint::new().set_boolean_constraint(BooleanConstraint::default()/* use setters */);
8305 /// assert!(x.boolean_constraint().is_some());
8306 /// assert!(x.list_constraint().is_none());
8307 /// ```
8308 pub fn set_boolean_constraint<
8309 T: std::convert::Into<
8310 std::boxed::Box<
8311 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
8312 >,
8313 >,
8314 >(
8315 mut self,
8316 v: T,
8317 ) -> Self {
8318 self.constraint_type = std::option::Option::Some(
8319 crate::model::analyzer_org_policy_constraint::constraint::ConstraintType::BooleanConstraint(
8320 v.into()
8321 )
8322 );
8323 self
8324 }
8325 }
8326
8327 impl wkt::message::Message for Constraint {
8328 fn typename() -> &'static str {
8329 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint"
8330 }
8331 }
8332
8333 /// Defines additional types related to [Constraint].
8334 pub mod constraint {
8335 #[allow(unused_imports)]
8336 use super::*;
8337
8338 /// A `Constraint` that allows or disallows a list of string values, which
8339 /// are configured by an organization's policy administrator with a `Policy`.
8340 #[derive(Clone, Default, PartialEq)]
8341 #[non_exhaustive]
8342 pub struct ListConstraint {
8343 /// Indicates whether values grouped into categories can be used in
8344 /// `Policy.allowed_values` and `Policy.denied_values`. For example,
8345 /// `"in:Python"` would match any value in the 'Python' group.
8346 pub supports_in: bool,
8347
8348 /// Indicates whether subtrees of Cloud Resource Manager resource hierarchy
8349 /// can be used in `Policy.allowed_values` and `Policy.denied_values`. For
8350 /// example, `"under:folders/123"` would match any resource under the
8351 /// 'folders/123' folder.
8352 pub supports_under: bool,
8353
8354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8355 }
8356
8357 impl ListConstraint {
8358 pub fn new() -> Self {
8359 std::default::Default::default()
8360 }
8361
8362 /// Sets the value of [supports_in][crate::model::analyzer_org_policy_constraint::constraint::ListConstraint::supports_in].
8363 ///
8364 /// # Example
8365 /// ```ignore,no_run
8366 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ListConstraint;
8367 /// let x = ListConstraint::new().set_supports_in(true);
8368 /// ```
8369 pub fn set_supports_in<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8370 self.supports_in = v.into();
8371 self
8372 }
8373
8374 /// Sets the value of [supports_under][crate::model::analyzer_org_policy_constraint::constraint::ListConstraint::supports_under].
8375 ///
8376 /// # Example
8377 /// ```ignore,no_run
8378 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::constraint::ListConstraint;
8379 /// let x = ListConstraint::new().set_supports_under(true);
8380 /// ```
8381 pub fn set_supports_under<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8382 self.supports_under = v.into();
8383 self
8384 }
8385 }
8386
8387 impl wkt::message::Message for ListConstraint {
8388 fn typename() -> &'static str {
8389 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ListConstraint"
8390 }
8391 }
8392
8393 /// A `Constraint` that is either enforced or not.
8394 ///
8395 /// For example a constraint `constraints/compute.disableSerialPortAccess`.
8396 /// If it is enforced on a VM instance, serial port connections will not be
8397 /// opened to that instance.
8398 #[derive(Clone, Default, PartialEq)]
8399 #[non_exhaustive]
8400 pub struct BooleanConstraint {
8401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8402 }
8403
8404 impl BooleanConstraint {
8405 pub fn new() -> Self {
8406 std::default::Default::default()
8407 }
8408 }
8409
8410 impl wkt::message::Message for BooleanConstraint {
8411 fn typename() -> &'static str {
8412 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.BooleanConstraint"
8413 }
8414 }
8415
8416 /// Specifies the default behavior in the absence of any `Policy` for the
8417 /// `Constraint`. This must not be `CONSTRAINT_DEFAULT_UNSPECIFIED`.
8418 ///
8419 /// # Working with unknown values
8420 ///
8421 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8422 /// additional enum variants at any time. Adding new variants is not considered
8423 /// a breaking change. Applications should write their code in anticipation of:
8424 ///
8425 /// - New values appearing in future releases of the client library, **and**
8426 /// - New values received dynamically, without application changes.
8427 ///
8428 /// Please consult the [Working with enums] section in the user guide for some
8429 /// guidelines.
8430 ///
8431 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8432 #[derive(Clone, Debug, PartialEq)]
8433 #[non_exhaustive]
8434 pub enum ConstraintDefault {
8435 /// This is only used for distinguishing unset values and should never be
8436 /// used.
8437 Unspecified,
8438 /// Indicate that all values are allowed for list constraints.
8439 /// Indicate that enforcement is off for boolean constraints.
8440 Allow,
8441 /// Indicate that all values are denied for list constraints.
8442 /// Indicate that enforcement is on for boolean constraints.
8443 Deny,
8444 /// If set, the enum was initialized with an unknown value.
8445 ///
8446 /// Applications can examine the value using [ConstraintDefault::value] or
8447 /// [ConstraintDefault::name].
8448 UnknownValue(constraint_default::UnknownValue),
8449 }
8450
8451 #[doc(hidden)]
8452 pub mod constraint_default {
8453 #[allow(unused_imports)]
8454 use super::*;
8455 #[derive(Clone, Debug, PartialEq)]
8456 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8457 }
8458
8459 impl ConstraintDefault {
8460 /// Gets the enum value.
8461 ///
8462 /// Returns `None` if the enum contains an unknown value deserialized from
8463 /// the string representation of enums.
8464 pub fn value(&self) -> std::option::Option<i32> {
8465 match self {
8466 Self::Unspecified => std::option::Option::Some(0),
8467 Self::Allow => std::option::Option::Some(1),
8468 Self::Deny => std::option::Option::Some(2),
8469 Self::UnknownValue(u) => u.0.value(),
8470 }
8471 }
8472
8473 /// Gets the enum value as a string.
8474 ///
8475 /// Returns `None` if the enum contains an unknown value deserialized from
8476 /// the integer representation of enums.
8477 pub fn name(&self) -> std::option::Option<&str> {
8478 match self {
8479 Self::Unspecified => {
8480 std::option::Option::Some("CONSTRAINT_DEFAULT_UNSPECIFIED")
8481 }
8482 Self::Allow => std::option::Option::Some("ALLOW"),
8483 Self::Deny => std::option::Option::Some("DENY"),
8484 Self::UnknownValue(u) => u.0.name(),
8485 }
8486 }
8487 }
8488
8489 impl std::default::Default for ConstraintDefault {
8490 fn default() -> Self {
8491 use std::convert::From;
8492 Self::from(0)
8493 }
8494 }
8495
8496 impl std::fmt::Display for ConstraintDefault {
8497 fn fmt(
8498 &self,
8499 f: &mut std::fmt::Formatter<'_>,
8500 ) -> std::result::Result<(), std::fmt::Error> {
8501 wkt::internal::display_enum(f, self.name(), self.value())
8502 }
8503 }
8504
8505 impl std::convert::From<i32> for ConstraintDefault {
8506 fn from(value: i32) -> Self {
8507 match value {
8508 0 => Self::Unspecified,
8509 1 => Self::Allow,
8510 2 => Self::Deny,
8511 _ => Self::UnknownValue(constraint_default::UnknownValue(
8512 wkt::internal::UnknownEnumValue::Integer(value),
8513 )),
8514 }
8515 }
8516 }
8517
8518 impl std::convert::From<&str> for ConstraintDefault {
8519 fn from(value: &str) -> Self {
8520 use std::string::ToString;
8521 match value {
8522 "CONSTRAINT_DEFAULT_UNSPECIFIED" => Self::Unspecified,
8523 "ALLOW" => Self::Allow,
8524 "DENY" => Self::Deny,
8525 _ => Self::UnknownValue(constraint_default::UnknownValue(
8526 wkt::internal::UnknownEnumValue::String(value.to_string()),
8527 )),
8528 }
8529 }
8530 }
8531
8532 impl serde::ser::Serialize for ConstraintDefault {
8533 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8534 where
8535 S: serde::Serializer,
8536 {
8537 match self {
8538 Self::Unspecified => serializer.serialize_i32(0),
8539 Self::Allow => serializer.serialize_i32(1),
8540 Self::Deny => serializer.serialize_i32(2),
8541 Self::UnknownValue(u) => u.0.serialize(serializer),
8542 }
8543 }
8544 }
8545
8546 impl<'de> serde::de::Deserialize<'de> for ConstraintDefault {
8547 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8548 where
8549 D: serde::Deserializer<'de>,
8550 {
8551 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConstraintDefault>::new(
8552 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ConstraintDefault"))
8553 }
8554 }
8555
8556 /// The type of restrictions for this `Constraint`.
8557 ///
8558 /// Immutable after creation.
8559 #[derive(Clone, Debug, PartialEq)]
8560 #[non_exhaustive]
8561 pub enum ConstraintType {
8562 /// Defines this constraint as being a ListConstraint.
8563 ListConstraint(
8564 std::boxed::Box<
8565 crate::model::analyzer_org_policy_constraint::constraint::ListConstraint,
8566 >,
8567 ),
8568 /// Defines this constraint as being a BooleanConstraint.
8569 BooleanConstraint(
8570 std::boxed::Box<
8571 crate::model::analyzer_org_policy_constraint::constraint::BooleanConstraint,
8572 >,
8573 ),
8574 }
8575 }
8576
8577 /// The definition of a custom constraint.
8578 #[derive(Clone, Default, PartialEq)]
8579 #[non_exhaustive]
8580 pub struct CustomConstraint {
8581 /// Name of the constraint. This is unique within the organization. Format of
8582 /// the name should be
8583 ///
8584 /// * `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
8585 ///
8586 /// Example :
8587 /// "organizations/123/customConstraints/custom.createOnlyE2TypeVms"
8588 pub name: std::string::String,
8589
8590 /// The Resource Instance type on which this policy applies to. Format will
8591 /// be of the form : "\<canonical service name\>/\<type\>" Example:
8592 ///
8593 /// * `compute.googleapis.com/Instance`.
8594 pub resource_types: std::vec::Vec<std::string::String>,
8595
8596 /// All the operations being applied for this constraint.
8597 pub method_types: std::vec::Vec<
8598 crate::model::analyzer_org_policy_constraint::custom_constraint::MethodType,
8599 >,
8600
8601 /// Organization Policy condition/expression. For example:
8602 /// `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
8603 /// `resource.management.auto_upgrade == true`
8604 pub condition: std::string::String,
8605
8606 /// Allow or deny type.
8607 pub action_type:
8608 crate::model::analyzer_org_policy_constraint::custom_constraint::ActionType,
8609
8610 /// One line display name for the UI.
8611 pub display_name: std::string::String,
8612
8613 /// Detailed information about this custom policy constraint.
8614 pub description: std::string::String,
8615
8616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8617 }
8618
8619 impl CustomConstraint {
8620 pub fn new() -> Self {
8621 std::default::Default::default()
8622 }
8623
8624 /// Sets the value of [name][crate::model::analyzer_org_policy_constraint::CustomConstraint::name].
8625 ///
8626 /// # Example
8627 /// ```ignore,no_run
8628 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8629 /// let x = CustomConstraint::new().set_name("example");
8630 /// ```
8631 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8632 self.name = v.into();
8633 self
8634 }
8635
8636 /// Sets the value of [resource_types][crate::model::analyzer_org_policy_constraint::CustomConstraint::resource_types].
8637 ///
8638 /// # Example
8639 /// ```ignore,no_run
8640 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8641 /// let x = CustomConstraint::new().set_resource_types(["a", "b", "c"]);
8642 /// ```
8643 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
8644 where
8645 T: std::iter::IntoIterator<Item = V>,
8646 V: std::convert::Into<std::string::String>,
8647 {
8648 use std::iter::Iterator;
8649 self.resource_types = v.into_iter().map(|i| i.into()).collect();
8650 self
8651 }
8652
8653 /// Sets the value of [method_types][crate::model::analyzer_org_policy_constraint::CustomConstraint::method_types].
8654 ///
8655 /// # Example
8656 /// ```ignore,no_run
8657 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8658 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::custom_constraint::MethodType;
8659 /// let x = CustomConstraint::new().set_method_types([
8660 /// MethodType::Create,
8661 /// MethodType::Update,
8662 /// MethodType::Delete,
8663 /// ]);
8664 /// ```
8665 pub fn set_method_types<T, V>(mut self, v: T) -> Self
8666 where
8667 T: std::iter::IntoIterator<Item = V>,
8668 V: std::convert::Into<
8669 crate::model::analyzer_org_policy_constraint::custom_constraint::MethodType,
8670 >,
8671 {
8672 use std::iter::Iterator;
8673 self.method_types = v.into_iter().map(|i| i.into()).collect();
8674 self
8675 }
8676
8677 /// Sets the value of [condition][crate::model::analyzer_org_policy_constraint::CustomConstraint::condition].
8678 ///
8679 /// # Example
8680 /// ```ignore,no_run
8681 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8682 /// let x = CustomConstraint::new().set_condition("example");
8683 /// ```
8684 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8685 self.condition = v.into();
8686 self
8687 }
8688
8689 /// Sets the value of [action_type][crate::model::analyzer_org_policy_constraint::CustomConstraint::action_type].
8690 ///
8691 /// # Example
8692 /// ```ignore,no_run
8693 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8694 /// use google_cloud_asset_v1::model::analyzer_org_policy_constraint::custom_constraint::ActionType;
8695 /// let x0 = CustomConstraint::new().set_action_type(ActionType::Allow);
8696 /// let x1 = CustomConstraint::new().set_action_type(ActionType::Deny);
8697 /// ```
8698 pub fn set_action_type<
8699 T: std::convert::Into<
8700 crate::model::analyzer_org_policy_constraint::custom_constraint::ActionType,
8701 >,
8702 >(
8703 mut self,
8704 v: T,
8705 ) -> Self {
8706 self.action_type = v.into();
8707 self
8708 }
8709
8710 /// Sets the value of [display_name][crate::model::analyzer_org_policy_constraint::CustomConstraint::display_name].
8711 ///
8712 /// # Example
8713 /// ```ignore,no_run
8714 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8715 /// let x = CustomConstraint::new().set_display_name("example");
8716 /// ```
8717 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
8718 mut self,
8719 v: T,
8720 ) -> Self {
8721 self.display_name = v.into();
8722 self
8723 }
8724
8725 /// Sets the value of [description][crate::model::analyzer_org_policy_constraint::CustomConstraint::description].
8726 ///
8727 /// # Example
8728 /// ```ignore,no_run
8729 /// # use google_cloud_asset_v1::model::analyzer_org_policy_constraint::CustomConstraint;
8730 /// let x = CustomConstraint::new().set_description("example");
8731 /// ```
8732 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8733 self.description = v.into();
8734 self
8735 }
8736 }
8737
8738 impl wkt::message::Message for CustomConstraint {
8739 fn typename() -> &'static str {
8740 "type.googleapis.com/google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint"
8741 }
8742 }
8743
8744 /// Defines additional types related to [CustomConstraint].
8745 pub mod custom_constraint {
8746 #[allow(unused_imports)]
8747 use super::*;
8748
8749 /// The operation in which this constraint will be applied. For example:
8750 /// If the constraint applies only when create VMs, the method_types will be
8751 /// "CREATE" only. If the constraint applied when create or delete VMs, the
8752 /// method_types will be "CREATE" and "DELETE".
8753 ///
8754 /// # Working with unknown values
8755 ///
8756 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8757 /// additional enum variants at any time. Adding new variants is not considered
8758 /// a breaking change. Applications should write their code in anticipation of:
8759 ///
8760 /// - New values appearing in future releases of the client library, **and**
8761 /// - New values received dynamically, without application changes.
8762 ///
8763 /// Please consult the [Working with enums] section in the user guide for some
8764 /// guidelines.
8765 ///
8766 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8767 #[derive(Clone, Debug, PartialEq)]
8768 #[non_exhaustive]
8769 pub enum MethodType {
8770 /// Unspecified. Will results in user error.
8771 Unspecified,
8772 /// Constraint applied when creating the resource.
8773 Create,
8774 /// Constraint applied when updating the resource.
8775 Update,
8776 /// Constraint applied when deleting the resource.
8777 Delete,
8778 /// Constraint applied when removing an IAM grant.
8779 RemoveGrant,
8780 /// Constraint applied when enforcing forced tagging.
8781 GovernTags,
8782 /// If set, the enum was initialized with an unknown value.
8783 ///
8784 /// Applications can examine the value using [MethodType::value] or
8785 /// [MethodType::name].
8786 UnknownValue(method_type::UnknownValue),
8787 }
8788
8789 #[doc(hidden)]
8790 pub mod method_type {
8791 #[allow(unused_imports)]
8792 use super::*;
8793 #[derive(Clone, Debug, PartialEq)]
8794 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8795 }
8796
8797 impl MethodType {
8798 /// Gets the enum value.
8799 ///
8800 /// Returns `None` if the enum contains an unknown value deserialized from
8801 /// the string representation of enums.
8802 pub fn value(&self) -> std::option::Option<i32> {
8803 match self {
8804 Self::Unspecified => std::option::Option::Some(0),
8805 Self::Create => std::option::Option::Some(1),
8806 Self::Update => std::option::Option::Some(2),
8807 Self::Delete => std::option::Option::Some(3),
8808 Self::RemoveGrant => std::option::Option::Some(4),
8809 Self::GovernTags => std::option::Option::Some(5),
8810 Self::UnknownValue(u) => u.0.value(),
8811 }
8812 }
8813
8814 /// Gets the enum value as a string.
8815 ///
8816 /// Returns `None` if the enum contains an unknown value deserialized from
8817 /// the integer representation of enums.
8818 pub fn name(&self) -> std::option::Option<&str> {
8819 match self {
8820 Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
8821 Self::Create => std::option::Option::Some("CREATE"),
8822 Self::Update => std::option::Option::Some("UPDATE"),
8823 Self::Delete => std::option::Option::Some("DELETE"),
8824 Self::RemoveGrant => std::option::Option::Some("REMOVE_GRANT"),
8825 Self::GovernTags => std::option::Option::Some("GOVERN_TAGS"),
8826 Self::UnknownValue(u) => u.0.name(),
8827 }
8828 }
8829 }
8830
8831 impl std::default::Default for MethodType {
8832 fn default() -> Self {
8833 use std::convert::From;
8834 Self::from(0)
8835 }
8836 }
8837
8838 impl std::fmt::Display for MethodType {
8839 fn fmt(
8840 &self,
8841 f: &mut std::fmt::Formatter<'_>,
8842 ) -> std::result::Result<(), std::fmt::Error> {
8843 wkt::internal::display_enum(f, self.name(), self.value())
8844 }
8845 }
8846
8847 impl std::convert::From<i32> for MethodType {
8848 fn from(value: i32) -> Self {
8849 match value {
8850 0 => Self::Unspecified,
8851 1 => Self::Create,
8852 2 => Self::Update,
8853 3 => Self::Delete,
8854 4 => Self::RemoveGrant,
8855 5 => Self::GovernTags,
8856 _ => Self::UnknownValue(method_type::UnknownValue(
8857 wkt::internal::UnknownEnumValue::Integer(value),
8858 )),
8859 }
8860 }
8861 }
8862
8863 impl std::convert::From<&str> for MethodType {
8864 fn from(value: &str) -> Self {
8865 use std::string::ToString;
8866 match value {
8867 "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
8868 "CREATE" => Self::Create,
8869 "UPDATE" => Self::Update,
8870 "DELETE" => Self::Delete,
8871 "REMOVE_GRANT" => Self::RemoveGrant,
8872 "GOVERN_TAGS" => Self::GovernTags,
8873 _ => Self::UnknownValue(method_type::UnknownValue(
8874 wkt::internal::UnknownEnumValue::String(value.to_string()),
8875 )),
8876 }
8877 }
8878 }
8879
8880 impl serde::ser::Serialize for MethodType {
8881 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8882 where
8883 S: serde::Serializer,
8884 {
8885 match self {
8886 Self::Unspecified => serializer.serialize_i32(0),
8887 Self::Create => serializer.serialize_i32(1),
8888 Self::Update => serializer.serialize_i32(2),
8889 Self::Delete => serializer.serialize_i32(3),
8890 Self::RemoveGrant => serializer.serialize_i32(4),
8891 Self::GovernTags => serializer.serialize_i32(5),
8892 Self::UnknownValue(u) => u.0.serialize(serializer),
8893 }
8894 }
8895 }
8896
8897 impl<'de> serde::de::Deserialize<'de> for MethodType {
8898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8899 where
8900 D: serde::Deserializer<'de>,
8901 {
8902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
8903 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.MethodType"))
8904 }
8905 }
8906
8907 /// Allow or deny type.
8908 ///
8909 /// # Working with unknown values
8910 ///
8911 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8912 /// additional enum variants at any time. Adding new variants is not considered
8913 /// a breaking change. Applications should write their code in anticipation of:
8914 ///
8915 /// - New values appearing in future releases of the client library, **and**
8916 /// - New values received dynamically, without application changes.
8917 ///
8918 /// Please consult the [Working with enums] section in the user guide for some
8919 /// guidelines.
8920 ///
8921 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8922 #[derive(Clone, Debug, PartialEq)]
8923 #[non_exhaustive]
8924 pub enum ActionType {
8925 /// Unspecified. Will results in user error.
8926 Unspecified,
8927 /// Allowed action type.
8928 Allow,
8929 /// Deny action type.
8930 Deny,
8931 /// If set, the enum was initialized with an unknown value.
8932 ///
8933 /// Applications can examine the value using [ActionType::value] or
8934 /// [ActionType::name].
8935 UnknownValue(action_type::UnknownValue),
8936 }
8937
8938 #[doc(hidden)]
8939 pub mod action_type {
8940 #[allow(unused_imports)]
8941 use super::*;
8942 #[derive(Clone, Debug, PartialEq)]
8943 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8944 }
8945
8946 impl ActionType {
8947 /// Gets the enum value.
8948 ///
8949 /// Returns `None` if the enum contains an unknown value deserialized from
8950 /// the string representation of enums.
8951 pub fn value(&self) -> std::option::Option<i32> {
8952 match self {
8953 Self::Unspecified => std::option::Option::Some(0),
8954 Self::Allow => std::option::Option::Some(1),
8955 Self::Deny => std::option::Option::Some(2),
8956 Self::UnknownValue(u) => u.0.value(),
8957 }
8958 }
8959
8960 /// Gets the enum value as a string.
8961 ///
8962 /// Returns `None` if the enum contains an unknown value deserialized from
8963 /// the integer representation of enums.
8964 pub fn name(&self) -> std::option::Option<&str> {
8965 match self {
8966 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
8967 Self::Allow => std::option::Option::Some("ALLOW"),
8968 Self::Deny => std::option::Option::Some("DENY"),
8969 Self::UnknownValue(u) => u.0.name(),
8970 }
8971 }
8972 }
8973
8974 impl std::default::Default for ActionType {
8975 fn default() -> Self {
8976 use std::convert::From;
8977 Self::from(0)
8978 }
8979 }
8980
8981 impl std::fmt::Display for ActionType {
8982 fn fmt(
8983 &self,
8984 f: &mut std::fmt::Formatter<'_>,
8985 ) -> std::result::Result<(), std::fmt::Error> {
8986 wkt::internal::display_enum(f, self.name(), self.value())
8987 }
8988 }
8989
8990 impl std::convert::From<i32> for ActionType {
8991 fn from(value: i32) -> Self {
8992 match value {
8993 0 => Self::Unspecified,
8994 1 => Self::Allow,
8995 2 => Self::Deny,
8996 _ => Self::UnknownValue(action_type::UnknownValue(
8997 wkt::internal::UnknownEnumValue::Integer(value),
8998 )),
8999 }
9000 }
9001 }
9002
9003 impl std::convert::From<&str> for ActionType {
9004 fn from(value: &str) -> Self {
9005 use std::string::ToString;
9006 match value {
9007 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
9008 "ALLOW" => Self::Allow,
9009 "DENY" => Self::Deny,
9010 _ => Self::UnknownValue(action_type::UnknownValue(
9011 wkt::internal::UnknownEnumValue::String(value.to_string()),
9012 )),
9013 }
9014 }
9015 }
9016
9017 impl serde::ser::Serialize for ActionType {
9018 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9019 where
9020 S: serde::Serializer,
9021 {
9022 match self {
9023 Self::Unspecified => serializer.serialize_i32(0),
9024 Self::Allow => serializer.serialize_i32(1),
9025 Self::Deny => serializer.serialize_i32(2),
9026 Self::UnknownValue(u) => u.0.serialize(serializer),
9027 }
9028 }
9029 }
9030
9031 impl<'de> serde::de::Deserialize<'de> for ActionType {
9032 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9033 where
9034 D: serde::Deserializer<'de>,
9035 {
9036 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
9037 ".google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType"))
9038 }
9039 }
9040 }
9041
9042 #[derive(Clone, Debug, PartialEq)]
9043 #[non_exhaustive]
9044 pub enum ConstraintDefinition {
9045 /// The definition of the canned constraint defined by Google.
9046 GoogleDefinedConstraint(
9047 std::boxed::Box<crate::model::analyzer_org_policy_constraint::Constraint>,
9048 ),
9049 /// The definition of the custom constraint.
9050 CustomConstraint(
9051 std::boxed::Box<crate::model::analyzer_org_policy_constraint::CustomConstraint>,
9052 ),
9053 }
9054}
9055
9056/// A request message for
9057/// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies].
9058///
9059/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]: crate::client::AssetService::analyze_org_policies
9060#[derive(Clone, Default, PartialEq)]
9061#[non_exhaustive]
9062pub struct AnalyzeOrgPoliciesRequest {
9063 /// Required. The organization to scope the request. Only organization
9064 /// policies within the scope will be analyzed.
9065 ///
9066 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
9067 pub scope: std::string::String,
9068
9069 /// Required. The name of the constraint to analyze organization policies for.
9070 /// The response only contains analyzed organization policies for the provided
9071 /// constraint.
9072 pub constraint: std::string::String,
9073
9074 /// The expression to filter
9075 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results].
9076 /// Filtering is currently available for bare literal values and the following
9077 /// fields:
9078 ///
9079 /// * consolidated_policy.attached_resource
9080 /// * consolidated_policy.rules.enforce
9081 ///
9082 /// When filtering by a specific field, the only supported operator is `=`.
9083 /// For example, filtering by
9084 /// consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001"
9085 /// will return all the Organization Policy results attached to "folders/001".
9086 ///
9087 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
9088 pub filter: std::string::String,
9089
9090 /// The maximum number of items to return per page. If unspecified,
9091 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]
9092 /// will contain 20 items with a maximum of 200.
9093 ///
9094 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
9095 pub page_size: std::option::Option<i32>,
9096
9097 /// The pagination token to retrieve the next page.
9098 pub page_token: std::string::String,
9099
9100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9101}
9102
9103impl AnalyzeOrgPoliciesRequest {
9104 pub fn new() -> Self {
9105 std::default::Default::default()
9106 }
9107
9108 /// Sets the value of [scope][crate::model::AnalyzeOrgPoliciesRequest::scope].
9109 ///
9110 /// # Example
9111 /// ```ignore,no_run
9112 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9113 /// let x = AnalyzeOrgPoliciesRequest::new().set_scope("example");
9114 /// ```
9115 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9116 self.scope = v.into();
9117 self
9118 }
9119
9120 /// Sets the value of [constraint][crate::model::AnalyzeOrgPoliciesRequest::constraint].
9121 ///
9122 /// # Example
9123 /// ```ignore,no_run
9124 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9125 /// let x = AnalyzeOrgPoliciesRequest::new().set_constraint("example");
9126 /// ```
9127 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9128 self.constraint = v.into();
9129 self
9130 }
9131
9132 /// Sets the value of [filter][crate::model::AnalyzeOrgPoliciesRequest::filter].
9133 ///
9134 /// # Example
9135 /// ```ignore,no_run
9136 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9137 /// let x = AnalyzeOrgPoliciesRequest::new().set_filter("example");
9138 /// ```
9139 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9140 self.filter = v.into();
9141 self
9142 }
9143
9144 /// Sets the value of [page_size][crate::model::AnalyzeOrgPoliciesRequest::page_size].
9145 ///
9146 /// # Example
9147 /// ```ignore,no_run
9148 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9149 /// let x = AnalyzeOrgPoliciesRequest::new().set_page_size(42);
9150 /// ```
9151 pub fn set_page_size<T>(mut self, v: T) -> Self
9152 where
9153 T: std::convert::Into<i32>,
9154 {
9155 self.page_size = std::option::Option::Some(v.into());
9156 self
9157 }
9158
9159 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPoliciesRequest::page_size].
9160 ///
9161 /// # Example
9162 /// ```ignore,no_run
9163 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9164 /// let x = AnalyzeOrgPoliciesRequest::new().set_or_clear_page_size(Some(42));
9165 /// let x = AnalyzeOrgPoliciesRequest::new().set_or_clear_page_size(None::<i32>);
9166 /// ```
9167 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
9168 where
9169 T: std::convert::Into<i32>,
9170 {
9171 self.page_size = v.map(|x| x.into());
9172 self
9173 }
9174
9175 /// Sets the value of [page_token][crate::model::AnalyzeOrgPoliciesRequest::page_token].
9176 ///
9177 /// # Example
9178 /// ```ignore,no_run
9179 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesRequest;
9180 /// let x = AnalyzeOrgPoliciesRequest::new().set_page_token("example");
9181 /// ```
9182 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9183 self.page_token = v.into();
9184 self
9185 }
9186}
9187
9188impl wkt::message::Message for AnalyzeOrgPoliciesRequest {
9189 fn typename() -> &'static str {
9190 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesRequest"
9191 }
9192}
9193
9194/// The response message for
9195/// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies].
9196///
9197/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]: crate::client::AssetService::analyze_org_policies
9198#[derive(Clone, Default, PartialEq)]
9199#[non_exhaustive]
9200pub struct AnalyzeOrgPoliciesResponse {
9201 /// The organization policies under the
9202 /// [AnalyzeOrgPoliciesRequest.scope][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope]
9203 /// with the
9204 /// [AnalyzeOrgPoliciesRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint].
9205 ///
9206 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint]: crate::model::AnalyzeOrgPoliciesRequest::constraint
9207 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope]: crate::model::AnalyzeOrgPoliciesRequest::scope
9208 pub org_policy_results:
9209 std::vec::Vec<crate::model::analyze_org_policies_response::OrgPolicyResult>,
9210
9211 /// The definition of the constraint in the request.
9212 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
9213
9214 /// The page token to fetch the next page for
9215 /// [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results].
9216 ///
9217 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]: crate::model::AnalyzeOrgPoliciesResponse::org_policy_results
9218 pub next_page_token: std::string::String,
9219
9220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9221}
9222
9223impl AnalyzeOrgPoliciesResponse {
9224 pub fn new() -> Self {
9225 std::default::Default::default()
9226 }
9227
9228 /// Sets the value of [org_policy_results][crate::model::AnalyzeOrgPoliciesResponse::org_policy_results].
9229 ///
9230 /// # Example
9231 /// ```ignore,no_run
9232 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesResponse;
9233 /// use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9234 /// let x = AnalyzeOrgPoliciesResponse::new()
9235 /// .set_org_policy_results([
9236 /// OrgPolicyResult::default()/* use setters */,
9237 /// OrgPolicyResult::default()/* use (different) setters */,
9238 /// ]);
9239 /// ```
9240 pub fn set_org_policy_results<T, V>(mut self, v: T) -> Self
9241 where
9242 T: std::iter::IntoIterator<Item = V>,
9243 V: std::convert::Into<crate::model::analyze_org_policies_response::OrgPolicyResult>,
9244 {
9245 use std::iter::Iterator;
9246 self.org_policy_results = v.into_iter().map(|i| i.into()).collect();
9247 self
9248 }
9249
9250 /// Sets the value of [constraint][crate::model::AnalyzeOrgPoliciesResponse::constraint].
9251 ///
9252 /// # Example
9253 /// ```ignore,no_run
9254 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesResponse;
9255 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
9256 /// let x = AnalyzeOrgPoliciesResponse::new().set_constraint(AnalyzerOrgPolicyConstraint::default()/* use setters */);
9257 /// ```
9258 pub fn set_constraint<T>(mut self, v: T) -> Self
9259 where
9260 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
9261 {
9262 self.constraint = std::option::Option::Some(v.into());
9263 self
9264 }
9265
9266 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPoliciesResponse::constraint].
9267 ///
9268 /// # Example
9269 /// ```ignore,no_run
9270 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesResponse;
9271 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
9272 /// let x = AnalyzeOrgPoliciesResponse::new().set_or_clear_constraint(Some(AnalyzerOrgPolicyConstraint::default()/* use setters */));
9273 /// let x = AnalyzeOrgPoliciesResponse::new().set_or_clear_constraint(None::<AnalyzerOrgPolicyConstraint>);
9274 /// ```
9275 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
9276 where
9277 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
9278 {
9279 self.constraint = v.map(|x| x.into());
9280 self
9281 }
9282
9283 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPoliciesResponse::next_page_token].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_asset_v1::model::AnalyzeOrgPoliciesResponse;
9288 /// let x = AnalyzeOrgPoliciesResponse::new().set_next_page_token("example");
9289 /// ```
9290 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9291 self.next_page_token = v.into();
9292 self
9293 }
9294}
9295
9296impl wkt::message::Message for AnalyzeOrgPoliciesResponse {
9297 fn typename() -> &'static str {
9298 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesResponse"
9299 }
9300}
9301
9302#[doc(hidden)]
9303impl google_cloud_gax::paginator::internal::PageableResponse for AnalyzeOrgPoliciesResponse {
9304 type PageItem = crate::model::analyze_org_policies_response::OrgPolicyResult;
9305
9306 fn items(self) -> std::vec::Vec<Self::PageItem> {
9307 self.org_policy_results
9308 }
9309
9310 fn next_page_token(&self) -> std::string::String {
9311 use std::clone::Clone;
9312 self.next_page_token.clone()
9313 }
9314}
9315
9316/// Defines additional types related to [AnalyzeOrgPoliciesResponse].
9317pub mod analyze_org_policies_response {
9318 #[allow(unused_imports)]
9319 use super::*;
9320
9321 /// The organization policy result to the query.
9322 #[derive(Clone, Default, PartialEq)]
9323 #[non_exhaustive]
9324 pub struct OrgPolicyResult {
9325 /// The consolidated organization policy for the analyzed resource. The
9326 /// consolidated organization policy is computed by merging and evaluating
9327 /// [policy_bundle][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult.policy_bundle].
9328 /// The evaluation will respect the organization policy [hierarchy
9329 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
9330 ///
9331 /// [google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult.policy_bundle]: crate::model::analyze_org_policies_response::OrgPolicyResult::policy_bundle
9332 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
9333
9334 /// The ordered list of all organization policies from the
9335 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
9336 /// to the scope specified in the request.
9337 ///
9338 /// If the constraint is defined with default policy, it will also appear in
9339 /// the list.
9340 ///
9341 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
9342 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
9343
9344 /// The project that this consolidated policy belongs to, in the format of
9345 /// projects/{PROJECT_NUMBER}. This field is available when the consolidated
9346 /// policy belongs to a project.
9347 pub project: std::string::String,
9348
9349 /// The folder(s) that this consolidated policy belongs to, in the format of
9350 /// folders/{FOLDER_NUMBER}. This field is available when the consolidated
9351 /// policy belongs (directly or cascadingly) to one or more folders.
9352 pub folders: std::vec::Vec<std::string::String>,
9353
9354 /// The organization that this consolidated policy belongs to, in the format
9355 /// of organizations/{ORGANIZATION_NUMBER}. This field is available when the
9356 /// consolidated policy belongs (directly or cascadingly) to an organization.
9357 pub organization: std::string::String,
9358
9359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9360 }
9361
9362 impl OrgPolicyResult {
9363 pub fn new() -> Self {
9364 std::default::Default::default()
9365 }
9366
9367 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policies_response::OrgPolicyResult::consolidated_policy].
9368 ///
9369 /// # Example
9370 /// ```ignore,no_run
9371 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9372 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9373 /// let x = OrgPolicyResult::new().set_consolidated_policy(AnalyzerOrgPolicy::default()/* use setters */);
9374 /// ```
9375 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
9376 where
9377 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9378 {
9379 self.consolidated_policy = std::option::Option::Some(v.into());
9380 self
9381 }
9382
9383 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policies_response::OrgPolicyResult::consolidated_policy].
9384 ///
9385 /// # Example
9386 /// ```ignore,no_run
9387 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9388 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9389 /// let x = OrgPolicyResult::new().set_or_clear_consolidated_policy(Some(AnalyzerOrgPolicy::default()/* use setters */));
9390 /// let x = OrgPolicyResult::new().set_or_clear_consolidated_policy(None::<AnalyzerOrgPolicy>);
9391 /// ```
9392 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
9393 where
9394 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9395 {
9396 self.consolidated_policy = v.map(|x| x.into());
9397 self
9398 }
9399
9400 /// Sets the value of [policy_bundle][crate::model::analyze_org_policies_response::OrgPolicyResult::policy_bundle].
9401 ///
9402 /// # Example
9403 /// ```ignore,no_run
9404 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9405 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9406 /// let x = OrgPolicyResult::new()
9407 /// .set_policy_bundle([
9408 /// AnalyzerOrgPolicy::default()/* use setters */,
9409 /// AnalyzerOrgPolicy::default()/* use (different) setters */,
9410 /// ]);
9411 /// ```
9412 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
9413 where
9414 T: std::iter::IntoIterator<Item = V>,
9415 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9416 {
9417 use std::iter::Iterator;
9418 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
9419 self
9420 }
9421
9422 /// Sets the value of [project][crate::model::analyze_org_policies_response::OrgPolicyResult::project].
9423 ///
9424 /// # Example
9425 /// ```ignore,no_run
9426 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9427 /// let x = OrgPolicyResult::new().set_project("example");
9428 /// ```
9429 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9430 self.project = v.into();
9431 self
9432 }
9433
9434 /// Sets the value of [folders][crate::model::analyze_org_policies_response::OrgPolicyResult::folders].
9435 ///
9436 /// # Example
9437 /// ```ignore,no_run
9438 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9439 /// let x = OrgPolicyResult::new().set_folders(["a", "b", "c"]);
9440 /// ```
9441 pub fn set_folders<T, V>(mut self, v: T) -> Self
9442 where
9443 T: std::iter::IntoIterator<Item = V>,
9444 V: std::convert::Into<std::string::String>,
9445 {
9446 use std::iter::Iterator;
9447 self.folders = v.into_iter().map(|i| i.into()).collect();
9448 self
9449 }
9450
9451 /// Sets the value of [organization][crate::model::analyze_org_policies_response::OrgPolicyResult::organization].
9452 ///
9453 /// # Example
9454 /// ```ignore,no_run
9455 /// # use google_cloud_asset_v1::model::analyze_org_policies_response::OrgPolicyResult;
9456 /// let x = OrgPolicyResult::new().set_organization("example");
9457 /// ```
9458 pub fn set_organization<T: std::convert::Into<std::string::String>>(
9459 mut self,
9460 v: T,
9461 ) -> Self {
9462 self.organization = v.into();
9463 self
9464 }
9465 }
9466
9467 impl wkt::message::Message for OrgPolicyResult {
9468 fn typename() -> &'static str {
9469 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult"
9470 }
9471 }
9472}
9473
9474/// A request message for
9475/// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers].
9476///
9477/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]: crate::client::AssetService::analyze_org_policy_governed_containers
9478#[derive(Clone, Default, PartialEq)]
9479#[non_exhaustive]
9480pub struct AnalyzeOrgPolicyGovernedContainersRequest {
9481 /// Required. The organization to scope the request. Only organization
9482 /// policies within the scope will be analyzed. The output containers will
9483 /// also be limited to the ones governed by those in-scope organization
9484 /// policies.
9485 ///
9486 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
9487 pub scope: std::string::String,
9488
9489 /// Required. The name of the constraint to analyze governed containers for.
9490 /// The analysis only contains organization policies for the provided
9491 /// constraint.
9492 pub constraint: std::string::String,
9493
9494 /// The expression to filter
9495 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers].
9496 /// Filtering is currently available for bare literal values and the following
9497 /// fields:
9498 ///
9499 /// * parent
9500 /// * consolidated_policy.rules.enforce
9501 ///
9502 /// When filtering by a specific field, the only supported operator is `=`.
9503 /// For example, filtering by
9504 /// parent="//cloudresourcemanager.googleapis.com/folders/001"
9505 /// will return all the containers under "folders/001".
9506 ///
9507 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
9508 pub filter: std::string::String,
9509
9510 /// The maximum number of items to return per page. If unspecified,
9511 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]
9512 /// will contain 100 items with a maximum of 200.
9513 ///
9514 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
9515 pub page_size: std::option::Option<i32>,
9516
9517 /// The pagination token to retrieve the next page.
9518 pub page_token: std::string::String,
9519
9520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9521}
9522
9523impl AnalyzeOrgPolicyGovernedContainersRequest {
9524 pub fn new() -> Self {
9525 std::default::Default::default()
9526 }
9527
9528 /// Sets the value of [scope][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::scope].
9529 ///
9530 /// # Example
9531 /// ```ignore,no_run
9532 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9533 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_scope("example");
9534 /// ```
9535 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9536 self.scope = v.into();
9537 self
9538 }
9539
9540 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::constraint].
9541 ///
9542 /// # Example
9543 /// ```ignore,no_run
9544 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9545 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_constraint("example");
9546 /// ```
9547 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9548 self.constraint = v.into();
9549 self
9550 }
9551
9552 /// Sets the value of [filter][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::filter].
9553 ///
9554 /// # Example
9555 /// ```ignore,no_run
9556 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9557 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_filter("example");
9558 /// ```
9559 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9560 self.filter = v.into();
9561 self
9562 }
9563
9564 /// Sets the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_size].
9565 ///
9566 /// # Example
9567 /// ```ignore,no_run
9568 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9569 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_page_size(42);
9570 /// ```
9571 pub fn set_page_size<T>(mut self, v: T) -> Self
9572 where
9573 T: std::convert::Into<i32>,
9574 {
9575 self.page_size = std::option::Option::Some(v.into());
9576 self
9577 }
9578
9579 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_size].
9580 ///
9581 /// # Example
9582 /// ```ignore,no_run
9583 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9584 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_or_clear_page_size(Some(42));
9585 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_or_clear_page_size(None::<i32>);
9586 /// ```
9587 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
9588 where
9589 T: std::convert::Into<i32>,
9590 {
9591 self.page_size = v.map(|x| x.into());
9592 self
9593 }
9594
9595 /// Sets the value of [page_token][crate::model::AnalyzeOrgPolicyGovernedContainersRequest::page_token].
9596 ///
9597 /// # Example
9598 /// ```ignore,no_run
9599 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersRequest;
9600 /// let x = AnalyzeOrgPolicyGovernedContainersRequest::new().set_page_token("example");
9601 /// ```
9602 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9603 self.page_token = v.into();
9604 self
9605 }
9606}
9607
9608impl wkt::message::Message for AnalyzeOrgPolicyGovernedContainersRequest {
9609 fn typename() -> &'static str {
9610 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest"
9611 }
9612}
9613
9614/// The response message for
9615/// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers].
9616///
9617/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]: crate::client::AssetService::analyze_org_policy_governed_containers
9618#[derive(Clone, Default, PartialEq)]
9619#[non_exhaustive]
9620pub struct AnalyzeOrgPolicyGovernedContainersResponse {
9621 /// The list of the analyzed governed containers.
9622 pub governed_containers: std::vec::Vec<
9623 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer,
9624 >,
9625
9626 /// The definition of the constraint in the request.
9627 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
9628
9629 /// The page token to fetch the next page for
9630 /// [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers].
9631 ///
9632 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]: crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers
9633 pub next_page_token: std::string::String,
9634
9635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9636}
9637
9638impl AnalyzeOrgPolicyGovernedContainersResponse {
9639 pub fn new() -> Self {
9640 std::default::Default::default()
9641 }
9642
9643 /// Sets the value of [governed_containers][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::governed_containers].
9644 ///
9645 /// # Example
9646 /// ```ignore,no_run
9647 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersResponse;
9648 /// use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9649 /// let x = AnalyzeOrgPolicyGovernedContainersResponse::new()
9650 /// .set_governed_containers([
9651 /// GovernedContainer::default()/* use setters */,
9652 /// GovernedContainer::default()/* use (different) setters */,
9653 /// ]);
9654 /// ```
9655 pub fn set_governed_containers<T, V>(mut self, v: T) -> Self
9656 where
9657 T: std::iter::IntoIterator<Item = V>,
9658 V: std::convert::Into<
9659 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer,
9660 >,
9661 {
9662 use std::iter::Iterator;
9663 self.governed_containers = v.into_iter().map(|i| i.into()).collect();
9664 self
9665 }
9666
9667 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::constraint].
9668 ///
9669 /// # Example
9670 /// ```ignore,no_run
9671 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersResponse;
9672 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
9673 /// let x = AnalyzeOrgPolicyGovernedContainersResponse::new().set_constraint(AnalyzerOrgPolicyConstraint::default()/* use setters */);
9674 /// ```
9675 pub fn set_constraint<T>(mut self, v: T) -> Self
9676 where
9677 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
9678 {
9679 self.constraint = std::option::Option::Some(v.into());
9680 self
9681 }
9682
9683 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::constraint].
9684 ///
9685 /// # Example
9686 /// ```ignore,no_run
9687 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersResponse;
9688 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
9689 /// let x = AnalyzeOrgPolicyGovernedContainersResponse::new().set_or_clear_constraint(Some(AnalyzerOrgPolicyConstraint::default()/* use setters */));
9690 /// let x = AnalyzeOrgPolicyGovernedContainersResponse::new().set_or_clear_constraint(None::<AnalyzerOrgPolicyConstraint>);
9691 /// ```
9692 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
9693 where
9694 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
9695 {
9696 self.constraint = v.map(|x| x.into());
9697 self
9698 }
9699
9700 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPolicyGovernedContainersResponse::next_page_token].
9701 ///
9702 /// # Example
9703 /// ```ignore,no_run
9704 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedContainersResponse;
9705 /// let x = AnalyzeOrgPolicyGovernedContainersResponse::new().set_next_page_token("example");
9706 /// ```
9707 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9708 self.next_page_token = v.into();
9709 self
9710 }
9711}
9712
9713impl wkt::message::Message for AnalyzeOrgPolicyGovernedContainersResponse {
9714 fn typename() -> &'static str {
9715 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse"
9716 }
9717}
9718
9719#[doc(hidden)]
9720impl google_cloud_gax::paginator::internal::PageableResponse
9721 for AnalyzeOrgPolicyGovernedContainersResponse
9722{
9723 type PageItem =
9724 crate::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9725
9726 fn items(self) -> std::vec::Vec<Self::PageItem> {
9727 self.governed_containers
9728 }
9729
9730 fn next_page_token(&self) -> std::string::String {
9731 use std::clone::Clone;
9732 self.next_page_token.clone()
9733 }
9734}
9735
9736/// Defines additional types related to [AnalyzeOrgPolicyGovernedContainersResponse].
9737pub mod analyze_org_policy_governed_containers_response {
9738 #[allow(unused_imports)]
9739 use super::*;
9740
9741 /// The organization/folder/project resource governed by organization policies
9742 /// of
9743 /// [AnalyzeOrgPolicyGovernedContainersRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest.constraint].
9744 ///
9745 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedContainersRequest::constraint
9746 #[derive(Clone, Default, PartialEq)]
9747 #[non_exhaustive]
9748 pub struct GovernedContainer {
9749 /// The [full resource name]
9750 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
9751 /// an organization/folder/project resource.
9752 pub full_resource_name: std::string::String,
9753
9754 /// The [full resource name]
9755 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
9756 /// the parent of
9757 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name].
9758 ///
9759 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::full_resource_name
9760 pub parent: std::string::String,
9761
9762 /// The consolidated organization policy for the analyzed resource. The
9763 /// consolidated organization policy is computed by merging and evaluating
9764 /// [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle].
9765 /// The evaluation will respect the organization policy [hierarchy
9766 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
9767 ///
9768 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle]: crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::policy_bundle
9769 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
9770
9771 /// The ordered list of all organization policies from the
9772 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
9773 /// to the scope specified in the request.
9774 ///
9775 /// If the constraint is defined with default policy, it will also appear in
9776 /// the list.
9777 ///
9778 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
9779 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
9780
9781 /// The project that this resource belongs to, in the format of
9782 /// projects/{PROJECT_NUMBER}. This field is available when the resource
9783 /// belongs to a project.
9784 pub project: std::string::String,
9785
9786 /// The folder(s) that this resource belongs to, in the format of
9787 /// folders/{FOLDER_NUMBER}. This field is available when the resource
9788 /// belongs (directly or cascadingly) to one or more folders.
9789 pub folders: std::vec::Vec<std::string::String>,
9790
9791 /// The organization that this resource belongs to, in the format of
9792 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
9793 /// resource belongs (directly or cascadingly) to an organization.
9794 pub organization: std::string::String,
9795
9796 /// The effective tags on this resource.
9797 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
9798
9799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9800 }
9801
9802 impl GovernedContainer {
9803 pub fn new() -> Self {
9804 std::default::Default::default()
9805 }
9806
9807 /// Sets the value of [full_resource_name][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::full_resource_name].
9808 ///
9809 /// # Example
9810 /// ```ignore,no_run
9811 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9812 /// let x = GovernedContainer::new().set_full_resource_name("example");
9813 /// ```
9814 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
9815 mut self,
9816 v: T,
9817 ) -> Self {
9818 self.full_resource_name = v.into();
9819 self
9820 }
9821
9822 /// Sets the value of [parent][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::parent].
9823 ///
9824 /// # Example
9825 /// ```ignore,no_run
9826 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9827 /// let x = GovernedContainer::new().set_parent("example");
9828 /// ```
9829 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9830 self.parent = v.into();
9831 self
9832 }
9833
9834 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy].
9835 ///
9836 /// # Example
9837 /// ```ignore,no_run
9838 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9839 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9840 /// let x = GovernedContainer::new().set_consolidated_policy(AnalyzerOrgPolicy::default()/* use setters */);
9841 /// ```
9842 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
9843 where
9844 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9845 {
9846 self.consolidated_policy = std::option::Option::Some(v.into());
9847 self
9848 }
9849
9850 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::consolidated_policy].
9851 ///
9852 /// # Example
9853 /// ```ignore,no_run
9854 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9855 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9856 /// let x = GovernedContainer::new().set_or_clear_consolidated_policy(Some(AnalyzerOrgPolicy::default()/* use setters */));
9857 /// let x = GovernedContainer::new().set_or_clear_consolidated_policy(None::<AnalyzerOrgPolicy>);
9858 /// ```
9859 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
9860 where
9861 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9862 {
9863 self.consolidated_policy = v.map(|x| x.into());
9864 self
9865 }
9866
9867 /// Sets the value of [policy_bundle][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::policy_bundle].
9868 ///
9869 /// # Example
9870 /// ```ignore,no_run
9871 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9872 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
9873 /// let x = GovernedContainer::new()
9874 /// .set_policy_bundle([
9875 /// AnalyzerOrgPolicy::default()/* use setters */,
9876 /// AnalyzerOrgPolicy::default()/* use (different) setters */,
9877 /// ]);
9878 /// ```
9879 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
9880 where
9881 T: std::iter::IntoIterator<Item = V>,
9882 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
9883 {
9884 use std::iter::Iterator;
9885 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
9886 self
9887 }
9888
9889 /// Sets the value of [project][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::project].
9890 ///
9891 /// # Example
9892 /// ```ignore,no_run
9893 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9894 /// let x = GovernedContainer::new().set_project("example");
9895 /// ```
9896 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9897 self.project = v.into();
9898 self
9899 }
9900
9901 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::folders].
9902 ///
9903 /// # Example
9904 /// ```ignore,no_run
9905 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9906 /// let x = GovernedContainer::new().set_folders(["a", "b", "c"]);
9907 /// ```
9908 pub fn set_folders<T, V>(mut self, v: T) -> Self
9909 where
9910 T: std::iter::IntoIterator<Item = V>,
9911 V: std::convert::Into<std::string::String>,
9912 {
9913 use std::iter::Iterator;
9914 self.folders = v.into_iter().map(|i| i.into()).collect();
9915 self
9916 }
9917
9918 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::organization].
9919 ///
9920 /// # Example
9921 /// ```ignore,no_run
9922 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9923 /// let x = GovernedContainer::new().set_organization("example");
9924 /// ```
9925 pub fn set_organization<T: std::convert::Into<std::string::String>>(
9926 mut self,
9927 v: T,
9928 ) -> Self {
9929 self.organization = v.into();
9930 self
9931 }
9932
9933 /// Sets the value of [effective_tags][crate::model::analyze_org_policy_governed_containers_response::GovernedContainer::effective_tags].
9934 ///
9935 /// # Example
9936 /// ```ignore,no_run
9937 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_containers_response::GovernedContainer;
9938 /// use google_cloud_asset_v1::model::EffectiveTagDetails;
9939 /// let x = GovernedContainer::new()
9940 /// .set_effective_tags([
9941 /// EffectiveTagDetails::default()/* use setters */,
9942 /// EffectiveTagDetails::default()/* use (different) setters */,
9943 /// ]);
9944 /// ```
9945 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
9946 where
9947 T: std::iter::IntoIterator<Item = V>,
9948 V: std::convert::Into<crate::model::EffectiveTagDetails>,
9949 {
9950 use std::iter::Iterator;
9951 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
9952 self
9953 }
9954 }
9955
9956 impl wkt::message::Message for GovernedContainer {
9957 fn typename() -> &'static str {
9958 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer"
9959 }
9960 }
9961}
9962
9963/// A request message for
9964/// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets].
9965///
9966/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]: crate::client::AssetService::analyze_org_policy_governed_assets
9967#[derive(Clone, Default, PartialEq)]
9968#[non_exhaustive]
9969pub struct AnalyzeOrgPolicyGovernedAssetsRequest {
9970 /// Required. The organization to scope the request. Only organization
9971 /// policies within the scope will be analyzed. The output assets will
9972 /// also be limited to the ones governed by those in-scope organization
9973 /// policies.
9974 ///
9975 /// * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
9976 pub scope: std::string::String,
9977
9978 /// Required. The name of the constraint to analyze governed assets for. The
9979 /// analysis only contains analyzed organization policies for the provided
9980 /// constraint.
9981 pub constraint: std::string::String,
9982
9983 /// The expression to filter
9984 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets].
9985 ///
9986 /// For governed resources, filtering is currently available for bare literal
9987 /// values and the following fields:
9988 ///
9989 /// * governed_resource.project
9990 /// * governed_resource.folders
9991 /// * consolidated_policy.rules.enforce
9992 /// When filtering by `governed_resource.project` or
9993 /// `consolidated_policy.rules.enforce`, the only supported operator is `=`.
9994 /// When filtering by `governed_resource.folders`, the supported operators
9995 /// are `=` and `:`.
9996 /// For example, filtering by `governed_resource.project="projects/12345678"`
9997 /// will return all the governed resources under "projects/12345678",
9998 /// including the project itself if applicable.
9999 ///
10000 /// For governed IAM policies, filtering is currently available for bare
10001 /// literal values and the following fields:
10002 ///
10003 /// * governed_iam_policy.project
10004 /// * governed_iam_policy.folders
10005 /// * consolidated_policy.rules.enforce
10006 /// When filtering by `governed_iam_policy.project` or
10007 /// `consolidated_policy.rules.enforce`, the only supported operator is `=`.
10008 /// When filtering by `governed_iam_policy.folders`, the supported operators
10009 /// are `=` and `:`.
10010 /// For example, filtering by `governed_iam_policy.folders:"folders/12345678"`
10011 /// will return all the governed IAM policies under "folders/001".
10012 ///
10013 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
10014 pub filter: std::string::String,
10015
10016 /// The maximum number of items to return per page. If unspecified,
10017 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]
10018 /// will contain 100 items with a maximum of 200.
10019 ///
10020 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
10021 pub page_size: std::option::Option<i32>,
10022
10023 /// The pagination token to retrieve the next page.
10024 pub page_token: std::string::String,
10025
10026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10027}
10028
10029impl AnalyzeOrgPolicyGovernedAssetsRequest {
10030 pub fn new() -> Self {
10031 std::default::Default::default()
10032 }
10033
10034 /// Sets the value of [scope][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::scope].
10035 ///
10036 /// # Example
10037 /// ```ignore,no_run
10038 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10039 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_scope("example");
10040 /// ```
10041 pub fn set_scope<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10042 self.scope = v.into();
10043 self
10044 }
10045
10046 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint].
10047 ///
10048 /// # Example
10049 /// ```ignore,no_run
10050 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10051 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_constraint("example");
10052 /// ```
10053 pub fn set_constraint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10054 self.constraint = v.into();
10055 self
10056 }
10057
10058 /// Sets the value of [filter][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::filter].
10059 ///
10060 /// # Example
10061 /// ```ignore,no_run
10062 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10063 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_filter("example");
10064 /// ```
10065 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10066 self.filter = v.into();
10067 self
10068 }
10069
10070 /// Sets the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_size].
10071 ///
10072 /// # Example
10073 /// ```ignore,no_run
10074 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10075 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_page_size(42);
10076 /// ```
10077 pub fn set_page_size<T>(mut self, v: T) -> Self
10078 where
10079 T: std::convert::Into<i32>,
10080 {
10081 self.page_size = std::option::Option::Some(v.into());
10082 self
10083 }
10084
10085 /// Sets or clears the value of [page_size][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_size].
10086 ///
10087 /// # Example
10088 /// ```ignore,no_run
10089 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10090 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_or_clear_page_size(Some(42));
10091 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_or_clear_page_size(None::<i32>);
10092 /// ```
10093 pub fn set_or_clear_page_size<T>(mut self, v: std::option::Option<T>) -> Self
10094 where
10095 T: std::convert::Into<i32>,
10096 {
10097 self.page_size = v.map(|x| x.into());
10098 self
10099 }
10100
10101 /// Sets the value of [page_token][crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::page_token].
10102 ///
10103 /// # Example
10104 /// ```ignore,no_run
10105 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsRequest;
10106 /// let x = AnalyzeOrgPolicyGovernedAssetsRequest::new().set_page_token("example");
10107 /// ```
10108 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10109 self.page_token = v.into();
10110 self
10111 }
10112}
10113
10114impl wkt::message::Message for AnalyzeOrgPolicyGovernedAssetsRequest {
10115 fn typename() -> &'static str {
10116 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest"
10117 }
10118}
10119
10120/// The response message for
10121/// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets].
10122///
10123/// [google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]: crate::client::AssetService::analyze_org_policy_governed_assets
10124#[derive(Clone, Default, PartialEq)]
10125#[non_exhaustive]
10126pub struct AnalyzeOrgPolicyGovernedAssetsResponse {
10127 /// The list of the analyzed governed assets.
10128 pub governed_assets:
10129 std::vec::Vec<crate::model::analyze_org_policy_governed_assets_response::GovernedAsset>,
10130
10131 /// The definition of the constraint in the request.
10132 pub constraint: std::option::Option<crate::model::AnalyzerOrgPolicyConstraint>,
10133
10134 /// The page token to fetch the next page for
10135 /// [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets].
10136 ///
10137 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]: crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets
10138 pub next_page_token: std::string::String,
10139
10140 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10141}
10142
10143impl AnalyzeOrgPolicyGovernedAssetsResponse {
10144 pub fn new() -> Self {
10145 std::default::Default::default()
10146 }
10147
10148 /// Sets the value of [governed_assets][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::governed_assets].
10149 ///
10150 /// # Example
10151 /// ```ignore,no_run
10152 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsResponse;
10153 /// use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10154 /// let x = AnalyzeOrgPolicyGovernedAssetsResponse::new()
10155 /// .set_governed_assets([
10156 /// GovernedAsset::default()/* use setters */,
10157 /// GovernedAsset::default()/* use (different) setters */,
10158 /// ]);
10159 /// ```
10160 pub fn set_governed_assets<T, V>(mut self, v: T) -> Self
10161 where
10162 T: std::iter::IntoIterator<Item = V>,
10163 V: std::convert::Into<
10164 crate::model::analyze_org_policy_governed_assets_response::GovernedAsset,
10165 >,
10166 {
10167 use std::iter::Iterator;
10168 self.governed_assets = v.into_iter().map(|i| i.into()).collect();
10169 self
10170 }
10171
10172 /// Sets the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::constraint].
10173 ///
10174 /// # Example
10175 /// ```ignore,no_run
10176 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsResponse;
10177 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
10178 /// let x = AnalyzeOrgPolicyGovernedAssetsResponse::new().set_constraint(AnalyzerOrgPolicyConstraint::default()/* use setters */);
10179 /// ```
10180 pub fn set_constraint<T>(mut self, v: T) -> Self
10181 where
10182 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
10183 {
10184 self.constraint = std::option::Option::Some(v.into());
10185 self
10186 }
10187
10188 /// Sets or clears the value of [constraint][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::constraint].
10189 ///
10190 /// # Example
10191 /// ```ignore,no_run
10192 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsResponse;
10193 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicyConstraint;
10194 /// let x = AnalyzeOrgPolicyGovernedAssetsResponse::new().set_or_clear_constraint(Some(AnalyzerOrgPolicyConstraint::default()/* use setters */));
10195 /// let x = AnalyzeOrgPolicyGovernedAssetsResponse::new().set_or_clear_constraint(None::<AnalyzerOrgPolicyConstraint>);
10196 /// ```
10197 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
10198 where
10199 T: std::convert::Into<crate::model::AnalyzerOrgPolicyConstraint>,
10200 {
10201 self.constraint = v.map(|x| x.into());
10202 self
10203 }
10204
10205 /// Sets the value of [next_page_token][crate::model::AnalyzeOrgPolicyGovernedAssetsResponse::next_page_token].
10206 ///
10207 /// # Example
10208 /// ```ignore,no_run
10209 /// # use google_cloud_asset_v1::model::AnalyzeOrgPolicyGovernedAssetsResponse;
10210 /// let x = AnalyzeOrgPolicyGovernedAssetsResponse::new().set_next_page_token("example");
10211 /// ```
10212 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10213 self.next_page_token = v.into();
10214 self
10215 }
10216}
10217
10218impl wkt::message::Message for AnalyzeOrgPolicyGovernedAssetsResponse {
10219 fn typename() -> &'static str {
10220 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse"
10221 }
10222}
10223
10224#[doc(hidden)]
10225impl google_cloud_gax::paginator::internal::PageableResponse
10226 for AnalyzeOrgPolicyGovernedAssetsResponse
10227{
10228 type PageItem = crate::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10229
10230 fn items(self) -> std::vec::Vec<Self::PageItem> {
10231 self.governed_assets
10232 }
10233
10234 fn next_page_token(&self) -> std::string::String {
10235 use std::clone::Clone;
10236 self.next_page_token.clone()
10237 }
10238}
10239
10240/// Defines additional types related to [AnalyzeOrgPolicyGovernedAssetsResponse].
10241pub mod analyze_org_policy_governed_assets_response {
10242 #[allow(unused_imports)]
10243 use super::*;
10244
10245 /// The Google Cloud resources governed by the organization policies of the
10246 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
10247 ///
10248 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
10249 #[derive(Clone, Default, PartialEq)]
10250 #[non_exhaustive]
10251 pub struct GovernedResource {
10252 /// The [full resource name]
10253 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
10254 /// the Google Cloud resource.
10255 pub full_resource_name: std::string::String,
10256
10257 /// The [full resource name]
10258 /// (<https://cloud.google.com/asset-inventory/docs/resource-name-format>) of
10259 /// the parent of
10260 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name].
10261 ///
10262 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]: crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name
10263 pub parent: std::string::String,
10264
10265 /// The project that this resource belongs to, in the format of
10266 /// projects/{PROJECT_NUMBER}. This field is available when the resource
10267 /// belongs to a project.
10268 pub project: std::string::String,
10269
10270 /// The folder(s) that this resource belongs to, in the format of
10271 /// folders/{FOLDER_NUMBER}. This field is available when the resource
10272 /// belongs (directly or cascadingly) to one or more folders.
10273 pub folders: std::vec::Vec<std::string::String>,
10274
10275 /// The organization that this resource belongs to, in the format of
10276 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
10277 /// resource belongs (directly or cascadingly) to an organization.
10278 pub organization: std::string::String,
10279
10280 /// The asset type of the
10281 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]
10282 /// Example:
10283 /// `cloudresourcemanager.googleapis.com/Project`
10284 /// See [Cloud Asset Inventory Supported Asset
10285 /// Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
10286 /// for all supported asset types.
10287 ///
10288 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]: crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name
10289 pub asset_type: std::string::String,
10290
10291 /// The effective tags on this resource.
10292 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
10293
10294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10295 }
10296
10297 impl GovernedResource {
10298 pub fn new() -> Self {
10299 std::default::Default::default()
10300 }
10301
10302 /// Sets the value of [full_resource_name][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::full_resource_name].
10303 ///
10304 /// # Example
10305 /// ```ignore,no_run
10306 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10307 /// let x = GovernedResource::new().set_full_resource_name("example");
10308 /// ```
10309 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
10310 mut self,
10311 v: T,
10312 ) -> Self {
10313 self.full_resource_name = v.into();
10314 self
10315 }
10316
10317 /// Sets the value of [parent][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::parent].
10318 ///
10319 /// # Example
10320 /// ```ignore,no_run
10321 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10322 /// let x = GovernedResource::new().set_parent("example");
10323 /// ```
10324 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10325 self.parent = v.into();
10326 self
10327 }
10328
10329 /// Sets the value of [project][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::project].
10330 ///
10331 /// # Example
10332 /// ```ignore,no_run
10333 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10334 /// let x = GovernedResource::new().set_project("example");
10335 /// ```
10336 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10337 self.project = v.into();
10338 self
10339 }
10340
10341 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::folders].
10342 ///
10343 /// # Example
10344 /// ```ignore,no_run
10345 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10346 /// let x = GovernedResource::new().set_folders(["a", "b", "c"]);
10347 /// ```
10348 pub fn set_folders<T, V>(mut self, v: T) -> Self
10349 where
10350 T: std::iter::IntoIterator<Item = V>,
10351 V: std::convert::Into<std::string::String>,
10352 {
10353 use std::iter::Iterator;
10354 self.folders = v.into_iter().map(|i| i.into()).collect();
10355 self
10356 }
10357
10358 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::organization].
10359 ///
10360 /// # Example
10361 /// ```ignore,no_run
10362 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10363 /// let x = GovernedResource::new().set_organization("example");
10364 /// ```
10365 pub fn set_organization<T: std::convert::Into<std::string::String>>(
10366 mut self,
10367 v: T,
10368 ) -> Self {
10369 self.organization = v.into();
10370 self
10371 }
10372
10373 /// Sets the value of [asset_type][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::asset_type].
10374 ///
10375 /// # Example
10376 /// ```ignore,no_run
10377 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10378 /// let x = GovernedResource::new().set_asset_type("example");
10379 /// ```
10380 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10381 self.asset_type = v.into();
10382 self
10383 }
10384
10385 /// Sets the value of [effective_tags][crate::model::analyze_org_policy_governed_assets_response::GovernedResource::effective_tags].
10386 ///
10387 /// # Example
10388 /// ```ignore,no_run
10389 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10390 /// use google_cloud_asset_v1::model::EffectiveTagDetails;
10391 /// let x = GovernedResource::new()
10392 /// .set_effective_tags([
10393 /// EffectiveTagDetails::default()/* use setters */,
10394 /// EffectiveTagDetails::default()/* use (different) setters */,
10395 /// ]);
10396 /// ```
10397 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
10398 where
10399 T: std::iter::IntoIterator<Item = V>,
10400 V: std::convert::Into<crate::model::EffectiveTagDetails>,
10401 {
10402 use std::iter::Iterator;
10403 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
10404 self
10405 }
10406 }
10407
10408 impl wkt::message::Message for GovernedResource {
10409 fn typename() -> &'static str {
10410 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource"
10411 }
10412 }
10413
10414 /// The IAM policies governed by the organization policies of the
10415 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
10416 ///
10417 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
10418 #[derive(Clone, Default, PartialEq)]
10419 #[non_exhaustive]
10420 pub struct GovernedIamPolicy {
10421 /// The full resource name of the resource on which this IAM policy is set.
10422 /// Example:
10423 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
10424 /// See [Cloud Asset Inventory Resource Name
10425 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
10426 /// for more information.
10427 pub attached_resource: std::string::String,
10428
10429 /// The IAM policy directly set on the given resource.
10430 pub policy: std::option::Option<google_cloud_iam_v1::model::Policy>,
10431
10432 /// The project that this IAM policy belongs to, in the format of
10433 /// projects/{PROJECT_NUMBER}. This field is available when the IAM policy
10434 /// belongs to a project.
10435 pub project: std::string::String,
10436
10437 /// The folder(s) that this IAM policy belongs to, in the format of
10438 /// folders/{FOLDER_NUMBER}. This field is available when the IAM policy
10439 /// belongs (directly or cascadingly) to one or more folders.
10440 pub folders: std::vec::Vec<std::string::String>,
10441
10442 /// The organization that this IAM policy belongs to, in the format of
10443 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
10444 /// IAM policy belongs (directly or cascadingly) to an organization.
10445 pub organization: std::string::String,
10446
10447 /// The asset type of the
10448 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource].
10449 /// Example:
10450 /// `cloudresourcemanager.googleapis.com/Project`
10451 /// See [Cloud Asset Inventory Supported Asset
10452 /// Types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
10453 /// for all supported asset types.
10454 ///
10455 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy.attached_resource]: crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::attached_resource
10456 pub asset_type: std::string::String,
10457
10458 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10459 }
10460
10461 impl GovernedIamPolicy {
10462 pub fn new() -> Self {
10463 std::default::Default::default()
10464 }
10465
10466 /// Sets the value of [attached_resource][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::attached_resource].
10467 ///
10468 /// # Example
10469 /// ```ignore,no_run
10470 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10471 /// let x = GovernedIamPolicy::new().set_attached_resource("example");
10472 /// ```
10473 pub fn set_attached_resource<T: std::convert::Into<std::string::String>>(
10474 mut self,
10475 v: T,
10476 ) -> Self {
10477 self.attached_resource = v.into();
10478 self
10479 }
10480
10481 /// Sets the value of [policy][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::policy].
10482 ///
10483 /// # Example
10484 /// ```ignore,no_run
10485 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10486 /// use google_cloud_iam_v1::model::Policy;
10487 /// let x = GovernedIamPolicy::new().set_policy(Policy::default()/* use setters */);
10488 /// ```
10489 pub fn set_policy<T>(mut self, v: T) -> Self
10490 where
10491 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
10492 {
10493 self.policy = std::option::Option::Some(v.into());
10494 self
10495 }
10496
10497 /// Sets or clears the value of [policy][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::policy].
10498 ///
10499 /// # Example
10500 /// ```ignore,no_run
10501 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10502 /// use google_cloud_iam_v1::model::Policy;
10503 /// let x = GovernedIamPolicy::new().set_or_clear_policy(Some(Policy::default()/* use setters */));
10504 /// let x = GovernedIamPolicy::new().set_or_clear_policy(None::<Policy>);
10505 /// ```
10506 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
10507 where
10508 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
10509 {
10510 self.policy = v.map(|x| x.into());
10511 self
10512 }
10513
10514 /// Sets the value of [project][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::project].
10515 ///
10516 /// # Example
10517 /// ```ignore,no_run
10518 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10519 /// let x = GovernedIamPolicy::new().set_project("example");
10520 /// ```
10521 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10522 self.project = v.into();
10523 self
10524 }
10525
10526 /// Sets the value of [folders][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::folders].
10527 ///
10528 /// # Example
10529 /// ```ignore,no_run
10530 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10531 /// let x = GovernedIamPolicy::new().set_folders(["a", "b", "c"]);
10532 /// ```
10533 pub fn set_folders<T, V>(mut self, v: T) -> Self
10534 where
10535 T: std::iter::IntoIterator<Item = V>,
10536 V: std::convert::Into<std::string::String>,
10537 {
10538 use std::iter::Iterator;
10539 self.folders = v.into_iter().map(|i| i.into()).collect();
10540 self
10541 }
10542
10543 /// Sets the value of [organization][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::organization].
10544 ///
10545 /// # Example
10546 /// ```ignore,no_run
10547 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10548 /// let x = GovernedIamPolicy::new().set_organization("example");
10549 /// ```
10550 pub fn set_organization<T: std::convert::Into<std::string::String>>(
10551 mut self,
10552 v: T,
10553 ) -> Self {
10554 self.organization = v.into();
10555 self
10556 }
10557
10558 /// Sets the value of [asset_type][crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy::asset_type].
10559 ///
10560 /// # Example
10561 /// ```ignore,no_run
10562 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10563 /// let x = GovernedIamPolicy::new().set_asset_type("example");
10564 /// ```
10565 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10566 self.asset_type = v.into();
10567 self
10568 }
10569 }
10570
10571 impl wkt::message::Message for GovernedIamPolicy {
10572 fn typename() -> &'static str {
10573 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedIamPolicy"
10574 }
10575 }
10576
10577 /// Represents a Google Cloud asset(resource or IAM policy) governed by the
10578 /// organization policies of the
10579 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
10580 ///
10581 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
10582 #[derive(Clone, Default, PartialEq)]
10583 #[non_exhaustive]
10584 pub struct GovernedAsset {
10585
10586 /// The consolidated policy for the analyzed asset. The consolidated
10587 /// policy is computed by merging and evaluating
10588 /// [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle].
10589 /// The evaluation will respect the organization policy [hierarchy
10590 /// rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy).
10591 ///
10592 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle]: crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::policy_bundle
10593 pub consolidated_policy: std::option::Option<crate::model::AnalyzerOrgPolicy>,
10594
10595 /// The ordered list of all organization policies from the
10596 /// [consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]
10597 /// to the scope specified in the request.
10598 ///
10599 /// If the constraint is defined with default policy, it will also appear in
10600 /// the list.
10601 ///
10602 /// [google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]: crate::model::AnalyzerOrgPolicy::attached_resource
10603 pub policy_bundle: std::vec::Vec<crate::model::AnalyzerOrgPolicy>,
10604
10605 pub governed_asset: std::option::Option<crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset>,
10606
10607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10608 }
10609
10610 impl GovernedAsset {
10611 pub fn new() -> Self {
10612 std::default::Default::default()
10613 }
10614
10615 /// Sets the value of [consolidated_policy][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10620 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
10621 /// let x = GovernedAsset::new().set_consolidated_policy(AnalyzerOrgPolicy::default()/* use setters */);
10622 /// ```
10623 pub fn set_consolidated_policy<T>(mut self, v: T) -> Self
10624 where
10625 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
10626 {
10627 self.consolidated_policy = std::option::Option::Some(v.into());
10628 self
10629 }
10630
10631 /// Sets or clears the value of [consolidated_policy][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::consolidated_policy].
10632 ///
10633 /// # Example
10634 /// ```ignore,no_run
10635 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10636 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
10637 /// let x = GovernedAsset::new().set_or_clear_consolidated_policy(Some(AnalyzerOrgPolicy::default()/* use setters */));
10638 /// let x = GovernedAsset::new().set_or_clear_consolidated_policy(None::<AnalyzerOrgPolicy>);
10639 /// ```
10640 pub fn set_or_clear_consolidated_policy<T>(mut self, v: std::option::Option<T>) -> Self
10641 where
10642 T: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
10643 {
10644 self.consolidated_policy = v.map(|x| x.into());
10645 self
10646 }
10647
10648 /// Sets the value of [policy_bundle][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::policy_bundle].
10649 ///
10650 /// # Example
10651 /// ```ignore,no_run
10652 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10653 /// use google_cloud_asset_v1::model::AnalyzerOrgPolicy;
10654 /// let x = GovernedAsset::new()
10655 /// .set_policy_bundle([
10656 /// AnalyzerOrgPolicy::default()/* use setters */,
10657 /// AnalyzerOrgPolicy::default()/* use (different) setters */,
10658 /// ]);
10659 /// ```
10660 pub fn set_policy_bundle<T, V>(mut self, v: T) -> Self
10661 where
10662 T: std::iter::IntoIterator<Item = V>,
10663 V: std::convert::Into<crate::model::AnalyzerOrgPolicy>,
10664 {
10665 use std::iter::Iterator;
10666 self.policy_bundle = v.into_iter().map(|i| i.into()).collect();
10667 self
10668 }
10669
10670 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset].
10671 ///
10672 /// Note that all the setters affecting `governed_asset` are mutually
10673 /// exclusive.
10674 ///
10675 /// # Example
10676 /// ```ignore,no_run
10677 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10678 /// use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10679 /// let x = GovernedAsset::new().set_governed_asset(Some(
10680 /// google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedResource(GovernedResource::default().into())));
10681 /// ```
10682 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
10683 {
10684 self.governed_asset = v.into();
10685 self
10686 }
10687
10688 /// The value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
10689 /// if it holds a `GovernedResource`, `None` if the field is not set or
10690 /// holds a different branch.
10691 pub fn governed_resource(
10692 &self,
10693 ) -> std::option::Option<
10694 &std::boxed::Box<
10695 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
10696 >,
10697 > {
10698 #[allow(unreachable_patterns)]
10699 self.governed_asset.as_ref().and_then(|v| match v {
10700 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedResource(v) => std::option::Option::Some(v),
10701 _ => std::option::Option::None,
10702 })
10703 }
10704
10705 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
10706 /// to hold a `GovernedResource`.
10707 ///
10708 /// Note that all the setters affecting `governed_asset` are
10709 /// mutually exclusive.
10710 ///
10711 /// # Example
10712 /// ```ignore,no_run
10713 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10714 /// use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedResource;
10715 /// let x = GovernedAsset::new().set_governed_resource(GovernedResource::default()/* use setters */);
10716 /// assert!(x.governed_resource().is_some());
10717 /// assert!(x.governed_iam_policy().is_none());
10718 /// ```
10719 pub fn set_governed_resource<
10720 T: std::convert::Into<
10721 std::boxed::Box<
10722 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
10723 >,
10724 >,
10725 >(
10726 mut self,
10727 v: T,
10728 ) -> Self {
10729 self.governed_asset = std::option::Option::Some(
10730 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedResource(
10731 v.into()
10732 )
10733 );
10734 self
10735 }
10736
10737 /// The value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
10738 /// if it holds a `GovernedIamPolicy`, `None` if the field is not set or
10739 /// holds a different branch.
10740 pub fn governed_iam_policy(
10741 &self,
10742 ) -> std::option::Option<
10743 &std::boxed::Box<
10744 crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy,
10745 >,
10746 > {
10747 #[allow(unreachable_patterns)]
10748 self.governed_asset.as_ref().and_then(|v| match v {
10749 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedIamPolicy(v) => std::option::Option::Some(v),
10750 _ => std::option::Option::None,
10751 })
10752 }
10753
10754 /// Sets the value of [governed_asset][crate::model::analyze_org_policy_governed_assets_response::GovernedAsset::governed_asset]
10755 /// to hold a `GovernedIamPolicy`.
10756 ///
10757 /// Note that all the setters affecting `governed_asset` are
10758 /// mutually exclusive.
10759 ///
10760 /// # Example
10761 /// ```ignore,no_run
10762 /// # use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedAsset;
10763 /// use google_cloud_asset_v1::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy;
10764 /// let x = GovernedAsset::new().set_governed_iam_policy(GovernedIamPolicy::default()/* use setters */);
10765 /// assert!(x.governed_iam_policy().is_some());
10766 /// assert!(x.governed_resource().is_none());
10767 /// ```
10768 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{
10769 self.governed_asset = std::option::Option::Some(
10770 crate::model::analyze_org_policy_governed_assets_response::governed_asset::GovernedAsset::GovernedIamPolicy(
10771 v.into()
10772 )
10773 );
10774 self
10775 }
10776 }
10777
10778 impl wkt::message::Message for GovernedAsset {
10779 fn typename() -> &'static str {
10780 "type.googleapis.com/google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset"
10781 }
10782 }
10783
10784 /// Defines additional types related to [GovernedAsset].
10785 pub mod governed_asset {
10786 #[allow(unused_imports)]
10787 use super::*;
10788
10789 #[derive(Clone, Debug, PartialEq)]
10790 #[non_exhaustive]
10791 pub enum GovernedAsset {
10792 /// A Google Cloud resource governed by the organization
10793 /// policies of the
10794 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
10795 ///
10796 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
10797 GovernedResource(
10798 std::boxed::Box<
10799 crate::model::analyze_org_policy_governed_assets_response::GovernedResource,
10800 >,
10801 ),
10802 /// An IAM policy governed by the organization
10803 /// policies of the
10804 /// [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint].
10805 ///
10806 /// [google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]: crate::model::AnalyzeOrgPolicyGovernedAssetsRequest::constraint
10807 GovernedIamPolicy(
10808 std::boxed::Box<
10809 crate::model::analyze_org_policy_governed_assets_response::GovernedIamPolicy,
10810 >,
10811 ),
10812 }
10813 }
10814}
10815
10816/// An asset in Google Cloud and its temporal metadata, including the time window
10817/// when it was observed and its status during that window.
10818#[derive(Clone, Default, PartialEq)]
10819#[non_exhaustive]
10820pub struct TemporalAsset {
10821 /// The time window when the asset data and state was observed.
10822 pub window: std::option::Option<crate::model::TimeWindow>,
10823
10824 /// Whether the asset has been deleted or not.
10825 pub deleted: bool,
10826
10827 /// An asset in Google Cloud.
10828 pub asset: std::option::Option<crate::model::Asset>,
10829
10830 /// State of prior_asset.
10831 pub prior_asset_state: crate::model::temporal_asset::PriorAssetState,
10832
10833 /// Prior copy of the asset. Populated if prior_asset_state is PRESENT.
10834 /// Currently this is only set for responses in Real-Time Feed.
10835 pub prior_asset: std::option::Option<crate::model::Asset>,
10836
10837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10838}
10839
10840impl TemporalAsset {
10841 pub fn new() -> Self {
10842 std::default::Default::default()
10843 }
10844
10845 /// Sets the value of [window][crate::model::TemporalAsset::window].
10846 ///
10847 /// # Example
10848 /// ```ignore,no_run
10849 /// # use google_cloud_asset_v1::model::TemporalAsset;
10850 /// use google_cloud_asset_v1::model::TimeWindow;
10851 /// let x = TemporalAsset::new().set_window(TimeWindow::default()/* use setters */);
10852 /// ```
10853 pub fn set_window<T>(mut self, v: T) -> Self
10854 where
10855 T: std::convert::Into<crate::model::TimeWindow>,
10856 {
10857 self.window = std::option::Option::Some(v.into());
10858 self
10859 }
10860
10861 /// Sets or clears the value of [window][crate::model::TemporalAsset::window].
10862 ///
10863 /// # Example
10864 /// ```ignore,no_run
10865 /// # use google_cloud_asset_v1::model::TemporalAsset;
10866 /// use google_cloud_asset_v1::model::TimeWindow;
10867 /// let x = TemporalAsset::new().set_or_clear_window(Some(TimeWindow::default()/* use setters */));
10868 /// let x = TemporalAsset::new().set_or_clear_window(None::<TimeWindow>);
10869 /// ```
10870 pub fn set_or_clear_window<T>(mut self, v: std::option::Option<T>) -> Self
10871 where
10872 T: std::convert::Into<crate::model::TimeWindow>,
10873 {
10874 self.window = v.map(|x| x.into());
10875 self
10876 }
10877
10878 /// Sets the value of [deleted][crate::model::TemporalAsset::deleted].
10879 ///
10880 /// # Example
10881 /// ```ignore,no_run
10882 /// # use google_cloud_asset_v1::model::TemporalAsset;
10883 /// let x = TemporalAsset::new().set_deleted(true);
10884 /// ```
10885 pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10886 self.deleted = v.into();
10887 self
10888 }
10889
10890 /// Sets the value of [asset][crate::model::TemporalAsset::asset].
10891 ///
10892 /// # Example
10893 /// ```ignore,no_run
10894 /// # use google_cloud_asset_v1::model::TemporalAsset;
10895 /// use google_cloud_asset_v1::model::Asset;
10896 /// let x = TemporalAsset::new().set_asset(Asset::default()/* use setters */);
10897 /// ```
10898 pub fn set_asset<T>(mut self, v: T) -> Self
10899 where
10900 T: std::convert::Into<crate::model::Asset>,
10901 {
10902 self.asset = std::option::Option::Some(v.into());
10903 self
10904 }
10905
10906 /// Sets or clears the value of [asset][crate::model::TemporalAsset::asset].
10907 ///
10908 /// # Example
10909 /// ```ignore,no_run
10910 /// # use google_cloud_asset_v1::model::TemporalAsset;
10911 /// use google_cloud_asset_v1::model::Asset;
10912 /// let x = TemporalAsset::new().set_or_clear_asset(Some(Asset::default()/* use setters */));
10913 /// let x = TemporalAsset::new().set_or_clear_asset(None::<Asset>);
10914 /// ```
10915 pub fn set_or_clear_asset<T>(mut self, v: std::option::Option<T>) -> Self
10916 where
10917 T: std::convert::Into<crate::model::Asset>,
10918 {
10919 self.asset = v.map(|x| x.into());
10920 self
10921 }
10922
10923 /// Sets the value of [prior_asset_state][crate::model::TemporalAsset::prior_asset_state].
10924 ///
10925 /// # Example
10926 /// ```ignore,no_run
10927 /// # use google_cloud_asset_v1::model::TemporalAsset;
10928 /// use google_cloud_asset_v1::model::temporal_asset::PriorAssetState;
10929 /// let x0 = TemporalAsset::new().set_prior_asset_state(PriorAssetState::Present);
10930 /// let x1 = TemporalAsset::new().set_prior_asset_state(PriorAssetState::Invalid);
10931 /// let x2 = TemporalAsset::new().set_prior_asset_state(PriorAssetState::DoesNotExist);
10932 /// ```
10933 pub fn set_prior_asset_state<
10934 T: std::convert::Into<crate::model::temporal_asset::PriorAssetState>,
10935 >(
10936 mut self,
10937 v: T,
10938 ) -> Self {
10939 self.prior_asset_state = v.into();
10940 self
10941 }
10942
10943 /// Sets the value of [prior_asset][crate::model::TemporalAsset::prior_asset].
10944 ///
10945 /// # Example
10946 /// ```ignore,no_run
10947 /// # use google_cloud_asset_v1::model::TemporalAsset;
10948 /// use google_cloud_asset_v1::model::Asset;
10949 /// let x = TemporalAsset::new().set_prior_asset(Asset::default()/* use setters */);
10950 /// ```
10951 pub fn set_prior_asset<T>(mut self, v: T) -> Self
10952 where
10953 T: std::convert::Into<crate::model::Asset>,
10954 {
10955 self.prior_asset = std::option::Option::Some(v.into());
10956 self
10957 }
10958
10959 /// Sets or clears the value of [prior_asset][crate::model::TemporalAsset::prior_asset].
10960 ///
10961 /// # Example
10962 /// ```ignore,no_run
10963 /// # use google_cloud_asset_v1::model::TemporalAsset;
10964 /// use google_cloud_asset_v1::model::Asset;
10965 /// let x = TemporalAsset::new().set_or_clear_prior_asset(Some(Asset::default()/* use setters */));
10966 /// let x = TemporalAsset::new().set_or_clear_prior_asset(None::<Asset>);
10967 /// ```
10968 pub fn set_or_clear_prior_asset<T>(mut self, v: std::option::Option<T>) -> Self
10969 where
10970 T: std::convert::Into<crate::model::Asset>,
10971 {
10972 self.prior_asset = v.map(|x| x.into());
10973 self
10974 }
10975}
10976
10977impl wkt::message::Message for TemporalAsset {
10978 fn typename() -> &'static str {
10979 "type.googleapis.com/google.cloud.asset.v1.TemporalAsset"
10980 }
10981}
10982
10983/// Defines additional types related to [TemporalAsset].
10984pub mod temporal_asset {
10985 #[allow(unused_imports)]
10986 use super::*;
10987
10988 /// State of prior asset.
10989 ///
10990 /// # Working with unknown values
10991 ///
10992 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10993 /// additional enum variants at any time. Adding new variants is not considered
10994 /// a breaking change. Applications should write their code in anticipation of:
10995 ///
10996 /// - New values appearing in future releases of the client library, **and**
10997 /// - New values received dynamically, without application changes.
10998 ///
10999 /// Please consult the [Working with enums] section in the user guide for some
11000 /// guidelines.
11001 ///
11002 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11003 #[derive(Clone, Debug, PartialEq)]
11004 #[non_exhaustive]
11005 pub enum PriorAssetState {
11006 /// prior_asset is not applicable for the current asset.
11007 Unspecified,
11008 /// prior_asset is populated correctly.
11009 Present,
11010 /// Failed to set prior_asset.
11011 Invalid,
11012 /// Current asset is the first known state.
11013 DoesNotExist,
11014 /// prior_asset is a deletion.
11015 Deleted,
11016 /// If set, the enum was initialized with an unknown value.
11017 ///
11018 /// Applications can examine the value using [PriorAssetState::value] or
11019 /// [PriorAssetState::name].
11020 UnknownValue(prior_asset_state::UnknownValue),
11021 }
11022
11023 #[doc(hidden)]
11024 pub mod prior_asset_state {
11025 #[allow(unused_imports)]
11026 use super::*;
11027 #[derive(Clone, Debug, PartialEq)]
11028 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11029 }
11030
11031 impl PriorAssetState {
11032 /// Gets the enum value.
11033 ///
11034 /// Returns `None` if the enum contains an unknown value deserialized from
11035 /// the string representation of enums.
11036 pub fn value(&self) -> std::option::Option<i32> {
11037 match self {
11038 Self::Unspecified => std::option::Option::Some(0),
11039 Self::Present => std::option::Option::Some(1),
11040 Self::Invalid => std::option::Option::Some(2),
11041 Self::DoesNotExist => std::option::Option::Some(3),
11042 Self::Deleted => std::option::Option::Some(4),
11043 Self::UnknownValue(u) => u.0.value(),
11044 }
11045 }
11046
11047 /// Gets the enum value as a string.
11048 ///
11049 /// Returns `None` if the enum contains an unknown value deserialized from
11050 /// the integer representation of enums.
11051 pub fn name(&self) -> std::option::Option<&str> {
11052 match self {
11053 Self::Unspecified => std::option::Option::Some("PRIOR_ASSET_STATE_UNSPECIFIED"),
11054 Self::Present => std::option::Option::Some("PRESENT"),
11055 Self::Invalid => std::option::Option::Some("INVALID"),
11056 Self::DoesNotExist => std::option::Option::Some("DOES_NOT_EXIST"),
11057 Self::Deleted => std::option::Option::Some("DELETED"),
11058 Self::UnknownValue(u) => u.0.name(),
11059 }
11060 }
11061 }
11062
11063 impl std::default::Default for PriorAssetState {
11064 fn default() -> Self {
11065 use std::convert::From;
11066 Self::from(0)
11067 }
11068 }
11069
11070 impl std::fmt::Display for PriorAssetState {
11071 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11072 wkt::internal::display_enum(f, self.name(), self.value())
11073 }
11074 }
11075
11076 impl std::convert::From<i32> for PriorAssetState {
11077 fn from(value: i32) -> Self {
11078 match value {
11079 0 => Self::Unspecified,
11080 1 => Self::Present,
11081 2 => Self::Invalid,
11082 3 => Self::DoesNotExist,
11083 4 => Self::Deleted,
11084 _ => Self::UnknownValue(prior_asset_state::UnknownValue(
11085 wkt::internal::UnknownEnumValue::Integer(value),
11086 )),
11087 }
11088 }
11089 }
11090
11091 impl std::convert::From<&str> for PriorAssetState {
11092 fn from(value: &str) -> Self {
11093 use std::string::ToString;
11094 match value {
11095 "PRIOR_ASSET_STATE_UNSPECIFIED" => Self::Unspecified,
11096 "PRESENT" => Self::Present,
11097 "INVALID" => Self::Invalid,
11098 "DOES_NOT_EXIST" => Self::DoesNotExist,
11099 "DELETED" => Self::Deleted,
11100 _ => Self::UnknownValue(prior_asset_state::UnknownValue(
11101 wkt::internal::UnknownEnumValue::String(value.to_string()),
11102 )),
11103 }
11104 }
11105 }
11106
11107 impl serde::ser::Serialize for PriorAssetState {
11108 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11109 where
11110 S: serde::Serializer,
11111 {
11112 match self {
11113 Self::Unspecified => serializer.serialize_i32(0),
11114 Self::Present => serializer.serialize_i32(1),
11115 Self::Invalid => serializer.serialize_i32(2),
11116 Self::DoesNotExist => serializer.serialize_i32(3),
11117 Self::Deleted => serializer.serialize_i32(4),
11118 Self::UnknownValue(u) => u.0.serialize(serializer),
11119 }
11120 }
11121 }
11122
11123 impl<'de> serde::de::Deserialize<'de> for PriorAssetState {
11124 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11125 where
11126 D: serde::Deserializer<'de>,
11127 {
11128 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PriorAssetState>::new(
11129 ".google.cloud.asset.v1.TemporalAsset.PriorAssetState",
11130 ))
11131 }
11132 }
11133}
11134
11135/// A time window specified by its `start_time` and `end_time`.
11136#[derive(Clone, Default, PartialEq)]
11137#[non_exhaustive]
11138pub struct TimeWindow {
11139 /// Start time of the time window (exclusive).
11140 pub start_time: std::option::Option<wkt::Timestamp>,
11141
11142 /// End time of the time window (inclusive). If not specified, the current
11143 /// timestamp is used instead.
11144 pub end_time: std::option::Option<wkt::Timestamp>,
11145
11146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11147}
11148
11149impl TimeWindow {
11150 pub fn new() -> Self {
11151 std::default::Default::default()
11152 }
11153
11154 /// Sets the value of [start_time][crate::model::TimeWindow::start_time].
11155 ///
11156 /// # Example
11157 /// ```ignore,no_run
11158 /// # use google_cloud_asset_v1::model::TimeWindow;
11159 /// use wkt::Timestamp;
11160 /// let x = TimeWindow::new().set_start_time(Timestamp::default()/* use setters */);
11161 /// ```
11162 pub fn set_start_time<T>(mut self, v: T) -> Self
11163 where
11164 T: std::convert::Into<wkt::Timestamp>,
11165 {
11166 self.start_time = std::option::Option::Some(v.into());
11167 self
11168 }
11169
11170 /// Sets or clears the value of [start_time][crate::model::TimeWindow::start_time].
11171 ///
11172 /// # Example
11173 /// ```ignore,no_run
11174 /// # use google_cloud_asset_v1::model::TimeWindow;
11175 /// use wkt::Timestamp;
11176 /// let x = TimeWindow::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
11177 /// let x = TimeWindow::new().set_or_clear_start_time(None::<Timestamp>);
11178 /// ```
11179 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
11180 where
11181 T: std::convert::Into<wkt::Timestamp>,
11182 {
11183 self.start_time = v.map(|x| x.into());
11184 self
11185 }
11186
11187 /// Sets the value of [end_time][crate::model::TimeWindow::end_time].
11188 ///
11189 /// # Example
11190 /// ```ignore,no_run
11191 /// # use google_cloud_asset_v1::model::TimeWindow;
11192 /// use wkt::Timestamp;
11193 /// let x = TimeWindow::new().set_end_time(Timestamp::default()/* use setters */);
11194 /// ```
11195 pub fn set_end_time<T>(mut self, v: T) -> Self
11196 where
11197 T: std::convert::Into<wkt::Timestamp>,
11198 {
11199 self.end_time = std::option::Option::Some(v.into());
11200 self
11201 }
11202
11203 /// Sets or clears the value of [end_time][crate::model::TimeWindow::end_time].
11204 ///
11205 /// # Example
11206 /// ```ignore,no_run
11207 /// # use google_cloud_asset_v1::model::TimeWindow;
11208 /// use wkt::Timestamp;
11209 /// let x = TimeWindow::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
11210 /// let x = TimeWindow::new().set_or_clear_end_time(None::<Timestamp>);
11211 /// ```
11212 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
11213 where
11214 T: std::convert::Into<wkt::Timestamp>,
11215 {
11216 self.end_time = v.map(|x| x.into());
11217 self
11218 }
11219}
11220
11221impl wkt::message::Message for TimeWindow {
11222 fn typename() -> &'static str {
11223 "type.googleapis.com/google.cloud.asset.v1.TimeWindow"
11224 }
11225}
11226
11227/// The enhanced metadata information for a resource.
11228#[derive(Clone, Default, PartialEq)]
11229#[non_exhaustive]
11230pub struct AssetEnrichment {
11231 pub enrichment_data: std::option::Option<crate::model::asset_enrichment::EnrichmentData>,
11232
11233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11234}
11235
11236impl AssetEnrichment {
11237 pub fn new() -> Self {
11238 std::default::Default::default()
11239 }
11240
11241 /// Sets the value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data].
11242 ///
11243 /// Note that all the setters affecting `enrichment_data` are mutually
11244 /// exclusive.
11245 ///
11246 /// # Example
11247 /// ```ignore,no_run
11248 /// # use google_cloud_asset_v1::model::AssetEnrichment;
11249 /// use google_cloud_asset_v1::model::ResourceOwners;
11250 /// let x = AssetEnrichment::new().set_enrichment_data(Some(
11251 /// google_cloud_asset_v1::model::asset_enrichment::EnrichmentData::ResourceOwners(ResourceOwners::default().into())));
11252 /// ```
11253 pub fn set_enrichment_data<
11254 T: std::convert::Into<std::option::Option<crate::model::asset_enrichment::EnrichmentData>>,
11255 >(
11256 mut self,
11257 v: T,
11258 ) -> Self {
11259 self.enrichment_data = v.into();
11260 self
11261 }
11262
11263 /// The value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data]
11264 /// if it holds a `ResourceOwners`, `None` if the field is not set or
11265 /// holds a different branch.
11266 pub fn resource_owners(
11267 &self,
11268 ) -> std::option::Option<&std::boxed::Box<crate::model::ResourceOwners>> {
11269 #[allow(unreachable_patterns)]
11270 self.enrichment_data.as_ref().and_then(|v| match v {
11271 crate::model::asset_enrichment::EnrichmentData::ResourceOwners(v) => {
11272 std::option::Option::Some(v)
11273 }
11274 _ => std::option::Option::None,
11275 })
11276 }
11277
11278 /// Sets the value of [enrichment_data][crate::model::AssetEnrichment::enrichment_data]
11279 /// to hold a `ResourceOwners`.
11280 ///
11281 /// Note that all the setters affecting `enrichment_data` are
11282 /// mutually exclusive.
11283 ///
11284 /// # Example
11285 /// ```ignore,no_run
11286 /// # use google_cloud_asset_v1::model::AssetEnrichment;
11287 /// use google_cloud_asset_v1::model::ResourceOwners;
11288 /// let x = AssetEnrichment::new().set_resource_owners(ResourceOwners::default()/* use setters */);
11289 /// assert!(x.resource_owners().is_some());
11290 /// ```
11291 pub fn set_resource_owners<
11292 T: std::convert::Into<std::boxed::Box<crate::model::ResourceOwners>>,
11293 >(
11294 mut self,
11295 v: T,
11296 ) -> Self {
11297 self.enrichment_data = std::option::Option::Some(
11298 crate::model::asset_enrichment::EnrichmentData::ResourceOwners(v.into()),
11299 );
11300 self
11301 }
11302}
11303
11304impl wkt::message::Message for AssetEnrichment {
11305 fn typename() -> &'static str {
11306 "type.googleapis.com/google.cloud.asset.v1.AssetEnrichment"
11307 }
11308}
11309
11310/// Defines additional types related to [AssetEnrichment].
11311pub mod asset_enrichment {
11312 #[allow(unused_imports)]
11313 use super::*;
11314
11315 #[derive(Clone, Debug, PartialEq)]
11316 #[non_exhaustive]
11317 pub enum EnrichmentData {
11318 /// The resource owners for a resource.
11319 ///
11320 /// Note that this field only contains the members that have "roles/owner"
11321 /// role in the resource's IAM Policy.
11322 ResourceOwners(std::boxed::Box<crate::model::ResourceOwners>),
11323 }
11324}
11325
11326/// An asset in Google Cloud. An asset can be any resource in the Google Cloud
11327/// [resource
11328/// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
11329/// a resource outside the Google Cloud resource hierarchy (such as Google
11330/// Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy),
11331/// or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship).
11332/// See [Supported asset
11333/// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
11334/// for more information.
11335#[derive(Clone, Default, PartialEq)]
11336#[non_exhaustive]
11337pub struct Asset {
11338 /// The last update timestamp of an asset. update_time is updated when
11339 /// create/update/delete operation is performed.
11340 pub update_time: std::option::Option<wkt::Timestamp>,
11341
11342 /// The full name of the asset. Example:
11343 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
11344 ///
11345 /// See [Resource
11346 /// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
11347 /// for more information.
11348 pub name: std::string::String,
11349
11350 /// The type of the asset. Example: `compute.googleapis.com/Disk`
11351 ///
11352 /// See [Supported asset
11353 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
11354 /// for more information.
11355 pub asset_type: std::string::String,
11356
11357 /// A representation of the resource.
11358 pub resource: std::option::Option<crate::model::Resource>,
11359
11360 /// A representation of the IAM policy set on a Google Cloud resource.
11361 /// There can be a maximum of one IAM policy set on any given resource.
11362 /// In addition, IAM policies inherit their granted access scope from any
11363 /// policies set on parent resources in the resource hierarchy. Therefore, the
11364 /// effectively policy is the union of both the policy set on this resource
11365 /// and each policy set on all of the resource's ancestry resource levels in
11366 /// the hierarchy. See
11367 /// [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance)
11368 /// for more information.
11369 pub iam_policy: std::option::Option<google_cloud_iam_v1::model::Policy>,
11370
11371 /// A representation of an [organization
11372 /// policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy).
11373 /// There can be more than one organization policy with different constraints
11374 /// set on a given resource.
11375 pub org_policy: std::vec::Vec<google_cloud_orgpolicy_v1::model::Policy>,
11376
11377 /// A representation of runtime OS Inventory information. See [this
11378 /// topic](https://cloud.google.com/compute/docs/instances/os-inventory-management)
11379 /// for more information.
11380 pub os_inventory: std::option::Option<google_cloud_osconfig_v1::model::Inventory>,
11381
11382 /// DEPRECATED. This field only presents for the purpose of
11383 /// backward-compatibility. The server will never generate responses with this
11384 /// field.
11385 /// The related assets of the asset of one relationship type. One asset
11386 /// only represents one type of relationship.
11387 #[deprecated]
11388 pub related_assets: std::option::Option<crate::model::RelatedAssets>,
11389
11390 /// One related asset of the current asset.
11391 pub related_asset: std::option::Option<crate::model::RelatedAsset>,
11392
11393 /// The ancestry path of an asset in Google Cloud [resource
11394 /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
11395 /// represented as a list of relative resource names. An ancestry path starts
11396 /// with the closest ancestor in the hierarchy and ends at root. If the asset
11397 /// is a project, folder, or organization, the ancestry path starts from the
11398 /// asset itself.
11399 ///
11400 /// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
11401 pub ancestors: std::vec::Vec<std::string::String>,
11402
11403 /// A representation of an [access
11404 /// policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
11405 pub access_context_policy: std::option::Option<crate::model::asset::AccessContextPolicy>,
11406
11407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11408}
11409
11410impl Asset {
11411 pub fn new() -> Self {
11412 std::default::Default::default()
11413 }
11414
11415 /// Sets the value of [update_time][crate::model::Asset::update_time].
11416 ///
11417 /// # Example
11418 /// ```ignore,no_run
11419 /// # use google_cloud_asset_v1::model::Asset;
11420 /// use wkt::Timestamp;
11421 /// let x = Asset::new().set_update_time(Timestamp::default()/* use setters */);
11422 /// ```
11423 pub fn set_update_time<T>(mut self, v: T) -> Self
11424 where
11425 T: std::convert::Into<wkt::Timestamp>,
11426 {
11427 self.update_time = std::option::Option::Some(v.into());
11428 self
11429 }
11430
11431 /// Sets or clears the value of [update_time][crate::model::Asset::update_time].
11432 ///
11433 /// # Example
11434 /// ```ignore,no_run
11435 /// # use google_cloud_asset_v1::model::Asset;
11436 /// use wkt::Timestamp;
11437 /// let x = Asset::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11438 /// let x = Asset::new().set_or_clear_update_time(None::<Timestamp>);
11439 /// ```
11440 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11441 where
11442 T: std::convert::Into<wkt::Timestamp>,
11443 {
11444 self.update_time = v.map(|x| x.into());
11445 self
11446 }
11447
11448 /// Sets the value of [name][crate::model::Asset::name].
11449 ///
11450 /// # Example
11451 /// ```ignore,no_run
11452 /// # use google_cloud_asset_v1::model::Asset;
11453 /// let x = Asset::new().set_name("example");
11454 /// ```
11455 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11456 self.name = v.into();
11457 self
11458 }
11459
11460 /// Sets the value of [asset_type][crate::model::Asset::asset_type].
11461 ///
11462 /// # Example
11463 /// ```ignore,no_run
11464 /// # use google_cloud_asset_v1::model::Asset;
11465 /// let x = Asset::new().set_asset_type("example");
11466 /// ```
11467 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11468 self.asset_type = v.into();
11469 self
11470 }
11471
11472 /// Sets the value of [resource][crate::model::Asset::resource].
11473 ///
11474 /// # Example
11475 /// ```ignore,no_run
11476 /// # use google_cloud_asset_v1::model::Asset;
11477 /// use google_cloud_asset_v1::model::Resource;
11478 /// let x = Asset::new().set_resource(Resource::default()/* use setters */);
11479 /// ```
11480 pub fn set_resource<T>(mut self, v: T) -> Self
11481 where
11482 T: std::convert::Into<crate::model::Resource>,
11483 {
11484 self.resource = std::option::Option::Some(v.into());
11485 self
11486 }
11487
11488 /// Sets or clears the value of [resource][crate::model::Asset::resource].
11489 ///
11490 /// # Example
11491 /// ```ignore,no_run
11492 /// # use google_cloud_asset_v1::model::Asset;
11493 /// use google_cloud_asset_v1::model::Resource;
11494 /// let x = Asset::new().set_or_clear_resource(Some(Resource::default()/* use setters */));
11495 /// let x = Asset::new().set_or_clear_resource(None::<Resource>);
11496 /// ```
11497 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
11498 where
11499 T: std::convert::Into<crate::model::Resource>,
11500 {
11501 self.resource = v.map(|x| x.into());
11502 self
11503 }
11504
11505 /// Sets the value of [iam_policy][crate::model::Asset::iam_policy].
11506 ///
11507 /// # Example
11508 /// ```ignore,no_run
11509 /// # use google_cloud_asset_v1::model::Asset;
11510 /// use google_cloud_iam_v1::model::Policy;
11511 /// let x = Asset::new().set_iam_policy(Policy::default()/* use setters */);
11512 /// ```
11513 pub fn set_iam_policy<T>(mut self, v: T) -> Self
11514 where
11515 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
11516 {
11517 self.iam_policy = std::option::Option::Some(v.into());
11518 self
11519 }
11520
11521 /// Sets or clears the value of [iam_policy][crate::model::Asset::iam_policy].
11522 ///
11523 /// # Example
11524 /// ```ignore,no_run
11525 /// # use google_cloud_asset_v1::model::Asset;
11526 /// use google_cloud_iam_v1::model::Policy;
11527 /// let x = Asset::new().set_or_clear_iam_policy(Some(Policy::default()/* use setters */));
11528 /// let x = Asset::new().set_or_clear_iam_policy(None::<Policy>);
11529 /// ```
11530 pub fn set_or_clear_iam_policy<T>(mut self, v: std::option::Option<T>) -> Self
11531 where
11532 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
11533 {
11534 self.iam_policy = v.map(|x| x.into());
11535 self
11536 }
11537
11538 /// Sets the value of [org_policy][crate::model::Asset::org_policy].
11539 ///
11540 /// # Example
11541 /// ```ignore,no_run
11542 /// # use google_cloud_asset_v1::model::Asset;
11543 /// use google_cloud_orgpolicy_v1::model::Policy;
11544 /// let x = Asset::new()
11545 /// .set_org_policy([
11546 /// Policy::default()/* use setters */,
11547 /// Policy::default()/* use (different) setters */,
11548 /// ]);
11549 /// ```
11550 pub fn set_org_policy<T, V>(mut self, v: T) -> Self
11551 where
11552 T: std::iter::IntoIterator<Item = V>,
11553 V: std::convert::Into<google_cloud_orgpolicy_v1::model::Policy>,
11554 {
11555 use std::iter::Iterator;
11556 self.org_policy = v.into_iter().map(|i| i.into()).collect();
11557 self
11558 }
11559
11560 /// Sets the value of [os_inventory][crate::model::Asset::os_inventory].
11561 ///
11562 /// # Example
11563 /// ```ignore,no_run
11564 /// # use google_cloud_asset_v1::model::Asset;
11565 /// use google_cloud_osconfig_v1::model::Inventory;
11566 /// let x = Asset::new().set_os_inventory(Inventory::default()/* use setters */);
11567 /// ```
11568 pub fn set_os_inventory<T>(mut self, v: T) -> Self
11569 where
11570 T: std::convert::Into<google_cloud_osconfig_v1::model::Inventory>,
11571 {
11572 self.os_inventory = std::option::Option::Some(v.into());
11573 self
11574 }
11575
11576 /// Sets or clears the value of [os_inventory][crate::model::Asset::os_inventory].
11577 ///
11578 /// # Example
11579 /// ```ignore,no_run
11580 /// # use google_cloud_asset_v1::model::Asset;
11581 /// use google_cloud_osconfig_v1::model::Inventory;
11582 /// let x = Asset::new().set_or_clear_os_inventory(Some(Inventory::default()/* use setters */));
11583 /// let x = Asset::new().set_or_clear_os_inventory(None::<Inventory>);
11584 /// ```
11585 pub fn set_or_clear_os_inventory<T>(mut self, v: std::option::Option<T>) -> Self
11586 where
11587 T: std::convert::Into<google_cloud_osconfig_v1::model::Inventory>,
11588 {
11589 self.os_inventory = v.map(|x| x.into());
11590 self
11591 }
11592
11593 /// Sets the value of [related_assets][crate::model::Asset::related_assets].
11594 ///
11595 /// # Example
11596 /// ```ignore,no_run
11597 /// # use google_cloud_asset_v1::model::Asset;
11598 /// use google_cloud_asset_v1::model::RelatedAssets;
11599 /// let x = Asset::new().set_related_assets(RelatedAssets::default()/* use setters */);
11600 /// ```
11601 #[deprecated]
11602 pub fn set_related_assets<T>(mut self, v: T) -> Self
11603 where
11604 T: std::convert::Into<crate::model::RelatedAssets>,
11605 {
11606 self.related_assets = std::option::Option::Some(v.into());
11607 self
11608 }
11609
11610 /// Sets or clears the value of [related_assets][crate::model::Asset::related_assets].
11611 ///
11612 /// # Example
11613 /// ```ignore,no_run
11614 /// # use google_cloud_asset_v1::model::Asset;
11615 /// use google_cloud_asset_v1::model::RelatedAssets;
11616 /// let x = Asset::new().set_or_clear_related_assets(Some(RelatedAssets::default()/* use setters */));
11617 /// let x = Asset::new().set_or_clear_related_assets(None::<RelatedAssets>);
11618 /// ```
11619 #[deprecated]
11620 pub fn set_or_clear_related_assets<T>(mut self, v: std::option::Option<T>) -> Self
11621 where
11622 T: std::convert::Into<crate::model::RelatedAssets>,
11623 {
11624 self.related_assets = v.map(|x| x.into());
11625 self
11626 }
11627
11628 /// Sets the value of [related_asset][crate::model::Asset::related_asset].
11629 ///
11630 /// # Example
11631 /// ```ignore,no_run
11632 /// # use google_cloud_asset_v1::model::Asset;
11633 /// use google_cloud_asset_v1::model::RelatedAsset;
11634 /// let x = Asset::new().set_related_asset(RelatedAsset::default()/* use setters */);
11635 /// ```
11636 pub fn set_related_asset<T>(mut self, v: T) -> Self
11637 where
11638 T: std::convert::Into<crate::model::RelatedAsset>,
11639 {
11640 self.related_asset = std::option::Option::Some(v.into());
11641 self
11642 }
11643
11644 /// Sets or clears the value of [related_asset][crate::model::Asset::related_asset].
11645 ///
11646 /// # Example
11647 /// ```ignore,no_run
11648 /// # use google_cloud_asset_v1::model::Asset;
11649 /// use google_cloud_asset_v1::model::RelatedAsset;
11650 /// let x = Asset::new().set_or_clear_related_asset(Some(RelatedAsset::default()/* use setters */));
11651 /// let x = Asset::new().set_or_clear_related_asset(None::<RelatedAsset>);
11652 /// ```
11653 pub fn set_or_clear_related_asset<T>(mut self, v: std::option::Option<T>) -> Self
11654 where
11655 T: std::convert::Into<crate::model::RelatedAsset>,
11656 {
11657 self.related_asset = v.map(|x| x.into());
11658 self
11659 }
11660
11661 /// Sets the value of [ancestors][crate::model::Asset::ancestors].
11662 ///
11663 /// # Example
11664 /// ```ignore,no_run
11665 /// # use google_cloud_asset_v1::model::Asset;
11666 /// let x = Asset::new().set_ancestors(["a", "b", "c"]);
11667 /// ```
11668 pub fn set_ancestors<T, V>(mut self, v: T) -> Self
11669 where
11670 T: std::iter::IntoIterator<Item = V>,
11671 V: std::convert::Into<std::string::String>,
11672 {
11673 use std::iter::Iterator;
11674 self.ancestors = v.into_iter().map(|i| i.into()).collect();
11675 self
11676 }
11677
11678 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy].
11679 ///
11680 /// Note that all the setters affecting `access_context_policy` are mutually
11681 /// exclusive.
11682 ///
11683 /// # Example
11684 /// ```ignore,no_run
11685 /// # use google_cloud_asset_v1::model::Asset;
11686 /// use google_cloud_identity_accesscontextmanager_v1::model::AccessPolicy;
11687 /// let x = Asset::new().set_access_context_policy(Some(
11688 /// google_cloud_asset_v1::model::asset::AccessContextPolicy::AccessPolicy(AccessPolicy::default().into())));
11689 /// ```
11690 pub fn set_access_context_policy<
11691 T: std::convert::Into<std::option::Option<crate::model::asset::AccessContextPolicy>>,
11692 >(
11693 mut self,
11694 v: T,
11695 ) -> Self {
11696 self.access_context_policy = v.into();
11697 self
11698 }
11699
11700 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
11701 /// if it holds a `AccessPolicy`, `None` if the field is not set or
11702 /// holds a different branch.
11703 pub fn access_policy(
11704 &self,
11705 ) -> std::option::Option<
11706 &std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessPolicy>,
11707 > {
11708 #[allow(unreachable_patterns)]
11709 self.access_context_policy.as_ref().and_then(|v| match v {
11710 crate::model::asset::AccessContextPolicy::AccessPolicy(v) => {
11711 std::option::Option::Some(v)
11712 }
11713 _ => std::option::Option::None,
11714 })
11715 }
11716
11717 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
11718 /// to hold a `AccessPolicy`.
11719 ///
11720 /// Note that all the setters affecting `access_context_policy` are
11721 /// mutually exclusive.
11722 ///
11723 /// # Example
11724 /// ```ignore,no_run
11725 /// # use google_cloud_asset_v1::model::Asset;
11726 /// use google_cloud_identity_accesscontextmanager_v1::model::AccessPolicy;
11727 /// let x = Asset::new().set_access_policy(AccessPolicy::default()/* use setters */);
11728 /// assert!(x.access_policy().is_some());
11729 /// assert!(x.access_level().is_none());
11730 /// assert!(x.service_perimeter().is_none());
11731 /// ```
11732 pub fn set_access_policy<
11733 T: std::convert::Into<
11734 std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessPolicy>,
11735 >,
11736 >(
11737 mut self,
11738 v: T,
11739 ) -> Self {
11740 self.access_context_policy = std::option::Option::Some(
11741 crate::model::asset::AccessContextPolicy::AccessPolicy(v.into()),
11742 );
11743 self
11744 }
11745
11746 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
11747 /// if it holds a `AccessLevel`, `None` if the field is not set or
11748 /// holds a different branch.
11749 pub fn access_level(
11750 &self,
11751 ) -> std::option::Option<
11752 &std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessLevel>,
11753 > {
11754 #[allow(unreachable_patterns)]
11755 self.access_context_policy.as_ref().and_then(|v| match v {
11756 crate::model::asset::AccessContextPolicy::AccessLevel(v) => {
11757 std::option::Option::Some(v)
11758 }
11759 _ => std::option::Option::None,
11760 })
11761 }
11762
11763 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
11764 /// to hold a `AccessLevel`.
11765 ///
11766 /// Note that all the setters affecting `access_context_policy` are
11767 /// mutually exclusive.
11768 ///
11769 /// # Example
11770 /// ```ignore,no_run
11771 /// # use google_cloud_asset_v1::model::Asset;
11772 /// use google_cloud_identity_accesscontextmanager_v1::model::AccessLevel;
11773 /// let x = Asset::new().set_access_level(AccessLevel::default()/* use setters */);
11774 /// assert!(x.access_level().is_some());
11775 /// assert!(x.access_policy().is_none());
11776 /// assert!(x.service_perimeter().is_none());
11777 /// ```
11778 pub fn set_access_level<
11779 T: std::convert::Into<
11780 std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessLevel>,
11781 >,
11782 >(
11783 mut self,
11784 v: T,
11785 ) -> Self {
11786 self.access_context_policy = std::option::Option::Some(
11787 crate::model::asset::AccessContextPolicy::AccessLevel(v.into()),
11788 );
11789 self
11790 }
11791
11792 /// The value of [access_context_policy][crate::model::Asset::access_context_policy]
11793 /// if it holds a `ServicePerimeter`, `None` if the field is not set or
11794 /// holds a different branch.
11795 pub fn service_perimeter(
11796 &self,
11797 ) -> std::option::Option<
11798 &std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::ServicePerimeter>,
11799 > {
11800 #[allow(unreachable_patterns)]
11801 self.access_context_policy.as_ref().and_then(|v| match v {
11802 crate::model::asset::AccessContextPolicy::ServicePerimeter(v) => {
11803 std::option::Option::Some(v)
11804 }
11805 _ => std::option::Option::None,
11806 })
11807 }
11808
11809 /// Sets the value of [access_context_policy][crate::model::Asset::access_context_policy]
11810 /// to hold a `ServicePerimeter`.
11811 ///
11812 /// Note that all the setters affecting `access_context_policy` are
11813 /// mutually exclusive.
11814 ///
11815 /// # Example
11816 /// ```ignore,no_run
11817 /// # use google_cloud_asset_v1::model::Asset;
11818 /// use google_cloud_identity_accesscontextmanager_v1::model::ServicePerimeter;
11819 /// let x = Asset::new().set_service_perimeter(ServicePerimeter::default()/* use setters */);
11820 /// assert!(x.service_perimeter().is_some());
11821 /// assert!(x.access_policy().is_none());
11822 /// assert!(x.access_level().is_none());
11823 /// ```
11824 pub fn set_service_perimeter<
11825 T: std::convert::Into<
11826 std::boxed::Box<
11827 google_cloud_identity_accesscontextmanager_v1::model::ServicePerimeter,
11828 >,
11829 >,
11830 >(
11831 mut self,
11832 v: T,
11833 ) -> Self {
11834 self.access_context_policy = std::option::Option::Some(
11835 crate::model::asset::AccessContextPolicy::ServicePerimeter(v.into()),
11836 );
11837 self
11838 }
11839}
11840
11841impl wkt::message::Message for Asset {
11842 fn typename() -> &'static str {
11843 "type.googleapis.com/google.cloud.asset.v1.Asset"
11844 }
11845}
11846
11847/// Defines additional types related to [Asset].
11848pub mod asset {
11849 #[allow(unused_imports)]
11850 use super::*;
11851
11852 /// A representation of an [access
11853 /// policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
11854 #[derive(Clone, Debug, PartialEq)]
11855 #[non_exhaustive]
11856 pub enum AccessContextPolicy {
11857 /// Also refer to the [access policy user
11858 /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
11859 AccessPolicy(
11860 std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessPolicy>,
11861 ),
11862 /// Also refer to the [access level user
11863 /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels).
11864 AccessLevel(
11865 std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::AccessLevel>,
11866 ),
11867 /// Also refer to the [service perimeter user
11868 /// guide](https://cloud.google.com/vpc-service-controls/docs/overview).
11869 ServicePerimeter(
11870 std::boxed::Box<google_cloud_identity_accesscontextmanager_v1::model::ServicePerimeter>,
11871 ),
11872 }
11873}
11874
11875/// A representation of a Google Cloud resource.
11876#[derive(Clone, Default, PartialEq)]
11877#[non_exhaustive]
11878pub struct Resource {
11879 /// The API version. Example: `v1`
11880 pub version: std::string::String,
11881
11882 /// The URL of the discovery document containing the resource's JSON schema.
11883 /// Example:
11884 /// `<https://www.googleapis.com/discovery/v1/apis/compute/v1/rest>`
11885 ///
11886 /// This value is unspecified for resources that do not have an API based on a
11887 /// discovery document, such as Cloud Bigtable.
11888 pub discovery_document_uri: std::string::String,
11889
11890 /// The JSON schema name listed in the discovery document. Example:
11891 /// `Project`
11892 ///
11893 /// This value is unspecified for resources that do not have an API based on a
11894 /// discovery document, such as Cloud Bigtable.
11895 pub discovery_name: std::string::String,
11896
11897 /// The REST URL for accessing the resource. An HTTP `GET` request using this
11898 /// URL returns the resource itself. Example:
11899 /// `<https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123>`
11900 ///
11901 /// This value is unspecified for resources without a REST API.
11902 pub resource_url: std::string::String,
11903
11904 /// The full name of the immediate parent of this resource. See
11905 /// [Resource
11906 /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
11907 /// for more information.
11908 ///
11909 /// For Google Cloud assets, this value is the parent resource defined in the
11910 /// [IAM policy
11911 /// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy).
11912 /// Example:
11913 /// `//cloudresourcemanager.googleapis.com/projects/my_project_123`
11914 pub parent: std::string::String,
11915
11916 /// The content of the resource, in which some sensitive fields are removed
11917 /// and may not be present.
11918 pub data: std::option::Option<wkt::Struct>,
11919
11920 /// The location of the resource in Google Cloud, such as its zone and region.
11921 /// For more information, see <https://cloud.google.com/about/locations/>.
11922 pub location: std::string::String,
11923
11924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11925}
11926
11927impl Resource {
11928 pub fn new() -> Self {
11929 std::default::Default::default()
11930 }
11931
11932 /// Sets the value of [version][crate::model::Resource::version].
11933 ///
11934 /// # Example
11935 /// ```ignore,no_run
11936 /// # use google_cloud_asset_v1::model::Resource;
11937 /// let x = Resource::new().set_version("example");
11938 /// ```
11939 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11940 self.version = v.into();
11941 self
11942 }
11943
11944 /// Sets the value of [discovery_document_uri][crate::model::Resource::discovery_document_uri].
11945 ///
11946 /// # Example
11947 /// ```ignore,no_run
11948 /// # use google_cloud_asset_v1::model::Resource;
11949 /// let x = Resource::new().set_discovery_document_uri("example");
11950 /// ```
11951 pub fn set_discovery_document_uri<T: std::convert::Into<std::string::String>>(
11952 mut self,
11953 v: T,
11954 ) -> Self {
11955 self.discovery_document_uri = v.into();
11956 self
11957 }
11958
11959 /// Sets the value of [discovery_name][crate::model::Resource::discovery_name].
11960 ///
11961 /// # Example
11962 /// ```ignore,no_run
11963 /// # use google_cloud_asset_v1::model::Resource;
11964 /// let x = Resource::new().set_discovery_name("example");
11965 /// ```
11966 pub fn set_discovery_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11967 self.discovery_name = v.into();
11968 self
11969 }
11970
11971 /// Sets the value of [resource_url][crate::model::Resource::resource_url].
11972 ///
11973 /// # Example
11974 /// ```ignore,no_run
11975 /// # use google_cloud_asset_v1::model::Resource;
11976 /// let x = Resource::new().set_resource_url("example");
11977 /// ```
11978 pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11979 self.resource_url = v.into();
11980 self
11981 }
11982
11983 /// Sets the value of [parent][crate::model::Resource::parent].
11984 ///
11985 /// # Example
11986 /// ```ignore,no_run
11987 /// # use google_cloud_asset_v1::model::Resource;
11988 /// let x = Resource::new().set_parent("example");
11989 /// ```
11990 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11991 self.parent = v.into();
11992 self
11993 }
11994
11995 /// Sets the value of [data][crate::model::Resource::data].
11996 ///
11997 /// # Example
11998 /// ```ignore,no_run
11999 /// # use google_cloud_asset_v1::model::Resource;
12000 /// use wkt::Struct;
12001 /// let x = Resource::new().set_data(Struct::default()/* use setters */);
12002 /// ```
12003 pub fn set_data<T>(mut self, v: T) -> Self
12004 where
12005 T: std::convert::Into<wkt::Struct>,
12006 {
12007 self.data = std::option::Option::Some(v.into());
12008 self
12009 }
12010
12011 /// Sets or clears the value of [data][crate::model::Resource::data].
12012 ///
12013 /// # Example
12014 /// ```ignore,no_run
12015 /// # use google_cloud_asset_v1::model::Resource;
12016 /// use wkt::Struct;
12017 /// let x = Resource::new().set_or_clear_data(Some(Struct::default()/* use setters */));
12018 /// let x = Resource::new().set_or_clear_data(None::<Struct>);
12019 /// ```
12020 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
12021 where
12022 T: std::convert::Into<wkt::Struct>,
12023 {
12024 self.data = v.map(|x| x.into());
12025 self
12026 }
12027
12028 /// Sets the value of [location][crate::model::Resource::location].
12029 ///
12030 /// # Example
12031 /// ```ignore,no_run
12032 /// # use google_cloud_asset_v1::model::Resource;
12033 /// let x = Resource::new().set_location("example");
12034 /// ```
12035 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12036 self.location = v.into();
12037 self
12038 }
12039}
12040
12041impl wkt::message::Message for Resource {
12042 fn typename() -> &'static str {
12043 "type.googleapis.com/google.cloud.asset.v1.Resource"
12044 }
12045}
12046
12047/// DEPRECATED. This message only presents for the purpose of
12048/// backward-compatibility. The server will never populate this message in
12049/// responses.
12050/// The detailed related assets with the `relationship_type`.
12051#[derive(Clone, Default, PartialEq)]
12052#[non_exhaustive]
12053#[deprecated]
12054pub struct RelatedAssets {
12055 /// The detailed relationship attributes.
12056 pub relationship_attributes: std::option::Option<crate::model::RelationshipAttributes>,
12057
12058 /// The peer resources of the relationship.
12059 pub assets: std::vec::Vec<crate::model::RelatedAsset>,
12060
12061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12062}
12063
12064impl RelatedAssets {
12065 pub fn new() -> Self {
12066 std::default::Default::default()
12067 }
12068
12069 /// Sets the value of [relationship_attributes][crate::model::RelatedAssets::relationship_attributes].
12070 ///
12071 /// # Example
12072 /// ```ignore,no_run
12073 /// # use google_cloud_asset_v1::model::RelatedAssets;
12074 /// use google_cloud_asset_v1::model::RelationshipAttributes;
12075 /// let x = RelatedAssets::new().set_relationship_attributes(RelationshipAttributes::default()/* use setters */);
12076 /// ```
12077 pub fn set_relationship_attributes<T>(mut self, v: T) -> Self
12078 where
12079 T: std::convert::Into<crate::model::RelationshipAttributes>,
12080 {
12081 self.relationship_attributes = std::option::Option::Some(v.into());
12082 self
12083 }
12084
12085 /// Sets or clears the value of [relationship_attributes][crate::model::RelatedAssets::relationship_attributes].
12086 ///
12087 /// # Example
12088 /// ```ignore,no_run
12089 /// # use google_cloud_asset_v1::model::RelatedAssets;
12090 /// use google_cloud_asset_v1::model::RelationshipAttributes;
12091 /// let x = RelatedAssets::new().set_or_clear_relationship_attributes(Some(RelationshipAttributes::default()/* use setters */));
12092 /// let x = RelatedAssets::new().set_or_clear_relationship_attributes(None::<RelationshipAttributes>);
12093 /// ```
12094 pub fn set_or_clear_relationship_attributes<T>(mut self, v: std::option::Option<T>) -> Self
12095 where
12096 T: std::convert::Into<crate::model::RelationshipAttributes>,
12097 {
12098 self.relationship_attributes = v.map(|x| x.into());
12099 self
12100 }
12101
12102 /// Sets the value of [assets][crate::model::RelatedAssets::assets].
12103 ///
12104 /// # Example
12105 /// ```ignore,no_run
12106 /// # use google_cloud_asset_v1::model::RelatedAssets;
12107 /// use google_cloud_asset_v1::model::RelatedAsset;
12108 /// let x = RelatedAssets::new()
12109 /// .set_assets([
12110 /// RelatedAsset::default()/* use setters */,
12111 /// RelatedAsset::default()/* use (different) setters */,
12112 /// ]);
12113 /// ```
12114 pub fn set_assets<T, V>(mut self, v: T) -> Self
12115 where
12116 T: std::iter::IntoIterator<Item = V>,
12117 V: std::convert::Into<crate::model::RelatedAsset>,
12118 {
12119 use std::iter::Iterator;
12120 self.assets = v.into_iter().map(|i| i.into()).collect();
12121 self
12122 }
12123}
12124
12125impl wkt::message::Message for RelatedAssets {
12126 fn typename() -> &'static str {
12127 "type.googleapis.com/google.cloud.asset.v1.RelatedAssets"
12128 }
12129}
12130
12131/// DEPRECATED. This message only presents for the purpose of
12132/// backward-compatibility. The server will never populate this message in
12133/// responses.
12134/// The relationship attributes which include `type`, `source_resource_type`,
12135/// `target_resource_type` and `action`.
12136#[derive(Clone, Default, PartialEq)]
12137#[non_exhaustive]
12138#[deprecated]
12139pub struct RelationshipAttributes {
12140 /// The unique identifier of the relationship type. Example:
12141 /// `INSTANCE_TO_INSTANCEGROUP`
12142 pub r#type: std::string::String,
12143
12144 /// The source asset type. Example: `compute.googleapis.com/Instance`
12145 pub source_resource_type: std::string::String,
12146
12147 /// The target asset type. Example: `compute.googleapis.com/Disk`
12148 pub target_resource_type: std::string::String,
12149
12150 /// The detail of the relationship, e.g. `contains`, `attaches`
12151 pub action: std::string::String,
12152
12153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12154}
12155
12156impl RelationshipAttributes {
12157 pub fn new() -> Self {
12158 std::default::Default::default()
12159 }
12160
12161 /// Sets the value of [r#type][crate::model::RelationshipAttributes::type].
12162 ///
12163 /// # Example
12164 /// ```ignore,no_run
12165 /// # use google_cloud_asset_v1::model::RelationshipAttributes;
12166 /// let x = RelationshipAttributes::new().set_type("example");
12167 /// ```
12168 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12169 self.r#type = v.into();
12170 self
12171 }
12172
12173 /// Sets the value of [source_resource_type][crate::model::RelationshipAttributes::source_resource_type].
12174 ///
12175 /// # Example
12176 /// ```ignore,no_run
12177 /// # use google_cloud_asset_v1::model::RelationshipAttributes;
12178 /// let x = RelationshipAttributes::new().set_source_resource_type("example");
12179 /// ```
12180 pub fn set_source_resource_type<T: std::convert::Into<std::string::String>>(
12181 mut self,
12182 v: T,
12183 ) -> Self {
12184 self.source_resource_type = v.into();
12185 self
12186 }
12187
12188 /// Sets the value of [target_resource_type][crate::model::RelationshipAttributes::target_resource_type].
12189 ///
12190 /// # Example
12191 /// ```ignore,no_run
12192 /// # use google_cloud_asset_v1::model::RelationshipAttributes;
12193 /// let x = RelationshipAttributes::new().set_target_resource_type("example");
12194 /// ```
12195 pub fn set_target_resource_type<T: std::convert::Into<std::string::String>>(
12196 mut self,
12197 v: T,
12198 ) -> Self {
12199 self.target_resource_type = v.into();
12200 self
12201 }
12202
12203 /// Sets the value of [action][crate::model::RelationshipAttributes::action].
12204 ///
12205 /// # Example
12206 /// ```ignore,no_run
12207 /// # use google_cloud_asset_v1::model::RelationshipAttributes;
12208 /// let x = RelationshipAttributes::new().set_action("example");
12209 /// ```
12210 pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12211 self.action = v.into();
12212 self
12213 }
12214}
12215
12216impl wkt::message::Message for RelationshipAttributes {
12217 fn typename() -> &'static str {
12218 "type.googleapis.com/google.cloud.asset.v1.RelationshipAttributes"
12219 }
12220}
12221
12222/// An asset identifier in Google Cloud which contains its name, type and
12223/// ancestors. An asset can be any resource in the Google Cloud [resource
12224/// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
12225/// a resource outside the Google Cloud resource hierarchy (such as Google
12226/// Kubernetes Engine clusters and objects), or a policy (e.g. IAM policy).
12227/// See [Supported asset
12228/// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
12229/// for more information.
12230#[derive(Clone, Default, PartialEq)]
12231#[non_exhaustive]
12232pub struct RelatedAsset {
12233 /// The full name of the asset. Example:
12234 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
12235 ///
12236 /// See [Resource
12237 /// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
12238 /// for more information.
12239 pub asset: std::string::String,
12240
12241 /// The type of the asset. Example: `compute.googleapis.com/Disk`
12242 ///
12243 /// See [Supported asset
12244 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
12245 /// for more information.
12246 pub asset_type: std::string::String,
12247
12248 /// The ancestors of an asset in Google Cloud [resource
12249 /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
12250 /// represented as a list of relative resource names. An ancestry path starts
12251 /// with the closest ancestor in the hierarchy and ends at root.
12252 ///
12253 /// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
12254 pub ancestors: std::vec::Vec<std::string::String>,
12255
12256 /// The unique identifier of the relationship type. Example:
12257 /// `INSTANCE_TO_INSTANCEGROUP`
12258 pub relationship_type: std::string::String,
12259
12260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12261}
12262
12263impl RelatedAsset {
12264 pub fn new() -> Self {
12265 std::default::Default::default()
12266 }
12267
12268 /// Sets the value of [asset][crate::model::RelatedAsset::asset].
12269 ///
12270 /// # Example
12271 /// ```ignore,no_run
12272 /// # use google_cloud_asset_v1::model::RelatedAsset;
12273 /// let x = RelatedAsset::new().set_asset("example");
12274 /// ```
12275 pub fn set_asset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12276 self.asset = v.into();
12277 self
12278 }
12279
12280 /// Sets the value of [asset_type][crate::model::RelatedAsset::asset_type].
12281 ///
12282 /// # Example
12283 /// ```ignore,no_run
12284 /// # use google_cloud_asset_v1::model::RelatedAsset;
12285 /// let x = RelatedAsset::new().set_asset_type("example");
12286 /// ```
12287 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12288 self.asset_type = v.into();
12289 self
12290 }
12291
12292 /// Sets the value of [ancestors][crate::model::RelatedAsset::ancestors].
12293 ///
12294 /// # Example
12295 /// ```ignore,no_run
12296 /// # use google_cloud_asset_v1::model::RelatedAsset;
12297 /// let x = RelatedAsset::new().set_ancestors(["a", "b", "c"]);
12298 /// ```
12299 pub fn set_ancestors<T, V>(mut self, v: T) -> Self
12300 where
12301 T: std::iter::IntoIterator<Item = V>,
12302 V: std::convert::Into<std::string::String>,
12303 {
12304 use std::iter::Iterator;
12305 self.ancestors = v.into_iter().map(|i| i.into()).collect();
12306 self
12307 }
12308
12309 /// Sets the value of [relationship_type][crate::model::RelatedAsset::relationship_type].
12310 ///
12311 /// # Example
12312 /// ```ignore,no_run
12313 /// # use google_cloud_asset_v1::model::RelatedAsset;
12314 /// let x = RelatedAsset::new().set_relationship_type("example");
12315 /// ```
12316 pub fn set_relationship_type<T: std::convert::Into<std::string::String>>(
12317 mut self,
12318 v: T,
12319 ) -> Self {
12320 self.relationship_type = v.into();
12321 self
12322 }
12323}
12324
12325impl wkt::message::Message for RelatedAsset {
12326 fn typename() -> &'static str {
12327 "type.googleapis.com/google.cloud.asset.v1.RelatedAsset"
12328 }
12329}
12330
12331/// The key and value for a
12332/// [tag](https://cloud.google.com/resource-manager/docs/tags/tags-overview).
12333#[derive(Clone, Default, PartialEq)]
12334#[non_exhaustive]
12335pub struct Tag {
12336 /// TagKey namespaced name, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}.
12337 pub tag_key: std::option::Option<std::string::String>,
12338
12339 /// TagKey ID, in the format of tagKeys/{TAG_KEY_ID}.
12340 pub tag_key_id: std::option::Option<std::string::String>,
12341
12342 /// TagValue namespaced name, in the format of
12343 /// {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}.
12344 pub tag_value: std::option::Option<std::string::String>,
12345
12346 /// TagValue ID, in the format of tagValues/{TAG_VALUE_ID}.
12347 pub tag_value_id: std::option::Option<std::string::String>,
12348
12349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12350}
12351
12352impl Tag {
12353 pub fn new() -> Self {
12354 std::default::Default::default()
12355 }
12356
12357 /// Sets the value of [tag_key][crate::model::Tag::tag_key].
12358 ///
12359 /// # Example
12360 /// ```ignore,no_run
12361 /// # use google_cloud_asset_v1::model::Tag;
12362 /// let x = Tag::new().set_tag_key("example");
12363 /// ```
12364 pub fn set_tag_key<T>(mut self, v: T) -> Self
12365 where
12366 T: std::convert::Into<std::string::String>,
12367 {
12368 self.tag_key = std::option::Option::Some(v.into());
12369 self
12370 }
12371
12372 /// Sets or clears the value of [tag_key][crate::model::Tag::tag_key].
12373 ///
12374 /// # Example
12375 /// ```ignore,no_run
12376 /// # use google_cloud_asset_v1::model::Tag;
12377 /// let x = Tag::new().set_or_clear_tag_key(Some("example"));
12378 /// let x = Tag::new().set_or_clear_tag_key(None::<String>);
12379 /// ```
12380 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
12381 where
12382 T: std::convert::Into<std::string::String>,
12383 {
12384 self.tag_key = v.map(|x| x.into());
12385 self
12386 }
12387
12388 /// Sets the value of [tag_key_id][crate::model::Tag::tag_key_id].
12389 ///
12390 /// # Example
12391 /// ```ignore,no_run
12392 /// # use google_cloud_asset_v1::model::Tag;
12393 /// let x = Tag::new().set_tag_key_id("example");
12394 /// ```
12395 pub fn set_tag_key_id<T>(mut self, v: T) -> Self
12396 where
12397 T: std::convert::Into<std::string::String>,
12398 {
12399 self.tag_key_id = std::option::Option::Some(v.into());
12400 self
12401 }
12402
12403 /// Sets or clears the value of [tag_key_id][crate::model::Tag::tag_key_id].
12404 ///
12405 /// # Example
12406 /// ```ignore,no_run
12407 /// # use google_cloud_asset_v1::model::Tag;
12408 /// let x = Tag::new().set_or_clear_tag_key_id(Some("example"));
12409 /// let x = Tag::new().set_or_clear_tag_key_id(None::<String>);
12410 /// ```
12411 pub fn set_or_clear_tag_key_id<T>(mut self, v: std::option::Option<T>) -> Self
12412 where
12413 T: std::convert::Into<std::string::String>,
12414 {
12415 self.tag_key_id = v.map(|x| x.into());
12416 self
12417 }
12418
12419 /// Sets the value of [tag_value][crate::model::Tag::tag_value].
12420 ///
12421 /// # Example
12422 /// ```ignore,no_run
12423 /// # use google_cloud_asset_v1::model::Tag;
12424 /// let x = Tag::new().set_tag_value("example");
12425 /// ```
12426 pub fn set_tag_value<T>(mut self, v: T) -> Self
12427 where
12428 T: std::convert::Into<std::string::String>,
12429 {
12430 self.tag_value = std::option::Option::Some(v.into());
12431 self
12432 }
12433
12434 /// Sets or clears the value of [tag_value][crate::model::Tag::tag_value].
12435 ///
12436 /// # Example
12437 /// ```ignore,no_run
12438 /// # use google_cloud_asset_v1::model::Tag;
12439 /// let x = Tag::new().set_or_clear_tag_value(Some("example"));
12440 /// let x = Tag::new().set_or_clear_tag_value(None::<String>);
12441 /// ```
12442 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
12443 where
12444 T: std::convert::Into<std::string::String>,
12445 {
12446 self.tag_value = v.map(|x| x.into());
12447 self
12448 }
12449
12450 /// Sets the value of [tag_value_id][crate::model::Tag::tag_value_id].
12451 ///
12452 /// # Example
12453 /// ```ignore,no_run
12454 /// # use google_cloud_asset_v1::model::Tag;
12455 /// let x = Tag::new().set_tag_value_id("example");
12456 /// ```
12457 pub fn set_tag_value_id<T>(mut self, v: T) -> Self
12458 where
12459 T: std::convert::Into<std::string::String>,
12460 {
12461 self.tag_value_id = std::option::Option::Some(v.into());
12462 self
12463 }
12464
12465 /// Sets or clears the value of [tag_value_id][crate::model::Tag::tag_value_id].
12466 ///
12467 /// # Example
12468 /// ```ignore,no_run
12469 /// # use google_cloud_asset_v1::model::Tag;
12470 /// let x = Tag::new().set_or_clear_tag_value_id(Some("example"));
12471 /// let x = Tag::new().set_or_clear_tag_value_id(None::<String>);
12472 /// ```
12473 pub fn set_or_clear_tag_value_id<T>(mut self, v: std::option::Option<T>) -> Self
12474 where
12475 T: std::convert::Into<std::string::String>,
12476 {
12477 self.tag_value_id = v.map(|x| x.into());
12478 self
12479 }
12480}
12481
12482impl wkt::message::Message for Tag {
12483 fn typename() -> &'static str {
12484 "type.googleapis.com/google.cloud.asset.v1.Tag"
12485 }
12486}
12487
12488/// The effective tags and the ancestor resources from which they were inherited.
12489#[derive(Clone, Default, PartialEq)]
12490#[non_exhaustive]
12491pub struct EffectiveTagDetails {
12492 /// The [full resource
12493 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
12494 /// of the ancestor from which
12495 /// [effective_tags][google.cloud.asset.v1.EffectiveTagDetails.effective_tags]
12496 /// are inherited, according to [tag
12497 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
12498 ///
12499 /// [google.cloud.asset.v1.EffectiveTagDetails.effective_tags]: crate::model::EffectiveTagDetails::effective_tags
12500 pub attached_resource: std::option::Option<std::string::String>,
12501
12502 /// The effective tags inherited from the
12503 /// [attached_resource][google.cloud.asset.v1.EffectiveTagDetails.attached_resource].
12504 /// Note that tags with the same key but different values may attach to
12505 /// resources at a different hierarchy levels. The lower hierarchy tag value
12506 /// will overwrite the higher hierarchy tag value of the same tag key. In this
12507 /// case, the tag value at the higher hierarchy level will be removed. For more
12508 /// information, see [tag
12509 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
12510 ///
12511 /// [google.cloud.asset.v1.EffectiveTagDetails.attached_resource]: crate::model::EffectiveTagDetails::attached_resource
12512 pub effective_tags: std::vec::Vec<crate::model::Tag>,
12513
12514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12515}
12516
12517impl EffectiveTagDetails {
12518 pub fn new() -> Self {
12519 std::default::Default::default()
12520 }
12521
12522 /// Sets the value of [attached_resource][crate::model::EffectiveTagDetails::attached_resource].
12523 ///
12524 /// # Example
12525 /// ```ignore,no_run
12526 /// # use google_cloud_asset_v1::model::EffectiveTagDetails;
12527 /// let x = EffectiveTagDetails::new().set_attached_resource("example");
12528 /// ```
12529 pub fn set_attached_resource<T>(mut self, v: T) -> Self
12530 where
12531 T: std::convert::Into<std::string::String>,
12532 {
12533 self.attached_resource = std::option::Option::Some(v.into());
12534 self
12535 }
12536
12537 /// Sets or clears the value of [attached_resource][crate::model::EffectiveTagDetails::attached_resource].
12538 ///
12539 /// # Example
12540 /// ```ignore,no_run
12541 /// # use google_cloud_asset_v1::model::EffectiveTagDetails;
12542 /// let x = EffectiveTagDetails::new().set_or_clear_attached_resource(Some("example"));
12543 /// let x = EffectiveTagDetails::new().set_or_clear_attached_resource(None::<String>);
12544 /// ```
12545 pub fn set_or_clear_attached_resource<T>(mut self, v: std::option::Option<T>) -> Self
12546 where
12547 T: std::convert::Into<std::string::String>,
12548 {
12549 self.attached_resource = v.map(|x| x.into());
12550 self
12551 }
12552
12553 /// Sets the value of [effective_tags][crate::model::EffectiveTagDetails::effective_tags].
12554 ///
12555 /// # Example
12556 /// ```ignore,no_run
12557 /// # use google_cloud_asset_v1::model::EffectiveTagDetails;
12558 /// use google_cloud_asset_v1::model::Tag;
12559 /// let x = EffectiveTagDetails::new()
12560 /// .set_effective_tags([
12561 /// Tag::default()/* use setters */,
12562 /// Tag::default()/* use (different) setters */,
12563 /// ]);
12564 /// ```
12565 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
12566 where
12567 T: std::iter::IntoIterator<Item = V>,
12568 V: std::convert::Into<crate::model::Tag>,
12569 {
12570 use std::iter::Iterator;
12571 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
12572 self
12573 }
12574}
12575
12576impl wkt::message::Message for EffectiveTagDetails {
12577 fn typename() -> &'static str {
12578 "type.googleapis.com/google.cloud.asset.v1.EffectiveTagDetails"
12579 }
12580}
12581
12582/// A result of Resource Search, containing information of a cloud resource.
12583#[derive(Clone, Default, PartialEq)]
12584#[non_exhaustive]
12585pub struct ResourceSearchResult {
12586 /// The full resource name of this resource. Example:
12587 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
12588 /// See [Cloud Asset Inventory Resource Name
12589 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
12590 /// for more information.
12591 ///
12592 /// To search against the `name`:
12593 ///
12594 /// * Use a field query. Example: `name:instance1`
12595 /// * Use a free text query. Example: `instance1`
12596 pub name: std::string::String,
12597
12598 /// The type of this resource. Example: `compute.googleapis.com/Disk`.
12599 ///
12600 /// To search against the `asset_type`:
12601 ///
12602 /// * Specify the `asset_type` field in your search request.
12603 pub asset_type: std::string::String,
12604
12605 /// The project that this resource belongs to, in the form of
12606 /// projects/{PROJECT_NUMBER}. This field is available when the resource
12607 /// belongs to a project.
12608 ///
12609 /// To search against `project`:
12610 ///
12611 /// * Use a field query. Example: `project:12345`
12612 /// * Use a free text query. Example: `12345`
12613 /// * Specify the `scope` field as this project in your search request.
12614 pub project: std::string::String,
12615
12616 /// The folder(s) that this resource belongs to, in the form of
12617 /// folders/{FOLDER_NUMBER}. This field is available when the resource
12618 /// belongs to one or more folders.
12619 ///
12620 /// To search against `folders`:
12621 ///
12622 /// * Use a field query. Example: `folders:(123 OR 456)`
12623 /// * Use a free text query. Example: `123`
12624 /// * Specify the `scope` field as this folder in your search request.
12625 pub folders: std::vec::Vec<std::string::String>,
12626
12627 /// The organization that this resource belongs to, in the form of
12628 /// organizations/{ORGANIZATION_NUMBER}. This field is available when the
12629 /// resource belongs to an organization.
12630 ///
12631 /// To search against `organization`:
12632 ///
12633 /// * Use a field query. Example: `organization:123`
12634 /// * Use a free text query. Example: `123`
12635 /// * Specify the `scope` field as this organization in your search request.
12636 pub organization: std::string::String,
12637
12638 /// The display name of this resource. This field is available only when the
12639 /// resource's Protobuf contains it.
12640 ///
12641 /// To search against the `display_name`:
12642 ///
12643 /// * Use a field query. Example: `displayName:"My Instance"`
12644 /// * Use a free text query. Example: `"My Instance"`
12645 pub display_name: std::string::String,
12646
12647 /// One or more paragraphs of text description of this resource. Maximum length
12648 /// could be up to 1M bytes. This field is available only when the resource's
12649 /// Protobuf contains it.
12650 ///
12651 /// To search against the `description`:
12652 ///
12653 /// * Use a field query. Example: `description:"important instance"`
12654 /// * Use a free text query. Example: `"important instance"`
12655 pub description: std::string::String,
12656
12657 /// Location can be `global`, regional like `us-east1`, or zonal like
12658 /// `us-west1-b`. This field is available only when the resource's Protobuf
12659 /// contains it.
12660 ///
12661 /// To search against the `location`:
12662 ///
12663 /// * Use a field query. Example: `location:us-west*`
12664 /// * Use a free text query. Example: `us-west*`
12665 pub location: std::string::String,
12666
12667 /// User labels associated with this resource. See [Labelling and grouping
12668 /// Google Cloud
12669 /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
12670 /// for more information. This field is available only when the resource's
12671 /// Protobuf contains it.
12672 ///
12673 /// To search against the `labels`:
12674 ///
12675 /// * Use a field query:
12676 /// - query on any label's key or value. Example: `labels:prod`
12677 /// - query by a given label. Example: `labels.env:prod`
12678 /// - query by a given label's existence. Example: `labels.env:*`
12679 /// * Use a free text query. Example: `prod`
12680 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12681
12682 /// Network tags associated with this resource. Like labels, network tags are a
12683 /// type of annotations used to group Google Cloud resources. See [Labelling
12684 /// Google Cloud
12685 /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources)
12686 /// for more information. This field is available only when the resource's
12687 /// Protobuf contains it.
12688 ///
12689 /// To search against the `network_tags`:
12690 ///
12691 /// * Use a field query. Example: `networkTags:internal`
12692 /// * Use a free text query. Example: `internal`
12693 pub network_tags: std::vec::Vec<std::string::String>,
12694
12695 /// The Cloud KMS
12696 /// [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys)
12697 /// name or
12698 /// [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions)
12699 /// name.
12700 ///
12701 /// This field only presents for the purpose of backward compatibility.
12702 /// Use the `kms_keys` field to retrieve Cloud KMS key information. This field
12703 /// is available only when the resource's Protobuf contains it and will only be
12704 /// populated for [these resource
12705 /// types](https://cloud.google.com/asset-inventory/docs/legacy-field-names#resource_types_with_the_to_be_deprecated_kmskey_field)
12706 /// for backward compatible purposes.
12707 ///
12708 /// To search against the `kms_key`:
12709 ///
12710 /// * Use a field query. Example: `kmsKey:key`
12711 /// * Use a free text query. Example: `key`
12712 #[deprecated]
12713 pub kms_key: std::string::String,
12714
12715 /// The Cloud KMS
12716 /// [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys)
12717 /// names or
12718 /// [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions)
12719 /// names. This field is available only when the resource's Protobuf contains
12720 /// it.
12721 ///
12722 /// To search against the `kms_keys`:
12723 ///
12724 /// * Use a field query. Example: `kmsKeys:key`
12725 /// * Use a free text query. Example: `key`
12726 pub kms_keys: std::vec::Vec<std::string::String>,
12727
12728 /// The create timestamp of this resource, at which the resource was created.
12729 /// The granularity is in seconds. Timestamp.nanos will always be 0. This field
12730 /// is available only when the resource's Protobuf contains it.
12731 ///
12732 /// To search against `create_time`:
12733 ///
12734 /// * Use a field query.
12735 /// - value in seconds since unix epoch. Example: `createTime > 1609459200`
12736 /// - value in date string. Example: `createTime > 2021-01-01`
12737 /// - value in date-time string (must be quoted). Example: `createTime >
12738 /// "2021-01-01T00:00:00"`
12739 pub create_time: std::option::Option<wkt::Timestamp>,
12740
12741 /// The last update timestamp of this resource, at which the resource was last
12742 /// modified or deleted. The granularity is in seconds. Timestamp.nanos will
12743 /// always be 0. This field is available only when the resource's Protobuf
12744 /// contains it.
12745 ///
12746 /// To search against `update_time`:
12747 ///
12748 /// * Use a field query.
12749 /// - value in seconds since unix epoch. Example: `updateTime < 1609459200`
12750 /// - value in date string. Example: `updateTime < 2021-01-01`
12751 /// - value in date-time string (must be quoted). Example: `updateTime <
12752 /// "2021-01-01T00:00:00"`
12753 pub update_time: std::option::Option<wkt::Timestamp>,
12754
12755 /// The state of this resource. Different resources types have different state
12756 /// definitions that are mapped from various fields of different resource
12757 /// types. This field is available only when the resource's Protobuf contains
12758 /// it.
12759 ///
12760 /// Example:
12761 /// If the resource is an instance provided by Compute Engine,
12762 /// its state will include PROVISIONING, STAGING, RUNNING, STOPPING,
12763 /// SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See `status` definition
12764 /// in [API
12765 /// Reference](https://cloud.google.com/compute/docs/reference/rest/v1/instances).
12766 /// If the resource is a project provided by Resource Manager, its state
12767 /// will include LIFECYCLE_STATE_UNSPECIFIED, ACTIVE, DELETE_REQUESTED and
12768 /// DELETE_IN_PROGRESS. See `lifecycleState` definition in [API
12769 /// Reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects).
12770 ///
12771 /// To search against the `state`:
12772 ///
12773 /// * Use a field query. Example: `state:RUNNING`
12774 /// * Use a free text query. Example: `RUNNING`
12775 pub state: std::string::String,
12776
12777 /// The additional searchable attributes of this resource. The attributes may
12778 /// vary from one resource type to another. Examples: `projectId` for Project,
12779 /// `dnsName` for DNS ManagedZone. This field contains a subset of the resource
12780 /// metadata fields that are returned by the List or Get APIs provided by the
12781 /// corresponding Google Cloud service (e.g., Compute Engine). see [API
12782 /// references and supported searchable
12783 /// attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
12784 /// to see which fields are included.
12785 ///
12786 /// You can search values of these fields through free text search. However,
12787 /// you should not consume the field programically as the field names and
12788 /// values may change as the Google Cloud service updates to a new incompatible
12789 /// API version.
12790 ///
12791 /// To search against the `additional_attributes`:
12792 ///
12793 /// * Use a free text query to match the attributes values. Example: to search
12794 /// `additional_attributes = { dnsName: "foobar" }`, you can issue a query
12795 /// `foobar`.
12796 pub additional_attributes: std::option::Option<wkt::Struct>,
12797
12798 /// The full resource name of this resource's parent, if it has one.
12799 /// To search against the `parent_full_resource_name`:
12800 ///
12801 /// * Use a field query. Example:
12802 /// `parentFullResourceName:"project-name"`
12803 /// * Use a free text query. Example:
12804 /// `project-name`
12805 pub parent_full_resource_name: std::string::String,
12806
12807 /// Versioned resource representations of this resource. This is repeated
12808 /// because there could be multiple versions of resource representations during
12809 /// version migration.
12810 ///
12811 /// This `versioned_resources` field is not searchable. Some attributes of the
12812 /// resource representations are exposed in `additional_attributes` field, so
12813 /// as to allow users to search on them.
12814 pub versioned_resources: std::vec::Vec<crate::model::VersionedResource>,
12815
12816 /// Attached resources of this resource. For example, an OSConfig
12817 /// Inventory is an attached resource of a Compute Instance. This field is
12818 /// repeated because a resource could have multiple attached resources.
12819 ///
12820 /// This `attached_resources` field is not searchable. Some attributes
12821 /// of the attached resources are exposed in `additional_attributes` field, so
12822 /// as to allow users to search on them.
12823 pub attached_resources: std::vec::Vec<crate::model::AttachedResource>,
12824
12825 /// A map of related resources of this resource, keyed by the
12826 /// relationship type. A relationship type is in the format of
12827 /// {SourceType}_{ACTION}_{DestType}. Example: `DISK_TO_INSTANCE`,
12828 /// `DISK_TO_NETWORK`, `INSTANCE_TO_INSTANCEGROUP`.
12829 /// See [supported relationship
12830 /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types).
12831 pub relationships:
12832 std::collections::HashMap<std::string::String, crate::model::RelatedResources>,
12833
12834 /// This field is only present for the purpose of backward compatibility.
12835 /// Use the `tags` field instead.
12836 ///
12837 /// TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}.
12838 /// To search against the `tagKeys`:
12839 ///
12840 /// * Use a field query. Example:
12841 ///
12842 /// - `tagKeys:"123456789/env*"`
12843 /// - `tagKeys="123456789/env"`
12844 /// - `tagKeys:"env"`
12845 /// * Use a free text query. Example:
12846 ///
12847 /// - `env`
12848 #[deprecated]
12849 pub tag_keys: std::vec::Vec<std::string::String>,
12850
12851 /// This field is only present for the purpose of backward compatibility.
12852 /// Use the `tags` field instead.
12853 ///
12854 /// TagValue namespaced names, in the format of
12855 /// {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}.
12856 /// To search against the `tagValues`:
12857 ///
12858 /// * Use a field query. Example:
12859 ///
12860 /// - `tagValues:"env"`
12861 /// - `tagValues:"env/prod"`
12862 /// - `tagValues:"123456789/env/prod*"`
12863 /// - `tagValues="123456789/env/prod"`
12864 /// * Use a free text query. Example:
12865 ///
12866 /// - `prod`
12867 #[deprecated]
12868 pub tag_values: std::vec::Vec<std::string::String>,
12869
12870 /// This field is only present for the purpose of backward compatibility.
12871 /// Use the `tags` field instead.
12872 ///
12873 /// TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}.
12874 /// To search against the `tagValueIds`:
12875 ///
12876 /// * Use a field query. Example:
12877 ///
12878 /// - `tagValueIds="tagValues/456"`
12879 /// * Use a free text query. Example:
12880 ///
12881 /// - `456`
12882 #[deprecated]
12883 pub tag_value_ids: std::vec::Vec<std::string::String>,
12884
12885 /// The tags directly attached to this resource.
12886 ///
12887 /// To search against the `tags`:
12888 ///
12889 /// * Use a field query. Example:
12890 ///
12891 /// - `tagKeys:"123456789/env*"`
12892 /// - `tagKeys="123456789/env"`
12893 /// - `tagKeys:"env"`
12894 /// - `tagKeyIds="tagKeys/123"`
12895 /// - `tagValues:"env"`
12896 /// - `tagValues:"env/prod"`
12897 /// - `tagValues:"123456789/env/prod*"`
12898 /// - `tagValues="123456789/env/prod"`
12899 /// - `tagValueIds="tagValues/456"`
12900 /// * Use a free text query. Example:
12901 ///
12902 /// - `env/prod`
12903 pub tags: std::vec::Vec<crate::model::Tag>,
12904
12905 /// The effective tags on this resource. All of the tags that are both attached
12906 /// to and inherited by a resource are collectively called the effective
12907 /// tags. For more information, see [tag
12908 /// inheritance](https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance).
12909 ///
12910 /// To search against the `effective_tags`:
12911 ///
12912 /// * Use a field query. Example:
12913 /// - `effectiveTagKeys:"123456789/env*"`
12914 /// - `effectiveTagKeys="123456789/env"`
12915 /// - `effectiveTagKeys:"env"`
12916 /// - `effectiveTagKeyIds="tagKeys/123"`
12917 /// - `effectiveTagValues:"env"`
12918 /// - `effectiveTagValues:"env/prod"`
12919 /// - `effectiveTagValues:"123456789/env/prod*"`
12920 /// - `effectiveTagValues="123456789/env/prod"`
12921 /// - `effectiveTagValueIds="tagValues/456"`
12922 pub effective_tags: std::vec::Vec<crate::model::EffectiveTagDetails>,
12923
12924 /// Enrichments of the asset. Currently supported enrichment types with
12925 /// SearchAllResources API:
12926 ///
12927 /// * RESOURCE_OWNERS
12928 ///
12929 /// The corresponding read masks in order to get the enrichment:
12930 ///
12931 /// * enrichments.resource_owners
12932 ///
12933 /// The corresponding required permissions:
12934 ///
12935 /// * cloudasset.assets.searchEnrichmentResourceOwners
12936 ///
12937 /// Example query to get resource owner enrichment:
12938 ///
12939 /// ```norust
12940 /// scope: "projects/my-project"
12941 /// query: "name: my-project"
12942 /// assetTypes: "cloudresourcemanager.googleapis.com/Project"
12943 /// readMask: {
12944 /// paths: "asset_type"
12945 /// paths: "name"
12946 /// paths: "enrichments.resource_owners"
12947 /// }
12948 /// ```
12949 pub enrichments: std::vec::Vec<crate::model::AssetEnrichment>,
12950
12951 /// The type of this resource's immediate parent, if there is one.
12952 ///
12953 /// To search against the `parent_asset_type`:
12954 ///
12955 /// * Use a field query. Example:
12956 /// `parentAssetType:"cloudresourcemanager.googleapis.com/Project"`
12957 /// * Use a free text query. Example:
12958 /// `cloudresourcemanager.googleapis.com/Project`
12959 pub parent_asset_type: std::string::String,
12960
12961 /// The actual content of Security Command Center security marks associated
12962 /// with the asset.
12963 ///
12964 /// To search against SCC SecurityMarks field:
12965 ///
12966 /// * Use a field query:
12967 /// - query by a given key value pair. Example: `sccSecurityMarks.foo=bar`
12968 /// - query by a given key's existence. Example: `sccSecurityMarks.foo:*`
12969 pub scc_security_marks: std::collections::HashMap<std::string::String, std::string::String>,
12970
12971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12972}
12973
12974impl ResourceSearchResult {
12975 pub fn new() -> Self {
12976 std::default::Default::default()
12977 }
12978
12979 /// Sets the value of [name][crate::model::ResourceSearchResult::name].
12980 ///
12981 /// # Example
12982 /// ```ignore,no_run
12983 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
12984 /// let x = ResourceSearchResult::new().set_name("example");
12985 /// ```
12986 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12987 self.name = v.into();
12988 self
12989 }
12990
12991 /// Sets the value of [asset_type][crate::model::ResourceSearchResult::asset_type].
12992 ///
12993 /// # Example
12994 /// ```ignore,no_run
12995 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
12996 /// let x = ResourceSearchResult::new().set_asset_type("example");
12997 /// ```
12998 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12999 self.asset_type = v.into();
13000 self
13001 }
13002
13003 /// Sets the value of [project][crate::model::ResourceSearchResult::project].
13004 ///
13005 /// # Example
13006 /// ```ignore,no_run
13007 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13008 /// let x = ResourceSearchResult::new().set_project("example");
13009 /// ```
13010 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13011 self.project = v.into();
13012 self
13013 }
13014
13015 /// Sets the value of [folders][crate::model::ResourceSearchResult::folders].
13016 ///
13017 /// # Example
13018 /// ```ignore,no_run
13019 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13020 /// let x = ResourceSearchResult::new().set_folders(["a", "b", "c"]);
13021 /// ```
13022 pub fn set_folders<T, V>(mut self, v: T) -> Self
13023 where
13024 T: std::iter::IntoIterator<Item = V>,
13025 V: std::convert::Into<std::string::String>,
13026 {
13027 use std::iter::Iterator;
13028 self.folders = v.into_iter().map(|i| i.into()).collect();
13029 self
13030 }
13031
13032 /// Sets the value of [organization][crate::model::ResourceSearchResult::organization].
13033 ///
13034 /// # Example
13035 /// ```ignore,no_run
13036 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13037 /// let x = ResourceSearchResult::new().set_organization("example");
13038 /// ```
13039 pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13040 self.organization = v.into();
13041 self
13042 }
13043
13044 /// Sets the value of [display_name][crate::model::ResourceSearchResult::display_name].
13045 ///
13046 /// # Example
13047 /// ```ignore,no_run
13048 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13049 /// let x = ResourceSearchResult::new().set_display_name("example");
13050 /// ```
13051 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13052 self.display_name = v.into();
13053 self
13054 }
13055
13056 /// Sets the value of [description][crate::model::ResourceSearchResult::description].
13057 ///
13058 /// # Example
13059 /// ```ignore,no_run
13060 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13061 /// let x = ResourceSearchResult::new().set_description("example");
13062 /// ```
13063 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13064 self.description = v.into();
13065 self
13066 }
13067
13068 /// Sets the value of [location][crate::model::ResourceSearchResult::location].
13069 ///
13070 /// # Example
13071 /// ```ignore,no_run
13072 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13073 /// let x = ResourceSearchResult::new().set_location("example");
13074 /// ```
13075 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13076 self.location = v.into();
13077 self
13078 }
13079
13080 /// Sets the value of [labels][crate::model::ResourceSearchResult::labels].
13081 ///
13082 /// # Example
13083 /// ```ignore,no_run
13084 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13085 /// let x = ResourceSearchResult::new().set_labels([
13086 /// ("key0", "abc"),
13087 /// ("key1", "xyz"),
13088 /// ]);
13089 /// ```
13090 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
13091 where
13092 T: std::iter::IntoIterator<Item = (K, V)>,
13093 K: std::convert::Into<std::string::String>,
13094 V: std::convert::Into<std::string::String>,
13095 {
13096 use std::iter::Iterator;
13097 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13098 self
13099 }
13100
13101 /// Sets the value of [network_tags][crate::model::ResourceSearchResult::network_tags].
13102 ///
13103 /// # Example
13104 /// ```ignore,no_run
13105 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13106 /// let x = ResourceSearchResult::new().set_network_tags(["a", "b", "c"]);
13107 /// ```
13108 pub fn set_network_tags<T, V>(mut self, v: T) -> Self
13109 where
13110 T: std::iter::IntoIterator<Item = V>,
13111 V: std::convert::Into<std::string::String>,
13112 {
13113 use std::iter::Iterator;
13114 self.network_tags = v.into_iter().map(|i| i.into()).collect();
13115 self
13116 }
13117
13118 /// Sets the value of [kms_key][crate::model::ResourceSearchResult::kms_key].
13119 ///
13120 /// # Example
13121 /// ```ignore,no_run
13122 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13123 /// let x = ResourceSearchResult::new().set_kms_key("example");
13124 /// ```
13125 #[deprecated]
13126 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13127 self.kms_key = v.into();
13128 self
13129 }
13130
13131 /// Sets the value of [kms_keys][crate::model::ResourceSearchResult::kms_keys].
13132 ///
13133 /// # Example
13134 /// ```ignore,no_run
13135 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13136 /// let x = ResourceSearchResult::new().set_kms_keys(["a", "b", "c"]);
13137 /// ```
13138 pub fn set_kms_keys<T, V>(mut self, v: T) -> Self
13139 where
13140 T: std::iter::IntoIterator<Item = V>,
13141 V: std::convert::Into<std::string::String>,
13142 {
13143 use std::iter::Iterator;
13144 self.kms_keys = v.into_iter().map(|i| i.into()).collect();
13145 self
13146 }
13147
13148 /// Sets the value of [create_time][crate::model::ResourceSearchResult::create_time].
13149 ///
13150 /// # Example
13151 /// ```ignore,no_run
13152 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13153 /// use wkt::Timestamp;
13154 /// let x = ResourceSearchResult::new().set_create_time(Timestamp::default()/* use setters */);
13155 /// ```
13156 pub fn set_create_time<T>(mut self, v: T) -> Self
13157 where
13158 T: std::convert::Into<wkt::Timestamp>,
13159 {
13160 self.create_time = std::option::Option::Some(v.into());
13161 self
13162 }
13163
13164 /// Sets or clears the value of [create_time][crate::model::ResourceSearchResult::create_time].
13165 ///
13166 /// # Example
13167 /// ```ignore,no_run
13168 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13169 /// use wkt::Timestamp;
13170 /// let x = ResourceSearchResult::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13171 /// let x = ResourceSearchResult::new().set_or_clear_create_time(None::<Timestamp>);
13172 /// ```
13173 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13174 where
13175 T: std::convert::Into<wkt::Timestamp>,
13176 {
13177 self.create_time = v.map(|x| x.into());
13178 self
13179 }
13180
13181 /// Sets the value of [update_time][crate::model::ResourceSearchResult::update_time].
13182 ///
13183 /// # Example
13184 /// ```ignore,no_run
13185 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13186 /// use wkt::Timestamp;
13187 /// let x = ResourceSearchResult::new().set_update_time(Timestamp::default()/* use setters */);
13188 /// ```
13189 pub fn set_update_time<T>(mut self, v: T) -> Self
13190 where
13191 T: std::convert::Into<wkt::Timestamp>,
13192 {
13193 self.update_time = std::option::Option::Some(v.into());
13194 self
13195 }
13196
13197 /// Sets or clears the value of [update_time][crate::model::ResourceSearchResult::update_time].
13198 ///
13199 /// # Example
13200 /// ```ignore,no_run
13201 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13202 /// use wkt::Timestamp;
13203 /// let x = ResourceSearchResult::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13204 /// let x = ResourceSearchResult::new().set_or_clear_update_time(None::<Timestamp>);
13205 /// ```
13206 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13207 where
13208 T: std::convert::Into<wkt::Timestamp>,
13209 {
13210 self.update_time = v.map(|x| x.into());
13211 self
13212 }
13213
13214 /// Sets the value of [state][crate::model::ResourceSearchResult::state].
13215 ///
13216 /// # Example
13217 /// ```ignore,no_run
13218 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13219 /// let x = ResourceSearchResult::new().set_state("example");
13220 /// ```
13221 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13222 self.state = v.into();
13223 self
13224 }
13225
13226 /// Sets the value of [additional_attributes][crate::model::ResourceSearchResult::additional_attributes].
13227 ///
13228 /// # Example
13229 /// ```ignore,no_run
13230 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13231 /// use wkt::Struct;
13232 /// let x = ResourceSearchResult::new().set_additional_attributes(Struct::default()/* use setters */);
13233 /// ```
13234 pub fn set_additional_attributes<T>(mut self, v: T) -> Self
13235 where
13236 T: std::convert::Into<wkt::Struct>,
13237 {
13238 self.additional_attributes = std::option::Option::Some(v.into());
13239 self
13240 }
13241
13242 /// Sets or clears the value of [additional_attributes][crate::model::ResourceSearchResult::additional_attributes].
13243 ///
13244 /// # Example
13245 /// ```ignore,no_run
13246 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13247 /// use wkt::Struct;
13248 /// let x = ResourceSearchResult::new().set_or_clear_additional_attributes(Some(Struct::default()/* use setters */));
13249 /// let x = ResourceSearchResult::new().set_or_clear_additional_attributes(None::<Struct>);
13250 /// ```
13251 pub fn set_or_clear_additional_attributes<T>(mut self, v: std::option::Option<T>) -> Self
13252 where
13253 T: std::convert::Into<wkt::Struct>,
13254 {
13255 self.additional_attributes = v.map(|x| x.into());
13256 self
13257 }
13258
13259 /// Sets the value of [parent_full_resource_name][crate::model::ResourceSearchResult::parent_full_resource_name].
13260 ///
13261 /// # Example
13262 /// ```ignore,no_run
13263 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13264 /// let x = ResourceSearchResult::new().set_parent_full_resource_name("example");
13265 /// ```
13266 pub fn set_parent_full_resource_name<T: std::convert::Into<std::string::String>>(
13267 mut self,
13268 v: T,
13269 ) -> Self {
13270 self.parent_full_resource_name = v.into();
13271 self
13272 }
13273
13274 /// Sets the value of [versioned_resources][crate::model::ResourceSearchResult::versioned_resources].
13275 ///
13276 /// # Example
13277 /// ```ignore,no_run
13278 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13279 /// use google_cloud_asset_v1::model::VersionedResource;
13280 /// let x = ResourceSearchResult::new()
13281 /// .set_versioned_resources([
13282 /// VersionedResource::default()/* use setters */,
13283 /// VersionedResource::default()/* use (different) setters */,
13284 /// ]);
13285 /// ```
13286 pub fn set_versioned_resources<T, V>(mut self, v: T) -> Self
13287 where
13288 T: std::iter::IntoIterator<Item = V>,
13289 V: std::convert::Into<crate::model::VersionedResource>,
13290 {
13291 use std::iter::Iterator;
13292 self.versioned_resources = v.into_iter().map(|i| i.into()).collect();
13293 self
13294 }
13295
13296 /// Sets the value of [attached_resources][crate::model::ResourceSearchResult::attached_resources].
13297 ///
13298 /// # Example
13299 /// ```ignore,no_run
13300 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13301 /// use google_cloud_asset_v1::model::AttachedResource;
13302 /// let x = ResourceSearchResult::new()
13303 /// .set_attached_resources([
13304 /// AttachedResource::default()/* use setters */,
13305 /// AttachedResource::default()/* use (different) setters */,
13306 /// ]);
13307 /// ```
13308 pub fn set_attached_resources<T, V>(mut self, v: T) -> Self
13309 where
13310 T: std::iter::IntoIterator<Item = V>,
13311 V: std::convert::Into<crate::model::AttachedResource>,
13312 {
13313 use std::iter::Iterator;
13314 self.attached_resources = v.into_iter().map(|i| i.into()).collect();
13315 self
13316 }
13317
13318 /// Sets the value of [relationships][crate::model::ResourceSearchResult::relationships].
13319 ///
13320 /// # Example
13321 /// ```ignore,no_run
13322 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13323 /// use google_cloud_asset_v1::model::RelatedResources;
13324 /// let x = ResourceSearchResult::new().set_relationships([
13325 /// ("key0", RelatedResources::default()/* use setters */),
13326 /// ("key1", RelatedResources::default()/* use (different) setters */),
13327 /// ]);
13328 /// ```
13329 pub fn set_relationships<T, K, V>(mut self, v: T) -> Self
13330 where
13331 T: std::iter::IntoIterator<Item = (K, V)>,
13332 K: std::convert::Into<std::string::String>,
13333 V: std::convert::Into<crate::model::RelatedResources>,
13334 {
13335 use std::iter::Iterator;
13336 self.relationships = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13337 self
13338 }
13339
13340 /// Sets the value of [tag_keys][crate::model::ResourceSearchResult::tag_keys].
13341 ///
13342 /// # Example
13343 /// ```ignore,no_run
13344 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13345 /// let x = ResourceSearchResult::new().set_tag_keys(["a", "b", "c"]);
13346 /// ```
13347 #[deprecated]
13348 pub fn set_tag_keys<T, V>(mut self, v: T) -> Self
13349 where
13350 T: std::iter::IntoIterator<Item = V>,
13351 V: std::convert::Into<std::string::String>,
13352 {
13353 use std::iter::Iterator;
13354 self.tag_keys = v.into_iter().map(|i| i.into()).collect();
13355 self
13356 }
13357
13358 /// Sets the value of [tag_values][crate::model::ResourceSearchResult::tag_values].
13359 ///
13360 /// # Example
13361 /// ```ignore,no_run
13362 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13363 /// let x = ResourceSearchResult::new().set_tag_values(["a", "b", "c"]);
13364 /// ```
13365 #[deprecated]
13366 pub fn set_tag_values<T, V>(mut self, v: T) -> Self
13367 where
13368 T: std::iter::IntoIterator<Item = V>,
13369 V: std::convert::Into<std::string::String>,
13370 {
13371 use std::iter::Iterator;
13372 self.tag_values = v.into_iter().map(|i| i.into()).collect();
13373 self
13374 }
13375
13376 /// Sets the value of [tag_value_ids][crate::model::ResourceSearchResult::tag_value_ids].
13377 ///
13378 /// # Example
13379 /// ```ignore,no_run
13380 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13381 /// let x = ResourceSearchResult::new().set_tag_value_ids(["a", "b", "c"]);
13382 /// ```
13383 #[deprecated]
13384 pub fn set_tag_value_ids<T, V>(mut self, v: T) -> Self
13385 where
13386 T: std::iter::IntoIterator<Item = V>,
13387 V: std::convert::Into<std::string::String>,
13388 {
13389 use std::iter::Iterator;
13390 self.tag_value_ids = v.into_iter().map(|i| i.into()).collect();
13391 self
13392 }
13393
13394 /// Sets the value of [tags][crate::model::ResourceSearchResult::tags].
13395 ///
13396 /// # Example
13397 /// ```ignore,no_run
13398 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13399 /// use google_cloud_asset_v1::model::Tag;
13400 /// let x = ResourceSearchResult::new()
13401 /// .set_tags([
13402 /// Tag::default()/* use setters */,
13403 /// Tag::default()/* use (different) setters */,
13404 /// ]);
13405 /// ```
13406 pub fn set_tags<T, V>(mut self, v: T) -> Self
13407 where
13408 T: std::iter::IntoIterator<Item = V>,
13409 V: std::convert::Into<crate::model::Tag>,
13410 {
13411 use std::iter::Iterator;
13412 self.tags = v.into_iter().map(|i| i.into()).collect();
13413 self
13414 }
13415
13416 /// Sets the value of [effective_tags][crate::model::ResourceSearchResult::effective_tags].
13417 ///
13418 /// # Example
13419 /// ```ignore,no_run
13420 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13421 /// use google_cloud_asset_v1::model::EffectiveTagDetails;
13422 /// let x = ResourceSearchResult::new()
13423 /// .set_effective_tags([
13424 /// EffectiveTagDetails::default()/* use setters */,
13425 /// EffectiveTagDetails::default()/* use (different) setters */,
13426 /// ]);
13427 /// ```
13428 pub fn set_effective_tags<T, V>(mut self, v: T) -> Self
13429 where
13430 T: std::iter::IntoIterator<Item = V>,
13431 V: std::convert::Into<crate::model::EffectiveTagDetails>,
13432 {
13433 use std::iter::Iterator;
13434 self.effective_tags = v.into_iter().map(|i| i.into()).collect();
13435 self
13436 }
13437
13438 /// Sets the value of [enrichments][crate::model::ResourceSearchResult::enrichments].
13439 ///
13440 /// # Example
13441 /// ```ignore,no_run
13442 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13443 /// use google_cloud_asset_v1::model::AssetEnrichment;
13444 /// let x = ResourceSearchResult::new()
13445 /// .set_enrichments([
13446 /// AssetEnrichment::default()/* use setters */,
13447 /// AssetEnrichment::default()/* use (different) setters */,
13448 /// ]);
13449 /// ```
13450 pub fn set_enrichments<T, V>(mut self, v: T) -> Self
13451 where
13452 T: std::iter::IntoIterator<Item = V>,
13453 V: std::convert::Into<crate::model::AssetEnrichment>,
13454 {
13455 use std::iter::Iterator;
13456 self.enrichments = v.into_iter().map(|i| i.into()).collect();
13457 self
13458 }
13459
13460 /// Sets the value of [parent_asset_type][crate::model::ResourceSearchResult::parent_asset_type].
13461 ///
13462 /// # Example
13463 /// ```ignore,no_run
13464 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13465 /// let x = ResourceSearchResult::new().set_parent_asset_type("example");
13466 /// ```
13467 pub fn set_parent_asset_type<T: std::convert::Into<std::string::String>>(
13468 mut self,
13469 v: T,
13470 ) -> Self {
13471 self.parent_asset_type = v.into();
13472 self
13473 }
13474
13475 /// Sets the value of [scc_security_marks][crate::model::ResourceSearchResult::scc_security_marks].
13476 ///
13477 /// # Example
13478 /// ```ignore,no_run
13479 /// # use google_cloud_asset_v1::model::ResourceSearchResult;
13480 /// let x = ResourceSearchResult::new().set_scc_security_marks([
13481 /// ("key0", "abc"),
13482 /// ("key1", "xyz"),
13483 /// ]);
13484 /// ```
13485 pub fn set_scc_security_marks<T, K, V>(mut self, v: T) -> Self
13486 where
13487 T: std::iter::IntoIterator<Item = (K, V)>,
13488 K: std::convert::Into<std::string::String>,
13489 V: std::convert::Into<std::string::String>,
13490 {
13491 use std::iter::Iterator;
13492 self.scc_security_marks = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13493 self
13494 }
13495}
13496
13497impl wkt::message::Message for ResourceSearchResult {
13498 fn typename() -> &'static str {
13499 "type.googleapis.com/google.cloud.asset.v1.ResourceSearchResult"
13500 }
13501}
13502
13503/// Resource representation as defined by the corresponding service providing the
13504/// resource for a given API version.
13505#[derive(Clone, Default, PartialEq)]
13506#[non_exhaustive]
13507pub struct VersionedResource {
13508 /// API version of the resource.
13509 ///
13510 /// Example:
13511 /// If the resource is an instance provided by Compute Engine v1 API as defined
13512 /// in `<https://cloud.google.com/compute/docs/reference/rest/v1/instances>`,
13513 /// version will be "v1".
13514 pub version: std::string::String,
13515
13516 /// JSON representation of the resource as defined by the corresponding
13517 /// service providing this resource.
13518 ///
13519 /// Example:
13520 /// If the resource is an instance provided by Compute Engine, this field will
13521 /// contain the JSON representation of the instance as defined by Compute
13522 /// Engine:
13523 /// `<https://cloud.google.com/compute/docs/reference/rest/v1/instances>`.
13524 ///
13525 /// You can find the resource definition for each supported resource type in
13526 /// this table:
13527 /// `<https://cloud.google.com/asset-inventory/docs/supported-asset-types>`
13528 pub resource: std::option::Option<wkt::Struct>,
13529
13530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13531}
13532
13533impl VersionedResource {
13534 pub fn new() -> Self {
13535 std::default::Default::default()
13536 }
13537
13538 /// Sets the value of [version][crate::model::VersionedResource::version].
13539 ///
13540 /// # Example
13541 /// ```ignore,no_run
13542 /// # use google_cloud_asset_v1::model::VersionedResource;
13543 /// let x = VersionedResource::new().set_version("example");
13544 /// ```
13545 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13546 self.version = v.into();
13547 self
13548 }
13549
13550 /// Sets the value of [resource][crate::model::VersionedResource::resource].
13551 ///
13552 /// # Example
13553 /// ```ignore,no_run
13554 /// # use google_cloud_asset_v1::model::VersionedResource;
13555 /// use wkt::Struct;
13556 /// let x = VersionedResource::new().set_resource(Struct::default()/* use setters */);
13557 /// ```
13558 pub fn set_resource<T>(mut self, v: T) -> Self
13559 where
13560 T: std::convert::Into<wkt::Struct>,
13561 {
13562 self.resource = std::option::Option::Some(v.into());
13563 self
13564 }
13565
13566 /// Sets or clears the value of [resource][crate::model::VersionedResource::resource].
13567 ///
13568 /// # Example
13569 /// ```ignore,no_run
13570 /// # use google_cloud_asset_v1::model::VersionedResource;
13571 /// use wkt::Struct;
13572 /// let x = VersionedResource::new().set_or_clear_resource(Some(Struct::default()/* use setters */));
13573 /// let x = VersionedResource::new().set_or_clear_resource(None::<Struct>);
13574 /// ```
13575 pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
13576 where
13577 T: std::convert::Into<wkt::Struct>,
13578 {
13579 self.resource = v.map(|x| x.into());
13580 self
13581 }
13582}
13583
13584impl wkt::message::Message for VersionedResource {
13585 fn typename() -> &'static str {
13586 "type.googleapis.com/google.cloud.asset.v1.VersionedResource"
13587 }
13588}
13589
13590/// Attached resource representation, which is defined by the corresponding
13591/// service provider. It represents an attached resource's payload.
13592#[derive(Clone, Default, PartialEq)]
13593#[non_exhaustive]
13594pub struct AttachedResource {
13595 /// The type of this attached resource.
13596 ///
13597 /// Example: `osconfig.googleapis.com/Inventory`
13598 ///
13599 /// You can find the supported attached asset types of each resource in this
13600 /// table:
13601 /// `<https://cloud.google.com/asset-inventory/docs/supported-asset-types>`
13602 pub asset_type: std::string::String,
13603
13604 /// Versioned resource representations of this attached resource. This is
13605 /// repeated because there could be multiple versions of the attached resource
13606 /// representations during version migration.
13607 pub versioned_resources: std::vec::Vec<crate::model::VersionedResource>,
13608
13609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13610}
13611
13612impl AttachedResource {
13613 pub fn new() -> Self {
13614 std::default::Default::default()
13615 }
13616
13617 /// Sets the value of [asset_type][crate::model::AttachedResource::asset_type].
13618 ///
13619 /// # Example
13620 /// ```ignore,no_run
13621 /// # use google_cloud_asset_v1::model::AttachedResource;
13622 /// let x = AttachedResource::new().set_asset_type("example");
13623 /// ```
13624 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13625 self.asset_type = v.into();
13626 self
13627 }
13628
13629 /// Sets the value of [versioned_resources][crate::model::AttachedResource::versioned_resources].
13630 ///
13631 /// # Example
13632 /// ```ignore,no_run
13633 /// # use google_cloud_asset_v1::model::AttachedResource;
13634 /// use google_cloud_asset_v1::model::VersionedResource;
13635 /// let x = AttachedResource::new()
13636 /// .set_versioned_resources([
13637 /// VersionedResource::default()/* use setters */,
13638 /// VersionedResource::default()/* use (different) setters */,
13639 /// ]);
13640 /// ```
13641 pub fn set_versioned_resources<T, V>(mut self, v: T) -> Self
13642 where
13643 T: std::iter::IntoIterator<Item = V>,
13644 V: std::convert::Into<crate::model::VersionedResource>,
13645 {
13646 use std::iter::Iterator;
13647 self.versioned_resources = v.into_iter().map(|i| i.into()).collect();
13648 self
13649 }
13650}
13651
13652impl wkt::message::Message for AttachedResource {
13653 fn typename() -> &'static str {
13654 "type.googleapis.com/google.cloud.asset.v1.AttachedResource"
13655 }
13656}
13657
13658/// The related resources of the primary resource.
13659#[derive(Clone, Default, PartialEq)]
13660#[non_exhaustive]
13661pub struct RelatedResources {
13662 /// The detailed related resources of the primary resource.
13663 pub related_resources: std::vec::Vec<crate::model::RelatedResource>,
13664
13665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13666}
13667
13668impl RelatedResources {
13669 pub fn new() -> Self {
13670 std::default::Default::default()
13671 }
13672
13673 /// Sets the value of [related_resources][crate::model::RelatedResources::related_resources].
13674 ///
13675 /// # Example
13676 /// ```ignore,no_run
13677 /// # use google_cloud_asset_v1::model::RelatedResources;
13678 /// use google_cloud_asset_v1::model::RelatedResource;
13679 /// let x = RelatedResources::new()
13680 /// .set_related_resources([
13681 /// RelatedResource::default()/* use setters */,
13682 /// RelatedResource::default()/* use (different) setters */,
13683 /// ]);
13684 /// ```
13685 pub fn set_related_resources<T, V>(mut self, v: T) -> Self
13686 where
13687 T: std::iter::IntoIterator<Item = V>,
13688 V: std::convert::Into<crate::model::RelatedResource>,
13689 {
13690 use std::iter::Iterator;
13691 self.related_resources = v.into_iter().map(|i| i.into()).collect();
13692 self
13693 }
13694}
13695
13696impl wkt::message::Message for RelatedResources {
13697 fn typename() -> &'static str {
13698 "type.googleapis.com/google.cloud.asset.v1.RelatedResources"
13699 }
13700}
13701
13702/// The detailed related resource.
13703#[derive(Clone, Default, PartialEq)]
13704#[non_exhaustive]
13705pub struct RelatedResource {
13706 /// The type of the asset. Example: `compute.googleapis.com/Instance`
13707 pub asset_type: std::string::String,
13708
13709 /// The full resource name of the related resource. Example:
13710 /// `//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123`
13711 pub full_resource_name: std::string::String,
13712
13713 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13714}
13715
13716impl RelatedResource {
13717 pub fn new() -> Self {
13718 std::default::Default::default()
13719 }
13720
13721 /// Sets the value of [asset_type][crate::model::RelatedResource::asset_type].
13722 ///
13723 /// # Example
13724 /// ```ignore,no_run
13725 /// # use google_cloud_asset_v1::model::RelatedResource;
13726 /// let x = RelatedResource::new().set_asset_type("example");
13727 /// ```
13728 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13729 self.asset_type = v.into();
13730 self
13731 }
13732
13733 /// Sets the value of [full_resource_name][crate::model::RelatedResource::full_resource_name].
13734 ///
13735 /// # Example
13736 /// ```ignore,no_run
13737 /// # use google_cloud_asset_v1::model::RelatedResource;
13738 /// let x = RelatedResource::new().set_full_resource_name("example");
13739 /// ```
13740 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
13741 mut self,
13742 v: T,
13743 ) -> Self {
13744 self.full_resource_name = v.into();
13745 self
13746 }
13747}
13748
13749impl wkt::message::Message for RelatedResource {
13750 fn typename() -> &'static str {
13751 "type.googleapis.com/google.cloud.asset.v1.RelatedResource"
13752 }
13753}
13754
13755/// A result of IAM Policy search, containing information of an IAM policy.
13756#[derive(Clone, Default, PartialEq)]
13757#[non_exhaustive]
13758pub struct IamPolicySearchResult {
13759 /// The full resource name of the resource associated with this IAM policy.
13760 /// Example:
13761 /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
13762 /// See [Cloud Asset Inventory Resource Name
13763 /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
13764 /// for more information.
13765 ///
13766 /// To search against the `resource`:
13767 ///
13768 /// * use a field query. Example: `resource:organizations/123`
13769 pub resource: std::string::String,
13770
13771 /// The type of the resource associated with this IAM policy. Example:
13772 /// `compute.googleapis.com/Disk`.
13773 ///
13774 /// To search against the `asset_type`:
13775 ///
13776 /// * specify the `asset_types` field in your search request.
13777 pub asset_type: std::string::String,
13778
13779 /// The project that the associated Google Cloud resource belongs to, in the
13780 /// form of projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource
13781 /// (like VM instance, Cloud Storage bucket), the project field will indicate
13782 /// the project that contains the resource. If an IAM policy is set on a folder
13783 /// or organization, this field will be empty.
13784 ///
13785 /// To search against the `project`:
13786 ///
13787 /// * specify the `scope` field as this project in your search request.
13788 pub project: std::string::String,
13789
13790 /// The folder(s) that the IAM policy belongs to, in the form of
13791 /// folders/{FOLDER_NUMBER}. This field is available when the IAM policy
13792 /// belongs to one or more folders.
13793 ///
13794 /// To search against `folders`:
13795 ///
13796 /// * use a field query. Example: `folders:(123 OR 456)`
13797 /// * use a free text query. Example: `123`
13798 /// * specify the `scope` field as this folder in your search request.
13799 pub folders: std::vec::Vec<std::string::String>,
13800
13801 /// The organization that the IAM policy belongs to, in the form
13802 /// of organizations/{ORGANIZATION_NUMBER}. This field is available when the
13803 /// IAM policy belongs to an organization.
13804 ///
13805 /// To search against `organization`:
13806 ///
13807 /// * use a field query. Example: `organization:123`
13808 /// * use a free text query. Example: `123`
13809 /// * specify the `scope` field as this organization in your search request.
13810 pub organization: std::string::String,
13811
13812 /// The IAM policy directly set on the given resource. Note that the original
13813 /// IAM policy can contain multiple bindings. This only contains the bindings
13814 /// that match the given query. For queries that don't contain a constrain on
13815 /// policies (e.g., an empty query), this contains all the bindings.
13816 ///
13817 /// To search against the `policy` bindings:
13818 ///
13819 /// * use a field query:
13820 /// - query by the policy contained members. Example:
13821 /// `policy:amy@gmail.com`
13822 /// - query by the policy contained roles. Example:
13823 /// `policy:roles/compute.admin`
13824 /// - query by the policy contained roles' included permissions. Example:
13825 /// `policy.role.permissions:compute.instances.create`
13826 pub policy: std::option::Option<google_cloud_iam_v1::model::Policy>,
13827
13828 /// Explanation about the IAM policy search result. It contains additional
13829 /// information to explain why the search result matches the query.
13830 pub explanation: std::option::Option<crate::model::iam_policy_search_result::Explanation>,
13831
13832 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13833}
13834
13835impl IamPolicySearchResult {
13836 pub fn new() -> Self {
13837 std::default::Default::default()
13838 }
13839
13840 /// Sets the value of [resource][crate::model::IamPolicySearchResult::resource].
13841 ///
13842 /// # Example
13843 /// ```ignore,no_run
13844 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13845 /// let x = IamPolicySearchResult::new().set_resource("example");
13846 /// ```
13847 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13848 self.resource = v.into();
13849 self
13850 }
13851
13852 /// Sets the value of [asset_type][crate::model::IamPolicySearchResult::asset_type].
13853 ///
13854 /// # Example
13855 /// ```ignore,no_run
13856 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13857 /// let x = IamPolicySearchResult::new().set_asset_type("example");
13858 /// ```
13859 pub fn set_asset_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13860 self.asset_type = v.into();
13861 self
13862 }
13863
13864 /// Sets the value of [project][crate::model::IamPolicySearchResult::project].
13865 ///
13866 /// # Example
13867 /// ```ignore,no_run
13868 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13869 /// let x = IamPolicySearchResult::new().set_project("example");
13870 /// ```
13871 pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13872 self.project = v.into();
13873 self
13874 }
13875
13876 /// Sets the value of [folders][crate::model::IamPolicySearchResult::folders].
13877 ///
13878 /// # Example
13879 /// ```ignore,no_run
13880 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13881 /// let x = IamPolicySearchResult::new().set_folders(["a", "b", "c"]);
13882 /// ```
13883 pub fn set_folders<T, V>(mut self, v: T) -> Self
13884 where
13885 T: std::iter::IntoIterator<Item = V>,
13886 V: std::convert::Into<std::string::String>,
13887 {
13888 use std::iter::Iterator;
13889 self.folders = v.into_iter().map(|i| i.into()).collect();
13890 self
13891 }
13892
13893 /// Sets the value of [organization][crate::model::IamPolicySearchResult::organization].
13894 ///
13895 /// # Example
13896 /// ```ignore,no_run
13897 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13898 /// let x = IamPolicySearchResult::new().set_organization("example");
13899 /// ```
13900 pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13901 self.organization = v.into();
13902 self
13903 }
13904
13905 /// Sets the value of [policy][crate::model::IamPolicySearchResult::policy].
13906 ///
13907 /// # Example
13908 /// ```ignore,no_run
13909 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13910 /// use google_cloud_iam_v1::model::Policy;
13911 /// let x = IamPolicySearchResult::new().set_policy(Policy::default()/* use setters */);
13912 /// ```
13913 pub fn set_policy<T>(mut self, v: T) -> Self
13914 where
13915 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
13916 {
13917 self.policy = std::option::Option::Some(v.into());
13918 self
13919 }
13920
13921 /// Sets or clears the value of [policy][crate::model::IamPolicySearchResult::policy].
13922 ///
13923 /// # Example
13924 /// ```ignore,no_run
13925 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13926 /// use google_cloud_iam_v1::model::Policy;
13927 /// let x = IamPolicySearchResult::new().set_or_clear_policy(Some(Policy::default()/* use setters */));
13928 /// let x = IamPolicySearchResult::new().set_or_clear_policy(None::<Policy>);
13929 /// ```
13930 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
13931 where
13932 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
13933 {
13934 self.policy = v.map(|x| x.into());
13935 self
13936 }
13937
13938 /// Sets the value of [explanation][crate::model::IamPolicySearchResult::explanation].
13939 ///
13940 /// # Example
13941 /// ```ignore,no_run
13942 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13943 /// use google_cloud_asset_v1::model::iam_policy_search_result::Explanation;
13944 /// let x = IamPolicySearchResult::new().set_explanation(Explanation::default()/* use setters */);
13945 /// ```
13946 pub fn set_explanation<T>(mut self, v: T) -> Self
13947 where
13948 T: std::convert::Into<crate::model::iam_policy_search_result::Explanation>,
13949 {
13950 self.explanation = std::option::Option::Some(v.into());
13951 self
13952 }
13953
13954 /// Sets or clears the value of [explanation][crate::model::IamPolicySearchResult::explanation].
13955 ///
13956 /// # Example
13957 /// ```ignore,no_run
13958 /// # use google_cloud_asset_v1::model::IamPolicySearchResult;
13959 /// use google_cloud_asset_v1::model::iam_policy_search_result::Explanation;
13960 /// let x = IamPolicySearchResult::new().set_or_clear_explanation(Some(Explanation::default()/* use setters */));
13961 /// let x = IamPolicySearchResult::new().set_or_clear_explanation(None::<Explanation>);
13962 /// ```
13963 pub fn set_or_clear_explanation<T>(mut self, v: std::option::Option<T>) -> Self
13964 where
13965 T: std::convert::Into<crate::model::iam_policy_search_result::Explanation>,
13966 {
13967 self.explanation = v.map(|x| x.into());
13968 self
13969 }
13970}
13971
13972impl wkt::message::Message for IamPolicySearchResult {
13973 fn typename() -> &'static str {
13974 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult"
13975 }
13976}
13977
13978/// Defines additional types related to [IamPolicySearchResult].
13979pub mod iam_policy_search_result {
13980 #[allow(unused_imports)]
13981 use super::*;
13982
13983 /// Explanation about the IAM policy search result.
13984 #[derive(Clone, Default, PartialEq)]
13985 #[non_exhaustive]
13986 pub struct Explanation {
13987 /// The map from roles to their included permissions that match the
13988 /// permission query (i.e., a query containing `policy.role.permissions:`).
13989 /// Example: if query `policy.role.permissions:compute.disk.get`
13990 /// matches a policy binding that contains owner role, the
13991 /// matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The
13992 /// roles can also be found in the returned `policy` bindings. Note that the
13993 /// map is populated only for requests with permission queries.
13994 pub matched_permissions: std::collections::HashMap<
13995 std::string::String,
13996 crate::model::iam_policy_search_result::explanation::Permissions,
13997 >,
13998
13999 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14000 }
14001
14002 impl Explanation {
14003 pub fn new() -> Self {
14004 std::default::Default::default()
14005 }
14006
14007 /// Sets the value of [matched_permissions][crate::model::iam_policy_search_result::Explanation::matched_permissions].
14008 ///
14009 /// # Example
14010 /// ```ignore,no_run
14011 /// # use google_cloud_asset_v1::model::iam_policy_search_result::Explanation;
14012 /// use google_cloud_asset_v1::model::iam_policy_search_result::explanation::Permissions;
14013 /// let x = Explanation::new().set_matched_permissions([
14014 /// ("key0", Permissions::default()/* use setters */),
14015 /// ("key1", Permissions::default()/* use (different) setters */),
14016 /// ]);
14017 /// ```
14018 pub fn set_matched_permissions<T, K, V>(mut self, v: T) -> Self
14019 where
14020 T: std::iter::IntoIterator<Item = (K, V)>,
14021 K: std::convert::Into<std::string::String>,
14022 V: std::convert::Into<crate::model::iam_policy_search_result::explanation::Permissions>,
14023 {
14024 use std::iter::Iterator;
14025 self.matched_permissions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14026 self
14027 }
14028 }
14029
14030 impl wkt::message::Message for Explanation {
14031 fn typename() -> &'static str {
14032 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult.Explanation"
14033 }
14034 }
14035
14036 /// Defines additional types related to [Explanation].
14037 pub mod explanation {
14038 #[allow(unused_imports)]
14039 use super::*;
14040
14041 /// IAM permissions
14042 #[derive(Clone, Default, PartialEq)]
14043 #[non_exhaustive]
14044 pub struct Permissions {
14045 /// A list of permissions. A sample permission string: `compute.disk.get`.
14046 pub permissions: std::vec::Vec<std::string::String>,
14047
14048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14049 }
14050
14051 impl Permissions {
14052 pub fn new() -> Self {
14053 std::default::Default::default()
14054 }
14055
14056 /// Sets the value of [permissions][crate::model::iam_policy_search_result::explanation::Permissions::permissions].
14057 ///
14058 /// # Example
14059 /// ```ignore,no_run
14060 /// # use google_cloud_asset_v1::model::iam_policy_search_result::explanation::Permissions;
14061 /// let x = Permissions::new().set_permissions(["a", "b", "c"]);
14062 /// ```
14063 pub fn set_permissions<T, V>(mut self, v: T) -> Self
14064 where
14065 T: std::iter::IntoIterator<Item = V>,
14066 V: std::convert::Into<std::string::String>,
14067 {
14068 use std::iter::Iterator;
14069 self.permissions = v.into_iter().map(|i| i.into()).collect();
14070 self
14071 }
14072 }
14073
14074 impl wkt::message::Message for Permissions {
14075 fn typename() -> &'static str {
14076 "type.googleapis.com/google.cloud.asset.v1.IamPolicySearchResult.Explanation.Permissions"
14077 }
14078 }
14079 }
14080}
14081
14082/// Represents the detailed state of an entity under analysis, such as a
14083/// resource, an identity or an access.
14084#[derive(Clone, Default, PartialEq)]
14085#[non_exhaustive]
14086pub struct IamPolicyAnalysisState {
14087 /// The Google standard error code that best describes the state.
14088 /// For example:
14089 ///
14090 /// - OK means the analysis on this entity has been successfully finished;
14091 /// - PERMISSION_DENIED means an access denied error is encountered;
14092 /// - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started
14093 /// in time;
14094 pub code: google_cloud_rpc::model::Code,
14095
14096 /// The human-readable description of the cause of failure.
14097 pub cause: std::string::String,
14098
14099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14100}
14101
14102impl IamPolicyAnalysisState {
14103 pub fn new() -> Self {
14104 std::default::Default::default()
14105 }
14106
14107 /// Sets the value of [code][crate::model::IamPolicyAnalysisState::code].
14108 ///
14109 /// # Example
14110 /// ```ignore,no_run
14111 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14112 /// use google_cloud_rpc::model::Code;
14113 /// let x0 = IamPolicyAnalysisState::new().set_code(Code::Cancelled);
14114 /// let x1 = IamPolicyAnalysisState::new().set_code(Code::Unknown);
14115 /// let x2 = IamPolicyAnalysisState::new().set_code(Code::InvalidArgument);
14116 /// ```
14117 pub fn set_code<T: std::convert::Into<google_cloud_rpc::model::Code>>(mut self, v: T) -> Self {
14118 self.code = v.into();
14119 self
14120 }
14121
14122 /// Sets the value of [cause][crate::model::IamPolicyAnalysisState::cause].
14123 ///
14124 /// # Example
14125 /// ```ignore,no_run
14126 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14127 /// let x = IamPolicyAnalysisState::new().set_cause("example");
14128 /// ```
14129 pub fn set_cause<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14130 self.cause = v.into();
14131 self
14132 }
14133}
14134
14135impl wkt::message::Message for IamPolicyAnalysisState {
14136 fn typename() -> &'static str {
14137 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisState"
14138 }
14139}
14140
14141/// The condition evaluation.
14142#[derive(Clone, Default, PartialEq)]
14143#[non_exhaustive]
14144pub struct ConditionEvaluation {
14145 /// The evaluation result.
14146 pub evaluation_value: crate::model::condition_evaluation::EvaluationValue,
14147
14148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14149}
14150
14151impl ConditionEvaluation {
14152 pub fn new() -> Self {
14153 std::default::Default::default()
14154 }
14155
14156 /// Sets the value of [evaluation_value][crate::model::ConditionEvaluation::evaluation_value].
14157 ///
14158 /// # Example
14159 /// ```ignore,no_run
14160 /// # use google_cloud_asset_v1::model::ConditionEvaluation;
14161 /// use google_cloud_asset_v1::model::condition_evaluation::EvaluationValue;
14162 /// let x0 = ConditionEvaluation::new().set_evaluation_value(EvaluationValue::True);
14163 /// let x1 = ConditionEvaluation::new().set_evaluation_value(EvaluationValue::False);
14164 /// let x2 = ConditionEvaluation::new().set_evaluation_value(EvaluationValue::Conditional);
14165 /// ```
14166 pub fn set_evaluation_value<
14167 T: std::convert::Into<crate::model::condition_evaluation::EvaluationValue>,
14168 >(
14169 mut self,
14170 v: T,
14171 ) -> Self {
14172 self.evaluation_value = v.into();
14173 self
14174 }
14175}
14176
14177impl wkt::message::Message for ConditionEvaluation {
14178 fn typename() -> &'static str {
14179 "type.googleapis.com/google.cloud.asset.v1.ConditionEvaluation"
14180 }
14181}
14182
14183/// Defines additional types related to [ConditionEvaluation].
14184pub mod condition_evaluation {
14185 #[allow(unused_imports)]
14186 use super::*;
14187
14188 /// Value of this expression.
14189 ///
14190 /// # Working with unknown values
14191 ///
14192 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14193 /// additional enum variants at any time. Adding new variants is not considered
14194 /// a breaking change. Applications should write their code in anticipation of:
14195 ///
14196 /// - New values appearing in future releases of the client library, **and**
14197 /// - New values received dynamically, without application changes.
14198 ///
14199 /// Please consult the [Working with enums] section in the user guide for some
14200 /// guidelines.
14201 ///
14202 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14203 #[derive(Clone, Debug, PartialEq)]
14204 #[non_exhaustive]
14205 pub enum EvaluationValue {
14206 /// Reserved for future use.
14207 Unspecified,
14208 /// The evaluation result is `true`.
14209 True,
14210 /// The evaluation result is `false`.
14211 False,
14212 /// The evaluation result is `conditional` when the condition expression
14213 /// contains variables that are either missing input values or have not been
14214 /// supported by Policy Analyzer yet.
14215 Conditional,
14216 /// If set, the enum was initialized with an unknown value.
14217 ///
14218 /// Applications can examine the value using [EvaluationValue::value] or
14219 /// [EvaluationValue::name].
14220 UnknownValue(evaluation_value::UnknownValue),
14221 }
14222
14223 #[doc(hidden)]
14224 pub mod evaluation_value {
14225 #[allow(unused_imports)]
14226 use super::*;
14227 #[derive(Clone, Debug, PartialEq)]
14228 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14229 }
14230
14231 impl EvaluationValue {
14232 /// Gets the enum value.
14233 ///
14234 /// Returns `None` if the enum contains an unknown value deserialized from
14235 /// the string representation of enums.
14236 pub fn value(&self) -> std::option::Option<i32> {
14237 match self {
14238 Self::Unspecified => std::option::Option::Some(0),
14239 Self::True => std::option::Option::Some(1),
14240 Self::False => std::option::Option::Some(2),
14241 Self::Conditional => std::option::Option::Some(3),
14242 Self::UnknownValue(u) => u.0.value(),
14243 }
14244 }
14245
14246 /// Gets the enum value as a string.
14247 ///
14248 /// Returns `None` if the enum contains an unknown value deserialized from
14249 /// the integer representation of enums.
14250 pub fn name(&self) -> std::option::Option<&str> {
14251 match self {
14252 Self::Unspecified => std::option::Option::Some("EVALUATION_VALUE_UNSPECIFIED"),
14253 Self::True => std::option::Option::Some("TRUE"),
14254 Self::False => std::option::Option::Some("FALSE"),
14255 Self::Conditional => std::option::Option::Some("CONDITIONAL"),
14256 Self::UnknownValue(u) => u.0.name(),
14257 }
14258 }
14259 }
14260
14261 impl std::default::Default for EvaluationValue {
14262 fn default() -> Self {
14263 use std::convert::From;
14264 Self::from(0)
14265 }
14266 }
14267
14268 impl std::fmt::Display for EvaluationValue {
14269 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14270 wkt::internal::display_enum(f, self.name(), self.value())
14271 }
14272 }
14273
14274 impl std::convert::From<i32> for EvaluationValue {
14275 fn from(value: i32) -> Self {
14276 match value {
14277 0 => Self::Unspecified,
14278 1 => Self::True,
14279 2 => Self::False,
14280 3 => Self::Conditional,
14281 _ => Self::UnknownValue(evaluation_value::UnknownValue(
14282 wkt::internal::UnknownEnumValue::Integer(value),
14283 )),
14284 }
14285 }
14286 }
14287
14288 impl std::convert::From<&str> for EvaluationValue {
14289 fn from(value: &str) -> Self {
14290 use std::string::ToString;
14291 match value {
14292 "EVALUATION_VALUE_UNSPECIFIED" => Self::Unspecified,
14293 "TRUE" => Self::True,
14294 "FALSE" => Self::False,
14295 "CONDITIONAL" => Self::Conditional,
14296 _ => Self::UnknownValue(evaluation_value::UnknownValue(
14297 wkt::internal::UnknownEnumValue::String(value.to_string()),
14298 )),
14299 }
14300 }
14301 }
14302
14303 impl serde::ser::Serialize for EvaluationValue {
14304 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14305 where
14306 S: serde::Serializer,
14307 {
14308 match self {
14309 Self::Unspecified => serializer.serialize_i32(0),
14310 Self::True => serializer.serialize_i32(1),
14311 Self::False => serializer.serialize_i32(2),
14312 Self::Conditional => serializer.serialize_i32(3),
14313 Self::UnknownValue(u) => u.0.serialize(serializer),
14314 }
14315 }
14316 }
14317
14318 impl<'de> serde::de::Deserialize<'de> for EvaluationValue {
14319 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14320 where
14321 D: serde::Deserializer<'de>,
14322 {
14323 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EvaluationValue>::new(
14324 ".google.cloud.asset.v1.ConditionEvaluation.EvaluationValue",
14325 ))
14326 }
14327 }
14328}
14329
14330/// IAM Policy analysis result, consisting of one IAM policy binding and derived
14331/// access control lists.
14332#[derive(Clone, Default, PartialEq)]
14333#[non_exhaustive]
14334pub struct IamPolicyAnalysisResult {
14335 /// The [full resource
14336 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
14337 /// of the resource to which the
14338 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
14339 /// policy attaches.
14340 ///
14341 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
14342 pub attached_resource_full_name: std::string::String,
14343
14344 /// The IAM policy binding under analysis.
14345 pub iam_binding: std::option::Option<google_cloud_iam_v1::model::Binding>,
14346
14347 /// The access control lists derived from the
14348 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
14349 /// that match or potentially match resource and access selectors specified in
14350 /// the request.
14351 ///
14352 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
14353 pub access_control_lists:
14354 std::vec::Vec<crate::model::iam_policy_analysis_result::AccessControlList>,
14355
14356 /// The identity list derived from members of the
14357 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
14358 /// that match or potentially match identity selector specified in the request.
14359 ///
14360 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
14361 pub identity_list: std::option::Option<crate::model::iam_policy_analysis_result::IdentityList>,
14362
14363 /// Represents whether all analyses on the
14364 /// [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]
14365 /// have successfully finished.
14366 ///
14367 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding]: crate::model::IamPolicyAnalysisResult::iam_binding
14368 pub fully_explored: bool,
14369
14370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14371}
14372
14373impl IamPolicyAnalysisResult {
14374 pub fn new() -> Self {
14375 std::default::Default::default()
14376 }
14377
14378 /// Sets the value of [attached_resource_full_name][crate::model::IamPolicyAnalysisResult::attached_resource_full_name].
14379 ///
14380 /// # Example
14381 /// ```ignore,no_run
14382 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14383 /// let x = IamPolicyAnalysisResult::new().set_attached_resource_full_name("example");
14384 /// ```
14385 pub fn set_attached_resource_full_name<T: std::convert::Into<std::string::String>>(
14386 mut self,
14387 v: T,
14388 ) -> Self {
14389 self.attached_resource_full_name = v.into();
14390 self
14391 }
14392
14393 /// Sets the value of [iam_binding][crate::model::IamPolicyAnalysisResult::iam_binding].
14394 ///
14395 /// # Example
14396 /// ```ignore,no_run
14397 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14398 /// use google_cloud_iam_v1::model::Binding;
14399 /// let x = IamPolicyAnalysisResult::new().set_iam_binding(Binding::default()/* use setters */);
14400 /// ```
14401 pub fn set_iam_binding<T>(mut self, v: T) -> Self
14402 where
14403 T: std::convert::Into<google_cloud_iam_v1::model::Binding>,
14404 {
14405 self.iam_binding = std::option::Option::Some(v.into());
14406 self
14407 }
14408
14409 /// Sets or clears the value of [iam_binding][crate::model::IamPolicyAnalysisResult::iam_binding].
14410 ///
14411 /// # Example
14412 /// ```ignore,no_run
14413 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14414 /// use google_cloud_iam_v1::model::Binding;
14415 /// let x = IamPolicyAnalysisResult::new().set_or_clear_iam_binding(Some(Binding::default()/* use setters */));
14416 /// let x = IamPolicyAnalysisResult::new().set_or_clear_iam_binding(None::<Binding>);
14417 /// ```
14418 pub fn set_or_clear_iam_binding<T>(mut self, v: std::option::Option<T>) -> Self
14419 where
14420 T: std::convert::Into<google_cloud_iam_v1::model::Binding>,
14421 {
14422 self.iam_binding = v.map(|x| x.into());
14423 self
14424 }
14425
14426 /// Sets the value of [access_control_lists][crate::model::IamPolicyAnalysisResult::access_control_lists].
14427 ///
14428 /// # Example
14429 /// ```ignore,no_run
14430 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14431 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
14432 /// let x = IamPolicyAnalysisResult::new()
14433 /// .set_access_control_lists([
14434 /// AccessControlList::default()/* use setters */,
14435 /// AccessControlList::default()/* use (different) setters */,
14436 /// ]);
14437 /// ```
14438 pub fn set_access_control_lists<T, V>(mut self, v: T) -> Self
14439 where
14440 T: std::iter::IntoIterator<Item = V>,
14441 V: std::convert::Into<crate::model::iam_policy_analysis_result::AccessControlList>,
14442 {
14443 use std::iter::Iterator;
14444 self.access_control_lists = v.into_iter().map(|i| i.into()).collect();
14445 self
14446 }
14447
14448 /// Sets the value of [identity_list][crate::model::IamPolicyAnalysisResult::identity_list].
14449 ///
14450 /// # Example
14451 /// ```ignore,no_run
14452 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14453 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::IdentityList;
14454 /// let x = IamPolicyAnalysisResult::new().set_identity_list(IdentityList::default()/* use setters */);
14455 /// ```
14456 pub fn set_identity_list<T>(mut self, v: T) -> Self
14457 where
14458 T: std::convert::Into<crate::model::iam_policy_analysis_result::IdentityList>,
14459 {
14460 self.identity_list = std::option::Option::Some(v.into());
14461 self
14462 }
14463
14464 /// Sets or clears the value of [identity_list][crate::model::IamPolicyAnalysisResult::identity_list].
14465 ///
14466 /// # Example
14467 /// ```ignore,no_run
14468 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14469 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::IdentityList;
14470 /// let x = IamPolicyAnalysisResult::new().set_or_clear_identity_list(Some(IdentityList::default()/* use setters */));
14471 /// let x = IamPolicyAnalysisResult::new().set_or_clear_identity_list(None::<IdentityList>);
14472 /// ```
14473 pub fn set_or_clear_identity_list<T>(mut self, v: std::option::Option<T>) -> Self
14474 where
14475 T: std::convert::Into<crate::model::iam_policy_analysis_result::IdentityList>,
14476 {
14477 self.identity_list = v.map(|x| x.into());
14478 self
14479 }
14480
14481 /// Sets the value of [fully_explored][crate::model::IamPolicyAnalysisResult::fully_explored].
14482 ///
14483 /// # Example
14484 /// ```ignore,no_run
14485 /// # use google_cloud_asset_v1::model::IamPolicyAnalysisResult;
14486 /// let x = IamPolicyAnalysisResult::new().set_fully_explored(true);
14487 /// ```
14488 pub fn set_fully_explored<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14489 self.fully_explored = v.into();
14490 self
14491 }
14492}
14493
14494impl wkt::message::Message for IamPolicyAnalysisResult {
14495 fn typename() -> &'static str {
14496 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult"
14497 }
14498}
14499
14500/// Defines additional types related to [IamPolicyAnalysisResult].
14501pub mod iam_policy_analysis_result {
14502 #[allow(unused_imports)]
14503 use super::*;
14504
14505 /// A Google Cloud resource under analysis.
14506 #[derive(Clone, Default, PartialEq)]
14507 #[non_exhaustive]
14508 pub struct Resource {
14509 /// The [full resource
14510 /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format)
14511 pub full_resource_name: std::string::String,
14512
14513 /// The analysis state of this resource.
14514 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
14515
14516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14517 }
14518
14519 impl Resource {
14520 pub fn new() -> Self {
14521 std::default::Default::default()
14522 }
14523
14524 /// Sets the value of [full_resource_name][crate::model::iam_policy_analysis_result::Resource::full_resource_name].
14525 ///
14526 /// # Example
14527 /// ```ignore,no_run
14528 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Resource;
14529 /// let x = Resource::new().set_full_resource_name("example");
14530 /// ```
14531 pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
14532 mut self,
14533 v: T,
14534 ) -> Self {
14535 self.full_resource_name = v.into();
14536 self
14537 }
14538
14539 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Resource::analysis_state].
14540 ///
14541 /// # Example
14542 /// ```ignore,no_run
14543 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Resource;
14544 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14545 /// let x = Resource::new().set_analysis_state(IamPolicyAnalysisState::default()/* use setters */);
14546 /// ```
14547 pub fn set_analysis_state<T>(mut self, v: T) -> Self
14548 where
14549 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14550 {
14551 self.analysis_state = std::option::Option::Some(v.into());
14552 self
14553 }
14554
14555 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Resource::analysis_state].
14556 ///
14557 /// # Example
14558 /// ```ignore,no_run
14559 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Resource;
14560 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14561 /// let x = Resource::new().set_or_clear_analysis_state(Some(IamPolicyAnalysisState::default()/* use setters */));
14562 /// let x = Resource::new().set_or_clear_analysis_state(None::<IamPolicyAnalysisState>);
14563 /// ```
14564 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
14565 where
14566 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14567 {
14568 self.analysis_state = v.map(|x| x.into());
14569 self
14570 }
14571 }
14572
14573 impl wkt::message::Message for Resource {
14574 fn typename() -> &'static str {
14575 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Resource"
14576 }
14577 }
14578
14579 /// An IAM role or permission under analysis.
14580 #[derive(Clone, Default, PartialEq)]
14581 #[non_exhaustive]
14582 pub struct Access {
14583 /// The analysis state of this access.
14584 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
14585
14586 pub oneof_access:
14587 std::option::Option<crate::model::iam_policy_analysis_result::access::OneofAccess>,
14588
14589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14590 }
14591
14592 impl Access {
14593 pub fn new() -> Self {
14594 std::default::Default::default()
14595 }
14596
14597 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Access::analysis_state].
14598 ///
14599 /// # Example
14600 /// ```ignore,no_run
14601 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14602 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14603 /// let x = Access::new().set_analysis_state(IamPolicyAnalysisState::default()/* use setters */);
14604 /// ```
14605 pub fn set_analysis_state<T>(mut self, v: T) -> Self
14606 where
14607 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14608 {
14609 self.analysis_state = std::option::Option::Some(v.into());
14610 self
14611 }
14612
14613 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Access::analysis_state].
14614 ///
14615 /// # Example
14616 /// ```ignore,no_run
14617 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14618 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14619 /// let x = Access::new().set_or_clear_analysis_state(Some(IamPolicyAnalysisState::default()/* use setters */));
14620 /// let x = Access::new().set_or_clear_analysis_state(None::<IamPolicyAnalysisState>);
14621 /// ```
14622 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
14623 where
14624 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14625 {
14626 self.analysis_state = v.map(|x| x.into());
14627 self
14628 }
14629
14630 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access].
14631 ///
14632 /// Note that all the setters affecting `oneof_access` are mutually
14633 /// exclusive.
14634 ///
14635 /// # Example
14636 /// ```ignore,no_run
14637 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14638 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::access::OneofAccess;
14639 /// let x = Access::new().set_oneof_access(Some(OneofAccess::Role("example".to_string())));
14640 /// ```
14641 pub fn set_oneof_access<
14642 T: std::convert::Into<
14643 std::option::Option<
14644 crate::model::iam_policy_analysis_result::access::OneofAccess,
14645 >,
14646 >,
14647 >(
14648 mut self,
14649 v: T,
14650 ) -> Self {
14651 self.oneof_access = v.into();
14652 self
14653 }
14654
14655 /// The value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
14656 /// if it holds a `Role`, `None` if the field is not set or
14657 /// holds a different branch.
14658 pub fn role(&self) -> std::option::Option<&std::string::String> {
14659 #[allow(unreachable_patterns)]
14660 self.oneof_access.as_ref().and_then(|v| match v {
14661 crate::model::iam_policy_analysis_result::access::OneofAccess::Role(v) => {
14662 std::option::Option::Some(v)
14663 }
14664 _ => std::option::Option::None,
14665 })
14666 }
14667
14668 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
14669 /// to hold a `Role`.
14670 ///
14671 /// Note that all the setters affecting `oneof_access` are
14672 /// mutually exclusive.
14673 ///
14674 /// # Example
14675 /// ```ignore,no_run
14676 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14677 /// let x = Access::new().set_role("example");
14678 /// assert!(x.role().is_some());
14679 /// assert!(x.permission().is_none());
14680 /// ```
14681 pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14682 self.oneof_access = std::option::Option::Some(
14683 crate::model::iam_policy_analysis_result::access::OneofAccess::Role(v.into()),
14684 );
14685 self
14686 }
14687
14688 /// The value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
14689 /// if it holds a `Permission`, `None` if the field is not set or
14690 /// holds a different branch.
14691 pub fn permission(&self) -> std::option::Option<&std::string::String> {
14692 #[allow(unreachable_patterns)]
14693 self.oneof_access.as_ref().and_then(|v| match v {
14694 crate::model::iam_policy_analysis_result::access::OneofAccess::Permission(v) => {
14695 std::option::Option::Some(v)
14696 }
14697 _ => std::option::Option::None,
14698 })
14699 }
14700
14701 /// Sets the value of [oneof_access][crate::model::iam_policy_analysis_result::Access::oneof_access]
14702 /// to hold a `Permission`.
14703 ///
14704 /// Note that all the setters affecting `oneof_access` are
14705 /// mutually exclusive.
14706 ///
14707 /// # Example
14708 /// ```ignore,no_run
14709 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14710 /// let x = Access::new().set_permission("example");
14711 /// assert!(x.permission().is_some());
14712 /// assert!(x.role().is_none());
14713 /// ```
14714 pub fn set_permission<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14715 self.oneof_access = std::option::Option::Some(
14716 crate::model::iam_policy_analysis_result::access::OneofAccess::Permission(v.into()),
14717 );
14718 self
14719 }
14720 }
14721
14722 impl wkt::message::Message for Access {
14723 fn typename() -> &'static str {
14724 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Access"
14725 }
14726 }
14727
14728 /// Defines additional types related to [Access].
14729 pub mod access {
14730 #[allow(unused_imports)]
14731 use super::*;
14732
14733 #[derive(Clone, Debug, PartialEq)]
14734 #[non_exhaustive]
14735 pub enum OneofAccess {
14736 /// The role.
14737 Role(std::string::String),
14738 /// The permission.
14739 Permission(std::string::String),
14740 }
14741 }
14742
14743 /// An identity under analysis.
14744 #[derive(Clone, Default, PartialEq)]
14745 #[non_exhaustive]
14746 pub struct Identity {
14747 /// The identity of members, formatted as appear in an
14748 /// [IAM policy
14749 /// binding](https://cloud.google.com/iam/reference/rest/v1/Binding). For
14750 /// example, they might be formatted like the following:
14751 ///
14752 /// - user:foo@google.com
14753 /// - group:group1@google.com
14754 /// - serviceAccount:s1@prj1.iam.gserviceaccount.com
14755 /// - projectOwner:some_project_id
14756 /// - domain:google.com
14757 /// - allUsers
14758 pub name: std::string::String,
14759
14760 /// The analysis state of this identity.
14761 pub analysis_state: std::option::Option<crate::model::IamPolicyAnalysisState>,
14762
14763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14764 }
14765
14766 impl Identity {
14767 pub fn new() -> Self {
14768 std::default::Default::default()
14769 }
14770
14771 /// Sets the value of [name][crate::model::iam_policy_analysis_result::Identity::name].
14772 ///
14773 /// # Example
14774 /// ```ignore,no_run
14775 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Identity;
14776 /// let x = Identity::new().set_name("example");
14777 /// ```
14778 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14779 self.name = v.into();
14780 self
14781 }
14782
14783 /// Sets the value of [analysis_state][crate::model::iam_policy_analysis_result::Identity::analysis_state].
14784 ///
14785 /// # Example
14786 /// ```ignore,no_run
14787 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Identity;
14788 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14789 /// let x = Identity::new().set_analysis_state(IamPolicyAnalysisState::default()/* use setters */);
14790 /// ```
14791 pub fn set_analysis_state<T>(mut self, v: T) -> Self
14792 where
14793 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14794 {
14795 self.analysis_state = std::option::Option::Some(v.into());
14796 self
14797 }
14798
14799 /// Sets or clears the value of [analysis_state][crate::model::iam_policy_analysis_result::Identity::analysis_state].
14800 ///
14801 /// # Example
14802 /// ```ignore,no_run
14803 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Identity;
14804 /// use google_cloud_asset_v1::model::IamPolicyAnalysisState;
14805 /// let x = Identity::new().set_or_clear_analysis_state(Some(IamPolicyAnalysisState::default()/* use setters */));
14806 /// let x = Identity::new().set_or_clear_analysis_state(None::<IamPolicyAnalysisState>);
14807 /// ```
14808 pub fn set_or_clear_analysis_state<T>(mut self, v: std::option::Option<T>) -> Self
14809 where
14810 T: std::convert::Into<crate::model::IamPolicyAnalysisState>,
14811 {
14812 self.analysis_state = v.map(|x| x.into());
14813 self
14814 }
14815 }
14816
14817 impl wkt::message::Message for Identity {
14818 fn typename() -> &'static str {
14819 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Identity"
14820 }
14821 }
14822
14823 /// A directional edge.
14824 #[derive(Clone, Default, PartialEq)]
14825 #[non_exhaustive]
14826 pub struct Edge {
14827 /// The source node of the edge. For example, it could be a full resource
14828 /// name for a resource node or an email of an identity.
14829 pub source_node: std::string::String,
14830
14831 /// The target node of the edge. For example, it could be a full resource
14832 /// name for a resource node or an email of an identity.
14833 pub target_node: std::string::String,
14834
14835 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14836 }
14837
14838 impl Edge {
14839 pub fn new() -> Self {
14840 std::default::Default::default()
14841 }
14842
14843 /// Sets the value of [source_node][crate::model::iam_policy_analysis_result::Edge::source_node].
14844 ///
14845 /// # Example
14846 /// ```ignore,no_run
14847 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Edge;
14848 /// let x = Edge::new().set_source_node("example");
14849 /// ```
14850 pub fn set_source_node<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14851 self.source_node = v.into();
14852 self
14853 }
14854
14855 /// Sets the value of [target_node][crate::model::iam_policy_analysis_result::Edge::target_node].
14856 ///
14857 /// # Example
14858 /// ```ignore,no_run
14859 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::Edge;
14860 /// let x = Edge::new().set_target_node("example");
14861 /// ```
14862 pub fn set_target_node<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14863 self.target_node = v.into();
14864 self
14865 }
14866 }
14867
14868 impl wkt::message::Message for Edge {
14869 fn typename() -> &'static str {
14870 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.Edge"
14871 }
14872 }
14873
14874 /// An access control list, derived from the above IAM policy binding, which
14875 /// contains a set of resources and accesses. May include one
14876 /// item from each set to compose an access control entry.
14877 ///
14878 /// NOTICE that there could be multiple access control lists for one IAM policy
14879 /// binding. The access control lists are created based on resource and access
14880 /// combinations.
14881 ///
14882 /// For example, assume we have the following cases in one IAM policy binding:
14883 ///
14884 /// - Permission P1 and P2 apply to resource R1 and R2;
14885 /// - Permission P3 applies to resource R2 and R3;
14886 ///
14887 /// This will result in the following access control lists:
14888 ///
14889 /// - AccessControlList 1: [R1, R2], [P1, P2]
14890 /// - AccessControlList 2: [R2, R3], [P3]
14891 #[derive(Clone, Default, PartialEq)]
14892 #[non_exhaustive]
14893 pub struct AccessControlList {
14894 /// The resources that match one of the following conditions:
14895 ///
14896 /// - The resource_selector, if it is specified in request;
14897 /// - Otherwise, resources reachable from the policy attached resource.
14898 pub resources: std::vec::Vec<crate::model::iam_policy_analysis_result::Resource>,
14899
14900 /// The accesses that match one of the following conditions:
14901 ///
14902 /// - The access_selector, if it is specified in request;
14903 /// - Otherwise, access specifiers reachable from the policy binding's role.
14904 pub accesses: std::vec::Vec<crate::model::iam_policy_analysis_result::Access>,
14905
14906 /// Resource edges of the graph starting from the policy attached
14907 /// resource to any descendant resources. The
14908 /// [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]
14909 /// contains the full resource name of a parent resource and
14910 /// [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]
14911 /// contains the full resource name of a child resource. This field is
14912 /// present only if the output_resource_edges option is enabled in request.
14913 ///
14914 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]: crate::model::iam_policy_analysis_result::Edge::source_node
14915 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]: crate::model::iam_policy_analysis_result::Edge::target_node
14916 pub resource_edges: std::vec::Vec<crate::model::iam_policy_analysis_result::Edge>,
14917
14918 /// Condition evaluation for this AccessControlList, if there is a condition
14919 /// defined in the above IAM policy binding.
14920 pub condition_evaluation: std::option::Option<crate::model::ConditionEvaluation>,
14921
14922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14923 }
14924
14925 impl AccessControlList {
14926 pub fn new() -> Self {
14927 std::default::Default::default()
14928 }
14929
14930 /// Sets the value of [resources][crate::model::iam_policy_analysis_result::AccessControlList::resources].
14931 ///
14932 /// # Example
14933 /// ```ignore,no_run
14934 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
14935 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::Resource;
14936 /// let x = AccessControlList::new()
14937 /// .set_resources([
14938 /// Resource::default()/* use setters */,
14939 /// Resource::default()/* use (different) setters */,
14940 /// ]);
14941 /// ```
14942 pub fn set_resources<T, V>(mut self, v: T) -> Self
14943 where
14944 T: std::iter::IntoIterator<Item = V>,
14945 V: std::convert::Into<crate::model::iam_policy_analysis_result::Resource>,
14946 {
14947 use std::iter::Iterator;
14948 self.resources = v.into_iter().map(|i| i.into()).collect();
14949 self
14950 }
14951
14952 /// Sets the value of [accesses][crate::model::iam_policy_analysis_result::AccessControlList::accesses].
14953 ///
14954 /// # Example
14955 /// ```ignore,no_run
14956 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
14957 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::Access;
14958 /// let x = AccessControlList::new()
14959 /// .set_accesses([
14960 /// Access::default()/* use setters */,
14961 /// Access::default()/* use (different) setters */,
14962 /// ]);
14963 /// ```
14964 pub fn set_accesses<T, V>(mut self, v: T) -> Self
14965 where
14966 T: std::iter::IntoIterator<Item = V>,
14967 V: std::convert::Into<crate::model::iam_policy_analysis_result::Access>,
14968 {
14969 use std::iter::Iterator;
14970 self.accesses = v.into_iter().map(|i| i.into()).collect();
14971 self
14972 }
14973
14974 /// Sets the value of [resource_edges][crate::model::iam_policy_analysis_result::AccessControlList::resource_edges].
14975 ///
14976 /// # Example
14977 /// ```ignore,no_run
14978 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
14979 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::Edge;
14980 /// let x = AccessControlList::new()
14981 /// .set_resource_edges([
14982 /// Edge::default()/* use setters */,
14983 /// Edge::default()/* use (different) setters */,
14984 /// ]);
14985 /// ```
14986 pub fn set_resource_edges<T, V>(mut self, v: T) -> Self
14987 where
14988 T: std::iter::IntoIterator<Item = V>,
14989 V: std::convert::Into<crate::model::iam_policy_analysis_result::Edge>,
14990 {
14991 use std::iter::Iterator;
14992 self.resource_edges = v.into_iter().map(|i| i.into()).collect();
14993 self
14994 }
14995
14996 /// Sets the value of [condition_evaluation][crate::model::iam_policy_analysis_result::AccessControlList::condition_evaluation].
14997 ///
14998 /// # Example
14999 /// ```ignore,no_run
15000 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
15001 /// use google_cloud_asset_v1::model::ConditionEvaluation;
15002 /// let x = AccessControlList::new().set_condition_evaluation(ConditionEvaluation::default()/* use setters */);
15003 /// ```
15004 pub fn set_condition_evaluation<T>(mut self, v: T) -> Self
15005 where
15006 T: std::convert::Into<crate::model::ConditionEvaluation>,
15007 {
15008 self.condition_evaluation = std::option::Option::Some(v.into());
15009 self
15010 }
15011
15012 /// Sets or clears the value of [condition_evaluation][crate::model::iam_policy_analysis_result::AccessControlList::condition_evaluation].
15013 ///
15014 /// # Example
15015 /// ```ignore,no_run
15016 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::AccessControlList;
15017 /// use google_cloud_asset_v1::model::ConditionEvaluation;
15018 /// let x = AccessControlList::new().set_or_clear_condition_evaluation(Some(ConditionEvaluation::default()/* use setters */));
15019 /// let x = AccessControlList::new().set_or_clear_condition_evaluation(None::<ConditionEvaluation>);
15020 /// ```
15021 pub fn set_or_clear_condition_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
15022 where
15023 T: std::convert::Into<crate::model::ConditionEvaluation>,
15024 {
15025 self.condition_evaluation = v.map(|x| x.into());
15026 self
15027 }
15028 }
15029
15030 impl wkt::message::Message for AccessControlList {
15031 fn typename() -> &'static str {
15032 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.AccessControlList"
15033 }
15034 }
15035
15036 /// The identities and group edges.
15037 #[derive(Clone, Default, PartialEq)]
15038 #[non_exhaustive]
15039 pub struct IdentityList {
15040 /// Only the identities that match one of the following conditions will be
15041 /// presented:
15042 ///
15043 /// - The identity_selector, if it is specified in request;
15044 /// - Otherwise, identities reachable from the policy binding's members.
15045 pub identities: std::vec::Vec<crate::model::iam_policy_analysis_result::Identity>,
15046
15047 /// Group identity edges of the graph starting from the binding's
15048 /// group members to any node of the
15049 /// [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities].
15050 /// The
15051 /// [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]
15052 /// contains a group, such as `group:parent@google.com`. The
15053 /// [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]
15054 /// contains a member of the group, such as `group:child@google.com` or
15055 /// `user:foo@google.com`. This field is present only if the
15056 /// output_group_edges option is enabled in request.
15057 ///
15058 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node]: crate::model::iam_policy_analysis_result::Edge::source_node
15059 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node]: crate::model::iam_policy_analysis_result::Edge::target_node
15060 /// [google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]: crate::model::iam_policy_analysis_result::IdentityList::identities
15061 pub group_edges: std::vec::Vec<crate::model::iam_policy_analysis_result::Edge>,
15062
15063 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15064 }
15065
15066 impl IdentityList {
15067 pub fn new() -> Self {
15068 std::default::Default::default()
15069 }
15070
15071 /// Sets the value of [identities][crate::model::iam_policy_analysis_result::IdentityList::identities].
15072 ///
15073 /// # Example
15074 /// ```ignore,no_run
15075 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::IdentityList;
15076 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::Identity;
15077 /// let x = IdentityList::new()
15078 /// .set_identities([
15079 /// Identity::default()/* use setters */,
15080 /// Identity::default()/* use (different) setters */,
15081 /// ]);
15082 /// ```
15083 pub fn set_identities<T, V>(mut self, v: T) -> Self
15084 where
15085 T: std::iter::IntoIterator<Item = V>,
15086 V: std::convert::Into<crate::model::iam_policy_analysis_result::Identity>,
15087 {
15088 use std::iter::Iterator;
15089 self.identities = v.into_iter().map(|i| i.into()).collect();
15090 self
15091 }
15092
15093 /// Sets the value of [group_edges][crate::model::iam_policy_analysis_result::IdentityList::group_edges].
15094 ///
15095 /// # Example
15096 /// ```ignore,no_run
15097 /// # use google_cloud_asset_v1::model::iam_policy_analysis_result::IdentityList;
15098 /// use google_cloud_asset_v1::model::iam_policy_analysis_result::Edge;
15099 /// let x = IdentityList::new()
15100 /// .set_group_edges([
15101 /// Edge::default()/* use setters */,
15102 /// Edge::default()/* use (different) setters */,
15103 /// ]);
15104 /// ```
15105 pub fn set_group_edges<T, V>(mut self, v: T) -> Self
15106 where
15107 T: std::iter::IntoIterator<Item = V>,
15108 V: std::convert::Into<crate::model::iam_policy_analysis_result::Edge>,
15109 {
15110 use std::iter::Iterator;
15111 self.group_edges = v.into_iter().map(|i| i.into()).collect();
15112 self
15113 }
15114 }
15115
15116 impl wkt::message::Message for IdentityList {
15117 fn typename() -> &'static str {
15118 "type.googleapis.com/google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList"
15119 }
15120 }
15121}
15122
15123/// Asset content type.
15124///
15125/// # Working with unknown values
15126///
15127/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15128/// additional enum variants at any time. Adding new variants is not considered
15129/// a breaking change. Applications should write their code in anticipation of:
15130///
15131/// - New values appearing in future releases of the client library, **and**
15132/// - New values received dynamically, without application changes.
15133///
15134/// Please consult the [Working with enums] section in the user guide for some
15135/// guidelines.
15136///
15137/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15138#[derive(Clone, Debug, PartialEq)]
15139#[non_exhaustive]
15140pub enum ContentType {
15141 /// Unspecified content type.
15142 Unspecified,
15143 /// Resource metadata.
15144 Resource,
15145 /// The actual IAM policy set on a resource.
15146 IamPolicy,
15147 /// The organization policy set on an asset.
15148 OrgPolicy,
15149 /// The Access Context Manager policy set on an asset.
15150 AccessPolicy,
15151 /// The runtime OS Inventory information.
15152 OsInventory,
15153 /// The related resources.
15154 Relationship,
15155 /// If set, the enum was initialized with an unknown value.
15156 ///
15157 /// Applications can examine the value using [ContentType::value] or
15158 /// [ContentType::name].
15159 UnknownValue(content_type::UnknownValue),
15160}
15161
15162#[doc(hidden)]
15163pub mod content_type {
15164 #[allow(unused_imports)]
15165 use super::*;
15166 #[derive(Clone, Debug, PartialEq)]
15167 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15168}
15169
15170impl ContentType {
15171 /// Gets the enum value.
15172 ///
15173 /// Returns `None` if the enum contains an unknown value deserialized from
15174 /// the string representation of enums.
15175 pub fn value(&self) -> std::option::Option<i32> {
15176 match self {
15177 Self::Unspecified => std::option::Option::Some(0),
15178 Self::Resource => std::option::Option::Some(1),
15179 Self::IamPolicy => std::option::Option::Some(2),
15180 Self::OrgPolicy => std::option::Option::Some(4),
15181 Self::AccessPolicy => std::option::Option::Some(5),
15182 Self::OsInventory => std::option::Option::Some(6),
15183 Self::Relationship => std::option::Option::Some(7),
15184 Self::UnknownValue(u) => u.0.value(),
15185 }
15186 }
15187
15188 /// Gets the enum value as a string.
15189 ///
15190 /// Returns `None` if the enum contains an unknown value deserialized from
15191 /// the integer representation of enums.
15192 pub fn name(&self) -> std::option::Option<&str> {
15193 match self {
15194 Self::Unspecified => std::option::Option::Some("CONTENT_TYPE_UNSPECIFIED"),
15195 Self::Resource => std::option::Option::Some("RESOURCE"),
15196 Self::IamPolicy => std::option::Option::Some("IAM_POLICY"),
15197 Self::OrgPolicy => std::option::Option::Some("ORG_POLICY"),
15198 Self::AccessPolicy => std::option::Option::Some("ACCESS_POLICY"),
15199 Self::OsInventory => std::option::Option::Some("OS_INVENTORY"),
15200 Self::Relationship => std::option::Option::Some("RELATIONSHIP"),
15201 Self::UnknownValue(u) => u.0.name(),
15202 }
15203 }
15204}
15205
15206impl std::default::Default for ContentType {
15207 fn default() -> Self {
15208 use std::convert::From;
15209 Self::from(0)
15210 }
15211}
15212
15213impl std::fmt::Display for ContentType {
15214 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15215 wkt::internal::display_enum(f, self.name(), self.value())
15216 }
15217}
15218
15219impl std::convert::From<i32> for ContentType {
15220 fn from(value: i32) -> Self {
15221 match value {
15222 0 => Self::Unspecified,
15223 1 => Self::Resource,
15224 2 => Self::IamPolicy,
15225 4 => Self::OrgPolicy,
15226 5 => Self::AccessPolicy,
15227 6 => Self::OsInventory,
15228 7 => Self::Relationship,
15229 _ => Self::UnknownValue(content_type::UnknownValue(
15230 wkt::internal::UnknownEnumValue::Integer(value),
15231 )),
15232 }
15233 }
15234}
15235
15236impl std::convert::From<&str> for ContentType {
15237 fn from(value: &str) -> Self {
15238 use std::string::ToString;
15239 match value {
15240 "CONTENT_TYPE_UNSPECIFIED" => Self::Unspecified,
15241 "RESOURCE" => Self::Resource,
15242 "IAM_POLICY" => Self::IamPolicy,
15243 "ORG_POLICY" => Self::OrgPolicy,
15244 "ACCESS_POLICY" => Self::AccessPolicy,
15245 "OS_INVENTORY" => Self::OsInventory,
15246 "RELATIONSHIP" => Self::Relationship,
15247 _ => Self::UnknownValue(content_type::UnknownValue(
15248 wkt::internal::UnknownEnumValue::String(value.to_string()),
15249 )),
15250 }
15251 }
15252}
15253
15254impl serde::ser::Serialize for ContentType {
15255 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15256 where
15257 S: serde::Serializer,
15258 {
15259 match self {
15260 Self::Unspecified => serializer.serialize_i32(0),
15261 Self::Resource => serializer.serialize_i32(1),
15262 Self::IamPolicy => serializer.serialize_i32(2),
15263 Self::OrgPolicy => serializer.serialize_i32(4),
15264 Self::AccessPolicy => serializer.serialize_i32(5),
15265 Self::OsInventory => serializer.serialize_i32(6),
15266 Self::Relationship => serializer.serialize_i32(7),
15267 Self::UnknownValue(u) => u.0.serialize(serializer),
15268 }
15269 }
15270}
15271
15272impl<'de> serde::de::Deserialize<'de> for ContentType {
15273 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15274 where
15275 D: serde::Deserializer<'de>,
15276 {
15277 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentType>::new(
15278 ".google.cloud.asset.v1.ContentType",
15279 ))
15280 }
15281}