Skip to content

Commit 18dbcd2

Browse files
committed
chore: dynatrace_platform_slo remove character length checks
Each change on the API side would mean that we have to update and release the provider to match the character length. As this is not feasible, we decide to not do any character length validation
1 parent 310e760 commit 18dbcd2

File tree

7 files changed

+33
-246
lines changed

7 files changed

+33
-246
lines changed

dynatrace/api/slo/settings/criteria.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,23 @@ func (me *Criteria) UnmarshalHCL(decoder hcl.Decoder) error {
4545
}
4646

4747
type CriteriaDetail struct {
48-
TimeframeFrom string `json:"timeframeFrom" minlength:"3" maxlength:"30"`
49-
TimeframeTo *string `json:"timeframeTo,omitempty" minlength:"3" maxlength:"30"`
48+
TimeframeFrom string `json:"timeframeFrom"`
49+
TimeframeTo *string `json:"timeframeTo,omitempty"`
5050
Target float64 `json:"target"`
5151
Warning *float64 `json:"warning,omitempty"`
5252
}
5353

5454
func (me *CriteriaDetail) Schema() map[string]*schema.Schema {
5555
return map[string]*schema.Schema{
5656
"timeframe_from": {
57-
Type: schema.TypeString,
58-
Description: "Timeframe from, example: `now-7d`",
59-
Required: true,
60-
ValidateDiagFunc: Validate(ValidateMinLength(3), ValidateMaxLength(30)),
57+
Type: schema.TypeString,
58+
Description: "Timeframe from, example: `now-7d`",
59+
Required: true,
6160
},
6261
"timeframe_to": {
63-
Type: schema.TypeString,
64-
Description: "Timeframe to, example: `now`",
65-
Optional: true,
66-
ValidateDiagFunc: Validate(ValidateMinLength(3), ValidateMaxLength(30)),
62+
Type: schema.TypeString,
63+
Description: "Timeframe to, example: `now`",
64+
Optional: true,
6765
},
6866
"target": {
6967
Type: schema.TypeFloat,

dynatrace/api/slo/settings/custom_sli.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ import (
2323
)
2424

2525
type CustomSli struct {
26-
Indicator string `json:"indicator" minlength:"1" maxlength:"2000"`
26+
Indicator string `json:"indicator"`
2727
FilterSegments FilterSegments `json:"filterSegments,omitempty"`
2828
}
2929

3030
func (me *CustomSli) Schema() map[string]*schema.Schema {
3131
return map[string]*schema.Schema{
3232
"indicator": {
33-
Type: schema.TypeString,
34-
Description: "Indicator of the custom SLI. Example: `timeseries sli=avg(dt.host.cpu.idle)`",
35-
Required: true,
36-
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(2000)),
33+
Type: schema.TypeString,
34+
Description: "Indicator of the custom SLI. Example: `timeseries sli=avg(dt.host.cpu.idle)`",
35+
Required: true,
3736
},
3837
"filter_segments": {
3938
Type: schema.TypeList,

dynatrace/api/slo/settings/filter_segment_variables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (me *FilterSegmentVariables) UnmarshalHCL(decoder hcl.Decoder) error {
4646

4747
type FilterSegmentVariable struct {
4848
Name string `json:"name"`
49-
Values []string `json:"values" maxlength:"1000"`
49+
Values []string `json:"values"`
5050
}
5151

5252
func (me *FilterSegmentVariable) Schema() map[string]*schema.Schema {

dynatrace/api/slo/settings/sli_reference.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ import (
2323
)
2424

2525
type SliReference struct {
26-
TemplateId string `json:"templateId" minlength:"1" maxlength:"800"`
26+
TemplateId string `json:"templateId"`
2727
Variables SliReferenceVariables `json:"variables"`
2828
}
2929

3030
func (me *SliReference) Schema() map[string]*schema.Schema {
3131
return map[string]*schema.Schema{
3232
"template_id": {
33-
Type: schema.TypeString,
34-
Description: "Template ID of the SLI reference",
35-
Required: true,
36-
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(800)),
33+
Type: schema.TypeString,
34+
Description: "Template ID of the SLI reference",
35+
Required: true,
3736
},
3837
"variables": {
3938
Type: schema.TypeList,

dynatrace/api/slo/settings/sli_reference_variables.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,21 @@ func (me *SliReferenceVariables) UnmarshalHCL(decoder hcl.Decoder) error {
4545
}
4646

4747
type SliReferenceVariable struct {
48-
Name string `json:"name" maxlength:"60"`
49-
Value string `json:"value" maxlength:"1000"`
48+
Name string `json:"name"`
49+
Value string `json:"value"`
5050
}
5151

5252
func (me *SliReferenceVariable) Schema() map[string]*schema.Schema {
5353
return map[string]*schema.Schema{
5454
"name": {
55-
Type: schema.TypeString,
56-
Description: "Name of the SLI reference variable. Example: `hostIds`",
57-
Required: true,
58-
ValidateDiagFunc: ValidateMaxLength(60),
55+
Type: schema.TypeString,
56+
Description: "Name of the SLI reference variable. Example: `hostIds`",
57+
Required: true,
5958
},
6059
"value": {
61-
Type: schema.TypeString,
62-
Description: "Value of the SLI reference variable. Example: `HOST-123456789ABCDEFG`",
63-
Required: true,
64-
ValidateDiagFunc: ValidateMaxLength(1000),
60+
Type: schema.TypeString,
61+
Description: "Value of the SLI reference variable. Example: `HOST-123456789ABCDEFG`",
62+
Required: true,
6563
},
6664
}
6765
}

dynatrace/api/slo/settings/slo.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
const SchemaVersion = "1.0.4"
2626

2727
type SLO struct {
28-
Name string `json:"name" minlength:"1" maxlength:"200"`
29-
Description *string `json:"description,omitempty" minlength:"1" maxlength:"250"`
28+
Name string `json:"name"`
29+
Description *string `json:"description,omitempty"`
3030
SliReference *SliReference `json:"sliReference,omitempty"`
3131
CustomSli *CustomSli `json:"customSli,omitempty"`
3232
Criteria Criteria `json:"criteria"`
@@ -36,16 +36,14 @@ type SLO struct {
3636
func (me *SLO) Schema() map[string]*schema.Schema {
3737
return map[string]*schema.Schema{
3838
"name": {
39-
Type: schema.TypeString,
40-
Description: "Name of the SLO",
41-
Required: true,
42-
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(200)),
39+
Type: schema.TypeString,
40+
Description: "Name of the SLO",
41+
Required: true,
4342
},
4443
"description": {
45-
Type: schema.TypeString,
46-
Description: "Description of the SLO",
47-
Optional: true,
48-
ValidateDiagFunc: Validate(ValidateMinLength(1), ValidateMaxLength(250)),
44+
Type: schema.TypeString,
45+
Description: "Description of the SLO",
46+
Optional: true,
4947
},
5048
"sli_reference": {
5149
Type: schema.TypeList,

dynatrace/api/slo/settings/validation.go

Lines changed: 0 additions & 205 deletions
This file was deleted.

0 commit comments

Comments
 (0)