Skip to content

create_rls_policy async

create_rls_policy(
    name: NameString,
    attachment_columns: ColumnList,
    filter_expression: PredicateString,
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
) -> CreateRLSPolicyResponse

Creates a row-level security (RLS) policy. A row-level security policy defines a filter expression that Lake Formation evaluates to determine which rows of a table a principal is allowed to see. The policy is created independently of any resource, and is later associated with a resource and principal using AttachRLSPolicy.

Parameters:

  • name (NameString) –

    A unique name for the row-level security policy within the Data Catalog.

  • attachment_columns (ColumnList) –

    The list of columns that the filter expression references. These columns define the shape of the data that the policy can be attached to.

  • filter_expression (PredicateString) –

    A filter predicate, written in a SQL-like syntax, that Lake Formation evaluates against each row. Only the rows for which the expression evaluates to true are returned to the principal.

Raises:

Source code in docs_src/capo_lakeformation/_services/async_lake_formation.py
async def create_rls_policy(
    self,
    name: "capo_lakeformation.types.name_string.NameString",
    attachment_columns: "capo_lakeformation.types.column_list.ColumnList",
    filter_expression: "capo_lakeformation.types.predicate_string.PredicateString",
    *,
    config_overrides: Optional[AsyncLakeFormationClientConfig] = None,
) -> "capo_lakeformation.types.create_rls_policy_response.CreateRLSPolicyResponse":
    """<p>Creates a row-level security (RLS) policy. A row-level security policy defines a filter expression that Lake Formation evaluates to determine which rows of a table a principal is allowed to see. The policy is created independently of any resource, and is later associated with a resource and principal using <code>AttachRLSPolicy</code>.</p>

    Args:
        name: <p>A unique name for the row-level security policy within the Data Catalog.</p>
        attachment_columns: <p>The list of columns that the filter expression references. These columns define the shape of the data that the policy can be attached to.</p>
        filter_expression: <p>A filter predicate, written in a SQL-like syntax, that Lake Formation evaluates against each row. Only the rows for which the expression evaluates to true are returned to the principal.</p>

    Raises:
        capo_lakeformation.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_lakeformation.errors.already_exists_exception.AlreadyExistsException: <p>A resource to be created or added already exists.</p>
        capo_lakeformation.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</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.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_lakeformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lakeformation.types.create_rls_policy_request.CreateRLSPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_lakeformation.types.create_rls_policy_response.CreateRLSPolicyResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.create_rls_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRLSPolicy")
    )
    input_: capo_lakeformation.types.create_rls_policy_request.CreateRLSPolicyRequest = {
        "name": name,
        "attachment_columns": attachment_columns,
        "filter_expression": filter_expression,
    }

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