Skip to content

restore_snapshot_tier async

restore_snapshot_tier(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    snapshot_id: Optional[SnapshotId] = None,
    temporary_restore_days: Optional[
        RestoreSnapshotTierRequestTemporaryRestoreDays
    ] = None,
    permanent_restore: Optional[Boolean] = None,
    dry_run: Optional[Boolean] = None,
) -> RestoreSnapshotTierResult

Restores an archived Amazon EBS snapshot for use temporarily or permanently, or modifies the restore period or restore type for a snapshot that was previously temporarily restored.

For more information see Restore an archived snapshot and modify the restore period or restore type for a temporarily restored snapshot in the Amazon EBS User Guide.

Parameters:

  • snapshot_id (Optional[SnapshotId], default: None ) –

    The ID of the snapshot to restore.

  • temporary_restore_days (Optional[RestoreSnapshotTierRequestTemporaryRestoreDays], default: None ) –

    Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period.

    To temporarily restore an archived snapshot, specify the number of days and omit the PermanentRestore parameter or set it to false.

  • permanent_restore (Optional[Boolean], default: None ) –

    Indicates whether to permanently restore an archived snapshot. To permanently restore an archived snapshot, specify true and omit the RestoreSnapshotTierRequest$TemporaryRestoreDays parameter.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def restore_snapshot_tier(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    snapshot_id: Optional["capo_ec2.types.snapshot_id.SnapshotId"] = None,
    temporary_restore_days: Optional[
        "capo_ec2.types.restore_snapshot_tier_request_temporary_restore_days.RestoreSnapshotTierRequestTemporaryRestoreDays"
    ] = None,
    permanent_restore: Optional["capo_ec2.types.boolean.Boolean"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.restore_snapshot_tier_result.RestoreSnapshotTierResult":
    """<p>Restores an archived Amazon EBS snapshot for use temporarily or permanently, or modifies the restore period or restore type for a snapshot that was previously temporarily restored.</p> <p>For more information see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/working-with-snapshot-archiving.html#restore-archived-snapshot"> Restore an archived snapshot</a> and <a href="https://docs.aws.amazon.com/ebs/latest/userguide/working-with-snapshot-archiving.html#modify-temp-restore-period"> modify the restore period or restore type for a temporarily restored snapshot</a> in the <i>Amazon EBS User Guide</i>.</p>

    Args:
        snapshot_id: <p>The ID of the snapshot to restore.</p>
        temporary_restore_days: <p>Specifies the number of days for which to temporarily restore an archived snapshot. Required for temporary restores only. The snapshot will be automatically re-archived after this period.</p> <p>To temporarily restore an archived snapshot, specify the number of days and omit the <b>PermanentRestore</b> parameter or set it to <code>false</code>.</p>
        permanent_restore: <p>Indicates whether to permanently restore an archived snapshot. To permanently restore an archived snapshot, specify <code>true</code> and omit the <b>RestoreSnapshotTierRequest$TemporaryRestoreDays</b> parameter.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.restore_snapshot_tier_request.RestoreSnapshotTierRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.restore_snapshot_tier_result.RestoreSnapshotTierResult"
    ]:
        import capo_ec2._operations.amazon_ec2.restore_snapshot_tier

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.restore_snapshot_tier.async_restore_snapshot_tier(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreSnapshotTier")
    )
    input_: capo_ec2.types.restore_snapshot_tier_request.RestoreSnapshotTierRequest = {}
    if snapshot_id is not None:
        input_["snapshot_id"] = snapshot_id
    if temporary_restore_days is not None:
        input_["temporary_restore_days"] = temporary_restore_days
    if permanent_restore is not None:
        input_["permanent_restore"] = permanent_restore
    if dry_run is not None:
        input_["dry_run"] = dry_run

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