1pub mod cloud_shell_service {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::CloudShellService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = CloudShellService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
43 Self::Client::new(config).await
44 }
45 }
46 }
47
48 #[derive(Clone, Debug)]
50 pub(crate) struct RequestBuilder<R: std::default::Default> {
51 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
52 request: R,
53 options: gax::options::RequestOptions,
54 }
55
56 impl<R> RequestBuilder<R>
57 where
58 R: std::default::Default,
59 {
60 pub(crate) fn new(
61 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
62 ) -> Self {
63 Self {
64 stub,
65 request: R::default(),
66 options: gax::options::RequestOptions::default(),
67 }
68 }
69 }
70
71 #[derive(Clone, Debug)]
88 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
89
90 impl GetEnvironment {
91 pub(crate) fn new(
92 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
93 ) -> Self {
94 Self(RequestBuilder::new(stub))
95 }
96
97 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
99 self.0.request = v.into();
100 self
101 }
102
103 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
105 self.0.options = v.into();
106 self
107 }
108
109 pub async fn send(self) -> Result<crate::model::Environment> {
111 (*self.0.stub)
112 .get_environment(self.0.request, self.0.options)
113 .await
114 .map(gax::response::Response::into_body)
115 }
116
117 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
121 self.0.request.name = v.into();
122 self
123 }
124 }
125
126 #[doc(hidden)]
127 impl gax::options::internal::RequestBuilder for GetEnvironment {
128 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
129 &mut self.0.options
130 }
131 }
132
133 #[derive(Clone, Debug)]
151 pub struct StartEnvironment(RequestBuilder<crate::model::StartEnvironmentRequest>);
152
153 impl StartEnvironment {
154 pub(crate) fn new(
155 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
156 ) -> Self {
157 Self(RequestBuilder::new(stub))
158 }
159
160 pub fn with_request<V: Into<crate::model::StartEnvironmentRequest>>(
162 mut self,
163 v: V,
164 ) -> Self {
165 self.0.request = v.into();
166 self
167 }
168
169 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
171 self.0.options = v.into();
172 self
173 }
174
175 pub async fn send(self) -> Result<longrunning::model::Operation> {
182 (*self.0.stub)
183 .start_environment(self.0.request, self.0.options)
184 .await
185 .map(gax::response::Response::into_body)
186 }
187
188 pub fn poller(
190 self,
191 ) -> impl lro::Poller<
192 crate::model::StartEnvironmentResponse,
193 crate::model::StartEnvironmentMetadata,
194 > {
195 type Operation = lro::internal::Operation<
196 crate::model::StartEnvironmentResponse,
197 crate::model::StartEnvironmentMetadata,
198 >;
199 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
200 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
201
202 let stub = self.0.stub.clone();
203 let mut options = self.0.options.clone();
204 options.set_retry_policy(gax::retry_policy::NeverRetry);
205 let query = move |name| {
206 let stub = stub.clone();
207 let options = options.clone();
208 async {
209 let op = GetOperation::new(stub)
210 .set_name(name)
211 .with_options(options)
212 .send()
213 .await?;
214 Ok(Operation::new(op))
215 }
216 };
217
218 let start = move || async {
219 let op = self.send().await?;
220 Ok(Operation::new(op))
221 };
222
223 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
224 }
225
226 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
228 self.0.request.name = v.into();
229 self
230 }
231
232 pub fn set_access_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
234 self.0.request.access_token = v.into();
235 self
236 }
237
238 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
240 where
241 T: std::iter::IntoIterator<Item = V>,
242 V: std::convert::Into<std::string::String>,
243 {
244 use std::iter::Iterator;
245 self.0.request.public_keys = v.into_iter().map(|i| i.into()).collect();
246 self
247 }
248 }
249
250 #[doc(hidden)]
251 impl gax::options::internal::RequestBuilder for StartEnvironment {
252 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
253 &mut self.0.options
254 }
255 }
256
257 #[derive(Clone, Debug)]
275 pub struct AuthorizeEnvironment(RequestBuilder<crate::model::AuthorizeEnvironmentRequest>);
276
277 impl AuthorizeEnvironment {
278 pub(crate) fn new(
279 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
280 ) -> Self {
281 Self(RequestBuilder::new(stub))
282 }
283
284 pub fn with_request<V: Into<crate::model::AuthorizeEnvironmentRequest>>(
286 mut self,
287 v: V,
288 ) -> Self {
289 self.0.request = v.into();
290 self
291 }
292
293 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
295 self.0.options = v.into();
296 self
297 }
298
299 pub async fn send(self) -> Result<longrunning::model::Operation> {
306 (*self.0.stub)
307 .authorize_environment(self.0.request, self.0.options)
308 .await
309 .map(gax::response::Response::into_body)
310 }
311
312 pub fn poller(
314 self,
315 ) -> impl lro::Poller<
316 crate::model::AuthorizeEnvironmentResponse,
317 crate::model::AuthorizeEnvironmentMetadata,
318 > {
319 type Operation = lro::internal::Operation<
320 crate::model::AuthorizeEnvironmentResponse,
321 crate::model::AuthorizeEnvironmentMetadata,
322 >;
323 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
324 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
325
326 let stub = self.0.stub.clone();
327 let mut options = self.0.options.clone();
328 options.set_retry_policy(gax::retry_policy::NeverRetry);
329 let query = move |name| {
330 let stub = stub.clone();
331 let options = options.clone();
332 async {
333 let op = GetOperation::new(stub)
334 .set_name(name)
335 .with_options(options)
336 .send()
337 .await?;
338 Ok(Operation::new(op))
339 }
340 };
341
342 let start = move || async {
343 let op = self.send().await?;
344 Ok(Operation::new(op))
345 };
346
347 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
348 }
349
350 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
352 self.0.request.name = v.into();
353 self
354 }
355
356 pub fn set_access_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
358 self.0.request.access_token = v.into();
359 self
360 }
361
362 pub fn set_id_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
364 self.0.request.id_token = v.into();
365 self
366 }
367
368 pub fn set_expire_time<T: Into<std::option::Option<wkt::Timestamp>>>(
370 mut self,
371 v: T,
372 ) -> Self {
373 self.0.request.expire_time = v.into();
374 self
375 }
376 }
377
378 #[doc(hidden)]
379 impl gax::options::internal::RequestBuilder for AuthorizeEnvironment {
380 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
381 &mut self.0.options
382 }
383 }
384
385 #[derive(Clone, Debug)]
403 pub struct AddPublicKey(RequestBuilder<crate::model::AddPublicKeyRequest>);
404
405 impl AddPublicKey {
406 pub(crate) fn new(
407 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
408 ) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 pub fn with_request<V: Into<crate::model::AddPublicKeyRequest>>(mut self, v: V) -> Self {
414 self.0.request = v.into();
415 self
416 }
417
418 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
420 self.0.options = v.into();
421 self
422 }
423
424 pub async fn send(self) -> Result<longrunning::model::Operation> {
431 (*self.0.stub)
432 .add_public_key(self.0.request, self.0.options)
433 .await
434 .map(gax::response::Response::into_body)
435 }
436
437 pub fn poller(
439 self,
440 ) -> impl lro::Poller<crate::model::AddPublicKeyResponse, crate::model::AddPublicKeyMetadata>
441 {
442 type Operation = lro::internal::Operation<
443 crate::model::AddPublicKeyResponse,
444 crate::model::AddPublicKeyMetadata,
445 >;
446 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
447 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
448
449 let stub = self.0.stub.clone();
450 let mut options = self.0.options.clone();
451 options.set_retry_policy(gax::retry_policy::NeverRetry);
452 let query = move |name| {
453 let stub = stub.clone();
454 let options = options.clone();
455 async {
456 let op = GetOperation::new(stub)
457 .set_name(name)
458 .with_options(options)
459 .send()
460 .await?;
461 Ok(Operation::new(op))
462 }
463 };
464
465 let start = move || async {
466 let op = self.send().await?;
467 Ok(Operation::new(op))
468 };
469
470 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
471 }
472
473 pub fn set_environment<T: Into<std::string::String>>(mut self, v: T) -> Self {
475 self.0.request.environment = v.into();
476 self
477 }
478
479 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
481 self.0.request.key = v.into();
482 self
483 }
484 }
485
486 #[doc(hidden)]
487 impl gax::options::internal::RequestBuilder for AddPublicKey {
488 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
489 &mut self.0.options
490 }
491 }
492
493 #[derive(Clone, Debug)]
511 pub struct RemovePublicKey(RequestBuilder<crate::model::RemovePublicKeyRequest>);
512
513 impl RemovePublicKey {
514 pub(crate) fn new(
515 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
516 ) -> Self {
517 Self(RequestBuilder::new(stub))
518 }
519
520 pub fn with_request<V: Into<crate::model::RemovePublicKeyRequest>>(mut self, v: V) -> Self {
522 self.0.request = v.into();
523 self
524 }
525
526 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
528 self.0.options = v.into();
529 self
530 }
531
532 pub async fn send(self) -> Result<longrunning::model::Operation> {
539 (*self.0.stub)
540 .remove_public_key(self.0.request, self.0.options)
541 .await
542 .map(gax::response::Response::into_body)
543 }
544
545 pub fn poller(
547 self,
548 ) -> impl lro::Poller<crate::model::RemovePublicKeyResponse, crate::model::RemovePublicKeyMetadata>
549 {
550 type Operation = lro::internal::Operation<
551 crate::model::RemovePublicKeyResponse,
552 crate::model::RemovePublicKeyMetadata,
553 >;
554 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
555 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
556
557 let stub = self.0.stub.clone();
558 let mut options = self.0.options.clone();
559 options.set_retry_policy(gax::retry_policy::NeverRetry);
560 let query = move |name| {
561 let stub = stub.clone();
562 let options = options.clone();
563 async {
564 let op = GetOperation::new(stub)
565 .set_name(name)
566 .with_options(options)
567 .send()
568 .await?;
569 Ok(Operation::new(op))
570 }
571 };
572
573 let start = move || async {
574 let op = self.send().await?;
575 Ok(Operation::new(op))
576 };
577
578 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
579 }
580
581 pub fn set_environment<T: Into<std::string::String>>(mut self, v: T) -> Self {
583 self.0.request.environment = v.into();
584 self
585 }
586
587 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
589 self.0.request.key = v.into();
590 self
591 }
592 }
593
594 #[doc(hidden)]
595 impl gax::options::internal::RequestBuilder for RemovePublicKey {
596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
597 &mut self.0.options
598 }
599 }
600
601 #[derive(Clone, Debug)]
618 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
619
620 impl GetOperation {
621 pub(crate) fn new(
622 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
623 ) -> Self {
624 Self(RequestBuilder::new(stub))
625 }
626
627 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
629 mut self,
630 v: V,
631 ) -> Self {
632 self.0.request = v.into();
633 self
634 }
635
636 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
638 self.0.options = v.into();
639 self
640 }
641
642 pub async fn send(self) -> Result<longrunning::model::Operation> {
644 (*self.0.stub)
645 .get_operation(self.0.request, self.0.options)
646 .await
647 .map(gax::response::Response::into_body)
648 }
649
650 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
652 self.0.request.name = v.into();
653 self
654 }
655 }
656
657 #[doc(hidden)]
658 impl gax::options::internal::RequestBuilder for GetOperation {
659 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
660 &mut self.0.options
661 }
662 }
663}