Hetzner Cloud

v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

getVolume

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var volume1 = Output.Create(HCloud.GetVolume.InvokeAsync(new HCloud.GetVolumeArgs
        {
            Id = 1234,
        }));
        var volume2 = Output.Create(HCloud.GetVolume.InvokeAsync(new HCloud.GetVolumeArgs
        {
            Name = "my-volume",
        }));
        var volume3 = Output.Create(HCloud.GetVolume.InvokeAsync(new HCloud.GetVolumeArgs
        {
            WithSelector = "key=value",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := hcloud.LookupVolume(ctx, &GetVolumeArgs{
			Id: pulumi.IntRef(1234),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.LookupVolume(ctx, &GetVolumeArgs{
			Name: pulumi.StringRef("my-volume"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = hcloud.LookupVolume(ctx, &GetVolumeArgs{
			WithSelector: pulumi.StringRef("key=value"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var volume1 = Output.of(HcloudFunctions.getVolume(GetVolumeArgs.builder()
            .id("1234")
            .build()));

        final var volume2 = Output.of(HcloudFunctions.getVolume(GetVolumeArgs.builder()
            .name("my-volume")
            .build()));

        final var volume3 = Output.of(HcloudFunctions.getVolume(GetVolumeArgs.builder()
            .withSelector("key=value")
            .build()));

    }
}
import pulumi
import pulumi_hcloud as hcloud

volume1 = hcloud.get_volume(id=1234)
volume2 = hcloud.get_volume(name="my-volume")
volume3 = hcloud.get_volume(with_selector="key=value")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const volume1 = pulumi.output(hcloud.getVolume({
    id: 1234,
}));
const volume2 = pulumi.output(hcloud.getVolume({
    name: "my-volume",
}));
const volume3 = pulumi.output(hcloud.getVolume({
    withSelector: "key=value",
}));
variables:
  volume1:
    Fn::Invoke:
      Function: hcloud:getVolume
      Arguments:
        id: 1234
  volume2:
    Fn::Invoke:
      Function: hcloud:getVolume
      Arguments:
        name: my-volume
  volume3:
    Fn::Invoke:
      Function: hcloud:getVolume
      Arguments:
        withSelector: key=value

Using getVolume

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getVolume(args: GetVolumeArgs, opts?: InvokeOptions): Promise<GetVolumeResult>
function getVolumeOutput(args: GetVolumeOutputArgs, opts?: InvokeOptions): Output<GetVolumeResult>
def get_volume(id: Optional[int] = None,
               location: Optional[str] = None,
               name: Optional[str] = None,
               selector: Optional[str] = None,
               server_id: Optional[int] = None,
               with_selector: Optional[str] = None,
               with_statuses: Optional[Sequence[str]] = None,
               opts: Optional[InvokeOptions] = None) -> GetVolumeResult
def get_volume_output(id: Optional[pulumi.Input[int]] = None,
               location: Optional[pulumi.Input[str]] = None,
               name: Optional[pulumi.Input[str]] = None,
               selector: Optional[pulumi.Input[str]] = None,
               server_id: Optional[pulumi.Input[int]] = None,
               with_selector: Optional[pulumi.Input[str]] = None,
               with_statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetVolumeResult]
func LookupVolume(ctx *Context, args *LookupVolumeArgs, opts ...InvokeOption) (*LookupVolumeResult, error)
func LookupVolumeOutput(ctx *Context, args *LookupVolumeOutputArgs, opts ...InvokeOption) LookupVolumeResultOutput

> Note: This function is named LookupVolume in the Go SDK.

public static class GetVolume 
{
    public static Task<GetVolumeResult> InvokeAsync(GetVolumeArgs args, InvokeOptions? opts = null)
    public static Output<GetVolumeResult> Invoke(GetVolumeInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: hcloud:index/getVolume:getVolume
  arguments:
    # arguments dictionary

The following arguments are supported:

Id int

ID of the volume.

Location string

(string) The location name.

Name string

Name of the volume.

Selector string

Deprecated:

Please use the with_selector property instead.

ServerId int

(Optional, int) Server ID the volume is attached to

WithSelector string

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

WithStatuses List<string>

List only volumes with the specified status, could contain creating or available.

Id int

ID of the volume.

Location string

(string) The location name.

Name string

Name of the volume.

Selector string

Deprecated:

Please use the with_selector property instead.

ServerId int

(Optional, int) Server ID the volume is attached to

WithSelector string

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

WithStatuses []string

List only volumes with the specified status, could contain creating or available.

id Integer

ID of the volume.

location String

(string) The location name.

name String

Name of the volume.

selector String

Deprecated:

Please use the with_selector property instead.

serverId Integer

(Optional, int) Server ID the volume is attached to

withSelector String

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

withStatuses List<String>

List only volumes with the specified status, could contain creating or available.

id number

ID of the volume.

location string

(string) The location name.

name string

Name of the volume.

selector string

Deprecated:

Please use the with_selector property instead.

serverId number

(Optional, int) Server ID the volume is attached to

withSelector string

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

withStatuses string[]

List only volumes with the specified status, could contain creating or available.

id int

ID of the volume.

location str

(string) The location name.

name str

Name of the volume.

selector str

Deprecated:

Please use the with_selector property instead.

server_id int

(Optional, int) Server ID the volume is attached to

with_selector str

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

with_statuses Sequence[str]

List only volumes with the specified status, could contain creating or available.

id Number

ID of the volume.

location String

(string) The location name.

name String

Name of the volume.

selector String

Deprecated:

Please use the with_selector property instead.

serverId Number

(Optional, int) Server ID the volume is attached to

withSelector String

Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

withStatuses List<String>

List only volumes with the specified status, could contain creating or available.

getVolume Result

The following output properties are available:

DeleteProtection bool

(boolean) Whether delete protection is enabled.

Id int

(int) Unique ID of the volume.

Labels Dictionary<string, object>

(map) User-defined labels (key-value pairs).

LinuxDevice string

(string) Device path on the file system for the Volume.

Name string

(string) Name of the volume.

Size int

(int) Size of the volume.

Location string

(string) The location name.

Selector string

Deprecated:

Please use the with_selector property instead.

ServerId int

(Optional, int) Server ID the volume is attached to

WithSelector string
WithStatuses List<string>
DeleteProtection bool

(boolean) Whether delete protection is enabled.

Id int

(int) Unique ID of the volume.

Labels map[string]interface{}

(map) User-defined labels (key-value pairs).

LinuxDevice string

(string) Device path on the file system for the Volume.

Name string

(string) Name of the volume.

Size int

(int) Size of the volume.

Location string

(string) The location name.

Selector string

Deprecated:

Please use the with_selector property instead.

ServerId int

(Optional, int) Server ID the volume is attached to

WithSelector string
WithStatuses []string
deleteProtection Boolean

(boolean) Whether delete protection is enabled.

id Integer

(int) Unique ID of the volume.

labels Map<String,Object>

(map) User-defined labels (key-value pairs).

linuxDevice String

(string) Device path on the file system for the Volume.

name String

(string) Name of the volume.

size Integer

(int) Size of the volume.

location String

(string) The location name.

selector String

Deprecated:

Please use the with_selector property instead.

serverId Integer

(Optional, int) Server ID the volume is attached to

withSelector String
withStatuses List<String>
deleteProtection boolean

(boolean) Whether delete protection is enabled.

id number

(int) Unique ID of the volume.

labels {[key: string]: any}

(map) User-defined labels (key-value pairs).

linuxDevice string

(string) Device path on the file system for the Volume.

name string

(string) Name of the volume.

size number

(int) Size of the volume.

location string

(string) The location name.

selector string

Deprecated:

Please use the with_selector property instead.

serverId number

(Optional, int) Server ID the volume is attached to

withSelector string
withStatuses string[]
delete_protection bool

(boolean) Whether delete protection is enabled.

id int

(int) Unique ID of the volume.

labels Mapping[str, Any]

(map) User-defined labels (key-value pairs).

linux_device str

(string) Device path on the file system for the Volume.

name str

(string) Name of the volume.

size int

(int) Size of the volume.

location str

(string) The location name.

selector str

Deprecated:

Please use the with_selector property instead.

server_id int

(Optional, int) Server ID the volume is attached to

with_selector str
with_statuses Sequence[str]
deleteProtection Boolean

(boolean) Whether delete protection is enabled.

id Number

(int) Unique ID of the volume.

labels Map<Any>

(map) User-defined labels (key-value pairs).

linuxDevice String

(string) Device path on the file system for the Volume.

name String

(string) Name of the volume.

size Number

(int) Size of the volume.

location String

(string) The location name.

selector String

Deprecated:

Please use the with_selector property instead.

serverId Number

(Optional, int) Server ID the volume is attached to

withSelector String
withStatuses List<String>

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.