google_cloud_security_publicca_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 lazy_static;
25extern crate serde;
26extern crate serde_json;
27extern crate serde_with;
28extern crate std;
29extern crate tracing;
30extern crate wkt;
31
32mod debug;
33mod deserialize;
34mod serialize;
35
36/// A representation of an ExternalAccountKey used for [external account
37/// binding](https://tools.ietf.org/html/rfc8555#section-7.3.4) within ACME.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct ExternalAccountKey {
41 /// Output only. Resource name.
42 /// projects/{project}/locations/{location}/externalAccountKeys/{key_id}
43 pub name: std::string::String,
44
45 /// Output only. Key ID.
46 /// It is generated by the PublicCertificateAuthorityService
47 /// when the ExternalAccountKey is created
48 pub key_id: std::string::String,
49
50 /// Output only. Base64-URL-encoded HS256 key.
51 /// It is generated by the PublicCertificateAuthorityService
52 /// when the ExternalAccountKey is created
53 pub b64_mac_key: ::bytes::Bytes,
54
55 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl ExternalAccountKey {
59 pub fn new() -> Self {
60 std::default::Default::default()
61 }
62
63 /// Sets the value of [name][crate::model::ExternalAccountKey::name].
64 ///
65 /// # Example
66 /// ```ignore,no_run
67 /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
68 /// let x = ExternalAccountKey::new().set_name("example");
69 /// ```
70 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71 self.name = v.into();
72 self
73 }
74
75 /// Sets the value of [key_id][crate::model::ExternalAccountKey::key_id].
76 ///
77 /// # Example
78 /// ```ignore,no_run
79 /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
80 /// let x = ExternalAccountKey::new().set_key_id("example");
81 /// ```
82 pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83 self.key_id = v.into();
84 self
85 }
86
87 /// Sets the value of [b64_mac_key][crate::model::ExternalAccountKey::b64_mac_key].
88 ///
89 /// # Example
90 /// ```ignore,no_run
91 /// # use google_cloud_security_publicca_v1::model::ExternalAccountKey;
92 /// let x = ExternalAccountKey::new().set_b64_mac_key(bytes::Bytes::from_static(b"example"));
93 /// ```
94 pub fn set_b64_mac_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
95 self.b64_mac_key = v.into();
96 self
97 }
98}
99
100impl wkt::message::Message for ExternalAccountKey {
101 fn typename() -> &'static str {
102 "type.googleapis.com/google.cloud.security.publicca.v1.ExternalAccountKey"
103 }
104}
105
106/// Creates a new
107/// [ExternalAccountKey][google.cloud.security.publicca.v1.ExternalAccountKey] in
108/// a given project.
109///
110/// [google.cloud.security.publicca.v1.ExternalAccountKey]: crate::model::ExternalAccountKey
111#[derive(Clone, Default, PartialEq)]
112#[non_exhaustive]
113pub struct CreateExternalAccountKeyRequest {
114 /// Required. The parent resource where this external_account_key will be
115 /// created. Format: projects/[project_id]/locations/[location]. At present
116 /// only the "global" location is supported.
117 pub parent: std::string::String,
118
119 /// Required. The external account key to create. This field only exists to
120 /// future-proof the API. At present, all fields in ExternalAccountKey are
121 /// output only and all values are ignored. For the purpose of the
122 /// CreateExternalAccountKeyRequest, set it to a default/empty value.
123 pub external_account_key: std::option::Option<crate::model::ExternalAccountKey>,
124
125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
126}
127
128impl CreateExternalAccountKeyRequest {
129 pub fn new() -> Self {
130 std::default::Default::default()
131 }
132
133 /// Sets the value of [parent][crate::model::CreateExternalAccountKeyRequest::parent].
134 ///
135 /// # Example
136 /// ```ignore,no_run
137 /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
138 /// let x = CreateExternalAccountKeyRequest::new().set_parent("example");
139 /// ```
140 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
141 self.parent = v.into();
142 self
143 }
144
145 /// Sets the value of [external_account_key][crate::model::CreateExternalAccountKeyRequest::external_account_key].
146 ///
147 /// # Example
148 /// ```ignore,no_run
149 /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
150 /// use google_cloud_security_publicca_v1::model::ExternalAccountKey;
151 /// let x = CreateExternalAccountKeyRequest::new().set_external_account_key(ExternalAccountKey::default()/* use setters */);
152 /// ```
153 pub fn set_external_account_key<T>(mut self, v: T) -> Self
154 where
155 T: std::convert::Into<crate::model::ExternalAccountKey>,
156 {
157 self.external_account_key = std::option::Option::Some(v.into());
158 self
159 }
160
161 /// Sets or clears the value of [external_account_key][crate::model::CreateExternalAccountKeyRequest::external_account_key].
162 ///
163 /// # Example
164 /// ```ignore,no_run
165 /// # use google_cloud_security_publicca_v1::model::CreateExternalAccountKeyRequest;
166 /// use google_cloud_security_publicca_v1::model::ExternalAccountKey;
167 /// let x = CreateExternalAccountKeyRequest::new().set_or_clear_external_account_key(Some(ExternalAccountKey::default()/* use setters */));
168 /// let x = CreateExternalAccountKeyRequest::new().set_or_clear_external_account_key(None::<ExternalAccountKey>);
169 /// ```
170 pub fn set_or_clear_external_account_key<T>(mut self, v: std::option::Option<T>) -> Self
171 where
172 T: std::convert::Into<crate::model::ExternalAccountKey>,
173 {
174 self.external_account_key = v.map(|x| x.into());
175 self
176 }
177}
178
179impl wkt::message::Message for CreateExternalAccountKeyRequest {
180 fn typename() -> &'static str {
181 "type.googleapis.com/google.cloud.security.publicca.v1.CreateExternalAccountKeyRequest"
182 }
183}