aws_sdk_ec2/operation/modify_traffic_mirror_session/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_traffic_mirror_session::_modify_traffic_mirror_session_output::ModifyTrafficMirrorSessionOutputBuilder;
3
4pub use crate::operation::modify_traffic_mirror_session::_modify_traffic_mirror_session_input::ModifyTrafficMirrorSessionInputBuilder;
5
6impl crate::operation::modify_traffic_mirror_session::builders::ModifyTrafficMirrorSessionInputBuilder {
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::modify_traffic_mirror_session::ModifyTrafficMirrorSessionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_traffic_mirror_session();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifyTrafficMirrorSession`.
24///
25/// <p>Modifies a Traffic Mirror session.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ModifyTrafficMirrorSessionFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::modify_traffic_mirror_session::builders::ModifyTrafficMirrorSessionInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionOutput,
35        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionError,
36    > for ModifyTrafficMirrorSessionFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionOutput,
44            crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl ModifyTrafficMirrorSessionFluentBuilder {
51    /// Creates a new `ModifyTrafficMirrorSessionFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the ModifyTrafficMirrorSession as a reference.
60    pub fn as_input(&self) -> &crate::operation::modify_traffic_mirror_session::builders::ModifyTrafficMirrorSessionInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSession::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSession::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionOutput,
97        crate::operation::modify_traffic_mirror_session::ModifyTrafficMirrorSessionError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The ID of the Traffic Mirror session.</p>
112    pub fn traffic_mirror_session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.traffic_mirror_session_id(input.into());
114        self
115    }
116    /// <p>The ID of the Traffic Mirror session.</p>
117    pub fn set_traffic_mirror_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_traffic_mirror_session_id(input);
119        self
120    }
121    /// <p>The ID of the Traffic Mirror session.</p>
122    pub fn get_traffic_mirror_session_id(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_traffic_mirror_session_id()
124    }
125    /// <p>The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.</p>
126    pub fn traffic_mirror_target_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.traffic_mirror_target_id(input.into());
128        self
129    }
130    /// <p>The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.</p>
131    pub fn set_traffic_mirror_target_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_traffic_mirror_target_id(input);
133        self
134    }
135    /// <p>The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.</p>
136    pub fn get_traffic_mirror_target_id(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_traffic_mirror_target_id()
138    }
139    /// <p>The ID of the Traffic Mirror filter.</p>
140    pub fn traffic_mirror_filter_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.traffic_mirror_filter_id(input.into());
142        self
143    }
144    /// <p>The ID of the Traffic Mirror filter.</p>
145    pub fn set_traffic_mirror_filter_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_traffic_mirror_filter_id(input);
147        self
148    }
149    /// <p>The ID of the Traffic Mirror filter.</p>
150    pub fn get_traffic_mirror_filter_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_traffic_mirror_filter_id()
152    }
153    /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet.</p>
154    /// <p>For sessions with Network Load Balancer (NLB) traffic mirror targets, the default <code>PacketLength</code> will be set to 8500. Valid values are 1-8500. Setting a <code>PacketLength</code> greater than 8500 will result in an error response.</p>
155    pub fn packet_length(mut self, input: i32) -> Self {
156        self.inner = self.inner.packet_length(input);
157        self
158    }
159    /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet.</p>
160    /// <p>For sessions with Network Load Balancer (NLB) traffic mirror targets, the default <code>PacketLength</code> will be set to 8500. Valid values are 1-8500. Setting a <code>PacketLength</code> greater than 8500 will result in an error response.</p>
161    pub fn set_packet_length(mut self, input: ::std::option::Option<i32>) -> Self {
162        self.inner = self.inner.set_packet_length(input);
163        self
164    }
165    /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet.</p>
166    /// <p>For sessions with Network Load Balancer (NLB) traffic mirror targets, the default <code>PacketLength</code> will be set to 8500. Valid values are 1-8500. Setting a <code>PacketLength</code> greater than 8500 will result in an error response.</p>
167    pub fn get_packet_length(&self) -> &::std::option::Option<i32> {
168        self.inner.get_packet_length()
169    }
170    /// <p>The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.</p>
171    /// <p>Valid values are 1-32766.</p>
172    pub fn session_number(mut self, input: i32) -> Self {
173        self.inner = self.inner.session_number(input);
174        self
175    }
176    /// <p>The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.</p>
177    /// <p>Valid values are 1-32766.</p>
178    pub fn set_session_number(mut self, input: ::std::option::Option<i32>) -> Self {
179        self.inner = self.inner.set_session_number(input);
180        self
181    }
182    /// <p>The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.</p>
183    /// <p>Valid values are 1-32766.</p>
184    pub fn get_session_number(&self) -> &::std::option::Option<i32> {
185        self.inner.get_session_number()
186    }
187    /// <p>The virtual network ID of the Traffic Mirror session.</p>
188    pub fn virtual_network_id(mut self, input: i32) -> Self {
189        self.inner = self.inner.virtual_network_id(input);
190        self
191    }
192    /// <p>The virtual network ID of the Traffic Mirror session.</p>
193    pub fn set_virtual_network_id(mut self, input: ::std::option::Option<i32>) -> Self {
194        self.inner = self.inner.set_virtual_network_id(input);
195        self
196    }
197    /// <p>The virtual network ID of the Traffic Mirror session.</p>
198    pub fn get_virtual_network_id(&self) -> &::std::option::Option<i32> {
199        self.inner.get_virtual_network_id()
200    }
201    /// <p>The description to assign to the Traffic Mirror session.</p>
202    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203        self.inner = self.inner.description(input.into());
204        self
205    }
206    /// <p>The description to assign to the Traffic Mirror session.</p>
207    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208        self.inner = self.inner.set_description(input);
209        self
210    }
211    /// <p>The description to assign to the Traffic Mirror session.</p>
212    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
213        self.inner.get_description()
214    }
215    ///
216    /// Appends an item to `RemoveFields`.
217    ///
218    /// To override the contents of this collection use [`set_remove_fields`](Self::set_remove_fields).
219    ///
220    /// <p>The properties that you want to remove from the Traffic Mirror session.</p>
221    /// <p>When you remove a property from a Traffic Mirror session, the property is set to the default.</p>
222    pub fn remove_fields(mut self, input: crate::types::TrafficMirrorSessionField) -> Self {
223        self.inner = self.inner.remove_fields(input);
224        self
225    }
226    /// <p>The properties that you want to remove from the Traffic Mirror session.</p>
227    /// <p>When you remove a property from a Traffic Mirror session, the property is set to the default.</p>
228    pub fn set_remove_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TrafficMirrorSessionField>>) -> Self {
229        self.inner = self.inner.set_remove_fields(input);
230        self
231    }
232    /// <p>The properties that you want to remove from the Traffic Mirror session.</p>
233    /// <p>When you remove a property from a Traffic Mirror session, the property is set to the default.</p>
234    pub fn get_remove_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TrafficMirrorSessionField>> {
235        self.inner.get_remove_fields()
236    }
237    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
238    pub fn dry_run(mut self, input: bool) -> Self {
239        self.inner = self.inner.dry_run(input);
240        self
241    }
242    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
243    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
244        self.inner = self.inner.set_dry_run(input);
245        self
246    }
247    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
248    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
249        self.inner.get_dry_run()
250    }
251}