This commit is contained in:
2026-08-21 17:52:28 +04:00
parent d7b8f08b4d
commit eb195dd992
116 changed files with 2719 additions and 1973 deletions

View File

@@ -1,43 +0,0 @@
package sep
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessGrantRequest struct to grant access to SEP
type AccessGrantRequest struct {
// Storage endpoint provider ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Account ID to grant access to the specified SEP. If 0,
// the SEP will be available for all accounts with no exceptions
// Required: true
AccountID uint64 `url:"account_id" json:"account_id" validate:"required"`
}
// AccessGrant grants access to SEP
func (s SEP) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/sep/accessGrant"
res, err := s.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
}

View File

@@ -1,50 +0,0 @@
package sep
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessGrantToPoolRequest struct to grant access to pool SEP
type AccessGrantToPoolRequest struct {
// Storage endpoint provider ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Pool name
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
// Account ID to grant access to the specified pool SEP
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Resource group to grant access to the specified pool SEP
// Required: false
RGID uint64 `url:"resgroup_id,omitempty" json:"resgroup_id,omitempty"`
}
// AccessGrantToPool grants access to pool SEP
func (s SEP) AccessGrantToPool(ctx context.Context, req AccessGrantToPoolRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/sep/accessGrantToPool"
res, err := s.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
}

View File

@@ -1,42 +0,0 @@
package sep
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessRevokeRequest struct to revoke access to SEP
type AccessRevokeRequest struct {
// Storage endpoint provider ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Account ID to revoke access to the specified SEP
// Required: true
AccountID uint64 `url:"account_id" json:"account_id" validate:"required"`
}
// AccessRevoke revokes access to SEP
func (s SEP) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/sep/accessRevoke"
res, err := s.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
}

View File

@@ -1,50 +0,0 @@
package sep
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessRevokeToPoolRequest struct to revoke access to pool SEP
type AccessRevokeToPoolRequest struct {
// Storage endpoint provider ID
// Required: true
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
// Pool name
// Required: true
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
// Account ID to grant access to the specified pool SEP
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Resource group ID to grant access to the specified pool SEP
// Required: false
RGID uint64 `url:"resgroup_id,omitempty" json:"resgroup_id,omitempty"`
}
// AccessRevokeToPool revokes access to pool SEP
func (s SEP) AccessRevokeToPool(ctx context.Context, req AccessRevokeToPoolRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/sep/accessRevokeToPool"
res, err := s.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
}