You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dynamix-golang-sdk/pkg/cloudapi/rg/del_storage_policy.go

43 lines
1.1 KiB

1 month ago
package rg
import (
"context"
"net/http"
"strconv"
4 weeks ago
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
1 month ago
)
// DelStoragePolicyRequest struct for deleting storage policy to the resource group
type DelStoragePolicyRequest struct {
// ID of resource group
// Required: true
RGID uint64 `url:"resgroup_id" json:"resgroup_id" validate:"required"`
// ID of the storage policy to which to disconnect account
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
// DelStoragePolicy delete storage policy to the account.
func (r RG) DelStoragePolicy(ctx context.Context, req DelStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/del_storage_policy"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}