generated from pulumi/pulumi-tf-provider-boilerplate
/
machineLearningJob.go
389 lines (331 loc) · 17.1 KB
/
machineLearningJob.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
// 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"
)
// A job defines the queries and model parameters for a machine learning task.
type MachineLearningJob struct {
pulumi.CustomResourceState
// An object representing the custom labels added on the forecast.
CustomLabels pulumi.MapOutput `pulumi:"customLabels"`
// The id of the datasource to query.
DatasourceId pulumi.IntPtrOutput `pulumi:"datasourceId"`
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
DatasourceType pulumi.StringOutput `pulumi:"datasourceType"`
// The uid of the datasource to query.
DatasourceUid pulumi.StringPtrOutput `pulumi:"datasourceUid"`
// A description of the job.
Description pulumi.StringPtrOutput `pulumi:"description"`
// A list of holiday IDs or names to take into account when training the model.
Holidays pulumi.StringArrayOutput `pulumi:"holidays"`
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
HyperParams pulumi.MapOutput `pulumi:"hyperParams"`
// The data interval in seconds to train the data on. Defaults to `300`.
Interval pulumi.IntPtrOutput `pulumi:"interval"`
// The metric used to query the job results.
Metric pulumi.StringOutput `pulumi:"metric"`
// The name of the job.
Name pulumi.StringOutput `pulumi:"name"`
// An object representing the query params to query Grafana with.
QueryParams pulumi.MapOutput `pulumi:"queryParams"`
// The data interval in seconds to train the data on. Defaults to `7776000`.
TrainingWindow pulumi.IntPtrOutput `pulumi:"trainingWindow"`
}
// NewMachineLearningJob registers a new resource with the given unique name, arguments, and options.
func NewMachineLearningJob(ctx *pulumi.Context,
name string, args *MachineLearningJobArgs, opts ...pulumi.ResourceOption) (*MachineLearningJob, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DatasourceType == nil {
return nil, errors.New("invalid value for required argument 'DatasourceType'")
}
if args.Metric == nil {
return nil, errors.New("invalid value for required argument 'Metric'")
}
if args.QueryParams == nil {
return nil, errors.New("invalid value for required argument 'QueryParams'")
}
opts = pkgResourceDefaultOpts(opts)
var resource MachineLearningJob
err := ctx.RegisterResource("grafana:index/machineLearningJob:MachineLearningJob", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMachineLearningJob gets an existing MachineLearningJob 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 GetMachineLearningJob(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MachineLearningJobState, opts ...pulumi.ResourceOption) (*MachineLearningJob, error) {
var resource MachineLearningJob
err := ctx.ReadResource("grafana:index/machineLearningJob:MachineLearningJob", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering MachineLearningJob resources.
type machineLearningJobState struct {
// An object representing the custom labels added on the forecast.
CustomLabels map[string]interface{} `pulumi:"customLabels"`
// The id of the datasource to query.
DatasourceId *int `pulumi:"datasourceId"`
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
DatasourceType *string `pulumi:"datasourceType"`
// The uid of the datasource to query.
DatasourceUid *string `pulumi:"datasourceUid"`
// A description of the job.
Description *string `pulumi:"description"`
// A list of holiday IDs or names to take into account when training the model.
Holidays []string `pulumi:"holidays"`
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
HyperParams map[string]interface{} `pulumi:"hyperParams"`
// The data interval in seconds to train the data on. Defaults to `300`.
Interval *int `pulumi:"interval"`
// The metric used to query the job results.
Metric *string `pulumi:"metric"`
// The name of the job.
Name *string `pulumi:"name"`
// An object representing the query params to query Grafana with.
QueryParams map[string]interface{} `pulumi:"queryParams"`
// The data interval in seconds to train the data on. Defaults to `7776000`.
TrainingWindow *int `pulumi:"trainingWindow"`
}
type MachineLearningJobState struct {
// An object representing the custom labels added on the forecast.
CustomLabels pulumi.MapInput
// The id of the datasource to query.
DatasourceId pulumi.IntPtrInput
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
DatasourceType pulumi.StringPtrInput
// The uid of the datasource to query.
DatasourceUid pulumi.StringPtrInput
// A description of the job.
Description pulumi.StringPtrInput
// A list of holiday IDs or names to take into account when training the model.
Holidays pulumi.StringArrayInput
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
HyperParams pulumi.MapInput
// The data interval in seconds to train the data on. Defaults to `300`.
Interval pulumi.IntPtrInput
// The metric used to query the job results.
Metric pulumi.StringPtrInput
// The name of the job.
Name pulumi.StringPtrInput
// An object representing the query params to query Grafana with.
QueryParams pulumi.MapInput
// The data interval in seconds to train the data on. Defaults to `7776000`.
TrainingWindow pulumi.IntPtrInput
}
func (MachineLearningJobState) ElementType() reflect.Type {
return reflect.TypeOf((*machineLearningJobState)(nil)).Elem()
}
type machineLearningJobArgs struct {
// An object representing the custom labels added on the forecast.
CustomLabels map[string]interface{} `pulumi:"customLabels"`
// The id of the datasource to query.
DatasourceId *int `pulumi:"datasourceId"`
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
DatasourceType string `pulumi:"datasourceType"`
// The uid of the datasource to query.
DatasourceUid *string `pulumi:"datasourceUid"`
// A description of the job.
Description *string `pulumi:"description"`
// A list of holiday IDs or names to take into account when training the model.
Holidays []string `pulumi:"holidays"`
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
HyperParams map[string]interface{} `pulumi:"hyperParams"`
// The data interval in seconds to train the data on. Defaults to `300`.
Interval *int `pulumi:"interval"`
// The metric used to query the job results.
Metric string `pulumi:"metric"`
// The name of the job.
Name *string `pulumi:"name"`
// An object representing the query params to query Grafana with.
QueryParams map[string]interface{} `pulumi:"queryParams"`
// The data interval in seconds to train the data on. Defaults to `7776000`.
TrainingWindow *int `pulumi:"trainingWindow"`
}
// The set of arguments for constructing a MachineLearningJob resource.
type MachineLearningJobArgs struct {
// An object representing the custom labels added on the forecast.
CustomLabels pulumi.MapInput
// The id of the datasource to query.
DatasourceId pulumi.IntPtrInput
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
DatasourceType pulumi.StringInput
// The uid of the datasource to query.
DatasourceUid pulumi.StringPtrInput
// A description of the job.
Description pulumi.StringPtrInput
// A list of holiday IDs or names to take into account when training the model.
Holidays pulumi.StringArrayInput
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
HyperParams pulumi.MapInput
// The data interval in seconds to train the data on. Defaults to `300`.
Interval pulumi.IntPtrInput
// The metric used to query the job results.
Metric pulumi.StringInput
// The name of the job.
Name pulumi.StringPtrInput
// An object representing the query params to query Grafana with.
QueryParams pulumi.MapInput
// The data interval in seconds to train the data on. Defaults to `7776000`.
TrainingWindow pulumi.IntPtrInput
}
func (MachineLearningJobArgs) ElementType() reflect.Type {
return reflect.TypeOf((*machineLearningJobArgs)(nil)).Elem()
}
type MachineLearningJobInput interface {
pulumi.Input
ToMachineLearningJobOutput() MachineLearningJobOutput
ToMachineLearningJobOutputWithContext(ctx context.Context) MachineLearningJobOutput
}
func (*MachineLearningJob) ElementType() reflect.Type {
return reflect.TypeOf((**MachineLearningJob)(nil)).Elem()
}
func (i *MachineLearningJob) ToMachineLearningJobOutput() MachineLearningJobOutput {
return i.ToMachineLearningJobOutputWithContext(context.Background())
}
func (i *MachineLearningJob) ToMachineLearningJobOutputWithContext(ctx context.Context) MachineLearningJobOutput {
return pulumi.ToOutputWithContext(ctx, i).(MachineLearningJobOutput)
}
// MachineLearningJobArrayInput is an input type that accepts MachineLearningJobArray and MachineLearningJobArrayOutput values.
// You can construct a concrete instance of `MachineLearningJobArrayInput` via:
//
// MachineLearningJobArray{ MachineLearningJobArgs{...} }
type MachineLearningJobArrayInput interface {
pulumi.Input
ToMachineLearningJobArrayOutput() MachineLearningJobArrayOutput
ToMachineLearningJobArrayOutputWithContext(context.Context) MachineLearningJobArrayOutput
}
type MachineLearningJobArray []MachineLearningJobInput
func (MachineLearningJobArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*MachineLearningJob)(nil)).Elem()
}
func (i MachineLearningJobArray) ToMachineLearningJobArrayOutput() MachineLearningJobArrayOutput {
return i.ToMachineLearningJobArrayOutputWithContext(context.Background())
}
func (i MachineLearningJobArray) ToMachineLearningJobArrayOutputWithContext(ctx context.Context) MachineLearningJobArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(MachineLearningJobArrayOutput)
}
// MachineLearningJobMapInput is an input type that accepts MachineLearningJobMap and MachineLearningJobMapOutput values.
// You can construct a concrete instance of `MachineLearningJobMapInput` via:
//
// MachineLearningJobMap{ "key": MachineLearningJobArgs{...} }
type MachineLearningJobMapInput interface {
pulumi.Input
ToMachineLearningJobMapOutput() MachineLearningJobMapOutput
ToMachineLearningJobMapOutputWithContext(context.Context) MachineLearningJobMapOutput
}
type MachineLearningJobMap map[string]MachineLearningJobInput
func (MachineLearningJobMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*MachineLearningJob)(nil)).Elem()
}
func (i MachineLearningJobMap) ToMachineLearningJobMapOutput() MachineLearningJobMapOutput {
return i.ToMachineLearningJobMapOutputWithContext(context.Background())
}
func (i MachineLearningJobMap) ToMachineLearningJobMapOutputWithContext(ctx context.Context) MachineLearningJobMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(MachineLearningJobMapOutput)
}
type MachineLearningJobOutput struct{ *pulumi.OutputState }
func (MachineLearningJobOutput) ElementType() reflect.Type {
return reflect.TypeOf((**MachineLearningJob)(nil)).Elem()
}
func (o MachineLearningJobOutput) ToMachineLearningJobOutput() MachineLearningJobOutput {
return o
}
func (o MachineLearningJobOutput) ToMachineLearningJobOutputWithContext(ctx context.Context) MachineLearningJobOutput {
return o
}
// An object representing the custom labels added on the forecast.
func (o MachineLearningJobOutput) CustomLabels() pulumi.MapOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.MapOutput { return v.CustomLabels }).(pulumi.MapOutput)
}
// The id of the datasource to query.
func (o MachineLearningJobOutput) DatasourceId() pulumi.IntPtrOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.IntPtrOutput { return v.DatasourceId }).(pulumi.IntPtrOutput)
}
// The type of datasource being queried. Currently allowed values are prometheus, graphite, loki, postgres, and datadog.
func (o MachineLearningJobOutput) DatasourceType() pulumi.StringOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringOutput { return v.DatasourceType }).(pulumi.StringOutput)
}
// The uid of the datasource to query.
func (o MachineLearningJobOutput) DatasourceUid() pulumi.StringPtrOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringPtrOutput { return v.DatasourceUid }).(pulumi.StringPtrOutput)
}
// A description of the job.
func (o MachineLearningJobOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// A list of holiday IDs or names to take into account when training the model.
func (o MachineLearningJobOutput) Holidays() pulumi.StringArrayOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringArrayOutput { return v.Holidays }).(pulumi.StringArrayOutput)
}
// The hyperparameters used to fine tune the algorithm. See https://grafana.com/docs/grafana-cloud/machine-learning/models/ for the full list of available hyperparameters. Defaults to `map[]`.
func (o MachineLearningJobOutput) HyperParams() pulumi.MapOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.MapOutput { return v.HyperParams }).(pulumi.MapOutput)
}
// The data interval in seconds to train the data on. Defaults to `300`.
func (o MachineLearningJobOutput) Interval() pulumi.IntPtrOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.IntPtrOutput { return v.Interval }).(pulumi.IntPtrOutput)
}
// The metric used to query the job results.
func (o MachineLearningJobOutput) Metric() pulumi.StringOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringOutput { return v.Metric }).(pulumi.StringOutput)
}
// The name of the job.
func (o MachineLearningJobOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// An object representing the query params to query Grafana with.
func (o MachineLearningJobOutput) QueryParams() pulumi.MapOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.MapOutput { return v.QueryParams }).(pulumi.MapOutput)
}
// The data interval in seconds to train the data on. Defaults to `7776000`.
func (o MachineLearningJobOutput) TrainingWindow() pulumi.IntPtrOutput {
return o.ApplyT(func(v *MachineLearningJob) pulumi.IntPtrOutput { return v.TrainingWindow }).(pulumi.IntPtrOutput)
}
type MachineLearningJobArrayOutput struct{ *pulumi.OutputState }
func (MachineLearningJobArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*MachineLearningJob)(nil)).Elem()
}
func (o MachineLearningJobArrayOutput) ToMachineLearningJobArrayOutput() MachineLearningJobArrayOutput {
return o
}
func (o MachineLearningJobArrayOutput) ToMachineLearningJobArrayOutputWithContext(ctx context.Context) MachineLearningJobArrayOutput {
return o
}
func (o MachineLearningJobArrayOutput) Index(i pulumi.IntInput) MachineLearningJobOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *MachineLearningJob {
return vs[0].([]*MachineLearningJob)[vs[1].(int)]
}).(MachineLearningJobOutput)
}
type MachineLearningJobMapOutput struct{ *pulumi.OutputState }
func (MachineLearningJobMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*MachineLearningJob)(nil)).Elem()
}
func (o MachineLearningJobMapOutput) ToMachineLearningJobMapOutput() MachineLearningJobMapOutput {
return o
}
func (o MachineLearningJobMapOutput) ToMachineLearningJobMapOutputWithContext(ctx context.Context) MachineLearningJobMapOutput {
return o
}
func (o MachineLearningJobMapOutput) MapIndex(k pulumi.StringInput) MachineLearningJobOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *MachineLearningJob {
return vs[0].(map[string]*MachineLearningJob)[vs[1].(string)]
}).(MachineLearningJobOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*MachineLearningJobInput)(nil)).Elem(), &MachineLearningJob{})
pulumi.RegisterInputType(reflect.TypeOf((*MachineLearningJobArrayInput)(nil)).Elem(), MachineLearningJobArray{})
pulumi.RegisterInputType(reflect.TypeOf((*MachineLearningJobMapInput)(nil)).Elem(), MachineLearningJobMap{})
pulumi.RegisterOutputType(MachineLearningJobOutput{})
pulumi.RegisterOutputType(MachineLearningJobArrayOutput{})
pulumi.RegisterOutputType(MachineLearningJobMapOutput{})
}