All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.alicloud.ram.AccessKey Maven / Gradle / Ivy

There is a newer version: 3.63.0-alpha.1727424957
Show newest version
// *** 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.ram;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.ram.AccessKeyArgs;
import com.pulumi.alicloud.ram.inputs.AccessKeyState;
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.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Provides a RAM User access key resource.
 * 
 * > **NOTE:**  You should set the `secret_file` if you want to get the access key.
 * 
 * > **NOTE:**  From version 1.98.0, if not set `pgp_key`, the resource will output the access key secret to field `secret` and please protect your backend state file judiciously
 * 
 * > **NOTE:** Available since v1.0.0+.
 * 
 * ## Example Usage
 * 
 * Output the secret to a file.
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.alicloud.ram.User;
 * import com.pulumi.alicloud.ram.UserArgs;
 * import com.pulumi.alicloud.ram.AccessKey;
 * import com.pulumi.alicloud.ram.AccessKeyArgs;
 * 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 }{{@code
 *     public static void main(String[] args) }{{@code
 *         Pulumi.run(App::stack);
 *     }}{@code
 * 
 *     public static void stack(Context ctx) }{{@code
 *         // Create a new RAM access key for user.
 *         var user = new User("user", UserArgs.builder()
 *             .name("terraform-example")
 *             .displayName("user_display_name")
 *             .mobile("86-18688888888")
 *             .email("hello.uuu}{@literal @}{@code aaa.com")
 *             .comments("yoyoyo")
 *             .force(true)
 *             .build());
 * 
 *         var ak = new AccessKey("ak", AccessKeyArgs.builder()
 *             .userName(user.name())
 *             .secretFile("/xxx/xxx/xxx.txt")
 *             .build());
 * 
 *     }}{@code
 * }}{@code
 * }
 * 
* <!--End PulumiCodeChooser --> * * Using `pgp_key` to encrypt the secret. * * <!--Start PulumiCodeChooser --> *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.alicloud.ram.User;
 * import com.pulumi.alicloud.ram.UserArgs;
 * import com.pulumi.alicloud.ram.AccessKey;
 * import com.pulumi.alicloud.ram.AccessKeyArgs;
 * 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 }{{@code
 *     public static void main(String[] args) }{{@code
 *         Pulumi.run(App::stack);
 *     }}{@code
 * 
 *     public static void stack(Context ctx) }{{@code
 *         // Create a new RAM access key for user.
 *         var user = new User("user", UserArgs.builder()
 *             .name("terraform-example")
 *             .displayName("user_display_name")
 *             .mobile("86-18688888888")
 *             .email("hello.uuu}{@literal @}{@code aaa.com")
 *             .comments("yoyoyo")
 *             .force(true)
 *             .build());
 * 
 *         var encrypt = new AccessKey("encrypt", AccessKeyArgs.builder()
 *             .userName(user.name())
 *             .pgpKey("""
 * mQENBFXbjPUBCADjNjCUQwfxKL+RR2GA6pv/1K+zJZ8UWIF9S0lk7cVIEfJiprzzwiMwBS5cD0da
 * rGin1FHvIWOZxujA7oW0O2TUuatqI3aAYDTfRYurh6iKLC+VS+F7H+/mhfFvKmgr0Y5kDCF1j0T/
 * 063QZ84IRGucR/X43IY7kAtmxGXH0dYOCzOe5UBX1fTn3mXGe2ImCDWBH7gOViynXmb6XNvXkP0f
 * sF5St9jhO7mbZU9EFkv9O3t3EaURfHopsCVDOlCkFCw5ArY+DUORHRzoMX0PnkyQb5OzibkChzpg
 * 8hQssKeVGpuskTdz5Q7PtdW71jXd4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1z1dAcQ1RCr9bTD3PxjLBczdGqhzw71trkQRBRdtPiUchltPMIyjUHqVJ0xmg0hPqFic0fICsr0
 * YwKoz3h9+QEcZHvsjSZjgydKvfLYcm+4DDMCCqcHuJrbXJKUWmJcXR0y/+HQONGrGJ5xWdO+6eJi
 * oPn2jVMnXCm4EKc7fcLFrz/LKmJ8seXhxjM3EdFtylBGCrx3xdK0f+JDNQaC/rhUb5V2XuX6VwoH
 * /AtY+XsKVYRfNIupLOUcf/srsm3IXT4SXWVomOc9hjGQiJ3rraIbADsc+6bCAr4XNZS7moViAAcI
 * PXFv3m3WfUlnG/om78UjQqyVACRZqqAGmuPq+TSkRUCpt9h+A39LQWkojHqyob3cyLgy6z9Q557O
 * 9uK3lQozbw2gH9zC0RqnePl+rsWIUU/ga16fH6pWc1uJiEBt8UZGypQ/E56/343epmYAe0a87sHx
 * 8iDV+dNtDVKfPRENiLOOc19MmS+phmUyrbHqI91c0pmysYcJZCD3a502X1gpjFbPZcRtiTmGnUKd
 * OIu60YPNE4+h7u2CfYyFPu3AlUaGNMBlvy6PEpU=
 *             """)
 *             .build());
 * 
 *         ctx.export("secret", encrypt.encryptedSecret());
 *     }}{@code
 * }}{@code
 * }
 * 
