google_cloud_api_servicecontrol_v1/
builders.rs1pub mod quota_controller {
18 use crate::Result;
19 use std::sync::Arc;
20
21 #[derive(Clone, Debug)]
23 pub struct RequestBuilder<R: std::default::Default> {
24 stub: Arc<dyn crate::stubs::dynamic::QuotaController>,
25 request: R,
26 options: gax::options::RequestOptions,
27 }
28
29 impl<R> RequestBuilder<R>
30 where
31 R: std::default::Default,
32 {
33 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::QuotaController>) -> Self {
34 Self {
35 stub,
36 request: R::default(),
37 options: gax::options::RequestOptions::default(),
38 }
39 }
40 }
41
42 #[derive(Clone, Debug)]
44 pub struct AllocateQuota(RequestBuilder<crate::model::AllocateQuotaRequest>);
45
46 impl AllocateQuota {
47 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::QuotaController>) -> Self {
48 Self(RequestBuilder::new(stub))
49 }
50
51 pub fn with_request<V: Into<crate::model::AllocateQuotaRequest>>(mut self, v: V) -> Self {
53 self.0.request = v.into();
54 self
55 }
56
57 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
59 self.0.options = v.into();
60 self
61 }
62
63 pub async fn send(self) -> Result<crate::model::AllocateQuotaResponse> {
65 (*self.0.stub)
66 .allocate_quota(self.0.request, self.0.options)
67 .await
68 }
69
70 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
72 self.0.request.service_name = v.into();
73 self
74 }
75
76 pub fn set_allocate_operation<
78 T: Into<std::option::Option<crate::model::QuotaOperation>>,
79 >(
80 mut self,
81 v: T,
82 ) -> Self {
83 self.0.request.allocate_operation = v.into();
84 self
85 }
86
87 pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
89 self.0.request.service_config_id = v.into();
90 self
91 }
92 }
93
94 impl gax::options::RequestBuilder for AllocateQuota {
95 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
96 &mut self.0.options
97 }
98 }
99}
100
101pub mod service_controller {
102 use crate::Result;
103 use std::sync::Arc;
104
105 #[derive(Clone, Debug)]
107 pub struct RequestBuilder<R: std::default::Default> {
108 stub: Arc<dyn crate::stubs::dynamic::ServiceController>,
109 request: R,
110 options: gax::options::RequestOptions,
111 }
112
113 impl<R> RequestBuilder<R>
114 where
115 R: std::default::Default,
116 {
117 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ServiceController>) -> Self {
118 Self {
119 stub,
120 request: R::default(),
121 options: gax::options::RequestOptions::default(),
122 }
123 }
124 }
125
126 #[derive(Clone, Debug)]
128 pub struct Check(RequestBuilder<crate::model::CheckRequest>);
129
130 impl Check {
131 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ServiceController>) -> Self {
132 Self(RequestBuilder::new(stub))
133 }
134
135 pub fn with_request<V: Into<crate::model::CheckRequest>>(mut self, v: V) -> Self {
137 self.0.request = v.into();
138 self
139 }
140
141 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
143 self.0.options = v.into();
144 self
145 }
146
147 pub async fn send(self) -> Result<crate::model::CheckResponse> {
149 (*self.0.stub).check(self.0.request, self.0.options).await
150 }
151
152 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
154 self.0.request.service_name = v.into();
155 self
156 }
157
158 pub fn set_operation<T: Into<std::option::Option<crate::model::Operation>>>(
160 mut self,
161 v: T,
162 ) -> Self {
163 self.0.request.operation = v.into();
164 self
165 }
166
167 pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
169 self.0.request.service_config_id = v.into();
170 self
171 }
172 }
173
174 impl gax::options::RequestBuilder for Check {
175 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
176 &mut self.0.options
177 }
178 }
179
180 #[derive(Clone, Debug)]
182 pub struct Report(RequestBuilder<crate::model::ReportRequest>);
183
184 impl Report {
185 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ServiceController>) -> Self {
186 Self(RequestBuilder::new(stub))
187 }
188
189 pub fn with_request<V: Into<crate::model::ReportRequest>>(mut self, v: V) -> Self {
191 self.0.request = v.into();
192 self
193 }
194
195 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
197 self.0.options = v.into();
198 self
199 }
200
201 pub async fn send(self) -> Result<crate::model::ReportResponse> {
203 (*self.0.stub).report(self.0.request, self.0.options).await
204 }
205
206 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
208 self.0.request.service_name = v.into();
209 self
210 }
211
212 pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
214 self.0.request.service_config_id = v.into();
215 self
216 }
217
218 pub fn set_operations<T, V>(mut self, v: T) -> Self
220 where
221 T: std::iter::IntoIterator<Item = V>,
222 V: std::convert::Into<crate::model::Operation>,
223 {
224 use std::iter::Iterator;
225 self.0.request.operations = v.into_iter().map(|i| i.into()).collect();
226 self
227 }
228 }
229
230 impl gax::options::RequestBuilder for Report {
231 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
232 &mut self.0.options
233 }
234 }
235}