Skip to content

Commit 977afe2

Browse files
committed
PR feedback
1 parent 2d1e391 commit 977afe2

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

internal/elasticsearch/ml/datafeed_state/schema.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func GetSchema() schema.Schema {
5757
MarkdownDescription: "The desired state for the ML datafeed. Valid values are `started` and `stopped`.",
5858
Required: true,
5959
Validators: []validator.String{
60+
// We don't allow starting/stopping here since they're transient states
6061
stringvalidator.OneOf(string(datafeed.StateStarted), string(datafeed.StateStopped)),
6162
},
6263
},

internal/elasticsearch/ml/datafeed_state/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (r *mlDatafeedStateResource) performStateTransition(ctx context.Context, cl
175175
// Return early if no state change is needed
176176
if currentState == desiredState {
177177
tflog.Debug(ctx, fmt.Sprintf("ML datafeed %s is already in desired state %s", datafeedId, desiredState))
178-
return false, nil
178+
return true, nil
179179
}
180180

181181
// Initiate the state change

internal/models/ml.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ type DatafeedNode struct {
125125

126126
// DatafeedRunning represents the running state of a datafeed
127127
type DatafeedRunning struct {
128-
RealTimeConfigured bool `json:"real_time_configured"`
129-
RealTimeRunning bool `json:"real_time_running"`
130-
SearchInterval DatafeedSearchInterval `json:"search_interval,omitempty"`
131-
LastEndTime *time.Time `json:"last_end_time,omitempty"`
128+
RealTimeConfigured bool `json:"real_time_configured"`
129+
RealTimeRunning bool `json:"real_time_running"`
130+
SearchInterval *DatafeedSearchInterval `json:"search_interval,omitempty"`
131+
LastEndTime *time.Time `json:"last_end_time,omitempty"`
132132
}
133133

134134
type DatafeedTimingStats struct {

internal/utils/customtypes/memory_size_value.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (v MemorySize) StringSemanticEquals(_ context.Context, newValuable basetype
6565
newValue, ok := newValuable.(MemorySize)
6666
if !ok {
6767
diags.AddError(
68-
"Semantic Equality Check Error",
68+
"Semantic equality check error",
6969
"An unexpected value type was received while performing semantic equality checks. "+
7070
"Please report this to the provider developers.\n\n"+
7171
"Expected Value Type: "+fmt.Sprintf("%T", v)+"\n"+
@@ -104,19 +104,19 @@ func (v MemorySize) ConvertToMB() (int64, diag.Diagnostics) {
104104
var diags diag.Diagnostics
105105

106106
if v.IsNull() {
107-
diags.Append(diag.NewErrorDiagnostic("Memory Size Parse error", "memory size string value is null"))
107+
diags.Append(diag.NewErrorDiagnostic("Memory size parse error", "memory size string value is null"))
108108
return 0, diags
109109
}
110110

111111
if v.IsUnknown() {
112-
diags.Append(diag.NewErrorDiagnostic("Memory Size Parse Error", "memory size string value is unknown"))
112+
diags.Append(diag.NewErrorDiagnostic("Memory size parse error", "memory size string value is unknown"))
113113
return 0, diags
114114
}
115115

116116
valueString := v.ValueString()
117117
matches := memoryPattern.FindStringSubmatch(valueString)
118118
if len(matches) != 3 {
119-
diags.Append(diag.NewErrorDiagnostic("Memory Size Parse Error",
119+
diags.Append(diag.NewErrorDiagnostic("Memory size parse error",
120120
fmt.Sprintf("invalid memory size format: %s", valueString)))
121121
return 0, diags
122122
}
@@ -125,7 +125,7 @@ func (v MemorySize) ConvertToMB() (int64, diag.Diagnostics) {
125125
numStr := matches[1]
126126
num, err := strconv.ParseInt(numStr, 10, 64)
127127
if err != nil {
128-
diags.Append(diag.NewErrorDiagnostic("Memory Size Parse Error",
128+
diags.Append(diag.NewErrorDiagnostic("Memory size parse error",
129129
fmt.Sprintf("invalid number in memory size: %s", numStr)))
130130
return 0, diags
131131
}
@@ -146,7 +146,7 @@ func (v MemorySize) ConvertToMB() (int64, diag.Diagnostics) {
146146
case "": // no unit = bytes
147147
bytes = num
148148
default:
149-
diags.Append(diag.NewErrorDiagnostic("Memory Size Parse Error",
149+
diags.Append(diag.NewErrorDiagnostic("Memory size parse error",
150150
fmt.Sprintf("unsupported memory unit: %s", unit)))
151151
return 0, diags
152152
}

0 commit comments

Comments
 (0)