@@ -275,7 +275,7 @@ func resourceSloCreate(ctx context.Context, d *schema.ResourceData, client *slo.
275
275
return diags
276
276
}
277
277
278
- req := client .DefaultAPI .V1SloPost (ctx ).Slo (sloModel )
278
+ req := client .DefaultAPI .V1SloPost (ctx ).SloV00Slo (sloModel )
279
279
response , _ , err := req .Execute ()
280
280
281
281
if err != nil {
@@ -320,7 +320,7 @@ func resourceSloUpdate(ctx context.Context, d *schema.ResourceData, client *slo.
320
320
return diags
321
321
}
322
322
323
- req := client .DefaultAPI .V1SloIdPut (ctx , sloID ).Slo (slo )
323
+ req := client .DefaultAPI .V1SloIdPut (ctx , sloID ).SloV00Slo (slo )
324
324
if _ , err := req .Execute (); err != nil {
325
325
return apiError ("Unable to Update SLO - API" , err )
326
326
}
@@ -340,19 +340,19 @@ func resourceSloDelete(ctx context.Context, d *schema.ResourceData, client *slo.
340
340
341
341
// Fetches all the Properties defined on the Terraform SLO State Object and converts it
342
342
// to a Slo so that it can be converted to JSON and sent to the API
343
- func packSloResource (d * schema.ResourceData ) (slo.Slo , error ) {
343
+ func packSloResource (d * schema.ResourceData ) (slo.SloV00Slo , error ) {
344
344
var (
345
- tfalerting slo.Alerting
346
- tflabels []slo.Label
347
- tfdestinationdatasource slo.DestinationDatasource
345
+ tfalerting slo.SloV00Alerting
346
+ tflabels []slo.SloV00Label
347
+ tfdestinationdatasource slo.SloV00DestinationDatasource
348
348
)
349
349
350
350
tfname := d .Get ("name" ).(string )
351
351
tfdescription := d .Get ("description" ).(string )
352
352
query := d .Get ("query" ).([]interface {})[0 ].(map [string ]interface {})
353
353
tfquery , err := packQuery (query )
354
354
if err != nil {
355
- return slo.Slo {}, err
355
+ return slo.SloV00Slo {}, err
356
356
}
357
357
358
358
objectives := d .Get ("objectives" ).([]interface {})
@@ -363,7 +363,7 @@ func packSloResource(d *schema.ResourceData) (slo.Slo, error) {
363
363
tflabels = packLabels (labels )
364
364
}
365
365
366
- slo := slo.Slo {
366
+ slo := slo.SloV00Slo {
367
367
Uuid : d .Id (),
368
368
Name : tfname ,
369
369
Description : tfdescription ,
@@ -402,8 +402,8 @@ func packSloResource(d *schema.ResourceData) (slo.Slo, error) {
402
402
return slo , nil
403
403
}
404
404
405
- func packDestinationDatasource (destinationdatasource map [string ]interface {}) (slo.DestinationDatasource , error ) {
406
- packedDestinationDatasource := slo.DestinationDatasource {}
405
+ func packDestinationDatasource (destinationdatasource map [string ]interface {}) (slo.SloV00DestinationDatasource , error ) {
406
+ packedDestinationDatasource := slo.SloV00DestinationDatasource {}
407
407
408
408
if destinationdatasource ["uid" ].(string ) != "" {
409
409
datasourceUID := destinationdatasource ["uid" ].(string )
@@ -413,13 +413,13 @@ func packDestinationDatasource(destinationdatasource map[string]interface{}) (sl
413
413
return packedDestinationDatasource , nil
414
414
}
415
415
416
- func packQuery (query map [string ]interface {}) (slo.Query , error ) {
416
+ func packQuery (query map [string ]interface {}) (slo.SloV00Query , error ) {
417
417
if query ["type" ] == "freeform" {
418
418
freeformquery := query ["freeform" ].([]interface {})[0 ].(map [string ]interface {})
419
419
querystring := freeformquery ["query" ].(string )
420
420
421
- sloQuery := slo.Query {
422
- Freeform : & slo.FreeformQuery {Query : querystring },
421
+ sloQuery := slo.SloV00Query {
422
+ Freeform : & slo.SloV00FreeformQuery {Query : querystring },
423
423
Type : QueryTypeFreeform ,
424
424
}
425
425
@@ -442,12 +442,12 @@ func packQuery(query map[string]interface{}) (slo.Query, error) {
442
442
labels = append (labels , groupByLabels [ind ].(string ))
443
443
}
444
444
445
- sloQuery := slo.Query {
446
- Ratio : & slo.RatioQuery {
447
- SuccessMetric : slo.MetricDef {
445
+ sloQuery := slo.SloV00Query {
446
+ Ratio : & slo.SloV00RatioQuery {
447
+ SuccessMetric : slo.SloV00MetricDef {
448
448
PrometheusMetric : successMetric ,
449
449
},
450
- TotalMetric : slo.MetricDef {
450
+ TotalMetric : slo.SloV00MetricDef {
451
451
PrometheusMetric : totalMetric ,
452
452
},
453
453
GroupByLabels : labels ,
@@ -458,15 +458,15 @@ func packQuery(query map[string]interface{}) (slo.Query, error) {
458
458
return sloQuery , nil
459
459
}
460
460
461
- return slo.Query {}, fmt .Errorf ("%s query type not implemented" , query ["type" ])
461
+ return slo.SloV00Query {}, fmt .Errorf ("%s query type not implemented" , query ["type" ])
462
462
}
463
463
464
- func packObjectives (tfobjectives []interface {}) []slo.Objective {
465
- objectives := []slo.Objective {}
464
+ func packObjectives (tfobjectives []interface {}) []slo.SloV00Objective {
465
+ objectives := []slo.SloV00Objective {}
466
466
467
467
for ind := range tfobjectives {
468
468
tfobjective := tfobjectives [ind ].(map [string ]interface {})
469
- objective := slo.Objective {
469
+ objective := slo.SloV00Objective {
470
470
Value : tfobjective ["value" ].(float64 ),
471
471
Window : tfobjective ["window" ].(string ),
472
472
}
@@ -476,12 +476,12 @@ func packObjectives(tfobjectives []interface{}) []slo.Objective {
476
476
return objectives
477
477
}
478
478
479
- func packLabels (tfLabels []interface {}) []slo.Label {
480
- labelSlice := []slo.Label {}
479
+ func packLabels (tfLabels []interface {}) []slo.SloV00Label {
480
+ labelSlice := []slo.SloV00Label {}
481
481
482
482
for ind := range tfLabels {
483
483
currLabel := tfLabels [ind ].(map [string ]interface {})
484
- curr := slo.Label {
484
+ curr := slo.SloV00Label {
485
485
Key : currLabel ["key" ].(string ),
486
486
Value : currLabel ["value" ].(string ),
487
487
}
@@ -492,11 +492,11 @@ func packLabels(tfLabels []interface{}) []slo.Label {
492
492
return labelSlice
493
493
}
494
494
495
- func packAlerting (tfAlerting map [string ]interface {}) slo.Alerting {
496
- var tfAnnots []slo.Label
497
- var tfLabels []slo.Label
498
- var tfFastBurn slo.AlertingMetadata
499
- var tfSlowBurn slo.AlertingMetadata
495
+ func packAlerting (tfAlerting map [string ]interface {}) slo.SloV00Alerting {
496
+ var tfAnnots []slo.SloV00Label
497
+ var tfLabels []slo.SloV00Label
498
+ var tfFastBurn slo.SloV00AlertingMetadata
499
+ var tfSlowBurn slo.SloV00AlertingMetadata
500
500
501
501
annots , ok := tfAlerting ["annotation" ].([]interface {})
502
502
if ok {
@@ -518,7 +518,7 @@ func packAlerting(tfAlerting map[string]interface{}) slo.Alerting {
518
518
tfSlowBurn = packAlertMetadata (slowBurn )
519
519
}
520
520
521
- alerting := slo.Alerting {
521
+ alerting := slo.SloV00Alerting {
522
522
Annotations : tfAnnots ,
523
523
Labels : tfLabels ,
524
524
FastBurn : & tfFastBurn ,
@@ -528,9 +528,9 @@ func packAlerting(tfAlerting map[string]interface{}) slo.Alerting {
528
528
return alerting
529
529
}
530
530
531
- func packAlertMetadata (metadata []interface {}) slo.AlertingMetadata {
532
- var tflabels []slo.Label
533
- var tfannots []slo.Label
531
+ func packAlertMetadata (metadata []interface {}) slo.SloV00AlertingMetadata {
532
+ var tflabels []slo.SloV00Label
533
+ var tfannots []slo.SloV00Label
534
534
535
535
if len (metadata ) > 0 {
536
536
meta , ok := metadata [0 ].(map [string ]interface {})
@@ -547,15 +547,15 @@ func packAlertMetadata(metadata []interface{}) slo.AlertingMetadata {
547
547
}
548
548
}
549
549
550
- apiMetadata := slo.AlertingMetadata {
550
+ apiMetadata := slo.SloV00AlertingMetadata {
551
551
Labels : tflabels ,
552
552
Annotations : tfannots ,
553
553
}
554
554
555
555
return apiMetadata
556
556
}
557
557
558
- func setTerraformState (d * schema.ResourceData , slo slo.Slo ) {
558
+ func setTerraformState (d * schema.ResourceData , slo slo.SloV00Slo ) {
559
559
d .Set ("name" , slo .Name )
560
560
d .Set ("description" , slo .Description )
561
561
0 commit comments