com.pulumi.alicloud.ecs.EcsKeyPair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alicloud Show documentation
Show all versions of alicloud Show documentation
A Pulumi package for creating and managing AliCloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.alicloud.ecs;
import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.ecs.EcsKeyPairArgs;
import com.pulumi.alicloud.ecs.inputs.EcsKeyPairState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Object;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a ECS Key Pair resource.
*
* For information about ECS Key Pair and how to use it, see [What is Key Pair](https://www.alibabacloud.com/help/en/doc-detail/51771.htm).
*
* > **NOTE:** Available in v1.121.0+.
*
* ## Example Usage
*
* Basic Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.alicloud.ecs.EcsKeyPair;
* import com.pulumi.alicloud.ecs.EcsKeyPairArgs;
* 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 example = new EcsKeyPair("example", EcsKeyPairArgs.builder()
* .keyPairName("key_pair_name")
* .build());
*
* // Using name prefix to build key pair
* var prefix = new EcsKeyPair("prefix", EcsKeyPairArgs.builder()
* .keyNamePrefix("terraform-test-key-pair-prefix")
* .build());
*
* // Import an existing public key to build a alicloud key pair
* var publickey = new EcsKeyPair("publickey", EcsKeyPairArgs.builder()
* .keyPairName("my_public_key")
* .publicKey("ssh-rsa AAAAB3Nza12345678qwertyuudsfsg")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* ECS Key Pair can be imported using the id, e.g.
*
* ```sh
* $ pulumi import alicloud:ecs/ecsKeyPair:EcsKeyPair example <key_name>
* ```
*
*/
@ResourceType(type="alicloud:ecs/ecsKeyPair:EcsKeyPair")
public class EcsKeyPair extends com.pulumi.resources.CustomResource {
/**
* The finger print of the key pair.
*
*/
@Export(name="fingerPrint", refs={String.class}, tree="[0]")
private Output fingerPrint;
/**
* @return The finger print of the key pair.
*
*/
public Output fingerPrint() {
return this.fingerPrint;
}
/**
* The key file.
*
*/
@Export(name="keyFile", refs={String.class}, tree="[0]")
private Output keyFile;
/**
* @return The key file.
*
*/
public Output> keyFile() {
return Codegen.optional(this.keyFile);
}
/**
* Field `key_name` has been deprecated from provider version 1.121.0. New field `key_pair_name` instead.
*
* @deprecated
* Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead.
*
*/
@Deprecated /* Field 'key_name' has been deprecated from provider version 1.121.0. New field 'key_pair_name' instead. */
@Export(name="keyName", refs={String.class}, tree="[0]")
private Output keyName;
/**
* @return Field `key_name` has been deprecated from provider version 1.121.0. New field `key_pair_name` instead.
*
*/
public Output keyName() {
return this.keyName;
}
@Export(name="keyNamePrefix", refs={String.class}, tree="[0]")
private Output keyNamePrefix;
public Output> keyNamePrefix() {
return Codegen.optional(this.keyNamePrefix);
}
/**
* The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.
*
*/
@Export(name="keyPairName", refs={String.class}, tree="[0]")
private Output keyPairName;
/**
* @return The key pair's name. It is the only in one Alicloud account, the key pair's name. must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.
*
*/
public Output keyPairName() {
return this.keyPairName;
}
/**
* You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, `resource_group_id` is the key pair belongs.
*
*/
@Export(name="publicKey", refs={String.class}, tree="[0]")
private Output publicKey;
/**
* @return You can import an existing public key and using Alicloud key pair to manage it. If this parameter is specified, `resource_group_id` is the key pair belongs.
*
*/
public Output> publicKey() {
return Codegen.optional(this.publicKey);
}
/**
* The Id of resource group which the key pair belongs.
*
*/
@Export(name="resourceGroupId", refs={String.class}, tree="[0]")
private Output resourceGroupId;
/**
* @return The Id of resource group which the key pair belongs.
*
*/
public Output> resourceGroupId() {
return Codegen.optional(this.resourceGroupId);
}
@Export(name="tags", refs={Map.class,String.class,Object.class}, tree="[0,1,2]")
private Output> tags;
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public EcsKeyPair(String name) {
this(name, EcsKeyPairArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public EcsKeyPair(String name, @Nullable EcsKeyPairArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public EcsKeyPair(String name, @Nullable EcsKeyPairArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:ecs/ecsKeyPair:EcsKeyPair", name, args == null ? EcsKeyPairArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
}
private EcsKeyPair(String name, Output id, @Nullable EcsKeyPairState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("alicloud:ecs/ecsKeyPair:EcsKeyPair", name, state, makeResourceOptions(options, id));
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static EcsKeyPair get(String name, Output id, @Nullable EcsKeyPairState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new EcsKeyPair(name, id, state, options);
}
}