Skip to content

Commit 6c74e64

Browse files
authored
Bugfix SLO API: Update type for group_by to accept either string or array-of-strings (#701)
- Starting with 8.14.0, the API can now return a list of strings instead of just a string. - To be able to handle both old and new APIs, the spec has been updated to accept either a string or a list of strings. - This change only ensures that the provider doesn't crash with the new API, there is no support yet for multiple group-by arguments.
1 parent d400796 commit 6c74e64

File tree

12 files changed

+231
-35
lines changed

12 files changed

+231
-35
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683))
55
- Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696))
66
- Support setting `restriction` in `elasticstack_elasticsearch_security_api_key` role definitions ([#577](https://github.com/elastic/terraform-provider-elasticstack/pull/577))
7+
- Fix type of `group_by` attribute in the `kibana_slo` resource to be compatible with versions 8.14+ ([#701](https://github.com/elastic/terraform-provider-elasticstack/pull/701))
78

89
## [0.11.4] - 2024-06-13
910

generated/slo-spec.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,11 @@ components:
11731173
example: true
11741174
groupBy:
11751175
description: optional group by field to use to generate an SLO per distinct value
1176-
type: string
1176+
oneOf:
1177+
- type: string
1178+
- type: array
1179+
items:
1180+
type: string
11771181
example: some.field
11781182
instanceId:
11791183
description: the value derived from the groupBy field, if present, otherwise '*'
@@ -1320,7 +1324,11 @@ components:
13201324
$ref: '#/components/schemas/settings'
13211325
groupBy:
13221326
description: optional group by field to use to generate an SLO per distinct value
1323-
type: string
1327+
oneOf:
1328+
- type: string
1329+
- type: array
1330+
items:
1331+
type: string
13241332
example: some.field
13251333
tags:
13261334
description: List of tags

generated/slo/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ docs/Objective.md
4545
docs/Settings.md
4646
docs/SloAPI.md
4747
docs/SloResponse.md
48+
docs/SloResponseGroupBy.md
4849
docs/SloResponseIndicator.md
4950
docs/Summary.md
5051
docs/SummaryStatus.md
@@ -94,6 +95,7 @@ model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go
9495
model_objective.go
9596
model_settings.go
9697
model_slo_response.go
98+
model_slo_response_group_by.go
9799
model_slo_response_indicator.go
98100
model_summary.go
99101
model_summary_status.go

generated/slo/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Class | Method | HTTP request | Description
128128
- [Objective](docs/Objective.md)
129129
- [Settings](docs/Settings.md)
130130
- [SloResponse](docs/SloResponse.md)
131+
- [SloResponseGroupBy](docs/SloResponseGroupBy.md)
131132
- [SloResponseIndicator](docs/SloResponseIndicator.md)
132133
- [Summary](docs/Summary.md)
133134
- [SummaryStatus](docs/SummaryStatus.md)

generated/slo/api/openapi.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,7 @@ components:
10621062
example: true
10631063
type: boolean
10641064
groupBy:
1065-
description: optional group by field to use to generate an SLO per distinct
1066-
value
1067-
example: some.field
1068-
type: string
1065+
$ref: '#/components/schemas/slo_response_groupBy'
10691066
instanceId:
10701067
description: "the value derived from the groupBy field, if present, otherwise\
10711068
\ '*'"
@@ -1289,10 +1286,7 @@ components:
12891286
settings:
12901287
$ref: '#/components/schemas/settings'
12911288
groupBy:
1292-
description: optional group by field to use to generate an SLO per distinct
1293-
value
1294-
example: some.field
1295-
type: string
1289+
$ref: '#/components/schemas/slo_response_groupBy'
12961290
tags:
12971291
description: List of tags
12981292
items:
@@ -1783,6 +1777,15 @@ components:
17831777
- $ref: '#/components/schemas/indicator_properties_custom_metric'
17841778
- $ref: '#/components/schemas/indicator_properties_histogram'
17851779
- $ref: '#/components/schemas/indicator_properties_timeslice_metric'
1780+
slo_response_groupBy:
1781+
description: optional group by field to use to generate an SLO per distinct
1782+
value
1783+
example: some.field
1784+
oneOf:
1785+
- type: string
1786+
- items:
1787+
type: string
1788+
type: array
17861789
create_slo_request_indicator:
17871790
oneOf:
17881791
- $ref: '#/components/schemas/indicator_properties_custom_kql'

generated/slo/docs/CreateSloRequest.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
1212
**BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | |
1313
**Objective** | [**Objective**](Objective.md) | |
1414
**Settings** | Pointer to [**Settings**](Settings.md) | | [optional]
15-
**GroupBy** | Pointer to **string** | optional group by field to use to generate an SLO per distinct value | [optional]
15+
**GroupBy** | Pointer to [**SloResponseGroupBy**](SloResponseGroupBy.md) | | [optional]
1616
**Tags** | Pointer to **[]string** | List of tags | [optional]
1717

1818
## Methods
@@ -206,20 +206,20 @@ HasSettings returns a boolean if a field has been set.
206206

207207
### GetGroupBy
208208

209-
`func (o *CreateSloRequest) GetGroupBy() string`
209+
`func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy`
210210

211211
GetGroupBy returns the GroupBy field if non-nil, zero value otherwise.
212212

213213
### GetGroupByOk
214214

215-
`func (o *CreateSloRequest) GetGroupByOk() (*string, bool)`
215+
`func (o *CreateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool)`
216216

217217
GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise
218218
and a boolean to check if the value has been set.
219219

220220
### SetGroupBy
221221

222-
`func (o *CreateSloRequest) SetGroupBy(v string)`
222+
`func (o *CreateSloRequest) SetGroupBy(v SloResponseGroupBy)`
223223

224224
SetGroupBy sets GroupBy field to given value.
225225

generated/slo/docs/SloResponse.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Name | Type | Description | Notes
1515
**Revision** | **float64** | The SLO revision |
1616
**Summary** | [**Summary**](Summary.md) | |
1717
**Enabled** | **bool** | Indicate if the SLO is enabled |
18-
**GroupBy** | **string** | optional group by field to use to generate an SLO per distinct value |
18+
**GroupBy** | [**SloResponseGroupBy**](SloResponseGroupBy.md) | |
1919
**InstanceId** | **string** | the value derived from the groupBy field, if present, otherwise '*' |
2020
**Tags** | **[]string** | List of tags |
2121
**CreatedAt** | **string** | The creation date |
@@ -25,7 +25,7 @@ Name | Type | Description | Notes
2525

2626
### NewSloResponse
2727

28-
`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, tags []string, createdAt string, updatedAt string, ) *SloResponse`
28+
`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy SloResponseGroupBy, instanceId string, tags []string, createdAt string, updatedAt string, ) *SloResponse`
2929

3030
NewSloResponse instantiates a new SloResponse object
3131
This constructor will assign default values to properties that have it defined,
@@ -262,20 +262,20 @@ SetEnabled sets Enabled field to given value.
262262

263263
### GetGroupBy
264264

265-
`func (o *SloResponse) GetGroupBy() string`
265+
`func (o *SloResponse) GetGroupBy() SloResponseGroupBy`
266266

267267
GetGroupBy returns the GroupBy field if non-nil, zero value otherwise.
268268

269269
### GetGroupByOk
270270

271-
`func (o *SloResponse) GetGroupByOk() (*string, bool)`
271+
`func (o *SloResponse) GetGroupByOk() (*SloResponseGroupBy, bool)`
272272

273273
GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise
274274
and a boolean to check if the value has been set.
275275

276276
### SetGroupBy
277277

278-
`func (o *SloResponse) SetGroupBy(v string)`
278+
`func (o *SloResponse) SetGroupBy(v SloResponseGroupBy)`
279279

280280
SetGroupBy sets GroupBy field to given value.
281281

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SloResponseGroupBy
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
8+
## Methods
9+
10+
### NewSloResponseGroupBy
11+
12+
`func NewSloResponseGroupBy() *SloResponseGroupBy`
13+
14+
NewSloResponseGroupBy instantiates a new SloResponseGroupBy object
15+
This constructor will assign default values to properties that have it defined,
16+
and makes sure properties required by API are set, but the set of arguments
17+
will change when the set of required properties is changed
18+
19+
### NewSloResponseGroupByWithDefaults
20+
21+
`func NewSloResponseGroupByWithDefaults() *SloResponseGroupBy`
22+
23+
NewSloResponseGroupByWithDefaults instantiates a new SloResponseGroupBy object
24+
This constructor will only assign default values to properties that have it defined,
25+
but it doesn't guarantee that properties required by API are set
26+
27+
28+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
29+
30+

generated/slo/model_create_slo_request.go

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/slo/model_slo_response.go

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)