1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. Ciphertext
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.kms.Ciphertext

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const key = new alicloud.kms.Key("key", {
        description: "example key",
        status: "Enabled",
        pendingWindowInDays: 7,
    });
    const encrypted = new alicloud.kms.Ciphertext("encrypted", {
        keyId: key.id,
        plaintext: "example",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    key = alicloud.kms.Key("key",
        description="example key",
        status="Enabled",
        pending_window_in_days=7)
    encrypted = alicloud.kms.Ciphertext("encrypted",
        key_id=key.id,
        plaintext="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		key, err := kms.NewKey(ctx, "key", &kms.KeyArgs{
    			Description:         pulumi.String("example key"),
    			Status:              pulumi.String("Enabled"),
    			PendingWindowInDays: pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kms.NewCiphertext(ctx, "encrypted", &kms.CiphertextArgs{
    			KeyId:     key.ID(),
    			Plaintext: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var key = new AliCloud.Kms.Key("key", new()
        {
            Description = "example key",
            Status = "Enabled",
            PendingWindowInDays = 7,
        });
    
        var encrypted = new AliCloud.Kms.Ciphertext("encrypted", new()
        {
            KeyId = key.Id,
            Plaintext = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.kms.Key;
    import com.pulumi.alicloud.kms.KeyArgs;
    import com.pulumi.alicloud.kms.Ciphertext;
    import com.pulumi.alicloud.kms.CiphertextArgs;
    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 key = new Key("key", KeyArgs.builder()        
                .description("example key")
                .status("Enabled")
                .pendingWindowInDays(7)
                .build());
    
            var encrypted = new Ciphertext("encrypted", CiphertextArgs.builder()        
                .keyId(key.id())
                .plaintext("example")
                .build());
    
        }
    }
    
    resources:
      key:
        type: alicloud:kms:Key
        properties:
          description: example key
          status: Enabled
          pendingWindowInDays: 7
      encrypted:
        type: alicloud:kms:Ciphertext
        properties:
          keyId: ${key.id}
          plaintext: example
    

    Create Ciphertext Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Ciphertext(name: string, args: CiphertextArgs, opts?: CustomResourceOptions);
    @overload
    def Ciphertext(resource_name: str,
                   args: CiphertextArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Ciphertext(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   key_id: Optional[str] = None,
                   plaintext: Optional[str] = None,
                   encryption_context: Optional[Mapping[str, str]] = None)
    func NewCiphertext(ctx *Context, name string, args CiphertextArgs, opts ...ResourceOption) (*Ciphertext, error)
    public Ciphertext(string name, CiphertextArgs args, CustomResourceOptions? opts = null)
    public Ciphertext(String name, CiphertextArgs args)
    public Ciphertext(String name, CiphertextArgs args, CustomResourceOptions options)
    
    type: alicloud:kms:Ciphertext
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args CiphertextArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args CiphertextArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args CiphertextArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CiphertextArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CiphertextArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var ciphertextResource = new AliCloud.Kms.Ciphertext("ciphertextResource", new()
    {
        KeyId = "string",
        Plaintext = "string",
        EncryptionContext = 
        {
            { "string", "string" },
        },
    });
    
    example, err := kms.NewCiphertext(ctx, "ciphertextResource", &kms.CiphertextArgs{
    	KeyId:     pulumi.String("string"),
    	Plaintext: pulumi.String("string"),
    	EncryptionContext: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var ciphertextResource = new Ciphertext("ciphertextResource", CiphertextArgs.builder()        
        .keyId("string")
        .plaintext("string")
        .encryptionContext(Map.of("string", "string"))
        .build());
    
    ciphertext_resource = alicloud.kms.Ciphertext("ciphertextResource",
        key_id="string",
        plaintext="string",
        encryption_context={
            "string": "string",
        })
    
    const ciphertextResource = new alicloud.kms.Ciphertext("ciphertextResource", {
        keyId: "string",
        plaintext: "string",
        encryptionContext: {
            string: "string",
        },
    });
    
    type: alicloud:kms:Ciphertext
    properties:
        encryptionContext:
            string: string
        keyId: string
        plaintext: string
    

    Ciphertext Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Ciphertext resource accepts the following input properties:

    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    EncryptionContext Dictionary<string, string>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    EncryptionContext map[string]string
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext Map<String,String>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId string
    The globally unique ID of the CMK.
    plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext {[key: string]: string}
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    key_id str
    The globally unique ID of the CMK.
    plaintext str
    The plaintext to be encrypted which must be encoded in Base64.
    encryption_context Mapping[str, str]
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.
    encryptionContext Map<String>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Ciphertext resource produces the following output properties:

    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    Id string
    The provider-assigned unique ID for this managed resource.
    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    Id string
    The provider-assigned unique ID for this managed resource.
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    id String
    The provider-assigned unique ID for this managed resource.
    ciphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    id string
    The provider-assigned unique ID for this managed resource.
    ciphertext_blob str
    The ciphertext of the data key encrypted with the primary CMK version.
    id str
    The provider-assigned unique ID for this managed resource.
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Ciphertext Resource

    Get an existing Ciphertext resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: CiphertextState, opts?: CustomResourceOptions): Ciphertext
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            ciphertext_blob: Optional[str] = None,
            encryption_context: Optional[Mapping[str, str]] = None,
            key_id: Optional[str] = None,
            plaintext: Optional[str] = None) -> Ciphertext
    func GetCiphertext(ctx *Context, name string, id IDInput, state *CiphertextState, opts ...ResourceOption) (*Ciphertext, error)
    public static Ciphertext Get(string name, Input<string> id, CiphertextState? state, CustomResourceOptions? opts = null)
    public static Ciphertext get(String name, Output<String> id, CiphertextState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    EncryptionContext Dictionary<string, string>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    CiphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    EncryptionContext map[string]string
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    KeyId string
    The globally unique ID of the CMK.
    Plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    encryptionContext Map<String,String>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.
    ciphertextBlob string
    The ciphertext of the data key encrypted with the primary CMK version.
    encryptionContext {[key: string]: string}
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId string
    The globally unique ID of the CMK.
    plaintext string
    The plaintext to be encrypted which must be encoded in Base64.
    ciphertext_blob str
    The ciphertext of the data key encrypted with the primary CMK version.
    encryption_context Mapping[str, str]
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    key_id str
    The globally unique ID of the CMK.
    plaintext str
    The plaintext to be encrypted which must be encoded in Base64.
    ciphertextBlob String
    The ciphertext of the data key encrypted with the primary CMK version.
    encryptionContext Map<String>
    The Encryption context. If you specify this parameter here, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.
    keyId String
    The globally unique ID of the CMK.
    plaintext String
    The plaintext to be encrypted which must be encoded in Base64.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi