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 9103213 commit e376f41
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 @@ -468,6 +468,7 @@ func ResourceContainerUpdate(ctx context.Context, d *schema.ResourceData, m inte
if err != nil {
return diag.FromErr(err)
}

req.ScalingOption = scalingOptionReq
>>>>>>> d04ca3f0 (feat(container/serverless): add scaling_option block)
}
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 @@ -131,6 +131,7 @@ func setCreateContainerRequest(d *schema.ResourceData, region scw.Region) (*cont
if err != nil {
return nil, err
}

req.ScalingOption = scalingOptionReq
}

Expand Down Expand Up @@ -241,15 +242,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 @@ -258,6 +262,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 e376f41

Please sign in to comment.