hcloud logo
Hetzner Cloud v1.10.3, Mar 8 23

hcloud.getServers

Example Usage

using System.Collections.Generic;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var s3 = HCloud.GetServers.Invoke(new()
    {
        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.GetServers(ctx, &hcloud.GetServersArgs{
			WithSelector: pulumi.StringRef("key=value"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.HcloudFunctions;
import com.pulumi.hcloud.inputs.GetServersArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

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

    public static void stack(Context ctx) {
        final var s3 = HcloudFunctions.getServers(GetServersArgs.builder()
            .withSelector("key=value")
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

s3 = hcloud.get_servers(with_selector="key=value")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const s3 = hcloud.getServers({
    withSelector: "key=value",
});
variables:
  s3:
    fn::invoke:
      Function: hcloud:getServers
      Arguments:
        withSelector: key=value

Using getServers

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 getServers(args: GetServersArgs, opts?: InvokeOptions): Promise<GetServersResult>
function getServersOutput(args: GetServersOutputArgs, opts?: InvokeOptions): Output<GetServersResult>
def get_servers(with_selector: Optional[str] = None,
                with_statuses: Optional[Sequence[str]] = None,
                opts: Optional[InvokeOptions] = None) -> GetServersResult
def get_servers_output(with_selector: Optional[pulumi.Input[str]] = None,
                with_statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetServersResult]
func GetServers(ctx *Context, args *GetServersArgs, opts ...InvokeOption) (*GetServersResult, error)
func GetServersOutput(ctx *Context, args *GetServersOutputArgs, opts ...InvokeOption) GetServersResultOutput

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

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

The following arguments are supported:

WithSelector string

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

WithStatuses List<string>

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

WithSelector string

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

WithStatuses []string

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

withSelector String

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

withStatuses List<String>

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

withSelector string

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

withStatuses string[]

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

with_selector str

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

with_statuses Sequence[str]

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

withSelector String

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

withStatuses List<String>

List only servers with the specified status, could contain initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown.

getServers Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Servers List<Pulumi.HCloud.Outputs.GetServersServer>

(list) List of all matching servers. See data.hcloud_server for schema.

WithSelector string
WithStatuses List<string>
Id string

The provider-assigned unique ID for this managed resource.

Servers []GetServersServer

(list) List of all matching servers. See data.hcloud_server for schema.

WithSelector string
WithStatuses []string
id String

The provider-assigned unique ID for this managed resource.

servers List<GetServersServer>

(list) List of all matching servers. See data.hcloud_server for schema.

withSelector String
withStatuses List<String>
id string

The provider-assigned unique ID for this managed resource.

servers GetServersServer[]

(list) List of all matching servers. See data.hcloud_server for schema.

withSelector string
withStatuses string[]
id str

The provider-assigned unique ID for this managed resource.

servers Sequence[GetServersServer]

(list) List of all matching servers. See data.hcloud_server for schema.

with_selector str
with_statuses Sequence[str]
id String

The provider-assigned unique ID for this managed resource.

servers List<Property Map>

(list) List of all matching servers. See data.hcloud_server for schema.

withSelector String
withStatuses List<String>

Supporting Types

GetServersServer

BackupWindow string
Backups bool
Datacenter string
DeleteProtection bool
FirewallIds List<int>
Id int
Image string
Ipv4Address string
Ipv6Address string
Ipv6Network string
Iso string
Labels Dictionary<string, object>
Location string
Name string
RebuildProtection bool
Rescue string
ServerType string
Status string
PlacementGroupId int
BackupWindow string
Backups bool
Datacenter string
DeleteProtection bool
FirewallIds []int
Id int
Image string
Ipv4Address string
Ipv6Address string
Ipv6Network string
Iso string
Labels map[string]interface{}
Location string
Name string
RebuildProtection bool
Rescue string
ServerType string
Status string
PlacementGroupId int
backupWindow String
backups Boolean
datacenter String
deleteProtection Boolean
firewallIds List<Integer>
id Integer
image String
ipv4Address String
ipv6Address String
ipv6Network String
iso String
labels Map<String,Object>
location String
name String
rebuildProtection Boolean
rescue String
serverType String
status String
placementGroupId Integer
backupWindow string
backups boolean
datacenter string
deleteProtection boolean
firewallIds number[]
id number
image string
ipv4Address string
ipv6Address string
ipv6Network string
iso string
labels {[key: string]: any}
location string
name string
rebuildProtection boolean
rescue string
serverType string
status string
placementGroupId number
backupWindow String
backups Boolean
datacenter String
deleteProtection Boolean
firewallIds List<Number>
id Number
image String
ipv4Address String
ipv6Address String
ipv6Network String
iso String
labels Map<Any>
location String
name String
rebuildProtection Boolean
rescue String
serverType String
status String
placementGroupId Number

Package Details

Repository
Hetzner Cloud pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.