generated from pulumi/pulumi-tf-provider-boilerplate
/
getDataKey.go
170 lines (149 loc) · 6.25 KB
/
getDataKey.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dew
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to get the plaintext and the ciphertext of an available HuaweiCloud KMS DEK (data encryption key).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Dew"
// "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Dew"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// key1, err := Dew.NewKey(ctx, "key1", &Dew.KeyArgs{
// KeyAlias: pulumi.String("key_1"),
// PendingDays: pulumi.String("7"),
// KeyDescription: pulumi.String("first test key"),
// })
// if err != nil {
// return err
// }
// _ = Dew.GetDataKeyOutput(ctx, dew.GetDataKeyOutputArgs{
// KeyId: key1.ID(),
// DatakeyLength: pulumi.String("512"),
// }, nil)
// return nil
// })
// }
//
// ```
func GetDataKey(ctx *pulumi.Context, args *GetDataKeyArgs, opts ...pulumi.InvokeOption) (*GetDataKeyResult, error) {
opts = pkgInvokeDefaultOpts(opts)
var rv GetDataKeyResult
err := ctx.Invoke("huaweicloud:Dew/getDataKey:getDataKey", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getDataKey.
type GetDataKeyArgs struct {
// Number of bits in the length of a DEK (data encryption keys). The maximum number
// is 512. Changing this gets the new data encryption key.
DatakeyLength string `pulumi:"datakeyLength"`
// The value of this parameter must be a series of
// "key:value" pairs used to record resource context information. The value of this parameter must not contain sensitive
// information and must be within 8192 characters in length. Example: {"Key1":"Value1","Key2":"Value2"}
EncryptionContext *string `pulumi:"encryptionContext"`
// The globally unique identifier for the key. Changing this gets the new data encryption
// key.
KeyId string `pulumi:"keyId"`
// The region in which to obtain the keys. If omitted, the provider-level region will be
// used.
Region *string `pulumi:"region"`
}
// A collection of values returned by getDataKey.
type GetDataKeyResult struct {
// The ciphertext of a DEK is expressed in hexadecimal format, and two characters indicate one byte.
CipherText string `pulumi:"cipherText"`
DatakeyLength string `pulumi:"datakeyLength"`
EncryptionContext *string `pulumi:"encryptionContext"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
KeyId string `pulumi:"keyId"`
// The plaintext of a DEK is expressed in hexadecimal format, and two characters indicate one byte.
PlainText string `pulumi:"plainText"`
Region string `pulumi:"region"`
}
func GetDataKeyOutput(ctx *pulumi.Context, args GetDataKeyOutputArgs, opts ...pulumi.InvokeOption) GetDataKeyResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetDataKeyResult, error) {
args := v.(GetDataKeyArgs)
r, err := GetDataKey(ctx, &args, opts...)
var s GetDataKeyResult
if r != nil {
s = *r
}
return s, err
}).(GetDataKeyResultOutput)
}
// A collection of arguments for invoking getDataKey.
type GetDataKeyOutputArgs struct {
// Number of bits in the length of a DEK (data encryption keys). The maximum number
// is 512. Changing this gets the new data encryption key.
DatakeyLength pulumi.StringInput `pulumi:"datakeyLength"`
// The value of this parameter must be a series of
// "key:value" pairs used to record resource context information. The value of this parameter must not contain sensitive
// information and must be within 8192 characters in length. Example: {"Key1":"Value1","Key2":"Value2"}
EncryptionContext pulumi.StringPtrInput `pulumi:"encryptionContext"`
// The globally unique identifier for the key. Changing this gets the new data encryption
// key.
KeyId pulumi.StringInput `pulumi:"keyId"`
// The region in which to obtain the keys. If omitted, the provider-level region will be
// used.
Region pulumi.StringPtrInput `pulumi:"region"`
}
func (GetDataKeyOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetDataKeyArgs)(nil)).Elem()
}
// A collection of values returned by getDataKey.
type GetDataKeyResultOutput struct{ *pulumi.OutputState }
func (GetDataKeyResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetDataKeyResult)(nil)).Elem()
}
func (o GetDataKeyResultOutput) ToGetDataKeyResultOutput() GetDataKeyResultOutput {
return o
}
func (o GetDataKeyResultOutput) ToGetDataKeyResultOutputWithContext(ctx context.Context) GetDataKeyResultOutput {
return o
}
// The ciphertext of a DEK is expressed in hexadecimal format, and two characters indicate one byte.
func (o GetDataKeyResultOutput) CipherText() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.CipherText }).(pulumi.StringOutput)
}
func (o GetDataKeyResultOutput) DatakeyLength() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.DatakeyLength }).(pulumi.StringOutput)
}
func (o GetDataKeyResultOutput) EncryptionContext() pulumi.StringPtrOutput {
return o.ApplyT(func(v GetDataKeyResult) *string { return v.EncryptionContext }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o GetDataKeyResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetDataKeyResultOutput) KeyId() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.KeyId }).(pulumi.StringOutput)
}
// The plaintext of a DEK is expressed in hexadecimal format, and two characters indicate one byte.
func (o GetDataKeyResultOutput) PlainText() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.PlainText }).(pulumi.StringOutput)
}
func (o GetDataKeyResultOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v GetDataKeyResult) string { return v.Region }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(GetDataKeyResultOutput{})
}