Skip to content

lock_rule async

lock_rule(
    identifier: RuleIdentifier,
    lock_configuration: LockConfiguration,
    *,
    config_overrides: Optional[AsyncrbinClientConfig] = None,
) -> LockRuleResponse

Locks a Region-level retention rule. A locked retention rule can't be modified or deleted.

You can't lock tag-level retention rules, or Region-level retention rules that have exclusion tags.

Parameters:

  • identifier (RuleIdentifier) –

    The unique ID of the retention rule.

  • lock_configuration (LockConfiguration) –

    Information about the retention rule lock configuration.

Raises:

Source code in docs_src/capo_rbin/_services/async_rbin.py
async def lock_rule(
    self,
    identifier: "capo_rbin.types.rule_identifier.RuleIdentifier",
    lock_configuration: "capo_rbin.types.lock_configuration.LockConfiguration",
    *,
    config_overrides: Optional[AsyncrbinClientConfig] = None,
) -> "capo_rbin.types.lock_rule_response.LockRuleResponse":
    """<p>Locks a Region-level retention rule. A locked retention rule can't be modified or deleted.</p> <note> <p>You can't lock tag-level retention rules, or Region-level retention rules that have exclusion tags.</p> </note>

    Args:
        identifier: <p>The unique ID of the retention rule.</p>
        lock_configuration: <p>Information about the retention rule lock configuration.</p>

    Raises:
        capo_rbin.errors.conflict_exception.ConflictException: <p>The specified retention rule lock request can't be completed.</p>
        capo_rbin.errors.internal_server_exception.InternalServerException: <p>The service could not respond to the request due to an internal problem.</p>
        capo_rbin.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_rbin.errors.validation_exception.ValidationException: <p>One or more of the parameters in the request is not valid.</p>
        capo_rbin.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rbin.types.lock_rule_request.LockRuleRequest]",
    ) -> AsyncOperationResponse[
        "capo_rbin.types.lock_rule_response.LockRuleResponse"
    ]:
        import capo_rbin._operations.amazon_recycle_bin.lock_rule

        (
            output,
            http_response,
        ) = await capo_rbin._operations.amazon_recycle_bin.lock_rule.async_lock_rule(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("LockRule")
    )
    input_: capo_rbin.types.lock_rule_request.LockRuleRequest = {
        "identifier": identifier,
        "lock_configuration": lock_configuration,
    }

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