aws_sdk_ec2/operation/create_security_group/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_security_group::_create_security_group_output::CreateSecurityGroupOutputBuilder;
3
4pub use crate::operation::create_security_group::_create_security_group_input::CreateSecurityGroupInputBuilder;
5
6impl crate::operation::create_security_group::builders::CreateSecurityGroupInputBuilder {
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_security_group::CreateSecurityGroupOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_security_group::CreateSecurityGroupError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_security_group();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateSecurityGroup`.
24///
25/// <p>Creates a security group.</p>
26/// <p>A security group acts as a virtual firewall for your instance to control inbound and outbound traffic. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html">Amazon EC2 security groups</a> in the <i>Amazon EC2 User Guide</i> and <a href="https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html">Security groups for your VPC</a> in the <i>Amazon VPC User Guide</i>.</p>
27/// <p>When you create a security group, you specify a friendly name of your choice. You can't have two security groups for the same VPC with the same name.</p>
28/// <p>You have a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other.</p>
29/// <p>You can add or remove rules from your security groups using <code>AuthorizeSecurityGroupIngress</code>, <code>AuthorizeSecurityGroupEgress</code>, <code>RevokeSecurityGroupIngress</code>, and <code>RevokeSecurityGroupEgress</code>.</p>
30/// <p>For more information about VPC security group limits, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html">Amazon VPC Limits</a>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct CreateSecurityGroupFluentBuilder {
33 handle: ::std::sync::Arc<crate::client::Handle>,
34 inner: crate::operation::create_security_group::builders::CreateSecurityGroupInputBuilder,
35 config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38 crate::client::customize::internal::CustomizableSend<
39 crate::operation::create_security_group::CreateSecurityGroupOutput,
40 crate::operation::create_security_group::CreateSecurityGroupError,
41 > for CreateSecurityGroupFluentBuilder
42{
43 fn send(
44 self,
45 config_override: crate::config::Builder,
46 ) -> crate::client::customize::internal::BoxFuture<
47 crate::client::customize::internal::SendResult<
48 crate::operation::create_security_group::CreateSecurityGroupOutput,
49 crate::operation::create_security_group::CreateSecurityGroupError,
50 >,
51 > {
52 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53 }
54}
55impl CreateSecurityGroupFluentBuilder {
56 /// Creates a new `CreateSecurityGroupFluentBuilder`.
57 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58 Self {
59 handle,
60 inner: ::std::default::Default::default(),
61 config_override: ::std::option::Option::None,
62 }
63 }
64 /// Access the CreateSecurityGroup as a reference.
65 pub fn as_input(&self) -> &crate::operation::create_security_group::builders::CreateSecurityGroupInputBuilder {
66 &self.inner
67 }
68 /// Sends the request and returns the response.
69 ///
70 /// If an error occurs, an `SdkError` will be returned with additional details that
71 /// can be matched against.
72 ///
73 /// By default, any retryable failures will be retried twice. Retry behavior
74 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75 /// set when configuring the client.
76 pub async fn send(
77 self,
78 ) -> ::std::result::Result<
79 crate::operation::create_security_group::CreateSecurityGroupOutput,
80 ::aws_smithy_runtime_api::client::result::SdkError<
81 crate::operation::create_security_group::CreateSecurityGroupError,
82 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83 >,
84 > {
85 let input = self
86 .inner
87 .build()
88 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89 let runtime_plugins = crate::operation::create_security_group::CreateSecurityGroup::operation_runtime_plugins(
90 self.handle.runtime_plugins.clone(),
91 &self.handle.conf,
92 self.config_override,
93 );
94 crate::operation::create_security_group::CreateSecurityGroup::orchestrate(&runtime_plugins, input).await
95 }
96
97 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98 pub fn customize(
99 self,
100 ) -> crate::client::customize::CustomizableOperation<
101 crate::operation::create_security_group::CreateSecurityGroupOutput,
102 crate::operation::create_security_group::CreateSecurityGroupError,
103 Self,
104 > {
105 crate::client::customize::CustomizableOperation::new(self)
106 }
107 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108 self.set_config_override(::std::option::Option::Some(config_override.into()));
109 self
110 }
111
112 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113 self.config_override = config_override;
114 self
115 }
116 /// <p>A description for the security group.</p>
117 /// <p>Constraints: Up to 255 characters in length</p>
118 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
119 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.inner = self.inner.description(input.into());
121 self
122 }
123 /// <p>A description for the security group.</p>
124 /// <p>Constraints: Up to 255 characters in length</p>
125 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
126 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127 self.inner = self.inner.set_description(input);
128 self
129 }
130 /// <p>A description for the security group.</p>
131 /// <p>Constraints: Up to 255 characters in length</p>
132 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
133 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
134 self.inner.get_description()
135 }
136 /// <p>The name of the security group. Names are case-insensitive and must be unique within the VPC.</p>
137 /// <p>Constraints: Up to 255 characters in length. Can't start with <code>sg-</code>.</p>
138 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
139 pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140 self.inner = self.inner.group_name(input.into());
141 self
142 }
143 /// <p>The name of the security group. Names are case-insensitive and must be unique within the VPC.</p>
144 /// <p>Constraints: Up to 255 characters in length. Can't start with <code>sg-</code>.</p>
145 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
146 pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147 self.inner = self.inner.set_group_name(input);
148 self
149 }
150 /// <p>The name of the security group. Names are case-insensitive and must be unique within the VPC.</p>
151 /// <p>Constraints: Up to 255 characters in length. Can't start with <code>sg-</code>.</p>
152 /// <p>Valid characters: a-z, A-Z, 0-9, spaces, and ._-:/()#,@\[\]+=&;{}!$*</p>
153 pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_group_name()
155 }
156 /// <p>The ID of the VPC. Required for a nondefault VPC.</p>
157 pub fn vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.inner = self.inner.vpc_id(input.into());
159 self
160 }
161 /// <p>The ID of the VPC. Required for a nondefault VPC.</p>
162 pub fn set_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.inner = self.inner.set_vpc_id(input);
164 self
165 }
166 /// <p>The ID of the VPC. Required for a nondefault VPC.</p>
167 pub fn get_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
168 self.inner.get_vpc_id()
169 }
170 ///
171 /// Appends an item to `TagSpecifications`.
172 ///
173 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
174 ///
175 /// <p>The tags to assign to the security group.</p>
176 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
177 self.inner = self.inner.tag_specifications(input);
178 self
179 }
180 /// <p>The tags to assign to the security group.</p>
181 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
182 self.inner = self.inner.set_tag_specifications(input);
183 self
184 }
185 /// <p>The tags to assign to the security group.</p>
186 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
187 self.inner.get_tag_specifications()
188 }
189 /// <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>
190 pub fn dry_run(mut self, input: bool) -> Self {
191 self.inner = self.inner.dry_run(input);
192 self
193 }
194 /// <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>
195 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
196 self.inner = self.inner.set_dry_run(input);
197 self
198 }
199 /// <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>
200 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
201 self.inner.get_dry_run()
202 }
203}