Package com.pulumi.openstack.compute
Class Keypair
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.openstack.compute.Keypair
-
public class Keypair extends com.pulumi.resources.CustomResource## Example Usage ### Import an Existing Public Key ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.openstack.compute.Keypair; import com.pulumi.openstack.compute.KeypairArgs; 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) { var test_keypair = new Keypair("test-keypair", KeypairArgs.builder() .publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB") .build()); } } ``` ### Generate a Public/Private Key Pair ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.openstack.compute.Keypair; 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) { var test_keypair = new Keypair("test-keypair"); } } ``` ## Import Keypairs can be imported using the `name`, e.g. ```sh $ pulumi import openstack:compute/keypair:Keypair my-keypair test-keypair ```
-
-
Constructor Summary
Constructors Constructor Description Keypair(java.lang.String name)Keypair(java.lang.String name, KeypairArgs args)Keypair(java.lang.String name, KeypairArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>fingerprint()static Keypairget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, KeypairState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>privateKey()com.pulumi.core.Output<java.lang.String>publicKey()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>userId()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>>>valueSpecs()
-
-
-
Constructor Detail
-
Keypair
public Keypair(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Keypair
public Keypair(java.lang.String name, @Nullable KeypairArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Keypair
public Keypair(java.lang.String name, @Nullable KeypairArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
fingerprint
public com.pulumi.core.Output<java.lang.String> fingerprint()
- Returns:
- The fingerprint of the public key.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- A unique name for the keypair. Changing this creates a new keypair.
-
privateKey
public com.pulumi.core.Output<java.lang.String> privateKey()
- Returns:
- The generated private key when no public key is specified.
-
publicKey
public com.pulumi.core.Output<java.lang.String> publicKey()
- Returns:
- A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, the `region` argument of the provider is used. Changing this creates a new keypair.
-
userId
public com.pulumi.core.Output<java.lang.String> userId()
- Returns:
- This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later.
-
valueSpecs
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.Object>>> valueSpecs()
- Returns:
- Map of additional options.
-
get
public static Keypair get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable KeypairState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-