Skip to main content

google_cloud_parametermanager_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_location;
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/// Message describing Parameter resource
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Parameter {
41    /// Identifier. [Output only] The resource name of the Parameter in the format
42    /// `projects/*/locations/*/parameters/*`.
43    pub name: std::string::String,
44
45    /// Output only. [Output only] Create time stamp
46    pub create_time: std::option::Option<wkt::Timestamp>,
47
48    /// Output only. [Output only] Update time stamp
49    pub update_time: std::option::Option<wkt::Timestamp>,
50
51    /// Optional. Labels as key value pairs
52    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
53
54    /// Optional. Specifies the format of a Parameter.
55    pub format: crate::model::ParameterFormat,
56
57    /// Output only. [Output-only] policy member strings of a Google Cloud
58    /// resource.
59    pub policy_member: std::option::Option<google_cloud_iam_v1::model::ResourcePolicyMember>,
60
61    /// Optional. Customer managed encryption key (CMEK) to use for encrypting the
62    /// Parameter Versions. If not set, the default Google-managed encryption key
63    /// will be used. Cloud KMS CryptoKeys must reside in the same location as the
64    /// Parameter. The expected format is
65    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
66    pub kms_key: std::option::Option<std::string::String>,
67
68    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl Parameter {
72    /// Creates a new default instance.
73    pub fn new() -> Self {
74        std::default::Default::default()
75    }
76
77    /// Sets the value of [name][crate::model::Parameter::name].
78    ///
79    /// # Example
80    /// ```ignore,no_run
81    /// # use google_cloud_parametermanager_v1::model::Parameter;
82    /// let x = Parameter::new().set_name("example");
83    /// ```
84    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
85        self.name = v.into();
86        self
87    }
88
89    /// Sets the value of [create_time][crate::model::Parameter::create_time].
90    ///
91    /// # Example
92    /// ```ignore,no_run
93    /// # use google_cloud_parametermanager_v1::model::Parameter;
94    /// use wkt::Timestamp;
95    /// let x = Parameter::new().set_create_time(Timestamp::default()/* use setters */);
96    /// ```
97    pub fn set_create_time<T>(mut self, v: T) -> Self
98    where
99        T: std::convert::Into<wkt::Timestamp>,
100    {
101        self.create_time = std::option::Option::Some(v.into());
102        self
103    }
104
105    /// Sets or clears the value of [create_time][crate::model::Parameter::create_time].
106    ///
107    /// # Example
108    /// ```ignore,no_run
109    /// # use google_cloud_parametermanager_v1::model::Parameter;
110    /// use wkt::Timestamp;
111    /// let x = Parameter::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
112    /// let x = Parameter::new().set_or_clear_create_time(None::<Timestamp>);
113    /// ```
114    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
115    where
116        T: std::convert::Into<wkt::Timestamp>,
117    {
118        self.create_time = v.map(|x| x.into());
119        self
120    }
121
122    /// Sets the value of [update_time][crate::model::Parameter::update_time].
123    ///
124    /// # Example
125    /// ```ignore,no_run
126    /// # use google_cloud_parametermanager_v1::model::Parameter;
127    /// use wkt::Timestamp;
128    /// let x = Parameter::new().set_update_time(Timestamp::default()/* use setters */);
129    /// ```
130    pub fn set_update_time<T>(mut self, v: T) -> Self
131    where
132        T: std::convert::Into<wkt::Timestamp>,
133    {
134        self.update_time = std::option::Option::Some(v.into());
135        self
136    }
137
138    /// Sets or clears the value of [update_time][crate::model::Parameter::update_time].
139    ///
140    /// # Example
141    /// ```ignore,no_run
142    /// # use google_cloud_parametermanager_v1::model::Parameter;
143    /// use wkt::Timestamp;
144    /// let x = Parameter::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
145    /// let x = Parameter::new().set_or_clear_update_time(None::<Timestamp>);
146    /// ```
147    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
148    where
149        T: std::convert::Into<wkt::Timestamp>,
150    {
151        self.update_time = v.map(|x| x.into());
152        self
153    }
154
155    /// Sets the value of [labels][crate::model::Parameter::labels].
156    ///
157    /// # Example
158    /// ```ignore,no_run
159    /// # use google_cloud_parametermanager_v1::model::Parameter;
160    /// let x = Parameter::new().set_labels([
161    ///     ("key0", "abc"),
162    ///     ("key1", "xyz"),
163    /// ]);
164    /// ```
165    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
166    where
167        T: std::iter::IntoIterator<Item = (K, V)>,
168        K: std::convert::Into<std::string::String>,
169        V: std::convert::Into<std::string::String>,
170    {
171        use std::iter::Iterator;
172        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
173        self
174    }
175
176    /// Sets the value of [format][crate::model::Parameter::format].
177    ///
178    /// # Example
179    /// ```ignore,no_run
180    /// # use google_cloud_parametermanager_v1::model::Parameter;
181    /// use google_cloud_parametermanager_v1::model::ParameterFormat;
182    /// let x0 = Parameter::new().set_format(ParameterFormat::Unformatted);
183    /// let x1 = Parameter::new().set_format(ParameterFormat::Yaml);
184    /// let x2 = Parameter::new().set_format(ParameterFormat::Json);
185    /// ```
186    pub fn set_format<T: std::convert::Into<crate::model::ParameterFormat>>(
187        mut self,
188        v: T,
189    ) -> Self {
190        self.format = v.into();
191        self
192    }
193
194    /// Sets the value of [policy_member][crate::model::Parameter::policy_member].
195    ///
196    /// # Example
197    /// ```ignore,no_run
198    /// # use google_cloud_parametermanager_v1::model::Parameter;
199    /// use google_cloud_iam_v1::model::ResourcePolicyMember;
200    /// let x = Parameter::new().set_policy_member(ResourcePolicyMember::default()/* use setters */);
201    /// ```
202    pub fn set_policy_member<T>(mut self, v: T) -> Self
203    where
204        T: std::convert::Into<google_cloud_iam_v1::model::ResourcePolicyMember>,
205    {
206        self.policy_member = std::option::Option::Some(v.into());
207        self
208    }
209
210    /// Sets or clears the value of [policy_member][crate::model::Parameter::policy_member].
211    ///
212    /// # Example
213    /// ```ignore,no_run
214    /// # use google_cloud_parametermanager_v1::model::Parameter;
215    /// use google_cloud_iam_v1::model::ResourcePolicyMember;
216    /// let x = Parameter::new().set_or_clear_policy_member(Some(ResourcePolicyMember::default()/* use setters */));
217    /// let x = Parameter::new().set_or_clear_policy_member(None::<ResourcePolicyMember>);
218    /// ```
219    pub fn set_or_clear_policy_member<T>(mut self, v: std::option::Option<T>) -> Self
220    where
221        T: std::convert::Into<google_cloud_iam_v1::model::ResourcePolicyMember>,
222    {
223        self.policy_member = v.map(|x| x.into());
224        self
225    }
226
227    /// Sets the value of [kms_key][crate::model::Parameter::kms_key].
228    ///
229    /// # Example
230    /// ```ignore,no_run
231    /// # use google_cloud_parametermanager_v1::model::Parameter;
232    /// let x = Parameter::new().set_kms_key("example");
233    /// ```
234    pub fn set_kms_key<T>(mut self, v: T) -> Self
235    where
236        T: std::convert::Into<std::string::String>,
237    {
238        self.kms_key = std::option::Option::Some(v.into());
239        self
240    }
241
242    /// Sets or clears the value of [kms_key][crate::model::Parameter::kms_key].
243    ///
244    /// # Example
245    /// ```ignore,no_run
246    /// # use google_cloud_parametermanager_v1::model::Parameter;
247    /// let x = Parameter::new().set_or_clear_kms_key(Some("example"));
248    /// let x = Parameter::new().set_or_clear_kms_key(None::<String>);
249    /// ```
250    pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
251    where
252        T: std::convert::Into<std::string::String>,
253    {
254        self.kms_key = v.map(|x| x.into());
255        self
256    }
257}
258
259impl wkt::message::Message for Parameter {
260    fn typename() -> &'static str {
261        "type.googleapis.com/google.cloud.parametermanager.v1.Parameter"
262    }
263}
264
265/// Message for requesting list of Parameters
266#[derive(Clone, Default, PartialEq)]
267#[non_exhaustive]
268pub struct ListParametersRequest {
269    /// Required. Parent value for ListParametersRequest in the format
270    /// `projects/*/locations/*`.
271    pub parent: std::string::String,
272
273    /// Optional. Requested page size. Server may return fewer items than
274    /// requested. If unspecified, server will pick an appropriate default.
275    pub page_size: i32,
276
277    /// Optional. A token identifying a page of results the server should return.
278    pub page_token: std::string::String,
279
280    /// Optional. Filtering results
281    pub filter: std::string::String,
282
283    /// Optional. Hint for how to order the results
284    pub order_by: std::string::String,
285
286    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
287}
288
289impl ListParametersRequest {
290    /// Creates a new default instance.
291    pub fn new() -> Self {
292        std::default::Default::default()
293    }
294
295    /// Sets the value of [parent][crate::model::ListParametersRequest::parent].
296    ///
297    /// # Example
298    /// ```ignore,no_run
299    /// # use google_cloud_parametermanager_v1::model::ListParametersRequest;
300    /// let x = ListParametersRequest::new().set_parent("example");
301    /// ```
302    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
303        self.parent = v.into();
304        self
305    }
306
307    /// Sets the value of [page_size][crate::model::ListParametersRequest::page_size].
308    ///
309    /// # Example
310    /// ```ignore,no_run
311    /// # use google_cloud_parametermanager_v1::model::ListParametersRequest;
312    /// let x = ListParametersRequest::new().set_page_size(42);
313    /// ```
314    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
315        self.page_size = v.into();
316        self
317    }
318
319    /// Sets the value of [page_token][crate::model::ListParametersRequest::page_token].
320    ///
321    /// # Example
322    /// ```ignore,no_run
323    /// # use google_cloud_parametermanager_v1::model::ListParametersRequest;
324    /// let x = ListParametersRequest::new().set_page_token("example");
325    /// ```
326    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
327        self.page_token = v.into();
328        self
329    }
330
331    /// Sets the value of [filter][crate::model::ListParametersRequest::filter].
332    ///
333    /// # Example
334    /// ```ignore,no_run
335    /// # use google_cloud_parametermanager_v1::model::ListParametersRequest;
336    /// let x = ListParametersRequest::new().set_filter("example");
337    /// ```
338    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
339        self.filter = v.into();
340        self
341    }
342
343    /// Sets the value of [order_by][crate::model::ListParametersRequest::order_by].
344    ///
345    /// # Example
346    /// ```ignore,no_run
347    /// # use google_cloud_parametermanager_v1::model::ListParametersRequest;
348    /// let x = ListParametersRequest::new().set_order_by("example");
349    /// ```
350    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
351        self.order_by = v.into();
352        self
353    }
354}
355
356impl wkt::message::Message for ListParametersRequest {
357    fn typename() -> &'static str {
358        "type.googleapis.com/google.cloud.parametermanager.v1.ListParametersRequest"
359    }
360}
361
362/// Message for response to listing Parameters
363#[derive(Clone, Default, PartialEq)]
364#[non_exhaustive]
365pub struct ListParametersResponse {
366    /// The list of Parameters
367    pub parameters: std::vec::Vec<crate::model::Parameter>,
368
369    /// A token identifying a page of results the server should return.
370    pub next_page_token: std::string::String,
371
372    /// Unordered list. Locations that could not be reached.
373    pub unreachable: std::vec::Vec<std::string::String>,
374
375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
376}
377
378impl ListParametersResponse {
379    /// Creates a new default instance.
380    pub fn new() -> Self {
381        std::default::Default::default()
382    }
383
384    /// Sets the value of [parameters][crate::model::ListParametersResponse::parameters].
385    ///
386    /// # Example
387    /// ```ignore,no_run
388    /// # use google_cloud_parametermanager_v1::model::ListParametersResponse;
389    /// use google_cloud_parametermanager_v1::model::Parameter;
390    /// let x = ListParametersResponse::new()
391    ///     .set_parameters([
392    ///         Parameter::default()/* use setters */,
393    ///         Parameter::default()/* use (different) setters */,
394    ///     ]);
395    /// ```
396    pub fn set_parameters<T, V>(mut self, v: T) -> Self
397    where
398        T: std::iter::IntoIterator<Item = V>,
399        V: std::convert::Into<crate::model::Parameter>,
400    {
401        use std::iter::Iterator;
402        self.parameters = v.into_iter().map(|i| i.into()).collect();
403        self
404    }
405
406    /// Sets the value of [next_page_token][crate::model::ListParametersResponse::next_page_token].
407    ///
408    /// # Example
409    /// ```ignore,no_run
410    /// # use google_cloud_parametermanager_v1::model::ListParametersResponse;
411    /// let x = ListParametersResponse::new().set_next_page_token("example");
412    /// ```
413    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
414        self.next_page_token = v.into();
415        self
416    }
417
418    /// Sets the value of [unreachable][crate::model::ListParametersResponse::unreachable].
419    ///
420    /// # Example
421    /// ```ignore,no_run
422    /// # use google_cloud_parametermanager_v1::model::ListParametersResponse;
423    /// let x = ListParametersResponse::new().set_unreachable(["a", "b", "c"]);
424    /// ```
425    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
426    where
427        T: std::iter::IntoIterator<Item = V>,
428        V: std::convert::Into<std::string::String>,
429    {
430        use std::iter::Iterator;
431        self.unreachable = v.into_iter().map(|i| i.into()).collect();
432        self
433    }
434}
435
436impl wkt::message::Message for ListParametersResponse {
437    fn typename() -> &'static str {
438        "type.googleapis.com/google.cloud.parametermanager.v1.ListParametersResponse"
439    }
440}
441
442#[doc(hidden)]
443impl google_cloud_gax::paginator::internal::PageableResponse for ListParametersResponse {
444    type PageItem = crate::model::Parameter;
445
446    fn items(self) -> std::vec::Vec<Self::PageItem> {
447        self.parameters
448    }
449
450    fn next_page_token(&self) -> std::string::String {
451        use std::clone::Clone;
452        self.next_page_token.clone()
453    }
454}
455
456/// Message for getting a Parameter
457#[derive(Clone, Default, PartialEq)]
458#[non_exhaustive]
459pub struct GetParameterRequest {
460    /// Required. Name of the resource in the format
461    /// `projects/*/locations/*/parameters/*`.
462    pub name: std::string::String,
463
464    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
465}
466
467impl GetParameterRequest {
468    /// Creates a new default instance.
469    pub fn new() -> Self {
470        std::default::Default::default()
471    }
472
473    /// Sets the value of [name][crate::model::GetParameterRequest::name].
474    ///
475    /// # Example
476    /// ```ignore,no_run
477    /// # use google_cloud_parametermanager_v1::model::GetParameterRequest;
478    /// let x = GetParameterRequest::new().set_name("example");
479    /// ```
480    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
481        self.name = v.into();
482        self
483    }
484}
485
486impl wkt::message::Message for GetParameterRequest {
487    fn typename() -> &'static str {
488        "type.googleapis.com/google.cloud.parametermanager.v1.GetParameterRequest"
489    }
490}
491
492/// Message for creating a Parameter
493#[derive(Clone, Default, PartialEq)]
494#[non_exhaustive]
495pub struct CreateParameterRequest {
496    /// Required. Value for parent in the format
497    /// `projects/*/locations/*`.
498    pub parent: std::string::String,
499
500    /// Required. Id of the Parameter resource
501    pub parameter_id: std::string::String,
502
503    /// Required. The Parameter resource being created
504    pub parameter: std::option::Option<crate::model::Parameter>,
505
506    /// Optional. An optional request ID to identify requests. Specify a unique
507    /// request ID so that if you must retry your request, the server will know to
508    /// ignore the request if it has already been completed. The server will
509    /// guarantee that for at least 60 minutes since the first request.
510    ///
511    /// For example, consider a situation where you make an initial request and the
512    /// request times out. If you make the request again with the same request
513    /// ID, the server can check if original operation with the same request ID
514    /// was received, and if so, will ignore the second request. This prevents
515    /// clients from accidentally creating duplicate commitments.
516    ///
517    /// The request ID must be a valid UUID with the exception that zero UUID is
518    /// not supported (00000000-0000-0000-0000-000000000000).
519    pub request_id: std::string::String,
520
521    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
522}
523
524impl CreateParameterRequest {
525    /// Creates a new default instance.
526    pub fn new() -> Self {
527        std::default::Default::default()
528    }
529
530    /// Sets the value of [parent][crate::model::CreateParameterRequest::parent].
531    ///
532    /// # Example
533    /// ```ignore,no_run
534    /// # use google_cloud_parametermanager_v1::model::CreateParameterRequest;
535    /// let x = CreateParameterRequest::new().set_parent("example");
536    /// ```
537    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
538        self.parent = v.into();
539        self
540    }
541
542    /// Sets the value of [parameter_id][crate::model::CreateParameterRequest::parameter_id].
543    ///
544    /// # Example
545    /// ```ignore,no_run
546    /// # use google_cloud_parametermanager_v1::model::CreateParameterRequest;
547    /// let x = CreateParameterRequest::new().set_parameter_id("example");
548    /// ```
549    pub fn set_parameter_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
550        self.parameter_id = v.into();
551        self
552    }
553
554    /// Sets the value of [parameter][crate::model::CreateParameterRequest::parameter].
555    ///
556    /// # Example
557    /// ```ignore,no_run
558    /// # use google_cloud_parametermanager_v1::model::CreateParameterRequest;
559    /// use google_cloud_parametermanager_v1::model::Parameter;
560    /// let x = CreateParameterRequest::new().set_parameter(Parameter::default()/* use setters */);
561    /// ```
562    pub fn set_parameter<T>(mut self, v: T) -> Self
563    where
564        T: std::convert::Into<crate::model::Parameter>,
565    {
566        self.parameter = std::option::Option::Some(v.into());
567        self
568    }
569
570    /// Sets or clears the value of [parameter][crate::model::CreateParameterRequest::parameter].
571    ///
572    /// # Example
573    /// ```ignore,no_run
574    /// # use google_cloud_parametermanager_v1::model::CreateParameterRequest;
575    /// use google_cloud_parametermanager_v1::model::Parameter;
576    /// let x = CreateParameterRequest::new().set_or_clear_parameter(Some(Parameter::default()/* use setters */));
577    /// let x = CreateParameterRequest::new().set_or_clear_parameter(None::<Parameter>);
578    /// ```
579    pub fn set_or_clear_parameter<T>(mut self, v: std::option::Option<T>) -> Self
580    where
581        T: std::convert::Into<crate::model::Parameter>,
582    {
583        self.parameter = v.map(|x| x.into());
584        self
585    }
586
587    /// Sets the value of [request_id][crate::model::CreateParameterRequest::request_id].
588    ///
589    /// # Example
590    /// ```ignore,no_run
591    /// # use google_cloud_parametermanager_v1::model::CreateParameterRequest;
592    /// let x = CreateParameterRequest::new().set_request_id("example");
593    /// ```
594    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
595        self.request_id = v.into();
596        self
597    }
598}
599
600impl wkt::message::Message for CreateParameterRequest {
601    fn typename() -> &'static str {
602        "type.googleapis.com/google.cloud.parametermanager.v1.CreateParameterRequest"
603    }
604}
605
606/// Message for updating a Parameter
607#[derive(Clone, Default, PartialEq)]
608#[non_exhaustive]
609pub struct UpdateParameterRequest {
610    /// Optional. Field mask is used to specify the fields to be overwritten in the
611    /// Parameter resource by the update.
612    /// The fields specified in the update_mask are relative to the resource, not
613    /// the full request. A mutable field will be overwritten if it is in the
614    /// mask. If the user does not provide a mask then all mutable fields present
615    /// in the request will be overwritten.
616    pub update_mask: std::option::Option<wkt::FieldMask>,
617
618    /// Required. The Parameter resource being updated
619    pub parameter: std::option::Option<crate::model::Parameter>,
620
621    /// Optional. An optional request ID to identify requests. Specify a unique
622    /// request ID so that if you must retry your request, the server will know to
623    /// ignore the request if it has already been completed. The server will
624    /// guarantee that for at least 60 minutes since the first request.
625    ///
626    /// For example, consider a situation where you make an initial request and the
627    /// request times out. If you make the request again with the same request
628    /// ID, the server can check if original operation with the same request ID
629    /// was received, and if so, will ignore the second request. This prevents
630    /// clients from accidentally creating duplicate commitments.
631    ///
632    /// The request ID must be a valid UUID with the exception that zero UUID is
633    /// not supported (00000000-0000-0000-0000-000000000000).
634    pub request_id: std::string::String,
635
636    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
637}
638
639impl UpdateParameterRequest {
640    /// Creates a new default instance.
641    pub fn new() -> Self {
642        std::default::Default::default()
643    }
644
645    /// Sets the value of [update_mask][crate::model::UpdateParameterRequest::update_mask].
646    ///
647    /// # Example
648    /// ```ignore,no_run
649    /// # use google_cloud_parametermanager_v1::model::UpdateParameterRequest;
650    /// use wkt::FieldMask;
651    /// let x = UpdateParameterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
652    /// ```
653    pub fn set_update_mask<T>(mut self, v: T) -> Self
654    where
655        T: std::convert::Into<wkt::FieldMask>,
656    {
657        self.update_mask = std::option::Option::Some(v.into());
658        self
659    }
660
661    /// Sets or clears the value of [update_mask][crate::model::UpdateParameterRequest::update_mask].
662    ///
663    /// # Example
664    /// ```ignore,no_run
665    /// # use google_cloud_parametermanager_v1::model::UpdateParameterRequest;
666    /// use wkt::FieldMask;
667    /// let x = UpdateParameterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
668    /// let x = UpdateParameterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
669    /// ```
670    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
671    where
672        T: std::convert::Into<wkt::FieldMask>,
673    {
674        self.update_mask = v.map(|x| x.into());
675        self
676    }
677
678    /// Sets the value of [parameter][crate::model::UpdateParameterRequest::parameter].
679    ///
680    /// # Example
681    /// ```ignore,no_run
682    /// # use google_cloud_parametermanager_v1::model::UpdateParameterRequest;
683    /// use google_cloud_parametermanager_v1::model::Parameter;
684    /// let x = UpdateParameterRequest::new().set_parameter(Parameter::default()/* use setters */);
685    /// ```
686    pub fn set_parameter<T>(mut self, v: T) -> Self
687    where
688        T: std::convert::Into<crate::model::Parameter>,
689    {
690        self.parameter = std::option::Option::Some(v.into());
691        self
692    }
693
694    /// Sets or clears the value of [parameter][crate::model::UpdateParameterRequest::parameter].
695    ///
696    /// # Example
697    /// ```ignore,no_run
698    /// # use google_cloud_parametermanager_v1::model::UpdateParameterRequest;
699    /// use google_cloud_parametermanager_v1::model::Parameter;
700    /// let x = UpdateParameterRequest::new().set_or_clear_parameter(Some(Parameter::default()/* use setters */));
701    /// let x = UpdateParameterRequest::new().set_or_clear_parameter(None::<Parameter>);
702    /// ```
703    pub fn set_or_clear_parameter<T>(mut self, v: std::option::Option<T>) -> Self
704    where
705        T: std::convert::Into<crate::model::Parameter>,
706    {
707        self.parameter = v.map(|x| x.into());
708        self
709    }
710
711    /// Sets the value of [request_id][crate::model::UpdateParameterRequest::request_id].
712    ///
713    /// # Example
714    /// ```ignore,no_run
715    /// # use google_cloud_parametermanager_v1::model::UpdateParameterRequest;
716    /// let x = UpdateParameterRequest::new().set_request_id("example");
717    /// ```
718    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
719        self.request_id = v.into();
720        self
721    }
722}
723
724impl wkt::message::Message for UpdateParameterRequest {
725    fn typename() -> &'static str {
726        "type.googleapis.com/google.cloud.parametermanager.v1.UpdateParameterRequest"
727    }
728}
729
730/// Message for deleting a Parameter
731#[derive(Clone, Default, PartialEq)]
732#[non_exhaustive]
733pub struct DeleteParameterRequest {
734    /// Required. Name of the resource in the format
735    /// `projects/*/locations/*/parameters/*`.
736    pub name: std::string::String,
737
738    /// Optional. An optional request ID to identify requests. Specify a unique
739    /// request ID so that if you must retry your request, the server will know to
740    /// ignore the request if it has already been completed. The server will
741    /// guarantee that for at least 60 minutes after the first request.
742    ///
743    /// For example, consider a situation where you make an initial request and the
744    /// request times out. If you make the request again with the same request
745    /// ID, the server can check if original operation with the same request ID
746    /// was received, and if so, will ignore the second request. This prevents
747    /// clients from accidentally creating duplicate commitments.
748    ///
749    /// The request ID must be a valid UUID with the exception that zero UUID is
750    /// not supported (00000000-0000-0000-0000-000000000000).
751    pub request_id: std::string::String,
752
753    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
754}
755
756impl DeleteParameterRequest {
757    /// Creates a new default instance.
758    pub fn new() -> Self {
759        std::default::Default::default()
760    }
761
762    /// Sets the value of [name][crate::model::DeleteParameterRequest::name].
763    ///
764    /// # Example
765    /// ```ignore,no_run
766    /// # use google_cloud_parametermanager_v1::model::DeleteParameterRequest;
767    /// let x = DeleteParameterRequest::new().set_name("example");
768    /// ```
769    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
770        self.name = v.into();
771        self
772    }
773
774    /// Sets the value of [request_id][crate::model::DeleteParameterRequest::request_id].
775    ///
776    /// # Example
777    /// ```ignore,no_run
778    /// # use google_cloud_parametermanager_v1::model::DeleteParameterRequest;
779    /// let x = DeleteParameterRequest::new().set_request_id("example");
780    /// ```
781    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
782        self.request_id = v.into();
783        self
784    }
785}
786
787impl wkt::message::Message for DeleteParameterRequest {
788    fn typename() -> &'static str {
789        "type.googleapis.com/google.cloud.parametermanager.v1.DeleteParameterRequest"
790    }
791}
792
793/// Message describing ParameterVersion resource
794#[derive(Clone, Default, PartialEq)]
795#[non_exhaustive]
796pub struct ParameterVersion {
797    /// Identifier. [Output only] The resource name of the ParameterVersion in the
798    /// format `projects/*/locations/*/parameters/*/versions/*`.
799    pub name: std::string::String,
800
801    /// Output only. [Output only] Create time stamp
802    pub create_time: std::option::Option<wkt::Timestamp>,
803
804    /// Output only. [Output only] Update time stamp
805    pub update_time: std::option::Option<wkt::Timestamp>,
806
807    /// Optional. Disabled boolean to determine if a ParameterVersion acts as a
808    /// metadata only resource (payload is never returned if disabled is true). If
809    /// true any calls will always default to BASIC view even if the user
810    /// explicitly passes FULL view as part of the request. A render call on a
811    /// disabled resource fails with an error. Default value is False.
812    pub disabled: bool,
813
814    /// Required. Immutable. Payload content of a ParameterVersion resource.  This
815    /// is only returned when the request provides the View value of FULL (default
816    /// for GET request).
817    pub payload: std::option::Option<crate::model::ParameterVersionPayload>,
818
819    /// Optional. Output only. [Output only] The resource name of the KMS key
820    /// version used to encrypt the ParameterVersion payload. This field is
821    /// populated only if the Parameter resource has customer managed encryption
822    /// key (CMEK) configured.
823    pub kms_key_version: std::option::Option<std::string::String>,
824
825    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
826}
827
828impl ParameterVersion {
829    /// Creates a new default instance.
830    pub fn new() -> Self {
831        std::default::Default::default()
832    }
833
834    /// Sets the value of [name][crate::model::ParameterVersion::name].
835    ///
836    /// # Example
837    /// ```ignore,no_run
838    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
839    /// let x = ParameterVersion::new().set_name("example");
840    /// ```
841    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
842        self.name = v.into();
843        self
844    }
845
846    /// Sets the value of [create_time][crate::model::ParameterVersion::create_time].
847    ///
848    /// # Example
849    /// ```ignore,no_run
850    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
851    /// use wkt::Timestamp;
852    /// let x = ParameterVersion::new().set_create_time(Timestamp::default()/* use setters */);
853    /// ```
854    pub fn set_create_time<T>(mut self, v: T) -> Self
855    where
856        T: std::convert::Into<wkt::Timestamp>,
857    {
858        self.create_time = std::option::Option::Some(v.into());
859        self
860    }
861
862    /// Sets or clears the value of [create_time][crate::model::ParameterVersion::create_time].
863    ///
864    /// # Example
865    /// ```ignore,no_run
866    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
867    /// use wkt::Timestamp;
868    /// let x = ParameterVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
869    /// let x = ParameterVersion::new().set_or_clear_create_time(None::<Timestamp>);
870    /// ```
871    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
872    where
873        T: std::convert::Into<wkt::Timestamp>,
874    {
875        self.create_time = v.map(|x| x.into());
876        self
877    }
878
879    /// Sets the value of [update_time][crate::model::ParameterVersion::update_time].
880    ///
881    /// # Example
882    /// ```ignore,no_run
883    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
884    /// use wkt::Timestamp;
885    /// let x = ParameterVersion::new().set_update_time(Timestamp::default()/* use setters */);
886    /// ```
887    pub fn set_update_time<T>(mut self, v: T) -> Self
888    where
889        T: std::convert::Into<wkt::Timestamp>,
890    {
891        self.update_time = std::option::Option::Some(v.into());
892        self
893    }
894
895    /// Sets or clears the value of [update_time][crate::model::ParameterVersion::update_time].
896    ///
897    /// # Example
898    /// ```ignore,no_run
899    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
900    /// use wkt::Timestamp;
901    /// let x = ParameterVersion::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
902    /// let x = ParameterVersion::new().set_or_clear_update_time(None::<Timestamp>);
903    /// ```
904    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
905    where
906        T: std::convert::Into<wkt::Timestamp>,
907    {
908        self.update_time = v.map(|x| x.into());
909        self
910    }
911
912    /// Sets the value of [disabled][crate::model::ParameterVersion::disabled].
913    ///
914    /// # Example
915    /// ```ignore,no_run
916    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
917    /// let x = ParameterVersion::new().set_disabled(true);
918    /// ```
919    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
920        self.disabled = v.into();
921        self
922    }
923
924    /// Sets the value of [payload][crate::model::ParameterVersion::payload].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
929    /// use google_cloud_parametermanager_v1::model::ParameterVersionPayload;
930    /// let x = ParameterVersion::new().set_payload(ParameterVersionPayload::default()/* use setters */);
931    /// ```
932    pub fn set_payload<T>(mut self, v: T) -> Self
933    where
934        T: std::convert::Into<crate::model::ParameterVersionPayload>,
935    {
936        self.payload = std::option::Option::Some(v.into());
937        self
938    }
939
940    /// Sets or clears the value of [payload][crate::model::ParameterVersion::payload].
941    ///
942    /// # Example
943    /// ```ignore,no_run
944    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
945    /// use google_cloud_parametermanager_v1::model::ParameterVersionPayload;
946    /// let x = ParameterVersion::new().set_or_clear_payload(Some(ParameterVersionPayload::default()/* use setters */));
947    /// let x = ParameterVersion::new().set_or_clear_payload(None::<ParameterVersionPayload>);
948    /// ```
949    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
950    where
951        T: std::convert::Into<crate::model::ParameterVersionPayload>,
952    {
953        self.payload = v.map(|x| x.into());
954        self
955    }
956
957    /// Sets the value of [kms_key_version][crate::model::ParameterVersion::kms_key_version].
958    ///
959    /// # Example
960    /// ```ignore,no_run
961    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
962    /// let x = ParameterVersion::new().set_kms_key_version("example");
963    /// ```
964    pub fn set_kms_key_version<T>(mut self, v: T) -> Self
965    where
966        T: std::convert::Into<std::string::String>,
967    {
968        self.kms_key_version = std::option::Option::Some(v.into());
969        self
970    }
971
972    /// Sets or clears the value of [kms_key_version][crate::model::ParameterVersion::kms_key_version].
973    ///
974    /// # Example
975    /// ```ignore,no_run
976    /// # use google_cloud_parametermanager_v1::model::ParameterVersion;
977    /// let x = ParameterVersion::new().set_or_clear_kms_key_version(Some("example"));
978    /// let x = ParameterVersion::new().set_or_clear_kms_key_version(None::<String>);
979    /// ```
980    pub fn set_or_clear_kms_key_version<T>(mut self, v: std::option::Option<T>) -> Self
981    where
982        T: std::convert::Into<std::string::String>,
983    {
984        self.kms_key_version = v.map(|x| x.into());
985        self
986    }
987}
988
989impl wkt::message::Message for ParameterVersion {
990    fn typename() -> &'static str {
991        "type.googleapis.com/google.cloud.parametermanager.v1.ParameterVersion"
992    }
993}
994
995/// Message for storing a ParameterVersion resource's payload data
996#[derive(Clone, Default, PartialEq)]
997#[non_exhaustive]
998pub struct ParameterVersionPayload {
999    /// Required. bytes data for storing payload.
1000    pub data: ::bytes::Bytes,
1001
1002    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1003}
1004
1005impl ParameterVersionPayload {
1006    /// Creates a new default instance.
1007    pub fn new() -> Self {
1008        std::default::Default::default()
1009    }
1010
1011    /// Sets the value of [data][crate::model::ParameterVersionPayload::data].
1012    ///
1013    /// # Example
1014    /// ```ignore,no_run
1015    /// # use google_cloud_parametermanager_v1::model::ParameterVersionPayload;
1016    /// let x = ParameterVersionPayload::new().set_data(bytes::Bytes::from_static(b"example"));
1017    /// ```
1018    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1019        self.data = v.into();
1020        self
1021    }
1022}
1023
1024impl wkt::message::Message for ParameterVersionPayload {
1025    fn typename() -> &'static str {
1026        "type.googleapis.com/google.cloud.parametermanager.v1.ParameterVersionPayload"
1027    }
1028}
1029
1030/// Message for requesting list of ParameterVersions
1031#[derive(Clone, Default, PartialEq)]
1032#[non_exhaustive]
1033pub struct ListParameterVersionsRequest {
1034    /// Required. Parent value for ListParameterVersionsRequest in the format
1035    /// `projects/*/locations/*/parameters/*`.
1036    pub parent: std::string::String,
1037
1038    /// Optional. Requested page size. Server may return fewer items than
1039    /// requested. If unspecified, server will pick an appropriate default.
1040    pub page_size: i32,
1041
1042    /// Optional. A token identifying a page of results the server should return.
1043    pub page_token: std::string::String,
1044
1045    /// Optional. Filtering results
1046    pub filter: std::string::String,
1047
1048    /// Optional. Hint for how to order the results
1049    pub order_by: std::string::String,
1050
1051    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1052}
1053
1054impl ListParameterVersionsRequest {
1055    /// Creates a new default instance.
1056    pub fn new() -> Self {
1057        std::default::Default::default()
1058    }
1059
1060    /// Sets the value of [parent][crate::model::ListParameterVersionsRequest::parent].
1061    ///
1062    /// # Example
1063    /// ```ignore,no_run
1064    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsRequest;
1065    /// let x = ListParameterVersionsRequest::new().set_parent("example");
1066    /// ```
1067    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1068        self.parent = v.into();
1069        self
1070    }
1071
1072    /// Sets the value of [page_size][crate::model::ListParameterVersionsRequest::page_size].
1073    ///
1074    /// # Example
1075    /// ```ignore,no_run
1076    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsRequest;
1077    /// let x = ListParameterVersionsRequest::new().set_page_size(42);
1078    /// ```
1079    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1080        self.page_size = v.into();
1081        self
1082    }
1083
1084    /// Sets the value of [page_token][crate::model::ListParameterVersionsRequest::page_token].
1085    ///
1086    /// # Example
1087    /// ```ignore,no_run
1088    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsRequest;
1089    /// let x = ListParameterVersionsRequest::new().set_page_token("example");
1090    /// ```
1091    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1092        self.page_token = v.into();
1093        self
1094    }
1095
1096    /// Sets the value of [filter][crate::model::ListParameterVersionsRequest::filter].
1097    ///
1098    /// # Example
1099    /// ```ignore,no_run
1100    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsRequest;
1101    /// let x = ListParameterVersionsRequest::new().set_filter("example");
1102    /// ```
1103    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1104        self.filter = v.into();
1105        self
1106    }
1107
1108    /// Sets the value of [order_by][crate::model::ListParameterVersionsRequest::order_by].
1109    ///
1110    /// # Example
1111    /// ```ignore,no_run
1112    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsRequest;
1113    /// let x = ListParameterVersionsRequest::new().set_order_by("example");
1114    /// ```
1115    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1116        self.order_by = v.into();
1117        self
1118    }
1119}
1120
1121impl wkt::message::Message for ListParameterVersionsRequest {
1122    fn typename() -> &'static str {
1123        "type.googleapis.com/google.cloud.parametermanager.v1.ListParameterVersionsRequest"
1124    }
1125}
1126
1127/// Message for response to listing ParameterVersions
1128#[derive(Clone, Default, PartialEq)]
1129#[non_exhaustive]
1130pub struct ListParameterVersionsResponse {
1131    /// The list of ParameterVersions
1132    pub parameter_versions: std::vec::Vec<crate::model::ParameterVersion>,
1133
1134    /// A token identifying a page of results the server should return.
1135    pub next_page_token: std::string::String,
1136
1137    /// Unordered list. Locations that could not be reached.
1138    pub unreachable: std::vec::Vec<std::string::String>,
1139
1140    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1141}
1142
1143impl ListParameterVersionsResponse {
1144    /// Creates a new default instance.
1145    pub fn new() -> Self {
1146        std::default::Default::default()
1147    }
1148
1149    /// Sets the value of [parameter_versions][crate::model::ListParameterVersionsResponse::parameter_versions].
1150    ///
1151    /// # Example
1152    /// ```ignore,no_run
1153    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsResponse;
1154    /// use google_cloud_parametermanager_v1::model::ParameterVersion;
1155    /// let x = ListParameterVersionsResponse::new()
1156    ///     .set_parameter_versions([
1157    ///         ParameterVersion::default()/* use setters */,
1158    ///         ParameterVersion::default()/* use (different) setters */,
1159    ///     ]);
1160    /// ```
1161    pub fn set_parameter_versions<T, V>(mut self, v: T) -> Self
1162    where
1163        T: std::iter::IntoIterator<Item = V>,
1164        V: std::convert::Into<crate::model::ParameterVersion>,
1165    {
1166        use std::iter::Iterator;
1167        self.parameter_versions = v.into_iter().map(|i| i.into()).collect();
1168        self
1169    }
1170
1171    /// Sets the value of [next_page_token][crate::model::ListParameterVersionsResponse::next_page_token].
1172    ///
1173    /// # Example
1174    /// ```ignore,no_run
1175    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsResponse;
1176    /// let x = ListParameterVersionsResponse::new().set_next_page_token("example");
1177    /// ```
1178    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1179        self.next_page_token = v.into();
1180        self
1181    }
1182
1183    /// Sets the value of [unreachable][crate::model::ListParameterVersionsResponse::unreachable].
1184    ///
1185    /// # Example
1186    /// ```ignore,no_run
1187    /// # use google_cloud_parametermanager_v1::model::ListParameterVersionsResponse;
1188    /// let x = ListParameterVersionsResponse::new().set_unreachable(["a", "b", "c"]);
1189    /// ```
1190    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1191    where
1192        T: std::iter::IntoIterator<Item = V>,
1193        V: std::convert::Into<std::string::String>,
1194    {
1195        use std::iter::Iterator;
1196        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1197        self
1198    }
1199}
1200
1201impl wkt::message::Message for ListParameterVersionsResponse {
1202    fn typename() -> &'static str {
1203        "type.googleapis.com/google.cloud.parametermanager.v1.ListParameterVersionsResponse"
1204    }
1205}
1206
1207#[doc(hidden)]
1208impl google_cloud_gax::paginator::internal::PageableResponse for ListParameterVersionsResponse {
1209    type PageItem = crate::model::ParameterVersion;
1210
1211    fn items(self) -> std::vec::Vec<Self::PageItem> {
1212        self.parameter_versions
1213    }
1214
1215    fn next_page_token(&self) -> std::string::String {
1216        use std::clone::Clone;
1217        self.next_page_token.clone()
1218    }
1219}
1220
1221/// Message for getting a ParameterVersion
1222#[derive(Clone, Default, PartialEq)]
1223#[non_exhaustive]
1224pub struct GetParameterVersionRequest {
1225    /// Required. Name of the resource in the format
1226    /// `projects/*/locations/*/parameters/*/versions/*`.
1227    pub name: std::string::String,
1228
1229    /// Optional. View of the ParameterVersion.
1230    /// In the default FULL view, all metadata & payload associated with the
1231    /// ParameterVersion will be returned.
1232    pub view: crate::model::View,
1233
1234    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1235}
1236
1237impl GetParameterVersionRequest {
1238    /// Creates a new default instance.
1239    pub fn new() -> Self {
1240        std::default::Default::default()
1241    }
1242
1243    /// Sets the value of [name][crate::model::GetParameterVersionRequest::name].
1244    ///
1245    /// # Example
1246    /// ```ignore,no_run
1247    /// # use google_cloud_parametermanager_v1::model::GetParameterVersionRequest;
1248    /// let x = GetParameterVersionRequest::new().set_name("example");
1249    /// ```
1250    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1251        self.name = v.into();
1252        self
1253    }
1254
1255    /// Sets the value of [view][crate::model::GetParameterVersionRequest::view].
1256    ///
1257    /// # Example
1258    /// ```ignore,no_run
1259    /// # use google_cloud_parametermanager_v1::model::GetParameterVersionRequest;
1260    /// use google_cloud_parametermanager_v1::model::View;
1261    /// let x0 = GetParameterVersionRequest::new().set_view(View::Basic);
1262    /// let x1 = GetParameterVersionRequest::new().set_view(View::Full);
1263    /// ```
1264    pub fn set_view<T: std::convert::Into<crate::model::View>>(mut self, v: T) -> Self {
1265        self.view = v.into();
1266        self
1267    }
1268}
1269
1270impl wkt::message::Message for GetParameterVersionRequest {
1271    fn typename() -> &'static str {
1272        "type.googleapis.com/google.cloud.parametermanager.v1.GetParameterVersionRequest"
1273    }
1274}
1275
1276/// Message for getting a ParameterVersionRender
1277#[derive(Clone, Default, PartialEq)]
1278#[non_exhaustive]
1279pub struct RenderParameterVersionRequest {
1280    /// Required. Name of the resource
1281    pub name: std::string::String,
1282
1283    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1284}
1285
1286impl RenderParameterVersionRequest {
1287    /// Creates a new default instance.
1288    pub fn new() -> Self {
1289        std::default::Default::default()
1290    }
1291
1292    /// Sets the value of [name][crate::model::RenderParameterVersionRequest::name].
1293    ///
1294    /// # Example
1295    /// ```ignore,no_run
1296    /// # use google_cloud_parametermanager_v1::model::RenderParameterVersionRequest;
1297    /// let x = RenderParameterVersionRequest::new().set_name("example");
1298    /// ```
1299    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1300        self.name = v.into();
1301        self
1302    }
1303}
1304
1305impl wkt::message::Message for RenderParameterVersionRequest {
1306    fn typename() -> &'static str {
1307        "type.googleapis.com/google.cloud.parametermanager.v1.RenderParameterVersionRequest"
1308    }
1309}
1310
1311/// Message describing RenderParameterVersionResponse resource
1312#[derive(Clone, Default, PartialEq)]
1313#[non_exhaustive]
1314pub struct RenderParameterVersionResponse {
1315    /// Output only. Resource identifier of a ParameterVersion in the format
1316    /// `projects/*/locations/*/parameters/*/versions/*`.
1317    pub parameter_version: std::string::String,
1318
1319    /// Payload content of a ParameterVersion resource.
1320    pub payload: std::option::Option<crate::model::ParameterVersionPayload>,
1321
1322    /// Output only. Server generated rendered version of the user provided payload
1323    /// data (ParameterVersionPayload) which has substitutions of all (if any)
1324    /// references to a SecretManager SecretVersion resources. This substitution
1325    /// only works for a Parameter which is in JSON or YAML format.
1326    pub rendered_payload: ::bytes::Bytes,
1327
1328    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1329}
1330
1331impl RenderParameterVersionResponse {
1332    /// Creates a new default instance.
1333    pub fn new() -> Self {
1334        std::default::Default::default()
1335    }
1336
1337    /// Sets the value of [parameter_version][crate::model::RenderParameterVersionResponse::parameter_version].
1338    ///
1339    /// # Example
1340    /// ```ignore,no_run
1341    /// # use google_cloud_parametermanager_v1::model::RenderParameterVersionResponse;
1342    /// let x = RenderParameterVersionResponse::new().set_parameter_version("example");
1343    /// ```
1344    pub fn set_parameter_version<T: std::convert::Into<std::string::String>>(
1345        mut self,
1346        v: T,
1347    ) -> Self {
1348        self.parameter_version = v.into();
1349        self
1350    }
1351
1352    /// Sets the value of [payload][crate::model::RenderParameterVersionResponse::payload].
1353    ///
1354    /// # Example
1355    /// ```ignore,no_run
1356    /// # use google_cloud_parametermanager_v1::model::RenderParameterVersionResponse;
1357    /// use google_cloud_parametermanager_v1::model::ParameterVersionPayload;
1358    /// let x = RenderParameterVersionResponse::new().set_payload(ParameterVersionPayload::default()/* use setters */);
1359    /// ```
1360    pub fn set_payload<T>(mut self, v: T) -> Self
1361    where
1362        T: std::convert::Into<crate::model::ParameterVersionPayload>,
1363    {
1364        self.payload = std::option::Option::Some(v.into());
1365        self
1366    }
1367
1368    /// Sets or clears the value of [payload][crate::model::RenderParameterVersionResponse::payload].
1369    ///
1370    /// # Example
1371    /// ```ignore,no_run
1372    /// # use google_cloud_parametermanager_v1::model::RenderParameterVersionResponse;
1373    /// use google_cloud_parametermanager_v1::model::ParameterVersionPayload;
1374    /// let x = RenderParameterVersionResponse::new().set_or_clear_payload(Some(ParameterVersionPayload::default()/* use setters */));
1375    /// let x = RenderParameterVersionResponse::new().set_or_clear_payload(None::<ParameterVersionPayload>);
1376    /// ```
1377    pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
1378    where
1379        T: std::convert::Into<crate::model::ParameterVersionPayload>,
1380    {
1381        self.payload = v.map(|x| x.into());
1382        self
1383    }
1384
1385    /// Sets the value of [rendered_payload][crate::model::RenderParameterVersionResponse::rendered_payload].
1386    ///
1387    /// # Example
1388    /// ```ignore,no_run
1389    /// # use google_cloud_parametermanager_v1::model::RenderParameterVersionResponse;
1390    /// let x = RenderParameterVersionResponse::new().set_rendered_payload(bytes::Bytes::from_static(b"example"));
1391    /// ```
1392    pub fn set_rendered_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1393        self.rendered_payload = v.into();
1394        self
1395    }
1396}
1397
1398impl wkt::message::Message for RenderParameterVersionResponse {
1399    fn typename() -> &'static str {
1400        "type.googleapis.com/google.cloud.parametermanager.v1.RenderParameterVersionResponse"
1401    }
1402}
1403
1404/// Message for creating a ParameterVersion
1405#[derive(Clone, Default, PartialEq)]
1406#[non_exhaustive]
1407pub struct CreateParameterVersionRequest {
1408    /// Required. Value for parent in the format
1409    /// `projects/*/locations/*/parameters/*`.
1410    pub parent: std::string::String,
1411
1412    /// Required. Id of the ParameterVersion resource
1413    pub parameter_version_id: std::string::String,
1414
1415    /// Required. The ParameterVersion resource being created
1416    pub parameter_version: std::option::Option<crate::model::ParameterVersion>,
1417
1418    /// Optional. An optional request ID to identify requests. Specify a unique
1419    /// request ID so that if you must retry your request, the server will know to
1420    /// ignore the request if it has already been completed. The server will
1421    /// guarantee that for at least 60 minutes since the first request.
1422    ///
1423    /// For example, consider a situation where you make an initial request and the
1424    /// request times out. If you make the request again with the same request
1425    /// ID, the server can check if original operation with the same request ID
1426    /// was received, and if so, will ignore the second request. This prevents
1427    /// clients from accidentally creating duplicate commitments.
1428    ///
1429    /// The request ID must be a valid UUID with the exception that zero UUID is
1430    /// not supported (00000000-0000-0000-0000-000000000000).
1431    pub request_id: std::string::String,
1432
1433    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1434}
1435
1436impl CreateParameterVersionRequest {
1437    /// Creates a new default instance.
1438    pub fn new() -> Self {
1439        std::default::Default::default()
1440    }
1441
1442    /// Sets the value of [parent][crate::model::CreateParameterVersionRequest::parent].
1443    ///
1444    /// # Example
1445    /// ```ignore,no_run
1446    /// # use google_cloud_parametermanager_v1::model::CreateParameterVersionRequest;
1447    /// let x = CreateParameterVersionRequest::new().set_parent("example");
1448    /// ```
1449    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1450        self.parent = v.into();
1451        self
1452    }
1453
1454    /// Sets the value of [parameter_version_id][crate::model::CreateParameterVersionRequest::parameter_version_id].
1455    ///
1456    /// # Example
1457    /// ```ignore,no_run
1458    /// # use google_cloud_parametermanager_v1::model::CreateParameterVersionRequest;
1459    /// let x = CreateParameterVersionRequest::new().set_parameter_version_id("example");
1460    /// ```
1461    pub fn set_parameter_version_id<T: std::convert::Into<std::string::String>>(
1462        mut self,
1463        v: T,
1464    ) -> Self {
1465        self.parameter_version_id = v.into();
1466        self
1467    }
1468
1469    /// Sets the value of [parameter_version][crate::model::CreateParameterVersionRequest::parameter_version].
1470    ///
1471    /// # Example
1472    /// ```ignore,no_run
1473    /// # use google_cloud_parametermanager_v1::model::CreateParameterVersionRequest;
1474    /// use google_cloud_parametermanager_v1::model::ParameterVersion;
1475    /// let x = CreateParameterVersionRequest::new().set_parameter_version(ParameterVersion::default()/* use setters */);
1476    /// ```
1477    pub fn set_parameter_version<T>(mut self, v: T) -> Self
1478    where
1479        T: std::convert::Into<crate::model::ParameterVersion>,
1480    {
1481        self.parameter_version = std::option::Option::Some(v.into());
1482        self
1483    }
1484
1485    /// Sets or clears the value of [parameter_version][crate::model::CreateParameterVersionRequest::parameter_version].
1486    ///
1487    /// # Example
1488    /// ```ignore,no_run
1489    /// # use google_cloud_parametermanager_v1::model::CreateParameterVersionRequest;
1490    /// use google_cloud_parametermanager_v1::model::ParameterVersion;
1491    /// let x = CreateParameterVersionRequest::new().set_or_clear_parameter_version(Some(ParameterVersion::default()/* use setters */));
1492    /// let x = CreateParameterVersionRequest::new().set_or_clear_parameter_version(None::<ParameterVersion>);
1493    /// ```
1494    pub fn set_or_clear_parameter_version<T>(mut self, v: std::option::Option<T>) -> Self
1495    where
1496        T: std::convert::Into<crate::model::ParameterVersion>,
1497    {
1498        self.parameter_version = v.map(|x| x.into());
1499        self
1500    }
1501
1502    /// Sets the value of [request_id][crate::model::CreateParameterVersionRequest::request_id].
1503    ///
1504    /// # Example
1505    /// ```ignore,no_run
1506    /// # use google_cloud_parametermanager_v1::model::CreateParameterVersionRequest;
1507    /// let x = CreateParameterVersionRequest::new().set_request_id("example");
1508    /// ```
1509    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1510        self.request_id = v.into();
1511        self
1512    }
1513}
1514
1515impl wkt::message::Message for CreateParameterVersionRequest {
1516    fn typename() -> &'static str {
1517        "type.googleapis.com/google.cloud.parametermanager.v1.CreateParameterVersionRequest"
1518    }
1519}
1520
1521/// Message for updating a ParameterVersion
1522#[derive(Clone, Default, PartialEq)]
1523#[non_exhaustive]
1524pub struct UpdateParameterVersionRequest {
1525    /// Optional. Field mask is used to specify the fields to be overwritten in the
1526    /// ParameterVersion resource by the update.
1527    /// The fields specified in the update_mask are relative to the resource, not
1528    /// the full request. A mutable field will be overwritten if it is in the
1529    /// mask. If the user does not provide a mask then all mutable fields present
1530    /// in the request will be overwritten.
1531    pub update_mask: std::option::Option<wkt::FieldMask>,
1532
1533    /// Required. The ParameterVersion resource being updated
1534    pub parameter_version: std::option::Option<crate::model::ParameterVersion>,
1535
1536    /// Optional. An optional request ID to identify requests. Specify a unique
1537    /// request ID so that if you must retry your request, the server will know to
1538    /// ignore the request if it has already been completed. The server will
1539    /// guarantee that for at least 60 minutes since the first request.
1540    ///
1541    /// For example, consider a situation where you make an initial request and the
1542    /// request times out. If you make the request again with the same request
1543    /// ID, the server can check if original operation with the same request ID
1544    /// was received, and if so, will ignore the second request. This prevents
1545    /// clients from accidentally creating duplicate commitments.
1546    ///
1547    /// The request ID must be a valid UUID with the exception that zero UUID is
1548    /// not supported (00000000-0000-0000-0000-000000000000).
1549    pub request_id: std::string::String,
1550
1551    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1552}
1553
1554impl UpdateParameterVersionRequest {
1555    /// Creates a new default instance.
1556    pub fn new() -> Self {
1557        std::default::Default::default()
1558    }
1559
1560    /// Sets the value of [update_mask][crate::model::UpdateParameterVersionRequest::update_mask].
1561    ///
1562    /// # Example
1563    /// ```ignore,no_run
1564    /// # use google_cloud_parametermanager_v1::model::UpdateParameterVersionRequest;
1565    /// use wkt::FieldMask;
1566    /// let x = UpdateParameterVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1567    /// ```
1568    pub fn set_update_mask<T>(mut self, v: T) -> Self
1569    where
1570        T: std::convert::Into<wkt::FieldMask>,
1571    {
1572        self.update_mask = std::option::Option::Some(v.into());
1573        self
1574    }
1575
1576    /// Sets or clears the value of [update_mask][crate::model::UpdateParameterVersionRequest::update_mask].
1577    ///
1578    /// # Example
1579    /// ```ignore,no_run
1580    /// # use google_cloud_parametermanager_v1::model::UpdateParameterVersionRequest;
1581    /// use wkt::FieldMask;
1582    /// let x = UpdateParameterVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1583    /// let x = UpdateParameterVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1584    /// ```
1585    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1586    where
1587        T: std::convert::Into<wkt::FieldMask>,
1588    {
1589        self.update_mask = v.map(|x| x.into());
1590        self
1591    }
1592
1593    /// Sets the value of [parameter_version][crate::model::UpdateParameterVersionRequest::parameter_version].
1594    ///
1595    /// # Example
1596    /// ```ignore,no_run
1597    /// # use google_cloud_parametermanager_v1::model::UpdateParameterVersionRequest;
1598    /// use google_cloud_parametermanager_v1::model::ParameterVersion;
1599    /// let x = UpdateParameterVersionRequest::new().set_parameter_version(ParameterVersion::default()/* use setters */);
1600    /// ```
1601    pub fn set_parameter_version<T>(mut self, v: T) -> Self
1602    where
1603        T: std::convert::Into<crate::model::ParameterVersion>,
1604    {
1605        self.parameter_version = std::option::Option::Some(v.into());
1606        self
1607    }
1608
1609    /// Sets or clears the value of [parameter_version][crate::model::UpdateParameterVersionRequest::parameter_version].
1610    ///
1611    /// # Example
1612    /// ```ignore,no_run
1613    /// # use google_cloud_parametermanager_v1::model::UpdateParameterVersionRequest;
1614    /// use google_cloud_parametermanager_v1::model::ParameterVersion;
1615    /// let x = UpdateParameterVersionRequest::new().set_or_clear_parameter_version(Some(ParameterVersion::default()/* use setters */));
1616    /// let x = UpdateParameterVersionRequest::new().set_or_clear_parameter_version(None::<ParameterVersion>);
1617    /// ```
1618    pub fn set_or_clear_parameter_version<T>(mut self, v: std::option::Option<T>) -> Self
1619    where
1620        T: std::convert::Into<crate::model::ParameterVersion>,
1621    {
1622        self.parameter_version = v.map(|x| x.into());
1623        self
1624    }
1625
1626    /// Sets the value of [request_id][crate::model::UpdateParameterVersionRequest::request_id].
1627    ///
1628    /// # Example
1629    /// ```ignore,no_run
1630    /// # use google_cloud_parametermanager_v1::model::UpdateParameterVersionRequest;
1631    /// let x = UpdateParameterVersionRequest::new().set_request_id("example");
1632    /// ```
1633    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1634        self.request_id = v.into();
1635        self
1636    }
1637}
1638
1639impl wkt::message::Message for UpdateParameterVersionRequest {
1640    fn typename() -> &'static str {
1641        "type.googleapis.com/google.cloud.parametermanager.v1.UpdateParameterVersionRequest"
1642    }
1643}
1644
1645/// Message for deleting a ParameterVersion
1646#[derive(Clone, Default, PartialEq)]
1647#[non_exhaustive]
1648pub struct DeleteParameterVersionRequest {
1649    /// Required. Name of the resource in the format
1650    /// `projects/*/locations/*/parameters/*/versions/*`.
1651    pub name: std::string::String,
1652
1653    /// Optional. An optional request ID to identify requests. Specify a unique
1654    /// request ID so that if you must retry your request, the server will know to
1655    /// ignore the request if it has already been completed. The server will
1656    /// guarantee that for at least 60 minutes after the first request.
1657    ///
1658    /// For example, consider a situation where you make an initial request and the
1659    /// request times out. If you make the request again with the same request
1660    /// ID, the server can check if original operation with the same request ID
1661    /// was received, and if so, will ignore the second request. This prevents
1662    /// clients from accidentally creating duplicate commitments.
1663    ///
1664    /// The request ID must be a valid UUID with the exception that zero UUID is
1665    /// not supported (00000000-0000-0000-0000-000000000000).
1666    pub request_id: std::string::String,
1667
1668    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1669}
1670
1671impl DeleteParameterVersionRequest {
1672    /// Creates a new default instance.
1673    pub fn new() -> Self {
1674        std::default::Default::default()
1675    }
1676
1677    /// Sets the value of [name][crate::model::DeleteParameterVersionRequest::name].
1678    ///
1679    /// # Example
1680    /// ```ignore,no_run
1681    /// # use google_cloud_parametermanager_v1::model::DeleteParameterVersionRequest;
1682    /// let x = DeleteParameterVersionRequest::new().set_name("example");
1683    /// ```
1684    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1685        self.name = v.into();
1686        self
1687    }
1688
1689    /// Sets the value of [request_id][crate::model::DeleteParameterVersionRequest::request_id].
1690    ///
1691    /// # Example
1692    /// ```ignore,no_run
1693    /// # use google_cloud_parametermanager_v1::model::DeleteParameterVersionRequest;
1694    /// let x = DeleteParameterVersionRequest::new().set_request_id("example");
1695    /// ```
1696    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1697        self.request_id = v.into();
1698        self
1699    }
1700}
1701
1702impl wkt::message::Message for DeleteParameterVersionRequest {
1703    fn typename() -> &'static str {
1704        "type.googleapis.com/google.cloud.parametermanager.v1.DeleteParameterVersionRequest"
1705    }
1706}
1707
1708/// Option to specify the format of a Parameter resource (UNFORMATTED / YAML /
1709/// JSON). This option is user specified at the time of creation of the resource
1710/// and is immutable.
1711///
1712/// # Working with unknown values
1713///
1714/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1715/// additional enum variants at any time. Adding new variants is not considered
1716/// a breaking change. Applications should write their code in anticipation of:
1717///
1718/// - New values appearing in future releases of the client library, **and**
1719/// - New values received dynamically, without application changes.
1720///
1721/// Please consult the [Working with enums] section in the user guide for some
1722/// guidelines.
1723///
1724/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1725#[derive(Clone, Debug, PartialEq)]
1726#[non_exhaustive]
1727pub enum ParameterFormat {
1728    /// The default / unset value.
1729    /// The API will default to the UNFORMATTED format.
1730    Unspecified,
1731    /// Unformatted.
1732    Unformatted,
1733    /// YAML format.
1734    Yaml,
1735    /// JSON format.
1736    Json,
1737    /// If set, the enum was initialized with an unknown value.
1738    ///
1739    /// Applications can examine the value using [ParameterFormat::value] or
1740    /// [ParameterFormat::name].
1741    UnknownValue(parameter_format::UnknownValue),
1742}
1743
1744#[doc(hidden)]
1745pub mod parameter_format {
1746    #[allow(unused_imports)]
1747    use super::*;
1748    #[derive(Clone, Debug, PartialEq)]
1749    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1750}
1751
1752impl ParameterFormat {
1753    /// Gets the enum value.
1754    ///
1755    /// Returns `None` if the enum contains an unknown value deserialized from
1756    /// the string representation of enums.
1757    pub fn value(&self) -> std::option::Option<i32> {
1758        match self {
1759            Self::Unspecified => std::option::Option::Some(0),
1760            Self::Unformatted => std::option::Option::Some(1),
1761            Self::Yaml => std::option::Option::Some(2),
1762            Self::Json => std::option::Option::Some(3),
1763            Self::UnknownValue(u) => u.0.value(),
1764        }
1765    }
1766
1767    /// Gets the enum value as a string.
1768    ///
1769    /// Returns `None` if the enum contains an unknown value deserialized from
1770    /// the integer representation of enums.
1771    pub fn name(&self) -> std::option::Option<&str> {
1772        match self {
1773            Self::Unspecified => std::option::Option::Some("PARAMETER_FORMAT_UNSPECIFIED"),
1774            Self::Unformatted => std::option::Option::Some("UNFORMATTED"),
1775            Self::Yaml => std::option::Option::Some("YAML"),
1776            Self::Json => std::option::Option::Some("JSON"),
1777            Self::UnknownValue(u) => u.0.name(),
1778        }
1779    }
1780}
1781
1782impl std::default::Default for ParameterFormat {
1783    fn default() -> Self {
1784        use std::convert::From;
1785        Self::from(0)
1786    }
1787}
1788
1789impl std::fmt::Display for ParameterFormat {
1790    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1791        wkt::internal::display_enum(f, self.name(), self.value())
1792    }
1793}
1794
1795impl std::convert::From<i32> for ParameterFormat {
1796    fn from(value: i32) -> Self {
1797        match value {
1798            0 => Self::Unspecified,
1799            1 => Self::Unformatted,
1800            2 => Self::Yaml,
1801            3 => Self::Json,
1802            _ => Self::UnknownValue(parameter_format::UnknownValue(
1803                wkt::internal::UnknownEnumValue::Integer(value),
1804            )),
1805        }
1806    }
1807}
1808
1809impl std::convert::From<&str> for ParameterFormat {
1810    fn from(value: &str) -> Self {
1811        use std::string::ToString;
1812        match value {
1813            "PARAMETER_FORMAT_UNSPECIFIED" => Self::Unspecified,
1814            "UNFORMATTED" => Self::Unformatted,
1815            "YAML" => Self::Yaml,
1816            "JSON" => Self::Json,
1817            _ => Self::UnknownValue(parameter_format::UnknownValue(
1818                wkt::internal::UnknownEnumValue::String(value.to_string()),
1819            )),
1820        }
1821    }
1822}
1823
1824impl serde::ser::Serialize for ParameterFormat {
1825    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1826    where
1827        S: serde::Serializer,
1828    {
1829        match self {
1830            Self::Unspecified => serializer.serialize_i32(0),
1831            Self::Unformatted => serializer.serialize_i32(1),
1832            Self::Yaml => serializer.serialize_i32(2),
1833            Self::Json => serializer.serialize_i32(3),
1834            Self::UnknownValue(u) => u.0.serialize(serializer),
1835        }
1836    }
1837}
1838
1839impl<'de> serde::de::Deserialize<'de> for ParameterFormat {
1840    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1841    where
1842        D: serde::Deserializer<'de>,
1843    {
1844        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ParameterFormat>::new(
1845            ".google.cloud.parametermanager.v1.ParameterFormat",
1846        ))
1847    }
1848}
1849
1850/// Option for requesting only metadata, or user provided payload
1851/// of a ParameterVersion resource.
1852///
1853/// # Working with unknown values
1854///
1855/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1856/// additional enum variants at any time. Adding new variants is not considered
1857/// a breaking change. Applications should write their code in anticipation of:
1858///
1859/// - New values appearing in future releases of the client library, **and**
1860/// - New values received dynamically, without application changes.
1861///
1862/// Please consult the [Working with enums] section in the user guide for some
1863/// guidelines.
1864///
1865/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1866#[derive(Clone, Debug, PartialEq)]
1867#[non_exhaustive]
1868pub enum View {
1869    /// The default / unset value.
1870    /// The API will default to the FULL view..
1871    Unspecified,
1872    /// Include only the metadata for the resource.
1873    Basic,
1874    /// Include metadata & other relevant payload data as well.
1875    /// This is the default view.
1876    Full,
1877    /// If set, the enum was initialized with an unknown value.
1878    ///
1879    /// Applications can examine the value using [View::value] or
1880    /// [View::name].
1881    UnknownValue(view::UnknownValue),
1882}
1883
1884#[doc(hidden)]
1885pub mod view {
1886    #[allow(unused_imports)]
1887    use super::*;
1888    #[derive(Clone, Debug, PartialEq)]
1889    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1890}
1891
1892impl View {
1893    /// Gets the enum value.
1894    ///
1895    /// Returns `None` if the enum contains an unknown value deserialized from
1896    /// the string representation of enums.
1897    pub fn value(&self) -> std::option::Option<i32> {
1898        match self {
1899            Self::Unspecified => std::option::Option::Some(0),
1900            Self::Basic => std::option::Option::Some(1),
1901            Self::Full => std::option::Option::Some(2),
1902            Self::UnknownValue(u) => u.0.value(),
1903        }
1904    }
1905
1906    /// Gets the enum value as a string.
1907    ///
1908    /// Returns `None` if the enum contains an unknown value deserialized from
1909    /// the integer representation of enums.
1910    pub fn name(&self) -> std::option::Option<&str> {
1911        match self {
1912            Self::Unspecified => std::option::Option::Some("VIEW_UNSPECIFIED"),
1913            Self::Basic => std::option::Option::Some("BASIC"),
1914            Self::Full => std::option::Option::Some("FULL"),
1915            Self::UnknownValue(u) => u.0.name(),
1916        }
1917    }
1918}
1919
1920impl std::default::Default for View {
1921    fn default() -> Self {
1922        use std::convert::From;
1923        Self::from(0)
1924    }
1925}
1926
1927impl std::fmt::Display for View {
1928    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1929        wkt::internal::display_enum(f, self.name(), self.value())
1930    }
1931}
1932
1933impl std::convert::From<i32> for View {
1934    fn from(value: i32) -> Self {
1935        match value {
1936            0 => Self::Unspecified,
1937            1 => Self::Basic,
1938            2 => Self::Full,
1939            _ => Self::UnknownValue(view::UnknownValue(
1940                wkt::internal::UnknownEnumValue::Integer(value),
1941            )),
1942        }
1943    }
1944}
1945
1946impl std::convert::From<&str> for View {
1947    fn from(value: &str) -> Self {
1948        use std::string::ToString;
1949        match value {
1950            "VIEW_UNSPECIFIED" => Self::Unspecified,
1951            "BASIC" => Self::Basic,
1952            "FULL" => Self::Full,
1953            _ => Self::UnknownValue(view::UnknownValue(wkt::internal::UnknownEnumValue::String(
1954                value.to_string(),
1955            ))),
1956        }
1957    }
1958}
1959
1960impl serde::ser::Serialize for View {
1961    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1962    where
1963        S: serde::Serializer,
1964    {
1965        match self {
1966            Self::Unspecified => serializer.serialize_i32(0),
1967            Self::Basic => serializer.serialize_i32(1),
1968            Self::Full => serializer.serialize_i32(2),
1969            Self::UnknownValue(u) => u.0.serialize(serializer),
1970        }
1971    }
1972}
1973
1974impl<'de> serde::de::Deserialize<'de> for View {
1975    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1976    where
1977        D: serde::Deserializer<'de>,
1978    {
1979        deserializer.deserialize_any(wkt::internal::EnumVisitor::<View>::new(
1980            ".google.cloud.parametermanager.v1.View",
1981        ))
1982    }
1983}