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.
decort-golang-sdk/pkg/cloudbroker/stpolicy/delete_pool.go

52 lines
1.2 KiB

package stpolicy
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
type DeletePoolRequest struct {
// ID of storage policy
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Storage endpoint provider ID to delete
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Pool to delete
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
}
func (sp StPolicy) DeletePool(ctx context.Context, req DeletePoolRequest) (*InfoStoragePolicyWithID, error) {
res, err := sp.DeletePoolRaw(ctx, req)
if err != nil {
return nil, err
}
info := InfoStoragePolicyWithID{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
func (sp StPolicy) DeletePoolRaw(ctx context.Context, req DeletePoolRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/storage_policy/delete_pool"
res, err := sp.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}