1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
pub mod quota_controller {
use crate::Result;
/// A builder for [QuotaController][crate::client::QuotaController].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_api_servicecontrol_v1::*;
/// # use builder::quota_controller::ClientBuilder;
/// # use client::QuotaController;
/// let builder : ClientBuilder = QuotaController::builder();
/// let client = builder
/// .with_endpoint("https://servicecontrol.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::QuotaController;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = QuotaController;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::QuotaController] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::QuotaController>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::QuotaController>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [QuotaController::allocate_quota][crate::client::QuotaController::allocate_quota] calls.
///
/// # Example
/// ```
/// # use google_cloud_api_servicecontrol_v1::builder::quota_controller::AllocateQuota;
/// # async fn sample() -> google_cloud_api_servicecontrol_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AllocateQuota {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AllocateQuota(RequestBuilder<crate::model::AllocateQuotaRequest>);
impl AllocateQuota {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::QuotaController>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AllocateQuotaRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AllocateQuotaResponse> {
(*self.0.stub)
.allocate_quota(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [service_name][crate::model::AllocateQuotaRequest::service_name].
pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_name = v.into();
self
}
/// Sets the value of [allocate_operation][crate::model::AllocateQuotaRequest::allocate_operation].
pub fn set_allocate_operation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QuotaOperation>,
{
self.0.request.allocate_operation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [allocate_operation][crate::model::AllocateQuotaRequest::allocate_operation].
pub fn set_or_clear_allocate_operation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QuotaOperation>,
{
self.0.request.allocate_operation = v.map(|x| x.into());
self
}
/// Sets the value of [service_config_id][crate::model::AllocateQuotaRequest::service_config_id].
pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_config_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AllocateQuota {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
pub mod service_controller {
use crate::Result;
/// A builder for [ServiceController][crate::client::ServiceController].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_api_servicecontrol_v1::*;
/// # use builder::service_controller::ClientBuilder;
/// # use client::ServiceController;
/// let builder : ClientBuilder = ServiceController::builder();
/// let client = builder
/// .with_endpoint("https://servicecontrol.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ServiceController;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ServiceController;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ServiceController] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ServiceController::check][crate::client::ServiceController::check] calls.
///
/// # Example
/// ```
/// # use google_cloud_api_servicecontrol_v1::builder::service_controller::Check;
/// # async fn sample() -> google_cloud_api_servicecontrol_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> Check {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct Check(RequestBuilder<crate::model::CheckRequest>);
impl Check {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CheckRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CheckResponse> {
(*self.0.stub)
.check(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [service_name][crate::model::CheckRequest::service_name].
pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_name = v.into();
self
}
/// Sets the value of [operation][crate::model::CheckRequest::operation].
pub fn set_operation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Operation>,
{
self.0.request.operation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [operation][crate::model::CheckRequest::operation].
pub fn set_or_clear_operation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Operation>,
{
self.0.request.operation = v.map(|x| x.into());
self
}
/// Sets the value of [service_config_id][crate::model::CheckRequest::service_config_id].
pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_config_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Check {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ServiceController::report][crate::client::ServiceController::report] calls.
///
/// # Example
/// ```
/// # use google_cloud_api_servicecontrol_v1::builder::service_controller::Report;
/// # async fn sample() -> google_cloud_api_servicecontrol_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> Report {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct Report(RequestBuilder<crate::model::ReportRequest>);
impl Report {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceController>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReportRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReportResponse> {
(*self.0.stub)
.report(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [service_name][crate::model::ReportRequest::service_name].
pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_name = v.into();
self
}
/// Sets the value of [operations][crate::model::ReportRequest::operations].
pub fn set_operations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Operation>,
{
use std::iter::Iterator;
self.0.request.operations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [service_config_id][crate::model::ReportRequest::service_config_id].
pub fn set_service_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_config_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Report {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}