Skip to main content

aws_sdk_networksecuritymanager/operation/list_rules/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_rules::_list_rules_input::ListRulesInputBuilder;
3
4pub use crate::operation::list_rules::_list_rules_output::ListRulesOutputBuilder;
5
6impl crate::operation::list_rules::builders::ListRulesInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::list_rules::ListRulesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_rules::ListRulesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_rules();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListRules`.
24///
25/// <p>Lists the rules in the account. You can filter the results by status and page through them using <code>maxResults</code> and <code>nextToken</code>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ListRulesFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::list_rules::builders::ListRulesInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::list_rules::ListRulesOutput, crate::operation::list_rules::ListRulesError>
33    for ListRulesFluentBuilder
34{
35    fn send(
36        self,
37        config_override: crate::config::Builder,
38    ) -> crate::client::customize::internal::BoxFuture<
39        crate::client::customize::internal::SendResult<crate::operation::list_rules::ListRulesOutput, crate::operation::list_rules::ListRulesError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl ListRulesFluentBuilder {
45    /// Creates a new `ListRulesFluentBuilder`.
46    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47        Self {
48            handle,
49            inner: ::std::default::Default::default(),
50            config_override: ::std::option::Option::None,
51        }
52    }
53    /// Access the ListRules as a reference.
54    pub fn as_input(&self) -> &crate::operation::list_rules::builders::ListRulesInputBuilder {
55        &self.inner
56    }
57    /// Sends the request and returns the response.
58    ///
59    /// If an error occurs, an `SdkError` will be returned with additional details that
60    /// can be matched against.
61    ///
62    /// By default, any retryable failures will be retried twice. Retry behavior
63    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
64    /// set when configuring the client.
65    pub async fn send(
66        self,
67    ) -> ::std::result::Result<
68        crate::operation::list_rules::ListRulesOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::list_rules::ListRulesError,
71            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72        >,
73    > {
74        let input = self
75            .inner
76            .build()
77            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78        let runtime_plugins = crate::operation::list_rules::ListRules::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::list_rules::ListRules::orchestrate(&runtime_plugins, input).await
84    }
85
86    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
87    pub fn customize(
88        self,
89    ) -> crate::client::customize::CustomizableOperation<
90        crate::operation::list_rules::ListRulesOutput,
91        crate::operation::list_rules::ListRulesError,
92        Self,
93    > {
94        crate::client::customize::CustomizableOperation::new(self)
95    }
96    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
97        self.set_config_override(::std::option::Option::Some(config_override.into()));
98        self
99    }
100
101    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
102        self.config_override = config_override;
103        self
104    }
105    /// Create a paginator for this request
106    ///
107    /// Paginators are used by calling [`send().await`](crate::operation::list_rules::paginator::ListRulesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
108    pub fn into_paginator(self) -> crate::operation::list_rules::paginator::ListRulesPaginator {
109        crate::operation::list_rules::paginator::ListRulesPaginator::new(self.handle, self.inner)
110    }
111    /// <p>The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned <code>nextToken</code> value in a subsequent call.</p>
112    pub fn max_results(mut self, input: i32) -> Self {
113        self.inner = self.inner.max_results(input);
114        self
115    }
116    /// <p>The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned <code>nextToken</code> value in a subsequent call.</p>
117    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
118        self.inner = self.inner.set_max_results(input);
119        self
120    }
121    /// <p>The maximum number of results to return in a single call. Valid range: 1-100. To retrieve the remaining results, use the returned <code>nextToken</code> value in a subsequent call.</p>
122    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
123        self.inner.get_max_results()
124    }
125    /// <p>The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.</p>
126    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.next_token(input.into());
128        self
129    }
130    /// <p>The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.</p>
131    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_next_token(input);
133        self
134    }
135    /// <p>The token for the next page of results. To retrieve the next page, call the operation again and provide this value. When there are no more results, this value is null.</p>
136    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_next_token()
138    }
139    /// <p>Filters the results by status, either <code>ACTIVE</code> or <code>DRAFT</code>.</p>
140    pub fn status(mut self, input: crate::types::EntityStatusFilter) -> Self {
141        self.inner = self.inner.status(input);
142        self
143    }
144    /// <p>Filters the results by status, either <code>ACTIVE</code> or <code>DRAFT</code>.</p>
145    pub fn set_status(mut self, input: ::std::option::Option<crate::types::EntityStatusFilter>) -> Self {
146        self.inner = self.inner.set_status(input);
147        self
148    }
149    /// <p>Filters the results by status, either <code>ACTIVE</code> or <code>DRAFT</code>.</p>
150    pub fn get_status(&self) -> &::std::option::Option<crate::types::EntityStatusFilter> {
151        self.inner.get_status()
152    }
153}