generated from pulumi/pulumi-tf-provider-boilerplate
/
sshkey.go
354 lines (300 loc) · 10.8 KB
/
sshkey.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
// 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 iam
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/raeumlich/pulumi-scaleway/sdk/go/scaleway/internal"
)
// Creates and manages Scaleway IAM SSH Keys.
// For more information,
// see [the documentation](https://developers.scaleway.com/en/products/iam/api/v1alpha1/#ssh-keys-d8ccd4).
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/raeumlich/pulumi-scaleway/sdk/go/scaleway/iam"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := iam.NewSSHKey(ctx, "main", &iam.SSHKeyArgs{
// PublicKey: pulumi.String("<YOUR-PUBLIC-SSH-KEY>"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// SSH keys can be imported using the `id`, e.g.
//
// bash
//
// ```sh
// $ pulumi import scaleway:iam/sSHKey:SSHKey main 11111111-1111-1111-1111-111111111111
// ```
type SSHKey struct {
pulumi.CustomResourceState
// The date and time of the creation of the SSH key.
CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
// The SSH key status.
Disabled pulumi.BoolPtrOutput `pulumi:"disabled"`
// The fingerprint of the iam SSH key.
Fingerprint pulumi.StringOutput `pulumi:"fingerprint"`
// The name of the SSH key.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the organization the SSH key is associated with.
OrganizationId pulumi.StringOutput `pulumi:"organizationId"`
// `projectId`) The ID of the project the SSH key is
// associated with.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// The public SSH key to be added.
PublicKey pulumi.StringOutput `pulumi:"publicKey"`
// The date and time of the last update of the SSH key.
UpdatedAt pulumi.StringOutput `pulumi:"updatedAt"`
}
// NewSSHKey registers a new resource with the given unique name, arguments, and options.
func NewSSHKey(ctx *pulumi.Context,
name string, args *SSHKeyArgs, opts ...pulumi.ResourceOption) (*SSHKey, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.PublicKey == nil {
return nil, errors.New("invalid value for required argument 'PublicKey'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource SSHKey
err := ctx.RegisterResource("scaleway:iam/sSHKey:SSHKey", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSSHKey gets an existing SSHKey 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 GetSSHKey(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SSHKeyState, opts ...pulumi.ResourceOption) (*SSHKey, error) {
var resource SSHKey
err := ctx.ReadResource("scaleway:iam/sSHKey:SSHKey", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SSHKey resources.
type sshkeyState struct {
// The date and time of the creation of the SSH key.
CreatedAt *string `pulumi:"createdAt"`
// The SSH key status.
Disabled *bool `pulumi:"disabled"`
// The fingerprint of the iam SSH key.
Fingerprint *string `pulumi:"fingerprint"`
// The name of the SSH key.
Name *string `pulumi:"name"`
// The ID of the organization the SSH key is associated with.
OrganizationId *string `pulumi:"organizationId"`
// `projectId`) The ID of the project the SSH key is
// associated with.
ProjectId *string `pulumi:"projectId"`
// The public SSH key to be added.
PublicKey *string `pulumi:"publicKey"`
// The date and time of the last update of the SSH key.
UpdatedAt *string `pulumi:"updatedAt"`
}
type SSHKeyState struct {
// The date and time of the creation of the SSH key.
CreatedAt pulumi.StringPtrInput
// The SSH key status.
Disabled pulumi.BoolPtrInput
// The fingerprint of the iam SSH key.
Fingerprint pulumi.StringPtrInput
// The name of the SSH key.
Name pulumi.StringPtrInput
// The ID of the organization the SSH key is associated with.
OrganizationId pulumi.StringPtrInput
// `projectId`) The ID of the project the SSH key is
// associated with.
ProjectId pulumi.StringPtrInput
// The public SSH key to be added.
PublicKey pulumi.StringPtrInput
// The date and time of the last update of the SSH key.
UpdatedAt pulumi.StringPtrInput
}
func (SSHKeyState) ElementType() reflect.Type {
return reflect.TypeOf((*sshkeyState)(nil)).Elem()
}
type sshkeyArgs struct {
// The SSH key status.
Disabled *bool `pulumi:"disabled"`
// The name of the SSH key.
Name *string `pulumi:"name"`
// `projectId`) The ID of the project the SSH key is
// associated with.
ProjectId *string `pulumi:"projectId"`
// The public SSH key to be added.
PublicKey string `pulumi:"publicKey"`
}
// The set of arguments for constructing a SSHKey resource.
type SSHKeyArgs struct {
// The SSH key status.
Disabled pulumi.BoolPtrInput
// The name of the SSH key.
Name pulumi.StringPtrInput
// `projectId`) The ID of the project the SSH key is
// associated with.
ProjectId pulumi.StringPtrInput
// The public SSH key to be added.
PublicKey pulumi.StringInput
}
func (SSHKeyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*sshkeyArgs)(nil)).Elem()
}
type SSHKeyInput interface {
pulumi.Input
ToSSHKeyOutput() SSHKeyOutput
ToSSHKeyOutputWithContext(ctx context.Context) SSHKeyOutput
}
func (*SSHKey) ElementType() reflect.Type {
return reflect.TypeOf((**SSHKey)(nil)).Elem()
}
func (i *SSHKey) ToSSHKeyOutput() SSHKeyOutput {
return i.ToSSHKeyOutputWithContext(context.Background())
}
func (i *SSHKey) ToSSHKeyOutputWithContext(ctx context.Context) SSHKeyOutput {
return pulumi.ToOutputWithContext(ctx, i).(SSHKeyOutput)
}
// SSHKeyArrayInput is an input type that accepts SSHKeyArray and SSHKeyArrayOutput values.
// You can construct a concrete instance of `SSHKeyArrayInput` via:
//
// SSHKeyArray{ SSHKeyArgs{...} }
type SSHKeyArrayInput interface {
pulumi.Input
ToSSHKeyArrayOutput() SSHKeyArrayOutput
ToSSHKeyArrayOutputWithContext(context.Context) SSHKeyArrayOutput
}
type SSHKeyArray []SSHKeyInput
func (SSHKeyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SSHKey)(nil)).Elem()
}
func (i SSHKeyArray) ToSSHKeyArrayOutput() SSHKeyArrayOutput {
return i.ToSSHKeyArrayOutputWithContext(context.Background())
}
func (i SSHKeyArray) ToSSHKeyArrayOutputWithContext(ctx context.Context) SSHKeyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SSHKeyArrayOutput)
}
// SSHKeyMapInput is an input type that accepts SSHKeyMap and SSHKeyMapOutput values.
// You can construct a concrete instance of `SSHKeyMapInput` via:
//
// SSHKeyMap{ "key": SSHKeyArgs{...} }
type SSHKeyMapInput interface {
pulumi.Input
ToSSHKeyMapOutput() SSHKeyMapOutput
ToSSHKeyMapOutputWithContext(context.Context) SSHKeyMapOutput
}
type SSHKeyMap map[string]SSHKeyInput
func (SSHKeyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SSHKey)(nil)).Elem()
}
func (i SSHKeyMap) ToSSHKeyMapOutput() SSHKeyMapOutput {
return i.ToSSHKeyMapOutputWithContext(context.Background())
}
func (i SSHKeyMap) ToSSHKeyMapOutputWithContext(ctx context.Context) SSHKeyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SSHKeyMapOutput)
}
type SSHKeyOutput struct{ *pulumi.OutputState }
func (SSHKeyOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SSHKey)(nil)).Elem()
}
func (o SSHKeyOutput) ToSSHKeyOutput() SSHKeyOutput {
return o
}
func (o SSHKeyOutput) ToSSHKeyOutputWithContext(ctx context.Context) SSHKeyOutput {
return o
}
// The date and time of the creation of the SSH key.
func (o SSHKeyOutput) CreatedAt() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
}
// The SSH key status.
func (o SSHKeyOutput) Disabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *SSHKey) pulumi.BoolPtrOutput { return v.Disabled }).(pulumi.BoolPtrOutput)
}
// The fingerprint of the iam SSH key.
func (o SSHKeyOutput) Fingerprint() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.Fingerprint }).(pulumi.StringOutput)
}
// The name of the SSH key.
func (o SSHKeyOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the organization the SSH key is associated with.
func (o SSHKeyOutput) OrganizationId() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.OrganizationId }).(pulumi.StringOutput)
}
// `projectId`) The ID of the project the SSH key is
// associated with.
func (o SSHKeyOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// The public SSH key to be added.
func (o SSHKeyOutput) PublicKey() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.PublicKey }).(pulumi.StringOutput)
}
// The date and time of the last update of the SSH key.
func (o SSHKeyOutput) UpdatedAt() pulumi.StringOutput {
return o.ApplyT(func(v *SSHKey) pulumi.StringOutput { return v.UpdatedAt }).(pulumi.StringOutput)
}
type SSHKeyArrayOutput struct{ *pulumi.OutputState }
func (SSHKeyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SSHKey)(nil)).Elem()
}
func (o SSHKeyArrayOutput) ToSSHKeyArrayOutput() SSHKeyArrayOutput {
return o
}
func (o SSHKeyArrayOutput) ToSSHKeyArrayOutputWithContext(ctx context.Context) SSHKeyArrayOutput {
return o
}
func (o SSHKeyArrayOutput) Index(i pulumi.IntInput) SSHKeyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SSHKey {
return vs[0].([]*SSHKey)[vs[1].(int)]
}).(SSHKeyOutput)
}
type SSHKeyMapOutput struct{ *pulumi.OutputState }
func (SSHKeyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SSHKey)(nil)).Elem()
}
func (o SSHKeyMapOutput) ToSSHKeyMapOutput() SSHKeyMapOutput {
return o
}
func (o SSHKeyMapOutput) ToSSHKeyMapOutputWithContext(ctx context.Context) SSHKeyMapOutput {
return o
}
func (o SSHKeyMapOutput) MapIndex(k pulumi.StringInput) SSHKeyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SSHKey {
return vs[0].(map[string]*SSHKey)[vs[1].(string)]
}).(SSHKeyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SSHKeyInput)(nil)).Elem(), &SSHKey{})
pulumi.RegisterInputType(reflect.TypeOf((*SSHKeyArrayInput)(nil)).Elem(), SSHKeyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SSHKeyMapInput)(nil)).Elem(), SSHKeyMap{})
pulumi.RegisterOutputType(SSHKeyOutput{})
pulumi.RegisterOutputType(SSHKeyArrayOutput{})
pulumi.RegisterOutputType(SSHKeyMapOutput{})
}