-
Notifications
You must be signed in to change notification settings - Fork 51
/
key.go
206 lines (184 loc) · 8.42 KB
/
key.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package keyvault
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a Key Vault Key.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/r/key_vault_key.html.markdown.
type Key struct {
s *pulumi.ResourceState
}
// NewKey registers a new resource with the given unique name, arguments, and options.
func NewKey(ctx *pulumi.Context,
name string, args *KeyArgs, opts ...pulumi.ResourceOpt) (*Key, error) {
if args == nil || args.KeyOpts == nil {
return nil, errors.New("missing required argument 'KeyOpts'")
}
if args == nil || args.KeyType == nil {
return nil, errors.New("missing required argument 'KeyType'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["curve"] = nil
inputs["keyOpts"] = nil
inputs["keySize"] = nil
inputs["keyType"] = nil
inputs["keyVaultId"] = nil
inputs["name"] = nil
inputs["tags"] = nil
inputs["vaultUri"] = nil
} else {
inputs["curve"] = args.Curve
inputs["keyOpts"] = args.KeyOpts
inputs["keySize"] = args.KeySize
inputs["keyType"] = args.KeyType
inputs["keyVaultId"] = args.KeyVaultId
inputs["name"] = args.Name
inputs["tags"] = args.Tags
inputs["vaultUri"] = args.VaultUri
}
inputs["e"] = nil
inputs["n"] = nil
inputs["version"] = nil
inputs["x"] = nil
inputs["y"] = nil
s, err := ctx.RegisterResource("azure:keyvault/key:Key", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &Key{s: s}, nil
}
// GetKey gets an existing Key resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetKey(ctx *pulumi.Context,
name string, id pulumi.ID, state *KeyState, opts ...pulumi.ResourceOpt) (*Key, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["curve"] = state.Curve
inputs["e"] = state.E
inputs["keyOpts"] = state.KeyOpts
inputs["keySize"] = state.KeySize
inputs["keyType"] = state.KeyType
inputs["keyVaultId"] = state.KeyVaultId
inputs["n"] = state.N
inputs["name"] = state.Name
inputs["tags"] = state.Tags
inputs["vaultUri"] = state.VaultUri
inputs["version"] = state.Version
inputs["x"] = state.X
inputs["y"] = state.Y
}
s, err := ctx.ReadResource("azure:keyvault/key:Key", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &Key{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *Key) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *Key) ID() *pulumi.IDOutput {
return r.s.ID()
}
// Specifies the curve to use when creating an `EC` key. Possible values are `P-256`, `P-384`, `P-521`, and `SECP256K1`. This field will be required in a future release if `keyType` is `EC` or `EC-HSM`. The API will default to `P-256` if nothing is specified. Changing this forces a new resource to be created.
func (r *Key) Curve() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["curve"])
}
// The RSA public exponent of this Key Vault Key.
func (r *Key) E() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["e"])
}
// A list of JSON web key operations. Possible values include: `decrypt`, `encrypt`, `sign`, `unwrapKey`, `verify` and `wrapKey`. Please note these values are case sensitive.
func (r *Key) KeyOpts() *pulumi.ArrayOutput {
return (*pulumi.ArrayOutput)(r.s.State["keyOpts"])
}
// Specifies the Size of the RSA key to create in bytes. For example, 1024 or 2048. *Note*: This field is required if `keyType` is `RSA` or `RSA-HSM`. Changing this forces a new resource to be created.
func (r *Key) KeySize() *pulumi.IntOutput {
return (*pulumi.IntOutput)(r.s.State["keySize"])
}
// Specifies the Key Type to use for this Key Vault Key. Possible values are `EC` (Elliptic Curve), `EC-HSM`, `Oct` (Octet), `RSA` and `RSA-HSM`. Changing this forces a new resource to be created.
func (r *Key) KeyType() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["keyType"])
}
// The ID of the Key Vault where the Key should be created. Changing this forces a new resource to be created.
func (r *Key) KeyVaultId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["keyVaultId"])
}
// The RSA modulus of this Key Vault Key.
func (r *Key) N() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["n"])
}
// Specifies the name of the Key Vault Key. Changing this forces a new resource to be created.
func (r *Key) Name() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["name"])
}
// A mapping of tags to assign to the resource.
func (r *Key) Tags() *pulumi.MapOutput {
return (*pulumi.MapOutput)(r.s.State["tags"])
}
func (r *Key) VaultUri() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["vaultUri"])
}
// The current version of the Key Vault Key.
func (r *Key) Version() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["version"])
}
// The EC X component of this Key Vault Key.
func (r *Key) X() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["x"])
}
// The EC Y component of this Key Vault Key.
func (r *Key) Y() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["y"])
}
// Input properties used for looking up and filtering Key resources.
type KeyState struct {
// Specifies the curve to use when creating an `EC` key. Possible values are `P-256`, `P-384`, `P-521`, and `SECP256K1`. This field will be required in a future release if `keyType` is `EC` or `EC-HSM`. The API will default to `P-256` if nothing is specified. Changing this forces a new resource to be created.
Curve interface{}
// The RSA public exponent of this Key Vault Key.
E interface{}
// A list of JSON web key operations. Possible values include: `decrypt`, `encrypt`, `sign`, `unwrapKey`, `verify` and `wrapKey`. Please note these values are case sensitive.
KeyOpts interface{}
// Specifies the Size of the RSA key to create in bytes. For example, 1024 or 2048. *Note*: This field is required if `keyType` is `RSA` or `RSA-HSM`. Changing this forces a new resource to be created.
KeySize interface{}
// Specifies the Key Type to use for this Key Vault Key. Possible values are `EC` (Elliptic Curve), `EC-HSM`, `Oct` (Octet), `RSA` and `RSA-HSM`. Changing this forces a new resource to be created.
KeyType interface{}
// The ID of the Key Vault where the Key should be created. Changing this forces a new resource to be created.
KeyVaultId interface{}
// The RSA modulus of this Key Vault Key.
N interface{}
// Specifies the name of the Key Vault Key. Changing this forces a new resource to be created.
Name interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
VaultUri interface{}
// The current version of the Key Vault Key.
Version interface{}
// The EC X component of this Key Vault Key.
X interface{}
// The EC Y component of this Key Vault Key.
Y interface{}
}
// The set of arguments for constructing a Key resource.
type KeyArgs struct {
// Specifies the curve to use when creating an `EC` key. Possible values are `P-256`, `P-384`, `P-521`, and `SECP256K1`. This field will be required in a future release if `keyType` is `EC` or `EC-HSM`. The API will default to `P-256` if nothing is specified. Changing this forces a new resource to be created.
Curve interface{}
// A list of JSON web key operations. Possible values include: `decrypt`, `encrypt`, `sign`, `unwrapKey`, `verify` and `wrapKey`. Please note these values are case sensitive.
KeyOpts interface{}
// Specifies the Size of the RSA key to create in bytes. For example, 1024 or 2048. *Note*: This field is required if `keyType` is `RSA` or `RSA-HSM`. Changing this forces a new resource to be created.
KeySize interface{}
// Specifies the Key Type to use for this Key Vault Key. Possible values are `EC` (Elliptic Curve), `EC-HSM`, `Oct` (Octet), `RSA` and `RSA-HSM`. Changing this forces a new resource to be created.
KeyType interface{}
// The ID of the Key Vault where the Key should be created. Changing this forces a new resource to be created.
KeyVaultId interface{}
// Specifies the name of the Key Vault Key. Changing this forces a new resource to be created.
Name interface{}
// A mapping of tags to assign to the resource.
Tags interface{}
VaultUri interface{}
}