Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions dynatrace/api/slo/settings/criteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,23 @@ func (me *Criteria) UnmarshalHCL(decoder hcl.Decoder) error {
}

type CriteriaDetail struct {
TimeframeFrom string `json:"timeframeFrom" minlength:"3" maxlength:"30"`
TimeframeTo *string `json:"timeframeTo,omitempty" minlength:"3" maxlength:"30"`
TimeframeFrom string `json:"timeframeFrom"`
TimeframeTo *string `json:"timeframeTo,omitempty"`
Target float64 `json:"target"`
Warning *float64 `json:"warning,omitempty"`
}

func (me *CriteriaDetail) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"timeframe_from": {
Type: schema.TypeString,
Description: "Timeframe from, example: `now-7d`",
Required: true,
ValidateDiagFunc: Validate(ValidateMinLength(3), ValidateMaxLength(30)),
Type: schema.TypeString,
Description: "Timeframe from, example: `now-7d`",
Required: true,
},
"timeframe_to": {
Type: schema.TypeString,
Description: "Timeframe to, example: `now`",
Optional: true,
ValidateDiagFunc: Validate(ValidateMinLength(3), ValidateMaxLength(30)),
Type: schema.TypeString,
Description: "Timeframe to, example: `now`",
Optional: true,
},
"target": {
Type: schema.TypeFloat,
Expand Down
9 changes: 4 additions & 5 deletions dynatrace/api/slo/settings/custom_sli.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ import (
)

type CustomSli struct {
Indicator string `json:"indicator" minlength:"1" maxlength:"2000"`
Indicator string `json:"indicator"`
FilterSegments FilterSegments `json:"filterSegments,omitempty"`
}

func (me *CustomSli) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"indicator": {
Type: schema.TypeString,
Description: "Indicator of the custom SLI. Example: `timeseries sli=avg(dt.host.cpu.idle)`",
Required: true,
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(2000)),
Type: schema.TypeString,
Description: "Indicator of the custom SLI. Example: `timeseries sli=avg(dt.host.cpu.idle)`",
Required: true,
},
"filter_segments": {
Type: schema.TypeList,
Expand Down
2 changes: 1 addition & 1 deletion dynatrace/api/slo/settings/filter_segment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (me *FilterSegmentVariables) UnmarshalHCL(decoder hcl.Decoder) error {

type FilterSegmentVariable struct {
Name string `json:"name"`
Values []string `json:"values" maxlength:"1000"`
Values []string `json:"values"`
}

func (me *FilterSegmentVariable) Schema() map[string]*schema.Schema {
Expand Down
9 changes: 4 additions & 5 deletions dynatrace/api/slo/settings/sli_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ import (
)

type SliReference struct {
TemplateId string `json:"templateId" minlength:"1" maxlength:"800"`
TemplateId string `json:"templateId"`
Variables SliReferenceVariables `json:"variables"`
}

func (me *SliReference) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"template_id": {
Type: schema.TypeString,
Description: "Template ID of the SLI reference",
Required: true,
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(800)),
Type: schema.TypeString,
Description: "Template ID of the SLI reference",
Required: true,
},
"variables": {
Type: schema.TypeList,
Expand Down
18 changes: 8 additions & 10 deletions dynatrace/api/slo/settings/sli_reference_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,21 @@ func (me *SliReferenceVariables) UnmarshalHCL(decoder hcl.Decoder) error {
}

type SliReferenceVariable struct {
Name string `json:"name" maxlength:"60"`
Value string `json:"value" maxlength:"1000"`
Name string `json:"name"`
Value string `json:"value"`
}

func (me *SliReferenceVariable) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the SLI reference variable. Example: `hostIds`",
Required: true,
ValidateDiagFunc: ValidateMaxLength(60),
Type: schema.TypeString,
Description: "Name of the SLI reference variable. Example: `hostIds`",
Required: true,
},
"value": {
Type: schema.TypeString,
Description: "Value of the SLI reference variable. Example: `HOST-123456789ABCDEFG`",
Required: true,
ValidateDiagFunc: ValidateMaxLength(1000),
Type: schema.TypeString,
Description: "Value of the SLI reference variable. Example: `HOST-123456789ABCDEFG`",
Required: true,
},
}
}
Expand Down
18 changes: 8 additions & 10 deletions dynatrace/api/slo/settings/slo.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
const SchemaVersion = "1.0.4"

type SLO struct {
Name string `json:"name" minlength:"1" maxlength:"200"`
Description *string `json:"description,omitempty" minlength:"1" maxlength:"250"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
SliReference *SliReference `json:"sliReference,omitempty"`
CustomSli *CustomSli `json:"customSli,omitempty"`
Criteria Criteria `json:"criteria"`
Expand All @@ -36,16 +36,14 @@ type SLO struct {
func (me *SLO) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "Name of the SLO",
Required: true,
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(200)),
Type: schema.TypeString,
Description: "Name of the SLO",
Required: true,
},
"description": {
Type: schema.TypeString,
Description: "Description of the SLO",
Optional: true,
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(250)),
Type: schema.TypeString,
Description: "Description of the SLO",
Optional: true,
},
"sli_reference": {
Type: schema.TypeList,
Expand Down
205 changes: 0 additions & 205 deletions dynatrace/api/slo/settings/validation.go

This file was deleted.

Loading