This commit is contained in:
2024-03-06 16:50:27 +03:00
parent 16cad7a3e7
commit 83bf1fb1fa
52 changed files with 715 additions and 1968 deletions

View File

@@ -1,36 +0,0 @@
package k8ci
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessAddRequest struct for adding permission to access to account for a k8ci
type AccessAddRequest struct {
// ID of the K8 catalog item to add access for
// Required: true
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
// Account ID to add to the sharedWith access list
// Required: true
AccountId uint64 `url:"accountId" json:"accountId" validate:"required"`
}
// Add accountId to sharedWith access list for k8ci.
func (k K8CI) AccessAdd (ctx context.Context, req AccessAddRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/k8ci/accessAdd"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -1,36 +0,0 @@
package k8ci
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AccessRemoveRequest struct for removing permission to access to account for a k8ci
type AccessRemoveRequest struct {
// ID of the K8 catalog item to remove access for
// Required: true
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
// Account ID to be removed from the sharedWith access list
// Required: true
AccountId uint64 `url:"accountId" json:"accountId" validate:"required"`
}
// Remove accountId from sharedWith access list for k8ci.
func (k K8CI) AccessRemove (ctx context.Context, req AccessRemoveRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/k8ci/accessRemove"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
return string(res), nil
}

View File

@@ -60,7 +60,7 @@ type CreateRequest struct {
MaxWorkerCount uint64 `url:"maxWorkerCount" json:"maxWorkerCount" validate:"required"`
// Network plugins
// Values of slice must be flannel, weawenet or calico
// Values of slice must be flannel, weavenet or calico
//Required: true
NetworkPlugins []string `url:"networkPlugins" json:"networkPlugins" validate:"required,networkPlugins"`
}

View File

@@ -16,7 +16,7 @@ type DeleteRequest struct {
// Delete permanently or not
// Required: false
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
Permanently bool `url:"permanently" json:"permanently"`
}
// Delete deletes K8CI by ID