* <!--End PulumiCodeChooser --> * */ @ResourceType(type="alicloud:ram/accessKey:AccessKey") public class AccessKey extends com.pulumi.resources.CustomResource { @Export(name="encryptedSecret", refs={String.class}, tree="[0]") private Output encryptedSecret; public Output encryptedSecret() { return this.encryptedSecret; } /** * The fingerprint of the PGP key used to encrypt the secret * */ @Export(name="keyFingerprint", refs={String.class}, tree="[0]") private Output keyFingerprint; /** * @return The fingerprint of the PGP key used to encrypt the secret * */ public Output keyFingerprint() { return this.keyFingerprint; } /** * Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists` * */ @Export(name="pgpKey", refs={String.class}, tree="[0]") private Output pgpKey; /** * @return Either a base-64 encoded PGP public key, or a keybase username in the form `keybase:some_person_that_exists` * */ public Output> pgpKey() { return Codegen.optional(this.pgpKey); } /** * (Available since 1.98.0+) - The secret access key. Note that this will be written to the state file. * If you use this, please protect your backend state file judiciously. * Alternatively, you may supply a `pgp_key` instead, which will prevent the secret from being stored in plaintext, * at the cost of preventing the use of the secret key in automation. * */ @Export(name="secret", refs={String.class}, tree="[0]") private Output secret; /** * @return (Available since 1.98.0+) - The secret access key. Note that this will be written to the state file. * If you use this, please protect your backend state file judiciously. * Alternatively, you may supply a `pgp_key` instead, which will prevent the secret from being stored in plaintext, * at the cost of preventing the use of the secret key in automation. * */ public Output secret() { return this.secret; } /** * The name of file that can save access key id and access key secret. Strongly suggest you to specified it when you creating access key, otherwise, you wouldn't get its secret ever. * */ @Export(name="secretFile", refs={String.class}, tree="[0]") private Output secretFile; /** * @return The name of file that can save access key id and access key secret. Strongly suggest you to specified it when you creating access key, otherwise, you wouldn't get its secret ever. * */ public Output> secretFile() { return Codegen.optional(this.secretFile); } /** * Status of access key. It must be `Active` or `Inactive`. Default value is `Active`. * */ @Export(name="status", refs={String.class}, tree="[0]") private Output status; /** * @return Status of access key. It must be `Active` or `Inactive`. Default value is `Active`. * */ public Output> status() { return Codegen.optional(this.status); } /** * Name of the RAM user. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen. * */ @Export(name="userName", refs={String.class}, tree="[0]") private Output userName; /** * @return Name of the RAM user. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin with a hyphen. * */ public Output> userName() { return Codegen.optional(this.userName); } /** * * @param name The _unique_ name of the resulting resource. */ public AccessKey(java.lang.String name) { this(name, AccessKeyArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AccessKey(java.lang.String name, @Nullable AccessKeyArgs 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 AccessKey(java.lang.String name, @Nullable AccessKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ram/accessKey:AccessKey", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AccessKey(java.lang.String name, Output id, @Nullable AccessKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:ram/accessKey:AccessKey", name, state, makeResourceOptions(options, id), false); } private static AccessKeyArgs makeArgs(@Nullable AccessKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AccessKeyArgs.Empty : args; } 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()) .additionalSecretOutputs(List.of( "secret" )) .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 AccessKey get(java.lang.String name, Output id, @Nullable AccessKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AccessKey(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy