Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone committed Feb 14, 2025
1 parent db1dfa3 commit 4351a0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/services/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ func ResourceContainerUpdate(ctx context.Context, d *schema.ResourceData, m inte
if err != nil {
return diag.FromErr(err)
}

req.ScalingOption = scalingOptionReq
}

Expand Down
5 changes: 5 additions & 0 deletions internal/services/container/helpers_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func setCreateContainerRequest(d *schema.ResourceData, region scw.Region) (*cont
if err != nil {
return nil, err
}

req.ScalingOption = scalingOptionReq
}

Expand All @@ -141,15 +142,18 @@ func expandScalingOptions(scalingOptionSchema interface{}) (*container.Container
}

setFields := 0

cso := &container.ContainerScalingOption{}
if concurrentRequestThresold, ok := rawOption["concurrent_requests_threshold"].(int); ok && concurrentRequestThresold != 0 {
cso.ConcurrentRequestsThreshold = scw.Uint32Ptr(uint32(concurrentRequestThresold))
setFields++
}

if cpuUsageThreshold, ok := rawOption["cpu_usage_threshold"].(int); ok && cpuUsageThreshold != 0 {
cso.CPUUsageThreshold = scw.Uint32Ptr(uint32(cpuUsageThreshold))
setFields++
}

if memoryUsageThreshold, ok := rawOption["memory_usage_threshold"].(int); ok && memoryUsageThreshold != 0 {
cso.MemoryUsageThreshold = scw.Uint32Ptr(uint32(memoryUsageThreshold))
setFields++
Expand All @@ -158,6 +162,7 @@ func expandScalingOptions(scalingOptionSchema interface{}) (*container.Container
if setFields > 1 {
return &container.ContainerScalingOption{}, errors.New("a maximum of one scaling option can be set")
}

return cso, nil
}

Expand Down

0 comments on commit 4351a0d

Please sign in to comment.