Skip to content

check_no_new_access async

check_no_new_access(
    new_policy_document: AccessCheckPolicyDocument,
    existing_policy_document: AccessCheckPolicyDocument,
    policy_type: AccessCheckPolicyType,
    *,
    config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None,
) -> CheckNoNewAccessResponse

Checks whether new access is allowed for an updated policy when compared to the existing policy.

You can find examples for reference policies and learn how to set up and run a custom policy check for new access in the IAM Access Analyzer custom policy checks samples repository on GitHub. The reference policies in this repository are meant to be passed to the existingPolicyDocument request parameter.

Parameters:

  • new_policy_document (AccessCheckPolicyDocument) –

    The JSON policy document to use as the content for the updated policy.

  • existing_policy_document (AccessCheckPolicyDocument) –

    The JSON policy document to use as the content for the existing policy.

  • policy_type (AccessCheckPolicyType) –

    The type of policy to compare. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.

    Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.

Raises:

Source code in docs_src/capo_accessanalyzer/_services/async_access_analyzer.py
async def check_no_new_access(
    self,
    new_policy_document: "capo_accessanalyzer.types.access_check_policy_document.AccessCheckPolicyDocument",
    existing_policy_document: "capo_accessanalyzer.types.access_check_policy_document.AccessCheckPolicyDocument",
    policy_type: "capo_accessanalyzer.types.access_check_policy_type.AccessCheckPolicyType",
    *,
    config_overrides: Optional[AsyncAccessAnalyzerClientConfig] = None,
) -> "capo_accessanalyzer.types.check_no_new_access_response.CheckNoNewAccessResponse":
    """<p>Checks whether new access is allowed for an updated policy when compared to the existing policy.</p> <p>You can find examples for reference policies and learn how to set up and run a custom policy check for new access in the <a href="https://github.com/aws-samples/iam-access-analyzer-custom-policy-check-samples">IAM Access Analyzer custom policy checks samples</a> repository on GitHub. The reference policies in this repository are meant to be passed to the <code>existingPolicyDocument</code> request parameter.</p>

    Args:
        new_policy_document: <p>The JSON policy document to use as the content for the updated policy.</p>
        existing_policy_document: <p>The JSON policy document to use as the content for the existing policy.</p>
        policy_type: <p>The type of policy to compare. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.</p> <p>Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.</p>

    Raises:
        capo_accessanalyzer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_accessanalyzer.errors.internal_server_exception.InternalServerException: <p>Internal server error.</p>
        capo_accessanalyzer.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid.</p>
        capo_accessanalyzer.errors.throttling_exception.ThrottlingException: <p>Throttling limit exceeded error.</p>
        capo_accessanalyzer.errors.unprocessable_entity_exception.UnprocessableEntityException: <p>The specified entity could not be processed.</p>
        capo_accessanalyzer.errors.validation_exception.ValidationException: <p>Validation exception error.</p>
        capo_accessanalyzer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_accessanalyzer.types.check_no_new_access_request.CheckNoNewAccessRequest]",
    ) -> AsyncOperationResponse[
        "capo_accessanalyzer.types.check_no_new_access_response.CheckNoNewAccessResponse"
    ]:
        import capo_accessanalyzer._operations.access_analyzer.check_no_new_access

        (
            output,
            http_response,
        ) = await capo_accessanalyzer._operations.access_analyzer.check_no_new_access.async_check_no_new_access(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_accessanalyzer.types.check_no_new_access_request.CheckNoNewAccessRequest",
    ) -> dict[str, Any]:
        import capo_accessanalyzer.types.check_no_new_access_request

        return (
            capo_accessanalyzer.types.check_no_new_access_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CheckNoNewAccess", redact_input=_redact_input),
    )
    input_: capo_accessanalyzer.types.check_no_new_access_request.CheckNoNewAccessRequest = {
        "new_policy_document": new_policy_document,
        "existing_policy_document": existing_policy_document,
        "policy_type": policy_type,
    }

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