aws_sdk_gamelift/operation/create_container_group_definition/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_container_group_definition::_create_container_group_definition_output::CreateContainerGroupDefinitionOutputBuilder;
3
4pub use crate::operation::create_container_group_definition::_create_container_group_definition_input::CreateContainerGroupDefinitionInputBuilder;
5
6impl crate::operation::create_container_group_definition::builders::CreateContainerGroupDefinitionInputBuilder {
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_container_group_definition::CreateContainerGroupDefinitionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_container_group_definition::CreateContainerGroupDefinitionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_container_group_definition();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateContainerGroupDefinition`.
24///
25/// <p><b>This API works with the following fleet types:</b> Container</p>
26/// <p>Creates a <code>ContainerGroupDefinition</code> that describes a set of containers for hosting your game server with Amazon GameLift Servers managed containers hosting. An Amazon GameLift Servers container group is similar to a container task or pod. Use container group definitions when you create a container fleet with <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateContainerFleet.html">CreateContainerFleet</a>.</p>
27/// <p>A container group definition determines how Amazon GameLift Servers deploys your containers to each instance in a container fleet. You can maintain multiple versions of a container group definition.</p>
28/// <p>There are two types of container groups:</p>
29/// <ul>
30/// <li>
31/// <p>A <b>game server container group</b> has the containers that run your game server application and supporting software. A game server container group can have these container types:</p>
32/// <ul>
33/// <li>
34/// <p>Game server container. This container runs your game server. You can define one game server container in a game server container group.</p></li>
35/// <li>
36/// <p>Support container. This container runs software in parallel with your game server. You can define up to 8 support containers in a game server group.</p></li>
37/// </ul>
38/// <p>When building a game server container group definition, you can choose to bundle your game server executable and all dependent software into a single game server container. Alternatively, you can separate the software into one game server container and one or more support containers.</p>
39/// <p>On a container fleet instance, a game server container group can be deployed multiple times (depending on the compute resources of the instance). This means that all containers in the container group are replicated together.</p></li>
40/// <li>
41/// <p>A <b>per-instance container group</b> has containers for processes that aren't replicated on a container fleet instance. This might include background services, logging, test processes, or processes that need to persist independently of the game server container group. When building a per-instance container group, you can define up to 10 support containers.</p></li>
42/// </ul><note>
43/// <p>This operation requires Identity and Access Management (IAM) permissions to access container images in Amazon ECR repositories. See <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-iam-policy-examples.html"> IAM permissions for Amazon GameLift Servers</a> for help setting the appropriate permissions.</p>
44/// </note>
45/// <p><b>Request options</b></p>
46/// <p>Use this operation to make the following types of requests. You can specify values for the minimum required parameters and customize optional values later.</p>
47/// <ul>
48/// <li>
49/// <p>Create a game server container group definition. Provide the following required parameter values:</p>
50/// <ul>
51/// <li>
52/// <p><code>Name</code></p></li>
53/// <li>
54/// <p><code>ContainerGroupType</code> (<code>GAME_SERVER</code>)</p></li>
55/// <li>
56/// <p><code>OperatingSystem</code> (omit to use default value)</p></li>
57/// <li>
58/// <p><code>TotalMemoryLimitMebibytes</code> (omit to use default value)</p></li>
59/// <li>
60/// <p><code>TotalVcpuLimit </code>(omit to use default value)</p></li>
61/// <li>
62/// <p>At least one <code>GameServerContainerDefinition</code></p>
63/// <ul>
64/// <li>
65/// <p><code>ContainerName</code></p></li>
66/// <li>
67/// <p><code>ImageUrl</code></p></li>
68/// <li>
69/// <p><code>PortConfiguration</code></p></li>
70/// <li>
71/// <p><code>ServerSdkVersion</code> (omit to use default value)</p></li>
72/// </ul></li>
73/// </ul></li>
74/// <li>
75/// <p>Create a per-instance container group definition. Provide the following required parameter values:</p>
76/// <ul>
77/// <li>
78/// <p><code>Name</code></p></li>
79/// <li>
80/// <p><code>ContainerGroupType</code> (<code>PER_INSTANCE</code>)</p></li>
81/// <li>
82/// <p><code>OperatingSystem</code> (omit to use default value)</p></li>
83/// <li>
84/// <p><code>TotalMemoryLimitMebibytes</code> (omit to use default value)</p></li>
85/// <li>
86/// <p><code>TotalVcpuLimit </code>(omit to use default value)</p></li>
87/// <li>
88/// <p>At least one <code>SupportContainerDefinition</code></p>
89/// <ul>
90/// <li>
91/// <p><code>ContainerName</code></p></li>
92/// <li>
93/// <p><code>ImageUrl</code></p></li>
94/// </ul></li>
95/// </ul></li>
96/// </ul>
97/// <p><b>Results</b></p>
98/// <p>If successful, this request creates a <code>ContainerGroupDefinition</code> resource and assigns a unique ARN value. You can update most properties of a container group definition by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateContainerGroupDefinition.html">UpdateContainerGroupDefinition</a>, and optionally save the update as a new version.</p>
99#[derive(::std::clone::Clone, ::std::fmt::Debug)]
100pub struct CreateContainerGroupDefinitionFluentBuilder {
101    handle: ::std::sync::Arc<crate::client::Handle>,
102    inner: crate::operation::create_container_group_definition::builders::CreateContainerGroupDefinitionInputBuilder,
103    config_override: ::std::option::Option<crate::config::Builder>,
104}
105impl
106    crate::client::customize::internal::CustomizableSend<
107        crate::operation::create_container_group_definition::CreateContainerGroupDefinitionOutput,
108        crate::operation::create_container_group_definition::CreateContainerGroupDefinitionError,
109    > for CreateContainerGroupDefinitionFluentBuilder
110{
111    fn send(
112        self,
113        config_override: crate::config::Builder,
114    ) -> crate::client::customize::internal::BoxFuture<
115        crate::client::customize::internal::SendResult<
116            crate::operation::create_container_group_definition::CreateContainerGroupDefinitionOutput,
117            crate::operation::create_container_group_definition::CreateContainerGroupDefinitionError,
118        >,
119    > {
120        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
121    }
122}
123impl CreateContainerGroupDefinitionFluentBuilder {
124    /// Creates a new `CreateContainerGroupDefinitionFluentBuilder`.
125    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
126        Self {
127            handle,
128            inner: ::std::default::Default::default(),
129            config_override: ::std::option::Option::None,
130        }
131    }
132    /// Access the CreateContainerGroupDefinition as a reference.
133    pub fn as_input(&self) -> &crate::operation::create_container_group_definition::builders::CreateContainerGroupDefinitionInputBuilder {
134        &self.inner
135    }
136    /// Sends the request and returns the response.
137    ///
138    /// If an error occurs, an `SdkError` will be returned with additional details that
139    /// can be matched against.
140    ///
141    /// By default, any retryable failures will be retried twice. Retry behavior
142    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
143    /// set when configuring the client.
144    pub async fn send(
145        self,
146    ) -> ::std::result::Result<
147        crate::operation::create_container_group_definition::CreateContainerGroupDefinitionOutput,
148        ::aws_smithy_runtime_api::client::result::SdkError<
149            crate::operation::create_container_group_definition::CreateContainerGroupDefinitionError,
150            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
151        >,
152    > {
153        let input = self
154            .inner
155            .build()
156            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
157        let runtime_plugins = crate::operation::create_container_group_definition::CreateContainerGroupDefinition::operation_runtime_plugins(
158            self.handle.runtime_plugins.clone(),
159            &self.handle.conf,
160            self.config_override,
161        );
162        crate::operation::create_container_group_definition::CreateContainerGroupDefinition::orchestrate(&runtime_plugins, input).await
163    }
164
165    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
166    pub fn customize(
167        self,
168    ) -> crate::client::customize::CustomizableOperation<
169        crate::operation::create_container_group_definition::CreateContainerGroupDefinitionOutput,
170        crate::operation::create_container_group_definition::CreateContainerGroupDefinitionError,
171        Self,
172    > {
173        crate::client::customize::CustomizableOperation::new(self)
174    }
175    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
176        self.set_config_override(::std::option::Option::Some(config_override.into()));
177        self
178    }
179
180    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
181        self.config_override = config_override;
182        self
183    }
184    /// <p>A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.</p>
185    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.name(input.into());
187        self
188    }
189    /// <p>A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.</p>
190    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.inner = self.inner.set_name(input);
192        self
193    }
194    /// <p>A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.</p>
195    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
196        self.inner.get_name()
197    }
198    /// <p>The type of container group being defined. Container group type determines how Amazon GameLift Servers deploys the container group on each fleet instance.</p>
199    /// <p>Default value: <code>GAME_SERVER</code></p>
200    pub fn container_group_type(mut self, input: crate::types::ContainerGroupType) -> Self {
201        self.inner = self.inner.container_group_type(input);
202        self
203    }
204    /// <p>The type of container group being defined. Container group type determines how Amazon GameLift Servers deploys the container group on each fleet instance.</p>
205    /// <p>Default value: <code>GAME_SERVER</code></p>
206    pub fn set_container_group_type(mut self, input: ::std::option::Option<crate::types::ContainerGroupType>) -> Self {
207        self.inner = self.inner.set_container_group_type(input);
208        self
209    }
210    /// <p>The type of container group being defined. Container group type determines how Amazon GameLift Servers deploys the container group on each fleet instance.</p>
211    /// <p>Default value: <code>GAME_SERVER</code></p>
212    pub fn get_container_group_type(&self) -> &::std::option::Option<crate::types::ContainerGroupType> {
213        self.inner.get_container_group_type()
214    }
215    /// <p>The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.</p>
216    /// <p>Default value: 1024</p>
217    pub fn total_memory_limit_mebibytes(mut self, input: i32) -> Self {
218        self.inner = self.inner.total_memory_limit_mebibytes(input);
219        self
220    }
221    /// <p>The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.</p>
222    /// <p>Default value: 1024</p>
223    pub fn set_total_memory_limit_mebibytes(mut self, input: ::std::option::Option<i32>) -> Self {
224        self.inner = self.inner.set_total_memory_limit_mebibytes(input);
225        self
226    }
227    /// <p>The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.</p>
228    /// <p>Default value: 1024</p>
229    pub fn get_total_memory_limit_mebibytes(&self) -> &::std::option::Option<i32> {
230        self.inner.get_total_memory_limit_mebibytes()
231    }
232    /// <p>The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share this memory. If you specify vCPU limits for individual containers, the total value must be equal to or greater than the sum of the CPU limits for all containers in the group.</p>
233    /// <p>Default value: 1</p>
234    pub fn total_vcpu_limit(mut self, input: f64) -> Self {
235        self.inner = self.inner.total_vcpu_limit(input);
236        self
237    }
238    /// <p>The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share this memory. If you specify vCPU limits for individual containers, the total value must be equal to or greater than the sum of the CPU limits for all containers in the group.</p>
239    /// <p>Default value: 1</p>
240    pub fn set_total_vcpu_limit(mut self, input: ::std::option::Option<f64>) -> Self {
241        self.inner = self.inner.set_total_vcpu_limit(input);
242        self
243    }
244    /// <p>The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share this memory. If you specify vCPU limits for individual containers, the total value must be equal to or greater than the sum of the CPU limits for all containers in the group.</p>
245    /// <p>Default value: 1</p>
246    pub fn get_total_vcpu_limit(&self) -> &::std::option::Option<f64> {
247        self.inner.get_total_vcpu_limit()
248    }
249    /// <p>The definition for the game server container in this group. Define a game server container only when the container group type is <code>GAME_SERVER</code>. Game server containers specify a container image with your game server build. You can pass in your container definitions as a JSON file.</p>
250    pub fn game_server_container_definition(mut self, input: crate::types::GameServerContainerDefinitionInput) -> Self {
251        self.inner = self.inner.game_server_container_definition(input);
252        self
253    }
254    /// <p>The definition for the game server container in this group. Define a game server container only when the container group type is <code>GAME_SERVER</code>. Game server containers specify a container image with your game server build. You can pass in your container definitions as a JSON file.</p>
255    pub fn set_game_server_container_definition(mut self, input: ::std::option::Option<crate::types::GameServerContainerDefinitionInput>) -> Self {
256        self.inner = self.inner.set_game_server_container_definition(input);
257        self
258    }
259    /// <p>The definition for the game server container in this group. Define a game server container only when the container group type is <code>GAME_SERVER</code>. Game server containers specify a container image with your game server build. You can pass in your container definitions as a JSON file.</p>
260    pub fn get_game_server_container_definition(&self) -> &::std::option::Option<crate::types::GameServerContainerDefinitionInput> {
261        self.inner.get_game_server_container_definition()
262    }
263    ///
264    /// Appends an item to `SupportContainerDefinitions`.
265    ///
266    /// To override the contents of this collection use [`set_support_container_definitions`](Self::set_support_container_definitions).
267    ///
268    /// <p>One or more definition for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.</p>
269    pub fn support_container_definitions(mut self, input: crate::types::SupportContainerDefinitionInput) -> Self {
270        self.inner = self.inner.support_container_definitions(input);
271        self
272    }
273    /// <p>One or more definition for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.</p>
274    pub fn set_support_container_definitions(
275        mut self,
276        input: ::std::option::Option<::std::vec::Vec<crate::types::SupportContainerDefinitionInput>>,
277    ) -> Self {
278        self.inner = self.inner.set_support_container_definitions(input);
279        self
280    }
281    /// <p>One or more definition for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.</p>
282    pub fn get_support_container_definitions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SupportContainerDefinitionInput>> {
283        self.inner.get_support_container_definitions()
284    }
285    /// <p>The platform that all containers in the group use. Containers in a group must run on the same operating system.</p>
286    /// <p>Default value: <code>AMAZON_LINUX_2023</code></p><note>
287    /// <p>Amazon Linux 2 (AL2) will reach end of support on 6/30/2025. See more details in the <a href="http://aws.amazon.com/amazon-linux-2/faqs/">Amazon Linux 2 FAQs</a>. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-serversdk5-migration.html"> Migrate to server SDK version 5.</a></p>
288    /// </note>
289    pub fn operating_system(mut self, input: crate::types::ContainerOperatingSystem) -> Self {
290        self.inner = self.inner.operating_system(input);
291        self
292    }
293    /// <p>The platform that all containers in the group use. Containers in a group must run on the same operating system.</p>
294    /// <p>Default value: <code>AMAZON_LINUX_2023</code></p><note>
295    /// <p>Amazon Linux 2 (AL2) will reach end of support on 6/30/2025. See more details in the <a href="http://aws.amazon.com/amazon-linux-2/faqs/">Amazon Linux 2 FAQs</a>. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-serversdk5-migration.html"> Migrate to server SDK version 5.</a></p>
296    /// </note>
297    pub fn set_operating_system(mut self, input: ::std::option::Option<crate::types::ContainerOperatingSystem>) -> Self {
298        self.inner = self.inner.set_operating_system(input);
299        self
300    }
301    /// <p>The platform that all containers in the group use. Containers in a group must run on the same operating system.</p>
302    /// <p>Default value: <code>AMAZON_LINUX_2023</code></p><note>
303    /// <p>Amazon Linux 2 (AL2) will reach end of support on 6/30/2025. See more details in the <a href="http://aws.amazon.com/amazon-linux-2/faqs/">Amazon Linux 2 FAQs</a>. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-serversdk5-migration.html"> Migrate to server SDK version 5.</a></p>
304    /// </note>
305    pub fn get_operating_system(&self) -> &::std::option::Option<crate::types::ContainerOperatingSystem> {
306        self.inner.get_operating_system()
307    }
308    /// <p>A description for the initial version of this container group definition.</p>
309    pub fn version_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
310        self.inner = self.inner.version_description(input.into());
311        self
312    }
313    /// <p>A description for the initial version of this container group definition.</p>
314    pub fn set_version_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
315        self.inner = self.inner.set_version_description(input);
316        self
317    }
318    /// <p>A description for the initial version of this container group definition.</p>
319    pub fn get_version_description(&self) -> &::std::option::Option<::std::string::String> {
320        self.inner.get_version_description()
321    }
322    ///
323    /// Appends an item to `Tags`.
324    ///
325    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
326    ///
327    /// <p>A list of labels to assign to the container group definition resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management and cost allocation. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html"> Tagging Amazon Web Services Resources</a> in the <i>Amazon Web Services General Reference</i>.</p>
328    pub fn tags(mut self, input: crate::types::Tag) -> Self {
329        self.inner = self.inner.tags(input);
330        self
331    }
332    /// <p>A list of labels to assign to the container group definition resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management and cost allocation. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html"> Tagging Amazon Web Services Resources</a> in the <i>Amazon Web Services General Reference</i>.</p>
333    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
334        self.inner = self.inner.set_tags(input);
335        self
336    }
337    /// <p>A list of labels to assign to the container group definition resource. Tags are developer-defined key-value pairs. Tagging Amazon Web Services resources are useful for resource management, access management and cost allocation. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html"> Tagging Amazon Web Services Resources</a> in the <i>Amazon Web Services General Reference</i>.</p>
338    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
339        self.inner.get_tags()
340    }
341}