aws_sdk_iam/operation/create_service_linked_role/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_service_linked_role::_create_service_linked_role_output::CreateServiceLinkedRoleOutputBuilder;
3
4pub use crate::operation::create_service_linked_role::_create_service_linked_role_input::CreateServiceLinkedRoleInputBuilder;
5
6impl crate::operation::create_service_linked_role::builders::CreateServiceLinkedRoleInputBuilder {
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_service_linked_role::CreateServiceLinkedRoleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_service_linked_role::CreateServiceLinkedRoleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_service_linked_role();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateServiceLinkedRole`.
24///
25/// <p>Creates an IAM role that is linked to a specific Amazon Web Services service. The service controls the attached policies and when the role can be deleted. This helps ensure that the service is not broken by an unexpectedly changed or deleted role, which could put your Amazon Web Services resources into an unknown state. Allowing the service to control the role helps improve service stability and proper cleanup when a service and its role are no longer needed. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html">Using service-linked roles</a> in the <i>IAM User Guide</i>.</p>
26/// <p>To attach a policy to this service-linked role, you must make the request using the Amazon Web Services service that depends on this role.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateServiceLinkedRoleFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_service_linked_role::builders::CreateServiceLinkedRoleInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::create_service_linked_role::CreateServiceLinkedRoleOutput,
36 crate::operation::create_service_linked_role::CreateServiceLinkedRoleError,
37 > for CreateServiceLinkedRoleFluentBuilder
38{
39 fn send(
40 self,
41 config_override: crate::config::Builder,
42 ) -> crate::client::customize::internal::BoxFuture<
43 crate::client::customize::internal::SendResult<
44 crate::operation::create_service_linked_role::CreateServiceLinkedRoleOutput,
45 crate::operation::create_service_linked_role::CreateServiceLinkedRoleError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl CreateServiceLinkedRoleFluentBuilder {
52 /// Creates a new `CreateServiceLinkedRoleFluentBuilder`.
53 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54 Self {
55 handle,
56 inner: ::std::default::Default::default(),
57 config_override: ::std::option::Option::None,
58 }
59 }
60 /// Access the CreateServiceLinkedRole as a reference.
61 pub fn as_input(&self) -> &crate::operation::create_service_linked_role::builders::CreateServiceLinkedRoleInputBuilder {
62 &self.inner
63 }
64 /// Sends the request and returns the response.
65 ///
66 /// If an error occurs, an `SdkError` will be returned with additional details that
67 /// can be matched against.
68 ///
69 /// By default, any retryable failures will be retried twice. Retry behavior
70 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71 /// set when configuring the client.
72 pub async fn send(
73 self,
74 ) -> ::std::result::Result<
75 crate::operation::create_service_linked_role::CreateServiceLinkedRoleOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::create_service_linked_role::CreateServiceLinkedRoleError,
78 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79 >,
80 > {
81 let input = self
82 .inner
83 .build()
84 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::create_service_linked_role::CreateServiceLinkedRole::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::create_service_linked_role::CreateServiceLinkedRole::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<
97 crate::operation::create_service_linked_role::CreateServiceLinkedRoleOutput,
98 crate::operation::create_service_linked_role::CreateServiceLinkedRoleError,
99 Self,
100 > {
101 crate::client::customize::CustomizableOperation::new(self)
102 }
103 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104 self.set_config_override(::std::option::Option::Some(config_override.into()));
105 self
106 }
107
108 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109 self.config_override = config_override;
110 self
111 }
112 /// <p>The service principal for the Amazon Web Services service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: <code>elasticbeanstalk.amazonaws.com</code>.</p>
113 /// <p>Service principals are unique and case-sensitive. To find the exact service principal for your service-linked role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">Amazon Web Services services that work with IAM</a> in the <i>IAM User Guide</i>. Look for the services that have <b>Yes </b>in the <b>Service-Linked Role</b> column. Choose the <b>Yes</b> link to view the service-linked role documentation for that service.</p>
114 pub fn aws_service_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.aws_service_name(input.into());
116 self
117 }
118 /// <p>The service principal for the Amazon Web Services service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: <code>elasticbeanstalk.amazonaws.com</code>.</p>
119 /// <p>Service principals are unique and case-sensitive. To find the exact service principal for your service-linked role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">Amazon Web Services services that work with IAM</a> in the <i>IAM User Guide</i>. Look for the services that have <b>Yes </b>in the <b>Service-Linked Role</b> column. Choose the <b>Yes</b> link to view the service-linked role documentation for that service.</p>
120 pub fn set_aws_service_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_aws_service_name(input);
122 self
123 }
124 /// <p>The service principal for the Amazon Web Services service to which this role is attached. You use a string similar to a URL but without the http:// in front. For example: <code>elasticbeanstalk.amazonaws.com</code>.</p>
125 /// <p>Service principals are unique and case-sensitive. To find the exact service principal for your service-linked role, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">Amazon Web Services services that work with IAM</a> in the <i>IAM User Guide</i>. Look for the services that have <b>Yes </b>in the <b>Service-Linked Role</b> column. Choose the <b>Yes</b> link to view the service-linked role documentation for that service.</p>
126 pub fn get_aws_service_name(&self) -> &::std::option::Option<::std::string::String> {
127 self.inner.get_aws_service_name()
128 }
129 /// <p>The description of the role.</p>
130 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.description(input.into());
132 self
133 }
134 /// <p>The description of the role.</p>
135 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_description(input);
137 self
138 }
139 /// <p>The description of the role.</p>
140 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_description()
142 }
143 /// <p></p>
144 /// <p>A string that you provide, which is combined with the service-provided prefix to form the complete role name. If you make multiple requests for the same service, then you must supply a different <code>CustomSuffix</code> for each request. Otherwise the request fails with a duplicate role name error. For example, you could add <code>-1</code> or <code>-debug</code> to the suffix.</p>
145 /// <p>Some services do not support the <code>CustomSuffix</code> parameter. If you provide an optional suffix and the operation fails, try the operation again without the suffix.</p>
146 pub fn custom_suffix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.custom_suffix(input.into());
148 self
149 }
150 /// <p></p>
151 /// <p>A string that you provide, which is combined with the service-provided prefix to form the complete role name. If you make multiple requests for the same service, then you must supply a different <code>CustomSuffix</code> for each request. Otherwise the request fails with a duplicate role name error. For example, you could add <code>-1</code> or <code>-debug</code> to the suffix.</p>
152 /// <p>Some services do not support the <code>CustomSuffix</code> parameter. If you provide an optional suffix and the operation fails, try the operation again without the suffix.</p>
153 pub fn set_custom_suffix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.inner = self.inner.set_custom_suffix(input);
155 self
156 }
157 /// <p></p>
158 /// <p>A string that you provide, which is combined with the service-provided prefix to form the complete role name. If you make multiple requests for the same service, then you must supply a different <code>CustomSuffix</code> for each request. Otherwise the request fails with a duplicate role name error. For example, you could add <code>-1</code> or <code>-debug</code> to the suffix.</p>
159 /// <p>Some services do not support the <code>CustomSuffix</code> parameter. If you provide an optional suffix and the operation fails, try the operation again without the suffix.</p>
160 pub fn get_custom_suffix(&self) -> &::std::option::Option<::std::string::String> {
161 self.inner.get_custom_suffix()
162 }
163}