Skip to content

Commit fd9c630

Browse files
committed
fix TestAccResourceDataStreamLifecycle
1 parent ce4d128 commit fd9c630

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

internal/clients/elasticsearch/index.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ func GetDataStreamLifecycle(ctx context.Context, apiClient *clients.ApiClient, d
548548
return nil, utils.FrameworkDiagsFromSDK(diags)
549549
}
550550

551-
dStreams := make(map[string][]models.DataStreamLifecycle)
551+
dStreams := &models.DataStreamLifecycleResponse{}
552552
if err := json.NewDecoder(res.Body).Decode(&dStreams); err != nil {
553553
return nil, utils.FrameworkDiagFromError(err)
554554
}
555-
ds := dStreams["data_streams"]
555+
ds := dStreams.DataStreams
556556
return &ds, nil
557557
}
558558

internal/models/models.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,11 @@ type IndexAlias struct {
312312
}
313313

314314
type LifecycleSettings struct {
315-
DataRetention string `json:"data_retention,omitempty"`
316-
Enabled bool `json:"enabled,omitempty"`
317-
Downsampling []Downsampling `json:"downsampling,omitempty"`
315+
DataRetention string `json:"data_retention,omitempty"`
316+
Enabled bool `json:"enabled,omitempty"`
317+
EffectiveRetention string `json:"effective_retention,omitempty"`
318+
RetentionDeterminedBy string `json:"retention_determined_by,omitempty"`
319+
Downsampling []Downsampling `json:"downsampling,omitempty"`
318320
}
319321

320322
type Downsampling struct {
@@ -341,6 +343,16 @@ type DataStreamIndex struct {
341343
IndexUUID string `json:"index_uuid"`
342344
}
343345

346+
type DataStreamLifecycleResponse struct {
347+
DataStreams []DataStreamLifecycle `json:"data_streams"`
348+
GlobalRetention DataStreamGlobalRetention `json:"global_retention"`
349+
}
350+
351+
type DataStreamGlobalRetention struct {
352+
MaxRetention string `json:"max_retention"`
353+
DefaultRetention string `json:"default_retention"`
354+
}
355+
344356
type DataStreamLifecycle struct {
345357
Name string `json:"name"`
346358
Lifecycle LifecycleSettings `json:"lifecycle,omitempty"`

0 commit comments

Comments
 (0)