1pub mod cloud_shell_service {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::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 crate::ClientFactory for Factory {
40 type Client = CloudShellService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
91 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
92
93 impl GetEnvironment {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
102 self.0.request = v.into();
103 self
104 }
105
106 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 pub async fn send(self) -> Result<crate::model::Environment> {
114 (*self.0.stub)
115 .get_environment(self.0.request, self.0.options)
116 .await
117 .map(crate::Response::into_body)
118 }
119
120 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
124 self.0.request.name = v.into();
125 self
126 }
127 }
128
129 #[doc(hidden)]
130 impl crate::RequestBuilder for GetEnvironment {
131 fn request_options(&mut self) -> &mut crate::RequestOptions {
132 &mut self.0.options
133 }
134 }
135
136 #[derive(Clone, Debug)]
154 pub struct StartEnvironment(RequestBuilder<crate::model::StartEnvironmentRequest>);
155
156 impl StartEnvironment {
157 pub(crate) fn new(
158 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
159 ) -> Self {
160 Self(RequestBuilder::new(stub))
161 }
162
163 pub fn with_request<V: Into<crate::model::StartEnvironmentRequest>>(
165 mut self,
166 v: V,
167 ) -> Self {
168 self.0.request = v.into();
169 self
170 }
171
172 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
174 self.0.options = v.into();
175 self
176 }
177
178 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
185 (*self.0.stub)
186 .start_environment(self.0.request, self.0.options)
187 .await
188 .map(crate::Response::into_body)
189 }
190
191 pub fn poller(
193 self,
194 ) -> impl google_cloud_lro::Poller<
195 crate::model::StartEnvironmentResponse,
196 crate::model::StartEnvironmentMetadata,
197 > {
198 type Operation = google_cloud_lro::internal::Operation<
199 crate::model::StartEnvironmentResponse,
200 crate::model::StartEnvironmentMetadata,
201 >;
202 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
203 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
204 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
205 if let Some(ref mut details) = poller_options.tracing {
206 details.method_name = "google_cloud_shell_v1::client::CloudShellService::start_environment::until_done";
207 }
208
209 let stub = self.0.stub.clone();
210 let mut options = self.0.options.clone();
211 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
212 let query = move |name| {
213 let stub = stub.clone();
214 let options = options.clone();
215 async {
216 let op = GetOperation::new(stub)
217 .set_name(name)
218 .with_options(options)
219 .send()
220 .await?;
221 Ok(Operation::new(op))
222 }
223 };
224
225 let start = move || async {
226 let op = self.send().await?;
227 Ok(Operation::new(op))
228 };
229
230 use google_cloud_lro::internal::PollerExt;
231 {
232 google_cloud_lro::internal::new_poller(
233 polling_error_policy,
234 polling_backoff_policy,
235 start,
236 query,
237 )
238 }
239 .with_options(poller_options)
240 }
241
242 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
244 self.0.request.name = v.into();
245 self
246 }
247
248 pub fn set_access_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
250 self.0.request.access_token = v.into();
251 self
252 }
253
254 pub fn set_public_keys<T, V>(mut self, v: T) -> Self
256 where
257 T: std::iter::IntoIterator<Item = V>,
258 V: std::convert::Into<std::string::String>,
259 {
260 use std::iter::Iterator;
261 self.0.request.public_keys = v.into_iter().map(|i| i.into()).collect();
262 self
263 }
264 }
265
266 #[doc(hidden)]
267 impl crate::RequestBuilder for StartEnvironment {
268 fn request_options(&mut self) -> &mut crate::RequestOptions {
269 &mut self.0.options
270 }
271 }
272
273 #[derive(Clone, Debug)]
291 pub struct AuthorizeEnvironment(RequestBuilder<crate::model::AuthorizeEnvironmentRequest>);
292
293 impl AuthorizeEnvironment {
294 pub(crate) fn new(
295 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
296 ) -> Self {
297 Self(RequestBuilder::new(stub))
298 }
299
300 pub fn with_request<V: Into<crate::model::AuthorizeEnvironmentRequest>>(
302 mut self,
303 v: V,
304 ) -> Self {
305 self.0.request = v.into();
306 self
307 }
308
309 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
311 self.0.options = v.into();
312 self
313 }
314
315 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
322 (*self.0.stub)
323 .authorize_environment(self.0.request, self.0.options)
324 .await
325 .map(crate::Response::into_body)
326 }
327
328 pub fn poller(
330 self,
331 ) -> impl google_cloud_lro::Poller<
332 crate::model::AuthorizeEnvironmentResponse,
333 crate::model::AuthorizeEnvironmentMetadata,
334 > {
335 type Operation = google_cloud_lro::internal::Operation<
336 crate::model::AuthorizeEnvironmentResponse,
337 crate::model::AuthorizeEnvironmentMetadata,
338 >;
339 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
340 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
341 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
342 if let Some(ref mut details) = poller_options.tracing {
343 details.method_name = "google_cloud_shell_v1::client::CloudShellService::authorize_environment::until_done";
344 }
345
346 let stub = self.0.stub.clone();
347 let mut options = self.0.options.clone();
348 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
349 let query = move |name| {
350 let stub = stub.clone();
351 let options = options.clone();
352 async {
353 let op = GetOperation::new(stub)
354 .set_name(name)
355 .with_options(options)
356 .send()
357 .await?;
358 Ok(Operation::new(op))
359 }
360 };
361
362 let start = move || async {
363 let op = self.send().await?;
364 Ok(Operation::new(op))
365 };
366
367 use google_cloud_lro::internal::PollerExt;
368 {
369 google_cloud_lro::internal::new_poller(
370 polling_error_policy,
371 polling_backoff_policy,
372 start,
373 query,
374 )
375 }
376 .with_options(poller_options)
377 }
378
379 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
381 self.0.request.name = v.into();
382 self
383 }
384
385 pub fn set_access_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
387 self.0.request.access_token = v.into();
388 self
389 }
390
391 pub fn set_id_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
393 self.0.request.id_token = v.into();
394 self
395 }
396
397 pub fn set_expire_time<T>(mut self, v: T) -> Self
399 where
400 T: std::convert::Into<wkt::Timestamp>,
401 {
402 self.0.request.expire_time = std::option::Option::Some(v.into());
403 self
404 }
405
406 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
408 where
409 T: std::convert::Into<wkt::Timestamp>,
410 {
411 self.0.request.expire_time = v.map(|x| x.into());
412 self
413 }
414 }
415
416 #[doc(hidden)]
417 impl crate::RequestBuilder for AuthorizeEnvironment {
418 fn request_options(&mut self) -> &mut crate::RequestOptions {
419 &mut self.0.options
420 }
421 }
422
423 #[derive(Clone, Debug)]
441 pub struct AddPublicKey(RequestBuilder<crate::model::AddPublicKeyRequest>);
442
443 impl AddPublicKey {
444 pub(crate) fn new(
445 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
446 ) -> Self {
447 Self(RequestBuilder::new(stub))
448 }
449
450 pub fn with_request<V: Into<crate::model::AddPublicKeyRequest>>(mut self, v: V) -> Self {
452 self.0.request = v.into();
453 self
454 }
455
456 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
458 self.0.options = v.into();
459 self
460 }
461
462 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
469 (*self.0.stub)
470 .add_public_key(self.0.request, self.0.options)
471 .await
472 .map(crate::Response::into_body)
473 }
474
475 pub fn poller(
477 self,
478 ) -> impl google_cloud_lro::Poller<
479 crate::model::AddPublicKeyResponse,
480 crate::model::AddPublicKeyMetadata,
481 > {
482 type Operation = google_cloud_lro::internal::Operation<
483 crate::model::AddPublicKeyResponse,
484 crate::model::AddPublicKeyMetadata,
485 >;
486 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
487 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
488 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
489 if let Some(ref mut details) = poller_options.tracing {
490 details.method_name =
491 "google_cloud_shell_v1::client::CloudShellService::add_public_key::until_done";
492 }
493
494 let stub = self.0.stub.clone();
495 let mut options = self.0.options.clone();
496 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
497 let query = move |name| {
498 let stub = stub.clone();
499 let options = options.clone();
500 async {
501 let op = GetOperation::new(stub)
502 .set_name(name)
503 .with_options(options)
504 .send()
505 .await?;
506 Ok(Operation::new(op))
507 }
508 };
509
510 let start = move || async {
511 let op = self.send().await?;
512 Ok(Operation::new(op))
513 };
514
515 use google_cloud_lro::internal::PollerExt;
516 {
517 google_cloud_lro::internal::new_poller(
518 polling_error_policy,
519 polling_backoff_policy,
520 start,
521 query,
522 )
523 }
524 .with_options(poller_options)
525 }
526
527 pub fn set_environment<T: Into<std::string::String>>(mut self, v: T) -> Self {
529 self.0.request.environment = v.into();
530 self
531 }
532
533 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
535 self.0.request.key = v.into();
536 self
537 }
538 }
539
540 #[doc(hidden)]
541 impl crate::RequestBuilder for AddPublicKey {
542 fn request_options(&mut self) -> &mut crate::RequestOptions {
543 &mut self.0.options
544 }
545 }
546
547 #[derive(Clone, Debug)]
565 pub struct RemovePublicKey(RequestBuilder<crate::model::RemovePublicKeyRequest>);
566
567 impl RemovePublicKey {
568 pub(crate) fn new(
569 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
570 ) -> Self {
571 Self(RequestBuilder::new(stub))
572 }
573
574 pub fn with_request<V: Into<crate::model::RemovePublicKeyRequest>>(mut self, v: V) -> Self {
576 self.0.request = v.into();
577 self
578 }
579
580 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
582 self.0.options = v.into();
583 self
584 }
585
586 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
593 (*self.0.stub)
594 .remove_public_key(self.0.request, self.0.options)
595 .await
596 .map(crate::Response::into_body)
597 }
598
599 pub fn poller(
601 self,
602 ) -> impl google_cloud_lro::Poller<
603 crate::model::RemovePublicKeyResponse,
604 crate::model::RemovePublicKeyMetadata,
605 > {
606 type Operation = google_cloud_lro::internal::Operation<
607 crate::model::RemovePublicKeyResponse,
608 crate::model::RemovePublicKeyMetadata,
609 >;
610 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
611 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
612 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
613 if let Some(ref mut details) = poller_options.tracing {
614 details.method_name = "google_cloud_shell_v1::client::CloudShellService::remove_public_key::until_done";
615 }
616
617 let stub = self.0.stub.clone();
618 let mut options = self.0.options.clone();
619 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
620 let query = move |name| {
621 let stub = stub.clone();
622 let options = options.clone();
623 async {
624 let op = GetOperation::new(stub)
625 .set_name(name)
626 .with_options(options)
627 .send()
628 .await?;
629 Ok(Operation::new(op))
630 }
631 };
632
633 let start = move || async {
634 let op = self.send().await?;
635 Ok(Operation::new(op))
636 };
637
638 use google_cloud_lro::internal::PollerExt;
639 {
640 google_cloud_lro::internal::new_poller(
641 polling_error_policy,
642 polling_backoff_policy,
643 start,
644 query,
645 )
646 }
647 .with_options(poller_options)
648 }
649
650 pub fn set_environment<T: Into<std::string::String>>(mut self, v: T) -> Self {
652 self.0.request.environment = v.into();
653 self
654 }
655
656 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
658 self.0.request.key = v.into();
659 self
660 }
661 }
662
663 #[doc(hidden)]
664 impl crate::RequestBuilder for RemovePublicKey {
665 fn request_options(&mut self) -> &mut crate::RequestOptions {
666 &mut self.0.options
667 }
668 }
669
670 #[derive(Clone, Debug)]
687 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
688
689 impl GetOperation {
690 pub(crate) fn new(
691 stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudShellService>,
692 ) -> Self {
693 Self(RequestBuilder::new(stub))
694 }
695
696 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
698 mut self,
699 v: V,
700 ) -> Self {
701 self.0.request = v.into();
702 self
703 }
704
705 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
707 self.0.options = v.into();
708 self
709 }
710
711 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
713 (*self.0.stub)
714 .get_operation(self.0.request, self.0.options)
715 .await
716 .map(crate::Response::into_body)
717 }
718
719 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
721 self.0.request.name = v.into();
722 self
723 }
724 }
725
726 #[doc(hidden)]
727 impl crate::RequestBuilder for GetOperation {
728 fn request_options(&mut self) -> &mut crate::RequestOptions {
729 &mut self.0.options
730 }
731 }
732}