google_cloud_api_servicecontrol_v2/
model.rs1#![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 gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate reqwest;
26extern crate rpc;
27extern crate rpc_context;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct CheckRequest {
43 pub service_name: std::string::String,
50
51 pub service_config_id: std::string::String,
55
56 pub attributes: std::option::Option<rpc_context::model::AttributeContext>,
58
59 pub resources: std::vec::Vec<crate::model::ResourceInfo>,
61
62 pub flags: std::string::String,
64
65 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl CheckRequest {
69 pub fn new() -> Self {
70 std::default::Default::default()
71 }
72
73 pub fn set_service_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
75 self.service_name = v.into();
76 self
77 }
78
79 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
81 mut self,
82 v: T,
83 ) -> Self {
84 self.service_config_id = v.into();
85 self
86 }
87
88 pub fn set_attributes<T>(mut self, v: T) -> Self
90 where
91 T: std::convert::Into<rpc_context::model::AttributeContext>,
92 {
93 self.attributes = std::option::Option::Some(v.into());
94 self
95 }
96
97 pub fn set_or_clear_attributes<T>(mut self, v: std::option::Option<T>) -> Self
99 where
100 T: std::convert::Into<rpc_context::model::AttributeContext>,
101 {
102 self.attributes = v.map(|x| x.into());
103 self
104 }
105
106 pub fn set_resources<T, V>(mut self, v: T) -> Self
108 where
109 T: std::iter::IntoIterator<Item = V>,
110 V: std::convert::Into<crate::model::ResourceInfo>,
111 {
112 use std::iter::Iterator;
113 self.resources = v.into_iter().map(|i| i.into()).collect();
114 self
115 }
116
117 pub fn set_flags<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
119 self.flags = v.into();
120 self
121 }
122}
123
124impl wkt::message::Message for CheckRequest {
125 fn typename() -> &'static str {
126 "type.googleapis.com/google.api.servicecontrol.v2.CheckRequest"
127 }
128}
129
130#[derive(Clone, Default, PartialEq)]
132#[non_exhaustive]
133pub struct ResourceInfo {
134 pub name: std::string::String,
136
137 pub r#type: std::string::String,
139
140 pub permission: std::string::String,
143
144 pub container: std::string::String,
154
155 pub location: std::string::String,
159
160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
161}
162
163impl ResourceInfo {
164 pub fn new() -> Self {
165 std::default::Default::default()
166 }
167
168 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
170 self.name = v.into();
171 self
172 }
173
174 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
176 self.r#type = v.into();
177 self
178 }
179
180 pub fn set_permission<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
182 self.permission = v.into();
183 self
184 }
185
186 pub fn set_container<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
188 self.container = v.into();
189 self
190 }
191
192 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
194 self.location = v.into();
195 self
196 }
197}
198
199impl wkt::message::Message for ResourceInfo {
200 fn typename() -> &'static str {
201 "type.googleapis.com/google.api.servicecontrol.v2.ResourceInfo"
202 }
203}
204
205#[derive(Clone, Default, PartialEq)]
207#[non_exhaustive]
208pub struct CheckResponse {
209 pub status: std::option::Option<rpc::model::Status>,
215
216 pub headers: std::collections::HashMap<std::string::String, std::string::String>,
218
219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
220}
221
222impl CheckResponse {
223 pub fn new() -> Self {
224 std::default::Default::default()
225 }
226
227 pub fn set_status<T>(mut self, v: T) -> Self
229 where
230 T: std::convert::Into<rpc::model::Status>,
231 {
232 self.status = std::option::Option::Some(v.into());
233 self
234 }
235
236 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
238 where
239 T: std::convert::Into<rpc::model::Status>,
240 {
241 self.status = v.map(|x| x.into());
242 self
243 }
244
245 pub fn set_headers<T, K, V>(mut self, v: T) -> Self
247 where
248 T: std::iter::IntoIterator<Item = (K, V)>,
249 K: std::convert::Into<std::string::String>,
250 V: std::convert::Into<std::string::String>,
251 {
252 use std::iter::Iterator;
253 self.headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
254 self
255 }
256}
257
258impl wkt::message::Message for CheckResponse {
259 fn typename() -> &'static str {
260 "type.googleapis.com/google.api.servicecontrol.v2.CheckResponse"
261 }
262}
263
264#[derive(Clone, Default, PartialEq)]
266#[non_exhaustive]
267pub struct ReportRequest {
268 pub service_name: std::string::String,
275
276 pub service_config_id: std::string::String,
280
281 pub operations: std::vec::Vec<rpc_context::model::AttributeContext>,
285
286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
287}
288
289impl ReportRequest {
290 pub fn new() -> Self {
291 std::default::Default::default()
292 }
293
294 pub fn set_service_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
296 self.service_name = v.into();
297 self
298 }
299
300 pub fn set_service_config_id<T: std::convert::Into<std::string::String>>(
302 mut self,
303 v: T,
304 ) -> Self {
305 self.service_config_id = v.into();
306 self
307 }
308
309 pub fn set_operations<T, V>(mut self, v: T) -> Self
311 where
312 T: std::iter::IntoIterator<Item = V>,
313 V: std::convert::Into<rpc_context::model::AttributeContext>,
314 {
315 use std::iter::Iterator;
316 self.operations = v.into_iter().map(|i| i.into()).collect();
317 self
318 }
319}
320
321impl wkt::message::Message for ReportRequest {
322 fn typename() -> &'static str {
323 "type.googleapis.com/google.api.servicecontrol.v2.ReportRequest"
324 }
325}
326
327#[derive(Clone, Default, PartialEq)]
330#[non_exhaustive]
331pub struct ReportResponse {
332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
333}
334
335impl ReportResponse {
336 pub fn new() -> Self {
337 std::default::Default::default()
338 }
339}
340
341impl wkt::message::Message for ReportResponse {
342 fn typename() -> &'static str {
343 "type.googleapis.com/google.api.servicecontrol.v2.ReportResponse"
344 }
345}
346
347#[derive(Clone, Default, PartialEq)]
349#[non_exhaustive]
350pub struct ResourceInfoList {
351 pub resources: std::vec::Vec<crate::model::ResourceInfo>,
353
354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
355}
356
357impl ResourceInfoList {
358 pub fn new() -> Self {
359 std::default::Default::default()
360 }
361
362 pub fn set_resources<T, V>(mut self, v: T) -> Self
364 where
365 T: std::iter::IntoIterator<Item = V>,
366 V: std::convert::Into<crate::model::ResourceInfo>,
367 {
368 use std::iter::Iterator;
369 self.resources = v.into_iter().map(|i| i.into()).collect();
370 self
371 }
372}
373
374impl wkt::message::Message for ResourceInfoList {
375 fn typename() -> &'static str {
376 "type.googleapis.com/google.api.servicecontrol.v2.ResourceInfoList"
377 }
378}