v9.0.0
This commit is contained in:
43
pkg/cloudbroker/sep/add_pool.go
Normal file
43
pkg/cloudbroker/sep/add_pool.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
|
||||
)
|
||||
|
||||
// AddPoolRequest struct to add pool to storage endpoint (SEP)
|
||||
type AddPoolRequest struct {
|
||||
// ID of SEP to add new pool
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// method Async/Sync
|
||||
// Default: true
|
||||
// Required: false
|
||||
Sync bool `url:"sync" json:"sync"`
|
||||
|
||||
// Pool structure which contains fields such as "name", "types", "accessAccountIds", "accessResGroupIds"
|
||||
// Required: true
|
||||
Pool string `url:"pool" json:"pool" validate:"required"`
|
||||
}
|
||||
|
||||
// AddPool adds pool to SEP
|
||||
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/addPool"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result := string(res)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user