Skip to content

list_application_assignments_for_principal async

list_application_assignments_for_principal(
    instance_arn: InstanceArn,
    principal_id: PrincipalId,
    principal_type: PrincipalType,
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
    filter: Optional[ListApplicationAssignmentsFilter] = None,
    next_token: Optional[Token] = None,
    max_results: Optional[MaxResults] = None,
) -> ListApplicationAssignmentsForPrincipalResponse

Lists the applications to which a specified principal is assigned. You must provide a filter when calling this action from a member account against your organization instance of IAM Identity Center. A filter is not required when called from the management account against an organization instance of IAM Identity Center, or from a member account against an account instance of IAM Identity Center in the same account.

Parameters:

  • instance_arn (InstanceArn) –

    Specifies the instance of IAM Identity Center that contains principal and applications.

  • principal_id (PrincipalId) –

    Specifies the unique identifier of the principal for which you want to retrieve its assignments.

  • principal_type (PrincipalType) –

    Specifies the type of the principal for which you want to retrieve its assignments.

  • filter (Optional[ListApplicationAssignmentsFilter], default: None ) –

    Filters the output to include only assignments associated with the application that has the specified ARN.

  • next_token (Optional[Token], default: None ) –

    Specifies that you want to receive the next page of results. Valid only if you received a NextToken response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's NextToken response to request the next page of results.

  • max_results (Optional[MaxResults], default: None ) –

    Specifies the total number of results that you want included in each response. If additional items exist beyond the number you specify, the NextToken response element is returned with a value (not null). Include the specified value as the NextToken request parameter in the next call to the operation to get the next set of results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Raises:

Source code in docs_src/capo_sso_admin/_services/async_sso_admin.py
async def list_application_assignments_for_principal(
    self,
    instance_arn: "capo_sso_admin.types.instance_arn.InstanceArn",
    principal_id: "capo_sso_admin.types.principal_id.PrincipalId",
    principal_type: "capo_sso_admin.types.principal_type.PrincipalType",
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
    filter: Optional[
        "capo_sso_admin.types.list_application_assignments_filter.ListApplicationAssignmentsFilter"
    ] = None,
    next_token: Optional["capo_sso_admin.types.token.Token"] = None,
    max_results: Optional["capo_sso_admin.types.max_results.MaxResults"] = None,
) -> "capo_sso_admin.types.list_application_assignments_for_principal_response.ListApplicationAssignmentsForPrincipalResponse":
    """<p>Lists the applications to which a specified principal is assigned. You must provide a filter when calling this action from a member account against your organization instance of IAM Identity Center. A filter is not required when called from the management account against an organization instance of IAM Identity Center, or from a member account against an account instance of IAM Identity Center in the same account.</p>

    Args:
        instance_arn: <p>Specifies the instance of IAM Identity Center that contains principal and applications.</p>
        principal_id: <p>Specifies the unique identifier of the principal for which you want to retrieve its assignments.</p>
        principal_type: <p>Specifies the type of the principal for which you want to retrieve its assignments.</p>
        filter: <p>Filters the output to include only assignments associated with the application that has the specified ARN.</p>
        next_token: <p>Specifies that you want to receive the next page of results. Valid only if you received a <code>NextToken</code> response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's <code>NextToken</code> response to request the next page of results.</p>
        max_results: <p>Specifies the total number of results that you want included in each response. If additional items exist beyond the number you specify, the <code>NextToken</code> response element is returned with a value (not null). Include the specified value as the <code>NextToken</code> request parameter in the next call to the operation to get the next set of results. Note that the service might return fewer results than the maximum even when there are more results available. You should check <code>NextToken</code> after every operation to ensure that you receive all of the results.</p>

    Raises:
        capo_sso_admin.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_sso_admin.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure with an internal server.</p>
        capo_sso_admin.errors.resource_not_found_exception.ResourceNotFoundException: <p>Indicates that a requested resource is not found.</p>
        capo_sso_admin.errors.throttling_exception.ThrottlingException: <p>Indicates that the principal has crossed the throttling limits of the API operations.</p>
        capo_sso_admin.errors.validation_exception.ValidationException: <p>The request failed because it contains a syntax error.</p>
        capo_sso_admin.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sso_admin.types.list_application_assignments_for_principal_request.ListApplicationAssignmentsForPrincipalRequest]",
    ) -> AsyncOperationResponse[
        "capo_sso_admin.types.list_application_assignments_for_principal_response.ListApplicationAssignmentsForPrincipalResponse"
    ]:
        import capo_sso_admin._operations.swb_external_service.list_application_assignments_for_principal

        (
            output,
            http_response,
        ) = await capo_sso_admin._operations.swb_external_service.list_application_assignments_for_principal.async_list_application_assignments_for_principal(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListApplicationAssignmentsForPrincipal")
    )
    input_: capo_sso_admin.types.list_application_assignments_for_principal_request.ListApplicationAssignmentsForPrincipalRequest = {
        "instance_arn": instance_arn,
        "principal_id": principal_id,
        "principal_type": principal_type,
    }
    if filter is not None:
        input_["filter"] = filter
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output