@@ -275,7 +275,7 @@ func resourceSloCreate(ctx context.Context, d *schema.ResourceData, client *slo.
275275 return diags
276276 }
277277
278- req := client .DefaultAPI .V1SloPost (ctx ).Slo (sloModel )
278+ req := client .DefaultAPI .V1SloPost (ctx ).SloV00Slo (sloModel )
279279 response , _ , err := req .Execute ()
280280
281281 if err != nil {
@@ -320,7 +320,7 @@ func resourceSloUpdate(ctx context.Context, d *schema.ResourceData, client *slo.
320320 return diags
321321 }
322322
323- req := client .DefaultAPI .V1SloIdPut (ctx , sloID ).Slo (slo )
323+ req := client .DefaultAPI .V1SloIdPut (ctx , sloID ).SloV00Slo (slo )
324324 if _ , err := req .Execute (); err != nil {
325325 return apiError ("Unable to Update SLO - API" , err )
326326 }
@@ -340,19 +340,19 @@ func resourceSloDelete(ctx context.Context, d *schema.ResourceData, client *slo.
340340
341341// Fetches all the Properties defined on the Terraform SLO State Object and converts it
342342// 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 ) {
344344 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
348348 )
349349
350350 tfname := d .Get ("name" ).(string )
351351 tfdescription := d .Get ("description" ).(string )
352352 query := d .Get ("query" ).([]interface {})[0 ].(map [string ]interface {})
353353 tfquery , err := packQuery (query )
354354 if err != nil {
355- return slo.Slo {}, err
355+ return slo.SloV00Slo {}, err
356356 }
357357
358358 objectives := d .Get ("objectives" ).([]interface {})
@@ -363,7 +363,7 @@ func packSloResource(d *schema.ResourceData) (slo.Slo, error) {
363363 tflabels = packLabels (labels )
364364 }
365365
366- slo := slo.Slo {
366+ slo := slo.SloV00Slo {
367367 Uuid : d .Id (),
368368 Name : tfname ,
369369 Description : tfdescription ,
@@ -402,8 +402,8 @@ func packSloResource(d *schema.ResourceData) (slo.Slo, error) {
402402 return slo , nil
403403}
404404
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 {}
407407
408408 if destinationdatasource ["uid" ].(string ) != "" {
409409 datasourceUID := destinationdatasource ["uid" ].(string )
@@ -413,13 +413,13 @@ func packDestinationDatasource(destinationdatasource map[string]interface{}) (sl
413413 return packedDestinationDatasource , nil
414414}
415415
416- func packQuery (query map [string ]interface {}) (slo.Query , error ) {
416+ func packQuery (query map [string ]interface {}) (slo.SloV00Query , error ) {
417417 if query ["type" ] == "freeform" {
418418 freeformquery := query ["freeform" ].([]interface {})[0 ].(map [string ]interface {})
419419 querystring := freeformquery ["query" ].(string )
420420
421- sloQuery := slo.Query {
422- Freeform : & slo.FreeformQuery {Query : querystring },
421+ sloQuery := slo.SloV00Query {
422+ Freeform : & slo.SloV00FreeformQuery {Query : querystring },
423423 Type : QueryTypeFreeform ,
424424 }
425425
@@ -442,12 +442,12 @@ func packQuery(query map[string]interface{}) (slo.Query, error) {
442442 labels = append (labels , groupByLabels [ind ].(string ))
443443 }
444444
445- sloQuery := slo.Query {
446- Ratio : & slo.RatioQuery {
447- SuccessMetric : slo.MetricDef {
445+ sloQuery := slo.SloV00Query {
446+ Ratio : & slo.SloV00RatioQuery {
447+ SuccessMetric : slo.SloV00MetricDef {
448448 PrometheusMetric : successMetric ,
449449 },
450- TotalMetric : slo.MetricDef {
450+ TotalMetric : slo.SloV00MetricDef {
451451 PrometheusMetric : totalMetric ,
452452 },
453453 GroupByLabels : labels ,
@@ -458,15 +458,15 @@ func packQuery(query map[string]interface{}) (slo.Query, error) {
458458 return sloQuery , nil
459459 }
460460
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" ])
462462}
463463
464- func packObjectives (tfobjectives []interface {}) []slo.Objective {
465- objectives := []slo.Objective {}
464+ func packObjectives (tfobjectives []interface {}) []slo.SloV00Objective {
465+ objectives := []slo.SloV00Objective {}
466466
467467 for ind := range tfobjectives {
468468 tfobjective := tfobjectives [ind ].(map [string ]interface {})
469- objective := slo.Objective {
469+ objective := slo.SloV00Objective {
470470 Value : tfobjective ["value" ].(float64 ),
471471 Window : tfobjective ["window" ].(string ),
472472 }
@@ -476,12 +476,12 @@ func packObjectives(tfobjectives []interface{}) []slo.Objective {
476476 return objectives
477477}
478478
479- func packLabels (tfLabels []interface {}) []slo.Label {
480- labelSlice := []slo.Label {}
479+ func packLabels (tfLabels []interface {}) []slo.SloV00Label {
480+ labelSlice := []slo.SloV00Label {}
481481
482482 for ind := range tfLabels {
483483 currLabel := tfLabels [ind ].(map [string ]interface {})
484- curr := slo.Label {
484+ curr := slo.SloV00Label {
485485 Key : currLabel ["key" ].(string ),
486486 Value : currLabel ["value" ].(string ),
487487 }
@@ -492,11 +492,11 @@ func packLabels(tfLabels []interface{}) []slo.Label {
492492 return labelSlice
493493}
494494
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
500500
501501 annots , ok := tfAlerting ["annotation" ].([]interface {})
502502 if ok {
@@ -518,7 +518,7 @@ func packAlerting(tfAlerting map[string]interface{}) slo.Alerting {
518518 tfSlowBurn = packAlertMetadata (slowBurn )
519519 }
520520
521- alerting := slo.Alerting {
521+ alerting := slo.SloV00Alerting {
522522 Annotations : tfAnnots ,
523523 Labels : tfLabels ,
524524 FastBurn : & tfFastBurn ,
@@ -528,9 +528,9 @@ func packAlerting(tfAlerting map[string]interface{}) slo.Alerting {
528528 return alerting
529529}
530530
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
534534
535535 if len (metadata ) > 0 {
536536 meta , ok := metadata [0 ].(map [string ]interface {})
@@ -547,15 +547,15 @@ func packAlertMetadata(metadata []interface{}) slo.AlertingMetadata {
547547 }
548548 }
549549
550- apiMetadata := slo.AlertingMetadata {
550+ apiMetadata := slo.SloV00AlertingMetadata {
551551 Labels : tflabels ,
552552 Annotations : tfannots ,
553553 }
554554
555555 return apiMetadata
556556}
557557
558- func setTerraformState (d * schema.ResourceData , slo slo.Slo ) {
558+ func setTerraformState (d * schema.ResourceData , slo slo.SloV00Slo ) {
559559 d .Set ("name" , slo .Name )
560560 d .Set ("description" , slo .Description )
561561
0 commit comments