aws_sdk_resourcegroups/operation/create_group/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_group::_create_group_output::CreateGroupOutputBuilder;
3
4pub use crate::operation::create_group::_create_group_input::CreateGroupInputBuilder;
5
6impl crate::operation::create_group::builders::CreateGroupInputBuilder {
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_group::CreateGroupOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_group::CreateGroupError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_group();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateGroup`.
24///
25/// <p>Creates a resource group with the specified name and description. You can optionally include either a resource query or a service configuration. For more information about constructing a resource query, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/getting_started-query.html">Build queries and groups in Resource Groups</a> in the <i>Resource Groups User Guide</i>. For more information about service-linked groups and service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p>
26/// <p><b>Minimum permissions</b></p>
27/// <p>To run this command, you must have the following permissions:</p>
28/// <ul>
29/// <li>
30/// <p><code>resource-groups:CreateGroup</code></p></li>
31/// </ul>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct CreateGroupFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::create_group::builders::CreateGroupInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::create_group::CreateGroupOutput,
41        crate::operation::create_group::CreateGroupError,
42    > for CreateGroupFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::create_group::CreateGroupOutput,
50            crate::operation::create_group::CreateGroupError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl CreateGroupFluentBuilder {
57    /// Creates a new `CreateGroupFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the CreateGroup as a reference.
66    pub fn as_input(&self) -> &crate::operation::create_group::builders::CreateGroupInputBuilder {
67        &self.inner
68    }
69    /// Sends the request and returns the response.
70    ///
71    /// If an error occurs, an `SdkError` will be returned with additional details that
72    /// can be matched against.
73    ///
74    /// By default, any retryable failures will be retried twice. Retry behavior
75    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76    /// set when configuring the client.
77    pub async fn send(
78        self,
79    ) -> ::std::result::Result<
80        crate::operation::create_group::CreateGroupOutput,
81        ::aws_smithy_runtime_api::client::result::SdkError<
82            crate::operation::create_group::CreateGroupError,
83            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84        >,
85    > {
86        let input = self
87            .inner
88            .build()
89            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90        let runtime_plugins = crate::operation::create_group::CreateGroup::operation_runtime_plugins(
91            self.handle.runtime_plugins.clone(),
92            &self.handle.conf,
93            self.config_override,
94        );
95        crate::operation::create_group::CreateGroup::orchestrate(&runtime_plugins, input).await
96    }
97
98    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99    pub fn customize(
100        self,
101    ) -> crate::client::customize::CustomizableOperation<
102        crate::operation::create_group::CreateGroupOutput,
103        crate::operation::create_group::CreateGroupError,
104        Self,
105    > {
106        crate::client::customize::CustomizableOperation::new(self)
107    }
108    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109        self.set_config_override(::std::option::Option::Some(config_override.into()));
110        self
111    }
112
113    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114        self.config_override = config_override;
115        self
116    }
117    /// <p>The name of the group, which is the identifier of the group in other operations. You can't change the name of a resource group after you create it. A resource group name can consist of letters, numbers, hyphens, periods, and underscores. The name cannot start with <code>AWS</code>, <code>aws</code>, or any other possible capitalization; these are reserved. A resource group name must be unique within each Amazon Web Services Region in your Amazon Web Services account.</p>
118    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.name(input.into());
120        self
121    }
122    /// <p>The name of the group, which is the identifier of the group in other operations. You can't change the name of a resource group after you create it. A resource group name can consist of letters, numbers, hyphens, periods, and underscores. The name cannot start with <code>AWS</code>, <code>aws</code>, or any other possible capitalization; these are reserved. A resource group name must be unique within each Amazon Web Services Region in your Amazon Web Services account.</p>
123    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_name(input);
125        self
126    }
127    /// <p>The name of the group, which is the identifier of the group in other operations. You can't change the name of a resource group after you create it. A resource group name can consist of letters, numbers, hyphens, periods, and underscores. The name cannot start with <code>AWS</code>, <code>aws</code>, or any other possible capitalization; these are reserved. A resource group name must be unique within each Amazon Web Services Region in your Amazon Web Services account.</p>
128    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
129        self.inner.get_name()
130    }
131    /// <p>The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.</p>
132    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.inner = self.inner.description(input.into());
134        self
135    }
136    /// <p>The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.</p>
137    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_description(input);
139        self
140    }
141    /// <p>The description of the resource group. Descriptions can consist of letters, numbers, hyphens, underscores, periods, and spaces.</p>
142    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_description()
144    }
145    /// <p>The resource query that determines which Amazon Web Services resources are members of this group. For more information about resource queries, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html#gettingstarted-query-cli-tag">Create a tag-based group in Resource Groups</a>.</p><note>
146    /// <p>A resource group can contain either a <code>ResourceQuery</code> or a <code>Configuration</code>, but not both.</p>
147    /// </note>
148    pub fn resource_query(mut self, input: crate::types::ResourceQuery) -> Self {
149        self.inner = self.inner.resource_query(input);
150        self
151    }
152    /// <p>The resource query that determines which Amazon Web Services resources are members of this group. For more information about resource queries, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html#gettingstarted-query-cli-tag">Create a tag-based group in Resource Groups</a>.</p><note>
153    /// <p>A resource group can contain either a <code>ResourceQuery</code> or a <code>Configuration</code>, but not both.</p>
154    /// </note>
155    pub fn set_resource_query(mut self, input: ::std::option::Option<crate::types::ResourceQuery>) -> Self {
156        self.inner = self.inner.set_resource_query(input);
157        self
158    }
159    /// <p>The resource query that determines which Amazon Web Services resources are members of this group. For more information about resource queries, see <a href="https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-query.html#gettingstarted-query-cli-tag">Create a tag-based group in Resource Groups</a>.</p><note>
160    /// <p>A resource group can contain either a <code>ResourceQuery</code> or a <code>Configuration</code>, but not both.</p>
161    /// </note>
162    pub fn get_resource_query(&self) -> &::std::option::Option<crate::types::ResourceQuery> {
163        self.inner.get_resource_query()
164    }
165    ///
166    /// Adds a key-value pair to `Tags`.
167    ///
168    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
169    ///
170    /// <p>The tags to add to the group. A tag is key-value pair string.</p>
171    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
172        self.inner = self.inner.tags(k.into(), v.into());
173        self
174    }
175    /// <p>The tags to add to the group. A tag is key-value pair string.</p>
176    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
177        self.inner = self.inner.set_tags(input);
178        self
179    }
180    /// <p>The tags to add to the group. A tag is key-value pair string.</p>
181    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
182        self.inner.get_tags()
183    }
184    ///
185    /// Appends an item to `Configuration`.
186    ///
187    /// To override the contents of this collection use [`set_configuration`](Self::set_configuration).
188    ///
189    /// <p>A configuration associates the resource group with an Amazon Web Services service and specifies how the service can interact with the resources in the group. A configuration is an array of <code>GroupConfigurationItem</code> elements. For details about the syntax of service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p><note>
190    /// <p>A resource group can contain either a <code>Configuration</code> or a <code>ResourceQuery</code>, but not both.</p>
191    /// </note>
192    pub fn configuration(mut self, input: crate::types::GroupConfigurationItem) -> Self {
193        self.inner = self.inner.configuration(input);
194        self
195    }
196    /// <p>A configuration associates the resource group with an Amazon Web Services service and specifies how the service can interact with the resources in the group. A configuration is an array of <code>GroupConfigurationItem</code> elements. For details about the syntax of service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p><note>
197    /// <p>A resource group can contain either a <code>Configuration</code> or a <code>ResourceQuery</code>, but not both.</p>
198    /// </note>
199    pub fn set_configuration(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GroupConfigurationItem>>) -> Self {
200        self.inner = self.inner.set_configuration(input);
201        self
202    }
203    /// <p>A configuration associates the resource group with an Amazon Web Services service and specifies how the service can interact with the resources in the group. A configuration is an array of <code>GroupConfigurationItem</code> elements. For details about the syntax of service configurations, see <a href="https://docs.aws.amazon.com/ARG/latest/APIReference/about-slg.html">Service configurations for Resource Groups</a>.</p><note>
204    /// <p>A resource group can contain either a <code>Configuration</code> or a <code>ResourceQuery</code>, but not both.</p>
205    /// </note>
206    pub fn get_configuration(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GroupConfigurationItem>> {
207        self.inner.get_configuration()
208    }
209    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
210    pub fn criticality(mut self, input: i32) -> Self {
211        self.inner = self.inner.criticality(input);
212        self
213    }
214    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
215    pub fn set_criticality(mut self, input: ::std::option::Option<i32>) -> Self {
216        self.inner = self.inner.set_criticality(input);
217        self
218    }
219    /// <p>The critical rank of the application group on a scale of 1 to 10, with a rank of 1 being the most critical, and a rank of 10 being least critical.</p>
220    pub fn get_criticality(&self) -> &::std::option::Option<i32> {
221        self.inner.get_criticality()
222    }
223    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
224    pub fn owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225        self.inner = self.inner.owner(input.into());
226        self
227    }
228    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
229    pub fn set_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230        self.inner = self.inner.set_owner(input);
231        self
232    }
233    /// <p>A name, email address or other identifier for the person or group who is considered as the owner of this application group within your organization.</p>
234    pub fn get_owner(&self) -> &::std::option::Option<::std::string::String> {
235        self.inner.get_owner()
236    }
237    /// <p>The name of the application group, which you can change at any time.</p>
238    pub fn display_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
239        self.inner = self.inner.display_name(input.into());
240        self
241    }
242    /// <p>The name of the application group, which you can change at any time.</p>
243    pub fn set_display_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
244        self.inner = self.inner.set_display_name(input);
245        self
246    }
247    /// <p>The name of the application group, which you can change at any time.</p>
248    pub fn get_display_name(&self) -> &::std::option::Option<::std::string::String> {
249        self.inner.get_display_name()
250    }
251}