Skip to content

restore_branch

restore_branch(
    branch_arn: BranchArn,
    restore_to_time: datetime,
    *,
    config_overrides: Optional[AmplifyGen3ClientConfig] = None,
) -> RestoreBranchResponse

Restores the data of the production branch to a point in time in a new branch of the Production environment. The production branch isn't changed, and no deployment uses the new branch. The name of the new branch is production- followed by the restore time in seconds since the epoch. The restore runs asynchronously. To connect to the new branch, call GetBranch with the returned branch ARN until it returns a DatabaseConnection. When you no longer need the branch, delete it with DeleteBranch. A request to restore to the same time as an earlier request returns the branch that the earlier request created.

Parameters:

  • branch_arn (BranchArn) –

    The Amazon Resource Name (ARN) of the production branch of the Production environment. Other branches can't be restored.

  • restore_to_time (datetime) –

    The point in time to restore the production branch to. The time must be within the window that GetRestoreWindow returns and can't be in the future. Fractions of a second are ignored.

Raises:

Source code in docs_src/capo_amplifygen3/_services/amplify_gen3.py
def restore_branch(
    self,
    branch_arn: "capo_amplifygen3.types.branch_arn.BranchArn",
    restore_to_time: datetime.datetime,
    *,
    config_overrides: Optional[AmplifyGen3ClientConfig] = None,
) -> "capo_amplifygen3.types.restore_branch_response.RestoreBranchResponse":
    """<p>Restores the data of the production branch to a point in time in a new branch of the Production environment. The production branch isn't changed, and no deployment uses the new branch. The name of the new branch is production- followed by the restore time in seconds since the epoch. The restore runs asynchronously. To connect to the new branch, call GetBranch with the returned branch ARN until it returns a DatabaseConnection. When you no longer need the branch, delete it with DeleteBranch. A request to restore to the same time as an earlier request returns the branch that the earlier request created.</p>

    Args:
        branch_arn: <p>The Amazon Resource Name (ARN) of the production branch of the Production environment. Other branches can't be restored.</p>
        restore_to_time: <p>The point in time to restore the production branch to. The time must be within the window that GetRestoreWindow returns and can't be in the future. Fractions of a second are ignored.</p>

    Raises:
        capo_amplifygen3.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_amplifygen3.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_amplifygen3.errors.internal_server_exception.InternalServerException: <p>An internal error occurred. Retry the request.</p>
        capo_amplifygen3.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_amplifygen3.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota for your account.</p>
        capo_amplifygen3.errors.throttling_exception.ThrottlingException: <p>The request was denied because the request rate exceeds the allowed limit.</p>
        capo_amplifygen3.errors.validation_exception.ValidationException: <p>The request contains invalid parameters or is otherwise malformed.</p>
        capo_amplifygen3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amplifygen3.types.restore_branch_request.RestoreBranchRequest]",
    ) -> OperationResponse[
        "capo_amplifygen3.types.restore_branch_response.RestoreBranchResponse"
    ]:
        import capo_amplifygen3._operations.omega.restore_branch

        output, http_response = (
            capo_amplifygen3._operations.omega.restore_branch.restore_branch(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreBranch")
    )
    input_: capo_amplifygen3.types.restore_branch_request.RestoreBranchRequest = {
        "branch_arn": branch_arn,
        "restore_to_time": restore_to_time,
    }

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