Skip to content

detach_rls_policy

detach_rls_policy(
    name: NameString,
    resource: Resource,
    *,
    config_overrides: Optional[LakeFormationClientConfig] = None,
    principal: Optional[DataLakePrincipal] = None,
    condition: Optional[Condition] = None,
    remove_default: Optional[NullableBoolean] = None,
) -> DetachRLSPolicyResponse

Detaches a row-level security policy from a resource for a principal. After the policy is detached, its filter expression is no longer applied to the principal's queries on that resource.

Parameters:

  • name (NameString) –

    The name of the row-level security policy to detach.

  • resource (Resource) –

    The resource from which the row-level security policy is detached.

  • principal (Optional[DataLakePrincipal], default: None ) –

    The principal for which the row-level security policy is detached.

  • condition (Optional[Condition], default: None ) –

    A Lake Formation condition, which applies to the row-level security policy attachment and contains an expression.

  • remove_default (Optional[NullableBoolean], default: None ) –

    Indicates whether to remove this policy as the default row-level security policy for the resource.

Raises:

Source code in docs_src/capo_lakeformation/_services/lake_formation.py
def detach_rls_policy(
    self,
    name: "capo_lakeformation.types.name_string.NameString",
    resource: "capo_lakeformation.types.resource.Resource",
    *,
    config_overrides: Optional[LakeFormationClientConfig] = None,
    principal: Optional[
        "capo_lakeformation.types.data_lake_principal.DataLakePrincipal"
    ] = None,
    condition: Optional["capo_lakeformation.types.condition.Condition"] = None,
    remove_default: Optional[
        "capo_lakeformation.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_lakeformation.types.detach_rls_policy_response.DetachRLSPolicyResponse":
    """<p>Detaches a row-level security policy from a resource for a principal. After the policy is detached, its filter expression is no longer applied to the principal's queries on that resource.</p>

    Args:
        name: <p>The name of the row-level security policy to detach.</p>
        resource: <p>The resource from which the row-level security policy is detached.</p>
        principal: <p>The principal for which the row-level security policy is detached.</p>
        condition: <p>A Lake Formation condition, which applies to the row-level security policy attachment and contains an expression.</p>
        remove_default: <p>Indicates whether to remove this policy as the default row-level security policy for the resource.</p>

    Raises:
        capo_lakeformation.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_lakeformation.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Two processes are trying to modify a resource simultaneously.</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.
    """

    def _handler(
        req: "OperationRequest[capo_lakeformation.types.detach_rls_policy_request.DetachRLSPolicyRequest]",
    ) -> OperationResponse[
        "capo_lakeformation.types.detach_rls_policy_response.DetachRLSPolicyResponse"
    ]:
        import capo_lakeformation._operations.aws_lake_formation.detach_rls_policy

        output, http_response = (
            capo_lakeformation._operations.aws_lake_formation.detach_rls_policy.detach_rls_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DetachRLSPolicy")
    )
    input_: capo_lakeformation.types.detach_rls_policy_request.DetachRLSPolicyRequest = {
        "name": name,
        "resource": resource,
    }
    if principal is not None:
        input_["principal"] = principal
    if condition is not None:
        input_["condition"] = condition
    if remove_default is not None:
        input_["remove_default"] = remove_default

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output