v15.0.0
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||
)
|
||||
|
||||
// PFWDelRequest struct to delete port forward rule
|
||||
@@ -36,6 +36,12 @@ type PFWDelRequest struct {
|
||||
Proto string `url:"proto,omitempty" json:"proto,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperPFWDelRequest struct {
|
||||
PFWDelRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// PFWDel deletes port forward rule
|
||||
func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -43,9 +49,14 @@ func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWDelRequest{
|
||||
PFWDelRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -57,3 +68,25 @@ func (c Compute) PFWDel(ctx context.Context, req PFWDelRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// PFWDelAsync deletes port forward rule with AsyncMode
|
||||
func (c Compute) PFWDelAsync(ctx context.Context, req PFWDelRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperPFWDelRequest{
|
||||
PFWDelRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/pfwDel"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user