Package com.pulumi.random
Class RandomBytes
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.random.RandomBytes
-
public class RandomBytes extends com.pulumi.resources.CustomResourceThe resource `random.RandomBytes` generates random bytes that are intended to be used as a secret, or key. Use this in preference to `random.RandomId` when the output is considered sensitive, and should not be displayed in the CLI. ## Example Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.random.RandomBytes; import com.pulumi.random.RandomBytesArgs; import com.pulumi.azure.keyvault.Secret; import com.pulumi.azure.keyvault.SecretArgs; 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 jwtSecretRandomBytes = new RandomBytes("jwtSecretRandomBytes", RandomBytesArgs.builder() .length(64) .build()); var jwtSecretSecret = new Secret("jwtSecretSecret", SecretArgs.builder() .keyVaultId("some-azure-key-vault-id") .value(jwtSecretRandomBytes.base64()) .build()); } } ``` ## Import Random bytes can be imported by specifying the value as base64 string. ```sh $ pulumi import random:index/randomBytes:RandomBytes basic "8/fu3q+2DcgSJ19i0jZ5Cw==" ```
-
-
Constructor Summary
Constructors Constructor Description RandomBytes(java.lang.String name)RandomBytes(java.lang.String name, RandomBytesArgs args)RandomBytes(java.lang.String name, RandomBytesArgs 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>base64()static RandomBytesget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, RandomBytesState 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>hex()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>keepers()com.pulumi.core.Output<java.lang.Integer>length()
-
-
-
Constructor Detail
-
RandomBytes
public RandomBytes(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
RandomBytes
public RandomBytes(java.lang.String name, RandomBytesArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
RandomBytes
public RandomBytes(java.lang.String name, RandomBytesArgs 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
-
base64
public com.pulumi.core.Output<java.lang.String> base64()
- Returns:
- The generated bytes presented in base64 string format.
-
hex
public com.pulumi.core.Output<java.lang.String> hex()
- Returns:
- The generated bytes presented in hex string format.
-
keepers
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> keepers()
- Returns:
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
-
length
public com.pulumi.core.Output<java.lang.Integer> length()
- Returns:
- The number of bytes requested. The minimum value for length is 1.
-
get
public static RandomBytes get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable RandomBytesState 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.
-
-