google_cloud_monitoring_v3/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod alert_policy_service {
18 use crate::Result;
19
20 /// A builder for [AlertPolicyService][crate::client::AlertPolicyService].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_monitoring_v3::*;
25 /// # use builder::alert_policy_service::ClientBuilder;
26 /// # use client::AlertPolicyService;
27 /// let builder : ClientBuilder = AlertPolicyService::builder();
28 /// let client = builder
29 /// .with_endpoint("https://monitoring.googleapis.com")
30 /// .build().await?;
31 /// # gax::client_builder::Result::<()>::Ok(()) });
32 /// ```
33 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::AlertPolicyService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = AlertPolicyService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::AlertPolicyService] request builders.
52 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
55 request: R,
56 options: gax::options::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::AlertPolicyService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [AlertPolicyService::list_alert_policies][crate::client::AlertPolicyService::list_alert_policies] calls.
75 ///
76 /// # Example
77 /// ```no_run
78 /// # use google_cloud_monitoring_v3::builder;
79 /// use builder::alert_policy_service::ListAlertPolicies;
80 /// # tokio_test::block_on(async {
81 /// use gax::paginator::ItemPaginator;
82 ///
83 /// let builder = prepare_request_builder();
84 /// let mut items = builder.by_item();
85 /// while let Some(result) = items.next().await {
86 /// let item = result?;
87 /// }
88 /// # gax::Result::<()>::Ok(()) });
89 ///
90 /// fn prepare_request_builder() -> ListAlertPolicies {
91 /// # panic!();
92 /// // ... details omitted ...
93 /// }
94 /// ```
95 #[derive(Clone, Debug)]
96 pub struct ListAlertPolicies(RequestBuilder<crate::model::ListAlertPoliciesRequest>);
97
98 impl ListAlertPolicies {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 /// Sets the full request, replacing any prior values.
106 pub fn with_request<V: Into<crate::model::ListAlertPoliciesRequest>>(
107 mut self,
108 v: V,
109 ) -> Self {
110 self.0.request = v.into();
111 self
112 }
113
114 /// Sets all the options, replacing any prior values.
115 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
116 self.0.options = v.into();
117 self
118 }
119
120 /// Sends the request.
121 pub async fn send(self) -> Result<crate::model::ListAlertPoliciesResponse> {
122 (*self.0.stub)
123 .list_alert_policies(self.0.request, self.0.options)
124 .await
125 .map(gax::response::Response::into_body)
126 }
127
128 /// Streams each page in the collection.
129 pub fn by_page(
130 self,
131 ) -> impl gax::paginator::Paginator<crate::model::ListAlertPoliciesResponse, gax::error::Error>
132 {
133 use std::clone::Clone;
134 let token = self.0.request.page_token.clone();
135 let execute = move |token: String| {
136 let mut builder = self.clone();
137 builder.0.request = builder.0.request.set_page_token(token);
138 builder.send()
139 };
140 gax::paginator::internal::new_paginator(token, execute)
141 }
142
143 /// Streams each item in the collection.
144 pub fn by_item(
145 self,
146 ) -> impl gax::paginator::ItemPaginator<crate::model::ListAlertPoliciesResponse, gax::error::Error>
147 {
148 use gax::paginator::Paginator;
149 self.by_page().items()
150 }
151
152 /// Sets the value of [name][crate::model::ListAlertPoliciesRequest::name].
153 ///
154 /// This is a **required** field for requests.
155 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
156 self.0.request.name = v.into();
157 self
158 }
159
160 /// Sets the value of [filter][crate::model::ListAlertPoliciesRequest::filter].
161 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
162 self.0.request.filter = v.into();
163 self
164 }
165
166 /// Sets the value of [order_by][crate::model::ListAlertPoliciesRequest::order_by].
167 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
168 self.0.request.order_by = v.into();
169 self
170 }
171
172 /// Sets the value of [page_size][crate::model::ListAlertPoliciesRequest::page_size].
173 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
174 self.0.request.page_size = v.into();
175 self
176 }
177
178 /// Sets the value of [page_token][crate::model::ListAlertPoliciesRequest::page_token].
179 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
180 self.0.request.page_token = v.into();
181 self
182 }
183 }
184
185 #[doc(hidden)]
186 impl gax::options::internal::RequestBuilder for ListAlertPolicies {
187 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
188 &mut self.0.options
189 }
190 }
191
192 /// The request builder for [AlertPolicyService::get_alert_policy][crate::client::AlertPolicyService::get_alert_policy] calls.
193 ///
194 /// # Example
195 /// ```no_run
196 /// # use google_cloud_monitoring_v3::builder;
197 /// use builder::alert_policy_service::GetAlertPolicy;
198 /// # tokio_test::block_on(async {
199 ///
200 /// let builder = prepare_request_builder();
201 /// let response = builder.send().await?;
202 /// # gax::Result::<()>::Ok(()) });
203 ///
204 /// fn prepare_request_builder() -> GetAlertPolicy {
205 /// # panic!();
206 /// // ... details omitted ...
207 /// }
208 /// ```
209 #[derive(Clone, Debug)]
210 pub struct GetAlertPolicy(RequestBuilder<crate::model::GetAlertPolicyRequest>);
211
212 impl GetAlertPolicy {
213 pub(crate) fn new(
214 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
215 ) -> Self {
216 Self(RequestBuilder::new(stub))
217 }
218
219 /// Sets the full request, replacing any prior values.
220 pub fn with_request<V: Into<crate::model::GetAlertPolicyRequest>>(mut self, v: V) -> Self {
221 self.0.request = v.into();
222 self
223 }
224
225 /// Sets all the options, replacing any prior values.
226 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
227 self.0.options = v.into();
228 self
229 }
230
231 /// Sends the request.
232 pub async fn send(self) -> Result<crate::model::AlertPolicy> {
233 (*self.0.stub)
234 .get_alert_policy(self.0.request, self.0.options)
235 .await
236 .map(gax::response::Response::into_body)
237 }
238
239 /// Sets the value of [name][crate::model::GetAlertPolicyRequest::name].
240 ///
241 /// This is a **required** field for requests.
242 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
243 self.0.request.name = v.into();
244 self
245 }
246 }
247
248 #[doc(hidden)]
249 impl gax::options::internal::RequestBuilder for GetAlertPolicy {
250 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
251 &mut self.0.options
252 }
253 }
254
255 /// The request builder for [AlertPolicyService::create_alert_policy][crate::client::AlertPolicyService::create_alert_policy] calls.
256 ///
257 /// # Example
258 /// ```no_run
259 /// # use google_cloud_monitoring_v3::builder;
260 /// use builder::alert_policy_service::CreateAlertPolicy;
261 /// # tokio_test::block_on(async {
262 ///
263 /// let builder = prepare_request_builder();
264 /// let response = builder.send().await?;
265 /// # gax::Result::<()>::Ok(()) });
266 ///
267 /// fn prepare_request_builder() -> CreateAlertPolicy {
268 /// # panic!();
269 /// // ... details omitted ...
270 /// }
271 /// ```
272 #[derive(Clone, Debug)]
273 pub struct CreateAlertPolicy(RequestBuilder<crate::model::CreateAlertPolicyRequest>);
274
275 impl CreateAlertPolicy {
276 pub(crate) fn new(
277 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
278 ) -> Self {
279 Self(RequestBuilder::new(stub))
280 }
281
282 /// Sets the full request, replacing any prior values.
283 pub fn with_request<V: Into<crate::model::CreateAlertPolicyRequest>>(
284 mut self,
285 v: V,
286 ) -> Self {
287 self.0.request = v.into();
288 self
289 }
290
291 /// Sets all the options, replacing any prior values.
292 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
293 self.0.options = v.into();
294 self
295 }
296
297 /// Sends the request.
298 pub async fn send(self) -> Result<crate::model::AlertPolicy> {
299 (*self.0.stub)
300 .create_alert_policy(self.0.request, self.0.options)
301 .await
302 .map(gax::response::Response::into_body)
303 }
304
305 /// Sets the value of [name][crate::model::CreateAlertPolicyRequest::name].
306 ///
307 /// This is a **required** field for requests.
308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
309 self.0.request.name = v.into();
310 self
311 }
312
313 /// Sets the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
314 ///
315 /// This is a **required** field for requests.
316 pub fn set_alert_policy<T>(mut self, v: T) -> Self
317 where
318 T: std::convert::Into<crate::model::AlertPolicy>,
319 {
320 self.0.request.alert_policy = std::option::Option::Some(v.into());
321 self
322 }
323
324 /// Sets or clears the value of [alert_policy][crate::model::CreateAlertPolicyRequest::alert_policy].
325 ///
326 /// This is a **required** field for requests.
327 pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
328 where
329 T: std::convert::Into<crate::model::AlertPolicy>,
330 {
331 self.0.request.alert_policy = v.map(|x| x.into());
332 self
333 }
334 }
335
336 #[doc(hidden)]
337 impl gax::options::internal::RequestBuilder for CreateAlertPolicy {
338 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
339 &mut self.0.options
340 }
341 }
342
343 /// The request builder for [AlertPolicyService::delete_alert_policy][crate::client::AlertPolicyService::delete_alert_policy] calls.
344 ///
345 /// # Example
346 /// ```no_run
347 /// # use google_cloud_monitoring_v3::builder;
348 /// use builder::alert_policy_service::DeleteAlertPolicy;
349 /// # tokio_test::block_on(async {
350 ///
351 /// let builder = prepare_request_builder();
352 /// let response = builder.send().await?;
353 /// # gax::Result::<()>::Ok(()) });
354 ///
355 /// fn prepare_request_builder() -> DeleteAlertPolicy {
356 /// # panic!();
357 /// // ... details omitted ...
358 /// }
359 /// ```
360 #[derive(Clone, Debug)]
361 pub struct DeleteAlertPolicy(RequestBuilder<crate::model::DeleteAlertPolicyRequest>);
362
363 impl DeleteAlertPolicy {
364 pub(crate) fn new(
365 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
366 ) -> Self {
367 Self(RequestBuilder::new(stub))
368 }
369
370 /// Sets the full request, replacing any prior values.
371 pub fn with_request<V: Into<crate::model::DeleteAlertPolicyRequest>>(
372 mut self,
373 v: V,
374 ) -> Self {
375 self.0.request = v.into();
376 self
377 }
378
379 /// Sets all the options, replacing any prior values.
380 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
381 self.0.options = v.into();
382 self
383 }
384
385 /// Sends the request.
386 pub async fn send(self) -> Result<()> {
387 (*self.0.stub)
388 .delete_alert_policy(self.0.request, self.0.options)
389 .await
390 .map(gax::response::Response::into_body)
391 }
392
393 /// Sets the value of [name][crate::model::DeleteAlertPolicyRequest::name].
394 ///
395 /// This is a **required** field for requests.
396 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
397 self.0.request.name = v.into();
398 self
399 }
400 }
401
402 #[doc(hidden)]
403 impl gax::options::internal::RequestBuilder for DeleteAlertPolicy {
404 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
405 &mut self.0.options
406 }
407 }
408
409 /// The request builder for [AlertPolicyService::update_alert_policy][crate::client::AlertPolicyService::update_alert_policy] calls.
410 ///
411 /// # Example
412 /// ```no_run
413 /// # use google_cloud_monitoring_v3::builder;
414 /// use builder::alert_policy_service::UpdateAlertPolicy;
415 /// # tokio_test::block_on(async {
416 ///
417 /// let builder = prepare_request_builder();
418 /// let response = builder.send().await?;
419 /// # gax::Result::<()>::Ok(()) });
420 ///
421 /// fn prepare_request_builder() -> UpdateAlertPolicy {
422 /// # panic!();
423 /// // ... details omitted ...
424 /// }
425 /// ```
426 #[derive(Clone, Debug)]
427 pub struct UpdateAlertPolicy(RequestBuilder<crate::model::UpdateAlertPolicyRequest>);
428
429 impl UpdateAlertPolicy {
430 pub(crate) fn new(
431 stub: std::sync::Arc<dyn super::super::stub::dynamic::AlertPolicyService>,
432 ) -> Self {
433 Self(RequestBuilder::new(stub))
434 }
435
436 /// Sets the full request, replacing any prior values.
437 pub fn with_request<V: Into<crate::model::UpdateAlertPolicyRequest>>(
438 mut self,
439 v: V,
440 ) -> Self {
441 self.0.request = v.into();
442 self
443 }
444
445 /// Sets all the options, replacing any prior values.
446 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
447 self.0.options = v.into();
448 self
449 }
450
451 /// Sends the request.
452 pub async fn send(self) -> Result<crate::model::AlertPolicy> {
453 (*self.0.stub)
454 .update_alert_policy(self.0.request, self.0.options)
455 .await
456 .map(gax::response::Response::into_body)
457 }
458
459 /// Sets the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
460 pub fn set_update_mask<T>(mut self, v: T) -> Self
461 where
462 T: std::convert::Into<wkt::FieldMask>,
463 {
464 self.0.request.update_mask = std::option::Option::Some(v.into());
465 self
466 }
467
468 /// Sets or clears the value of [update_mask][crate::model::UpdateAlertPolicyRequest::update_mask].
469 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
470 where
471 T: std::convert::Into<wkt::FieldMask>,
472 {
473 self.0.request.update_mask = v.map(|x| x.into());
474 self
475 }
476
477 /// Sets the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
478 ///
479 /// This is a **required** field for requests.
480 pub fn set_alert_policy<T>(mut self, v: T) -> Self
481 where
482 T: std::convert::Into<crate::model::AlertPolicy>,
483 {
484 self.0.request.alert_policy = std::option::Option::Some(v.into());
485 self
486 }
487
488 /// Sets or clears the value of [alert_policy][crate::model::UpdateAlertPolicyRequest::alert_policy].
489 ///
490 /// This is a **required** field for requests.
491 pub fn set_or_clear_alert_policy<T>(mut self, v: std::option::Option<T>) -> Self
492 where
493 T: std::convert::Into<crate::model::AlertPolicy>,
494 {
495 self.0.request.alert_policy = v.map(|x| x.into());
496 self
497 }
498 }
499
500 #[doc(hidden)]
501 impl gax::options::internal::RequestBuilder for UpdateAlertPolicy {
502 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
503 &mut self.0.options
504 }
505 }
506}
507
508pub mod group_service {
509 use crate::Result;
510
511 /// A builder for [GroupService][crate::client::GroupService].
512 ///
513 /// ```
514 /// # tokio_test::block_on(async {
515 /// # use google_cloud_monitoring_v3::*;
516 /// # use builder::group_service::ClientBuilder;
517 /// # use client::GroupService;
518 /// let builder : ClientBuilder = GroupService::builder();
519 /// let client = builder
520 /// .with_endpoint("https://monitoring.googleapis.com")
521 /// .build().await?;
522 /// # gax::client_builder::Result::<()>::Ok(()) });
523 /// ```
524 pub type ClientBuilder =
525 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
526
527 pub(crate) mod client {
528 use super::super::super::client::GroupService;
529 pub struct Factory;
530 impl gax::client_builder::internal::ClientFactory for Factory {
531 type Client = GroupService;
532 type Credentials = gaxi::options::Credentials;
533 async fn build(
534 self,
535 config: gaxi::options::ClientConfig,
536 ) -> gax::client_builder::Result<Self::Client> {
537 Self::Client::new(config).await
538 }
539 }
540 }
541
542 /// Common implementation for [crate::client::GroupService] request builders.
543 #[derive(Clone, Debug)]
544 pub(crate) struct RequestBuilder<R: std::default::Default> {
545 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
546 request: R,
547 options: gax::options::RequestOptions,
548 }
549
550 impl<R> RequestBuilder<R>
551 where
552 R: std::default::Default,
553 {
554 pub(crate) fn new(
555 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
556 ) -> Self {
557 Self {
558 stub,
559 request: R::default(),
560 options: gax::options::RequestOptions::default(),
561 }
562 }
563 }
564
565 /// The request builder for [GroupService::list_groups][crate::client::GroupService::list_groups] calls.
566 ///
567 /// # Example
568 /// ```no_run
569 /// # use google_cloud_monitoring_v3::builder;
570 /// use builder::group_service::ListGroups;
571 /// # tokio_test::block_on(async {
572 /// use gax::paginator::ItemPaginator;
573 ///
574 /// let builder = prepare_request_builder();
575 /// let mut items = builder.by_item();
576 /// while let Some(result) = items.next().await {
577 /// let item = result?;
578 /// }
579 /// # gax::Result::<()>::Ok(()) });
580 ///
581 /// fn prepare_request_builder() -> ListGroups {
582 /// # panic!();
583 /// // ... details omitted ...
584 /// }
585 /// ```
586 #[derive(Clone, Debug)]
587 pub struct ListGroups(RequestBuilder<crate::model::ListGroupsRequest>);
588
589 impl ListGroups {
590 pub(crate) fn new(
591 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
592 ) -> Self {
593 Self(RequestBuilder::new(stub))
594 }
595
596 /// Sets the full request, replacing any prior values.
597 pub fn with_request<V: Into<crate::model::ListGroupsRequest>>(mut self, v: V) -> Self {
598 self.0.request = v.into();
599 self
600 }
601
602 /// Sets all the options, replacing any prior values.
603 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
604 self.0.options = v.into();
605 self
606 }
607
608 /// Sends the request.
609 pub async fn send(self) -> Result<crate::model::ListGroupsResponse> {
610 (*self.0.stub)
611 .list_groups(self.0.request, self.0.options)
612 .await
613 .map(gax::response::Response::into_body)
614 }
615
616 /// Streams each page in the collection.
617 pub fn by_page(
618 self,
619 ) -> impl gax::paginator::Paginator<crate::model::ListGroupsResponse, gax::error::Error>
620 {
621 use std::clone::Clone;
622 let token = self.0.request.page_token.clone();
623 let execute = move |token: String| {
624 let mut builder = self.clone();
625 builder.0.request = builder.0.request.set_page_token(token);
626 builder.send()
627 };
628 gax::paginator::internal::new_paginator(token, execute)
629 }
630
631 /// Streams each item in the collection.
632 pub fn by_item(
633 self,
634 ) -> impl gax::paginator::ItemPaginator<crate::model::ListGroupsResponse, gax::error::Error>
635 {
636 use gax::paginator::Paginator;
637 self.by_page().items()
638 }
639
640 /// Sets the value of [name][crate::model::ListGroupsRequest::name].
641 ///
642 /// This is a **required** field for requests.
643 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
644 self.0.request.name = v.into();
645 self
646 }
647
648 /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
649 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
650 self.0.request.page_size = v.into();
651 self
652 }
653
654 /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
655 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
656 self.0.request.page_token = v.into();
657 self
658 }
659
660 /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
661 ///
662 /// Note that all the setters affecting `filter` are
663 /// mutually exclusive.
664 pub fn set_filter<T: Into<Option<crate::model::list_groups_request::Filter>>>(
665 mut self,
666 v: T,
667 ) -> Self {
668 self.0.request.filter = v.into();
669 self
670 }
671
672 /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
673 /// to hold a `ChildrenOfGroup`.
674 ///
675 /// Note that all the setters affecting `filter` are
676 /// mutually exclusive.
677 pub fn set_children_of_group<T: std::convert::Into<std::string::String>>(
678 mut self,
679 v: T,
680 ) -> Self {
681 self.0.request = self.0.request.set_children_of_group(v);
682 self
683 }
684
685 /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
686 /// to hold a `AncestorsOfGroup`.
687 ///
688 /// Note that all the setters affecting `filter` are
689 /// mutually exclusive.
690 pub fn set_ancestors_of_group<T: std::convert::Into<std::string::String>>(
691 mut self,
692 v: T,
693 ) -> Self {
694 self.0.request = self.0.request.set_ancestors_of_group(v);
695 self
696 }
697
698 /// Sets the value of [filter][crate::model::ListGroupsRequest::filter]
699 /// to hold a `DescendantsOfGroup`.
700 ///
701 /// Note that all the setters affecting `filter` are
702 /// mutually exclusive.
703 pub fn set_descendants_of_group<T: std::convert::Into<std::string::String>>(
704 mut self,
705 v: T,
706 ) -> Self {
707 self.0.request = self.0.request.set_descendants_of_group(v);
708 self
709 }
710 }
711
712 #[doc(hidden)]
713 impl gax::options::internal::RequestBuilder for ListGroups {
714 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
715 &mut self.0.options
716 }
717 }
718
719 /// The request builder for [GroupService::get_group][crate::client::GroupService::get_group] calls.
720 ///
721 /// # Example
722 /// ```no_run
723 /// # use google_cloud_monitoring_v3::builder;
724 /// use builder::group_service::GetGroup;
725 /// # tokio_test::block_on(async {
726 ///
727 /// let builder = prepare_request_builder();
728 /// let response = builder.send().await?;
729 /// # gax::Result::<()>::Ok(()) });
730 ///
731 /// fn prepare_request_builder() -> GetGroup {
732 /// # panic!();
733 /// // ... details omitted ...
734 /// }
735 /// ```
736 #[derive(Clone, Debug)]
737 pub struct GetGroup(RequestBuilder<crate::model::GetGroupRequest>);
738
739 impl GetGroup {
740 pub(crate) fn new(
741 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
742 ) -> Self {
743 Self(RequestBuilder::new(stub))
744 }
745
746 /// Sets the full request, replacing any prior values.
747 pub fn with_request<V: Into<crate::model::GetGroupRequest>>(mut self, v: V) -> Self {
748 self.0.request = v.into();
749 self
750 }
751
752 /// Sets all the options, replacing any prior values.
753 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
754 self.0.options = v.into();
755 self
756 }
757
758 /// Sends the request.
759 pub async fn send(self) -> Result<crate::model::Group> {
760 (*self.0.stub)
761 .get_group(self.0.request, self.0.options)
762 .await
763 .map(gax::response::Response::into_body)
764 }
765
766 /// Sets the value of [name][crate::model::GetGroupRequest::name].
767 ///
768 /// This is a **required** field for requests.
769 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
770 self.0.request.name = v.into();
771 self
772 }
773 }
774
775 #[doc(hidden)]
776 impl gax::options::internal::RequestBuilder for GetGroup {
777 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
778 &mut self.0.options
779 }
780 }
781
782 /// The request builder for [GroupService::create_group][crate::client::GroupService::create_group] calls.
783 ///
784 /// # Example
785 /// ```no_run
786 /// # use google_cloud_monitoring_v3::builder;
787 /// use builder::group_service::CreateGroup;
788 /// # tokio_test::block_on(async {
789 ///
790 /// let builder = prepare_request_builder();
791 /// let response = builder.send().await?;
792 /// # gax::Result::<()>::Ok(()) });
793 ///
794 /// fn prepare_request_builder() -> CreateGroup {
795 /// # panic!();
796 /// // ... details omitted ...
797 /// }
798 /// ```
799 #[derive(Clone, Debug)]
800 pub struct CreateGroup(RequestBuilder<crate::model::CreateGroupRequest>);
801
802 impl CreateGroup {
803 pub(crate) fn new(
804 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
805 ) -> Self {
806 Self(RequestBuilder::new(stub))
807 }
808
809 /// Sets the full request, replacing any prior values.
810 pub fn with_request<V: Into<crate::model::CreateGroupRequest>>(mut self, v: V) -> Self {
811 self.0.request = v.into();
812 self
813 }
814
815 /// Sets all the options, replacing any prior values.
816 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
817 self.0.options = v.into();
818 self
819 }
820
821 /// Sends the request.
822 pub async fn send(self) -> Result<crate::model::Group> {
823 (*self.0.stub)
824 .create_group(self.0.request, self.0.options)
825 .await
826 .map(gax::response::Response::into_body)
827 }
828
829 /// Sets the value of [name][crate::model::CreateGroupRequest::name].
830 ///
831 /// This is a **required** field for requests.
832 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
833 self.0.request.name = v.into();
834 self
835 }
836
837 /// Sets the value of [group][crate::model::CreateGroupRequest::group].
838 ///
839 /// This is a **required** field for requests.
840 pub fn set_group<T>(mut self, v: T) -> Self
841 where
842 T: std::convert::Into<crate::model::Group>,
843 {
844 self.0.request.group = std::option::Option::Some(v.into());
845 self
846 }
847
848 /// Sets or clears the value of [group][crate::model::CreateGroupRequest::group].
849 ///
850 /// This is a **required** field for requests.
851 pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
852 where
853 T: std::convert::Into<crate::model::Group>,
854 {
855 self.0.request.group = v.map(|x| x.into());
856 self
857 }
858
859 /// Sets the value of [validate_only][crate::model::CreateGroupRequest::validate_only].
860 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
861 self.0.request.validate_only = v.into();
862 self
863 }
864 }
865
866 #[doc(hidden)]
867 impl gax::options::internal::RequestBuilder for CreateGroup {
868 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
869 &mut self.0.options
870 }
871 }
872
873 /// The request builder for [GroupService::update_group][crate::client::GroupService::update_group] calls.
874 ///
875 /// # Example
876 /// ```no_run
877 /// # use google_cloud_monitoring_v3::builder;
878 /// use builder::group_service::UpdateGroup;
879 /// # tokio_test::block_on(async {
880 ///
881 /// let builder = prepare_request_builder();
882 /// let response = builder.send().await?;
883 /// # gax::Result::<()>::Ok(()) });
884 ///
885 /// fn prepare_request_builder() -> UpdateGroup {
886 /// # panic!();
887 /// // ... details omitted ...
888 /// }
889 /// ```
890 #[derive(Clone, Debug)]
891 pub struct UpdateGroup(RequestBuilder<crate::model::UpdateGroupRequest>);
892
893 impl UpdateGroup {
894 pub(crate) fn new(
895 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
896 ) -> Self {
897 Self(RequestBuilder::new(stub))
898 }
899
900 /// Sets the full request, replacing any prior values.
901 pub fn with_request<V: Into<crate::model::UpdateGroupRequest>>(mut self, v: V) -> Self {
902 self.0.request = v.into();
903 self
904 }
905
906 /// Sets all the options, replacing any prior values.
907 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
908 self.0.options = v.into();
909 self
910 }
911
912 /// Sends the request.
913 pub async fn send(self) -> Result<crate::model::Group> {
914 (*self.0.stub)
915 .update_group(self.0.request, self.0.options)
916 .await
917 .map(gax::response::Response::into_body)
918 }
919
920 /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
921 ///
922 /// This is a **required** field for requests.
923 pub fn set_group<T>(mut self, v: T) -> Self
924 where
925 T: std::convert::Into<crate::model::Group>,
926 {
927 self.0.request.group = std::option::Option::Some(v.into());
928 self
929 }
930
931 /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
932 ///
933 /// This is a **required** field for requests.
934 pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
935 where
936 T: std::convert::Into<crate::model::Group>,
937 {
938 self.0.request.group = v.map(|x| x.into());
939 self
940 }
941
942 /// Sets the value of [validate_only][crate::model::UpdateGroupRequest::validate_only].
943 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
944 self.0.request.validate_only = v.into();
945 self
946 }
947 }
948
949 #[doc(hidden)]
950 impl gax::options::internal::RequestBuilder for UpdateGroup {
951 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
952 &mut self.0.options
953 }
954 }
955
956 /// The request builder for [GroupService::delete_group][crate::client::GroupService::delete_group] calls.
957 ///
958 /// # Example
959 /// ```no_run
960 /// # use google_cloud_monitoring_v3::builder;
961 /// use builder::group_service::DeleteGroup;
962 /// # tokio_test::block_on(async {
963 ///
964 /// let builder = prepare_request_builder();
965 /// let response = builder.send().await?;
966 /// # gax::Result::<()>::Ok(()) });
967 ///
968 /// fn prepare_request_builder() -> DeleteGroup {
969 /// # panic!();
970 /// // ... details omitted ...
971 /// }
972 /// ```
973 #[derive(Clone, Debug)]
974 pub struct DeleteGroup(RequestBuilder<crate::model::DeleteGroupRequest>);
975
976 impl DeleteGroup {
977 pub(crate) fn new(
978 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
979 ) -> Self {
980 Self(RequestBuilder::new(stub))
981 }
982
983 /// Sets the full request, replacing any prior values.
984 pub fn with_request<V: Into<crate::model::DeleteGroupRequest>>(mut self, v: V) -> Self {
985 self.0.request = v.into();
986 self
987 }
988
989 /// Sets all the options, replacing any prior values.
990 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
991 self.0.options = v.into();
992 self
993 }
994
995 /// Sends the request.
996 pub async fn send(self) -> Result<()> {
997 (*self.0.stub)
998 .delete_group(self.0.request, self.0.options)
999 .await
1000 .map(gax::response::Response::into_body)
1001 }
1002
1003 /// Sets the value of [name][crate::model::DeleteGroupRequest::name].
1004 ///
1005 /// This is a **required** field for requests.
1006 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1007 self.0.request.name = v.into();
1008 self
1009 }
1010
1011 /// Sets the value of [recursive][crate::model::DeleteGroupRequest::recursive].
1012 pub fn set_recursive<T: Into<bool>>(mut self, v: T) -> Self {
1013 self.0.request.recursive = v.into();
1014 self
1015 }
1016 }
1017
1018 #[doc(hidden)]
1019 impl gax::options::internal::RequestBuilder for DeleteGroup {
1020 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1021 &mut self.0.options
1022 }
1023 }
1024
1025 /// The request builder for [GroupService::list_group_members][crate::client::GroupService::list_group_members] calls.
1026 ///
1027 /// # Example
1028 /// ```no_run
1029 /// # use google_cloud_monitoring_v3::builder;
1030 /// use builder::group_service::ListGroupMembers;
1031 /// # tokio_test::block_on(async {
1032 /// use gax::paginator::ItemPaginator;
1033 ///
1034 /// let builder = prepare_request_builder();
1035 /// let mut items = builder.by_item();
1036 /// while let Some(result) = items.next().await {
1037 /// let item = result?;
1038 /// }
1039 /// # gax::Result::<()>::Ok(()) });
1040 ///
1041 /// fn prepare_request_builder() -> ListGroupMembers {
1042 /// # panic!();
1043 /// // ... details omitted ...
1044 /// }
1045 /// ```
1046 #[derive(Clone, Debug)]
1047 pub struct ListGroupMembers(RequestBuilder<crate::model::ListGroupMembersRequest>);
1048
1049 impl ListGroupMembers {
1050 pub(crate) fn new(
1051 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroupService>,
1052 ) -> Self {
1053 Self(RequestBuilder::new(stub))
1054 }
1055
1056 /// Sets the full request, replacing any prior values.
1057 pub fn with_request<V: Into<crate::model::ListGroupMembersRequest>>(
1058 mut self,
1059 v: V,
1060 ) -> Self {
1061 self.0.request = v.into();
1062 self
1063 }
1064
1065 /// Sets all the options, replacing any prior values.
1066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1067 self.0.options = v.into();
1068 self
1069 }
1070
1071 /// Sends the request.
1072 pub async fn send(self) -> Result<crate::model::ListGroupMembersResponse> {
1073 (*self.0.stub)
1074 .list_group_members(self.0.request, self.0.options)
1075 .await
1076 .map(gax::response::Response::into_body)
1077 }
1078
1079 /// Streams each page in the collection.
1080 pub fn by_page(
1081 self,
1082 ) -> impl gax::paginator::Paginator<crate::model::ListGroupMembersResponse, gax::error::Error>
1083 {
1084 use std::clone::Clone;
1085 let token = self.0.request.page_token.clone();
1086 let execute = move |token: String| {
1087 let mut builder = self.clone();
1088 builder.0.request = builder.0.request.set_page_token(token);
1089 builder.send()
1090 };
1091 gax::paginator::internal::new_paginator(token, execute)
1092 }
1093
1094 /// Streams each item in the collection.
1095 pub fn by_item(
1096 self,
1097 ) -> impl gax::paginator::ItemPaginator<crate::model::ListGroupMembersResponse, gax::error::Error>
1098 {
1099 use gax::paginator::Paginator;
1100 self.by_page().items()
1101 }
1102
1103 /// Sets the value of [name][crate::model::ListGroupMembersRequest::name].
1104 ///
1105 /// This is a **required** field for requests.
1106 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1107 self.0.request.name = v.into();
1108 self
1109 }
1110
1111 /// Sets the value of [page_size][crate::model::ListGroupMembersRequest::page_size].
1112 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1113 self.0.request.page_size = v.into();
1114 self
1115 }
1116
1117 /// Sets the value of [page_token][crate::model::ListGroupMembersRequest::page_token].
1118 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1119 self.0.request.page_token = v.into();
1120 self
1121 }
1122
1123 /// Sets the value of [filter][crate::model::ListGroupMembersRequest::filter].
1124 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1125 self.0.request.filter = v.into();
1126 self
1127 }
1128
1129 /// Sets the value of [interval][crate::model::ListGroupMembersRequest::interval].
1130 pub fn set_interval<T>(mut self, v: T) -> Self
1131 where
1132 T: std::convert::Into<crate::model::TimeInterval>,
1133 {
1134 self.0.request.interval = std::option::Option::Some(v.into());
1135 self
1136 }
1137
1138 /// Sets or clears the value of [interval][crate::model::ListGroupMembersRequest::interval].
1139 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
1140 where
1141 T: std::convert::Into<crate::model::TimeInterval>,
1142 {
1143 self.0.request.interval = v.map(|x| x.into());
1144 self
1145 }
1146 }
1147
1148 #[doc(hidden)]
1149 impl gax::options::internal::RequestBuilder for ListGroupMembers {
1150 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1151 &mut self.0.options
1152 }
1153 }
1154}
1155
1156pub mod metric_service {
1157 use crate::Result;
1158
1159 /// A builder for [MetricService][crate::client::MetricService].
1160 ///
1161 /// ```
1162 /// # tokio_test::block_on(async {
1163 /// # use google_cloud_monitoring_v3::*;
1164 /// # use builder::metric_service::ClientBuilder;
1165 /// # use client::MetricService;
1166 /// let builder : ClientBuilder = MetricService::builder();
1167 /// let client = builder
1168 /// .with_endpoint("https://monitoring.googleapis.com")
1169 /// .build().await?;
1170 /// # gax::client_builder::Result::<()>::Ok(()) });
1171 /// ```
1172 pub type ClientBuilder =
1173 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1174
1175 pub(crate) mod client {
1176 use super::super::super::client::MetricService;
1177 pub struct Factory;
1178 impl gax::client_builder::internal::ClientFactory for Factory {
1179 type Client = MetricService;
1180 type Credentials = gaxi::options::Credentials;
1181 async fn build(
1182 self,
1183 config: gaxi::options::ClientConfig,
1184 ) -> gax::client_builder::Result<Self::Client> {
1185 Self::Client::new(config).await
1186 }
1187 }
1188 }
1189
1190 /// Common implementation for [crate::client::MetricService] request builders.
1191 #[derive(Clone, Debug)]
1192 pub(crate) struct RequestBuilder<R: std::default::Default> {
1193 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1194 request: R,
1195 options: gax::options::RequestOptions,
1196 }
1197
1198 impl<R> RequestBuilder<R>
1199 where
1200 R: std::default::Default,
1201 {
1202 pub(crate) fn new(
1203 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1204 ) -> Self {
1205 Self {
1206 stub,
1207 request: R::default(),
1208 options: gax::options::RequestOptions::default(),
1209 }
1210 }
1211 }
1212
1213 /// The request builder for [MetricService::list_monitored_resource_descriptors][crate::client::MetricService::list_monitored_resource_descriptors] calls.
1214 ///
1215 /// # Example
1216 /// ```no_run
1217 /// # use google_cloud_monitoring_v3::builder;
1218 /// use builder::metric_service::ListMonitoredResourceDescriptors;
1219 /// # tokio_test::block_on(async {
1220 /// use gax::paginator::ItemPaginator;
1221 ///
1222 /// let builder = prepare_request_builder();
1223 /// let mut items = builder.by_item();
1224 /// while let Some(result) = items.next().await {
1225 /// let item = result?;
1226 /// }
1227 /// # gax::Result::<()>::Ok(()) });
1228 ///
1229 /// fn prepare_request_builder() -> ListMonitoredResourceDescriptors {
1230 /// # panic!();
1231 /// // ... details omitted ...
1232 /// }
1233 /// ```
1234 #[derive(Clone, Debug)]
1235 pub struct ListMonitoredResourceDescriptors(
1236 RequestBuilder<crate::model::ListMonitoredResourceDescriptorsRequest>,
1237 );
1238
1239 impl ListMonitoredResourceDescriptors {
1240 pub(crate) fn new(
1241 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1242 ) -> Self {
1243 Self(RequestBuilder::new(stub))
1244 }
1245
1246 /// Sets the full request, replacing any prior values.
1247 pub fn with_request<V: Into<crate::model::ListMonitoredResourceDescriptorsRequest>>(
1248 mut self,
1249 v: V,
1250 ) -> Self {
1251 self.0.request = v.into();
1252 self
1253 }
1254
1255 /// Sets all the options, replacing any prior values.
1256 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1257 self.0.options = v.into();
1258 self
1259 }
1260
1261 /// Sends the request.
1262 pub async fn send(self) -> Result<crate::model::ListMonitoredResourceDescriptorsResponse> {
1263 (*self.0.stub)
1264 .list_monitored_resource_descriptors(self.0.request, self.0.options)
1265 .await
1266 .map(gax::response::Response::into_body)
1267 }
1268
1269 /// Streams each page in the collection.
1270 pub fn by_page(
1271 self,
1272 ) -> impl gax::paginator::Paginator<
1273 crate::model::ListMonitoredResourceDescriptorsResponse,
1274 gax::error::Error,
1275 > {
1276 use std::clone::Clone;
1277 let token = self.0.request.page_token.clone();
1278 let execute = move |token: String| {
1279 let mut builder = self.clone();
1280 builder.0.request = builder.0.request.set_page_token(token);
1281 builder.send()
1282 };
1283 gax::paginator::internal::new_paginator(token, execute)
1284 }
1285
1286 /// Streams each item in the collection.
1287 pub fn by_item(
1288 self,
1289 ) -> impl gax::paginator::ItemPaginator<
1290 crate::model::ListMonitoredResourceDescriptorsResponse,
1291 gax::error::Error,
1292 > {
1293 use gax::paginator::Paginator;
1294 self.by_page().items()
1295 }
1296
1297 /// Sets the value of [name][crate::model::ListMonitoredResourceDescriptorsRequest::name].
1298 ///
1299 /// This is a **required** field for requests.
1300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1301 self.0.request.name = v.into();
1302 self
1303 }
1304
1305 /// Sets the value of [filter][crate::model::ListMonitoredResourceDescriptorsRequest::filter].
1306 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1307 self.0.request.filter = v.into();
1308 self
1309 }
1310
1311 /// Sets the value of [page_size][crate::model::ListMonitoredResourceDescriptorsRequest::page_size].
1312 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1313 self.0.request.page_size = v.into();
1314 self
1315 }
1316
1317 /// Sets the value of [page_token][crate::model::ListMonitoredResourceDescriptorsRequest::page_token].
1318 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1319 self.0.request.page_token = v.into();
1320 self
1321 }
1322 }
1323
1324 #[doc(hidden)]
1325 impl gax::options::internal::RequestBuilder for ListMonitoredResourceDescriptors {
1326 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1327 &mut self.0.options
1328 }
1329 }
1330
1331 /// The request builder for [MetricService::get_monitored_resource_descriptor][crate::client::MetricService::get_monitored_resource_descriptor] calls.
1332 ///
1333 /// # Example
1334 /// ```no_run
1335 /// # use google_cloud_monitoring_v3::builder;
1336 /// use builder::metric_service::GetMonitoredResourceDescriptor;
1337 /// # tokio_test::block_on(async {
1338 ///
1339 /// let builder = prepare_request_builder();
1340 /// let response = builder.send().await?;
1341 /// # gax::Result::<()>::Ok(()) });
1342 ///
1343 /// fn prepare_request_builder() -> GetMonitoredResourceDescriptor {
1344 /// # panic!();
1345 /// // ... details omitted ...
1346 /// }
1347 /// ```
1348 #[derive(Clone, Debug)]
1349 pub struct GetMonitoredResourceDescriptor(
1350 RequestBuilder<crate::model::GetMonitoredResourceDescriptorRequest>,
1351 );
1352
1353 impl GetMonitoredResourceDescriptor {
1354 pub(crate) fn new(
1355 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1356 ) -> Self {
1357 Self(RequestBuilder::new(stub))
1358 }
1359
1360 /// Sets the full request, replacing any prior values.
1361 pub fn with_request<V: Into<crate::model::GetMonitoredResourceDescriptorRequest>>(
1362 mut self,
1363 v: V,
1364 ) -> Self {
1365 self.0.request = v.into();
1366 self
1367 }
1368
1369 /// Sets all the options, replacing any prior values.
1370 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1371 self.0.options = v.into();
1372 self
1373 }
1374
1375 /// Sends the request.
1376 pub async fn send(self) -> Result<api::model::MonitoredResourceDescriptor> {
1377 (*self.0.stub)
1378 .get_monitored_resource_descriptor(self.0.request, self.0.options)
1379 .await
1380 .map(gax::response::Response::into_body)
1381 }
1382
1383 /// Sets the value of [name][crate::model::GetMonitoredResourceDescriptorRequest::name].
1384 ///
1385 /// This is a **required** field for requests.
1386 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1387 self.0.request.name = v.into();
1388 self
1389 }
1390 }
1391
1392 #[doc(hidden)]
1393 impl gax::options::internal::RequestBuilder for GetMonitoredResourceDescriptor {
1394 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1395 &mut self.0.options
1396 }
1397 }
1398
1399 /// The request builder for [MetricService::list_metric_descriptors][crate::client::MetricService::list_metric_descriptors] calls.
1400 ///
1401 /// # Example
1402 /// ```no_run
1403 /// # use google_cloud_monitoring_v3::builder;
1404 /// use builder::metric_service::ListMetricDescriptors;
1405 /// # tokio_test::block_on(async {
1406 /// use gax::paginator::ItemPaginator;
1407 ///
1408 /// let builder = prepare_request_builder();
1409 /// let mut items = builder.by_item();
1410 /// while let Some(result) = items.next().await {
1411 /// let item = result?;
1412 /// }
1413 /// # gax::Result::<()>::Ok(()) });
1414 ///
1415 /// fn prepare_request_builder() -> ListMetricDescriptors {
1416 /// # panic!();
1417 /// // ... details omitted ...
1418 /// }
1419 /// ```
1420 #[derive(Clone, Debug)]
1421 pub struct ListMetricDescriptors(RequestBuilder<crate::model::ListMetricDescriptorsRequest>);
1422
1423 impl ListMetricDescriptors {
1424 pub(crate) fn new(
1425 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1426 ) -> Self {
1427 Self(RequestBuilder::new(stub))
1428 }
1429
1430 /// Sets the full request, replacing any prior values.
1431 pub fn with_request<V: Into<crate::model::ListMetricDescriptorsRequest>>(
1432 mut self,
1433 v: V,
1434 ) -> Self {
1435 self.0.request = v.into();
1436 self
1437 }
1438
1439 /// Sets all the options, replacing any prior values.
1440 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1441 self.0.options = v.into();
1442 self
1443 }
1444
1445 /// Sends the request.
1446 pub async fn send(self) -> Result<crate::model::ListMetricDescriptorsResponse> {
1447 (*self.0.stub)
1448 .list_metric_descriptors(self.0.request, self.0.options)
1449 .await
1450 .map(gax::response::Response::into_body)
1451 }
1452
1453 /// Streams each page in the collection.
1454 pub fn by_page(
1455 self,
1456 ) -> impl gax::paginator::Paginator<crate::model::ListMetricDescriptorsResponse, gax::error::Error>
1457 {
1458 use std::clone::Clone;
1459 let token = self.0.request.page_token.clone();
1460 let execute = move |token: String| {
1461 let mut builder = self.clone();
1462 builder.0.request = builder.0.request.set_page_token(token);
1463 builder.send()
1464 };
1465 gax::paginator::internal::new_paginator(token, execute)
1466 }
1467
1468 /// Streams each item in the collection.
1469 pub fn by_item(
1470 self,
1471 ) -> impl gax::paginator::ItemPaginator<
1472 crate::model::ListMetricDescriptorsResponse,
1473 gax::error::Error,
1474 > {
1475 use gax::paginator::Paginator;
1476 self.by_page().items()
1477 }
1478
1479 /// Sets the value of [name][crate::model::ListMetricDescriptorsRequest::name].
1480 ///
1481 /// This is a **required** field for requests.
1482 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1483 self.0.request.name = v.into();
1484 self
1485 }
1486
1487 /// Sets the value of [filter][crate::model::ListMetricDescriptorsRequest::filter].
1488 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1489 self.0.request.filter = v.into();
1490 self
1491 }
1492
1493 /// Sets the value of [page_size][crate::model::ListMetricDescriptorsRequest::page_size].
1494 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1495 self.0.request.page_size = v.into();
1496 self
1497 }
1498
1499 /// Sets the value of [page_token][crate::model::ListMetricDescriptorsRequest::page_token].
1500 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1501 self.0.request.page_token = v.into();
1502 self
1503 }
1504
1505 /// Sets the value of [active_only][crate::model::ListMetricDescriptorsRequest::active_only].
1506 pub fn set_active_only<T: Into<bool>>(mut self, v: T) -> Self {
1507 self.0.request.active_only = v.into();
1508 self
1509 }
1510 }
1511
1512 #[doc(hidden)]
1513 impl gax::options::internal::RequestBuilder for ListMetricDescriptors {
1514 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1515 &mut self.0.options
1516 }
1517 }
1518
1519 /// The request builder for [MetricService::get_metric_descriptor][crate::client::MetricService::get_metric_descriptor] calls.
1520 ///
1521 /// # Example
1522 /// ```no_run
1523 /// # use google_cloud_monitoring_v3::builder;
1524 /// use builder::metric_service::GetMetricDescriptor;
1525 /// # tokio_test::block_on(async {
1526 ///
1527 /// let builder = prepare_request_builder();
1528 /// let response = builder.send().await?;
1529 /// # gax::Result::<()>::Ok(()) });
1530 ///
1531 /// fn prepare_request_builder() -> GetMetricDescriptor {
1532 /// # panic!();
1533 /// // ... details omitted ...
1534 /// }
1535 /// ```
1536 #[derive(Clone, Debug)]
1537 pub struct GetMetricDescriptor(RequestBuilder<crate::model::GetMetricDescriptorRequest>);
1538
1539 impl GetMetricDescriptor {
1540 pub(crate) fn new(
1541 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1542 ) -> Self {
1543 Self(RequestBuilder::new(stub))
1544 }
1545
1546 /// Sets the full request, replacing any prior values.
1547 pub fn with_request<V: Into<crate::model::GetMetricDescriptorRequest>>(
1548 mut self,
1549 v: V,
1550 ) -> Self {
1551 self.0.request = v.into();
1552 self
1553 }
1554
1555 /// Sets all the options, replacing any prior values.
1556 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1557 self.0.options = v.into();
1558 self
1559 }
1560
1561 /// Sends the request.
1562 pub async fn send(self) -> Result<api::model::MetricDescriptor> {
1563 (*self.0.stub)
1564 .get_metric_descriptor(self.0.request, self.0.options)
1565 .await
1566 .map(gax::response::Response::into_body)
1567 }
1568
1569 /// Sets the value of [name][crate::model::GetMetricDescriptorRequest::name].
1570 ///
1571 /// This is a **required** field for requests.
1572 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1573 self.0.request.name = v.into();
1574 self
1575 }
1576 }
1577
1578 #[doc(hidden)]
1579 impl gax::options::internal::RequestBuilder for GetMetricDescriptor {
1580 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1581 &mut self.0.options
1582 }
1583 }
1584
1585 /// The request builder for [MetricService::create_metric_descriptor][crate::client::MetricService::create_metric_descriptor] calls.
1586 ///
1587 /// # Example
1588 /// ```no_run
1589 /// # use google_cloud_monitoring_v3::builder;
1590 /// use builder::metric_service::CreateMetricDescriptor;
1591 /// # tokio_test::block_on(async {
1592 ///
1593 /// let builder = prepare_request_builder();
1594 /// let response = builder.send().await?;
1595 /// # gax::Result::<()>::Ok(()) });
1596 ///
1597 /// fn prepare_request_builder() -> CreateMetricDescriptor {
1598 /// # panic!();
1599 /// // ... details omitted ...
1600 /// }
1601 /// ```
1602 #[derive(Clone, Debug)]
1603 pub struct CreateMetricDescriptor(RequestBuilder<crate::model::CreateMetricDescriptorRequest>);
1604
1605 impl CreateMetricDescriptor {
1606 pub(crate) fn new(
1607 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1608 ) -> Self {
1609 Self(RequestBuilder::new(stub))
1610 }
1611
1612 /// Sets the full request, replacing any prior values.
1613 pub fn with_request<V: Into<crate::model::CreateMetricDescriptorRequest>>(
1614 mut self,
1615 v: V,
1616 ) -> Self {
1617 self.0.request = v.into();
1618 self
1619 }
1620
1621 /// Sets all the options, replacing any prior values.
1622 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1623 self.0.options = v.into();
1624 self
1625 }
1626
1627 /// Sends the request.
1628 pub async fn send(self) -> Result<api::model::MetricDescriptor> {
1629 (*self.0.stub)
1630 .create_metric_descriptor(self.0.request, self.0.options)
1631 .await
1632 .map(gax::response::Response::into_body)
1633 }
1634
1635 /// Sets the value of [name][crate::model::CreateMetricDescriptorRequest::name].
1636 ///
1637 /// This is a **required** field for requests.
1638 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1639 self.0.request.name = v.into();
1640 self
1641 }
1642
1643 /// Sets the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
1644 ///
1645 /// This is a **required** field for requests.
1646 pub fn set_metric_descriptor<T>(mut self, v: T) -> Self
1647 where
1648 T: std::convert::Into<api::model::MetricDescriptor>,
1649 {
1650 self.0.request.metric_descriptor = std::option::Option::Some(v.into());
1651 self
1652 }
1653
1654 /// Sets or clears the value of [metric_descriptor][crate::model::CreateMetricDescriptorRequest::metric_descriptor].
1655 ///
1656 /// This is a **required** field for requests.
1657 pub fn set_or_clear_metric_descriptor<T>(mut self, v: std::option::Option<T>) -> Self
1658 where
1659 T: std::convert::Into<api::model::MetricDescriptor>,
1660 {
1661 self.0.request.metric_descriptor = v.map(|x| x.into());
1662 self
1663 }
1664 }
1665
1666 #[doc(hidden)]
1667 impl gax::options::internal::RequestBuilder for CreateMetricDescriptor {
1668 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1669 &mut self.0.options
1670 }
1671 }
1672
1673 /// The request builder for [MetricService::delete_metric_descriptor][crate::client::MetricService::delete_metric_descriptor] calls.
1674 ///
1675 /// # Example
1676 /// ```no_run
1677 /// # use google_cloud_monitoring_v3::builder;
1678 /// use builder::metric_service::DeleteMetricDescriptor;
1679 /// # tokio_test::block_on(async {
1680 ///
1681 /// let builder = prepare_request_builder();
1682 /// let response = builder.send().await?;
1683 /// # gax::Result::<()>::Ok(()) });
1684 ///
1685 /// fn prepare_request_builder() -> DeleteMetricDescriptor {
1686 /// # panic!();
1687 /// // ... details omitted ...
1688 /// }
1689 /// ```
1690 #[derive(Clone, Debug)]
1691 pub struct DeleteMetricDescriptor(RequestBuilder<crate::model::DeleteMetricDescriptorRequest>);
1692
1693 impl DeleteMetricDescriptor {
1694 pub(crate) fn new(
1695 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1696 ) -> Self {
1697 Self(RequestBuilder::new(stub))
1698 }
1699
1700 /// Sets the full request, replacing any prior values.
1701 pub fn with_request<V: Into<crate::model::DeleteMetricDescriptorRequest>>(
1702 mut self,
1703 v: V,
1704 ) -> Self {
1705 self.0.request = v.into();
1706 self
1707 }
1708
1709 /// Sets all the options, replacing any prior values.
1710 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1711 self.0.options = v.into();
1712 self
1713 }
1714
1715 /// Sends the request.
1716 pub async fn send(self) -> Result<()> {
1717 (*self.0.stub)
1718 .delete_metric_descriptor(self.0.request, self.0.options)
1719 .await
1720 .map(gax::response::Response::into_body)
1721 }
1722
1723 /// Sets the value of [name][crate::model::DeleteMetricDescriptorRequest::name].
1724 ///
1725 /// This is a **required** field for requests.
1726 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1727 self.0.request.name = v.into();
1728 self
1729 }
1730 }
1731
1732 #[doc(hidden)]
1733 impl gax::options::internal::RequestBuilder for DeleteMetricDescriptor {
1734 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1735 &mut self.0.options
1736 }
1737 }
1738
1739 /// The request builder for [MetricService::list_time_series][crate::client::MetricService::list_time_series] calls.
1740 ///
1741 /// # Example
1742 /// ```no_run
1743 /// # use google_cloud_monitoring_v3::builder;
1744 /// use builder::metric_service::ListTimeSeries;
1745 /// # tokio_test::block_on(async {
1746 /// use gax::paginator::ItemPaginator;
1747 ///
1748 /// let builder = prepare_request_builder();
1749 /// let mut items = builder.by_item();
1750 /// while let Some(result) = items.next().await {
1751 /// let item = result?;
1752 /// }
1753 /// # gax::Result::<()>::Ok(()) });
1754 ///
1755 /// fn prepare_request_builder() -> ListTimeSeries {
1756 /// # panic!();
1757 /// // ... details omitted ...
1758 /// }
1759 /// ```
1760 #[derive(Clone, Debug)]
1761 pub struct ListTimeSeries(RequestBuilder<crate::model::ListTimeSeriesRequest>);
1762
1763 impl ListTimeSeries {
1764 pub(crate) fn new(
1765 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1766 ) -> Self {
1767 Self(RequestBuilder::new(stub))
1768 }
1769
1770 /// Sets the full request, replacing any prior values.
1771 pub fn with_request<V: Into<crate::model::ListTimeSeriesRequest>>(mut self, v: V) -> Self {
1772 self.0.request = v.into();
1773 self
1774 }
1775
1776 /// Sets all the options, replacing any prior values.
1777 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1778 self.0.options = v.into();
1779 self
1780 }
1781
1782 /// Sends the request.
1783 pub async fn send(self) -> Result<crate::model::ListTimeSeriesResponse> {
1784 (*self.0.stub)
1785 .list_time_series(self.0.request, self.0.options)
1786 .await
1787 .map(gax::response::Response::into_body)
1788 }
1789
1790 /// Streams each page in the collection.
1791 pub fn by_page(
1792 self,
1793 ) -> impl gax::paginator::Paginator<crate::model::ListTimeSeriesResponse, gax::error::Error>
1794 {
1795 use std::clone::Clone;
1796 let token = self.0.request.page_token.clone();
1797 let execute = move |token: String| {
1798 let mut builder = self.clone();
1799 builder.0.request = builder.0.request.set_page_token(token);
1800 builder.send()
1801 };
1802 gax::paginator::internal::new_paginator(token, execute)
1803 }
1804
1805 /// Streams each item in the collection.
1806 pub fn by_item(
1807 self,
1808 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTimeSeriesResponse, gax::error::Error>
1809 {
1810 use gax::paginator::Paginator;
1811 self.by_page().items()
1812 }
1813
1814 /// Sets the value of [name][crate::model::ListTimeSeriesRequest::name].
1815 ///
1816 /// This is a **required** field for requests.
1817 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1818 self.0.request.name = v.into();
1819 self
1820 }
1821
1822 /// Sets the value of [filter][crate::model::ListTimeSeriesRequest::filter].
1823 ///
1824 /// This is a **required** field for requests.
1825 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1826 self.0.request.filter = v.into();
1827 self
1828 }
1829
1830 /// Sets the value of [interval][crate::model::ListTimeSeriesRequest::interval].
1831 ///
1832 /// This is a **required** field for requests.
1833 pub fn set_interval<T>(mut self, v: T) -> Self
1834 where
1835 T: std::convert::Into<crate::model::TimeInterval>,
1836 {
1837 self.0.request.interval = std::option::Option::Some(v.into());
1838 self
1839 }
1840
1841 /// Sets or clears the value of [interval][crate::model::ListTimeSeriesRequest::interval].
1842 ///
1843 /// This is a **required** field for requests.
1844 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
1845 where
1846 T: std::convert::Into<crate::model::TimeInterval>,
1847 {
1848 self.0.request.interval = v.map(|x| x.into());
1849 self
1850 }
1851
1852 /// Sets the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
1853 pub fn set_aggregation<T>(mut self, v: T) -> Self
1854 where
1855 T: std::convert::Into<crate::model::Aggregation>,
1856 {
1857 self.0.request.aggregation = std::option::Option::Some(v.into());
1858 self
1859 }
1860
1861 /// Sets or clears the value of [aggregation][crate::model::ListTimeSeriesRequest::aggregation].
1862 pub fn set_or_clear_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
1863 where
1864 T: std::convert::Into<crate::model::Aggregation>,
1865 {
1866 self.0.request.aggregation = v.map(|x| x.into());
1867 self
1868 }
1869
1870 /// Sets the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
1871 pub fn set_secondary_aggregation<T>(mut self, v: T) -> Self
1872 where
1873 T: std::convert::Into<crate::model::Aggregation>,
1874 {
1875 self.0.request.secondary_aggregation = std::option::Option::Some(v.into());
1876 self
1877 }
1878
1879 /// Sets or clears the value of [secondary_aggregation][crate::model::ListTimeSeriesRequest::secondary_aggregation].
1880 pub fn set_or_clear_secondary_aggregation<T>(mut self, v: std::option::Option<T>) -> Self
1881 where
1882 T: std::convert::Into<crate::model::Aggregation>,
1883 {
1884 self.0.request.secondary_aggregation = v.map(|x| x.into());
1885 self
1886 }
1887
1888 /// Sets the value of [order_by][crate::model::ListTimeSeriesRequest::order_by].
1889 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1890 self.0.request.order_by = v.into();
1891 self
1892 }
1893
1894 /// Sets the value of [view][crate::model::ListTimeSeriesRequest::view].
1895 ///
1896 /// This is a **required** field for requests.
1897 pub fn set_view<T: Into<crate::model::list_time_series_request::TimeSeriesView>>(
1898 mut self,
1899 v: T,
1900 ) -> Self {
1901 self.0.request.view = v.into();
1902 self
1903 }
1904
1905 /// Sets the value of [page_size][crate::model::ListTimeSeriesRequest::page_size].
1906 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1907 self.0.request.page_size = v.into();
1908 self
1909 }
1910
1911 /// Sets the value of [page_token][crate::model::ListTimeSeriesRequest::page_token].
1912 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1913 self.0.request.page_token = v.into();
1914 self
1915 }
1916 }
1917
1918 #[doc(hidden)]
1919 impl gax::options::internal::RequestBuilder for ListTimeSeries {
1920 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1921 &mut self.0.options
1922 }
1923 }
1924
1925 /// The request builder for [MetricService::create_time_series][crate::client::MetricService::create_time_series] calls.
1926 ///
1927 /// # Example
1928 /// ```no_run
1929 /// # use google_cloud_monitoring_v3::builder;
1930 /// use builder::metric_service::CreateTimeSeries;
1931 /// # tokio_test::block_on(async {
1932 ///
1933 /// let builder = prepare_request_builder();
1934 /// let response = builder.send().await?;
1935 /// # gax::Result::<()>::Ok(()) });
1936 ///
1937 /// fn prepare_request_builder() -> CreateTimeSeries {
1938 /// # panic!();
1939 /// // ... details omitted ...
1940 /// }
1941 /// ```
1942 #[derive(Clone, Debug)]
1943 pub struct CreateTimeSeries(RequestBuilder<crate::model::CreateTimeSeriesRequest>);
1944
1945 impl CreateTimeSeries {
1946 pub(crate) fn new(
1947 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
1948 ) -> Self {
1949 Self(RequestBuilder::new(stub))
1950 }
1951
1952 /// Sets the full request, replacing any prior values.
1953 pub fn with_request<V: Into<crate::model::CreateTimeSeriesRequest>>(
1954 mut self,
1955 v: V,
1956 ) -> Self {
1957 self.0.request = v.into();
1958 self
1959 }
1960
1961 /// Sets all the options, replacing any prior values.
1962 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1963 self.0.options = v.into();
1964 self
1965 }
1966
1967 /// Sends the request.
1968 pub async fn send(self) -> Result<()> {
1969 (*self.0.stub)
1970 .create_time_series(self.0.request, self.0.options)
1971 .await
1972 .map(gax::response::Response::into_body)
1973 }
1974
1975 /// Sets the value of [name][crate::model::CreateTimeSeriesRequest::name].
1976 ///
1977 /// This is a **required** field for requests.
1978 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1979 self.0.request.name = v.into();
1980 self
1981 }
1982
1983 /// Sets the value of [time_series][crate::model::CreateTimeSeriesRequest::time_series].
1984 ///
1985 /// This is a **required** field for requests.
1986 pub fn set_time_series<T, V>(mut self, v: T) -> Self
1987 where
1988 T: std::iter::IntoIterator<Item = V>,
1989 V: std::convert::Into<crate::model::TimeSeries>,
1990 {
1991 use std::iter::Iterator;
1992 self.0.request.time_series = v.into_iter().map(|i| i.into()).collect();
1993 self
1994 }
1995 }
1996
1997 #[doc(hidden)]
1998 impl gax::options::internal::RequestBuilder for CreateTimeSeries {
1999 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2000 &mut self.0.options
2001 }
2002 }
2003
2004 /// The request builder for [MetricService::create_service_time_series][crate::client::MetricService::create_service_time_series] calls.
2005 ///
2006 /// # Example
2007 /// ```no_run
2008 /// # use google_cloud_monitoring_v3::builder;
2009 /// use builder::metric_service::CreateServiceTimeSeries;
2010 /// # tokio_test::block_on(async {
2011 ///
2012 /// let builder = prepare_request_builder();
2013 /// let response = builder.send().await?;
2014 /// # gax::Result::<()>::Ok(()) });
2015 ///
2016 /// fn prepare_request_builder() -> CreateServiceTimeSeries {
2017 /// # panic!();
2018 /// // ... details omitted ...
2019 /// }
2020 /// ```
2021 #[derive(Clone, Debug)]
2022 pub struct CreateServiceTimeSeries(RequestBuilder<crate::model::CreateTimeSeriesRequest>);
2023
2024 impl CreateServiceTimeSeries {
2025 pub(crate) fn new(
2026 stub: std::sync::Arc<dyn super::super::stub::dynamic::MetricService>,
2027 ) -> Self {
2028 Self(RequestBuilder::new(stub))
2029 }
2030
2031 /// Sets the full request, replacing any prior values.
2032 pub fn with_request<V: Into<crate::model::CreateTimeSeriesRequest>>(
2033 mut self,
2034 v: V,
2035 ) -> Self {
2036 self.0.request = v.into();
2037 self
2038 }
2039
2040 /// Sets all the options, replacing any prior values.
2041 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2042 self.0.options = v.into();
2043 self
2044 }
2045
2046 /// Sends the request.
2047 pub async fn send(self) -> Result<()> {
2048 (*self.0.stub)
2049 .create_service_time_series(self.0.request, self.0.options)
2050 .await
2051 .map(gax::response::Response::into_body)
2052 }
2053
2054 /// Sets the value of [name][crate::model::CreateTimeSeriesRequest::name].
2055 ///
2056 /// This is a **required** field for requests.
2057 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2058 self.0.request.name = v.into();
2059 self
2060 }
2061
2062 /// Sets the value of [time_series][crate::model::CreateTimeSeriesRequest::time_series].
2063 ///
2064 /// This is a **required** field for requests.
2065 pub fn set_time_series<T, V>(mut self, v: T) -> Self
2066 where
2067 T: std::iter::IntoIterator<Item = V>,
2068 V: std::convert::Into<crate::model::TimeSeries>,
2069 {
2070 use std::iter::Iterator;
2071 self.0.request.time_series = v.into_iter().map(|i| i.into()).collect();
2072 self
2073 }
2074 }
2075
2076 #[doc(hidden)]
2077 impl gax::options::internal::RequestBuilder for CreateServiceTimeSeries {
2078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2079 &mut self.0.options
2080 }
2081 }
2082}
2083
2084pub mod notification_channel_service {
2085 use crate::Result;
2086
2087 /// A builder for [NotificationChannelService][crate::client::NotificationChannelService].
2088 ///
2089 /// ```
2090 /// # tokio_test::block_on(async {
2091 /// # use google_cloud_monitoring_v3::*;
2092 /// # use builder::notification_channel_service::ClientBuilder;
2093 /// # use client::NotificationChannelService;
2094 /// let builder : ClientBuilder = NotificationChannelService::builder();
2095 /// let client = builder
2096 /// .with_endpoint("https://monitoring.googleapis.com")
2097 /// .build().await?;
2098 /// # gax::client_builder::Result::<()>::Ok(()) });
2099 /// ```
2100 pub type ClientBuilder =
2101 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2102
2103 pub(crate) mod client {
2104 use super::super::super::client::NotificationChannelService;
2105 pub struct Factory;
2106 impl gax::client_builder::internal::ClientFactory for Factory {
2107 type Client = NotificationChannelService;
2108 type Credentials = gaxi::options::Credentials;
2109 async fn build(
2110 self,
2111 config: gaxi::options::ClientConfig,
2112 ) -> gax::client_builder::Result<Self::Client> {
2113 Self::Client::new(config).await
2114 }
2115 }
2116 }
2117
2118 /// Common implementation for [crate::client::NotificationChannelService] request builders.
2119 #[derive(Clone, Debug)]
2120 pub(crate) struct RequestBuilder<R: std::default::Default> {
2121 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2122 request: R,
2123 options: gax::options::RequestOptions,
2124 }
2125
2126 impl<R> RequestBuilder<R>
2127 where
2128 R: std::default::Default,
2129 {
2130 pub(crate) fn new(
2131 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2132 ) -> Self {
2133 Self {
2134 stub,
2135 request: R::default(),
2136 options: gax::options::RequestOptions::default(),
2137 }
2138 }
2139 }
2140
2141 /// The request builder for [NotificationChannelService::list_notification_channel_descriptors][crate::client::NotificationChannelService::list_notification_channel_descriptors] calls.
2142 ///
2143 /// # Example
2144 /// ```no_run
2145 /// # use google_cloud_monitoring_v3::builder;
2146 /// use builder::notification_channel_service::ListNotificationChannelDescriptors;
2147 /// # tokio_test::block_on(async {
2148 /// use gax::paginator::ItemPaginator;
2149 ///
2150 /// let builder = prepare_request_builder();
2151 /// let mut items = builder.by_item();
2152 /// while let Some(result) = items.next().await {
2153 /// let item = result?;
2154 /// }
2155 /// # gax::Result::<()>::Ok(()) });
2156 ///
2157 /// fn prepare_request_builder() -> ListNotificationChannelDescriptors {
2158 /// # panic!();
2159 /// // ... details omitted ...
2160 /// }
2161 /// ```
2162 #[derive(Clone, Debug)]
2163 pub struct ListNotificationChannelDescriptors(
2164 RequestBuilder<crate::model::ListNotificationChannelDescriptorsRequest>,
2165 );
2166
2167 impl ListNotificationChannelDescriptors {
2168 pub(crate) fn new(
2169 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2170 ) -> Self {
2171 Self(RequestBuilder::new(stub))
2172 }
2173
2174 /// Sets the full request, replacing any prior values.
2175 pub fn with_request<V: Into<crate::model::ListNotificationChannelDescriptorsRequest>>(
2176 mut self,
2177 v: V,
2178 ) -> Self {
2179 self.0.request = v.into();
2180 self
2181 }
2182
2183 /// Sets all the options, replacing any prior values.
2184 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2185 self.0.options = v.into();
2186 self
2187 }
2188
2189 /// Sends the request.
2190 pub async fn send(
2191 self,
2192 ) -> Result<crate::model::ListNotificationChannelDescriptorsResponse> {
2193 (*self.0.stub)
2194 .list_notification_channel_descriptors(self.0.request, self.0.options)
2195 .await
2196 .map(gax::response::Response::into_body)
2197 }
2198
2199 /// Streams each page in the collection.
2200 pub fn by_page(
2201 self,
2202 ) -> impl gax::paginator::Paginator<
2203 crate::model::ListNotificationChannelDescriptorsResponse,
2204 gax::error::Error,
2205 > {
2206 use std::clone::Clone;
2207 let token = self.0.request.page_token.clone();
2208 let execute = move |token: String| {
2209 let mut builder = self.clone();
2210 builder.0.request = builder.0.request.set_page_token(token);
2211 builder.send()
2212 };
2213 gax::paginator::internal::new_paginator(token, execute)
2214 }
2215
2216 /// Streams each item in the collection.
2217 pub fn by_item(
2218 self,
2219 ) -> impl gax::paginator::ItemPaginator<
2220 crate::model::ListNotificationChannelDescriptorsResponse,
2221 gax::error::Error,
2222 > {
2223 use gax::paginator::Paginator;
2224 self.by_page().items()
2225 }
2226
2227 /// Sets the value of [name][crate::model::ListNotificationChannelDescriptorsRequest::name].
2228 ///
2229 /// This is a **required** field for requests.
2230 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2231 self.0.request.name = v.into();
2232 self
2233 }
2234
2235 /// Sets the value of [page_size][crate::model::ListNotificationChannelDescriptorsRequest::page_size].
2236 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2237 self.0.request.page_size = v.into();
2238 self
2239 }
2240
2241 /// Sets the value of [page_token][crate::model::ListNotificationChannelDescriptorsRequest::page_token].
2242 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2243 self.0.request.page_token = v.into();
2244 self
2245 }
2246 }
2247
2248 #[doc(hidden)]
2249 impl gax::options::internal::RequestBuilder for ListNotificationChannelDescriptors {
2250 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2251 &mut self.0.options
2252 }
2253 }
2254
2255 /// The request builder for [NotificationChannelService::get_notification_channel_descriptor][crate::client::NotificationChannelService::get_notification_channel_descriptor] calls.
2256 ///
2257 /// # Example
2258 /// ```no_run
2259 /// # use google_cloud_monitoring_v3::builder;
2260 /// use builder::notification_channel_service::GetNotificationChannelDescriptor;
2261 /// # tokio_test::block_on(async {
2262 ///
2263 /// let builder = prepare_request_builder();
2264 /// let response = builder.send().await?;
2265 /// # gax::Result::<()>::Ok(()) });
2266 ///
2267 /// fn prepare_request_builder() -> GetNotificationChannelDescriptor {
2268 /// # panic!();
2269 /// // ... details omitted ...
2270 /// }
2271 /// ```
2272 #[derive(Clone, Debug)]
2273 pub struct GetNotificationChannelDescriptor(
2274 RequestBuilder<crate::model::GetNotificationChannelDescriptorRequest>,
2275 );
2276
2277 impl GetNotificationChannelDescriptor {
2278 pub(crate) fn new(
2279 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2280 ) -> Self {
2281 Self(RequestBuilder::new(stub))
2282 }
2283
2284 /// Sets the full request, replacing any prior values.
2285 pub fn with_request<V: Into<crate::model::GetNotificationChannelDescriptorRequest>>(
2286 mut self,
2287 v: V,
2288 ) -> Self {
2289 self.0.request = v.into();
2290 self
2291 }
2292
2293 /// Sets all the options, replacing any prior values.
2294 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2295 self.0.options = v.into();
2296 self
2297 }
2298
2299 /// Sends the request.
2300 pub async fn send(self) -> Result<crate::model::NotificationChannelDescriptor> {
2301 (*self.0.stub)
2302 .get_notification_channel_descriptor(self.0.request, self.0.options)
2303 .await
2304 .map(gax::response::Response::into_body)
2305 }
2306
2307 /// Sets the value of [name][crate::model::GetNotificationChannelDescriptorRequest::name].
2308 ///
2309 /// This is a **required** field for requests.
2310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2311 self.0.request.name = v.into();
2312 self
2313 }
2314 }
2315
2316 #[doc(hidden)]
2317 impl gax::options::internal::RequestBuilder for GetNotificationChannelDescriptor {
2318 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2319 &mut self.0.options
2320 }
2321 }
2322
2323 /// The request builder for [NotificationChannelService::list_notification_channels][crate::client::NotificationChannelService::list_notification_channels] calls.
2324 ///
2325 /// # Example
2326 /// ```no_run
2327 /// # use google_cloud_monitoring_v3::builder;
2328 /// use builder::notification_channel_service::ListNotificationChannels;
2329 /// # tokio_test::block_on(async {
2330 /// use gax::paginator::ItemPaginator;
2331 ///
2332 /// let builder = prepare_request_builder();
2333 /// let mut items = builder.by_item();
2334 /// while let Some(result) = items.next().await {
2335 /// let item = result?;
2336 /// }
2337 /// # gax::Result::<()>::Ok(()) });
2338 ///
2339 /// fn prepare_request_builder() -> ListNotificationChannels {
2340 /// # panic!();
2341 /// // ... details omitted ...
2342 /// }
2343 /// ```
2344 #[derive(Clone, Debug)]
2345 pub struct ListNotificationChannels(
2346 RequestBuilder<crate::model::ListNotificationChannelsRequest>,
2347 );
2348
2349 impl ListNotificationChannels {
2350 pub(crate) fn new(
2351 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2352 ) -> Self {
2353 Self(RequestBuilder::new(stub))
2354 }
2355
2356 /// Sets the full request, replacing any prior values.
2357 pub fn with_request<V: Into<crate::model::ListNotificationChannelsRequest>>(
2358 mut self,
2359 v: V,
2360 ) -> Self {
2361 self.0.request = v.into();
2362 self
2363 }
2364
2365 /// Sets all the options, replacing any prior values.
2366 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2367 self.0.options = v.into();
2368 self
2369 }
2370
2371 /// Sends the request.
2372 pub async fn send(self) -> Result<crate::model::ListNotificationChannelsResponse> {
2373 (*self.0.stub)
2374 .list_notification_channels(self.0.request, self.0.options)
2375 .await
2376 .map(gax::response::Response::into_body)
2377 }
2378
2379 /// Streams each page in the collection.
2380 pub fn by_page(
2381 self,
2382 ) -> impl gax::paginator::Paginator<
2383 crate::model::ListNotificationChannelsResponse,
2384 gax::error::Error,
2385 > {
2386 use std::clone::Clone;
2387 let token = self.0.request.page_token.clone();
2388 let execute = move |token: String| {
2389 let mut builder = self.clone();
2390 builder.0.request = builder.0.request.set_page_token(token);
2391 builder.send()
2392 };
2393 gax::paginator::internal::new_paginator(token, execute)
2394 }
2395
2396 /// Streams each item in the collection.
2397 pub fn by_item(
2398 self,
2399 ) -> impl gax::paginator::ItemPaginator<
2400 crate::model::ListNotificationChannelsResponse,
2401 gax::error::Error,
2402 > {
2403 use gax::paginator::Paginator;
2404 self.by_page().items()
2405 }
2406
2407 /// Sets the value of [name][crate::model::ListNotificationChannelsRequest::name].
2408 ///
2409 /// This is a **required** field for requests.
2410 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2411 self.0.request.name = v.into();
2412 self
2413 }
2414
2415 /// Sets the value of [filter][crate::model::ListNotificationChannelsRequest::filter].
2416 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2417 self.0.request.filter = v.into();
2418 self
2419 }
2420
2421 /// Sets the value of [order_by][crate::model::ListNotificationChannelsRequest::order_by].
2422 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2423 self.0.request.order_by = v.into();
2424 self
2425 }
2426
2427 /// Sets the value of [page_size][crate::model::ListNotificationChannelsRequest::page_size].
2428 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2429 self.0.request.page_size = v.into();
2430 self
2431 }
2432
2433 /// Sets the value of [page_token][crate::model::ListNotificationChannelsRequest::page_token].
2434 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2435 self.0.request.page_token = v.into();
2436 self
2437 }
2438 }
2439
2440 #[doc(hidden)]
2441 impl gax::options::internal::RequestBuilder for ListNotificationChannels {
2442 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2443 &mut self.0.options
2444 }
2445 }
2446
2447 /// The request builder for [NotificationChannelService::get_notification_channel][crate::client::NotificationChannelService::get_notification_channel] calls.
2448 ///
2449 /// # Example
2450 /// ```no_run
2451 /// # use google_cloud_monitoring_v3::builder;
2452 /// use builder::notification_channel_service::GetNotificationChannel;
2453 /// # tokio_test::block_on(async {
2454 ///
2455 /// let builder = prepare_request_builder();
2456 /// let response = builder.send().await?;
2457 /// # gax::Result::<()>::Ok(()) });
2458 ///
2459 /// fn prepare_request_builder() -> GetNotificationChannel {
2460 /// # panic!();
2461 /// // ... details omitted ...
2462 /// }
2463 /// ```
2464 #[derive(Clone, Debug)]
2465 pub struct GetNotificationChannel(RequestBuilder<crate::model::GetNotificationChannelRequest>);
2466
2467 impl GetNotificationChannel {
2468 pub(crate) fn new(
2469 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2470 ) -> Self {
2471 Self(RequestBuilder::new(stub))
2472 }
2473
2474 /// Sets the full request, replacing any prior values.
2475 pub fn with_request<V: Into<crate::model::GetNotificationChannelRequest>>(
2476 mut self,
2477 v: V,
2478 ) -> Self {
2479 self.0.request = v.into();
2480 self
2481 }
2482
2483 /// Sets all the options, replacing any prior values.
2484 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2485 self.0.options = v.into();
2486 self
2487 }
2488
2489 /// Sends the request.
2490 pub async fn send(self) -> Result<crate::model::NotificationChannel> {
2491 (*self.0.stub)
2492 .get_notification_channel(self.0.request, self.0.options)
2493 .await
2494 .map(gax::response::Response::into_body)
2495 }
2496
2497 /// Sets the value of [name][crate::model::GetNotificationChannelRequest::name].
2498 ///
2499 /// This is a **required** field for requests.
2500 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2501 self.0.request.name = v.into();
2502 self
2503 }
2504 }
2505
2506 #[doc(hidden)]
2507 impl gax::options::internal::RequestBuilder for GetNotificationChannel {
2508 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2509 &mut self.0.options
2510 }
2511 }
2512
2513 /// The request builder for [NotificationChannelService::create_notification_channel][crate::client::NotificationChannelService::create_notification_channel] calls.
2514 ///
2515 /// # Example
2516 /// ```no_run
2517 /// # use google_cloud_monitoring_v3::builder;
2518 /// use builder::notification_channel_service::CreateNotificationChannel;
2519 /// # tokio_test::block_on(async {
2520 ///
2521 /// let builder = prepare_request_builder();
2522 /// let response = builder.send().await?;
2523 /// # gax::Result::<()>::Ok(()) });
2524 ///
2525 /// fn prepare_request_builder() -> CreateNotificationChannel {
2526 /// # panic!();
2527 /// // ... details omitted ...
2528 /// }
2529 /// ```
2530 #[derive(Clone, Debug)]
2531 pub struct CreateNotificationChannel(
2532 RequestBuilder<crate::model::CreateNotificationChannelRequest>,
2533 );
2534
2535 impl CreateNotificationChannel {
2536 pub(crate) fn new(
2537 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2538 ) -> Self {
2539 Self(RequestBuilder::new(stub))
2540 }
2541
2542 /// Sets the full request, replacing any prior values.
2543 pub fn with_request<V: Into<crate::model::CreateNotificationChannelRequest>>(
2544 mut self,
2545 v: V,
2546 ) -> Self {
2547 self.0.request = v.into();
2548 self
2549 }
2550
2551 /// Sets all the options, replacing any prior values.
2552 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2553 self.0.options = v.into();
2554 self
2555 }
2556
2557 /// Sends the request.
2558 pub async fn send(self) -> Result<crate::model::NotificationChannel> {
2559 (*self.0.stub)
2560 .create_notification_channel(self.0.request, self.0.options)
2561 .await
2562 .map(gax::response::Response::into_body)
2563 }
2564
2565 /// Sets the value of [name][crate::model::CreateNotificationChannelRequest::name].
2566 ///
2567 /// This is a **required** field for requests.
2568 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2569 self.0.request.name = v.into();
2570 self
2571 }
2572
2573 /// Sets the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
2574 ///
2575 /// This is a **required** field for requests.
2576 pub fn set_notification_channel<T>(mut self, v: T) -> Self
2577 where
2578 T: std::convert::Into<crate::model::NotificationChannel>,
2579 {
2580 self.0.request.notification_channel = std::option::Option::Some(v.into());
2581 self
2582 }
2583
2584 /// Sets or clears the value of [notification_channel][crate::model::CreateNotificationChannelRequest::notification_channel].
2585 ///
2586 /// This is a **required** field for requests.
2587 pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
2588 where
2589 T: std::convert::Into<crate::model::NotificationChannel>,
2590 {
2591 self.0.request.notification_channel = v.map(|x| x.into());
2592 self
2593 }
2594 }
2595
2596 #[doc(hidden)]
2597 impl gax::options::internal::RequestBuilder for CreateNotificationChannel {
2598 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2599 &mut self.0.options
2600 }
2601 }
2602
2603 /// The request builder for [NotificationChannelService::update_notification_channel][crate::client::NotificationChannelService::update_notification_channel] calls.
2604 ///
2605 /// # Example
2606 /// ```no_run
2607 /// # use google_cloud_monitoring_v3::builder;
2608 /// use builder::notification_channel_service::UpdateNotificationChannel;
2609 /// # tokio_test::block_on(async {
2610 ///
2611 /// let builder = prepare_request_builder();
2612 /// let response = builder.send().await?;
2613 /// # gax::Result::<()>::Ok(()) });
2614 ///
2615 /// fn prepare_request_builder() -> UpdateNotificationChannel {
2616 /// # panic!();
2617 /// // ... details omitted ...
2618 /// }
2619 /// ```
2620 #[derive(Clone, Debug)]
2621 pub struct UpdateNotificationChannel(
2622 RequestBuilder<crate::model::UpdateNotificationChannelRequest>,
2623 );
2624
2625 impl UpdateNotificationChannel {
2626 pub(crate) fn new(
2627 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2628 ) -> Self {
2629 Self(RequestBuilder::new(stub))
2630 }
2631
2632 /// Sets the full request, replacing any prior values.
2633 pub fn with_request<V: Into<crate::model::UpdateNotificationChannelRequest>>(
2634 mut self,
2635 v: V,
2636 ) -> Self {
2637 self.0.request = v.into();
2638 self
2639 }
2640
2641 /// Sets all the options, replacing any prior values.
2642 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2643 self.0.options = v.into();
2644 self
2645 }
2646
2647 /// Sends the request.
2648 pub async fn send(self) -> Result<crate::model::NotificationChannel> {
2649 (*self.0.stub)
2650 .update_notification_channel(self.0.request, self.0.options)
2651 .await
2652 .map(gax::response::Response::into_body)
2653 }
2654
2655 /// Sets the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
2656 pub fn set_update_mask<T>(mut self, v: T) -> Self
2657 where
2658 T: std::convert::Into<wkt::FieldMask>,
2659 {
2660 self.0.request.update_mask = std::option::Option::Some(v.into());
2661 self
2662 }
2663
2664 /// Sets or clears the value of [update_mask][crate::model::UpdateNotificationChannelRequest::update_mask].
2665 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2666 where
2667 T: std::convert::Into<wkt::FieldMask>,
2668 {
2669 self.0.request.update_mask = v.map(|x| x.into());
2670 self
2671 }
2672
2673 /// Sets the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
2674 ///
2675 /// This is a **required** field for requests.
2676 pub fn set_notification_channel<T>(mut self, v: T) -> Self
2677 where
2678 T: std::convert::Into<crate::model::NotificationChannel>,
2679 {
2680 self.0.request.notification_channel = std::option::Option::Some(v.into());
2681 self
2682 }
2683
2684 /// Sets or clears the value of [notification_channel][crate::model::UpdateNotificationChannelRequest::notification_channel].
2685 ///
2686 /// This is a **required** field for requests.
2687 pub fn set_or_clear_notification_channel<T>(mut self, v: std::option::Option<T>) -> Self
2688 where
2689 T: std::convert::Into<crate::model::NotificationChannel>,
2690 {
2691 self.0.request.notification_channel = v.map(|x| x.into());
2692 self
2693 }
2694 }
2695
2696 #[doc(hidden)]
2697 impl gax::options::internal::RequestBuilder for UpdateNotificationChannel {
2698 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2699 &mut self.0.options
2700 }
2701 }
2702
2703 /// The request builder for [NotificationChannelService::delete_notification_channel][crate::client::NotificationChannelService::delete_notification_channel] calls.
2704 ///
2705 /// # Example
2706 /// ```no_run
2707 /// # use google_cloud_monitoring_v3::builder;
2708 /// use builder::notification_channel_service::DeleteNotificationChannel;
2709 /// # tokio_test::block_on(async {
2710 ///
2711 /// let builder = prepare_request_builder();
2712 /// let response = builder.send().await?;
2713 /// # gax::Result::<()>::Ok(()) });
2714 ///
2715 /// fn prepare_request_builder() -> DeleteNotificationChannel {
2716 /// # panic!();
2717 /// // ... details omitted ...
2718 /// }
2719 /// ```
2720 #[derive(Clone, Debug)]
2721 pub struct DeleteNotificationChannel(
2722 RequestBuilder<crate::model::DeleteNotificationChannelRequest>,
2723 );
2724
2725 impl DeleteNotificationChannel {
2726 pub(crate) fn new(
2727 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2728 ) -> Self {
2729 Self(RequestBuilder::new(stub))
2730 }
2731
2732 /// Sets the full request, replacing any prior values.
2733 pub fn with_request<V: Into<crate::model::DeleteNotificationChannelRequest>>(
2734 mut self,
2735 v: V,
2736 ) -> Self {
2737 self.0.request = v.into();
2738 self
2739 }
2740
2741 /// Sets all the options, replacing any prior values.
2742 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2743 self.0.options = v.into();
2744 self
2745 }
2746
2747 /// Sends the request.
2748 pub async fn send(self) -> Result<()> {
2749 (*self.0.stub)
2750 .delete_notification_channel(self.0.request, self.0.options)
2751 .await
2752 .map(gax::response::Response::into_body)
2753 }
2754
2755 /// Sets the value of [name][crate::model::DeleteNotificationChannelRequest::name].
2756 ///
2757 /// This is a **required** field for requests.
2758 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2759 self.0.request.name = v.into();
2760 self
2761 }
2762
2763 /// Sets the value of [force][crate::model::DeleteNotificationChannelRequest::force].
2764 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2765 self.0.request.force = v.into();
2766 self
2767 }
2768 }
2769
2770 #[doc(hidden)]
2771 impl gax::options::internal::RequestBuilder for DeleteNotificationChannel {
2772 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2773 &mut self.0.options
2774 }
2775 }
2776
2777 /// The request builder for [NotificationChannelService::send_notification_channel_verification_code][crate::client::NotificationChannelService::send_notification_channel_verification_code] calls.
2778 ///
2779 /// # Example
2780 /// ```no_run
2781 /// # use google_cloud_monitoring_v3::builder;
2782 /// use builder::notification_channel_service::SendNotificationChannelVerificationCode;
2783 /// # tokio_test::block_on(async {
2784 ///
2785 /// let builder = prepare_request_builder();
2786 /// let response = builder.send().await?;
2787 /// # gax::Result::<()>::Ok(()) });
2788 ///
2789 /// fn prepare_request_builder() -> SendNotificationChannelVerificationCode {
2790 /// # panic!();
2791 /// // ... details omitted ...
2792 /// }
2793 /// ```
2794 #[derive(Clone, Debug)]
2795 pub struct SendNotificationChannelVerificationCode(
2796 RequestBuilder<crate::model::SendNotificationChannelVerificationCodeRequest>,
2797 );
2798
2799 impl SendNotificationChannelVerificationCode {
2800 pub(crate) fn new(
2801 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2802 ) -> Self {
2803 Self(RequestBuilder::new(stub))
2804 }
2805
2806 /// Sets the full request, replacing any prior values.
2807 pub fn with_request<
2808 V: Into<crate::model::SendNotificationChannelVerificationCodeRequest>,
2809 >(
2810 mut self,
2811 v: V,
2812 ) -> Self {
2813 self.0.request = v.into();
2814 self
2815 }
2816
2817 /// Sets all the options, replacing any prior values.
2818 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2819 self.0.options = v.into();
2820 self
2821 }
2822
2823 /// Sends the request.
2824 pub async fn send(self) -> Result<()> {
2825 (*self.0.stub)
2826 .send_notification_channel_verification_code(self.0.request, self.0.options)
2827 .await
2828 .map(gax::response::Response::into_body)
2829 }
2830
2831 /// Sets the value of [name][crate::model::SendNotificationChannelVerificationCodeRequest::name].
2832 ///
2833 /// This is a **required** field for requests.
2834 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2835 self.0.request.name = v.into();
2836 self
2837 }
2838 }
2839
2840 #[doc(hidden)]
2841 impl gax::options::internal::RequestBuilder for SendNotificationChannelVerificationCode {
2842 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2843 &mut self.0.options
2844 }
2845 }
2846
2847 /// The request builder for [NotificationChannelService::get_notification_channel_verification_code][crate::client::NotificationChannelService::get_notification_channel_verification_code] calls.
2848 ///
2849 /// # Example
2850 /// ```no_run
2851 /// # use google_cloud_monitoring_v3::builder;
2852 /// use builder::notification_channel_service::GetNotificationChannelVerificationCode;
2853 /// # tokio_test::block_on(async {
2854 ///
2855 /// let builder = prepare_request_builder();
2856 /// let response = builder.send().await?;
2857 /// # gax::Result::<()>::Ok(()) });
2858 ///
2859 /// fn prepare_request_builder() -> GetNotificationChannelVerificationCode {
2860 /// # panic!();
2861 /// // ... details omitted ...
2862 /// }
2863 /// ```
2864 #[derive(Clone, Debug)]
2865 pub struct GetNotificationChannelVerificationCode(
2866 RequestBuilder<crate::model::GetNotificationChannelVerificationCodeRequest>,
2867 );
2868
2869 impl GetNotificationChannelVerificationCode {
2870 pub(crate) fn new(
2871 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2872 ) -> Self {
2873 Self(RequestBuilder::new(stub))
2874 }
2875
2876 /// Sets the full request, replacing any prior values.
2877 pub fn with_request<
2878 V: Into<crate::model::GetNotificationChannelVerificationCodeRequest>,
2879 >(
2880 mut self,
2881 v: V,
2882 ) -> Self {
2883 self.0.request = v.into();
2884 self
2885 }
2886
2887 /// Sets all the options, replacing any prior values.
2888 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2889 self.0.options = v.into();
2890 self
2891 }
2892
2893 /// Sends the request.
2894 pub async fn send(
2895 self,
2896 ) -> Result<crate::model::GetNotificationChannelVerificationCodeResponse> {
2897 (*self.0.stub)
2898 .get_notification_channel_verification_code(self.0.request, self.0.options)
2899 .await
2900 .map(gax::response::Response::into_body)
2901 }
2902
2903 /// Sets the value of [name][crate::model::GetNotificationChannelVerificationCodeRequest::name].
2904 ///
2905 /// This is a **required** field for requests.
2906 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2907 self.0.request.name = v.into();
2908 self
2909 }
2910
2911 /// Sets the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
2912 pub fn set_expire_time<T>(mut self, v: T) -> Self
2913 where
2914 T: std::convert::Into<wkt::Timestamp>,
2915 {
2916 self.0.request.expire_time = std::option::Option::Some(v.into());
2917 self
2918 }
2919
2920 /// Sets or clears the value of [expire_time][crate::model::GetNotificationChannelVerificationCodeRequest::expire_time].
2921 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2922 where
2923 T: std::convert::Into<wkt::Timestamp>,
2924 {
2925 self.0.request.expire_time = v.map(|x| x.into());
2926 self
2927 }
2928 }
2929
2930 #[doc(hidden)]
2931 impl gax::options::internal::RequestBuilder for GetNotificationChannelVerificationCode {
2932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2933 &mut self.0.options
2934 }
2935 }
2936
2937 /// The request builder for [NotificationChannelService::verify_notification_channel][crate::client::NotificationChannelService::verify_notification_channel] calls.
2938 ///
2939 /// # Example
2940 /// ```no_run
2941 /// # use google_cloud_monitoring_v3::builder;
2942 /// use builder::notification_channel_service::VerifyNotificationChannel;
2943 /// # tokio_test::block_on(async {
2944 ///
2945 /// let builder = prepare_request_builder();
2946 /// let response = builder.send().await?;
2947 /// # gax::Result::<()>::Ok(()) });
2948 ///
2949 /// fn prepare_request_builder() -> VerifyNotificationChannel {
2950 /// # panic!();
2951 /// // ... details omitted ...
2952 /// }
2953 /// ```
2954 #[derive(Clone, Debug)]
2955 pub struct VerifyNotificationChannel(
2956 RequestBuilder<crate::model::VerifyNotificationChannelRequest>,
2957 );
2958
2959 impl VerifyNotificationChannel {
2960 pub(crate) fn new(
2961 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotificationChannelService>,
2962 ) -> Self {
2963 Self(RequestBuilder::new(stub))
2964 }
2965
2966 /// Sets the full request, replacing any prior values.
2967 pub fn with_request<V: Into<crate::model::VerifyNotificationChannelRequest>>(
2968 mut self,
2969 v: V,
2970 ) -> Self {
2971 self.0.request = v.into();
2972 self
2973 }
2974
2975 /// Sets all the options, replacing any prior values.
2976 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2977 self.0.options = v.into();
2978 self
2979 }
2980
2981 /// Sends the request.
2982 pub async fn send(self) -> Result<crate::model::NotificationChannel> {
2983 (*self.0.stub)
2984 .verify_notification_channel(self.0.request, self.0.options)
2985 .await
2986 .map(gax::response::Response::into_body)
2987 }
2988
2989 /// Sets the value of [name][crate::model::VerifyNotificationChannelRequest::name].
2990 ///
2991 /// This is a **required** field for requests.
2992 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2993 self.0.request.name = v.into();
2994 self
2995 }
2996
2997 /// Sets the value of [code][crate::model::VerifyNotificationChannelRequest::code].
2998 ///
2999 /// This is a **required** field for requests.
3000 pub fn set_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
3001 self.0.request.code = v.into();
3002 self
3003 }
3004 }
3005
3006 #[doc(hidden)]
3007 impl gax::options::internal::RequestBuilder for VerifyNotificationChannel {
3008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3009 &mut self.0.options
3010 }
3011 }
3012}
3013
3014pub mod query_service {
3015 use crate::Result;
3016
3017 /// A builder for [QueryService][crate::client::QueryService].
3018 ///
3019 /// ```
3020 /// # tokio_test::block_on(async {
3021 /// # use google_cloud_monitoring_v3::*;
3022 /// # use builder::query_service::ClientBuilder;
3023 /// # use client::QueryService;
3024 /// let builder : ClientBuilder = QueryService::builder();
3025 /// let client = builder
3026 /// .with_endpoint("https://monitoring.googleapis.com")
3027 /// .build().await?;
3028 /// # gax::client_builder::Result::<()>::Ok(()) });
3029 /// ```
3030 pub type ClientBuilder =
3031 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3032
3033 pub(crate) mod client {
3034 use super::super::super::client::QueryService;
3035 pub struct Factory;
3036 impl gax::client_builder::internal::ClientFactory for Factory {
3037 type Client = QueryService;
3038 type Credentials = gaxi::options::Credentials;
3039 async fn build(
3040 self,
3041 config: gaxi::options::ClientConfig,
3042 ) -> gax::client_builder::Result<Self::Client> {
3043 Self::Client::new(config).await
3044 }
3045 }
3046 }
3047
3048 /// Common implementation for [crate::client::QueryService] request builders.
3049 #[derive(Clone, Debug)]
3050 pub(crate) struct RequestBuilder<R: std::default::Default> {
3051 stub: std::sync::Arc<dyn super::super::stub::dynamic::QueryService>,
3052 request: R,
3053 options: gax::options::RequestOptions,
3054 }
3055
3056 impl<R> RequestBuilder<R>
3057 where
3058 R: std::default::Default,
3059 {
3060 pub(crate) fn new(
3061 stub: std::sync::Arc<dyn super::super::stub::dynamic::QueryService>,
3062 ) -> Self {
3063 Self {
3064 stub,
3065 request: R::default(),
3066 options: gax::options::RequestOptions::default(),
3067 }
3068 }
3069 }
3070
3071 /// The request builder for [QueryService::query_time_series][crate::client::QueryService::query_time_series] calls.
3072 ///
3073 /// # Example
3074 /// ```no_run
3075 /// # use google_cloud_monitoring_v3::builder;
3076 /// use builder::query_service::QueryTimeSeries;
3077 /// # tokio_test::block_on(async {
3078 /// use gax::paginator::ItemPaginator;
3079 ///
3080 /// let builder = prepare_request_builder();
3081 /// let mut items = builder.by_item();
3082 /// while let Some(result) = items.next().await {
3083 /// let item = result?;
3084 /// }
3085 /// # gax::Result::<()>::Ok(()) });
3086 ///
3087 /// fn prepare_request_builder() -> QueryTimeSeries {
3088 /// # panic!();
3089 /// // ... details omitted ...
3090 /// }
3091 /// ```
3092 #[derive(Clone, Debug)]
3093 pub struct QueryTimeSeries(RequestBuilder<crate::model::QueryTimeSeriesRequest>);
3094
3095 impl QueryTimeSeries {
3096 pub(crate) fn new(
3097 stub: std::sync::Arc<dyn super::super::stub::dynamic::QueryService>,
3098 ) -> Self {
3099 Self(RequestBuilder::new(stub))
3100 }
3101
3102 /// Sets the full request, replacing any prior values.
3103 pub fn with_request<V: Into<crate::model::QueryTimeSeriesRequest>>(mut self, v: V) -> Self {
3104 self.0.request = v.into();
3105 self
3106 }
3107
3108 /// Sets all the options, replacing any prior values.
3109 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3110 self.0.options = v.into();
3111 self
3112 }
3113
3114 /// Sends the request.
3115 pub async fn send(self) -> Result<crate::model::QueryTimeSeriesResponse> {
3116 (*self.0.stub)
3117 .query_time_series(self.0.request, self.0.options)
3118 .await
3119 .map(gax::response::Response::into_body)
3120 }
3121
3122 /// Streams each page in the collection.
3123 pub fn by_page(
3124 self,
3125 ) -> impl gax::paginator::Paginator<crate::model::QueryTimeSeriesResponse, gax::error::Error>
3126 {
3127 use std::clone::Clone;
3128 let token = self.0.request.page_token.clone();
3129 let execute = move |token: String| {
3130 let mut builder = self.clone();
3131 builder.0.request = builder.0.request.set_page_token(token);
3132 builder.send()
3133 };
3134 gax::paginator::internal::new_paginator(token, execute)
3135 }
3136
3137 /// Streams each item in the collection.
3138 pub fn by_item(
3139 self,
3140 ) -> impl gax::paginator::ItemPaginator<crate::model::QueryTimeSeriesResponse, gax::error::Error>
3141 {
3142 use gax::paginator::Paginator;
3143 self.by_page().items()
3144 }
3145
3146 /// Sets the value of [name][crate::model::QueryTimeSeriesRequest::name].
3147 ///
3148 /// This is a **required** field for requests.
3149 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150 self.0.request.name = v.into();
3151 self
3152 }
3153
3154 /// Sets the value of [query][crate::model::QueryTimeSeriesRequest::query].
3155 ///
3156 /// This is a **required** field for requests.
3157 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
3158 self.0.request.query = v.into();
3159 self
3160 }
3161
3162 /// Sets the value of [page_size][crate::model::QueryTimeSeriesRequest::page_size].
3163 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3164 self.0.request.page_size = v.into();
3165 self
3166 }
3167
3168 /// Sets the value of [page_token][crate::model::QueryTimeSeriesRequest::page_token].
3169 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3170 self.0.request.page_token = v.into();
3171 self
3172 }
3173 }
3174
3175 #[doc(hidden)]
3176 impl gax::options::internal::RequestBuilder for QueryTimeSeries {
3177 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3178 &mut self.0.options
3179 }
3180 }
3181}
3182
3183pub mod service_monitoring_service {
3184 use crate::Result;
3185
3186 /// A builder for [ServiceMonitoringService][crate::client::ServiceMonitoringService].
3187 ///
3188 /// ```
3189 /// # tokio_test::block_on(async {
3190 /// # use google_cloud_monitoring_v3::*;
3191 /// # use builder::service_monitoring_service::ClientBuilder;
3192 /// # use client::ServiceMonitoringService;
3193 /// let builder : ClientBuilder = ServiceMonitoringService::builder();
3194 /// let client = builder
3195 /// .with_endpoint("https://monitoring.googleapis.com")
3196 /// .build().await?;
3197 /// # gax::client_builder::Result::<()>::Ok(()) });
3198 /// ```
3199 pub type ClientBuilder =
3200 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3201
3202 pub(crate) mod client {
3203 use super::super::super::client::ServiceMonitoringService;
3204 pub struct Factory;
3205 impl gax::client_builder::internal::ClientFactory for Factory {
3206 type Client = ServiceMonitoringService;
3207 type Credentials = gaxi::options::Credentials;
3208 async fn build(
3209 self,
3210 config: gaxi::options::ClientConfig,
3211 ) -> gax::client_builder::Result<Self::Client> {
3212 Self::Client::new(config).await
3213 }
3214 }
3215 }
3216
3217 /// Common implementation for [crate::client::ServiceMonitoringService] request builders.
3218 #[derive(Clone, Debug)]
3219 pub(crate) struct RequestBuilder<R: std::default::Default> {
3220 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3221 request: R,
3222 options: gax::options::RequestOptions,
3223 }
3224
3225 impl<R> RequestBuilder<R>
3226 where
3227 R: std::default::Default,
3228 {
3229 pub(crate) fn new(
3230 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3231 ) -> Self {
3232 Self {
3233 stub,
3234 request: R::default(),
3235 options: gax::options::RequestOptions::default(),
3236 }
3237 }
3238 }
3239
3240 /// The request builder for [ServiceMonitoringService::create_service][crate::client::ServiceMonitoringService::create_service] calls.
3241 ///
3242 /// # Example
3243 /// ```no_run
3244 /// # use google_cloud_monitoring_v3::builder;
3245 /// use builder::service_monitoring_service::CreateService;
3246 /// # tokio_test::block_on(async {
3247 ///
3248 /// let builder = prepare_request_builder();
3249 /// let response = builder.send().await?;
3250 /// # gax::Result::<()>::Ok(()) });
3251 ///
3252 /// fn prepare_request_builder() -> CreateService {
3253 /// # panic!();
3254 /// // ... details omitted ...
3255 /// }
3256 /// ```
3257 #[derive(Clone, Debug)]
3258 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
3259
3260 impl CreateService {
3261 pub(crate) fn new(
3262 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3263 ) -> Self {
3264 Self(RequestBuilder::new(stub))
3265 }
3266
3267 /// Sets the full request, replacing any prior values.
3268 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
3269 self.0.request = v.into();
3270 self
3271 }
3272
3273 /// Sets all the options, replacing any prior values.
3274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3275 self.0.options = v.into();
3276 self
3277 }
3278
3279 /// Sends the request.
3280 pub async fn send(self) -> Result<crate::model::Service> {
3281 (*self.0.stub)
3282 .create_service(self.0.request, self.0.options)
3283 .await
3284 .map(gax::response::Response::into_body)
3285 }
3286
3287 /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
3288 ///
3289 /// This is a **required** field for requests.
3290 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3291 self.0.request.parent = v.into();
3292 self
3293 }
3294
3295 /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
3296 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3297 self.0.request.service_id = v.into();
3298 self
3299 }
3300
3301 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
3302 ///
3303 /// This is a **required** field for requests.
3304 pub fn set_service<T>(mut self, v: T) -> Self
3305 where
3306 T: std::convert::Into<crate::model::Service>,
3307 {
3308 self.0.request.service = std::option::Option::Some(v.into());
3309 self
3310 }
3311
3312 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
3313 ///
3314 /// This is a **required** field for requests.
3315 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3316 where
3317 T: std::convert::Into<crate::model::Service>,
3318 {
3319 self.0.request.service = v.map(|x| x.into());
3320 self
3321 }
3322 }
3323
3324 #[doc(hidden)]
3325 impl gax::options::internal::RequestBuilder for CreateService {
3326 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3327 &mut self.0.options
3328 }
3329 }
3330
3331 /// The request builder for [ServiceMonitoringService::get_service][crate::client::ServiceMonitoringService::get_service] calls.
3332 ///
3333 /// # Example
3334 /// ```no_run
3335 /// # use google_cloud_monitoring_v3::builder;
3336 /// use builder::service_monitoring_service::GetService;
3337 /// # tokio_test::block_on(async {
3338 ///
3339 /// let builder = prepare_request_builder();
3340 /// let response = builder.send().await?;
3341 /// # gax::Result::<()>::Ok(()) });
3342 ///
3343 /// fn prepare_request_builder() -> GetService {
3344 /// # panic!();
3345 /// // ... details omitted ...
3346 /// }
3347 /// ```
3348 #[derive(Clone, Debug)]
3349 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
3350
3351 impl GetService {
3352 pub(crate) fn new(
3353 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3354 ) -> Self {
3355 Self(RequestBuilder::new(stub))
3356 }
3357
3358 /// Sets the full request, replacing any prior values.
3359 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
3360 self.0.request = v.into();
3361 self
3362 }
3363
3364 /// Sets all the options, replacing any prior values.
3365 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3366 self.0.options = v.into();
3367 self
3368 }
3369
3370 /// Sends the request.
3371 pub async fn send(self) -> Result<crate::model::Service> {
3372 (*self.0.stub)
3373 .get_service(self.0.request, self.0.options)
3374 .await
3375 .map(gax::response::Response::into_body)
3376 }
3377
3378 /// Sets the value of [name][crate::model::GetServiceRequest::name].
3379 ///
3380 /// This is a **required** field for requests.
3381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3382 self.0.request.name = v.into();
3383 self
3384 }
3385 }
3386
3387 #[doc(hidden)]
3388 impl gax::options::internal::RequestBuilder for GetService {
3389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3390 &mut self.0.options
3391 }
3392 }
3393
3394 /// The request builder for [ServiceMonitoringService::list_services][crate::client::ServiceMonitoringService::list_services] calls.
3395 ///
3396 /// # Example
3397 /// ```no_run
3398 /// # use google_cloud_monitoring_v3::builder;
3399 /// use builder::service_monitoring_service::ListServices;
3400 /// # tokio_test::block_on(async {
3401 /// use gax::paginator::ItemPaginator;
3402 ///
3403 /// let builder = prepare_request_builder();
3404 /// let mut items = builder.by_item();
3405 /// while let Some(result) = items.next().await {
3406 /// let item = result?;
3407 /// }
3408 /// # gax::Result::<()>::Ok(()) });
3409 ///
3410 /// fn prepare_request_builder() -> ListServices {
3411 /// # panic!();
3412 /// // ... details omitted ...
3413 /// }
3414 /// ```
3415 #[derive(Clone, Debug)]
3416 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
3417
3418 impl ListServices {
3419 pub(crate) fn new(
3420 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3421 ) -> Self {
3422 Self(RequestBuilder::new(stub))
3423 }
3424
3425 /// Sets the full request, replacing any prior values.
3426 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
3427 self.0.request = v.into();
3428 self
3429 }
3430
3431 /// Sets all the options, replacing any prior values.
3432 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3433 self.0.options = v.into();
3434 self
3435 }
3436
3437 /// Sends the request.
3438 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
3439 (*self.0.stub)
3440 .list_services(self.0.request, self.0.options)
3441 .await
3442 .map(gax::response::Response::into_body)
3443 }
3444
3445 /// Streams each page in the collection.
3446 pub fn by_page(
3447 self,
3448 ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
3449 {
3450 use std::clone::Clone;
3451 let token = self.0.request.page_token.clone();
3452 let execute = move |token: String| {
3453 let mut builder = self.clone();
3454 builder.0.request = builder.0.request.set_page_token(token);
3455 builder.send()
3456 };
3457 gax::paginator::internal::new_paginator(token, execute)
3458 }
3459
3460 /// Streams each item in the collection.
3461 pub fn by_item(
3462 self,
3463 ) -> impl gax::paginator::ItemPaginator<crate::model::ListServicesResponse, gax::error::Error>
3464 {
3465 use gax::paginator::Paginator;
3466 self.by_page().items()
3467 }
3468
3469 /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
3470 ///
3471 /// This is a **required** field for requests.
3472 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3473 self.0.request.parent = v.into();
3474 self
3475 }
3476
3477 /// Sets the value of [filter][crate::model::ListServicesRequest::filter].
3478 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3479 self.0.request.filter = v.into();
3480 self
3481 }
3482
3483 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
3484 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3485 self.0.request.page_size = v.into();
3486 self
3487 }
3488
3489 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
3490 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3491 self.0.request.page_token = v.into();
3492 self
3493 }
3494 }
3495
3496 #[doc(hidden)]
3497 impl gax::options::internal::RequestBuilder for ListServices {
3498 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3499 &mut self.0.options
3500 }
3501 }
3502
3503 /// The request builder for [ServiceMonitoringService::update_service][crate::client::ServiceMonitoringService::update_service] calls.
3504 ///
3505 /// # Example
3506 /// ```no_run
3507 /// # use google_cloud_monitoring_v3::builder;
3508 /// use builder::service_monitoring_service::UpdateService;
3509 /// # tokio_test::block_on(async {
3510 ///
3511 /// let builder = prepare_request_builder();
3512 /// let response = builder.send().await?;
3513 /// # gax::Result::<()>::Ok(()) });
3514 ///
3515 /// fn prepare_request_builder() -> UpdateService {
3516 /// # panic!();
3517 /// // ... details omitted ...
3518 /// }
3519 /// ```
3520 #[derive(Clone, Debug)]
3521 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
3522
3523 impl UpdateService {
3524 pub(crate) fn new(
3525 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3526 ) -> Self {
3527 Self(RequestBuilder::new(stub))
3528 }
3529
3530 /// Sets the full request, replacing any prior values.
3531 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
3532 self.0.request = v.into();
3533 self
3534 }
3535
3536 /// Sets all the options, replacing any prior values.
3537 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3538 self.0.options = v.into();
3539 self
3540 }
3541
3542 /// Sends the request.
3543 pub async fn send(self) -> Result<crate::model::Service> {
3544 (*self.0.stub)
3545 .update_service(self.0.request, self.0.options)
3546 .await
3547 .map(gax::response::Response::into_body)
3548 }
3549
3550 /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
3551 ///
3552 /// This is a **required** field for requests.
3553 pub fn set_service<T>(mut self, v: T) -> Self
3554 where
3555 T: std::convert::Into<crate::model::Service>,
3556 {
3557 self.0.request.service = std::option::Option::Some(v.into());
3558 self
3559 }
3560
3561 /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
3562 ///
3563 /// This is a **required** field for requests.
3564 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3565 where
3566 T: std::convert::Into<crate::model::Service>,
3567 {
3568 self.0.request.service = v.map(|x| x.into());
3569 self
3570 }
3571
3572 /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
3573 pub fn set_update_mask<T>(mut self, v: T) -> Self
3574 where
3575 T: std::convert::Into<wkt::FieldMask>,
3576 {
3577 self.0.request.update_mask = std::option::Option::Some(v.into());
3578 self
3579 }
3580
3581 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
3582 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3583 where
3584 T: std::convert::Into<wkt::FieldMask>,
3585 {
3586 self.0.request.update_mask = v.map(|x| x.into());
3587 self
3588 }
3589 }
3590
3591 #[doc(hidden)]
3592 impl gax::options::internal::RequestBuilder for UpdateService {
3593 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3594 &mut self.0.options
3595 }
3596 }
3597
3598 /// The request builder for [ServiceMonitoringService::delete_service][crate::client::ServiceMonitoringService::delete_service] calls.
3599 ///
3600 /// # Example
3601 /// ```no_run
3602 /// # use google_cloud_monitoring_v3::builder;
3603 /// use builder::service_monitoring_service::DeleteService;
3604 /// # tokio_test::block_on(async {
3605 ///
3606 /// let builder = prepare_request_builder();
3607 /// let response = builder.send().await?;
3608 /// # gax::Result::<()>::Ok(()) });
3609 ///
3610 /// fn prepare_request_builder() -> DeleteService {
3611 /// # panic!();
3612 /// // ... details omitted ...
3613 /// }
3614 /// ```
3615 #[derive(Clone, Debug)]
3616 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
3617
3618 impl DeleteService {
3619 pub(crate) fn new(
3620 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3621 ) -> Self {
3622 Self(RequestBuilder::new(stub))
3623 }
3624
3625 /// Sets the full request, replacing any prior values.
3626 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
3627 self.0.request = v.into();
3628 self
3629 }
3630
3631 /// Sets all the options, replacing any prior values.
3632 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3633 self.0.options = v.into();
3634 self
3635 }
3636
3637 /// Sends the request.
3638 pub async fn send(self) -> Result<()> {
3639 (*self.0.stub)
3640 .delete_service(self.0.request, self.0.options)
3641 .await
3642 .map(gax::response::Response::into_body)
3643 }
3644
3645 /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
3646 ///
3647 /// This is a **required** field for requests.
3648 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3649 self.0.request.name = v.into();
3650 self
3651 }
3652 }
3653
3654 #[doc(hidden)]
3655 impl gax::options::internal::RequestBuilder for DeleteService {
3656 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3657 &mut self.0.options
3658 }
3659 }
3660
3661 /// The request builder for [ServiceMonitoringService::create_service_level_objective][crate::client::ServiceMonitoringService::create_service_level_objective] calls.
3662 ///
3663 /// # Example
3664 /// ```no_run
3665 /// # use google_cloud_monitoring_v3::builder;
3666 /// use builder::service_monitoring_service::CreateServiceLevelObjective;
3667 /// # tokio_test::block_on(async {
3668 ///
3669 /// let builder = prepare_request_builder();
3670 /// let response = builder.send().await?;
3671 /// # gax::Result::<()>::Ok(()) });
3672 ///
3673 /// fn prepare_request_builder() -> CreateServiceLevelObjective {
3674 /// # panic!();
3675 /// // ... details omitted ...
3676 /// }
3677 /// ```
3678 #[derive(Clone, Debug)]
3679 pub struct CreateServiceLevelObjective(
3680 RequestBuilder<crate::model::CreateServiceLevelObjectiveRequest>,
3681 );
3682
3683 impl CreateServiceLevelObjective {
3684 pub(crate) fn new(
3685 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3686 ) -> Self {
3687 Self(RequestBuilder::new(stub))
3688 }
3689
3690 /// Sets the full request, replacing any prior values.
3691 pub fn with_request<V: Into<crate::model::CreateServiceLevelObjectiveRequest>>(
3692 mut self,
3693 v: V,
3694 ) -> Self {
3695 self.0.request = v.into();
3696 self
3697 }
3698
3699 /// Sets all the options, replacing any prior values.
3700 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3701 self.0.options = v.into();
3702 self
3703 }
3704
3705 /// Sends the request.
3706 pub async fn send(self) -> Result<crate::model::ServiceLevelObjective> {
3707 (*self.0.stub)
3708 .create_service_level_objective(self.0.request, self.0.options)
3709 .await
3710 .map(gax::response::Response::into_body)
3711 }
3712
3713 /// Sets the value of [parent][crate::model::CreateServiceLevelObjectiveRequest::parent].
3714 ///
3715 /// This is a **required** field for requests.
3716 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3717 self.0.request.parent = v.into();
3718 self
3719 }
3720
3721 /// Sets the value of [service_level_objective_id][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective_id].
3722 pub fn set_service_level_objective_id<T: Into<std::string::String>>(
3723 mut self,
3724 v: T,
3725 ) -> Self {
3726 self.0.request.service_level_objective_id = v.into();
3727 self
3728 }
3729
3730 /// Sets the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
3731 ///
3732 /// This is a **required** field for requests.
3733 pub fn set_service_level_objective<T>(mut self, v: T) -> Self
3734 where
3735 T: std::convert::Into<crate::model::ServiceLevelObjective>,
3736 {
3737 self.0.request.service_level_objective = std::option::Option::Some(v.into());
3738 self
3739 }
3740
3741 /// Sets or clears the value of [service_level_objective][crate::model::CreateServiceLevelObjectiveRequest::service_level_objective].
3742 ///
3743 /// This is a **required** field for requests.
3744 pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
3745 where
3746 T: std::convert::Into<crate::model::ServiceLevelObjective>,
3747 {
3748 self.0.request.service_level_objective = v.map(|x| x.into());
3749 self
3750 }
3751 }
3752
3753 #[doc(hidden)]
3754 impl gax::options::internal::RequestBuilder for CreateServiceLevelObjective {
3755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3756 &mut self.0.options
3757 }
3758 }
3759
3760 /// The request builder for [ServiceMonitoringService::get_service_level_objective][crate::client::ServiceMonitoringService::get_service_level_objective] calls.
3761 ///
3762 /// # Example
3763 /// ```no_run
3764 /// # use google_cloud_monitoring_v3::builder;
3765 /// use builder::service_monitoring_service::GetServiceLevelObjective;
3766 /// # tokio_test::block_on(async {
3767 ///
3768 /// let builder = prepare_request_builder();
3769 /// let response = builder.send().await?;
3770 /// # gax::Result::<()>::Ok(()) });
3771 ///
3772 /// fn prepare_request_builder() -> GetServiceLevelObjective {
3773 /// # panic!();
3774 /// // ... details omitted ...
3775 /// }
3776 /// ```
3777 #[derive(Clone, Debug)]
3778 pub struct GetServiceLevelObjective(
3779 RequestBuilder<crate::model::GetServiceLevelObjectiveRequest>,
3780 );
3781
3782 impl GetServiceLevelObjective {
3783 pub(crate) fn new(
3784 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3785 ) -> Self {
3786 Self(RequestBuilder::new(stub))
3787 }
3788
3789 /// Sets the full request, replacing any prior values.
3790 pub fn with_request<V: Into<crate::model::GetServiceLevelObjectiveRequest>>(
3791 mut self,
3792 v: V,
3793 ) -> Self {
3794 self.0.request = v.into();
3795 self
3796 }
3797
3798 /// Sets all the options, replacing any prior values.
3799 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3800 self.0.options = v.into();
3801 self
3802 }
3803
3804 /// Sends the request.
3805 pub async fn send(self) -> Result<crate::model::ServiceLevelObjective> {
3806 (*self.0.stub)
3807 .get_service_level_objective(self.0.request, self.0.options)
3808 .await
3809 .map(gax::response::Response::into_body)
3810 }
3811
3812 /// Sets the value of [name][crate::model::GetServiceLevelObjectiveRequest::name].
3813 ///
3814 /// This is a **required** field for requests.
3815 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3816 self.0.request.name = v.into();
3817 self
3818 }
3819
3820 /// Sets the value of [view][crate::model::GetServiceLevelObjectiveRequest::view].
3821 pub fn set_view<T: Into<crate::model::service_level_objective::View>>(
3822 mut self,
3823 v: T,
3824 ) -> Self {
3825 self.0.request.view = v.into();
3826 self
3827 }
3828 }
3829
3830 #[doc(hidden)]
3831 impl gax::options::internal::RequestBuilder for GetServiceLevelObjective {
3832 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3833 &mut self.0.options
3834 }
3835 }
3836
3837 /// The request builder for [ServiceMonitoringService::list_service_level_objectives][crate::client::ServiceMonitoringService::list_service_level_objectives] calls.
3838 ///
3839 /// # Example
3840 /// ```no_run
3841 /// # use google_cloud_monitoring_v3::builder;
3842 /// use builder::service_monitoring_service::ListServiceLevelObjectives;
3843 /// # tokio_test::block_on(async {
3844 /// use gax::paginator::ItemPaginator;
3845 ///
3846 /// let builder = prepare_request_builder();
3847 /// let mut items = builder.by_item();
3848 /// while let Some(result) = items.next().await {
3849 /// let item = result?;
3850 /// }
3851 /// # gax::Result::<()>::Ok(()) });
3852 ///
3853 /// fn prepare_request_builder() -> ListServiceLevelObjectives {
3854 /// # panic!();
3855 /// // ... details omitted ...
3856 /// }
3857 /// ```
3858 #[derive(Clone, Debug)]
3859 pub struct ListServiceLevelObjectives(
3860 RequestBuilder<crate::model::ListServiceLevelObjectivesRequest>,
3861 );
3862
3863 impl ListServiceLevelObjectives {
3864 pub(crate) fn new(
3865 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3866 ) -> Self {
3867 Self(RequestBuilder::new(stub))
3868 }
3869
3870 /// Sets the full request, replacing any prior values.
3871 pub fn with_request<V: Into<crate::model::ListServiceLevelObjectivesRequest>>(
3872 mut self,
3873 v: V,
3874 ) -> Self {
3875 self.0.request = v.into();
3876 self
3877 }
3878
3879 /// Sets all the options, replacing any prior values.
3880 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3881 self.0.options = v.into();
3882 self
3883 }
3884
3885 /// Sends the request.
3886 pub async fn send(self) -> Result<crate::model::ListServiceLevelObjectivesResponse> {
3887 (*self.0.stub)
3888 .list_service_level_objectives(self.0.request, self.0.options)
3889 .await
3890 .map(gax::response::Response::into_body)
3891 }
3892
3893 /// Streams each page in the collection.
3894 pub fn by_page(
3895 self,
3896 ) -> impl gax::paginator::Paginator<
3897 crate::model::ListServiceLevelObjectivesResponse,
3898 gax::error::Error,
3899 > {
3900 use std::clone::Clone;
3901 let token = self.0.request.page_token.clone();
3902 let execute = move |token: String| {
3903 let mut builder = self.clone();
3904 builder.0.request = builder.0.request.set_page_token(token);
3905 builder.send()
3906 };
3907 gax::paginator::internal::new_paginator(token, execute)
3908 }
3909
3910 /// Streams each item in the collection.
3911 pub fn by_item(
3912 self,
3913 ) -> impl gax::paginator::ItemPaginator<
3914 crate::model::ListServiceLevelObjectivesResponse,
3915 gax::error::Error,
3916 > {
3917 use gax::paginator::Paginator;
3918 self.by_page().items()
3919 }
3920
3921 /// Sets the value of [parent][crate::model::ListServiceLevelObjectivesRequest::parent].
3922 ///
3923 /// This is a **required** field for requests.
3924 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3925 self.0.request.parent = v.into();
3926 self
3927 }
3928
3929 /// Sets the value of [filter][crate::model::ListServiceLevelObjectivesRequest::filter].
3930 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3931 self.0.request.filter = v.into();
3932 self
3933 }
3934
3935 /// Sets the value of [page_size][crate::model::ListServiceLevelObjectivesRequest::page_size].
3936 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3937 self.0.request.page_size = v.into();
3938 self
3939 }
3940
3941 /// Sets the value of [page_token][crate::model::ListServiceLevelObjectivesRequest::page_token].
3942 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3943 self.0.request.page_token = v.into();
3944 self
3945 }
3946
3947 /// Sets the value of [view][crate::model::ListServiceLevelObjectivesRequest::view].
3948 pub fn set_view<T: Into<crate::model::service_level_objective::View>>(
3949 mut self,
3950 v: T,
3951 ) -> Self {
3952 self.0.request.view = v.into();
3953 self
3954 }
3955 }
3956
3957 #[doc(hidden)]
3958 impl gax::options::internal::RequestBuilder for ListServiceLevelObjectives {
3959 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3960 &mut self.0.options
3961 }
3962 }
3963
3964 /// The request builder for [ServiceMonitoringService::update_service_level_objective][crate::client::ServiceMonitoringService::update_service_level_objective] calls.
3965 ///
3966 /// # Example
3967 /// ```no_run
3968 /// # use google_cloud_monitoring_v3::builder;
3969 /// use builder::service_monitoring_service::UpdateServiceLevelObjective;
3970 /// # tokio_test::block_on(async {
3971 ///
3972 /// let builder = prepare_request_builder();
3973 /// let response = builder.send().await?;
3974 /// # gax::Result::<()>::Ok(()) });
3975 ///
3976 /// fn prepare_request_builder() -> UpdateServiceLevelObjective {
3977 /// # panic!();
3978 /// // ... details omitted ...
3979 /// }
3980 /// ```
3981 #[derive(Clone, Debug)]
3982 pub struct UpdateServiceLevelObjective(
3983 RequestBuilder<crate::model::UpdateServiceLevelObjectiveRequest>,
3984 );
3985
3986 impl UpdateServiceLevelObjective {
3987 pub(crate) fn new(
3988 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
3989 ) -> Self {
3990 Self(RequestBuilder::new(stub))
3991 }
3992
3993 /// Sets the full request, replacing any prior values.
3994 pub fn with_request<V: Into<crate::model::UpdateServiceLevelObjectiveRequest>>(
3995 mut self,
3996 v: V,
3997 ) -> Self {
3998 self.0.request = v.into();
3999 self
4000 }
4001
4002 /// Sets all the options, replacing any prior values.
4003 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4004 self.0.options = v.into();
4005 self
4006 }
4007
4008 /// Sends the request.
4009 pub async fn send(self) -> Result<crate::model::ServiceLevelObjective> {
4010 (*self.0.stub)
4011 .update_service_level_objective(self.0.request, self.0.options)
4012 .await
4013 .map(gax::response::Response::into_body)
4014 }
4015
4016 /// Sets the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
4017 ///
4018 /// This is a **required** field for requests.
4019 pub fn set_service_level_objective<T>(mut self, v: T) -> Self
4020 where
4021 T: std::convert::Into<crate::model::ServiceLevelObjective>,
4022 {
4023 self.0.request.service_level_objective = std::option::Option::Some(v.into());
4024 self
4025 }
4026
4027 /// Sets or clears the value of [service_level_objective][crate::model::UpdateServiceLevelObjectiveRequest::service_level_objective].
4028 ///
4029 /// This is a **required** field for requests.
4030 pub fn set_or_clear_service_level_objective<T>(mut self, v: std::option::Option<T>) -> Self
4031 where
4032 T: std::convert::Into<crate::model::ServiceLevelObjective>,
4033 {
4034 self.0.request.service_level_objective = v.map(|x| x.into());
4035 self
4036 }
4037
4038 /// Sets the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
4039 pub fn set_update_mask<T>(mut self, v: T) -> Self
4040 where
4041 T: std::convert::Into<wkt::FieldMask>,
4042 {
4043 self.0.request.update_mask = std::option::Option::Some(v.into());
4044 self
4045 }
4046
4047 /// Sets or clears the value of [update_mask][crate::model::UpdateServiceLevelObjectiveRequest::update_mask].
4048 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4049 where
4050 T: std::convert::Into<wkt::FieldMask>,
4051 {
4052 self.0.request.update_mask = v.map(|x| x.into());
4053 self
4054 }
4055 }
4056
4057 #[doc(hidden)]
4058 impl gax::options::internal::RequestBuilder for UpdateServiceLevelObjective {
4059 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4060 &mut self.0.options
4061 }
4062 }
4063
4064 /// The request builder for [ServiceMonitoringService::delete_service_level_objective][crate::client::ServiceMonitoringService::delete_service_level_objective] calls.
4065 ///
4066 /// # Example
4067 /// ```no_run
4068 /// # use google_cloud_monitoring_v3::builder;
4069 /// use builder::service_monitoring_service::DeleteServiceLevelObjective;
4070 /// # tokio_test::block_on(async {
4071 ///
4072 /// let builder = prepare_request_builder();
4073 /// let response = builder.send().await?;
4074 /// # gax::Result::<()>::Ok(()) });
4075 ///
4076 /// fn prepare_request_builder() -> DeleteServiceLevelObjective {
4077 /// # panic!();
4078 /// // ... details omitted ...
4079 /// }
4080 /// ```
4081 #[derive(Clone, Debug)]
4082 pub struct DeleteServiceLevelObjective(
4083 RequestBuilder<crate::model::DeleteServiceLevelObjectiveRequest>,
4084 );
4085
4086 impl DeleteServiceLevelObjective {
4087 pub(crate) fn new(
4088 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceMonitoringService>,
4089 ) -> Self {
4090 Self(RequestBuilder::new(stub))
4091 }
4092
4093 /// Sets the full request, replacing any prior values.
4094 pub fn with_request<V: Into<crate::model::DeleteServiceLevelObjectiveRequest>>(
4095 mut self,
4096 v: V,
4097 ) -> Self {
4098 self.0.request = v.into();
4099 self
4100 }
4101
4102 /// Sets all the options, replacing any prior values.
4103 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4104 self.0.options = v.into();
4105 self
4106 }
4107
4108 /// Sends the request.
4109 pub async fn send(self) -> Result<()> {
4110 (*self.0.stub)
4111 .delete_service_level_objective(self.0.request, self.0.options)
4112 .await
4113 .map(gax::response::Response::into_body)
4114 }
4115
4116 /// Sets the value of [name][crate::model::DeleteServiceLevelObjectiveRequest::name].
4117 ///
4118 /// This is a **required** field for requests.
4119 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4120 self.0.request.name = v.into();
4121 self
4122 }
4123 }
4124
4125 #[doc(hidden)]
4126 impl gax::options::internal::RequestBuilder for DeleteServiceLevelObjective {
4127 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4128 &mut self.0.options
4129 }
4130 }
4131}
4132
4133pub mod snooze_service {
4134 use crate::Result;
4135
4136 /// A builder for [SnoozeService][crate::client::SnoozeService].
4137 ///
4138 /// ```
4139 /// # tokio_test::block_on(async {
4140 /// # use google_cloud_monitoring_v3::*;
4141 /// # use builder::snooze_service::ClientBuilder;
4142 /// # use client::SnoozeService;
4143 /// let builder : ClientBuilder = SnoozeService::builder();
4144 /// let client = builder
4145 /// .with_endpoint("https://monitoring.googleapis.com")
4146 /// .build().await?;
4147 /// # gax::client_builder::Result::<()>::Ok(()) });
4148 /// ```
4149 pub type ClientBuilder =
4150 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4151
4152 pub(crate) mod client {
4153 use super::super::super::client::SnoozeService;
4154 pub struct Factory;
4155 impl gax::client_builder::internal::ClientFactory for Factory {
4156 type Client = SnoozeService;
4157 type Credentials = gaxi::options::Credentials;
4158 async fn build(
4159 self,
4160 config: gaxi::options::ClientConfig,
4161 ) -> gax::client_builder::Result<Self::Client> {
4162 Self::Client::new(config).await
4163 }
4164 }
4165 }
4166
4167 /// Common implementation for [crate::client::SnoozeService] request builders.
4168 #[derive(Clone, Debug)]
4169 pub(crate) struct RequestBuilder<R: std::default::Default> {
4170 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4171 request: R,
4172 options: gax::options::RequestOptions,
4173 }
4174
4175 impl<R> RequestBuilder<R>
4176 where
4177 R: std::default::Default,
4178 {
4179 pub(crate) fn new(
4180 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4181 ) -> Self {
4182 Self {
4183 stub,
4184 request: R::default(),
4185 options: gax::options::RequestOptions::default(),
4186 }
4187 }
4188 }
4189
4190 /// The request builder for [SnoozeService::create_snooze][crate::client::SnoozeService::create_snooze] calls.
4191 ///
4192 /// # Example
4193 /// ```no_run
4194 /// # use google_cloud_monitoring_v3::builder;
4195 /// use builder::snooze_service::CreateSnooze;
4196 /// # tokio_test::block_on(async {
4197 ///
4198 /// let builder = prepare_request_builder();
4199 /// let response = builder.send().await?;
4200 /// # gax::Result::<()>::Ok(()) });
4201 ///
4202 /// fn prepare_request_builder() -> CreateSnooze {
4203 /// # panic!();
4204 /// // ... details omitted ...
4205 /// }
4206 /// ```
4207 #[derive(Clone, Debug)]
4208 pub struct CreateSnooze(RequestBuilder<crate::model::CreateSnoozeRequest>);
4209
4210 impl CreateSnooze {
4211 pub(crate) fn new(
4212 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4213 ) -> Self {
4214 Self(RequestBuilder::new(stub))
4215 }
4216
4217 /// Sets the full request, replacing any prior values.
4218 pub fn with_request<V: Into<crate::model::CreateSnoozeRequest>>(mut self, v: V) -> Self {
4219 self.0.request = v.into();
4220 self
4221 }
4222
4223 /// Sets all the options, replacing any prior values.
4224 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4225 self.0.options = v.into();
4226 self
4227 }
4228
4229 /// Sends the request.
4230 pub async fn send(self) -> Result<crate::model::Snooze> {
4231 (*self.0.stub)
4232 .create_snooze(self.0.request, self.0.options)
4233 .await
4234 .map(gax::response::Response::into_body)
4235 }
4236
4237 /// Sets the value of [parent][crate::model::CreateSnoozeRequest::parent].
4238 ///
4239 /// This is a **required** field for requests.
4240 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4241 self.0.request.parent = v.into();
4242 self
4243 }
4244
4245 /// Sets the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
4246 ///
4247 /// This is a **required** field for requests.
4248 pub fn set_snooze<T>(mut self, v: T) -> Self
4249 where
4250 T: std::convert::Into<crate::model::Snooze>,
4251 {
4252 self.0.request.snooze = std::option::Option::Some(v.into());
4253 self
4254 }
4255
4256 /// Sets or clears the value of [snooze][crate::model::CreateSnoozeRequest::snooze].
4257 ///
4258 /// This is a **required** field for requests.
4259 pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
4260 where
4261 T: std::convert::Into<crate::model::Snooze>,
4262 {
4263 self.0.request.snooze = v.map(|x| x.into());
4264 self
4265 }
4266 }
4267
4268 #[doc(hidden)]
4269 impl gax::options::internal::RequestBuilder for CreateSnooze {
4270 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4271 &mut self.0.options
4272 }
4273 }
4274
4275 /// The request builder for [SnoozeService::list_snoozes][crate::client::SnoozeService::list_snoozes] calls.
4276 ///
4277 /// # Example
4278 /// ```no_run
4279 /// # use google_cloud_monitoring_v3::builder;
4280 /// use builder::snooze_service::ListSnoozes;
4281 /// # tokio_test::block_on(async {
4282 /// use gax::paginator::ItemPaginator;
4283 ///
4284 /// let builder = prepare_request_builder();
4285 /// let mut items = builder.by_item();
4286 /// while let Some(result) = items.next().await {
4287 /// let item = result?;
4288 /// }
4289 /// # gax::Result::<()>::Ok(()) });
4290 ///
4291 /// fn prepare_request_builder() -> ListSnoozes {
4292 /// # panic!();
4293 /// // ... details omitted ...
4294 /// }
4295 /// ```
4296 #[derive(Clone, Debug)]
4297 pub struct ListSnoozes(RequestBuilder<crate::model::ListSnoozesRequest>);
4298
4299 impl ListSnoozes {
4300 pub(crate) fn new(
4301 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4302 ) -> Self {
4303 Self(RequestBuilder::new(stub))
4304 }
4305
4306 /// Sets the full request, replacing any prior values.
4307 pub fn with_request<V: Into<crate::model::ListSnoozesRequest>>(mut self, v: V) -> Self {
4308 self.0.request = v.into();
4309 self
4310 }
4311
4312 /// Sets all the options, replacing any prior values.
4313 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4314 self.0.options = v.into();
4315 self
4316 }
4317
4318 /// Sends the request.
4319 pub async fn send(self) -> Result<crate::model::ListSnoozesResponse> {
4320 (*self.0.stub)
4321 .list_snoozes(self.0.request, self.0.options)
4322 .await
4323 .map(gax::response::Response::into_body)
4324 }
4325
4326 /// Streams each page in the collection.
4327 pub fn by_page(
4328 self,
4329 ) -> impl gax::paginator::Paginator<crate::model::ListSnoozesResponse, gax::error::Error>
4330 {
4331 use std::clone::Clone;
4332 let token = self.0.request.page_token.clone();
4333 let execute = move |token: String| {
4334 let mut builder = self.clone();
4335 builder.0.request = builder.0.request.set_page_token(token);
4336 builder.send()
4337 };
4338 gax::paginator::internal::new_paginator(token, execute)
4339 }
4340
4341 /// Streams each item in the collection.
4342 pub fn by_item(
4343 self,
4344 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSnoozesResponse, gax::error::Error>
4345 {
4346 use gax::paginator::Paginator;
4347 self.by_page().items()
4348 }
4349
4350 /// Sets the value of [parent][crate::model::ListSnoozesRequest::parent].
4351 ///
4352 /// This is a **required** field for requests.
4353 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4354 self.0.request.parent = v.into();
4355 self
4356 }
4357
4358 /// Sets the value of [filter][crate::model::ListSnoozesRequest::filter].
4359 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4360 self.0.request.filter = v.into();
4361 self
4362 }
4363
4364 /// Sets the value of [page_size][crate::model::ListSnoozesRequest::page_size].
4365 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4366 self.0.request.page_size = v.into();
4367 self
4368 }
4369
4370 /// Sets the value of [page_token][crate::model::ListSnoozesRequest::page_token].
4371 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4372 self.0.request.page_token = v.into();
4373 self
4374 }
4375 }
4376
4377 #[doc(hidden)]
4378 impl gax::options::internal::RequestBuilder for ListSnoozes {
4379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4380 &mut self.0.options
4381 }
4382 }
4383
4384 /// The request builder for [SnoozeService::get_snooze][crate::client::SnoozeService::get_snooze] calls.
4385 ///
4386 /// # Example
4387 /// ```no_run
4388 /// # use google_cloud_monitoring_v3::builder;
4389 /// use builder::snooze_service::GetSnooze;
4390 /// # tokio_test::block_on(async {
4391 ///
4392 /// let builder = prepare_request_builder();
4393 /// let response = builder.send().await?;
4394 /// # gax::Result::<()>::Ok(()) });
4395 ///
4396 /// fn prepare_request_builder() -> GetSnooze {
4397 /// # panic!();
4398 /// // ... details omitted ...
4399 /// }
4400 /// ```
4401 #[derive(Clone, Debug)]
4402 pub struct GetSnooze(RequestBuilder<crate::model::GetSnoozeRequest>);
4403
4404 impl GetSnooze {
4405 pub(crate) fn new(
4406 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4407 ) -> Self {
4408 Self(RequestBuilder::new(stub))
4409 }
4410
4411 /// Sets the full request, replacing any prior values.
4412 pub fn with_request<V: Into<crate::model::GetSnoozeRequest>>(mut self, v: V) -> Self {
4413 self.0.request = v.into();
4414 self
4415 }
4416
4417 /// Sets all the options, replacing any prior values.
4418 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4419 self.0.options = v.into();
4420 self
4421 }
4422
4423 /// Sends the request.
4424 pub async fn send(self) -> Result<crate::model::Snooze> {
4425 (*self.0.stub)
4426 .get_snooze(self.0.request, self.0.options)
4427 .await
4428 .map(gax::response::Response::into_body)
4429 }
4430
4431 /// Sets the value of [name][crate::model::GetSnoozeRequest::name].
4432 ///
4433 /// This is a **required** field for requests.
4434 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4435 self.0.request.name = v.into();
4436 self
4437 }
4438 }
4439
4440 #[doc(hidden)]
4441 impl gax::options::internal::RequestBuilder for GetSnooze {
4442 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4443 &mut self.0.options
4444 }
4445 }
4446
4447 /// The request builder for [SnoozeService::update_snooze][crate::client::SnoozeService::update_snooze] calls.
4448 ///
4449 /// # Example
4450 /// ```no_run
4451 /// # use google_cloud_monitoring_v3::builder;
4452 /// use builder::snooze_service::UpdateSnooze;
4453 /// # tokio_test::block_on(async {
4454 ///
4455 /// let builder = prepare_request_builder();
4456 /// let response = builder.send().await?;
4457 /// # gax::Result::<()>::Ok(()) });
4458 ///
4459 /// fn prepare_request_builder() -> UpdateSnooze {
4460 /// # panic!();
4461 /// // ... details omitted ...
4462 /// }
4463 /// ```
4464 #[derive(Clone, Debug)]
4465 pub struct UpdateSnooze(RequestBuilder<crate::model::UpdateSnoozeRequest>);
4466
4467 impl UpdateSnooze {
4468 pub(crate) fn new(
4469 stub: std::sync::Arc<dyn super::super::stub::dynamic::SnoozeService>,
4470 ) -> Self {
4471 Self(RequestBuilder::new(stub))
4472 }
4473
4474 /// Sets the full request, replacing any prior values.
4475 pub fn with_request<V: Into<crate::model::UpdateSnoozeRequest>>(mut self, v: V) -> Self {
4476 self.0.request = v.into();
4477 self
4478 }
4479
4480 /// Sets all the options, replacing any prior values.
4481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4482 self.0.options = v.into();
4483 self
4484 }
4485
4486 /// Sends the request.
4487 pub async fn send(self) -> Result<crate::model::Snooze> {
4488 (*self.0.stub)
4489 .update_snooze(self.0.request, self.0.options)
4490 .await
4491 .map(gax::response::Response::into_body)
4492 }
4493
4494 /// Sets the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
4495 ///
4496 /// This is a **required** field for requests.
4497 pub fn set_snooze<T>(mut self, v: T) -> Self
4498 where
4499 T: std::convert::Into<crate::model::Snooze>,
4500 {
4501 self.0.request.snooze = std::option::Option::Some(v.into());
4502 self
4503 }
4504
4505 /// Sets or clears the value of [snooze][crate::model::UpdateSnoozeRequest::snooze].
4506 ///
4507 /// This is a **required** field for requests.
4508 pub fn set_or_clear_snooze<T>(mut self, v: std::option::Option<T>) -> Self
4509 where
4510 T: std::convert::Into<crate::model::Snooze>,
4511 {
4512 self.0.request.snooze = v.map(|x| x.into());
4513 self
4514 }
4515
4516 /// Sets the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
4517 ///
4518 /// This is a **required** field for requests.
4519 pub fn set_update_mask<T>(mut self, v: T) -> Self
4520 where
4521 T: std::convert::Into<wkt::FieldMask>,
4522 {
4523 self.0.request.update_mask = std::option::Option::Some(v.into());
4524 self
4525 }
4526
4527 /// Sets or clears the value of [update_mask][crate::model::UpdateSnoozeRequest::update_mask].
4528 ///
4529 /// This is a **required** field for requests.
4530 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4531 where
4532 T: std::convert::Into<wkt::FieldMask>,
4533 {
4534 self.0.request.update_mask = v.map(|x| x.into());
4535 self
4536 }
4537 }
4538
4539 #[doc(hidden)]
4540 impl gax::options::internal::RequestBuilder for UpdateSnooze {
4541 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4542 &mut self.0.options
4543 }
4544 }
4545}
4546
4547pub mod uptime_check_service {
4548 use crate::Result;
4549
4550 /// A builder for [UptimeCheckService][crate::client::UptimeCheckService].
4551 ///
4552 /// ```
4553 /// # tokio_test::block_on(async {
4554 /// # use google_cloud_monitoring_v3::*;
4555 /// # use builder::uptime_check_service::ClientBuilder;
4556 /// # use client::UptimeCheckService;
4557 /// let builder : ClientBuilder = UptimeCheckService::builder();
4558 /// let client = builder
4559 /// .with_endpoint("https://monitoring.googleapis.com")
4560 /// .build().await?;
4561 /// # gax::client_builder::Result::<()>::Ok(()) });
4562 /// ```
4563 pub type ClientBuilder =
4564 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4565
4566 pub(crate) mod client {
4567 use super::super::super::client::UptimeCheckService;
4568 pub struct Factory;
4569 impl gax::client_builder::internal::ClientFactory for Factory {
4570 type Client = UptimeCheckService;
4571 type Credentials = gaxi::options::Credentials;
4572 async fn build(
4573 self,
4574 config: gaxi::options::ClientConfig,
4575 ) -> gax::client_builder::Result<Self::Client> {
4576 Self::Client::new(config).await
4577 }
4578 }
4579 }
4580
4581 /// Common implementation for [crate::client::UptimeCheckService] request builders.
4582 #[derive(Clone, Debug)]
4583 pub(crate) struct RequestBuilder<R: std::default::Default> {
4584 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4585 request: R,
4586 options: gax::options::RequestOptions,
4587 }
4588
4589 impl<R> RequestBuilder<R>
4590 where
4591 R: std::default::Default,
4592 {
4593 pub(crate) fn new(
4594 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4595 ) -> Self {
4596 Self {
4597 stub,
4598 request: R::default(),
4599 options: gax::options::RequestOptions::default(),
4600 }
4601 }
4602 }
4603
4604 /// The request builder for [UptimeCheckService::list_uptime_check_configs][crate::client::UptimeCheckService::list_uptime_check_configs] calls.
4605 ///
4606 /// # Example
4607 /// ```no_run
4608 /// # use google_cloud_monitoring_v3::builder;
4609 /// use builder::uptime_check_service::ListUptimeCheckConfigs;
4610 /// # tokio_test::block_on(async {
4611 /// use gax::paginator::ItemPaginator;
4612 ///
4613 /// let builder = prepare_request_builder();
4614 /// let mut items = builder.by_item();
4615 /// while let Some(result) = items.next().await {
4616 /// let item = result?;
4617 /// }
4618 /// # gax::Result::<()>::Ok(()) });
4619 ///
4620 /// fn prepare_request_builder() -> ListUptimeCheckConfigs {
4621 /// # panic!();
4622 /// // ... details omitted ...
4623 /// }
4624 /// ```
4625 #[derive(Clone, Debug)]
4626 pub struct ListUptimeCheckConfigs(RequestBuilder<crate::model::ListUptimeCheckConfigsRequest>);
4627
4628 impl ListUptimeCheckConfigs {
4629 pub(crate) fn new(
4630 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4631 ) -> Self {
4632 Self(RequestBuilder::new(stub))
4633 }
4634
4635 /// Sets the full request, replacing any prior values.
4636 pub fn with_request<V: Into<crate::model::ListUptimeCheckConfigsRequest>>(
4637 mut self,
4638 v: V,
4639 ) -> Self {
4640 self.0.request = v.into();
4641 self
4642 }
4643
4644 /// Sets all the options, replacing any prior values.
4645 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4646 self.0.options = v.into();
4647 self
4648 }
4649
4650 /// Sends the request.
4651 pub async fn send(self) -> Result<crate::model::ListUptimeCheckConfigsResponse> {
4652 (*self.0.stub)
4653 .list_uptime_check_configs(self.0.request, self.0.options)
4654 .await
4655 .map(gax::response::Response::into_body)
4656 }
4657
4658 /// Streams each page in the collection.
4659 pub fn by_page(
4660 self,
4661 ) -> impl gax::paginator::Paginator<
4662 crate::model::ListUptimeCheckConfigsResponse,
4663 gax::error::Error,
4664 > {
4665 use std::clone::Clone;
4666 let token = self.0.request.page_token.clone();
4667 let execute = move |token: String| {
4668 let mut builder = self.clone();
4669 builder.0.request = builder.0.request.set_page_token(token);
4670 builder.send()
4671 };
4672 gax::paginator::internal::new_paginator(token, execute)
4673 }
4674
4675 /// Streams each item in the collection.
4676 pub fn by_item(
4677 self,
4678 ) -> impl gax::paginator::ItemPaginator<
4679 crate::model::ListUptimeCheckConfigsResponse,
4680 gax::error::Error,
4681 > {
4682 use gax::paginator::Paginator;
4683 self.by_page().items()
4684 }
4685
4686 /// Sets the value of [parent][crate::model::ListUptimeCheckConfigsRequest::parent].
4687 ///
4688 /// This is a **required** field for requests.
4689 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4690 self.0.request.parent = v.into();
4691 self
4692 }
4693
4694 /// Sets the value of [filter][crate::model::ListUptimeCheckConfigsRequest::filter].
4695 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4696 self.0.request.filter = v.into();
4697 self
4698 }
4699
4700 /// Sets the value of [page_size][crate::model::ListUptimeCheckConfigsRequest::page_size].
4701 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4702 self.0.request.page_size = v.into();
4703 self
4704 }
4705
4706 /// Sets the value of [page_token][crate::model::ListUptimeCheckConfigsRequest::page_token].
4707 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4708 self.0.request.page_token = v.into();
4709 self
4710 }
4711 }
4712
4713 #[doc(hidden)]
4714 impl gax::options::internal::RequestBuilder for ListUptimeCheckConfigs {
4715 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4716 &mut self.0.options
4717 }
4718 }
4719
4720 /// The request builder for [UptimeCheckService::get_uptime_check_config][crate::client::UptimeCheckService::get_uptime_check_config] calls.
4721 ///
4722 /// # Example
4723 /// ```no_run
4724 /// # use google_cloud_monitoring_v3::builder;
4725 /// use builder::uptime_check_service::GetUptimeCheckConfig;
4726 /// # tokio_test::block_on(async {
4727 ///
4728 /// let builder = prepare_request_builder();
4729 /// let response = builder.send().await?;
4730 /// # gax::Result::<()>::Ok(()) });
4731 ///
4732 /// fn prepare_request_builder() -> GetUptimeCheckConfig {
4733 /// # panic!();
4734 /// // ... details omitted ...
4735 /// }
4736 /// ```
4737 #[derive(Clone, Debug)]
4738 pub struct GetUptimeCheckConfig(RequestBuilder<crate::model::GetUptimeCheckConfigRequest>);
4739
4740 impl GetUptimeCheckConfig {
4741 pub(crate) fn new(
4742 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4743 ) -> Self {
4744 Self(RequestBuilder::new(stub))
4745 }
4746
4747 /// Sets the full request, replacing any prior values.
4748 pub fn with_request<V: Into<crate::model::GetUptimeCheckConfigRequest>>(
4749 mut self,
4750 v: V,
4751 ) -> Self {
4752 self.0.request = v.into();
4753 self
4754 }
4755
4756 /// Sets all the options, replacing any prior values.
4757 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4758 self.0.options = v.into();
4759 self
4760 }
4761
4762 /// Sends the request.
4763 pub async fn send(self) -> Result<crate::model::UptimeCheckConfig> {
4764 (*self.0.stub)
4765 .get_uptime_check_config(self.0.request, self.0.options)
4766 .await
4767 .map(gax::response::Response::into_body)
4768 }
4769
4770 /// Sets the value of [name][crate::model::GetUptimeCheckConfigRequest::name].
4771 ///
4772 /// This is a **required** field for requests.
4773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4774 self.0.request.name = v.into();
4775 self
4776 }
4777 }
4778
4779 #[doc(hidden)]
4780 impl gax::options::internal::RequestBuilder for GetUptimeCheckConfig {
4781 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4782 &mut self.0.options
4783 }
4784 }
4785
4786 /// The request builder for [UptimeCheckService::create_uptime_check_config][crate::client::UptimeCheckService::create_uptime_check_config] calls.
4787 ///
4788 /// # Example
4789 /// ```no_run
4790 /// # use google_cloud_monitoring_v3::builder;
4791 /// use builder::uptime_check_service::CreateUptimeCheckConfig;
4792 /// # tokio_test::block_on(async {
4793 ///
4794 /// let builder = prepare_request_builder();
4795 /// let response = builder.send().await?;
4796 /// # gax::Result::<()>::Ok(()) });
4797 ///
4798 /// fn prepare_request_builder() -> CreateUptimeCheckConfig {
4799 /// # panic!();
4800 /// // ... details omitted ...
4801 /// }
4802 /// ```
4803 #[derive(Clone, Debug)]
4804 pub struct CreateUptimeCheckConfig(
4805 RequestBuilder<crate::model::CreateUptimeCheckConfigRequest>,
4806 );
4807
4808 impl CreateUptimeCheckConfig {
4809 pub(crate) fn new(
4810 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4811 ) -> Self {
4812 Self(RequestBuilder::new(stub))
4813 }
4814
4815 /// Sets the full request, replacing any prior values.
4816 pub fn with_request<V: Into<crate::model::CreateUptimeCheckConfigRequest>>(
4817 mut self,
4818 v: V,
4819 ) -> Self {
4820 self.0.request = v.into();
4821 self
4822 }
4823
4824 /// Sets all the options, replacing any prior values.
4825 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4826 self.0.options = v.into();
4827 self
4828 }
4829
4830 /// Sends the request.
4831 pub async fn send(self) -> Result<crate::model::UptimeCheckConfig> {
4832 (*self.0.stub)
4833 .create_uptime_check_config(self.0.request, self.0.options)
4834 .await
4835 .map(gax::response::Response::into_body)
4836 }
4837
4838 /// Sets the value of [parent][crate::model::CreateUptimeCheckConfigRequest::parent].
4839 ///
4840 /// This is a **required** field for requests.
4841 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4842 self.0.request.parent = v.into();
4843 self
4844 }
4845
4846 /// Sets the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
4847 ///
4848 /// This is a **required** field for requests.
4849 pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
4850 where
4851 T: std::convert::Into<crate::model::UptimeCheckConfig>,
4852 {
4853 self.0.request.uptime_check_config = std::option::Option::Some(v.into());
4854 self
4855 }
4856
4857 /// Sets or clears the value of [uptime_check_config][crate::model::CreateUptimeCheckConfigRequest::uptime_check_config].
4858 ///
4859 /// This is a **required** field for requests.
4860 pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
4861 where
4862 T: std::convert::Into<crate::model::UptimeCheckConfig>,
4863 {
4864 self.0.request.uptime_check_config = v.map(|x| x.into());
4865 self
4866 }
4867 }
4868
4869 #[doc(hidden)]
4870 impl gax::options::internal::RequestBuilder for CreateUptimeCheckConfig {
4871 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4872 &mut self.0.options
4873 }
4874 }
4875
4876 /// The request builder for [UptimeCheckService::update_uptime_check_config][crate::client::UptimeCheckService::update_uptime_check_config] calls.
4877 ///
4878 /// # Example
4879 /// ```no_run
4880 /// # use google_cloud_monitoring_v3::builder;
4881 /// use builder::uptime_check_service::UpdateUptimeCheckConfig;
4882 /// # tokio_test::block_on(async {
4883 ///
4884 /// let builder = prepare_request_builder();
4885 /// let response = builder.send().await?;
4886 /// # gax::Result::<()>::Ok(()) });
4887 ///
4888 /// fn prepare_request_builder() -> UpdateUptimeCheckConfig {
4889 /// # panic!();
4890 /// // ... details omitted ...
4891 /// }
4892 /// ```
4893 #[derive(Clone, Debug)]
4894 pub struct UpdateUptimeCheckConfig(
4895 RequestBuilder<crate::model::UpdateUptimeCheckConfigRequest>,
4896 );
4897
4898 impl UpdateUptimeCheckConfig {
4899 pub(crate) fn new(
4900 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
4901 ) -> Self {
4902 Self(RequestBuilder::new(stub))
4903 }
4904
4905 /// Sets the full request, replacing any prior values.
4906 pub fn with_request<V: Into<crate::model::UpdateUptimeCheckConfigRequest>>(
4907 mut self,
4908 v: V,
4909 ) -> Self {
4910 self.0.request = v.into();
4911 self
4912 }
4913
4914 /// Sets all the options, replacing any prior values.
4915 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4916 self.0.options = v.into();
4917 self
4918 }
4919
4920 /// Sends the request.
4921 pub async fn send(self) -> Result<crate::model::UptimeCheckConfig> {
4922 (*self.0.stub)
4923 .update_uptime_check_config(self.0.request, self.0.options)
4924 .await
4925 .map(gax::response::Response::into_body)
4926 }
4927
4928 /// Sets the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
4929 pub fn set_update_mask<T>(mut self, v: T) -> Self
4930 where
4931 T: std::convert::Into<wkt::FieldMask>,
4932 {
4933 self.0.request.update_mask = std::option::Option::Some(v.into());
4934 self
4935 }
4936
4937 /// Sets or clears the value of [update_mask][crate::model::UpdateUptimeCheckConfigRequest::update_mask].
4938 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4939 where
4940 T: std::convert::Into<wkt::FieldMask>,
4941 {
4942 self.0.request.update_mask = v.map(|x| x.into());
4943 self
4944 }
4945
4946 /// Sets the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
4947 ///
4948 /// This is a **required** field for requests.
4949 pub fn set_uptime_check_config<T>(mut self, v: T) -> Self
4950 where
4951 T: std::convert::Into<crate::model::UptimeCheckConfig>,
4952 {
4953 self.0.request.uptime_check_config = std::option::Option::Some(v.into());
4954 self
4955 }
4956
4957 /// Sets or clears the value of [uptime_check_config][crate::model::UpdateUptimeCheckConfigRequest::uptime_check_config].
4958 ///
4959 /// This is a **required** field for requests.
4960 pub fn set_or_clear_uptime_check_config<T>(mut self, v: std::option::Option<T>) -> Self
4961 where
4962 T: std::convert::Into<crate::model::UptimeCheckConfig>,
4963 {
4964 self.0.request.uptime_check_config = v.map(|x| x.into());
4965 self
4966 }
4967 }
4968
4969 #[doc(hidden)]
4970 impl gax::options::internal::RequestBuilder for UpdateUptimeCheckConfig {
4971 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4972 &mut self.0.options
4973 }
4974 }
4975
4976 /// The request builder for [UptimeCheckService::delete_uptime_check_config][crate::client::UptimeCheckService::delete_uptime_check_config] calls.
4977 ///
4978 /// # Example
4979 /// ```no_run
4980 /// # use google_cloud_monitoring_v3::builder;
4981 /// use builder::uptime_check_service::DeleteUptimeCheckConfig;
4982 /// # tokio_test::block_on(async {
4983 ///
4984 /// let builder = prepare_request_builder();
4985 /// let response = builder.send().await?;
4986 /// # gax::Result::<()>::Ok(()) });
4987 ///
4988 /// fn prepare_request_builder() -> DeleteUptimeCheckConfig {
4989 /// # panic!();
4990 /// // ... details omitted ...
4991 /// }
4992 /// ```
4993 #[derive(Clone, Debug)]
4994 pub struct DeleteUptimeCheckConfig(
4995 RequestBuilder<crate::model::DeleteUptimeCheckConfigRequest>,
4996 );
4997
4998 impl DeleteUptimeCheckConfig {
4999 pub(crate) fn new(
5000 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
5001 ) -> Self {
5002 Self(RequestBuilder::new(stub))
5003 }
5004
5005 /// Sets the full request, replacing any prior values.
5006 pub fn with_request<V: Into<crate::model::DeleteUptimeCheckConfigRequest>>(
5007 mut self,
5008 v: V,
5009 ) -> Self {
5010 self.0.request = v.into();
5011 self
5012 }
5013
5014 /// Sets all the options, replacing any prior values.
5015 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5016 self.0.options = v.into();
5017 self
5018 }
5019
5020 /// Sends the request.
5021 pub async fn send(self) -> Result<()> {
5022 (*self.0.stub)
5023 .delete_uptime_check_config(self.0.request, self.0.options)
5024 .await
5025 .map(gax::response::Response::into_body)
5026 }
5027
5028 /// Sets the value of [name][crate::model::DeleteUptimeCheckConfigRequest::name].
5029 ///
5030 /// This is a **required** field for requests.
5031 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5032 self.0.request.name = v.into();
5033 self
5034 }
5035 }
5036
5037 #[doc(hidden)]
5038 impl gax::options::internal::RequestBuilder for DeleteUptimeCheckConfig {
5039 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5040 &mut self.0.options
5041 }
5042 }
5043
5044 /// The request builder for [UptimeCheckService::list_uptime_check_ips][crate::client::UptimeCheckService::list_uptime_check_ips] calls.
5045 ///
5046 /// # Example
5047 /// ```no_run
5048 /// # use google_cloud_monitoring_v3::builder;
5049 /// use builder::uptime_check_service::ListUptimeCheckIps;
5050 /// # tokio_test::block_on(async {
5051 /// use gax::paginator::ItemPaginator;
5052 ///
5053 /// let builder = prepare_request_builder();
5054 /// let mut items = builder.by_item();
5055 /// while let Some(result) = items.next().await {
5056 /// let item = result?;
5057 /// }
5058 /// # gax::Result::<()>::Ok(()) });
5059 ///
5060 /// fn prepare_request_builder() -> ListUptimeCheckIps {
5061 /// # panic!();
5062 /// // ... details omitted ...
5063 /// }
5064 /// ```
5065 #[derive(Clone, Debug)]
5066 pub struct ListUptimeCheckIps(RequestBuilder<crate::model::ListUptimeCheckIpsRequest>);
5067
5068 impl ListUptimeCheckIps {
5069 pub(crate) fn new(
5070 stub: std::sync::Arc<dyn super::super::stub::dynamic::UptimeCheckService>,
5071 ) -> Self {
5072 Self(RequestBuilder::new(stub))
5073 }
5074
5075 /// Sets the full request, replacing any prior values.
5076 pub fn with_request<V: Into<crate::model::ListUptimeCheckIpsRequest>>(
5077 mut self,
5078 v: V,
5079 ) -> Self {
5080 self.0.request = v.into();
5081 self
5082 }
5083
5084 /// Sets all the options, replacing any prior values.
5085 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5086 self.0.options = v.into();
5087 self
5088 }
5089
5090 /// Sends the request.
5091 pub async fn send(self) -> Result<crate::model::ListUptimeCheckIpsResponse> {
5092 (*self.0.stub)
5093 .list_uptime_check_ips(self.0.request, self.0.options)
5094 .await
5095 .map(gax::response::Response::into_body)
5096 }
5097
5098 /// Streams each page in the collection.
5099 pub fn by_page(
5100 self,
5101 ) -> impl gax::paginator::Paginator<crate::model::ListUptimeCheckIpsResponse, gax::error::Error>
5102 {
5103 use std::clone::Clone;
5104 let token = self.0.request.page_token.clone();
5105 let execute = move |token: String| {
5106 let mut builder = self.clone();
5107 builder.0.request = builder.0.request.set_page_token(token);
5108 builder.send()
5109 };
5110 gax::paginator::internal::new_paginator(token, execute)
5111 }
5112
5113 /// Streams each item in the collection.
5114 pub fn by_item(
5115 self,
5116 ) -> impl gax::paginator::ItemPaginator<
5117 crate::model::ListUptimeCheckIpsResponse,
5118 gax::error::Error,
5119 > {
5120 use gax::paginator::Paginator;
5121 self.by_page().items()
5122 }
5123
5124 /// Sets the value of [page_size][crate::model::ListUptimeCheckIpsRequest::page_size].
5125 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5126 self.0.request.page_size = v.into();
5127 self
5128 }
5129
5130 /// Sets the value of [page_token][crate::model::ListUptimeCheckIpsRequest::page_token].
5131 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5132 self.0.request.page_token = v.into();
5133 self
5134 }
5135 }
5136
5137 #[doc(hidden)]
5138 impl gax::options::internal::RequestBuilder for ListUptimeCheckIps {
5139 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5140 &mut self.0.options
5141 }
5142 }
5143}