generated from pulumi/pulumi-tf-provider-boilerplate
/
annotation.go
400 lines (340 loc) · 14.3 KB
/
annotation.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// 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 grafana
import (
"context"
"reflect"
"errors"
"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/)
// * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/annotations/)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := grafana.NewAnnotation(ctx, "test", &grafana.AnnotationArgs{
// Text: pulumi.String("basic text"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type Annotation struct {
pulumi.CustomResourceState
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
DashboardId pulumi.IntPtrOutput `pulumi:"dashboardId"`
// The ID of the dashboard on which to create the annotation.
DashboardUid pulumi.StringPtrOutput `pulumi:"dashboardUid"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrOutput `pulumi:"orgId"`
// The ID of the dashboard panel on which to create the annotation.
PanelId pulumi.IntPtrOutput `pulumi:"panelId"`
// The tags to associate with the annotation.
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// The text to associate with the annotation.
Text pulumi.StringOutput `pulumi:"text"`
// The RFC 3339-formatted time string indicating the annotation's time.
Time pulumi.StringOutput `pulumi:"time"`
// The RFC 3339-formatted time string indicating the annotation's end time.
TimeEnd pulumi.StringOutput `pulumi:"timeEnd"`
}
// NewAnnotation registers a new resource with the given unique name, arguments, and options.
func NewAnnotation(ctx *pulumi.Context,
name string, args *AnnotationArgs, opts ...pulumi.ResourceOption) (*Annotation, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Text == nil {
return nil, errors.New("invalid value for required argument 'Text'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Annotation
err := ctx.RegisterResource("grafana:index/annotation:Annotation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAnnotation gets an existing Annotation 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 GetAnnotation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AnnotationState, opts ...pulumi.ResourceOption) (*Annotation, error) {
var resource Annotation
err := ctx.ReadResource("grafana:index/annotation:Annotation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Annotation resources.
type annotationState struct {
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
DashboardId *int `pulumi:"dashboardId"`
// The ID of the dashboard on which to create the annotation.
DashboardUid *string `pulumi:"dashboardUid"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId *string `pulumi:"orgId"`
// The ID of the dashboard panel on which to create the annotation.
PanelId *int `pulumi:"panelId"`
// The tags to associate with the annotation.
Tags []string `pulumi:"tags"`
// The text to associate with the annotation.
Text *string `pulumi:"text"`
// The RFC 3339-formatted time string indicating the annotation's time.
Time *string `pulumi:"time"`
// The RFC 3339-formatted time string indicating the annotation's end time.
TimeEnd *string `pulumi:"timeEnd"`
}
type AnnotationState struct {
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
DashboardId pulumi.IntPtrInput
// The ID of the dashboard on which to create the annotation.
DashboardUid pulumi.StringPtrInput
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrInput
// The ID of the dashboard panel on which to create the annotation.
PanelId pulumi.IntPtrInput
// The tags to associate with the annotation.
Tags pulumi.StringArrayInput
// The text to associate with the annotation.
Text pulumi.StringPtrInput
// The RFC 3339-formatted time string indicating the annotation's time.
Time pulumi.StringPtrInput
// The RFC 3339-formatted time string indicating the annotation's end time.
TimeEnd pulumi.StringPtrInput
}
func (AnnotationState) ElementType() reflect.Type {
return reflect.TypeOf((*annotationState)(nil)).Elem()
}
type annotationArgs struct {
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
DashboardId *int `pulumi:"dashboardId"`
// The ID of the dashboard on which to create the annotation.
DashboardUid *string `pulumi:"dashboardUid"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId *string `pulumi:"orgId"`
// The ID of the dashboard panel on which to create the annotation.
PanelId *int `pulumi:"panelId"`
// The tags to associate with the annotation.
Tags []string `pulumi:"tags"`
// The text to associate with the annotation.
Text string `pulumi:"text"`
// The RFC 3339-formatted time string indicating the annotation's time.
Time *string `pulumi:"time"`
// The RFC 3339-formatted time string indicating the annotation's end time.
TimeEnd *string `pulumi:"timeEnd"`
}
// The set of arguments for constructing a Annotation resource.
type AnnotationArgs struct {
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
DashboardId pulumi.IntPtrInput
// The ID of the dashboard on which to create the annotation.
DashboardUid pulumi.StringPtrInput
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrInput
// The ID of the dashboard panel on which to create the annotation.
PanelId pulumi.IntPtrInput
// The tags to associate with the annotation.
Tags pulumi.StringArrayInput
// The text to associate with the annotation.
Text pulumi.StringInput
// The RFC 3339-formatted time string indicating the annotation's time.
Time pulumi.StringPtrInput
// The RFC 3339-formatted time string indicating the annotation's end time.
TimeEnd pulumi.StringPtrInput
}
func (AnnotationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*annotationArgs)(nil)).Elem()
}
type AnnotationInput interface {
pulumi.Input
ToAnnotationOutput() AnnotationOutput
ToAnnotationOutputWithContext(ctx context.Context) AnnotationOutput
}
func (*Annotation) ElementType() reflect.Type {
return reflect.TypeOf((**Annotation)(nil)).Elem()
}
func (i *Annotation) ToAnnotationOutput() AnnotationOutput {
return i.ToAnnotationOutputWithContext(context.Background())
}
func (i *Annotation) ToAnnotationOutputWithContext(ctx context.Context) AnnotationOutput {
return pulumi.ToOutputWithContext(ctx, i).(AnnotationOutput)
}
func (i *Annotation) ToOutput(ctx context.Context) pulumix.Output[*Annotation] {
return pulumix.Output[*Annotation]{
OutputState: i.ToAnnotationOutputWithContext(ctx).OutputState,
}
}
// AnnotationArrayInput is an input type that accepts AnnotationArray and AnnotationArrayOutput values.
// You can construct a concrete instance of `AnnotationArrayInput` via:
//
// AnnotationArray{ AnnotationArgs{...} }
type AnnotationArrayInput interface {
pulumi.Input
ToAnnotationArrayOutput() AnnotationArrayOutput
ToAnnotationArrayOutputWithContext(context.Context) AnnotationArrayOutput
}
type AnnotationArray []AnnotationInput
func (AnnotationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Annotation)(nil)).Elem()
}
func (i AnnotationArray) ToAnnotationArrayOutput() AnnotationArrayOutput {
return i.ToAnnotationArrayOutputWithContext(context.Background())
}
func (i AnnotationArray) ToAnnotationArrayOutputWithContext(ctx context.Context) AnnotationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AnnotationArrayOutput)
}
func (i AnnotationArray) ToOutput(ctx context.Context) pulumix.Output[[]*Annotation] {
return pulumix.Output[[]*Annotation]{
OutputState: i.ToAnnotationArrayOutputWithContext(ctx).OutputState,
}
}
// AnnotationMapInput is an input type that accepts AnnotationMap and AnnotationMapOutput values.
// You can construct a concrete instance of `AnnotationMapInput` via:
//
// AnnotationMap{ "key": AnnotationArgs{...} }
type AnnotationMapInput interface {
pulumi.Input
ToAnnotationMapOutput() AnnotationMapOutput
ToAnnotationMapOutputWithContext(context.Context) AnnotationMapOutput
}
type AnnotationMap map[string]AnnotationInput
func (AnnotationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Annotation)(nil)).Elem()
}
func (i AnnotationMap) ToAnnotationMapOutput() AnnotationMapOutput {
return i.ToAnnotationMapOutputWithContext(context.Background())
}
func (i AnnotationMap) ToAnnotationMapOutputWithContext(ctx context.Context) AnnotationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AnnotationMapOutput)
}
func (i AnnotationMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*Annotation] {
return pulumix.Output[map[string]*Annotation]{
OutputState: i.ToAnnotationMapOutputWithContext(ctx).OutputState,
}
}
type AnnotationOutput struct{ *pulumi.OutputState }
func (AnnotationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Annotation)(nil)).Elem()
}
func (o AnnotationOutput) ToAnnotationOutput() AnnotationOutput {
return o
}
func (o AnnotationOutput) ToAnnotationOutputWithContext(ctx context.Context) AnnotationOutput {
return o
}
func (o AnnotationOutput) ToOutput(ctx context.Context) pulumix.Output[*Annotation] {
return pulumix.Output[*Annotation]{
OutputState: o.OutputState,
}
}
// The ID of the dashboard on which to create the annotation. Deprecated: Use dashboardUid instead.
//
// Deprecated: Use dashboard_uid instead.
func (o AnnotationOutput) DashboardId() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Annotation) pulumi.IntPtrOutput { return v.DashboardId }).(pulumi.IntPtrOutput)
}
// The ID of the dashboard on which to create the annotation.
func (o AnnotationOutput) DashboardUid() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringPtrOutput { return v.DashboardUid }).(pulumi.StringPtrOutput)
}
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
func (o AnnotationOutput) OrgId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringPtrOutput { return v.OrgId }).(pulumi.StringPtrOutput)
}
// The ID of the dashboard panel on which to create the annotation.
func (o AnnotationOutput) PanelId() pulumi.IntPtrOutput {
return o.ApplyT(func(v *Annotation) pulumi.IntPtrOutput { return v.PanelId }).(pulumi.IntPtrOutput)
}
// The tags to associate with the annotation.
func (o AnnotationOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringArrayOutput { return v.Tags }).(pulumi.StringArrayOutput)
}
// The text to associate with the annotation.
func (o AnnotationOutput) Text() pulumi.StringOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringOutput { return v.Text }).(pulumi.StringOutput)
}
// The RFC 3339-formatted time string indicating the annotation's time.
func (o AnnotationOutput) Time() pulumi.StringOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringOutput { return v.Time }).(pulumi.StringOutput)
}
// The RFC 3339-formatted time string indicating the annotation's end time.
func (o AnnotationOutput) TimeEnd() pulumi.StringOutput {
return o.ApplyT(func(v *Annotation) pulumi.StringOutput { return v.TimeEnd }).(pulumi.StringOutput)
}
type AnnotationArrayOutput struct{ *pulumi.OutputState }
func (AnnotationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Annotation)(nil)).Elem()
}
func (o AnnotationArrayOutput) ToAnnotationArrayOutput() AnnotationArrayOutput {
return o
}
func (o AnnotationArrayOutput) ToAnnotationArrayOutputWithContext(ctx context.Context) AnnotationArrayOutput {
return o
}
func (o AnnotationArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*Annotation] {
return pulumix.Output[[]*Annotation]{
OutputState: o.OutputState,
}
}
func (o AnnotationArrayOutput) Index(i pulumi.IntInput) AnnotationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Annotation {
return vs[0].([]*Annotation)[vs[1].(int)]
}).(AnnotationOutput)
}
type AnnotationMapOutput struct{ *pulumi.OutputState }
func (AnnotationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Annotation)(nil)).Elem()
}
func (o AnnotationMapOutput) ToAnnotationMapOutput() AnnotationMapOutput {
return o
}
func (o AnnotationMapOutput) ToAnnotationMapOutputWithContext(ctx context.Context) AnnotationMapOutput {
return o
}
func (o AnnotationMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*Annotation] {
return pulumix.Output[map[string]*Annotation]{
OutputState: o.OutputState,
}
}
func (o AnnotationMapOutput) MapIndex(k pulumi.StringInput) AnnotationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Annotation {
return vs[0].(map[string]*Annotation)[vs[1].(string)]
}).(AnnotationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AnnotationInput)(nil)).Elem(), &Annotation{})
pulumi.RegisterInputType(reflect.TypeOf((*AnnotationArrayInput)(nil)).Elem(), AnnotationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AnnotationMapInput)(nil)).Elem(), AnnotationMap{})
pulumi.RegisterOutputType(AnnotationOutput{})
pulumi.RegisterOutputType(AnnotationArrayOutput{})
pulumi.RegisterOutputType(AnnotationMapOutput{})
}