Skip to content

assume_decorated_role_with_saml async

assume_decorated_role_with_saml(
    saml_assertion: SAMLAssertionString,
    role_arn: IAMRoleArn,
    principal_arn: IAMSAMLProviderArn,
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    duration_seconds: Optional[CredentialTimeoutDurationSecondInteger] = None,
) -> AssumeDecoratedRoleWithSAMLResponse

Allows a caller to assume an IAM role decorated as the SAML user specified in the SAML assertion included in the request. This decoration allows Lake Formation to enforce access policies against the SAML users and groups. This API operation requires SAML federation setup in the caller’s account as it can only be called with valid SAML assertions. Lake Formation does not scope down the permission of the assumed role. All permissions attached to the role via the SAML federation setup will be included in the role session.

This decorated role is expected to access data in Amazon S3 by getting temporary access from Lake Formation which is authorized via the virtual API GetDataAccess. Therefore, all SAML roles that can be assumed via AssumeDecoratedRoleWithSAML must at a minimum include lakeformation:GetDataAccess in their role policies. A typical IAM policy attached to such a role would include the following actions:

  • glue:*Database*

  • glue:*Table*

  • glue:*Partition*

  • glue:*UserDefinedFunction*

  • lakeformation:GetDataAccess

Parameters:

  • saml_assertion (SAMLAssertionString) –

    A SAML assertion consisting of an assertion statement for the user who needs temporary credentials. This must match the SAML assertion that was issued to IAM. This must be Base64 encoded.

  • role_arn (IAMRoleArn) –

    The role that represents an IAM principal whose scope down policy allows it to call credential vending APIs such as GetTemporaryTableCredentials. The caller must also have iam:PassRole permission on this role.

  • principal_arn (IAMSAMLProviderArn) –

    The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.

  • duration_seconds (Optional[CredentialTimeoutDurationSecondInteger], default: None ) –

    The time period, between 900 and 43,200 seconds, for the timeout of the temporary credentials.

Raises:

Source code in docs_src/capo_lakeformation/_services/async_lake_formation.py
async def assume_decorated_role_with_saml(
    self,
    saml_assertion: "capo_lakeformation.types.saml_assertion_string.SAMLAssertionString",
    role_arn: "capo_lakeformation.types.iam_role_arn.IAMRoleArn",
    principal_arn: "capo_lakeformation.types.iamsaml_provider_arn.IAMSAMLProviderArn",
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
    duration_seconds: Optional[
        "capo_lakeformation.types.credential_timeout_duration_second_integer.CredentialTimeoutDurationSecondInteger"
    ] = None,
) -> "capo_lakeformation.types.assume_decorated_role_with_saml_response.AssumeDecoratedRoleWithSAMLResponse":
    """<p>Allows a caller to assume an IAM role decorated as the SAML user specified in the SAML assertion included in the request. This decoration allows Lake Formation to enforce access policies against the SAML users and groups. This API operation requires SAML federation setup in the caller’s account as it can only be called with valid SAML assertions. Lake Formation does not scope down the permission of the assumed role. All permissions attached to the role via the SAML federation setup will be included in the role session. </p> <p> This decorated role is expected to access data in Amazon S3 by getting temporary access from Lake Formation which is authorized via the virtual API <code>GetDataAccess</code>. Therefore, all SAML roles that can be assumed via <code>AssumeDecoratedRoleWithSAML</code> must at a minimum include <code>lakeformation:GetDataAccess</code> in their role policies. A typical IAM policy attached to such a role would include the following actions: </p> <ul> <li> <p>glue:*Database*</p> </li> <li> <p>glue:*Table*</p> </li> <li> <p>glue:*Partition*</p> </li> <li> <p>glue:*UserDefinedFunction*</p> </li> <li> <p>lakeformation:GetDataAccess</p> </li> </ul>

    Args:
        saml_assertion: <p>A SAML assertion consisting of an assertion statement for the user who needs temporary credentials. This must match the SAML assertion that was issued to IAM. This must be Base64 encoded.</p>
        role_arn: <p>The role that represents an IAM principal whose scope down policy allows it to call credential vending APIs such as <code>GetTemporaryTableCredentials</code>. The caller must also have iam:PassRole permission on this role. </p>
        principal_arn: <p>The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.</p>
        duration_seconds: <p>The time period, between 900 and 43,200 seconds, for the timeout of the temporary credentials.</p>

    Raises:
        capo_lakeformation.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_lakeformation.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist.</p>
        capo_lakeformation.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_lakeformation.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_lakeformation.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_lakeformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lakeformation.types.assume_decorated_role_with_saml_request.AssumeDecoratedRoleWithSAMLRequest]",
    ) -> AsyncOperationResponse[
        "capo_lakeformation.types.assume_decorated_role_with_saml_response.AssumeDecoratedRoleWithSAMLResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.assume_decorated_role_with_saml

        (
            output,
            http_response,
        ) = await capo_lakeformation._operations.aws_lake_formation.assume_decorated_role_with_saml.async_assume_decorated_role_with_saml(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssumeDecoratedRoleWithSAML")
    )
    input_: capo_lakeformation.types.assume_decorated_role_with_saml_request.AssumeDecoratedRoleWithSAMLRequest = {
        "saml_assertion": saml_assertion,
        "role_arn": role_arn,
        "principal_arn": principal_arn,
    }
    if duration_seconds is not None:
        input_["duration_seconds"] = duration_seconds

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