Retrieves the service last accessed data report for Organizations that was previously generated using the GenerateOrganizationsAccessReport operation. This operation retrieves the status of your report job and the report contents.
Depending on the parameters that you passed when you generated the report, the data returned could include different information. For details, see GenerateOrganizationsAccessReport.
To call this operation, you must be signed in to the management account in your organization. SCPs must be enabled for your organization root. You must have permissions to perform this operation. For more information, see Refining permissions using service last accessed data in the IAM User Guide.
For each service that principals in an account (root user, IAM users, or IAM roles) could access using SCPs, 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, it returns the reason that it failed.
By default, the list is sorted by service namespace.
Parameters:
-
job_id
(jobIDType)
–
-
max_items
(Optional[maxItemsType], default:
None
)
–
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 IsTruncated response element is true.
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 IsTruncated response element returns true, and Marker contains a value to include in the subsequent call that tells the service where to continue from.
-
marker
(Optional[markerType], default:
None
)
–
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 Marker element in the response that you received to indicate where the next call should start.
-
sort_key
(Optional[sortKeyType], default:
None
)
–
The key that is used to sort the results. If you choose the namespace key, the results are returned in alphabetical order. If you choose the time key, the results are sorted numerically by the date and time.
Raises:
-
NoSuchEntityException
–
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To get details from a previously generated organizational unit report
The following operation gets details about the report with the job ID: examplea-1234-b567-cde8-90fg123abcd4
>>> client.get_organizations_access_report(job_id='examplea-1234-b567-cde8-90fg123abcd4')
Source code in docs_src/capo_iam/_services/iam.py
| def get_organizations_access_report(
self,
job_id: "capo_iam.types.job_id_type.jobIDType",
*,
config_overrides: Optional[IAMClientConfig] = None,
max_items: Optional["capo_iam.types.max_items_type.maxItemsType"] = None,
marker: Optional["capo_iam.types.marker_type.markerType"] = None,
sort_key: Optional["capo_iam.types.sort_key_type.sortKeyType"] = None,
) -> "capo_iam.types.get_organizations_access_report_response.GetOrganizationsAccessReportResponse":
"""<p>Retrieves the service last accessed data report for Organizations that was previously generated using the <code> <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateOrganizationsAccessReport.html">GenerateOrganizationsAccessReport</a> </code> operation. This operation retrieves the status of your report job and the report contents.</p> <p>Depending on the parameters that you passed when you generated the report, the data returned could include different information. For details, see <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateOrganizationsAccessReport.html">GenerateOrganizationsAccessReport</a>.</p> <p>To call this operation, you must be signed in to the management account in your organization. SCPs must be enabled for your organization root. You must have permissions to perform this operation. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html">Refining permissions using service last accessed data</a> in the <i>IAM User Guide</i>.</p> <p>For each service that principals in an account (root user, IAM users, or IAM roles) could access using SCPs, 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, it returns the reason that it failed.</p> <p>By default, the list is sorted by service namespace.</p>
Args:
job_id: <p>The identifier of the request generated by the <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_GenerateOrganizationsAccessReport.html">GenerateOrganizationsAccessReport</a> operation.</p>
max_items: <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> <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>
marker: <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>
sort_key: <p>The key that is used to sort the results. If you choose the namespace key, the results are returned in alphabetical order. If you choose the time key, the results are sorted numerically by the date and time.</p>
Raises:
capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To get details from a previously generated organizational unit report
The following operation gets details about the report with the job ID: examplea-1234-b567-cde8-90fg123abcd4
>>> client.get_organizations_access_report(job_id='examplea-1234-b567-cde8-90fg123abcd4')
"""
def _handler(
req: "OperationRequest[capo_iam.types.get_organizations_access_report_request.GetOrganizationsAccessReportRequest]",
) -> OperationResponse[
"capo_iam.types.get_organizations_access_report_response.GetOrganizationsAccessReportResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.get_organizations_access_report
output, http_response = (
capo_iam._operations.aws_identity_management_v20100508.get_organizations_access_report.get_organizations_access_report(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetOrganizationsAccessReport")
)
input_: capo_iam.types.get_organizations_access_report_request.GetOrganizationsAccessReportRequest = {
"job_id": job_id
}
if max_items is not None:
input_["max_items"] = max_items
if marker is not None:
input_["marker"] = marker
if sort_key is not None:
input_["sort_key"] = sort_key
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|