After you generate a group or policy report using the GenerateServiceLastAccessedDetails operation, you can use the JobId parameter in GetServiceLastAccessedDetailsWithEntities. This operation retrieves the status of your report job and a list of entities that could have used group or policy permissions to access the specified service.
-
Group – For a group report, this operation returns a list of users in the group that could have used the group’s policies in an attempt to access the service.
-
Policy – For a policy report, this operation returns a list of entities (users or roles) that could have used the policy in an attempt to access the service.
You can also use this operation for user or role reports to retrieve details about those entities.
If the operation fails, the GetServiceLastAccessedDetailsWithEntities operation returns the reason that it failed.
By default, the list of associated entities is sorted by date, with the most recent access listed first.
Parameters:
-
job_id
(jobIDType)
–
The ID of the request generated by the GenerateServiceLastAccessedDetails operation.
-
service_namespace
(serviceNamespaceType)
–
The service namespace for an Amazon Web Services service. Provide the service namespace to learn when the IAM entity last attempted to access the specified service.
To learn the service namespace for a service, see Actions, resources, and condition keys for Amazon Web Services services in the IAM User Guide. Choose the name of the service to view details for that service. In the first paragraph, find the service prefix. For example, (service prefix: a4b). For more information about service namespaces, see Amazon Web Services service namespaces in the Amazon Web Services General Reference.
-
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.
Raises:
-
InvalidInputException
–
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
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 sntity details from a previously-generated report
The following operation returns details about the entities that attempted to access the IAM service.
>>> await client.get_service_last_accessed_details_with_entities(job_id='examplef-1305-c245-eba4-71fe298bcda7', service_namespace='iam')
Source code in docs_src/capo_iam/_services/async_iam.py
| async def get_service_last_accessed_details_with_entities(
self,
job_id: "capo_iam.types.job_id_type.jobIDType",
service_namespace: "capo_iam.types.service_namespace_type.serviceNamespaceType",
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
max_items: Optional["capo_iam.types.max_items_type.maxItemsType"] = None,
marker: Optional["capo_iam.types.marker_type.markerType"] = None,
) -> "capo_iam.types.get_service_last_accessed_details_with_entities_response.GetServiceLastAccessedDetailsWithEntitiesResponse":
"""<p>After you generate a group or policy report using the <code>GenerateServiceLastAccessedDetails</code> operation, you can use the <code>JobId</code> parameter in <code>GetServiceLastAccessedDetailsWithEntities</code>. This operation retrieves the status of your report job and a list of entities that could have used group or policy permissions to access the specified service.</p> <ul> <li> <p> <b>Group</b> – For a group report, this operation returns a list of users in the group that could have used the group’s policies in an attempt to access the service.</p> </li> <li> <p> <b>Policy</b> – For a policy report, this operation returns a list of entities (users or roles) that could have used the policy in an attempt to access the service.</p> </li> </ul> <p>You can also use this operation for user or role reports to retrieve details about those entities.</p> <p>If the operation fails, the <code>GetServiceLastAccessedDetailsWithEntities</code> operation returns the reason that it failed.</p> <p>By default, the list of associated entities is sorted by date, with the most recent access listed first.</p>
Args:
job_id: <p>The ID of the request generated by the <code>GenerateServiceLastAccessedDetails</code> operation.</p>
service_namespace: <p>The service namespace for an Amazon Web Services service. Provide the service namespace to learn when the IAM entity last attempted to access the specified service.</p> <p>To learn the service namespace for a service, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>IAM User Guide</i>. Choose the name of the service to view details for that service. In the first paragraph, find the service prefix. For example, <code>(service prefix: a4b)</code>. For more information about service namespaces, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces">Amazon Web Services service namespaces</a> in the <i>Amazon Web Services General Reference</i>.</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>
Raises:
capo_iam.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
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 sntity details from a previously-generated report
The following operation returns details about the entities that attempted to access the IAM service.
>>> await client.get_service_last_accessed_details_with_entities(job_id='examplef-1305-c245-eba4-71fe298bcda7', service_namespace='iam')
"""
async def _handler(
req: "AsyncOperationRequest[capo_iam.types.get_service_last_accessed_details_with_entities_request.GetServiceLastAccessedDetailsWithEntitiesRequest]",
) -> AsyncOperationResponse[
"capo_iam.types.get_service_last_accessed_details_with_entities_response.GetServiceLastAccessedDetailsWithEntitiesResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.get_service_last_accessed_details_with_entities
(
output,
http_response,
) = await capo_iam._operations.aws_identity_management_v20100508.get_service_last_accessed_details_with_entities.async_get_service_last_accessed_details_with_entities(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("GetServiceLastAccessedDetailsWithEntities"),
)
input_: capo_iam.types.get_service_last_accessed_details_with_entities_request.GetServiceLastAccessedDetailsWithEntitiesRequest = {
"job_id": job_id,
"service_namespace": service_namespace,
}
if max_items is not None:
input_["max_items"] = max_items
if marker is not None:
input_["marker"] = marker
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|