Hetzner Cloud

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

getSshKeys

Example Usage

using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var allKeys = Output.Create(HCloud.GetSshKeys.InvokeAsync());
        var keysBySelector = Output.Create(HCloud.GetSshKeys.InvokeAsync(new HCloud.GetSshKeysArgs
        {
            WithSelector = "foo=bar",
        }));
        var main = new HCloud.Server("main", new HCloud.ServerArgs
        {
            SshKeys = 
            {
                allKeys.Apply(allKeys => allKeys.SshKeys),
            }.Select(__item => __item?.Name).ToList(),
        });
    }

}

Coming soon!

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 allKeys = Output.of(HcloudFunctions.getSshKeys());

        final var keysBySelector = Output.of(HcloudFunctions.getSshKeys(GetSshKeysArgs.builder()
            .withSelector("foo=bar")
            .build()));

        var main = new Server("main", ServerArgs.builder()        
            .sshKeys(allKeys.apply(getSshKeysResult -> getSshKeysResult.sshKeys()).stream().map(element -> element.name()).collect(toList()))
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

all_keys = hcloud.get_ssh_keys()
keys_by_selector = hcloud.get_ssh_keys(with_selector="foo=bar")
main = hcloud.Server("main", ssh_keys=[__item.name for __item in [all_keys.ssh_keys]])
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const allKeys = hcloud.getSshKeys({});
const keysBySelector = hcloud.getSshKeys({
    withSelector: "foo=bar",
});
const main = new hcloud.Server("main", {sshKeys: [allKeys.then(allKeys => allKeys.sshKeys)].map(__item => __item?.name)});

Coming soon!

Using getSshKeys

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 getSshKeys(args: GetSshKeysArgs, opts?: InvokeOptions): Promise<GetSshKeysResult>
function getSshKeysOutput(args: GetSshKeysOutputArgs, opts?: InvokeOptions): Output<GetSshKeysResult>
def get_ssh_keys(with_selector: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetSshKeysResult
def get_ssh_keys_output(with_selector: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetSshKeysResult]
func GetSshKeys(ctx *Context, args *GetSshKeysArgs, opts ...InvokeOption) (*GetSshKeysResult, error)
func GetSshKeysOutput(ctx *Context, args *GetSshKeysOutputArgs, opts ...InvokeOption) GetSshKeysResultOutput

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

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

The following arguments are supported:

getSshKeys Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

SshKeys List<Pulumi.HCloud.Outputs.GetSshKeysSshKey>

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

WithSelector string
Id string

The provider-assigned unique ID for this managed resource.

SshKeys []GetSshKeysSshKey

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

WithSelector string
id String

The provider-assigned unique ID for this managed resource.

sshKeys List<GetSshKeysSshKey>

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

withSelector String
id string

The provider-assigned unique ID for this managed resource.

sshKeys GetSshKeysSshKey[]

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

withSelector string
id str

The provider-assigned unique ID for this managed resource.

ssh_keys Sequence[GetSshKeysSshKey]

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

with_selector str
id String

The provider-assigned unique ID for this managed resource.

sshKeys List<Property Map>

(list) List of all matches SSH keys. See data.hcloud_ssh_key for schema.

withSelector String

Supporting Types

GetSshKeysSshKey

Fingerprint string
Id int
Labels Dictionary<string, object>
Name string
PublicKey string
Fingerprint string
Id int
Labels map[string]interface{}
Name string
PublicKey string
fingerprint String
id Integer
labels Map<String,Object>
name String
publicKey String
fingerprint string
id number
labels {[key: string]: any}
name string
publicKey string
fingerprint str
id int
labels Mapping[str, Any]
name str
public_key str
fingerprint String
id Number
labels Map<Any>
name String
publicKey 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.