generated from pulumi/pulumi-tf-provider-boilerplate
/
playlist.go
255 lines (205 loc) · 8.2 KB
/
playlist.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
// 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/pulumi/pulumi/sdk/v3/go/pulumi"
)
// * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/create-manage-playlists/)
// * [HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/playlist/)
type Playlist struct {
pulumi.CustomResourceState
Interval pulumi.StringOutput `pulumi:"interval"`
Items PlaylistItemArrayOutput `pulumi:"items"`
// The name of the playlist.
Name pulumi.StringOutput `pulumi:"name"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrOutput `pulumi:"orgId"`
}
// NewPlaylist registers a new resource with the given unique name, arguments, and options.
func NewPlaylist(ctx *pulumi.Context,
name string, args *PlaylistArgs, opts ...pulumi.ResourceOption) (*Playlist, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Interval == nil {
return nil, errors.New("invalid value for required argument 'Interval'")
}
if args.Items == nil {
return nil, errors.New("invalid value for required argument 'Items'")
}
opts = pkgResourceDefaultOpts(opts)
var resource Playlist
err := ctx.RegisterResource("grafana:index/playlist:Playlist", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPlaylist gets an existing Playlist 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 GetPlaylist(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PlaylistState, opts ...pulumi.ResourceOption) (*Playlist, error) {
var resource Playlist
err := ctx.ReadResource("grafana:index/playlist:Playlist", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Playlist resources.
type playlistState struct {
Interval *string `pulumi:"interval"`
Items []PlaylistItem `pulumi:"items"`
// The name of the playlist.
Name *string `pulumi:"name"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId *string `pulumi:"orgId"`
}
type PlaylistState struct {
Interval pulumi.StringPtrInput
Items PlaylistItemArrayInput
// The name of the playlist.
Name pulumi.StringPtrInput
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrInput
}
func (PlaylistState) ElementType() reflect.Type {
return reflect.TypeOf((*playlistState)(nil)).Elem()
}
type playlistArgs struct {
Interval string `pulumi:"interval"`
Items []PlaylistItem `pulumi:"items"`
// The name of the playlist.
Name *string `pulumi:"name"`
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId *string `pulumi:"orgId"`
}
// The set of arguments for constructing a Playlist resource.
type PlaylistArgs struct {
Interval pulumi.StringInput
Items PlaylistItemArrayInput
// The name of the playlist.
Name pulumi.StringPtrInput
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
OrgId pulumi.StringPtrInput
}
func (PlaylistArgs) ElementType() reflect.Type {
return reflect.TypeOf((*playlistArgs)(nil)).Elem()
}
type PlaylistInput interface {
pulumi.Input
ToPlaylistOutput() PlaylistOutput
ToPlaylistOutputWithContext(ctx context.Context) PlaylistOutput
}
func (*Playlist) ElementType() reflect.Type {
return reflect.TypeOf((**Playlist)(nil)).Elem()
}
func (i *Playlist) ToPlaylistOutput() PlaylistOutput {
return i.ToPlaylistOutputWithContext(context.Background())
}
func (i *Playlist) ToPlaylistOutputWithContext(ctx context.Context) PlaylistOutput {
return pulumi.ToOutputWithContext(ctx, i).(PlaylistOutput)
}
// PlaylistArrayInput is an input type that accepts PlaylistArray and PlaylistArrayOutput values.
// You can construct a concrete instance of `PlaylistArrayInput` via:
//
// PlaylistArray{ PlaylistArgs{...} }
type PlaylistArrayInput interface {
pulumi.Input
ToPlaylistArrayOutput() PlaylistArrayOutput
ToPlaylistArrayOutputWithContext(context.Context) PlaylistArrayOutput
}
type PlaylistArray []PlaylistInput
func (PlaylistArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Playlist)(nil)).Elem()
}
func (i PlaylistArray) ToPlaylistArrayOutput() PlaylistArrayOutput {
return i.ToPlaylistArrayOutputWithContext(context.Background())
}
func (i PlaylistArray) ToPlaylistArrayOutputWithContext(ctx context.Context) PlaylistArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PlaylistArrayOutput)
}
// PlaylistMapInput is an input type that accepts PlaylistMap and PlaylistMapOutput values.
// You can construct a concrete instance of `PlaylistMapInput` via:
//
// PlaylistMap{ "key": PlaylistArgs{...} }
type PlaylistMapInput interface {
pulumi.Input
ToPlaylistMapOutput() PlaylistMapOutput
ToPlaylistMapOutputWithContext(context.Context) PlaylistMapOutput
}
type PlaylistMap map[string]PlaylistInput
func (PlaylistMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Playlist)(nil)).Elem()
}
func (i PlaylistMap) ToPlaylistMapOutput() PlaylistMapOutput {
return i.ToPlaylistMapOutputWithContext(context.Background())
}
func (i PlaylistMap) ToPlaylistMapOutputWithContext(ctx context.Context) PlaylistMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PlaylistMapOutput)
}
type PlaylistOutput struct{ *pulumi.OutputState }
func (PlaylistOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Playlist)(nil)).Elem()
}
func (o PlaylistOutput) ToPlaylistOutput() PlaylistOutput {
return o
}
func (o PlaylistOutput) ToPlaylistOutputWithContext(ctx context.Context) PlaylistOutput {
return o
}
func (o PlaylistOutput) Interval() pulumi.StringOutput {
return o.ApplyT(func(v *Playlist) pulumi.StringOutput { return v.Interval }).(pulumi.StringOutput)
}
func (o PlaylistOutput) Items() PlaylistItemArrayOutput {
return o.ApplyT(func(v *Playlist) PlaylistItemArrayOutput { return v.Items }).(PlaylistItemArrayOutput)
}
// The name of the playlist.
func (o PlaylistOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Playlist) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The Organization ID. If not set, the Org ID defined in the provider block will be used.
func (o PlaylistOutput) OrgId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Playlist) pulumi.StringPtrOutput { return v.OrgId }).(pulumi.StringPtrOutput)
}
type PlaylistArrayOutput struct{ *pulumi.OutputState }
func (PlaylistArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Playlist)(nil)).Elem()
}
func (o PlaylistArrayOutput) ToPlaylistArrayOutput() PlaylistArrayOutput {
return o
}
func (o PlaylistArrayOutput) ToPlaylistArrayOutputWithContext(ctx context.Context) PlaylistArrayOutput {
return o
}
func (o PlaylistArrayOutput) Index(i pulumi.IntInput) PlaylistOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Playlist {
return vs[0].([]*Playlist)[vs[1].(int)]
}).(PlaylistOutput)
}
type PlaylistMapOutput struct{ *pulumi.OutputState }
func (PlaylistMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Playlist)(nil)).Elem()
}
func (o PlaylistMapOutput) ToPlaylistMapOutput() PlaylistMapOutput {
return o
}
func (o PlaylistMapOutput) ToPlaylistMapOutputWithContext(ctx context.Context) PlaylistMapOutput {
return o
}
func (o PlaylistMapOutput) MapIndex(k pulumi.StringInput) PlaylistOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Playlist {
return vs[0].(map[string]*Playlist)[vs[1].(string)]
}).(PlaylistOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PlaylistInput)(nil)).Elem(), &Playlist{})
pulumi.RegisterInputType(reflect.TypeOf((*PlaylistArrayInput)(nil)).Elem(), PlaylistArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PlaylistMapInput)(nil)).Elem(), PlaylistMap{})
pulumi.RegisterOutputType(PlaylistOutput{})
pulumi.RegisterOutputType(PlaylistArrayOutput{})
pulumi.RegisterOutputType(PlaylistMapOutput{})
}