generated from pulumi/pulumi-tf-provider-boilerplate
/
cockpitGrafanaUser.go
302 lines (252 loc) · 10.9 KB
/
cockpitGrafanaUser.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
// 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 scaleway
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates and manages Scaleway Cockpit Grafana Users.
//
// For more information consult the [documentation](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#grafana-users).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/luxifer/pulumi-scaleway/sdk/go/scaleway"
// "github.com/pulumi/pulumi-scaleway/sdk/go/scaleway"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// mainCockpit, err := scaleway.LookupCockpit(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = scaleway.NewCockpitGrafanaUser(ctx, "mainCockpitGrafanaUser", &scaleway.CockpitGrafanaUserArgs{
// ProjectId: pulumi.String(mainCockpit.ProjectId),
// Login: pulumi.String("my-awesome-user"),
// Role: pulumi.String("editor"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Cockpits Grafana Users can be imported using the project ID and the grafana user ID formatted `{project_id}/{grafana_user_id}`, e.g. bash
//
// ```sh
// $ pulumi import scaleway:index/cockpitGrafanaUser:CockpitGrafanaUser main 11111111-1111-1111-1111-111111111111/2
// ```
type CockpitGrafanaUser struct {
pulumi.CustomResourceState
// The login of the grafana user.
Login pulumi.StringOutput `pulumi:"login"`
// The password of the grafana user
Password pulumi.StringOutput `pulumi:"password"`
// `projectId`) The ID of the project the cockpit is associated with.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// The role of the grafana user. Must be `editor` or `viewer`.
Role pulumi.StringOutput `pulumi:"role"`
}
// NewCockpitGrafanaUser registers a new resource with the given unique name, arguments, and options.
func NewCockpitGrafanaUser(ctx *pulumi.Context,
name string, args *CockpitGrafanaUserArgs, opts ...pulumi.ResourceOption) (*CockpitGrafanaUser, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Login == nil {
return nil, errors.New("invalid value for required argument 'Login'")
}
if args.Role == nil {
return nil, errors.New("invalid value for required argument 'Role'")
}
opts = pkgResourceDefaultOpts(opts)
var resource CockpitGrafanaUser
err := ctx.RegisterResource("scaleway:index/cockpitGrafanaUser:CockpitGrafanaUser", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCockpitGrafanaUser gets an existing CockpitGrafanaUser 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 GetCockpitGrafanaUser(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CockpitGrafanaUserState, opts ...pulumi.ResourceOption) (*CockpitGrafanaUser, error) {
var resource CockpitGrafanaUser
err := ctx.ReadResource("scaleway:index/cockpitGrafanaUser:CockpitGrafanaUser", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CockpitGrafanaUser resources.
type cockpitGrafanaUserState struct {
// The login of the grafana user.
Login *string `pulumi:"login"`
// The password of the grafana user
Password *string `pulumi:"password"`
// `projectId`) The ID of the project the cockpit is associated with.
ProjectId *string `pulumi:"projectId"`
// The role of the grafana user. Must be `editor` or `viewer`.
Role *string `pulumi:"role"`
}
type CockpitGrafanaUserState struct {
// The login of the grafana user.
Login pulumi.StringPtrInput
// The password of the grafana user
Password pulumi.StringPtrInput
// `projectId`) The ID of the project the cockpit is associated with.
ProjectId pulumi.StringPtrInput
// The role of the grafana user. Must be `editor` or `viewer`.
Role pulumi.StringPtrInput
}
func (CockpitGrafanaUserState) ElementType() reflect.Type {
return reflect.TypeOf((*cockpitGrafanaUserState)(nil)).Elem()
}
type cockpitGrafanaUserArgs struct {
// The login of the grafana user.
Login string `pulumi:"login"`
// `projectId`) The ID of the project the cockpit is associated with.
ProjectId *string `pulumi:"projectId"`
// The role of the grafana user. Must be `editor` or `viewer`.
Role string `pulumi:"role"`
}
// The set of arguments for constructing a CockpitGrafanaUser resource.
type CockpitGrafanaUserArgs struct {
// The login of the grafana user.
Login pulumi.StringInput
// `projectId`) The ID of the project the cockpit is associated with.
ProjectId pulumi.StringPtrInput
// The role of the grafana user. Must be `editor` or `viewer`.
Role pulumi.StringInput
}
func (CockpitGrafanaUserArgs) ElementType() reflect.Type {
return reflect.TypeOf((*cockpitGrafanaUserArgs)(nil)).Elem()
}
type CockpitGrafanaUserInput interface {
pulumi.Input
ToCockpitGrafanaUserOutput() CockpitGrafanaUserOutput
ToCockpitGrafanaUserOutputWithContext(ctx context.Context) CockpitGrafanaUserOutput
}
func (*CockpitGrafanaUser) ElementType() reflect.Type {
return reflect.TypeOf((**CockpitGrafanaUser)(nil)).Elem()
}
func (i *CockpitGrafanaUser) ToCockpitGrafanaUserOutput() CockpitGrafanaUserOutput {
return i.ToCockpitGrafanaUserOutputWithContext(context.Background())
}
func (i *CockpitGrafanaUser) ToCockpitGrafanaUserOutputWithContext(ctx context.Context) CockpitGrafanaUserOutput {
return pulumi.ToOutputWithContext(ctx, i).(CockpitGrafanaUserOutput)
}
// CockpitGrafanaUserArrayInput is an input type that accepts CockpitGrafanaUserArray and CockpitGrafanaUserArrayOutput values.
// You can construct a concrete instance of `CockpitGrafanaUserArrayInput` via:
//
// CockpitGrafanaUserArray{ CockpitGrafanaUserArgs{...} }
type CockpitGrafanaUserArrayInput interface {
pulumi.Input
ToCockpitGrafanaUserArrayOutput() CockpitGrafanaUserArrayOutput
ToCockpitGrafanaUserArrayOutputWithContext(context.Context) CockpitGrafanaUserArrayOutput
}
type CockpitGrafanaUserArray []CockpitGrafanaUserInput
func (CockpitGrafanaUserArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CockpitGrafanaUser)(nil)).Elem()
}
func (i CockpitGrafanaUserArray) ToCockpitGrafanaUserArrayOutput() CockpitGrafanaUserArrayOutput {
return i.ToCockpitGrafanaUserArrayOutputWithContext(context.Background())
}
func (i CockpitGrafanaUserArray) ToCockpitGrafanaUserArrayOutputWithContext(ctx context.Context) CockpitGrafanaUserArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CockpitGrafanaUserArrayOutput)
}
// CockpitGrafanaUserMapInput is an input type that accepts CockpitGrafanaUserMap and CockpitGrafanaUserMapOutput values.
// You can construct a concrete instance of `CockpitGrafanaUserMapInput` via:
//
// CockpitGrafanaUserMap{ "key": CockpitGrafanaUserArgs{...} }
type CockpitGrafanaUserMapInput interface {
pulumi.Input
ToCockpitGrafanaUserMapOutput() CockpitGrafanaUserMapOutput
ToCockpitGrafanaUserMapOutputWithContext(context.Context) CockpitGrafanaUserMapOutput
}
type CockpitGrafanaUserMap map[string]CockpitGrafanaUserInput
func (CockpitGrafanaUserMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CockpitGrafanaUser)(nil)).Elem()
}
func (i CockpitGrafanaUserMap) ToCockpitGrafanaUserMapOutput() CockpitGrafanaUserMapOutput {
return i.ToCockpitGrafanaUserMapOutputWithContext(context.Background())
}
func (i CockpitGrafanaUserMap) ToCockpitGrafanaUserMapOutputWithContext(ctx context.Context) CockpitGrafanaUserMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CockpitGrafanaUserMapOutput)
}
type CockpitGrafanaUserOutput struct{ *pulumi.OutputState }
func (CockpitGrafanaUserOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CockpitGrafanaUser)(nil)).Elem()
}
func (o CockpitGrafanaUserOutput) ToCockpitGrafanaUserOutput() CockpitGrafanaUserOutput {
return o
}
func (o CockpitGrafanaUserOutput) ToCockpitGrafanaUserOutputWithContext(ctx context.Context) CockpitGrafanaUserOutput {
return o
}
// The login of the grafana user.
func (o CockpitGrafanaUserOutput) Login() pulumi.StringOutput {
return o.ApplyT(func(v *CockpitGrafanaUser) pulumi.StringOutput { return v.Login }).(pulumi.StringOutput)
}
// The password of the grafana user
func (o CockpitGrafanaUserOutput) Password() pulumi.StringOutput {
return o.ApplyT(func(v *CockpitGrafanaUser) pulumi.StringOutput { return v.Password }).(pulumi.StringOutput)
}
// `projectId`) The ID of the project the cockpit is associated with.
func (o CockpitGrafanaUserOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *CockpitGrafanaUser) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// The role of the grafana user. Must be `editor` or `viewer`.
func (o CockpitGrafanaUserOutput) Role() pulumi.StringOutput {
return o.ApplyT(func(v *CockpitGrafanaUser) pulumi.StringOutput { return v.Role }).(pulumi.StringOutput)
}
type CockpitGrafanaUserArrayOutput struct{ *pulumi.OutputState }
func (CockpitGrafanaUserArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CockpitGrafanaUser)(nil)).Elem()
}
func (o CockpitGrafanaUserArrayOutput) ToCockpitGrafanaUserArrayOutput() CockpitGrafanaUserArrayOutput {
return o
}
func (o CockpitGrafanaUserArrayOutput) ToCockpitGrafanaUserArrayOutputWithContext(ctx context.Context) CockpitGrafanaUserArrayOutput {
return o
}
func (o CockpitGrafanaUserArrayOutput) Index(i pulumi.IntInput) CockpitGrafanaUserOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CockpitGrafanaUser {
return vs[0].([]*CockpitGrafanaUser)[vs[1].(int)]
}).(CockpitGrafanaUserOutput)
}
type CockpitGrafanaUserMapOutput struct{ *pulumi.OutputState }
func (CockpitGrafanaUserMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CockpitGrafanaUser)(nil)).Elem()
}
func (o CockpitGrafanaUserMapOutput) ToCockpitGrafanaUserMapOutput() CockpitGrafanaUserMapOutput {
return o
}
func (o CockpitGrafanaUserMapOutput) ToCockpitGrafanaUserMapOutputWithContext(ctx context.Context) CockpitGrafanaUserMapOutput {
return o
}
func (o CockpitGrafanaUserMapOutput) MapIndex(k pulumi.StringInput) CockpitGrafanaUserOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CockpitGrafanaUser {
return vs[0].(map[string]*CockpitGrafanaUser)[vs[1].(string)]
}).(CockpitGrafanaUserOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CockpitGrafanaUserInput)(nil)).Elem(), &CockpitGrafanaUser{})
pulumi.RegisterInputType(reflect.TypeOf((*CockpitGrafanaUserArrayInput)(nil)).Elem(), CockpitGrafanaUserArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CockpitGrafanaUserMapInput)(nil)).Elem(), CockpitGrafanaUserMap{})
pulumi.RegisterOutputType(CockpitGrafanaUserOutput{})
pulumi.RegisterOutputType(CockpitGrafanaUserArrayOutput{})
pulumi.RegisterOutputType(CockpitGrafanaUserMapOutput{})
}