You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dynamix-golang-sdk/pkg/cloudapi/k8ci/list_deleted.go

61 lines
1.5 KiB

package k8ci
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ListDeletedRequest struct to get list information about deleted k8ci items
type ListDeletedRequest struct {
// Find by ID
// Required: false
ByID uint64 `url:"k8cId,omitempty" json:"k8cId,omitempty"`
// Find by name
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Find by network plugin
// Required: false
NetworkPlugins string `url:"netPlugins,omitempty" json:"netPlugins,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListDeleted gets list all deleted k8ci catalog items available to the current user
func (k K8CI) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListK8CI, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/k8ci/listDeleted"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListK8CI{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}