Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.19.0 published on Friday, Mar 18, 2022 by Pulumi

getPlaintext

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var key = new AliCloud.Kms.Key("key", new AliCloud.Kms.KeyArgs
        {
            Description = "example key",
            IsEnabled = true,
        });
        // Encrypt plaintext 'example'
        var encrypted = new AliCloud.Kms.Ciphertext("encrypted", new AliCloud.Kms.CiphertextArgs
        {
            KeyId = key.Id,
            Plaintext = "example",
        });
        var plaintext = AliCloud.Kms.GetPlaintext.Invoke(new AliCloud.Kms.GetPlaintextInvokeArgs
        {
            CiphertextBlob = encrypted.CiphertextBlob,
        });
        this.Decrypted = plaintext.Apply(plaintext => plaintext.Plaintext);
    }

    [Output("decrypted")]
    public Output<string> Decrypted { get; set; }
}
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"),
			IsEnabled:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		encrypted, err := kms.NewCiphertext(ctx, "encrypted", &kms.CiphertextArgs{
			KeyId:     key.ID(),
			Plaintext: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		plaintext := kms.GetPlaintextOutput(ctx, kms.GetPlaintextOutputArgs{
			CiphertextBlob: encrypted.CiphertextBlob,
		}, nil)
		ctx.Export("decrypted", plaintext.ApplyT(func(plaintext kms.GetPlaintextResult) (string, error) {
			return plaintext.Plaintext, nil
		}).(pulumi.StringOutput))
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

key = alicloud.kms.Key("key",
    description="example key",
    is_enabled=True)
# Encrypt plaintext 'example'
encrypted = alicloud.kms.Ciphertext("encrypted",
    key_id=key.id,
    plaintext="example")
plaintext = alicloud.kms.get_plaintext_output(ciphertext_blob=encrypted.ciphertext_blob)
pulumi.export("decrypted", plaintext.plaintext)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const key = new alicloud.kms.Key("key", {
    description: "example key",
    isEnabled: true,
});
// Encrypt plaintext 'example'
const encrypted = new alicloud.kms.Ciphertext("encrypted", {
    keyId: key.id,
    plaintext: "example",
});
const plaintext = alicloud.kms.getPlaintextOutput({
    ciphertextBlob: encrypted.ciphertextBlob,
});
export const decrypted = plaintext.apply(plaintext => plaintext.plaintext);

Coming soon!

Using getPlaintext

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getPlaintext(args: GetPlaintextArgs, opts?: InvokeOptions): Promise<GetPlaintextResult>
function getPlaintextOutput(args: GetPlaintextOutputArgs, opts?: InvokeOptions): Output<GetPlaintextResult>
def get_plaintext(ciphertext_blob: Optional[str] = None,
                  encryption_context: Optional[Mapping[str, str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetPlaintextResult
def get_plaintext_output(ciphertext_blob: Optional[pulumi.Input[str]] = None,
                  encryption_context: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetPlaintextResult]
func GetPlaintext(ctx *Context, args *GetPlaintextArgs, opts ...InvokeOption) (*GetPlaintextResult, error)
func GetPlaintextOutput(ctx *Context, args *GetPlaintextOutputArgs, opts ...InvokeOption) GetPlaintextResultOutput

> Note: This function is named GetPlaintext in the Go SDK.

public static class GetPlaintext 
{
    public static Task<GetPlaintextResult> InvokeAsync(GetPlaintextArgs args, InvokeOptions? opts = null)
    public static Output<GetPlaintextResult> Invoke(GetPlaintextInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPlaintextResult> getPlaintext(GetPlaintextArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:kms/getPlaintext:getPlaintext
  Arguments:
    # Arguments dictionary

The following arguments are supported:

CiphertextBlob string

The ciphertext to be decrypted.

EncryptionContext Dictionary<string, string>

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

CiphertextBlob string

The ciphertext to be decrypted.

EncryptionContext map[string]string

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

ciphertextBlob String

The ciphertext to be decrypted.

encryptionContext Map<String,String>

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

ciphertextBlob string

The ciphertext to be decrypted.

encryptionContext {[key: string]: string}

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

ciphertext_blob str

The ciphertext to be decrypted.

encryption_context Mapping[str, str]

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

ciphertextBlob String

The ciphertext to be decrypted.

encryptionContext Map<String>

(Optional) The Encryption context. If you specify this parameter in the Encrypt or GenerateDataKey API operation, it is also required when you call the Decrypt API operation. For more information, see Encryption Context.

getPlaintext Result

The following output properties are available:

CiphertextBlob string
Id string

The provider-assigned unique ID for this managed resource.

KeyId string

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

Plaintext string

The decrypted plaintext.

EncryptionContext Dictionary<string, string>
CiphertextBlob string
Id string

The provider-assigned unique ID for this managed resource.

KeyId string

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

Plaintext string

The decrypted plaintext.

EncryptionContext map[string]string
ciphertextBlob String
id String

The provider-assigned unique ID for this managed resource.

keyId String

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

plaintext String

The decrypted plaintext.

encryptionContext Map<String,String>
ciphertextBlob string
id string

The provider-assigned unique ID for this managed resource.

keyId string

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

plaintext string

The decrypted plaintext.

encryptionContext {[key: string]: string}
ciphertext_blob str
id str

The provider-assigned unique ID for this managed resource.

key_id str

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

plaintext str

The decrypted plaintext.

encryption_context Mapping[str, str]
ciphertextBlob String
id String

The provider-assigned unique ID for this managed resource.

keyId String

The globally unique ID of the CMK. It is the ID of the CMK used to decrypt ciphertext.

plaintext String

The decrypted plaintext.

encryptionContext Map<String>

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.