aws_sdk_iam/operation/get_role_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_role_policy::_get_role_policy_output::GetRolePolicyOutputBuilder;
3
4pub use crate::operation::get_role_policy::_get_role_policy_input::GetRolePolicyInputBuilder;
5
6impl crate::operation::get_role_policy::builders::GetRolePolicyInputBuilder {
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::get_role_policy::GetRolePolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_role_policy::GetRolePolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_role_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetRolePolicy`.
24///
25/// <p>Retrieves the specified inline policy document that is embedded with the specified IAM role.</p><note>
26/// <p>Policies returned by this operation are URL-encoded compliant with <a href="https://tools.ietf.org/html/rfc3986">RFC 3986</a>. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the <code>decode</code> method of the <code>java.net.URLDecoder</code> utility class in the Java SDK. Other languages and SDKs provide similar functionality, and some SDKs do this decoding automatically.</p>
27/// </note>
28/// <p>An IAM role can also have managed policies attached to it. To retrieve a managed policy document that is attached to a role, use <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetPolicy.html">GetPolicy</a> to determine the policy's default version, then use <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetPolicyVersion.html">GetPolicyVersion</a> to retrieve the policy document.</p>
29/// <p>For more information about policies, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html">Managed policies and inline policies</a> in the <i>IAM User Guide</i>.</p>
30/// <p>For more information about roles, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">IAM roles</a> in the <i>IAM User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct GetRolePolicyFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::get_role_policy::builders::GetRolePolicyInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::get_role_policy::GetRolePolicyOutput,
40        crate::operation::get_role_policy::GetRolePolicyError,
41    > for GetRolePolicyFluentBuilder
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::get_role_policy::GetRolePolicyOutput,
49            crate::operation::get_role_policy::GetRolePolicyError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl GetRolePolicyFluentBuilder {
56    /// Creates a new `GetRolePolicyFluentBuilder`.
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 GetRolePolicy as a reference.
65    pub fn as_input(&self) -> &crate::operation::get_role_policy::builders::GetRolePolicyInputBuilder {
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::get_role_policy::GetRolePolicyOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::get_role_policy::GetRolePolicyError,
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::get_role_policy::GetRolePolicy::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::get_role_policy::GetRolePolicy::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::get_role_policy::GetRolePolicyOutput,
102        crate::operation::get_role_policy::GetRolePolicyError,
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>The name of the role associated with the policy.</p>
117    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
118    pub fn role_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.role_name(input.into());
120        self
121    }
122    /// <p>The name of the role associated with the policy.</p>
123    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
124    pub fn set_role_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.inner = self.inner.set_role_name(input);
126        self
127    }
128    /// <p>The name of the role associated with the policy.</p>
129    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
130    pub fn get_role_name(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_role_name()
132    }
133    /// <p>The name of the policy document to get.</p>
134    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
135    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.policy_name(input.into());
137        self
138    }
139    /// <p>The name of the policy document to get.</p>
140    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
141    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_policy_name(input);
143        self
144    }
145    /// <p>The name of the policy document to get.</p>
146    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
147    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_policy_name()
149    }
150}