Skip to main content

google_cloud_managedidentities_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_longrunning;
25extern crate google_cloud_lro;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// Represents the metadata of the long-running operation.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct OpMetadata {
41    /// Output only. The time the operation was created.
42    pub create_time: std::option::Option<wkt::Timestamp>,
43
44    /// Output only. The time the operation finished running.
45    pub end_time: std::option::Option<wkt::Timestamp>,
46
47    /// Output only. Server-defined resource path for the target of the operation.
48    pub target: std::string::String,
49
50    /// Output only. Name of the verb executed by the operation.
51    pub verb: std::string::String,
52
53    /// Output only. Identifies whether the user has requested cancellation
54    /// of the operation. Operations that have successfully been cancelled
55    /// have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
56    /// corresponding to `Code.CANCELLED`.
57    ///
58    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
59    pub requested_cancellation: bool,
60
61    /// Output only. API version used to start the operation.
62    pub api_version: std::string::String,
63
64    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
65}
66
67impl OpMetadata {
68    pub fn new() -> Self {
69        std::default::Default::default()
70    }
71
72    /// Sets the value of [create_time][crate::model::OpMetadata::create_time].
73    ///
74    /// # Example
75    /// ```ignore,no_run
76    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
77    /// use wkt::Timestamp;
78    /// let x = OpMetadata::new().set_create_time(Timestamp::default()/* use setters */);
79    /// ```
80    pub fn set_create_time<T>(mut self, v: T) -> Self
81    where
82        T: std::convert::Into<wkt::Timestamp>,
83    {
84        self.create_time = std::option::Option::Some(v.into());
85        self
86    }
87
88    /// Sets or clears the value of [create_time][crate::model::OpMetadata::create_time].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
93    /// use wkt::Timestamp;
94    /// let x = OpMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
95    /// let x = OpMetadata::new().set_or_clear_create_time(None::<Timestamp>);
96    /// ```
97    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
98    where
99        T: std::convert::Into<wkt::Timestamp>,
100    {
101        self.create_time = v.map(|x| x.into());
102        self
103    }
104
105    /// Sets the value of [end_time][crate::model::OpMetadata::end_time].
106    ///
107    /// # Example
108    /// ```ignore,no_run
109    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
110    /// use wkt::Timestamp;
111    /// let x = OpMetadata::new().set_end_time(Timestamp::default()/* use setters */);
112    /// ```
113    pub fn set_end_time<T>(mut self, v: T) -> Self
114    where
115        T: std::convert::Into<wkt::Timestamp>,
116    {
117        self.end_time = std::option::Option::Some(v.into());
118        self
119    }
120
121    /// Sets or clears the value of [end_time][crate::model::OpMetadata::end_time].
122    ///
123    /// # Example
124    /// ```ignore,no_run
125    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
126    /// use wkt::Timestamp;
127    /// let x = OpMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
128    /// let x = OpMetadata::new().set_or_clear_end_time(None::<Timestamp>);
129    /// ```
130    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
131    where
132        T: std::convert::Into<wkt::Timestamp>,
133    {
134        self.end_time = v.map(|x| x.into());
135        self
136    }
137
138    /// Sets the value of [target][crate::model::OpMetadata::target].
139    ///
140    /// # Example
141    /// ```ignore,no_run
142    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
143    /// let x = OpMetadata::new().set_target("example");
144    /// ```
145    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
146        self.target = v.into();
147        self
148    }
149
150    /// Sets the value of [verb][crate::model::OpMetadata::verb].
151    ///
152    /// # Example
153    /// ```ignore,no_run
154    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
155    /// let x = OpMetadata::new().set_verb("example");
156    /// ```
157    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
158        self.verb = v.into();
159        self
160    }
161
162    /// Sets the value of [requested_cancellation][crate::model::OpMetadata::requested_cancellation].
163    ///
164    /// # Example
165    /// ```ignore,no_run
166    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
167    /// let x = OpMetadata::new().set_requested_cancellation(true);
168    /// ```
169    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
170        self.requested_cancellation = v.into();
171        self
172    }
173
174    /// Sets the value of [api_version][crate::model::OpMetadata::api_version].
175    ///
176    /// # Example
177    /// ```ignore,no_run
178    /// # use google_cloud_managedidentities_v1::model::OpMetadata;
179    /// let x = OpMetadata::new().set_api_version("example");
180    /// ```
181    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
182        self.api_version = v.into();
183        self
184    }
185}
186
187impl wkt::message::Message for OpMetadata {
188    fn typename() -> &'static str {
189        "type.googleapis.com/google.cloud.managedidentities.v1.OpMetadata"
190    }
191}
192
193/// Request message for
194/// [CreateMicrosoftAdDomain][google.cloud.managedidentities.v1.CreateMicrosoftAdDomain]
195#[derive(Clone, Default, PartialEq)]
196#[non_exhaustive]
197pub struct CreateMicrosoftAdDomainRequest {
198    /// Required. The resource project name and location using the form:
199    /// `projects/{project_id}/locations/global`
200    pub parent: std::string::String,
201
202    /// Required. The fully qualified domain name.
203    /// e.g. mydomain.myorganization.com, with the following restrictions:
204    ///
205    /// * Must contain only lowercase letters, numbers, periods and hyphens.
206    /// * Must start with a letter.
207    /// * Must contain between 2-64 characters.
208    /// * Must end with a number or a letter.
209    /// * Must not start with period.
210    /// * First segement length (mydomain form example above) shouldn't exceed
211    ///   15 chars.
212    /// * The last segment cannot be fully numeric.
213    /// * Must be unique within the customer project.
214    pub domain_name: std::string::String,
215
216    /// Required. A Managed Identity domain resource.
217    pub domain: std::option::Option<crate::model::Domain>,
218
219    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
220}
221
222impl CreateMicrosoftAdDomainRequest {
223    pub fn new() -> Self {
224        std::default::Default::default()
225    }
226
227    /// Sets the value of [parent][crate::model::CreateMicrosoftAdDomainRequest::parent].
228    ///
229    /// # Example
230    /// ```ignore,no_run
231    /// # use google_cloud_managedidentities_v1::model::CreateMicrosoftAdDomainRequest;
232    /// let x = CreateMicrosoftAdDomainRequest::new().set_parent("example");
233    /// ```
234    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
235        self.parent = v.into();
236        self
237    }
238
239    /// Sets the value of [domain_name][crate::model::CreateMicrosoftAdDomainRequest::domain_name].
240    ///
241    /// # Example
242    /// ```ignore,no_run
243    /// # use google_cloud_managedidentities_v1::model::CreateMicrosoftAdDomainRequest;
244    /// let x = CreateMicrosoftAdDomainRequest::new().set_domain_name("example");
245    /// ```
246    pub fn set_domain_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
247        self.domain_name = v.into();
248        self
249    }
250
251    /// Sets the value of [domain][crate::model::CreateMicrosoftAdDomainRequest::domain].
252    ///
253    /// # Example
254    /// ```ignore,no_run
255    /// # use google_cloud_managedidentities_v1::model::CreateMicrosoftAdDomainRequest;
256    /// use google_cloud_managedidentities_v1::model::Domain;
257    /// let x = CreateMicrosoftAdDomainRequest::new().set_domain(Domain::default()/* use setters */);
258    /// ```
259    pub fn set_domain<T>(mut self, v: T) -> Self
260    where
261        T: std::convert::Into<crate::model::Domain>,
262    {
263        self.domain = std::option::Option::Some(v.into());
264        self
265    }
266
267    /// Sets or clears the value of [domain][crate::model::CreateMicrosoftAdDomainRequest::domain].
268    ///
269    /// # Example
270    /// ```ignore,no_run
271    /// # use google_cloud_managedidentities_v1::model::CreateMicrosoftAdDomainRequest;
272    /// use google_cloud_managedidentities_v1::model::Domain;
273    /// let x = CreateMicrosoftAdDomainRequest::new().set_or_clear_domain(Some(Domain::default()/* use setters */));
274    /// let x = CreateMicrosoftAdDomainRequest::new().set_or_clear_domain(None::<Domain>);
275    /// ```
276    pub fn set_or_clear_domain<T>(mut self, v: std::option::Option<T>) -> Self
277    where
278        T: std::convert::Into<crate::model::Domain>,
279    {
280        self.domain = v.map(|x| x.into());
281        self
282    }
283}
284
285impl wkt::message::Message for CreateMicrosoftAdDomainRequest {
286    fn typename() -> &'static str {
287        "type.googleapis.com/google.cloud.managedidentities.v1.CreateMicrosoftAdDomainRequest"
288    }
289}
290
291/// Request message for
292/// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword]
293#[derive(Clone, Default, PartialEq)]
294#[non_exhaustive]
295pub struct ResetAdminPasswordRequest {
296    /// Required. The domain resource name using the form:
297    /// `projects/{project_id}/locations/global/domains/{domain_name}`
298    pub name: std::string::String,
299
300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
301}
302
303impl ResetAdminPasswordRequest {
304    pub fn new() -> Self {
305        std::default::Default::default()
306    }
307
308    /// Sets the value of [name][crate::model::ResetAdminPasswordRequest::name].
309    ///
310    /// # Example
311    /// ```ignore,no_run
312    /// # use google_cloud_managedidentities_v1::model::ResetAdminPasswordRequest;
313    /// let x = ResetAdminPasswordRequest::new().set_name("example");
314    /// ```
315    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
316        self.name = v.into();
317        self
318    }
319}
320
321impl wkt::message::Message for ResetAdminPasswordRequest {
322    fn typename() -> &'static str {
323        "type.googleapis.com/google.cloud.managedidentities.v1.ResetAdminPasswordRequest"
324    }
325}
326
327/// Response message for
328/// [ResetAdminPassword][google.cloud.managedidentities.v1.ResetAdminPassword]
329#[derive(Clone, Default, PartialEq)]
330#[non_exhaustive]
331pub struct ResetAdminPasswordResponse {
332    /// A random password. See [admin][google.cloud.managedidentities.v1.Domain.admin] for more information.
333    ///
334    /// [google.cloud.managedidentities.v1.Domain.admin]: crate::model::Domain::admin
335    pub password: std::string::String,
336
337    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
338}
339
340impl ResetAdminPasswordResponse {
341    pub fn new() -> Self {
342        std::default::Default::default()
343    }
344
345    /// Sets the value of [password][crate::model::ResetAdminPasswordResponse::password].
346    ///
347    /// # Example
348    /// ```ignore,no_run
349    /// # use google_cloud_managedidentities_v1::model::ResetAdminPasswordResponse;
350    /// let x = ResetAdminPasswordResponse::new().set_password("example");
351    /// ```
352    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
353        self.password = v.into();
354        self
355    }
356}
357
358impl wkt::message::Message for ResetAdminPasswordResponse {
359    fn typename() -> &'static str {
360        "type.googleapis.com/google.cloud.managedidentities.v1.ResetAdminPasswordResponse"
361    }
362}
363
364/// Request message for
365/// [ListDomains][google.cloud.managedidentities.v1.ListDomains]
366#[derive(Clone, Default, PartialEq)]
367#[non_exhaustive]
368pub struct ListDomainsRequest {
369    /// Required. The resource name of the domain location using the form:
370    /// `projects/{project_id}/locations/global`
371    pub parent: std::string::String,
372
373    /// Optional. The maximum number of items to return.
374    /// If not specified, a default value of 1000 will be used.
375    /// Regardless of the page_size value, the response may include a partial list.
376    /// Callers should rely on a response's
377    /// [next_page_token][google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token]
378    /// to determine if there are additional results to list.
379    ///
380    /// [google.cloud.managedidentities.v1.ListDomainsResponse.next_page_token]: crate::model::ListDomainsResponse::next_page_token
381    pub page_size: i32,
382
383    /// Optional. The `next_page_token` value returned from a previous ListDomainsRequest
384    /// request, if any.
385    pub page_token: std::string::String,
386
387    /// Optional. A filter specifying constraints of a list operation.
388    /// For example, `Domain.fqdn="mydomain.myorginization"`.
389    pub filter: std::string::String,
390
391    /// Optional. Specifies the ordering of results. See
392    /// [Sorting
393    /// order](https://cloud.google.com/apis/design/design_patterns#sorting_order)
394    /// for more information.
395    pub order_by: std::string::String,
396
397    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
398}
399
400impl ListDomainsRequest {
401    pub fn new() -> Self {
402        std::default::Default::default()
403    }
404
405    /// Sets the value of [parent][crate::model::ListDomainsRequest::parent].
406    ///
407    /// # Example
408    /// ```ignore,no_run
409    /// # use google_cloud_managedidentities_v1::model::ListDomainsRequest;
410    /// let x = ListDomainsRequest::new().set_parent("example");
411    /// ```
412    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
413        self.parent = v.into();
414        self
415    }
416
417    /// Sets the value of [page_size][crate::model::ListDomainsRequest::page_size].
418    ///
419    /// # Example
420    /// ```ignore,no_run
421    /// # use google_cloud_managedidentities_v1::model::ListDomainsRequest;
422    /// let x = ListDomainsRequest::new().set_page_size(42);
423    /// ```
424    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
425        self.page_size = v.into();
426        self
427    }
428
429    /// Sets the value of [page_token][crate::model::ListDomainsRequest::page_token].
430    ///
431    /// # Example
432    /// ```ignore,no_run
433    /// # use google_cloud_managedidentities_v1::model::ListDomainsRequest;
434    /// let x = ListDomainsRequest::new().set_page_token("example");
435    /// ```
436    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
437        self.page_token = v.into();
438        self
439    }
440
441    /// Sets the value of [filter][crate::model::ListDomainsRequest::filter].
442    ///
443    /// # Example
444    /// ```ignore,no_run
445    /// # use google_cloud_managedidentities_v1::model::ListDomainsRequest;
446    /// let x = ListDomainsRequest::new().set_filter("example");
447    /// ```
448    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
449        self.filter = v.into();
450        self
451    }
452
453    /// Sets the value of [order_by][crate::model::ListDomainsRequest::order_by].
454    ///
455    /// # Example
456    /// ```ignore,no_run
457    /// # use google_cloud_managedidentities_v1::model::ListDomainsRequest;
458    /// let x = ListDomainsRequest::new().set_order_by("example");
459    /// ```
460    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
461        self.order_by = v.into();
462        self
463    }
464}
465
466impl wkt::message::Message for ListDomainsRequest {
467    fn typename() -> &'static str {
468        "type.googleapis.com/google.cloud.managedidentities.v1.ListDomainsRequest"
469    }
470}
471
472/// Response message for
473/// [ListDomains][google.cloud.managedidentities.v1.ListDomains]
474#[derive(Clone, Default, PartialEq)]
475#[non_exhaustive]
476pub struct ListDomainsResponse {
477    /// A list of Managed Identities Service domains in the project.
478    pub domains: std::vec::Vec<crate::model::Domain>,
479
480    /// A token to retrieve the next page of results, or empty if there are no more
481    /// results in the list.
482    pub next_page_token: std::string::String,
483
484    /// A list of locations that could not be reached.
485    pub unreachable: std::vec::Vec<std::string::String>,
486
487    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
488}
489
490impl ListDomainsResponse {
491    pub fn new() -> Self {
492        std::default::Default::default()
493    }
494
495    /// Sets the value of [domains][crate::model::ListDomainsResponse::domains].
496    ///
497    /// # Example
498    /// ```ignore,no_run
499    /// # use google_cloud_managedidentities_v1::model::ListDomainsResponse;
500    /// use google_cloud_managedidentities_v1::model::Domain;
501    /// let x = ListDomainsResponse::new()
502    ///     .set_domains([
503    ///         Domain::default()/* use setters */,
504    ///         Domain::default()/* use (different) setters */,
505    ///     ]);
506    /// ```
507    pub fn set_domains<T, V>(mut self, v: T) -> Self
508    where
509        T: std::iter::IntoIterator<Item = V>,
510        V: std::convert::Into<crate::model::Domain>,
511    {
512        use std::iter::Iterator;
513        self.domains = v.into_iter().map(|i| i.into()).collect();
514        self
515    }
516
517    /// Sets the value of [next_page_token][crate::model::ListDomainsResponse::next_page_token].
518    ///
519    /// # Example
520    /// ```ignore,no_run
521    /// # use google_cloud_managedidentities_v1::model::ListDomainsResponse;
522    /// let x = ListDomainsResponse::new().set_next_page_token("example");
523    /// ```
524    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
525        self.next_page_token = v.into();
526        self
527    }
528
529    /// Sets the value of [unreachable][crate::model::ListDomainsResponse::unreachable].
530    ///
531    /// # Example
532    /// ```ignore,no_run
533    /// # use google_cloud_managedidentities_v1::model::ListDomainsResponse;
534    /// let x = ListDomainsResponse::new().set_unreachable(["a", "b", "c"]);
535    /// ```
536    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
537    where
538        T: std::iter::IntoIterator<Item = V>,
539        V: std::convert::Into<std::string::String>,
540    {
541        use std::iter::Iterator;
542        self.unreachable = v.into_iter().map(|i| i.into()).collect();
543        self
544    }
545}
546
547impl wkt::message::Message for ListDomainsResponse {
548    fn typename() -> &'static str {
549        "type.googleapis.com/google.cloud.managedidentities.v1.ListDomainsResponse"
550    }
551}
552
553#[doc(hidden)]
554impl google_cloud_gax::paginator::internal::PageableResponse for ListDomainsResponse {
555    type PageItem = crate::model::Domain;
556
557    fn items(self) -> std::vec::Vec<Self::PageItem> {
558        self.domains
559    }
560
561    fn next_page_token(&self) -> std::string::String {
562        use std::clone::Clone;
563        self.next_page_token.clone()
564    }
565}
566
567/// Request message for [GetDomain][google.cloud.managedidentities.v1.GetDomain]
568#[derive(Clone, Default, PartialEq)]
569#[non_exhaustive]
570pub struct GetDomainRequest {
571    /// Required. The domain resource name using the form:
572    /// `projects/{project_id}/locations/global/domains/{domain_name}`
573    pub name: std::string::String,
574
575    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
576}
577
578impl GetDomainRequest {
579    pub fn new() -> Self {
580        std::default::Default::default()
581    }
582
583    /// Sets the value of [name][crate::model::GetDomainRequest::name].
584    ///
585    /// # Example
586    /// ```ignore,no_run
587    /// # use google_cloud_managedidentities_v1::model::GetDomainRequest;
588    /// let x = GetDomainRequest::new().set_name("example");
589    /// ```
590    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
591        self.name = v.into();
592        self
593    }
594}
595
596impl wkt::message::Message for GetDomainRequest {
597    fn typename() -> &'static str {
598        "type.googleapis.com/google.cloud.managedidentities.v1.GetDomainRequest"
599    }
600}
601
602/// Request message for
603/// [UpdateDomain][google.cloud.managedidentities.v1.UpdateDomain]
604#[derive(Clone, Default, PartialEq)]
605#[non_exhaustive]
606pub struct UpdateDomainRequest {
607    /// Required. Mask of fields to update. At least one path must be supplied in this
608    /// field. The elements of the repeated paths field may only include
609    /// fields from [Domain][google.cloud.managedidentities.v1.Domain]:
610    ///
611    /// * `labels`
612    /// * `locations`
613    /// * `authorized_networks`
614    ///
615    /// [google.cloud.managedidentities.v1.Domain]: crate::model::Domain
616    pub update_mask: std::option::Option<wkt::FieldMask>,
617
618    /// Required. Domain message with updated fields. Only supported fields specified in
619    /// update_mask are updated.
620    pub domain: std::option::Option<crate::model::Domain>,
621
622    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
623}
624
625impl UpdateDomainRequest {
626    pub fn new() -> Self {
627        std::default::Default::default()
628    }
629
630    /// Sets the value of [update_mask][crate::model::UpdateDomainRequest::update_mask].
631    ///
632    /// # Example
633    /// ```ignore,no_run
634    /// # use google_cloud_managedidentities_v1::model::UpdateDomainRequest;
635    /// use wkt::FieldMask;
636    /// let x = UpdateDomainRequest::new().set_update_mask(FieldMask::default()/* use setters */);
637    /// ```
638    pub fn set_update_mask<T>(mut self, v: T) -> Self
639    where
640        T: std::convert::Into<wkt::FieldMask>,
641    {
642        self.update_mask = std::option::Option::Some(v.into());
643        self
644    }
645
646    /// Sets or clears the value of [update_mask][crate::model::UpdateDomainRequest::update_mask].
647    ///
648    /// # Example
649    /// ```ignore,no_run
650    /// # use google_cloud_managedidentities_v1::model::UpdateDomainRequest;
651    /// use wkt::FieldMask;
652    /// let x = UpdateDomainRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
653    /// let x = UpdateDomainRequest::new().set_or_clear_update_mask(None::<FieldMask>);
654    /// ```
655    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
656    where
657        T: std::convert::Into<wkt::FieldMask>,
658    {
659        self.update_mask = v.map(|x| x.into());
660        self
661    }
662
663    /// Sets the value of [domain][crate::model::UpdateDomainRequest::domain].
664    ///
665    /// # Example
666    /// ```ignore,no_run
667    /// # use google_cloud_managedidentities_v1::model::UpdateDomainRequest;
668    /// use google_cloud_managedidentities_v1::model::Domain;
669    /// let x = UpdateDomainRequest::new().set_domain(Domain::default()/* use setters */);
670    /// ```
671    pub fn set_domain<T>(mut self, v: T) -> Self
672    where
673        T: std::convert::Into<crate::model::Domain>,
674    {
675        self.domain = std::option::Option::Some(v.into());
676        self
677    }
678
679    /// Sets or clears the value of [domain][crate::model::UpdateDomainRequest::domain].
680    ///
681    /// # Example
682    /// ```ignore,no_run
683    /// # use google_cloud_managedidentities_v1::model::UpdateDomainRequest;
684    /// use google_cloud_managedidentities_v1::model::Domain;
685    /// let x = UpdateDomainRequest::new().set_or_clear_domain(Some(Domain::default()/* use setters */));
686    /// let x = UpdateDomainRequest::new().set_or_clear_domain(None::<Domain>);
687    /// ```
688    pub fn set_or_clear_domain<T>(mut self, v: std::option::Option<T>) -> Self
689    where
690        T: std::convert::Into<crate::model::Domain>,
691    {
692        self.domain = v.map(|x| x.into());
693        self
694    }
695}
696
697impl wkt::message::Message for UpdateDomainRequest {
698    fn typename() -> &'static str {
699        "type.googleapis.com/google.cloud.managedidentities.v1.UpdateDomainRequest"
700    }
701}
702
703/// Request message for
704/// [DeleteDomain][google.cloud.managedidentities.v1.DeleteDomain]
705#[derive(Clone, Default, PartialEq)]
706#[non_exhaustive]
707pub struct DeleteDomainRequest {
708    /// Required. The domain resource name using the form:
709    /// `projects/{project_id}/locations/global/domains/{domain_name}`
710    pub name: std::string::String,
711
712    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
713}
714
715impl DeleteDomainRequest {
716    pub fn new() -> Self {
717        std::default::Default::default()
718    }
719
720    /// Sets the value of [name][crate::model::DeleteDomainRequest::name].
721    ///
722    /// # Example
723    /// ```ignore,no_run
724    /// # use google_cloud_managedidentities_v1::model::DeleteDomainRequest;
725    /// let x = DeleteDomainRequest::new().set_name("example");
726    /// ```
727    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
728        self.name = v.into();
729        self
730    }
731}
732
733impl wkt::message::Message for DeleteDomainRequest {
734    fn typename() -> &'static str {
735        "type.googleapis.com/google.cloud.managedidentities.v1.DeleteDomainRequest"
736    }
737}
738
739/// Request message for
740/// [AttachTrust][google.cloud.managedidentities.v1.AttachTrust]
741#[derive(Clone, Default, PartialEq)]
742#[non_exhaustive]
743pub struct AttachTrustRequest {
744    /// Required. The resource domain name, project name and location using the form:
745    /// `projects/{project_id}/locations/global/domains/{domain_name}`
746    pub name: std::string::String,
747
748    /// Required. The domain trust resource.
749    pub trust: std::option::Option<crate::model::Trust>,
750
751    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
752}
753
754impl AttachTrustRequest {
755    pub fn new() -> Self {
756        std::default::Default::default()
757    }
758
759    /// Sets the value of [name][crate::model::AttachTrustRequest::name].
760    ///
761    /// # Example
762    /// ```ignore,no_run
763    /// # use google_cloud_managedidentities_v1::model::AttachTrustRequest;
764    /// let x = AttachTrustRequest::new().set_name("example");
765    /// ```
766    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
767        self.name = v.into();
768        self
769    }
770
771    /// Sets the value of [trust][crate::model::AttachTrustRequest::trust].
772    ///
773    /// # Example
774    /// ```ignore,no_run
775    /// # use google_cloud_managedidentities_v1::model::AttachTrustRequest;
776    /// use google_cloud_managedidentities_v1::model::Trust;
777    /// let x = AttachTrustRequest::new().set_trust(Trust::default()/* use setters */);
778    /// ```
779    pub fn set_trust<T>(mut self, v: T) -> Self
780    where
781        T: std::convert::Into<crate::model::Trust>,
782    {
783        self.trust = std::option::Option::Some(v.into());
784        self
785    }
786
787    /// Sets or clears the value of [trust][crate::model::AttachTrustRequest::trust].
788    ///
789    /// # Example
790    /// ```ignore,no_run
791    /// # use google_cloud_managedidentities_v1::model::AttachTrustRequest;
792    /// use google_cloud_managedidentities_v1::model::Trust;
793    /// let x = AttachTrustRequest::new().set_or_clear_trust(Some(Trust::default()/* use setters */));
794    /// let x = AttachTrustRequest::new().set_or_clear_trust(None::<Trust>);
795    /// ```
796    pub fn set_or_clear_trust<T>(mut self, v: std::option::Option<T>) -> Self
797    where
798        T: std::convert::Into<crate::model::Trust>,
799    {
800        self.trust = v.map(|x| x.into());
801        self
802    }
803}
804
805impl wkt::message::Message for AttachTrustRequest {
806    fn typename() -> &'static str {
807        "type.googleapis.com/google.cloud.managedidentities.v1.AttachTrustRequest"
808    }
809}
810
811/// Request message for
812/// [ReconfigureTrust][google.cloud.managedidentities.v1.ReconfigureTrust]
813#[derive(Clone, Default, PartialEq)]
814#[non_exhaustive]
815pub struct ReconfigureTrustRequest {
816    /// Required. The resource domain name, project name and location using the form:
817    /// `projects/{project_id}/locations/global/domains/{domain_name}`
818    pub name: std::string::String,
819
820    /// Required. The fully-qualified target domain name which will be in trust with current
821    /// domain.
822    pub target_domain_name: std::string::String,
823
824    /// Required. The target DNS server IP addresses to resolve the remote domain involved
825    /// in the trust.
826    pub target_dns_ip_addresses: std::vec::Vec<std::string::String>,
827
828    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
829}
830
831impl ReconfigureTrustRequest {
832    pub fn new() -> Self {
833        std::default::Default::default()
834    }
835
836    /// Sets the value of [name][crate::model::ReconfigureTrustRequest::name].
837    ///
838    /// # Example
839    /// ```ignore,no_run
840    /// # use google_cloud_managedidentities_v1::model::ReconfigureTrustRequest;
841    /// let x = ReconfigureTrustRequest::new().set_name("example");
842    /// ```
843    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
844        self.name = v.into();
845        self
846    }
847
848    /// Sets the value of [target_domain_name][crate::model::ReconfigureTrustRequest::target_domain_name].
849    ///
850    /// # Example
851    /// ```ignore,no_run
852    /// # use google_cloud_managedidentities_v1::model::ReconfigureTrustRequest;
853    /// let x = ReconfigureTrustRequest::new().set_target_domain_name("example");
854    /// ```
855    pub fn set_target_domain_name<T: std::convert::Into<std::string::String>>(
856        mut self,
857        v: T,
858    ) -> Self {
859        self.target_domain_name = v.into();
860        self
861    }
862
863    /// Sets the value of [target_dns_ip_addresses][crate::model::ReconfigureTrustRequest::target_dns_ip_addresses].
864    ///
865    /// # Example
866    /// ```ignore,no_run
867    /// # use google_cloud_managedidentities_v1::model::ReconfigureTrustRequest;
868    /// let x = ReconfigureTrustRequest::new().set_target_dns_ip_addresses(["a", "b", "c"]);
869    /// ```
870    pub fn set_target_dns_ip_addresses<T, V>(mut self, v: T) -> Self
871    where
872        T: std::iter::IntoIterator<Item = V>,
873        V: std::convert::Into<std::string::String>,
874    {
875        use std::iter::Iterator;
876        self.target_dns_ip_addresses = v.into_iter().map(|i| i.into()).collect();
877        self
878    }
879}
880
881impl wkt::message::Message for ReconfigureTrustRequest {
882    fn typename() -> &'static str {
883        "type.googleapis.com/google.cloud.managedidentities.v1.ReconfigureTrustRequest"
884    }
885}
886
887/// Request message for
888/// [DetachTrust][google.cloud.managedidentities.v1.DetachTrust]
889#[derive(Clone, Default, PartialEq)]
890#[non_exhaustive]
891pub struct DetachTrustRequest {
892    /// Required. The resource domain name, project name, and location using the form:
893    /// `projects/{project_id}/locations/global/domains/{domain_name}`
894    pub name: std::string::String,
895
896    /// Required. The domain trust resource to removed.
897    pub trust: std::option::Option<crate::model::Trust>,
898
899    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
900}
901
902impl DetachTrustRequest {
903    pub fn new() -> Self {
904        std::default::Default::default()
905    }
906
907    /// Sets the value of [name][crate::model::DetachTrustRequest::name].
908    ///
909    /// # Example
910    /// ```ignore,no_run
911    /// # use google_cloud_managedidentities_v1::model::DetachTrustRequest;
912    /// let x = DetachTrustRequest::new().set_name("example");
913    /// ```
914    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915        self.name = v.into();
916        self
917    }
918
919    /// Sets the value of [trust][crate::model::DetachTrustRequest::trust].
920    ///
921    /// # Example
922    /// ```ignore,no_run
923    /// # use google_cloud_managedidentities_v1::model::DetachTrustRequest;
924    /// use google_cloud_managedidentities_v1::model::Trust;
925    /// let x = DetachTrustRequest::new().set_trust(Trust::default()/* use setters */);
926    /// ```
927    pub fn set_trust<T>(mut self, v: T) -> Self
928    where
929        T: std::convert::Into<crate::model::Trust>,
930    {
931        self.trust = std::option::Option::Some(v.into());
932        self
933    }
934
935    /// Sets or clears the value of [trust][crate::model::DetachTrustRequest::trust].
936    ///
937    /// # Example
938    /// ```ignore,no_run
939    /// # use google_cloud_managedidentities_v1::model::DetachTrustRequest;
940    /// use google_cloud_managedidentities_v1::model::Trust;
941    /// let x = DetachTrustRequest::new().set_or_clear_trust(Some(Trust::default()/* use setters */));
942    /// let x = DetachTrustRequest::new().set_or_clear_trust(None::<Trust>);
943    /// ```
944    pub fn set_or_clear_trust<T>(mut self, v: std::option::Option<T>) -> Self
945    where
946        T: std::convert::Into<crate::model::Trust>,
947    {
948        self.trust = v.map(|x| x.into());
949        self
950    }
951}
952
953impl wkt::message::Message for DetachTrustRequest {
954    fn typename() -> &'static str {
955        "type.googleapis.com/google.cloud.managedidentities.v1.DetachTrustRequest"
956    }
957}
958
959/// Request message for
960/// [ValidateTrust][google.cloud.managedidentities.v1.ValidateTrust]
961#[derive(Clone, Default, PartialEq)]
962#[non_exhaustive]
963pub struct ValidateTrustRequest {
964    /// Required. The resource domain name, project name, and location using the form:
965    /// `projects/{project_id}/locations/global/domains/{domain_name}`
966    pub name: std::string::String,
967
968    /// Required. The domain trust to validate trust state for.
969    pub trust: std::option::Option<crate::model::Trust>,
970
971    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
972}
973
974impl ValidateTrustRequest {
975    pub fn new() -> Self {
976        std::default::Default::default()
977    }
978
979    /// Sets the value of [name][crate::model::ValidateTrustRequest::name].
980    ///
981    /// # Example
982    /// ```ignore,no_run
983    /// # use google_cloud_managedidentities_v1::model::ValidateTrustRequest;
984    /// let x = ValidateTrustRequest::new().set_name("example");
985    /// ```
986    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
987        self.name = v.into();
988        self
989    }
990
991    /// Sets the value of [trust][crate::model::ValidateTrustRequest::trust].
992    ///
993    /// # Example
994    /// ```ignore,no_run
995    /// # use google_cloud_managedidentities_v1::model::ValidateTrustRequest;
996    /// use google_cloud_managedidentities_v1::model::Trust;
997    /// let x = ValidateTrustRequest::new().set_trust(Trust::default()/* use setters */);
998    /// ```
999    pub fn set_trust<T>(mut self, v: T) -> Self
1000    where
1001        T: std::convert::Into<crate::model::Trust>,
1002    {
1003        self.trust = std::option::Option::Some(v.into());
1004        self
1005    }
1006
1007    /// Sets or clears the value of [trust][crate::model::ValidateTrustRequest::trust].
1008    ///
1009    /// # Example
1010    /// ```ignore,no_run
1011    /// # use google_cloud_managedidentities_v1::model::ValidateTrustRequest;
1012    /// use google_cloud_managedidentities_v1::model::Trust;
1013    /// let x = ValidateTrustRequest::new().set_or_clear_trust(Some(Trust::default()/* use setters */));
1014    /// let x = ValidateTrustRequest::new().set_or_clear_trust(None::<Trust>);
1015    /// ```
1016    pub fn set_or_clear_trust<T>(mut self, v: std::option::Option<T>) -> Self
1017    where
1018        T: std::convert::Into<crate::model::Trust>,
1019    {
1020        self.trust = v.map(|x| x.into());
1021        self
1022    }
1023}
1024
1025impl wkt::message::Message for ValidateTrustRequest {
1026    fn typename() -> &'static str {
1027        "type.googleapis.com/google.cloud.managedidentities.v1.ValidateTrustRequest"
1028    }
1029}
1030
1031/// Represents a managed Microsoft Active Directory domain.
1032#[derive(Clone, Default, PartialEq)]
1033#[non_exhaustive]
1034pub struct Domain {
1035    /// Required. The unique name of the domain using the form:
1036    /// `projects/{project_id}/locations/global/domains/{domain_name}`.
1037    pub name: std::string::String,
1038
1039    /// Optional. Resource labels that can contain user-provided metadata.
1040    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1041
1042    /// Optional. The full names of the Google Compute Engine
1043    /// [networks](/compute/docs/networks-and-firewalls#networks) the domain
1044    /// instance is connected to. Networks can be added using UpdateDomain.
1045    /// The domain is only available on networks listed in `authorized_networks`.
1046    /// If CIDR subnets overlap between networks, domain creation will fail.
1047    pub authorized_networks: std::vec::Vec<std::string::String>,
1048
1049    /// Required. The CIDR range of internal addresses that are reserved for this
1050    /// domain. Reserved networks must be /24 or larger. Ranges must be
1051    /// unique and non-overlapping with existing subnets in
1052    /// [Domain].[authorized_networks].
1053    pub reserved_ip_range: std::string::String,
1054
1055    /// Required. Locations where domain needs to be provisioned.
1056    /// [regions][compute/docs/regions-zones/]
1057    /// e.g. us-west1 or us-east4
1058    /// Service supports up to 4 locations at once. Each location will use a /26
1059    /// block.
1060    pub locations: std::vec::Vec<std::string::String>,
1061
1062    /// Optional. The name of delegated administrator account used to perform
1063    /// Active Directory operations. If not specified, `setupadmin` will be used.
1064    pub admin: std::string::String,
1065
1066    /// Output only. The fully-qualified domain name of the exposed domain used by
1067    /// clients to connect to the service. Similar to what would be chosen for an
1068    /// Active Directory set up on an internal network.
1069    pub fqdn: std::string::String,
1070
1071    /// Output only. The time the instance was created.
1072    pub create_time: std::option::Option<wkt::Timestamp>,
1073
1074    /// Output only. The last update time.
1075    pub update_time: std::option::Option<wkt::Timestamp>,
1076
1077    /// Output only. The current state of this domain.
1078    pub state: crate::model::domain::State,
1079
1080    /// Output only. Additional information about the current status of this
1081    /// domain, if available.
1082    pub status_message: std::string::String,
1083
1084    /// Output only. The current trusts associated with the domain.
1085    pub trusts: std::vec::Vec<crate::model::Trust>,
1086
1087    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1088}
1089
1090impl Domain {
1091    pub fn new() -> Self {
1092        std::default::Default::default()
1093    }
1094
1095    /// Sets the value of [name][crate::model::Domain::name].
1096    ///
1097    /// # Example
1098    /// ```ignore,no_run
1099    /// # use google_cloud_managedidentities_v1::model::Domain;
1100    /// let x = Domain::new().set_name("example");
1101    /// ```
1102    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1103        self.name = v.into();
1104        self
1105    }
1106
1107    /// Sets the value of [labels][crate::model::Domain::labels].
1108    ///
1109    /// # Example
1110    /// ```ignore,no_run
1111    /// # use google_cloud_managedidentities_v1::model::Domain;
1112    /// let x = Domain::new().set_labels([
1113    ///     ("key0", "abc"),
1114    ///     ("key1", "xyz"),
1115    /// ]);
1116    /// ```
1117    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1118    where
1119        T: std::iter::IntoIterator<Item = (K, V)>,
1120        K: std::convert::Into<std::string::String>,
1121        V: std::convert::Into<std::string::String>,
1122    {
1123        use std::iter::Iterator;
1124        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1125        self
1126    }
1127
1128    /// Sets the value of [authorized_networks][crate::model::Domain::authorized_networks].
1129    ///
1130    /// # Example
1131    /// ```ignore,no_run
1132    /// # use google_cloud_managedidentities_v1::model::Domain;
1133    /// let x = Domain::new().set_authorized_networks(["a", "b", "c"]);
1134    /// ```
1135    pub fn set_authorized_networks<T, V>(mut self, v: T) -> Self
1136    where
1137        T: std::iter::IntoIterator<Item = V>,
1138        V: std::convert::Into<std::string::String>,
1139    {
1140        use std::iter::Iterator;
1141        self.authorized_networks = v.into_iter().map(|i| i.into()).collect();
1142        self
1143    }
1144
1145    /// Sets the value of [reserved_ip_range][crate::model::Domain::reserved_ip_range].
1146    ///
1147    /// # Example
1148    /// ```ignore,no_run
1149    /// # use google_cloud_managedidentities_v1::model::Domain;
1150    /// let x = Domain::new().set_reserved_ip_range("example");
1151    /// ```
1152    pub fn set_reserved_ip_range<T: std::convert::Into<std::string::String>>(
1153        mut self,
1154        v: T,
1155    ) -> Self {
1156        self.reserved_ip_range = v.into();
1157        self
1158    }
1159
1160    /// Sets the value of [locations][crate::model::Domain::locations].
1161    ///
1162    /// # Example
1163    /// ```ignore,no_run
1164    /// # use google_cloud_managedidentities_v1::model::Domain;
1165    /// let x = Domain::new().set_locations(["a", "b", "c"]);
1166    /// ```
1167    pub fn set_locations<T, V>(mut self, v: T) -> Self
1168    where
1169        T: std::iter::IntoIterator<Item = V>,
1170        V: std::convert::Into<std::string::String>,
1171    {
1172        use std::iter::Iterator;
1173        self.locations = v.into_iter().map(|i| i.into()).collect();
1174        self
1175    }
1176
1177    /// Sets the value of [admin][crate::model::Domain::admin].
1178    ///
1179    /// # Example
1180    /// ```ignore,no_run
1181    /// # use google_cloud_managedidentities_v1::model::Domain;
1182    /// let x = Domain::new().set_admin("example");
1183    /// ```
1184    pub fn set_admin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1185        self.admin = v.into();
1186        self
1187    }
1188
1189    /// Sets the value of [fqdn][crate::model::Domain::fqdn].
1190    ///
1191    /// # Example
1192    /// ```ignore,no_run
1193    /// # use google_cloud_managedidentities_v1::model::Domain;
1194    /// let x = Domain::new().set_fqdn("example");
1195    /// ```
1196    pub fn set_fqdn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1197        self.fqdn = v.into();
1198        self
1199    }
1200
1201    /// Sets the value of [create_time][crate::model::Domain::create_time].
1202    ///
1203    /// # Example
1204    /// ```ignore,no_run
1205    /// # use google_cloud_managedidentities_v1::model::Domain;
1206    /// use wkt::Timestamp;
1207    /// let x = Domain::new().set_create_time(Timestamp::default()/* use setters */);
1208    /// ```
1209    pub fn set_create_time<T>(mut self, v: T) -> Self
1210    where
1211        T: std::convert::Into<wkt::Timestamp>,
1212    {
1213        self.create_time = std::option::Option::Some(v.into());
1214        self
1215    }
1216
1217    /// Sets or clears the value of [create_time][crate::model::Domain::create_time].
1218    ///
1219    /// # Example
1220    /// ```ignore,no_run
1221    /// # use google_cloud_managedidentities_v1::model::Domain;
1222    /// use wkt::Timestamp;
1223    /// let x = Domain::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1224    /// let x = Domain::new().set_or_clear_create_time(None::<Timestamp>);
1225    /// ```
1226    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1227    where
1228        T: std::convert::Into<wkt::Timestamp>,
1229    {
1230        self.create_time = v.map(|x| x.into());
1231        self
1232    }
1233
1234    /// Sets the value of [update_time][crate::model::Domain::update_time].
1235    ///
1236    /// # Example
1237    /// ```ignore,no_run
1238    /// # use google_cloud_managedidentities_v1::model::Domain;
1239    /// use wkt::Timestamp;
1240    /// let x = Domain::new().set_update_time(Timestamp::default()/* use setters */);
1241    /// ```
1242    pub fn set_update_time<T>(mut self, v: T) -> Self
1243    where
1244        T: std::convert::Into<wkt::Timestamp>,
1245    {
1246        self.update_time = std::option::Option::Some(v.into());
1247        self
1248    }
1249
1250    /// Sets or clears the value of [update_time][crate::model::Domain::update_time].
1251    ///
1252    /// # Example
1253    /// ```ignore,no_run
1254    /// # use google_cloud_managedidentities_v1::model::Domain;
1255    /// use wkt::Timestamp;
1256    /// let x = Domain::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1257    /// let x = Domain::new().set_or_clear_update_time(None::<Timestamp>);
1258    /// ```
1259    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1260    where
1261        T: std::convert::Into<wkt::Timestamp>,
1262    {
1263        self.update_time = v.map(|x| x.into());
1264        self
1265    }
1266
1267    /// Sets the value of [state][crate::model::Domain::state].
1268    ///
1269    /// # Example
1270    /// ```ignore,no_run
1271    /// # use google_cloud_managedidentities_v1::model::Domain;
1272    /// use google_cloud_managedidentities_v1::model::domain::State;
1273    /// let x0 = Domain::new().set_state(State::Creating);
1274    /// let x1 = Domain::new().set_state(State::Ready);
1275    /// let x2 = Domain::new().set_state(State::Updating);
1276    /// ```
1277    pub fn set_state<T: std::convert::Into<crate::model::domain::State>>(mut self, v: T) -> Self {
1278        self.state = v.into();
1279        self
1280    }
1281
1282    /// Sets the value of [status_message][crate::model::Domain::status_message].
1283    ///
1284    /// # Example
1285    /// ```ignore,no_run
1286    /// # use google_cloud_managedidentities_v1::model::Domain;
1287    /// let x = Domain::new().set_status_message("example");
1288    /// ```
1289    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1290        self.status_message = v.into();
1291        self
1292    }
1293
1294    /// Sets the value of [trusts][crate::model::Domain::trusts].
1295    ///
1296    /// # Example
1297    /// ```ignore,no_run
1298    /// # use google_cloud_managedidentities_v1::model::Domain;
1299    /// use google_cloud_managedidentities_v1::model::Trust;
1300    /// let x = Domain::new()
1301    ///     .set_trusts([
1302    ///         Trust::default()/* use setters */,
1303    ///         Trust::default()/* use (different) setters */,
1304    ///     ]);
1305    /// ```
1306    pub fn set_trusts<T, V>(mut self, v: T) -> Self
1307    where
1308        T: std::iter::IntoIterator<Item = V>,
1309        V: std::convert::Into<crate::model::Trust>,
1310    {
1311        use std::iter::Iterator;
1312        self.trusts = v.into_iter().map(|i| i.into()).collect();
1313        self
1314    }
1315}
1316
1317impl wkt::message::Message for Domain {
1318    fn typename() -> &'static str {
1319        "type.googleapis.com/google.cloud.managedidentities.v1.Domain"
1320    }
1321}
1322
1323/// Defines additional types related to [Domain].
1324pub mod domain {
1325    #[allow(unused_imports)]
1326    use super::*;
1327
1328    /// Represents the different states of a managed domain.
1329    ///
1330    /// # Working with unknown values
1331    ///
1332    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1333    /// additional enum variants at any time. Adding new variants is not considered
1334    /// a breaking change. Applications should write their code in anticipation of:
1335    ///
1336    /// - New values appearing in future releases of the client library, **and**
1337    /// - New values received dynamically, without application changes.
1338    ///
1339    /// Please consult the [Working with enums] section in the user guide for some
1340    /// guidelines.
1341    ///
1342    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1343    #[derive(Clone, Debug, PartialEq)]
1344    #[non_exhaustive]
1345    pub enum State {
1346        /// Not set.
1347        Unspecified,
1348        /// The domain is being created.
1349        Creating,
1350        /// The domain has been created and is fully usable.
1351        Ready,
1352        /// The domain's configuration is being updated.
1353        Updating,
1354        /// The domain is being deleted.
1355        Deleting,
1356        /// The domain is being repaired and may be unusable. Details
1357        /// can be found in the `status_message` field.
1358        Repairing,
1359        /// The domain is undergoing maintenance.
1360        PerformingMaintenance,
1361        /// The domain is not serving requests.
1362        Unavailable,
1363        /// If set, the enum was initialized with an unknown value.
1364        ///
1365        /// Applications can examine the value using [State::value] or
1366        /// [State::name].
1367        UnknownValue(state::UnknownValue),
1368    }
1369
1370    #[doc(hidden)]
1371    pub mod state {
1372        #[allow(unused_imports)]
1373        use super::*;
1374        #[derive(Clone, Debug, PartialEq)]
1375        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1376    }
1377
1378    impl State {
1379        /// Gets the enum value.
1380        ///
1381        /// Returns `None` if the enum contains an unknown value deserialized from
1382        /// the string representation of enums.
1383        pub fn value(&self) -> std::option::Option<i32> {
1384            match self {
1385                Self::Unspecified => std::option::Option::Some(0),
1386                Self::Creating => std::option::Option::Some(1),
1387                Self::Ready => std::option::Option::Some(2),
1388                Self::Updating => std::option::Option::Some(3),
1389                Self::Deleting => std::option::Option::Some(4),
1390                Self::Repairing => std::option::Option::Some(5),
1391                Self::PerformingMaintenance => std::option::Option::Some(6),
1392                Self::Unavailable => std::option::Option::Some(7),
1393                Self::UnknownValue(u) => u.0.value(),
1394            }
1395        }
1396
1397        /// Gets the enum value as a string.
1398        ///
1399        /// Returns `None` if the enum contains an unknown value deserialized from
1400        /// the integer representation of enums.
1401        pub fn name(&self) -> std::option::Option<&str> {
1402            match self {
1403                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1404                Self::Creating => std::option::Option::Some("CREATING"),
1405                Self::Ready => std::option::Option::Some("READY"),
1406                Self::Updating => std::option::Option::Some("UPDATING"),
1407                Self::Deleting => std::option::Option::Some("DELETING"),
1408                Self::Repairing => std::option::Option::Some("REPAIRING"),
1409                Self::PerformingMaintenance => std::option::Option::Some("PERFORMING_MAINTENANCE"),
1410                Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
1411                Self::UnknownValue(u) => u.0.name(),
1412            }
1413        }
1414    }
1415
1416    impl std::default::Default for State {
1417        fn default() -> Self {
1418            use std::convert::From;
1419            Self::from(0)
1420        }
1421    }
1422
1423    impl std::fmt::Display for State {
1424        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1425            wkt::internal::display_enum(f, self.name(), self.value())
1426        }
1427    }
1428
1429    impl std::convert::From<i32> for State {
1430        fn from(value: i32) -> Self {
1431            match value {
1432                0 => Self::Unspecified,
1433                1 => Self::Creating,
1434                2 => Self::Ready,
1435                3 => Self::Updating,
1436                4 => Self::Deleting,
1437                5 => Self::Repairing,
1438                6 => Self::PerformingMaintenance,
1439                7 => Self::Unavailable,
1440                _ => Self::UnknownValue(state::UnknownValue(
1441                    wkt::internal::UnknownEnumValue::Integer(value),
1442                )),
1443            }
1444        }
1445    }
1446
1447    impl std::convert::From<&str> for State {
1448        fn from(value: &str) -> Self {
1449            use std::string::ToString;
1450            match value {
1451                "STATE_UNSPECIFIED" => Self::Unspecified,
1452                "CREATING" => Self::Creating,
1453                "READY" => Self::Ready,
1454                "UPDATING" => Self::Updating,
1455                "DELETING" => Self::Deleting,
1456                "REPAIRING" => Self::Repairing,
1457                "PERFORMING_MAINTENANCE" => Self::PerformingMaintenance,
1458                "UNAVAILABLE" => Self::Unavailable,
1459                _ => Self::UnknownValue(state::UnknownValue(
1460                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1461                )),
1462            }
1463        }
1464    }
1465
1466    impl serde::ser::Serialize for State {
1467        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1468        where
1469            S: serde::Serializer,
1470        {
1471            match self {
1472                Self::Unspecified => serializer.serialize_i32(0),
1473                Self::Creating => serializer.serialize_i32(1),
1474                Self::Ready => serializer.serialize_i32(2),
1475                Self::Updating => serializer.serialize_i32(3),
1476                Self::Deleting => serializer.serialize_i32(4),
1477                Self::Repairing => serializer.serialize_i32(5),
1478                Self::PerformingMaintenance => serializer.serialize_i32(6),
1479                Self::Unavailable => serializer.serialize_i32(7),
1480                Self::UnknownValue(u) => u.0.serialize(serializer),
1481            }
1482        }
1483    }
1484
1485    impl<'de> serde::de::Deserialize<'de> for State {
1486        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1487        where
1488            D: serde::Deserializer<'de>,
1489        {
1490            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1491                ".google.cloud.managedidentities.v1.Domain.State",
1492            ))
1493        }
1494    }
1495}
1496
1497/// Represents a relationship between two domains. This allows a controller in
1498/// one domain to authenticate a user in another domain.
1499#[derive(Clone, Default, PartialEq)]
1500#[non_exhaustive]
1501pub struct Trust {
1502    /// Required. The fully qualified target domain name which will be in trust with the
1503    /// current domain.
1504    pub target_domain_name: std::string::String,
1505
1506    /// Required. The type of trust represented by the trust resource.
1507    pub trust_type: crate::model::trust::TrustType,
1508
1509    /// Required. The trust direction, which decides if the current domain is trusted,
1510    /// trusting, or both.
1511    pub trust_direction: crate::model::trust::TrustDirection,
1512
1513    /// Optional. The trust authentication type, which decides whether the trusted side has
1514    /// forest/domain wide access or selective access to an approved set of
1515    /// resources.
1516    pub selective_authentication: bool,
1517
1518    /// Required. The target DNS server IP addresses which can resolve the remote domain
1519    /// involved in the trust.
1520    pub target_dns_ip_addresses: std::vec::Vec<std::string::String>,
1521
1522    /// Required. The trust secret used for the handshake with the target domain. This will
1523    /// not be stored.
1524    pub trust_handshake_secret: std::string::String,
1525
1526    /// Output only. The time the instance was created.
1527    pub create_time: std::option::Option<wkt::Timestamp>,
1528
1529    /// Output only. The last update time.
1530    pub update_time: std::option::Option<wkt::Timestamp>,
1531
1532    /// Output only. The current state of the trust.
1533    pub state: crate::model::trust::State,
1534
1535    /// Output only. Additional information about the current state of the trust, if available.
1536    pub state_description: std::string::String,
1537
1538    /// Output only. The last heartbeat time when the trust was known to be connected.
1539    pub last_trust_heartbeat_time: std::option::Option<wkt::Timestamp>,
1540
1541    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1542}
1543
1544impl Trust {
1545    pub fn new() -> Self {
1546        std::default::Default::default()
1547    }
1548
1549    /// Sets the value of [target_domain_name][crate::model::Trust::target_domain_name].
1550    ///
1551    /// # Example
1552    /// ```ignore,no_run
1553    /// # use google_cloud_managedidentities_v1::model::Trust;
1554    /// let x = Trust::new().set_target_domain_name("example");
1555    /// ```
1556    pub fn set_target_domain_name<T: std::convert::Into<std::string::String>>(
1557        mut self,
1558        v: T,
1559    ) -> Self {
1560        self.target_domain_name = v.into();
1561        self
1562    }
1563
1564    /// Sets the value of [trust_type][crate::model::Trust::trust_type].
1565    ///
1566    /// # Example
1567    /// ```ignore,no_run
1568    /// # use google_cloud_managedidentities_v1::model::Trust;
1569    /// use google_cloud_managedidentities_v1::model::trust::TrustType;
1570    /// let x0 = Trust::new().set_trust_type(TrustType::Forest);
1571    /// let x1 = Trust::new().set_trust_type(TrustType::External);
1572    /// ```
1573    pub fn set_trust_type<T: std::convert::Into<crate::model::trust::TrustType>>(
1574        mut self,
1575        v: T,
1576    ) -> Self {
1577        self.trust_type = v.into();
1578        self
1579    }
1580
1581    /// Sets the value of [trust_direction][crate::model::Trust::trust_direction].
1582    ///
1583    /// # Example
1584    /// ```ignore,no_run
1585    /// # use google_cloud_managedidentities_v1::model::Trust;
1586    /// use google_cloud_managedidentities_v1::model::trust::TrustDirection;
1587    /// let x0 = Trust::new().set_trust_direction(TrustDirection::Inbound);
1588    /// let x1 = Trust::new().set_trust_direction(TrustDirection::Outbound);
1589    /// let x2 = Trust::new().set_trust_direction(TrustDirection::Bidirectional);
1590    /// ```
1591    pub fn set_trust_direction<T: std::convert::Into<crate::model::trust::TrustDirection>>(
1592        mut self,
1593        v: T,
1594    ) -> Self {
1595        self.trust_direction = v.into();
1596        self
1597    }
1598
1599    /// Sets the value of [selective_authentication][crate::model::Trust::selective_authentication].
1600    ///
1601    /// # Example
1602    /// ```ignore,no_run
1603    /// # use google_cloud_managedidentities_v1::model::Trust;
1604    /// let x = Trust::new().set_selective_authentication(true);
1605    /// ```
1606    pub fn set_selective_authentication<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1607        self.selective_authentication = v.into();
1608        self
1609    }
1610
1611    /// Sets the value of [target_dns_ip_addresses][crate::model::Trust::target_dns_ip_addresses].
1612    ///
1613    /// # Example
1614    /// ```ignore,no_run
1615    /// # use google_cloud_managedidentities_v1::model::Trust;
1616    /// let x = Trust::new().set_target_dns_ip_addresses(["a", "b", "c"]);
1617    /// ```
1618    pub fn set_target_dns_ip_addresses<T, V>(mut self, v: T) -> Self
1619    where
1620        T: std::iter::IntoIterator<Item = V>,
1621        V: std::convert::Into<std::string::String>,
1622    {
1623        use std::iter::Iterator;
1624        self.target_dns_ip_addresses = v.into_iter().map(|i| i.into()).collect();
1625        self
1626    }
1627
1628    /// Sets the value of [trust_handshake_secret][crate::model::Trust::trust_handshake_secret].
1629    ///
1630    /// # Example
1631    /// ```ignore,no_run
1632    /// # use google_cloud_managedidentities_v1::model::Trust;
1633    /// let x = Trust::new().set_trust_handshake_secret("example");
1634    /// ```
1635    pub fn set_trust_handshake_secret<T: std::convert::Into<std::string::String>>(
1636        mut self,
1637        v: T,
1638    ) -> Self {
1639        self.trust_handshake_secret = v.into();
1640        self
1641    }
1642
1643    /// Sets the value of [create_time][crate::model::Trust::create_time].
1644    ///
1645    /// # Example
1646    /// ```ignore,no_run
1647    /// # use google_cloud_managedidentities_v1::model::Trust;
1648    /// use wkt::Timestamp;
1649    /// let x = Trust::new().set_create_time(Timestamp::default()/* use setters */);
1650    /// ```
1651    pub fn set_create_time<T>(mut self, v: T) -> Self
1652    where
1653        T: std::convert::Into<wkt::Timestamp>,
1654    {
1655        self.create_time = std::option::Option::Some(v.into());
1656        self
1657    }
1658
1659    /// Sets or clears the value of [create_time][crate::model::Trust::create_time].
1660    ///
1661    /// # Example
1662    /// ```ignore,no_run
1663    /// # use google_cloud_managedidentities_v1::model::Trust;
1664    /// use wkt::Timestamp;
1665    /// let x = Trust::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1666    /// let x = Trust::new().set_or_clear_create_time(None::<Timestamp>);
1667    /// ```
1668    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1669    where
1670        T: std::convert::Into<wkt::Timestamp>,
1671    {
1672        self.create_time = v.map(|x| x.into());
1673        self
1674    }
1675
1676    /// Sets the value of [update_time][crate::model::Trust::update_time].
1677    ///
1678    /// # Example
1679    /// ```ignore,no_run
1680    /// # use google_cloud_managedidentities_v1::model::Trust;
1681    /// use wkt::Timestamp;
1682    /// let x = Trust::new().set_update_time(Timestamp::default()/* use setters */);
1683    /// ```
1684    pub fn set_update_time<T>(mut self, v: T) -> Self
1685    where
1686        T: std::convert::Into<wkt::Timestamp>,
1687    {
1688        self.update_time = std::option::Option::Some(v.into());
1689        self
1690    }
1691
1692    /// Sets or clears the value of [update_time][crate::model::Trust::update_time].
1693    ///
1694    /// # Example
1695    /// ```ignore,no_run
1696    /// # use google_cloud_managedidentities_v1::model::Trust;
1697    /// use wkt::Timestamp;
1698    /// let x = Trust::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1699    /// let x = Trust::new().set_or_clear_update_time(None::<Timestamp>);
1700    /// ```
1701    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1702    where
1703        T: std::convert::Into<wkt::Timestamp>,
1704    {
1705        self.update_time = v.map(|x| x.into());
1706        self
1707    }
1708
1709    /// Sets the value of [state][crate::model::Trust::state].
1710    ///
1711    /// # Example
1712    /// ```ignore,no_run
1713    /// # use google_cloud_managedidentities_v1::model::Trust;
1714    /// use google_cloud_managedidentities_v1::model::trust::State;
1715    /// let x0 = Trust::new().set_state(State::Creating);
1716    /// let x1 = Trust::new().set_state(State::Updating);
1717    /// let x2 = Trust::new().set_state(State::Deleting);
1718    /// ```
1719    pub fn set_state<T: std::convert::Into<crate::model::trust::State>>(mut self, v: T) -> Self {
1720        self.state = v.into();
1721        self
1722    }
1723
1724    /// Sets the value of [state_description][crate::model::Trust::state_description].
1725    ///
1726    /// # Example
1727    /// ```ignore,no_run
1728    /// # use google_cloud_managedidentities_v1::model::Trust;
1729    /// let x = Trust::new().set_state_description("example");
1730    /// ```
1731    pub fn set_state_description<T: std::convert::Into<std::string::String>>(
1732        mut self,
1733        v: T,
1734    ) -> Self {
1735        self.state_description = v.into();
1736        self
1737    }
1738
1739    /// Sets the value of [last_trust_heartbeat_time][crate::model::Trust::last_trust_heartbeat_time].
1740    ///
1741    /// # Example
1742    /// ```ignore,no_run
1743    /// # use google_cloud_managedidentities_v1::model::Trust;
1744    /// use wkt::Timestamp;
1745    /// let x = Trust::new().set_last_trust_heartbeat_time(Timestamp::default()/* use setters */);
1746    /// ```
1747    pub fn set_last_trust_heartbeat_time<T>(mut self, v: T) -> Self
1748    where
1749        T: std::convert::Into<wkt::Timestamp>,
1750    {
1751        self.last_trust_heartbeat_time = std::option::Option::Some(v.into());
1752        self
1753    }
1754
1755    /// Sets or clears the value of [last_trust_heartbeat_time][crate::model::Trust::last_trust_heartbeat_time].
1756    ///
1757    /// # Example
1758    /// ```ignore,no_run
1759    /// # use google_cloud_managedidentities_v1::model::Trust;
1760    /// use wkt::Timestamp;
1761    /// let x = Trust::new().set_or_clear_last_trust_heartbeat_time(Some(Timestamp::default()/* use setters */));
1762    /// let x = Trust::new().set_or_clear_last_trust_heartbeat_time(None::<Timestamp>);
1763    /// ```
1764    pub fn set_or_clear_last_trust_heartbeat_time<T>(mut self, v: std::option::Option<T>) -> Self
1765    where
1766        T: std::convert::Into<wkt::Timestamp>,
1767    {
1768        self.last_trust_heartbeat_time = v.map(|x| x.into());
1769        self
1770    }
1771}
1772
1773impl wkt::message::Message for Trust {
1774    fn typename() -> &'static str {
1775        "type.googleapis.com/google.cloud.managedidentities.v1.Trust"
1776    }
1777}
1778
1779/// Defines additional types related to [Trust].
1780pub mod trust {
1781    #[allow(unused_imports)]
1782    use super::*;
1783
1784    /// Represents the different states of a domain trust.
1785    ///
1786    /// # Working with unknown values
1787    ///
1788    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1789    /// additional enum variants at any time. Adding new variants is not considered
1790    /// a breaking change. Applications should write their code in anticipation of:
1791    ///
1792    /// - New values appearing in future releases of the client library, **and**
1793    /// - New values received dynamically, without application changes.
1794    ///
1795    /// Please consult the [Working with enums] section in the user guide for some
1796    /// guidelines.
1797    ///
1798    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1799    #[derive(Clone, Debug, PartialEq)]
1800    #[non_exhaustive]
1801    pub enum State {
1802        /// Not set.
1803        Unspecified,
1804        /// The domain trust is being created.
1805        Creating,
1806        /// The domain trust is being updated.
1807        Updating,
1808        /// The domain trust is being deleted.
1809        Deleting,
1810        /// The domain trust is connected.
1811        Connected,
1812        /// The domain trust is disconnected.
1813        Disconnected,
1814        /// If set, the enum was initialized with an unknown value.
1815        ///
1816        /// Applications can examine the value using [State::value] or
1817        /// [State::name].
1818        UnknownValue(state::UnknownValue),
1819    }
1820
1821    #[doc(hidden)]
1822    pub mod state {
1823        #[allow(unused_imports)]
1824        use super::*;
1825        #[derive(Clone, Debug, PartialEq)]
1826        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1827    }
1828
1829    impl State {
1830        /// Gets the enum value.
1831        ///
1832        /// Returns `None` if the enum contains an unknown value deserialized from
1833        /// the string representation of enums.
1834        pub fn value(&self) -> std::option::Option<i32> {
1835            match self {
1836                Self::Unspecified => std::option::Option::Some(0),
1837                Self::Creating => std::option::Option::Some(1),
1838                Self::Updating => std::option::Option::Some(2),
1839                Self::Deleting => std::option::Option::Some(3),
1840                Self::Connected => std::option::Option::Some(4),
1841                Self::Disconnected => std::option::Option::Some(5),
1842                Self::UnknownValue(u) => u.0.value(),
1843            }
1844        }
1845
1846        /// Gets the enum value as a string.
1847        ///
1848        /// Returns `None` if the enum contains an unknown value deserialized from
1849        /// the integer representation of enums.
1850        pub fn name(&self) -> std::option::Option<&str> {
1851            match self {
1852                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1853                Self::Creating => std::option::Option::Some("CREATING"),
1854                Self::Updating => std::option::Option::Some("UPDATING"),
1855                Self::Deleting => std::option::Option::Some("DELETING"),
1856                Self::Connected => std::option::Option::Some("CONNECTED"),
1857                Self::Disconnected => std::option::Option::Some("DISCONNECTED"),
1858                Self::UnknownValue(u) => u.0.name(),
1859            }
1860        }
1861    }
1862
1863    impl std::default::Default for State {
1864        fn default() -> Self {
1865            use std::convert::From;
1866            Self::from(0)
1867        }
1868    }
1869
1870    impl std::fmt::Display for State {
1871        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1872            wkt::internal::display_enum(f, self.name(), self.value())
1873        }
1874    }
1875
1876    impl std::convert::From<i32> for State {
1877        fn from(value: i32) -> Self {
1878            match value {
1879                0 => Self::Unspecified,
1880                1 => Self::Creating,
1881                2 => Self::Updating,
1882                3 => Self::Deleting,
1883                4 => Self::Connected,
1884                5 => Self::Disconnected,
1885                _ => Self::UnknownValue(state::UnknownValue(
1886                    wkt::internal::UnknownEnumValue::Integer(value),
1887                )),
1888            }
1889        }
1890    }
1891
1892    impl std::convert::From<&str> for State {
1893        fn from(value: &str) -> Self {
1894            use std::string::ToString;
1895            match value {
1896                "STATE_UNSPECIFIED" => Self::Unspecified,
1897                "CREATING" => Self::Creating,
1898                "UPDATING" => Self::Updating,
1899                "DELETING" => Self::Deleting,
1900                "CONNECTED" => Self::Connected,
1901                "DISCONNECTED" => Self::Disconnected,
1902                _ => Self::UnknownValue(state::UnknownValue(
1903                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1904                )),
1905            }
1906        }
1907    }
1908
1909    impl serde::ser::Serialize for State {
1910        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1911        where
1912            S: serde::Serializer,
1913        {
1914            match self {
1915                Self::Unspecified => serializer.serialize_i32(0),
1916                Self::Creating => serializer.serialize_i32(1),
1917                Self::Updating => serializer.serialize_i32(2),
1918                Self::Deleting => serializer.serialize_i32(3),
1919                Self::Connected => serializer.serialize_i32(4),
1920                Self::Disconnected => serializer.serialize_i32(5),
1921                Self::UnknownValue(u) => u.0.serialize(serializer),
1922            }
1923        }
1924    }
1925
1926    impl<'de> serde::de::Deserialize<'de> for State {
1927        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1928        where
1929            D: serde::Deserializer<'de>,
1930        {
1931            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1932                ".google.cloud.managedidentities.v1.Trust.State",
1933            ))
1934        }
1935    }
1936
1937    /// Represents the different inter-forest trust types.
1938    ///
1939    /// # Working with unknown values
1940    ///
1941    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1942    /// additional enum variants at any time. Adding new variants is not considered
1943    /// a breaking change. Applications should write their code in anticipation of:
1944    ///
1945    /// - New values appearing in future releases of the client library, **and**
1946    /// - New values received dynamically, without application changes.
1947    ///
1948    /// Please consult the [Working with enums] section in the user guide for some
1949    /// guidelines.
1950    ///
1951    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1952    #[derive(Clone, Debug, PartialEq)]
1953    #[non_exhaustive]
1954    pub enum TrustType {
1955        /// Not set.
1956        Unspecified,
1957        /// The forest trust.
1958        Forest,
1959        /// The external domain trust.
1960        External,
1961        /// If set, the enum was initialized with an unknown value.
1962        ///
1963        /// Applications can examine the value using [TrustType::value] or
1964        /// [TrustType::name].
1965        UnknownValue(trust_type::UnknownValue),
1966    }
1967
1968    #[doc(hidden)]
1969    pub mod trust_type {
1970        #[allow(unused_imports)]
1971        use super::*;
1972        #[derive(Clone, Debug, PartialEq)]
1973        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1974    }
1975
1976    impl TrustType {
1977        /// Gets the enum value.
1978        ///
1979        /// Returns `None` if the enum contains an unknown value deserialized from
1980        /// the string representation of enums.
1981        pub fn value(&self) -> std::option::Option<i32> {
1982            match self {
1983                Self::Unspecified => std::option::Option::Some(0),
1984                Self::Forest => std::option::Option::Some(1),
1985                Self::External => std::option::Option::Some(2),
1986                Self::UnknownValue(u) => u.0.value(),
1987            }
1988        }
1989
1990        /// Gets the enum value as a string.
1991        ///
1992        /// Returns `None` if the enum contains an unknown value deserialized from
1993        /// the integer representation of enums.
1994        pub fn name(&self) -> std::option::Option<&str> {
1995            match self {
1996                Self::Unspecified => std::option::Option::Some("TRUST_TYPE_UNSPECIFIED"),
1997                Self::Forest => std::option::Option::Some("FOREST"),
1998                Self::External => std::option::Option::Some("EXTERNAL"),
1999                Self::UnknownValue(u) => u.0.name(),
2000            }
2001        }
2002    }
2003
2004    impl std::default::Default for TrustType {
2005        fn default() -> Self {
2006            use std::convert::From;
2007            Self::from(0)
2008        }
2009    }
2010
2011    impl std::fmt::Display for TrustType {
2012        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2013            wkt::internal::display_enum(f, self.name(), self.value())
2014        }
2015    }
2016
2017    impl std::convert::From<i32> for TrustType {
2018        fn from(value: i32) -> Self {
2019            match value {
2020                0 => Self::Unspecified,
2021                1 => Self::Forest,
2022                2 => Self::External,
2023                _ => Self::UnknownValue(trust_type::UnknownValue(
2024                    wkt::internal::UnknownEnumValue::Integer(value),
2025                )),
2026            }
2027        }
2028    }
2029
2030    impl std::convert::From<&str> for TrustType {
2031        fn from(value: &str) -> Self {
2032            use std::string::ToString;
2033            match value {
2034                "TRUST_TYPE_UNSPECIFIED" => Self::Unspecified,
2035                "FOREST" => Self::Forest,
2036                "EXTERNAL" => Self::External,
2037                _ => Self::UnknownValue(trust_type::UnknownValue(
2038                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2039                )),
2040            }
2041        }
2042    }
2043
2044    impl serde::ser::Serialize for TrustType {
2045        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2046        where
2047            S: serde::Serializer,
2048        {
2049            match self {
2050                Self::Unspecified => serializer.serialize_i32(0),
2051                Self::Forest => serializer.serialize_i32(1),
2052                Self::External => serializer.serialize_i32(2),
2053                Self::UnknownValue(u) => u.0.serialize(serializer),
2054            }
2055        }
2056    }
2057
2058    impl<'de> serde::de::Deserialize<'de> for TrustType {
2059        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2060        where
2061            D: serde::Deserializer<'de>,
2062        {
2063            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrustType>::new(
2064                ".google.cloud.managedidentities.v1.Trust.TrustType",
2065            ))
2066        }
2067    }
2068
2069    /// Represents the direction of trust.
2070    /// See
2071    /// [System.DirectoryServices.ActiveDirectory.TrustDirection](https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices.activedirectory.trustdirection?view=netframework-4.7.2)
2072    /// for more information.
2073    ///
2074    /// # Working with unknown values
2075    ///
2076    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2077    /// additional enum variants at any time. Adding new variants is not considered
2078    /// a breaking change. Applications should write their code in anticipation of:
2079    ///
2080    /// - New values appearing in future releases of the client library, **and**
2081    /// - New values received dynamically, without application changes.
2082    ///
2083    /// Please consult the [Working with enums] section in the user guide for some
2084    /// guidelines.
2085    ///
2086    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2087    #[derive(Clone, Debug, PartialEq)]
2088    #[non_exhaustive]
2089    pub enum TrustDirection {
2090        /// Not set.
2091        Unspecified,
2092        /// The inbound direction represents the trusting side.
2093        Inbound,
2094        /// The outboud direction represents the trusted side.
2095        Outbound,
2096        /// The bidirectional direction represents the trusted / trusting side.
2097        Bidirectional,
2098        /// If set, the enum was initialized with an unknown value.
2099        ///
2100        /// Applications can examine the value using [TrustDirection::value] or
2101        /// [TrustDirection::name].
2102        UnknownValue(trust_direction::UnknownValue),
2103    }
2104
2105    #[doc(hidden)]
2106    pub mod trust_direction {
2107        #[allow(unused_imports)]
2108        use super::*;
2109        #[derive(Clone, Debug, PartialEq)]
2110        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2111    }
2112
2113    impl TrustDirection {
2114        /// Gets the enum value.
2115        ///
2116        /// Returns `None` if the enum contains an unknown value deserialized from
2117        /// the string representation of enums.
2118        pub fn value(&self) -> std::option::Option<i32> {
2119            match self {
2120                Self::Unspecified => std::option::Option::Some(0),
2121                Self::Inbound => std::option::Option::Some(1),
2122                Self::Outbound => std::option::Option::Some(2),
2123                Self::Bidirectional => std::option::Option::Some(3),
2124                Self::UnknownValue(u) => u.0.value(),
2125            }
2126        }
2127
2128        /// Gets the enum value as a string.
2129        ///
2130        /// Returns `None` if the enum contains an unknown value deserialized from
2131        /// the integer representation of enums.
2132        pub fn name(&self) -> std::option::Option<&str> {
2133            match self {
2134                Self::Unspecified => std::option::Option::Some("TRUST_DIRECTION_UNSPECIFIED"),
2135                Self::Inbound => std::option::Option::Some("INBOUND"),
2136                Self::Outbound => std::option::Option::Some("OUTBOUND"),
2137                Self::Bidirectional => std::option::Option::Some("BIDIRECTIONAL"),
2138                Self::UnknownValue(u) => u.0.name(),
2139            }
2140        }
2141    }
2142
2143    impl std::default::Default for TrustDirection {
2144        fn default() -> Self {
2145            use std::convert::From;
2146            Self::from(0)
2147        }
2148    }
2149
2150    impl std::fmt::Display for TrustDirection {
2151        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2152            wkt::internal::display_enum(f, self.name(), self.value())
2153        }
2154    }
2155
2156    impl std::convert::From<i32> for TrustDirection {
2157        fn from(value: i32) -> Self {
2158            match value {
2159                0 => Self::Unspecified,
2160                1 => Self::Inbound,
2161                2 => Self::Outbound,
2162                3 => Self::Bidirectional,
2163                _ => Self::UnknownValue(trust_direction::UnknownValue(
2164                    wkt::internal::UnknownEnumValue::Integer(value),
2165                )),
2166            }
2167        }
2168    }
2169
2170    impl std::convert::From<&str> for TrustDirection {
2171        fn from(value: &str) -> Self {
2172            use std::string::ToString;
2173            match value {
2174                "TRUST_DIRECTION_UNSPECIFIED" => Self::Unspecified,
2175                "INBOUND" => Self::Inbound,
2176                "OUTBOUND" => Self::Outbound,
2177                "BIDIRECTIONAL" => Self::Bidirectional,
2178                _ => Self::UnknownValue(trust_direction::UnknownValue(
2179                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2180                )),
2181            }
2182        }
2183    }
2184
2185    impl serde::ser::Serialize for TrustDirection {
2186        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2187        where
2188            S: serde::Serializer,
2189        {
2190            match self {
2191                Self::Unspecified => serializer.serialize_i32(0),
2192                Self::Inbound => serializer.serialize_i32(1),
2193                Self::Outbound => serializer.serialize_i32(2),
2194                Self::Bidirectional => serializer.serialize_i32(3),
2195                Self::UnknownValue(u) => u.0.serialize(serializer),
2196            }
2197        }
2198    }
2199
2200    impl<'de> serde::de::Deserialize<'de> for TrustDirection {
2201        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2202        where
2203            D: serde::Deserializer<'de>,
2204        {
2205            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrustDirection>::new(
2206                ".google.cloud.managedidentities.v1.Trust.TrustDirection",
2207            ))
2208        }
2209    }
2210}