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/k8s/delete_master_from_group.go

47 lines
1.2 KiB

package k8s
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeleteMasterFromGroupRequest struct to delete master from group
type DeleteMasterFromGroupRequest struct {
// Kubernetes cluster ID
// Required: true
K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"`
// ID of the masters compute group
// Required: true
MasterGroupID uint64 `url:"masterGroupId" json:"masterGroupId" validate:"required"`
// List of Compute IDs of master nodes to delete
// Required: true
MasterIDs []uint64 `url:"masterIds" json:"masterIds" validate:"min=1"`
}
// DeleteMasterFromGroup deletes compute from masters group in selected Kubernetes cluster
func (k8s K8S) DeleteMasterFromGroup(ctx context.Context, req DeleteMasterFromGroupRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/k8s/deleteMasterFromGroup"
res, err := k8s.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
}