aws_sdk_iam/operation/get_service_last_accessed_details/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_service_last_accessed_details::_get_service_last_accessed_details_output::GetServiceLastAccessedDetailsOutputBuilder;
3
4pub use crate::operation::get_service_last_accessed_details::_get_service_last_accessed_details_input::GetServiceLastAccessedDetailsInputBuilder;
5
6impl crate::operation::get_service_last_accessed_details::builders::GetServiceLastAccessedDetailsInputBuilder {
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_service_last_accessed_details::GetServiceLastAccessedDetailsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.get_service_last_accessed_details();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `GetServiceLastAccessedDetails`.
24///
25/// <p>Retrieves a service last accessed report that was created using the <code>GenerateServiceLastAccessedDetails</code> operation. You can use the <code>JobId</code> parameter in <code>GetServiceLastAccessedDetails</code> to retrieve the status of your report job. When the report is complete, you can retrieve the generated report. The report includes a list of Amazon Web Services services that the resource (user, group, role, or managed policy) can access.</p><note>
26/// <p>Service last accessed data does not use other policy types when determining whether a resource could access a service. These other policy types include resource-based policies, access control lists, Organizations policies, IAM permissions boundaries, and STS assume role policies. It only applies permissions policy logic. For more about the evaluation of policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics">Evaluating policies</a> in the <i>IAM User Guide</i>.</p>
27/// </note>
28/// <p>For each service that the resource could access using permissions policies, the operation returns details about the most recent access attempt. If there was no attempt, the service is listed without details about the most recent attempt to access the service. If the operation fails, the <code>GetServiceLastAccessedDetails</code> operation returns the reason that it failed.</p>
29/// <p>The <code>GetServiceLastAccessedDetails</code> operation returns a list of services. This list includes the number of entities that have attempted to access the service and the date and time of the last attempt. It also returns the ARN of the following entity, depending on the resource ARN that you used to generate the report:</p>
30/// <ul>
31/// <li>
32/// <p><b>User</b> – Returns the user ARN that you used to generate the report</p></li>
33/// <li>
34/// <p><b>Group</b> – Returns the ARN of the group member (user) that last attempted to access the service</p></li>
35/// <li>
36/// <p><b>Role</b> – Returns the role ARN that you used to generate the report</p></li>
37/// <li>
38/// <p><b>Policy</b> – Returns the ARN of the user or role that last used the policy to attempt to access the service</p></li>
39/// </ul>
40/// <p>By default, the list is sorted by service namespace.</p>
41/// <p>If you specified <code>ACTION_LEVEL</code> granularity when you generated the report, this operation returns service and action last accessed data. This includes the most recent access attempt for each tracked action within a service. Otherwise, this operation returns only service data.</p>
42/// <p>For more information about service and action last accessed data, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html">Reducing permissions using service last accessed data</a> in the <i>IAM User Guide</i>.</p>
43#[derive(::std::clone::Clone, ::std::fmt::Debug)]
44pub struct GetServiceLastAccessedDetailsFluentBuilder {
45 handle: ::std::sync::Arc<crate::client::Handle>,
46 inner: crate::operation::get_service_last_accessed_details::builders::GetServiceLastAccessedDetailsInputBuilder,
47 config_override: ::std::option::Option<crate::config::Builder>,
48}
49impl
50 crate::client::customize::internal::CustomizableSend<
51 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsOutput,
52 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsError,
53 > for GetServiceLastAccessedDetailsFluentBuilder
54{
55 fn send(
56 self,
57 config_override: crate::config::Builder,
58 ) -> crate::client::customize::internal::BoxFuture<
59 crate::client::customize::internal::SendResult<
60 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsOutput,
61 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsError,
62 >,
63 > {
64 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
65 }
66}
67impl GetServiceLastAccessedDetailsFluentBuilder {
68 /// Creates a new `GetServiceLastAccessedDetailsFluentBuilder`.
69 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
70 Self {
71 handle,
72 inner: ::std::default::Default::default(),
73 config_override: ::std::option::Option::None,
74 }
75 }
76 /// Access the GetServiceLastAccessedDetails as a reference.
77 pub fn as_input(&self) -> &crate::operation::get_service_last_accessed_details::builders::GetServiceLastAccessedDetailsInputBuilder {
78 &self.inner
79 }
80 /// Sends the request and returns the response.
81 ///
82 /// If an error occurs, an `SdkError` will be returned with additional details that
83 /// can be matched against.
84 ///
85 /// By default, any retryable failures will be retried twice. Retry behavior
86 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
87 /// set when configuring the client.
88 pub async fn send(
89 self,
90 ) -> ::std::result::Result<
91 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsOutput,
92 ::aws_smithy_runtime_api::client::result::SdkError<
93 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsError,
94 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
95 >,
96 > {
97 let input = self
98 .inner
99 .build()
100 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
101 let runtime_plugins = crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetails::operation_runtime_plugins(
102 self.handle.runtime_plugins.clone(),
103 &self.handle.conf,
104 self.config_override,
105 );
106 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetails::orchestrate(&runtime_plugins, input).await
107 }
108
109 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
110 pub fn customize(
111 self,
112 ) -> crate::client::customize::CustomizableOperation<
113 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsOutput,
114 crate::operation::get_service_last_accessed_details::GetServiceLastAccessedDetailsError,
115 Self,
116 > {
117 crate::client::customize::CustomizableOperation::new(self)
118 }
119 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
120 self.set_config_override(::std::option::Option::Some(config_override.into()));
121 self
122 }
123
124 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
125 self.config_override = config_override;
126 self
127 }
128 /// <p>The ID of the request generated by the <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateServiceLastAccessedDetails.html">GenerateServiceLastAccessedDetails</a> operation. The <code>JobId</code> returned by <code>GenerateServiceLastAccessedDetail</code> must be used by the same role within a session, or by the same user when used to call <code>GetServiceLastAccessedDetail</code>.</p>
129 pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.job_id(input.into());
131 self
132 }
133 /// <p>The ID of the request generated by the <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateServiceLastAccessedDetails.html">GenerateServiceLastAccessedDetails</a> operation. The <code>JobId</code> returned by <code>GenerateServiceLastAccessedDetail</code> must be used by the same role within a session, or by the same user when used to call <code>GetServiceLastAccessedDetail</code>.</p>
134 pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_job_id(input);
136 self
137 }
138 /// <p>The ID of the request generated by the <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateServiceLastAccessedDetails.html">GenerateServiceLastAccessedDetails</a> operation. The <code>JobId</code> returned by <code>GenerateServiceLastAccessedDetail</code> must be used by the same role within a session, or by the same user when used to call <code>GetServiceLastAccessedDetail</code>.</p>
139 pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_job_id()
141 }
142 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
143 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
144 pub fn max_items(mut self, input: i32) -> Self {
145 self.inner = self.inner.max_items(input);
146 self
147 }
148 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
149 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
150 pub fn set_max_items(mut self, input: ::std::option::Option<i32>) -> Self {
151 self.inner = self.inner.set_max_items(input);
152 self
153 }
154 /// <p>Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the <code>IsTruncated</code> response element is <code>true</code>.</p>
155 /// <p>If you do not include this parameter, the number of items defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the <code>IsTruncated</code> response element returns <code>true</code>, and <code>Marker</code> contains a value to include in the subsequent call that tells the service where to continue from.</p>
156 pub fn get_max_items(&self) -> &::std::option::Option<i32> {
157 self.inner.get_max_items()
158 }
159 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
160 pub fn marker(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.marker(input.into());
162 self
163 }
164 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
165 pub fn set_marker(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_marker(input);
167 self
168 }
169 /// <p>Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the <code>Marker</code> element in the response that you received to indicate where the next call should start.</p>
170 pub fn get_marker(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_marker()
172 }
173}