v15.0.0
This commit is contained in:
43
pkg/cloudbroker/compute/set_cpu_alignment_profile.go
Normal file
43
pkg/cloudbroker/compute/set_cpu_alignment_profile.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||
)
|
||||
|
||||
// SetCPUAlignmentProfileRequest struct to set CPU alignment profile for computes
|
||||
type SetCPUAlignmentProfileRequest struct {
|
||||
// IDs of the compute instances
|
||||
// Required: true
|
||||
ComputeIDs []int64 `url:"compute_ids" json:"compute_ids" validate:"min=1"`
|
||||
|
||||
// CPU alignment profile name
|
||||
// Required: true
|
||||
CPUAlignmentProfile string `url:"cpu_alignment_profile" json:"cpu_alignment_profile" validate:"required"`
|
||||
}
|
||||
|
||||
// SetCPUAlignmentProfile sets CPU alignment profile for computes
|
||||
func (c Compute) SetCPUAlignmentProfile(ctx context.Context, req SetCPUAlignmentProfileRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/set_cpu_alignment_profile"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user