aws_sdk_networkfirewall/operation/start_flow_capture/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_flow_capture::_start_flow_capture_output::StartFlowCaptureOutputBuilder;
3
4pub use crate::operation::start_flow_capture::_start_flow_capture_input::StartFlowCaptureInputBuilder;
5
6impl crate::operation::start_flow_capture::builders::StartFlowCaptureInputBuilder {
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::start_flow_capture::StartFlowCaptureOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_flow_capture::StartFlowCaptureError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_flow_capture();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartFlowCapture`.
24///
25/// <p>Begins capturing the flows in a firewall, according to the filters you define. Captures are similar, but not identical to snapshots. Capture operations provide visibility into flows that are not closed and are tracked by a firewall's flow table. Unlike snapshots, captures are a time-boxed view.</p>
26/// <p>A flow is network traffic that is monitored by a firewall, either by stateful or stateless rules. For traffic to be considered part of a flow, it must share Destination, DestinationPort, Direction, Protocol, Source, and SourcePort.</p><note>
27/// <p>To avoid encountering operation limits, you should avoid starting captures with broad filters, like wide IP ranges. Instead, we recommend you define more specific criteria with <code>FlowFilters</code>, like narrow IP ranges, ports, or protocols.</p>
28/// </note>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct StartFlowCaptureFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::start_flow_capture::builders::StartFlowCaptureInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::start_flow_capture::StartFlowCaptureOutput,
38        crate::operation::start_flow_capture::StartFlowCaptureError,
39    > for StartFlowCaptureFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::start_flow_capture::StartFlowCaptureOutput,
47            crate::operation::start_flow_capture::StartFlowCaptureError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl StartFlowCaptureFluentBuilder {
54    /// Creates a new `StartFlowCaptureFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the StartFlowCapture as a reference.
63    pub fn as_input(&self) -> &crate::operation::start_flow_capture::builders::StartFlowCaptureInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::start_flow_capture::StartFlowCaptureOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::start_flow_capture::StartFlowCaptureError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::start_flow_capture::StartFlowCapture::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::start_flow_capture::StartFlowCapture::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::start_flow_capture::StartFlowCaptureOutput,
100        crate::operation::start_flow_capture::StartFlowCaptureError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The Amazon Resource Name (ARN) of the firewall.</p>
115    pub fn firewall_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.inner = self.inner.firewall_arn(input.into());
117        self
118    }
119    /// <p>The Amazon Resource Name (ARN) of the firewall.</p>
120    pub fn set_firewall_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_firewall_arn(input);
122        self
123    }
124    /// <p>The Amazon Resource Name (ARN) of the firewall.</p>
125    pub fn get_firewall_arn(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_firewall_arn()
127    }
128    /// <p>The ID of the Availability Zone where the firewall is located. For example, <code>us-east-2a</code>.</p>
129    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
130    pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.availability_zone(input.into());
132        self
133    }
134    /// <p>The ID of the Availability Zone where the firewall is located. For example, <code>us-east-2a</code>.</p>
135    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
136    pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_availability_zone(input);
138        self
139    }
140    /// <p>The ID of the Availability Zone where the firewall is located. For example, <code>us-east-2a</code>.</p>
141    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
142    pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_availability_zone()
144    }
145    /// <p>The reqested <code>FlowOperation</code> ignores flows with an age (in seconds) lower than <code>MinimumFlowAgeInSeconds</code>. You provide this for start commands.</p><note>
146    /// <p>We recommend setting this value to at least 1 minute (60 seconds) to reduce chance of capturing flows that are not yet established.</p>
147    /// </note>
148    pub fn minimum_flow_age_in_seconds(mut self, input: i32) -> Self {
149        self.inner = self.inner.minimum_flow_age_in_seconds(input);
150        self
151    }
152    /// <p>The reqested <code>FlowOperation</code> ignores flows with an age (in seconds) lower than <code>MinimumFlowAgeInSeconds</code>. You provide this for start commands.</p><note>
153    /// <p>We recommend setting this value to at least 1 minute (60 seconds) to reduce chance of capturing flows that are not yet established.</p>
154    /// </note>
155    pub fn set_minimum_flow_age_in_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
156        self.inner = self.inner.set_minimum_flow_age_in_seconds(input);
157        self
158    }
159    /// <p>The reqested <code>FlowOperation</code> ignores flows with an age (in seconds) lower than <code>MinimumFlowAgeInSeconds</code>. You provide this for start commands.</p><note>
160    /// <p>We recommend setting this value to at least 1 minute (60 seconds) to reduce chance of capturing flows that are not yet established.</p>
161    /// </note>
162    pub fn get_minimum_flow_age_in_seconds(&self) -> &::std::option::Option<i32> {
163        self.inner.get_minimum_flow_age_in_seconds()
164    }
165    ///
166    /// Appends an item to `FlowFilters`.
167    ///
168    /// To override the contents of this collection use [`set_flow_filters`](Self::set_flow_filters).
169    ///
170    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
171    pub fn flow_filters(mut self, input: crate::types::FlowFilter) -> Self {
172        self.inner = self.inner.flow_filters(input);
173        self
174    }
175    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
176    pub fn set_flow_filters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FlowFilter>>) -> Self {
177        self.inner = self.inner.set_flow_filters(input);
178        self
179    }
180    /// <p>Defines the scope a flow operation. You can use up to 20 filters to configure a single flow operation.</p>
181    pub fn get_flow_filters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FlowFilter>> {
182        self.inner.get_flow_filters()
183    }
184}