aws_sdk_iam/operation/get_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_policy::_get_policy_output::GetPolicyOutputBuilder;
3
4pub use crate::operation::get_policy::_get_policy_input::GetPolicyInputBuilder;
5
6impl crate::operation::get_policy::builders::GetPolicyInputBuilder {
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_policy::GetPolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_policy::GetPolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetPolicy`.
24///
25/// <p>Retrieves information about the specified managed policy, including the policy's default version and the total number of IAM users, groups, and roles to which the policy is attached. To retrieve the list of the specific users, groups, and roles that the policy is attached to, use <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListEntitiesForPolicy.html">ListEntitiesForPolicy</a>. This operation returns metadata about the policy. To retrieve the actual policy document for a specific version of the policy, use <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetPolicyVersion.html">GetPolicyVersion</a>.</p>
26/// <p>This operation retrieves information about managed policies. To retrieve information about an inline policy that is embedded with an IAM user, group, or role, use <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetUserPolicy.html">GetUserPolicy</a>, <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetGroupPolicy.html">GetGroupPolicy</a>, or <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetRolePolicy.html">GetRolePolicy</a>.</p>
27/// <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>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct GetPolicyFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::get_policy::builders::GetPolicyInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl crate::client::customize::internal::CustomizableSend<crate::operation::get_policy::GetPolicyOutput, crate::operation::get_policy::GetPolicyError>
35    for GetPolicyFluentBuilder
36{
37    fn send(
38        self,
39        config_override: crate::config::Builder,
40    ) -> crate::client::customize::internal::BoxFuture<
41        crate::client::customize::internal::SendResult<crate::operation::get_policy::GetPolicyOutput, crate::operation::get_policy::GetPolicyError>,
42    > {
43        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
44    }
45}
46impl GetPolicyFluentBuilder {
47    /// Creates a new `GetPolicyFluentBuilder`.
48    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
49        Self {
50            handle,
51            inner: ::std::default::Default::default(),
52            config_override: ::std::option::Option::None,
53        }
54    }
55    /// Access the GetPolicy as a reference.
56    pub fn as_input(&self) -> &crate::operation::get_policy::builders::GetPolicyInputBuilder {
57        &self.inner
58    }
59    /// Sends the request and returns the response.
60    ///
61    /// If an error occurs, an `SdkError` will be returned with additional details that
62    /// can be matched against.
63    ///
64    /// By default, any retryable failures will be retried twice. Retry behavior
65    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
66    /// set when configuring the client.
67    pub async fn send(
68        self,
69    ) -> ::std::result::Result<
70        crate::operation::get_policy::GetPolicyOutput,
71        ::aws_smithy_runtime_api::client::result::SdkError<
72            crate::operation::get_policy::GetPolicyError,
73            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
74        >,
75    > {
76        let input = self
77            .inner
78            .build()
79            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
80        let runtime_plugins = crate::operation::get_policy::GetPolicy::operation_runtime_plugins(
81            self.handle.runtime_plugins.clone(),
82            &self.handle.conf,
83            self.config_override,
84        );
85        crate::operation::get_policy::GetPolicy::orchestrate(&runtime_plugins, input).await
86    }
87
88    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
89    pub fn customize(
90        self,
91    ) -> crate::client::customize::CustomizableOperation<
92        crate::operation::get_policy::GetPolicyOutput,
93        crate::operation::get_policy::GetPolicyError,
94        Self,
95    > {
96        crate::client::customize::CustomizableOperation::new(self)
97    }
98    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
99        self.set_config_override(::std::option::Option::Some(config_override.into()));
100        self
101    }
102
103    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
104        self.config_override = config_override;
105        self
106    }
107    /// <p>The Amazon Resource Name (ARN) of the managed policy that you want information about.</p>
108    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
109    pub fn policy_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.inner = self.inner.policy_arn(input.into());
111        self
112    }
113    /// <p>The Amazon Resource Name (ARN) of the managed policy that you want information about.</p>
114    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
115    pub fn set_policy_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.inner = self.inner.set_policy_arn(input);
117        self
118    }
119    /// <p>The Amazon Resource Name (ARN) of the managed policy that you want information about.</p>
120    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
121    pub fn get_policy_arn(&self) -> &::std::option::Option<::std::string::String> {
122        self.inner.get_policy_arn()
123    }
124}