Show / Hide Table of Contents

Class GetVolumeSnapshot

Inheritance
System.Object
GetVolumeSnapshot
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.DigitalOcean
Assembly: Pulumi.DigitalOcean.dll
Syntax
public static class GetVolumeSnapshot

Methods

View Source

InvokeAsync(GetVolumeSnapshotArgs, InvokeOptions)

Volume snapshots are saved instances of a block storage volume. Use this data source to retrieve the ID of a DigitalOcean volume snapshot for use in other resources.

{{% examples %}}

Example Usage

{{% example %}}

Get the volume snapshot:

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
public MyStack()
{
    var snapshot = Output.Create(DigitalOcean.GetVolumeSnapshot.InvokeAsync(new DigitalOcean.GetVolumeSnapshotArgs
    {
        MostRecent = true,
        NameRegex = "^web",
        Region = "nyc3",
    }));
}

}

Reuse the data about a volume snapshot to create a new volume based on it:

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
public MyStack()
{
    var snapshot = Output.Create(DigitalOcean.GetVolumeSnapshot.InvokeAsync(new DigitalOcean.GetVolumeSnapshotArgs
    {
        NameRegex = "^web",
        Region = "nyc3",
        MostRecent = true,
    }));
    var foobar = new DigitalOcean.Volume("foobar", new DigitalOcean.VolumeArgs
    {
        Region = "nyc3",
        Size = 100,
        SnapshotId = snapshot.Apply(snapshot => snapshot.Id),
    });
}

}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetVolumeSnapshotResult> InvokeAsync(GetVolumeSnapshotArgs args = null, InvokeOptions options = null)
Parameters
Type Name Description
GetVolumeSnapshotArgs args
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetVolumeSnapshotResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.