Files
decort-golang-sdk/pkg/cloudbroker/sep/add_pool.go

45 lines
1.4 KiB
Go
Raw Normal View History

2024-04-16 14:26:06 +03:00
package sep
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/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"`
2025-12-08 16:16:35 +03:00
// Method Async/Sync
2024-04-16 14:26:06 +03:00
// Default: true
// Required: false
Sync bool `url:"sync" json:"sync"`
2025-12-08 16:16:35 +03:00
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
2024-04-16 14:26:06 +03:00
// Required: true
Pool string `url:"pool" json:"pool" validate:"required"`
}
// AddPool adds pool to SEP
2024-08-26 17:51:34 +03:00
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) {
2024-04-16 14:26:06 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2024-08-26 17:51:34 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
2024-04-16 14:26:06 +03:00
}
url := "/cloudbroker/sep/addPool"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
2024-08-26 17:51:34 +03:00
return "", err
2024-04-16 14:26:06 +03:00
}
2024-08-26 17:51:34 +03:00
result := string(res)
2024-04-16 14:26:06 +03:00
return result, nil
}