aws_sdk_ec2/operation/create_traffic_mirror_session/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_traffic_mirror_session::_create_traffic_mirror_session_output::CreateTrafficMirrorSessionOutputBuilder;
3
4pub use crate::operation::create_traffic_mirror_session::_create_traffic_mirror_session_input::CreateTrafficMirrorSessionInputBuilder;
5
6impl crate::operation::create_traffic_mirror_session::builders::CreateTrafficMirrorSessionInputBuilder {
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::create_traffic_mirror_session::CreateTrafficMirrorSessionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_traffic_mirror_session();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateTrafficMirrorSession`.
24///
25/// <p>Creates a Traffic Mirror session.</p>
26/// <p>A Traffic Mirror session actively copies packets from a Traffic Mirror source to a Traffic Mirror target. Create a filter, and then assign it to the session to define a subset of the traffic to mirror, for example all TCP traffic.</p>
27/// <p>The Traffic Mirror source and the Traffic Mirror target (monitoring appliances) can be in the same VPC, or in a different VPC connected via VPC peering or a transit gateway.</p>
28/// <p>By default, no traffic is mirrored. Use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTrafficMirrorFilter.html">CreateTrafficMirrorFilter</a> to create filter rules that specify the traffic to mirror.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateTrafficMirrorSessionFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::create_traffic_mirror_session::builders::CreateTrafficMirrorSessionInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionOutput,
38 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionError,
39 > for CreateTrafficMirrorSessionFluentBuilder
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::create_traffic_mirror_session::CreateTrafficMirrorSessionOutput,
47 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl CreateTrafficMirrorSessionFluentBuilder {
54 /// Creates a new `CreateTrafficMirrorSessionFluentBuilder`.
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 CreateTrafficMirrorSession as a reference.
63 pub fn as_input(&self) -> &crate::operation::create_traffic_mirror_session::builders::CreateTrafficMirrorSessionInputBuilder {
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::create_traffic_mirror_session::CreateTrafficMirrorSessionOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionError,
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::create_traffic_mirror_session::CreateTrafficMirrorSession::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSession::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::create_traffic_mirror_session::CreateTrafficMirrorSessionOutput,
100 crate::operation::create_traffic_mirror_session::CreateTrafficMirrorSessionError,
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 ID of the source network interface.</p>
115 pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.network_interface_id(input.into());
117 self
118 }
119 /// <p>The ID of the source network interface.</p>
120 pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_network_interface_id(input);
122 self
123 }
124 /// <p>The ID of the source network interface.</p>
125 pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_network_interface_id()
127 }
128 /// <p>The ID of the Traffic Mirror target.</p>
129 pub fn traffic_mirror_target_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.traffic_mirror_target_id(input.into());
131 self
132 }
133 /// <p>The ID of the Traffic Mirror target.</p>
134 pub fn set_traffic_mirror_target_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_traffic_mirror_target_id(input);
136 self
137 }
138 /// <p>The ID of the Traffic Mirror target.</p>
139 pub fn get_traffic_mirror_target_id(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_traffic_mirror_target_id()
141 }
142 /// <p>The ID of the Traffic Mirror filter.</p>
143 pub fn traffic_mirror_filter_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.traffic_mirror_filter_id(input.into());
145 self
146 }
147 /// <p>The ID of the Traffic Mirror filter.</p>
148 pub fn set_traffic_mirror_filter_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_traffic_mirror_filter_id(input);
150 self
151 }
152 /// <p>The ID of the Traffic Mirror filter.</p>
153 pub fn get_traffic_mirror_filter_id(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_traffic_mirror_filter_id()
155 }
156 /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want 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.</p>
157 /// <p>If you do not want to mirror the entire packet, use the <code>PacketLength</code> parameter to specify the number of bytes in each packet to mirror.</p>
158 /// <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>
159 pub fn packet_length(mut self, input: i32) -> Self {
160 self.inner = self.inner.packet_length(input);
161 self
162 }
163 /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want 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.</p>
164 /// <p>If you do not want to mirror the entire packet, use the <code>PacketLength</code> parameter to specify the number of bytes in each packet to mirror.</p>
165 /// <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>
166 pub fn set_packet_length(mut self, input: ::std::option::Option<i32>) -> Self {
167 self.inner = self.inner.set_packet_length(input);
168 self
169 }
170 /// <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. Do not specify this parameter when you want to mirror the entire packet. To mirror a subset of the packet, set this to the length (in bytes) that you want 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.</p>
171 /// <p>If you do not want to mirror the entire packet, use the <code>PacketLength</code> parameter to specify the number of bytes in each packet to mirror.</p>
172 /// <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>
173 pub fn get_packet_length(&self) -> &::std::option::Option<i32> {
174 self.inner.get_packet_length()
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 session_number(mut self, input: i32) -> Self {
179 self.inner = self.inner.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 set_session_number(mut self, input: ::std::option::Option<i32>) -> Self {
185 self.inner = self.inner.set_session_number(input);
186 self
187 }
188 /// <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>
189 /// <p>Valid values are 1-32766.</p>
190 pub fn get_session_number(&self) -> &::std::option::Option<i32> {
191 self.inner.get_session_number()
192 }
193 /// <p>The VXLAN ID for the Traffic Mirror session. For more information about the VXLAN protocol, see <a href="https://datatracker.ietf.org/doc/html/rfc7348">RFC 7348</a>. If you do not specify a <code>VirtualNetworkId</code>, an account-wide unique ID is chosen at random.</p>
194 pub fn virtual_network_id(mut self, input: i32) -> Self {
195 self.inner = self.inner.virtual_network_id(input);
196 self
197 }
198 /// <p>The VXLAN ID for the Traffic Mirror session. For more information about the VXLAN protocol, see <a href="https://datatracker.ietf.org/doc/html/rfc7348">RFC 7348</a>. If you do not specify a <code>VirtualNetworkId</code>, an account-wide unique ID is chosen at random.</p>
199 pub fn set_virtual_network_id(mut self, input: ::std::option::Option<i32>) -> Self {
200 self.inner = self.inner.set_virtual_network_id(input);
201 self
202 }
203 /// <p>The VXLAN ID for the Traffic Mirror session. For more information about the VXLAN protocol, see <a href="https://datatracker.ietf.org/doc/html/rfc7348">RFC 7348</a>. If you do not specify a <code>VirtualNetworkId</code>, an account-wide unique ID is chosen at random.</p>
204 pub fn get_virtual_network_id(&self) -> &::std::option::Option<i32> {
205 self.inner.get_virtual_network_id()
206 }
207 /// <p>The description of the Traffic Mirror session.</p>
208 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209 self.inner = self.inner.description(input.into());
210 self
211 }
212 /// <p>The description of the Traffic Mirror session.</p>
213 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214 self.inner = self.inner.set_description(input);
215 self
216 }
217 /// <p>The description of the Traffic Mirror session.</p>
218 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
219 self.inner.get_description()
220 }
221 ///
222 /// Appends an item to `TagSpecifications`.
223 ///
224 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
225 ///
226 /// <p>The tags to assign to a Traffic Mirror session.</p>
227 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
228 self.inner = self.inner.tag_specifications(input);
229 self
230 }
231 /// <p>The tags to assign to a Traffic Mirror session.</p>
232 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
233 self.inner = self.inner.set_tag_specifications(input);
234 self
235 }
236 /// <p>The tags to assign to a Traffic Mirror session.</p>
237 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
238 self.inner.get_tag_specifications()
239 }
240 /// <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>
241 pub fn dry_run(mut self, input: bool) -> Self {
242 self.inner = self.inner.dry_run(input);
243 self
244 }
245 /// <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>
246 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
247 self.inner = self.inner.set_dry_run(input);
248 self
249 }
250 /// <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>
251 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
252 self.inner.get_dry_run()
253 }
254 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">How to ensure idempotency</a>.</p>
255 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
256 self.inner = self.inner.client_token(input.into());
257 self
258 }
259 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">How to ensure idempotency</a>.</p>
260 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
261 self.inner = self.inner.set_client_token(input);
262 self
263 }
264 /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">How to ensure idempotency</a>.</p>
265 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
266 self.inner.get_client_token()
267 }
268}