v2.0.0-rc.9
This commit is contained in:
1 parent
eaf2672f6b
commit
76efee844d
329 files changed
+10154
-5210
No files matched your search
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeAPISIXService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the apisix is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s apisix pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get apisix by id
|
||||
func (a *DeAPISIXService) Describe(ctx context.Context, req DescribeRequest) (DescribeAPISIXResult, error) {
|
||||
func (a *DeAPISIXService) Describe(ctx context.Context, body DescribeAPISIXRequest) (DescribeAPISIXResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeAPISIXService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeAPISIXService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/apisix/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeAPISIXService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,35 +94,8 @@ func (a *DeAPISIXService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// hostname for apisix
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// http port
|
||||
//
|
||||
// Required.
|
||||
HTTPPort int64 `json:"httpPort" form:"httpPort"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// https port
|
||||
HTTPSPort int64 `json:"httpsPort" form:"httpsPort"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install apisix in cluster
|
||||
func (a *DeAPISIXService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeAPISIXService) Install(ctx context.Context, body InstallAPISIXRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -147,14 +107,8 @@ func (a *DeAPISIXService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.HTTPPort) {
|
||||
missingRequiredParams = append(missingRequiredParams, "httpPort")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -163,7 +117,7 @@ func (a *DeAPISIXService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/apisix/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -177,15 +131,7 @@ func (a *DeAPISIXService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "httpPort", req.HTTPPort, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "httpsPort", req.HTTPSPort, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -228,19 +174,8 @@ func (a *DeAPISIXService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the apisix even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall apisix from cluster
|
||||
func (a *DeAPISIXService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeAPISIXService) Uninstall(ctx context.Context, body UninstallAPISIXRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -252,8 +187,8 @@ func (a *DeAPISIXService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -262,7 +197,7 @@ func (a *DeAPISIXService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/apisix/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -276,9 +211,7 @@ func (a *DeAPISIXService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_apisix
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,26 @@
|
||||
|
||||
package de_apisix
|
||||
|
||||
type APISIXInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
HTTPPort int64 `json:"httpPort"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type APISIXRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -17,6 +37,12 @@ type APISIXRecord struct {
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeAPISIXRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeAPISIXResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -31,3 +57,18 @@ type DescribeAPISIXResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeAPISIXResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallAPISIXRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params APISIXInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallAPISIXRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_apisix
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_argocd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeArgocdService service
|
||||
|
||||
// Get argocd by id
|
||||
func (a *DeArgocdService) Describe(ctx context.Context, body DescribeArgocdRequest) (DescribeArgocdResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeArgocdResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/argocd/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeArgocdResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install argocd in cluster
|
||||
func (a *DeArgocdService) Install(ctx context.Context, body InstallArgocdRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/argocd/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall argocd from cluster
|
||||
func (a *DeArgocdService) Uninstall(ctx context.Context, body UninstallArgocdRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/argocd/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_argocd
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeArgocd *DeArgocdService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeArgocd = (*DeArgocdService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_argocd
|
||||
|
||||
type ArgocdInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type ArgocdRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeArgocdRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeArgocdResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry ArgocdRecord `json:"registry,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeArgocdResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeArgocdResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallArgocdRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params ArgocdInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallArgocdRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_argocd
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeAuditsService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_audits
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_audits
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeAutoscalerService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_autoscaler
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_cdxgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCdxgenService service
|
||||
|
||||
// Get Cdxgen info by cluster id
|
||||
func (a *DeCdxgenService) Describe(ctx context.Context, body DescribeCdxgenRequest) (DescribeCdxgenResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeCdxgenResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/cdxgen/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeCdxgenResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install Cdxgen in cluster
|
||||
func (a *DeCdxgenService) Install(ctx context.Context, body InstallCdxgenRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/cdxgen/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall Cdxgen from cluster
|
||||
func (a *DeCdxgenService) Uninstall(ctx context.Context, body UninstallCdxgenRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/cdxgen/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_cdxgen
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeCdxgen *DeCdxgenService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeCdxgen = (*DeCdxgenService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_cdxgen
|
||||
|
||||
type CdxgenInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type CdxgenRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeCdxgenRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeCdxgenResult struct {
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry CdxgenRecord `json:"registry,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeCdxgenResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeCdxgenResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCdxgenRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params CdxgenInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallCdxgenRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_cdxgen
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCertificatesService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_certificates
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCertmanagerService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the certmanager is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s certmanager pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"CheckLiveness" form:"CheckLiveness"`
|
||||
}
|
||||
|
||||
// Get certmanager by id
|
||||
func (a *DeCertmanagerService) Describe(ctx context.Context, req DescribeRequest) (DescribeCertmanagerResult, error) {
|
||||
func (a *DeCertmanagerService) Describe(ctx context.Context, body DescribeCertmanagerRequest) (DescribeCertmanagerResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeCertmanagerService) Describe(ctx context.Context, req DescribeRequest
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeCertmanagerService) Describe(ctx context.Context, req DescribeRequest
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/certmanager/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeCertmanagerService) Describe(ctx context.Context, req DescribeRequest
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "CheckLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,29 +94,8 @@ func (a *DeCertmanagerService) Describe(ctx context.Context, req DescribeRequest
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// Cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// Hostname for certmanager
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name for certmanager
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install certmanager in cluster
|
||||
func (a *DeCertmanagerService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeCertmanagerService) Install(ctx context.Context, body InstallCertmanagerRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -141,11 +107,8 @@ func (a *DeCertmanagerService) Install(ctx context.Context, req InstallRequest)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -154,7 +117,7 @@ func (a *DeCertmanagerService) Install(ctx context.Context, req InstallRequest)
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/certmanager/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -168,13 +131,7 @@ func (a *DeCertmanagerService) Install(ctx context.Context, req InstallRequest)
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -217,19 +174,8 @@ func (a *DeCertmanagerService) Install(ctx context.Context, req InstallRequest)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the certmanager even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall certmanager from cluster
|
||||
func (a *DeCertmanagerService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeCertmanagerService) Uninstall(ctx context.Context, body UninstallCertmanagerRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -241,8 +187,8 @@ func (a *DeCertmanagerService) Uninstall(ctx context.Context, req UninstallReque
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -251,7 +197,7 @@ func (a *DeCertmanagerService) Uninstall(ctx context.Context, req UninstallReque
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/certmanager/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -265,9 +211,7 @@ func (a *DeCertmanagerService) Uninstall(ctx context.Context, req UninstallReque
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_certmanager
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,25 @@
|
||||
|
||||
package de_certmanager
|
||||
|
||||
type CertmanagerInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type CertmanagerRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
CACert string `json:"caCert,omitempty"`
|
||||
@@ -17,6 +36,12 @@ type CertmanagerRecord struct {
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeCertmanagerRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeCertmanagerResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -31,3 +56,18 @@ type DescribeCertmanagerResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeCertmanagerResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCertmanagerRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params CertmanagerInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallCertmanagerRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_certmanager
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
+344
-838
File diff suppressed because it is too large.
Load diff
@@ -3,8 +3,8 @@
|
||||
package de_cluster
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
+728
-12
@@ -2,6 +2,20 @@
|
||||
|
||||
package de_cluster
|
||||
|
||||
type BalancerForwarding struct {
|
||||
CreatedAt int64 `json:"createdAt,omitempty"`
|
||||
CustomServerSettings bool `json:"customServerSettings,omitempty"`
|
||||
ForwardingPort int64 `json:"forwardingPort,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Server BalancerServerSettings `json:"server,omitempty"`
|
||||
ServiceName string `json:"serviceName,omitempty"`
|
||||
TargetAddresses []string `json:"targetAddresses,omitempty"`
|
||||
TargetPort int64 `json:"targetPort,omitempty"`
|
||||
UpdatedAt int64 `json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
type BalancerHaproxyInfo struct {
|
||||
ConfigValid bool `json:"configValid,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
@@ -55,6 +69,217 @@ type BalancerVrrpData struct {
|
||||
WantState string `json:"wantState,omitempty"`
|
||||
}
|
||||
|
||||
type BriefConfigMap struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Keys int64 `json:"keys,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type BriefCronJob struct {
|
||||
Active int64 `json:"active,omitempty"`
|
||||
Age string `json:"age,omitempty"`
|
||||
LastSchedule string `json:"lastSchedule,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
NextExecution string `json:"nextExecution,omitempty"`
|
||||
Schedule string `json:"schedule,omitempty"`
|
||||
Suspend string `json:"suspend,omitempty"`
|
||||
TimeZone string `json:"timeZone,omitempty"`
|
||||
}
|
||||
|
||||
type BriefDaemonSet struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Available int64 `json:"available,omitempty"`
|
||||
Current int64 `json:"current,omitempty"`
|
||||
Desired int64 `json:"desired,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
NodeSelector string `json:"nodeSelector,omitempty"`
|
||||
Ready int64 `json:"ready,omitempty"`
|
||||
Updated int64 `json:"updated,omitempty"`
|
||||
}
|
||||
|
||||
type BriefDeployment struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Pods string `json:"pods,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type BriefEndpointSlices struct {
|
||||
AddressType string `json:"addressType,omitempty"`
|
||||
Age string `json:"age,omitempty"`
|
||||
Endpoints []string `json:"endpoints,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Ports []string `json:"ports,omitempty"`
|
||||
}
|
||||
|
||||
type BriefEvent struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Count int64 `json:"count,omitempty"`
|
||||
InvolvedObject BriefInvolvedObject `json:"involvedObject,omitempty"`
|
||||
LastSeen string `json:"lastSeen,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type BriefHorizontalPodAutoscalers struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
MaxPods int64 `json:"maxPods,omitempty"`
|
||||
Metrics string `json:"metrics,omitempty"`
|
||||
MinPods int64 `json:"minPods,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Replicas int64 `json:"replicas,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type BriefIngress struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
LoadBalancers string `json:"loadBalancers,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type BriefIngressClass struct {
|
||||
APIGroup string `json:"apiGroup,omitempty"`
|
||||
Controller string `json:"controller,omitempty"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
type BriefInvolvedObject struct {
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
type BriefJob struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Completions string `json:"completions,omitempty"`
|
||||
Conditions string `json:"conditions,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type BriefLimitRange struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type BriefNamespace struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Labels string `json:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type BriefNetworkPolicy struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
PolicyTypes string `json:"policyTypes,omitempty"`
|
||||
}
|
||||
|
||||
type BriefPersistentVolume struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Capacity string `json:"capacity,omitempty"`
|
||||
Claim string `json:"claim,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
}
|
||||
|
||||
type BriefPersistentVolumeClaim struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Pods string `json:"pods,omitempty"`
|
||||
Size string `json:"size,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
}
|
||||
|
||||
type BriefPod struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
ControlledBy string `json:"controlledBy,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Node string `json:"node,omitempty"`
|
||||
QoSClass string `json:"qosClass,omitempty"`
|
||||
Ready string `json:"ready,omitempty"`
|
||||
Restarts int64 `json:"restarts,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type BriefReplicaSets struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Current int64 `json:"current,omitempty"`
|
||||
Desired int64 `json:"desired,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Ready int64 `json:"ready,omitempty"`
|
||||
}
|
||||
|
||||
type BriefReplicationController struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Desired int64 `json:"desired,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Replicas int64 `json:"replicas,omitempty"`
|
||||
Selector string `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
type BriefResourceQuota struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type BriefSecret struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Keys int64 `json:"keys,omitempty"`
|
||||
Labels string `json:"labels,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type BriefService struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
ClusterIP string `json:"clusterIP,omitempty"`
|
||||
ExternalIP string `json:"externalIP,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Ports []string `json:"ports,omitempty"`
|
||||
Selector string `json:"selector,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type BriefStatefulSet struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Pods string `json:"pods,omitempty"`
|
||||
Replicas int64 `json:"replicas,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type BriefStorageClass struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Default string `json:"default,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Provisioner string `json:"provisioner,omitempty"`
|
||||
ReclaimPolicy string `json:"reclaimPolicy,omitempty"`
|
||||
}
|
||||
|
||||
type Cluster struct {
|
||||
AppContainerRepository string `json:"appContainerRepository,omitempty"`
|
||||
AuditEnabled bool `json:"auditEnabled,omitempty"`
|
||||
@@ -78,17 +303,17 @@ type Cluster struct {
|
||||
DomainResolvers []string `json:"domainResolvers,omitempty"`
|
||||
DynamixCIID int64 `json:"dynamixCIId,omitempty"`
|
||||
DynamixCreateTaskID string `json:"dynamixCreateTaskId,omitempty"`
|
||||
DynamixID int64 `json:"dynamixId,omitempty"`
|
||||
DynamixK8CIID int64 `json:"dynamixK8CIId,omitempty"`
|
||||
DynamixOwnerID int64 `json:"dynamixOwnerId,omitempty"`
|
||||
DynamixRGID int64 `json:"dynamixRGId,omitempty"`
|
||||
DynamixSEPID int64 `json:"dynamixSEPId,omitempty"`
|
||||
DynamixSEPPool string `json:"dynamixSEPPool,omitempty"`
|
||||
DynamixStatus string `json:"dynamixStatus,omitempty"`
|
||||
DynamixTechStatus string `json:"dynamixTechStatus,omitempty"`
|
||||
// Dynamyx data
|
||||
DynamixURL string `json:"dynamixURL,omitempty"`
|
||||
DynamixVersion DynamixVersion `json:"dynamixVersion,omitempty"`
|
||||
DynamixID int64 `json:"dynamixId,omitempty"`
|
||||
DynamixK8CIID int64 `json:"dynamixK8CIId,omitempty"`
|
||||
DynamixOwnerID int64 `json:"dynamixOwnerId,omitempty"`
|
||||
DynamixPlatform DynamixPlatform `json:"dynamixPlatform,omitempty"`
|
||||
DynamixRGID int64 `json:"dynamixRGId,omitempty"`
|
||||
DynamixSEPID int64 `json:"dynamixSEPId,omitempty"`
|
||||
DynamixSEPPool string `json:"dynamixSEPPool,omitempty"`
|
||||
DynamixStatus string `json:"dynamixStatus,omitempty"`
|
||||
DynamixTechStatus string `json:"dynamixTechStatus,omitempty"`
|
||||
DynamixVersion DynamixVersion `json:"dynamixVersion,omitempty"`
|
||||
// Data encryption information
|
||||
Encrypted bool `json:"encrypted,omitempty"`
|
||||
EssAuthToken string `json:"essAuthToken,omitempty"`
|
||||
@@ -121,9 +346,11 @@ type Cluster struct {
|
||||
InstalledPodLogger bool `json:"installedPodLogger,omitempty"`
|
||||
InstalledRBACManager bool `json:"installedRbacManager,omitempty"`
|
||||
InstalledServchecker bool `json:"installedServchecker,omitempty"`
|
||||
InstalledTekton bool `json:"installedTekton,omitempty"`
|
||||
InstalledTrivy bool `json:"installedTrivy,omitempty"`
|
||||
IntVirtualAddress string `json:"intVirtualAddress,omitempty"`
|
||||
IntVirtualAddressID int64 `json:"intVirtualAddressId,omitempty"`
|
||||
IsRBPO bool `json:"isRBPO,omitempty"`
|
||||
KubeAddresses []string `json:"kubeAddresses,omitempty"`
|
||||
KubeConfig string `json:"kubeConfig,omitempty"`
|
||||
// Repositories used for cluster nodes preparing and post install operatios
|
||||
@@ -182,7 +409,9 @@ type ClusterBrief struct {
|
||||
InstalledPodLogger bool `json:"installedPodLogger,omitempty"`
|
||||
InstalledRBACManager bool `json:"installedRbacManager,omitempty"`
|
||||
InstalledServchecker bool `json:"installedServchecker,omitempty"`
|
||||
InstalledTekton bool `json:"installedTekton,omitempty"`
|
||||
InstalledTrivy bool `json:"installedTrivy,omitempty"`
|
||||
IsRPBO bool `json:"isRPBO,omitempty"`
|
||||
// Generic data
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
@@ -208,6 +437,79 @@ type ClusterTaskCreationResultWithError struct {
|
||||
Result ClusterTaskCreationResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type CronJob struct {
|
||||
Active int64 `json:"active,omitempty"`
|
||||
Age string `json:"age,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
AnnotationsCount int64 `json:"annotationsCount,omitempty"`
|
||||
Deleted string `json:"deleted,omitempty"`
|
||||
FailedJobsLimit int64 `json:"failedJobsLimit,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
LabelsCount int64 `json:"labelsCount,omitempty"`
|
||||
LastSchedule string `json:"lastSchedule,omitempty"`
|
||||
LastSuccessful string `json:"lastSuccessful,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
NextExecution string `json:"nextExecution,omitempty"`
|
||||
Schedule string `json:"schedule,omitempty"`
|
||||
StartingDeadline int64 `json:"startingDeadline,omitempty"`
|
||||
SuccessfulJobsLimit int64 `json:"successfulJobsLimit,omitempty"`
|
||||
Suspend string `json:"suspend,omitempty"`
|
||||
TimeZone string `json:"timeZone,omitempty"`
|
||||
}
|
||||
|
||||
type DaemonSet struct {
|
||||
Age string `json:"age,omitempty"`
|
||||
Conditions []DaemonSetCondition `json:"conditions,omitempty"`
|
||||
CurrentScheduled int64 `json:"currentScheduled,omitempty"`
|
||||
DesiredScheduled int64 `json:"desiredScheduled,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
MinReadySeconds int64 `json:"minReadySeconds,omitempty"`
|
||||
Misscheduled int64 `json:"misscheduled,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
NodeSelector string `json:"nodeSelector,omitempty"`
|
||||
NumberAvailable int64 `json:"numberAvailable,omitempty"`
|
||||
NumberReady int64 `json:"numberReady,omitempty"`
|
||||
NumberUnavailable int64 `json:"numberUnavailable,omitempty"`
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
PodTemplateSpec PodTemplateSpec `json:"podTemplateSpec,omitempty"`
|
||||
UpdateStrategyType string `json:"updateStrategyType,omitempty"`
|
||||
UpdatedNumberScheduled int64 `json:"updatedNumberScheduled,omitempty"`
|
||||
}
|
||||
|
||||
type DaemonSetCondition struct {
|
||||
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type Deployment struct {
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
AnnotationsCount int64 `json:"annotationsCount,omitempty"`
|
||||
AvailableReplicas int64 `json:"availableReplicas,omitempty"`
|
||||
Conditions []DeploymentCondition `json:"conditions,omitempty"`
|
||||
ControlledBy string `json:"controlledBy,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Deleted string `json:"deleted,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
LabelsCount int64 `json:"labelsCount,omitempty"`
|
||||
MinReadySeconds int64 `json:"minReadySeconds,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Paused bool `json:"paused,omitempty"`
|
||||
ReadyReplicas int64 `json:"readyReplicas,omitempty"`
|
||||
Replicas int64 `json:"replicas,omitempty"`
|
||||
RevisionHistoryLimit int64 `json:"revisionHistoryLimit,omitempty"`
|
||||
RollingUpdateMaxSurge string `json:"rollingUpdateMaxSurge,omitempty"`
|
||||
RollingUpdateMaxUnavailable string `json:"rollingUpdateMaxUnavailable,omitempty"`
|
||||
Selector LabelSelector `json:"selector,omitempty"`
|
||||
StatusReplicas int64 `json:"statusReplicas,omitempty"`
|
||||
StrategyType string `json:"strategyType,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeClusterResult struct {
|
||||
IncompleteVerificationTaskBriefs []TaskBrief `json:"incompleteVerificationTaskBriefs,omitempty"`
|
||||
TaskBriefs []TaskBrief `json:"taskBriefs,omitempty"`
|
||||
@@ -273,8 +575,127 @@ type GetClusterResultWithError struct {
|
||||
Result GetClusterResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GetForwardingResult struct {
|
||||
CreatedAt int64 `json:"createdAt,omitempty"`
|
||||
CustomServerSettings bool `json:"customServerSettings,omitempty"`
|
||||
ForwardingPort int64 `json:"forwardingPort,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Server BalancerServerSettings `json:"server,omitempty"`
|
||||
ServiceName string `json:"serviceName,omitempty"`
|
||||
TargetAddresses []string `json:"targetAddresses,omitempty"`
|
||||
TargetPort int64 `json:"targetPort,omitempty"`
|
||||
UpdatedAt int64 `json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
type GetForwardingResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result GetForwardingResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeConfigMapResult struct {
|
||||
ConfigMap ConfigMap `json:"configMap,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeCronJobResult struct {
|
||||
CronJob CronJob `json:"cronJob,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeDaemonSetResult struct {
|
||||
DaemonSet DaemonSet `json:"daemonSet,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeDeploymentResult struct {
|
||||
Deployment Deployment `json:"deployment,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeEndpointSliceResult struct {
|
||||
EndpointSlice EndpointSlice `json:"endpointSlice,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeEventResult struct {
|
||||
Event K8sIoAPICoreV1Event `json:"event,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeHorizontalPodAutoscalerResult struct {
|
||||
HorizontalPodAutoscaler HorizontalPodAutoscaler `json:"horizontalPodAutoscaler,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeIngressClassResult struct {
|
||||
IngressClass IngressClass `json:"ingressClass,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeIngressResult struct {
|
||||
Ingress Ingress `json:"ingress,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeJobResult struct {
|
||||
Job Job `json:"job,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeLimitRangeResult struct {
|
||||
LimitRange LimitRange `json:"limitRange,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeNamespaceResult struct {
|
||||
Namespace K8sIoAPICoreV1Namespace `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeNetworkPolicyResult struct {
|
||||
NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubePersistentVolumeClaimsResult struct {
|
||||
PersistentVolumeClaim PersistentVolumeClaim `json:"persistentVolumeClaim,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubePersistentVolumesResult struct {
|
||||
PersistentVolume PersistentVolumes `json:"persistentVolume,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubePodResult struct {
|
||||
Pod Pod `json:"pod,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeReplicaSetResult struct {
|
||||
ReplicaSet ReplicaSet `json:"replicaSet,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeReplicationControllerResult struct {
|
||||
ReplicationController ReplicationController `json:"replicationController,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeResourceQuotaResult struct {
|
||||
ResourceQuota ResourceQuota `json:"resourceQuota,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeResourcesResult struct {
|
||||
Any any `json:"any,omitempty"`
|
||||
ConfigMap GetKubeConfigMapResult `json:"configMap,omitempty"`
|
||||
CronJob GetKubeCronJobResult `json:"cronJob,omitempty"`
|
||||
DaemonSet GetKubeDaemonSetResult `json:"daemonSet,omitempty"`
|
||||
Deployment GetKubeDeploymentResult `json:"deployment,omitempty"`
|
||||
EndpointSlice GetKubeEndpointSliceResult `json:"endpointSlice,omitempty"`
|
||||
Event GetKubeEventResult `json:"event,omitempty"`
|
||||
HorizontalPodAutoscaler GetKubeHorizontalPodAutoscalerResult `json:"horizontalPodAutoscaler,omitempty"`
|
||||
Ingress GetKubeIngressResult `json:"ingress,omitempty"`
|
||||
IngressClass GetKubeIngressClassResult `json:"ingressClass,omitempty"`
|
||||
Job GetKubeJobResult `json:"job,omitempty"`
|
||||
LimitRange GetKubeLimitRangeResult `json:"limitRange,omitempty"`
|
||||
Namespace GetKubeNamespaceResult `json:"namespace,omitempty"`
|
||||
NetworkPolicy GetKubeNetworkPolicyResult `json:"networkPolicy,omitempty"`
|
||||
PersistentVolume GetKubePersistentVolumesResult `json:"persistentVolume,omitempty"`
|
||||
PersistentVolumeClaim GetKubePersistentVolumeClaimsResult `json:"persistentVolumeClaim,omitempty"`
|
||||
Pod GetKubePodResult `json:"pod,omitempty"`
|
||||
ReplicaSet GetKubeReplicaSetResult `json:"replicaSet,omitempty"`
|
||||
ReplicationController GetKubeReplicationControllerResult `json:"replicationController,omitempty"`
|
||||
ResourceQuota GetKubeResourceQuotaResult `json:"resourceQuota,omitempty"`
|
||||
Secret GetKubeSecretResult `json:"secret,omitempty"`
|
||||
Service GetKubeServicesResult `json:"service,omitempty"`
|
||||
StatefulSet GetKubeStatefulSetResult `json:"statefulSet,omitempty"`
|
||||
StorageClass GetKubeStorageClassResult `json:"storageClass,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeResourcesResultWithError struct {
|
||||
@@ -284,6 +705,22 @@ type GetKubeResourcesResultWithError struct {
|
||||
Result GetKubeResourcesResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeSecretResult struct {
|
||||
Secret Secret `json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeServicesResult struct {
|
||||
Service Service `json:"service,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeStatefulSetResult struct {
|
||||
StatefulSet StatefulSet `json:"statefulSet,omitempty"`
|
||||
}
|
||||
|
||||
type GetKubeStorageClassResult struct {
|
||||
StorageClass StorageClass `json:"storageClass,omitempty"`
|
||||
}
|
||||
|
||||
type GetLoadBalancerResult struct {
|
||||
LoadBalancer LoadBalancer `json:"loadBalancer,omitempty"`
|
||||
}
|
||||
@@ -340,6 +777,23 @@ type GPU struct {
|
||||
VideoMemorySize int64 `json:"videoMemorySize,omitempty"`
|
||||
}
|
||||
|
||||
type Job struct {
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
AnnotationsCount int64 `json:"annotationsCount,omitempty"`
|
||||
Completions string `json:"completions,omitempty"`
|
||||
Conditions string `json:"conditions,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Deleted string `json:"deleted,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
LabelsCount int64 `json:"labelsCount,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Parallelism int64 `json:"parallelism,omitempty"`
|
||||
Selector LabelSelector `json:"selector,omitempty"`
|
||||
Succeeded int64 `json:"succeeded,omitempty"`
|
||||
Template V1PodTemplateSpec `json:"template,omitempty"`
|
||||
}
|
||||
|
||||
type ListClustersResult struct {
|
||||
Clusters []ClusterBrief `json:"clusters,omitempty"`
|
||||
}
|
||||
@@ -351,8 +805,136 @@ type ListClustersResultWithError struct {
|
||||
Result ListClustersResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type ListForwardingsResult struct {
|
||||
Forwardings []BalancerForwarding `json:"forwardings,omitempty"`
|
||||
}
|
||||
|
||||
type ListForwardingsResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result ListForwardingsResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeConfigMapsResult struct {
|
||||
ConfigMaps []BriefConfigMap `json:"configMaps,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeCronJobsResult struct {
|
||||
CronJobs []BriefCronJob `json:"cronJobs,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeDaemonSetsResult struct {
|
||||
DaemonSets []BriefDaemonSet `json:"daemonSets,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeDeploymentsResult struct {
|
||||
Deployments []BriefDeployment `json:"deployments,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeEndpointSlicesResult struct {
|
||||
EndpointSlices []BriefEndpointSlices `json:"endpointSlices,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeEventsResult struct {
|
||||
Events []BriefEvent `json:"events,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeHorizontalPodAutoscalersResult struct {
|
||||
Hpas []BriefHorizontalPodAutoscalers `json:"hpas,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeIngressClassesResult struct {
|
||||
IngressClasses []BriefIngressClass `json:"ingressClasses,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeIngressesResult struct {
|
||||
Ingresses []BriefIngress `json:"ingresses,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeJobsResult struct {
|
||||
Jobs []BriefJob `json:"jobs,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeLimitRangesResult struct {
|
||||
LimitRanges []BriefLimitRange `json:"limitRanges,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeListPersistentVolumeClaimsResult struct {
|
||||
PersistentVolumeClaims []BriefPersistentVolumeClaim `json:"persistentVolumeClaims,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeNamespacesResult struct {
|
||||
Namespaces []BriefNamespace `json:"namespaces,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeNetworkPoliciesResult struct {
|
||||
NetworkPolicies []BriefNetworkPolicy `json:"networkPolicies,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubePersistentVolumesResult struct {
|
||||
PersistentVolumes []BriefPersistentVolume `json:"persistentVolumes,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubePodsResult struct {
|
||||
Pods []BriefPod `json:"pods,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeReplicaSetsResult struct {
|
||||
ReplicaSets []BriefReplicaSets `json:"replicaSets,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeReplicationControllersResult struct {
|
||||
ReplicationControllers []BriefReplicationController `json:"replicationControllers,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeResourceQuotasResult struct {
|
||||
ResourceQuotas []BriefResourceQuota `json:"resourceQuotas,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeResourcesResult struct {
|
||||
Any any `json:"any,omitempty"`
|
||||
ConfigMaps ListKubeConfigMapsResult `json:"configMaps,omitempty"`
|
||||
CronJobs ListKubeCronJobsResult `json:"cronJobs,omitempty"`
|
||||
DaemonSets ListKubeDaemonSetsResult `json:"daemonSets,omitempty"`
|
||||
Deployments ListKubeDeploymentsResult `json:"deployments,omitempty"`
|
||||
EndpointSlices ListKubeEndpointSlicesResult `json:"endpointSlices,omitempty"`
|
||||
Events ListKubeEventsResult `json:"events,omitempty"`
|
||||
HorizontalPodAutoscalers ListKubeHorizontalPodAutoscalersResult `json:"horizontalPodAutoscalers,omitempty"`
|
||||
IngressClasses ListKubeIngressClassesResult `json:"ingressClasses,omitempty"`
|
||||
Ingresses ListKubeIngressesResult `json:"ingresses,omitempty"`
|
||||
Jobs ListKubeJobsResult `json:"jobs,omitempty"`
|
||||
LimitRanges ListKubeLimitRangesResult `json:"limitRanges,omitempty"`
|
||||
Namespaces ListKubeNamespacesResult `json:"namespaces,omitempty"`
|
||||
NetworkPolicies ListKubeNetworkPoliciesResult `json:"networkPolicies,omitempty"`
|
||||
PersistentVolumeClaims ListKubeListPersistentVolumeClaimsResult `json:"persistentVolumeClaims,omitempty"`
|
||||
PersistentVolumes ListKubePersistentVolumesResult `json:"persistentVolumes,omitempty"`
|
||||
Pods ListKubePodsResult `json:"pods,omitempty"`
|
||||
ReplicaSets ListKubeReplicaSetsResult `json:"replicaSets,omitempty"`
|
||||
ReplicationControllers ListKubeReplicationControllersResult `json:"replicationControllers,omitempty"`
|
||||
ResourceQuotas ListKubeResourceQuotasResult `json:"resourceQuotas,omitempty"`
|
||||
Secrets ListKubeSecretsResult `json:"secrets,omitempty"`
|
||||
Services ListKubeServicesResult `json:"services,omitempty"`
|
||||
StatefulSets ListKubeStatefulSetsResult `json:"statefulSets,omitempty"`
|
||||
StorageClasses ListKubeStorageClassesResult `json:"storageClasses,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeResourcesResultWithError struct {
|
||||
@@ -362,6 +944,26 @@ type ListKubeResourcesResultWithError struct {
|
||||
Result ListKubeResourcesResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeSecretsResult struct {
|
||||
Secrets []BriefSecret `json:"secrets,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeServicesResult struct {
|
||||
Services []BriefService `json:"services,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeStatefulSetsResult struct {
|
||||
StatefulSets []BriefStatefulSet `json:"statefulSets,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListKubeStorageClassesResult struct {
|
||||
StorageClasses []BriefStorageClass `json:"storageClasses,omitempty"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
}
|
||||
|
||||
type ListLoadBalancersResult struct {
|
||||
LoadBalancers []LoadBalancer `json:"loadBalancers,omitempty"`
|
||||
}
|
||||
@@ -583,6 +1185,105 @@ type NetworkDescribeResultWithError struct {
|
||||
Result NetworkDescribeResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type PersistentVolumes struct {
|
||||
// spec.accessModes
|
||||
AccessModes []string `json:"accessModes,omitempty"`
|
||||
// time.Since(kubecore.PersistentVolume.metadata.creationTimestamp).String()
|
||||
Age string `json:"age,omitempty"`
|
||||
// metadata.annotations
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
// kubecore.PersistentVolume.spec.capacity.storage
|
||||
Capacity string `json:"capacity,omitempty"`
|
||||
// kubecore.PersistentVolume.spec.claimRef.name (кому привязан)
|
||||
Claim string `json:"claim,omitempty"`
|
||||
// spec.claimRef.namespace
|
||||
ClaimNamespace string `json:"claimNamespace,omitempty"`
|
||||
// spec.claimRef.kind
|
||||
ClaimType string `json:"claimType,omitempty"`
|
||||
// metadata.creationTimestamp (ISO)
|
||||
Created string `json:"created,omitempty"`
|
||||
// metadata.finalizers
|
||||
Finalizers []string `json:"finalizers,omitempty"`
|
||||
// kubecore.PersistentVolume.metadata.name
|
||||
Name string `json:"name,omitempty"`
|
||||
// spec.hostPath.path
|
||||
Path string `json:"path,omitempty"`
|
||||
// spec.persistentVolumeReclaimPolicy
|
||||
ReclaimPolicy string `json:"reclaimPolicy,omitempty"`
|
||||
// тип источника
|
||||
SourceProvider string `json:"sourceProvider,omitempty"`
|
||||
// status.phase (Available, Bound, Released, Failed)
|
||||
Status string `json:"status,omitempty"`
|
||||
// kubecore.PersistentVolume.spec.storageClassName
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
// spec.hostPath.type
|
||||
Type string `json:"type,omitempty"`
|
||||
// spec.volumeMode
|
||||
VolumeMode string `json:"volumeMode,omitempty"`
|
||||
}
|
||||
|
||||
type Pod struct {
|
||||
Affinity Affinity `json:"affinity,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
AnnotationsCount int64 `json:"annotationsCount,omitempty"`
|
||||
Conditions []PodCondition `json:"conditions,omitempty"`
|
||||
ContainerStatuses []ContainerStatus `json:"containerStatuses,omitempty"`
|
||||
Containers []Container `json:"containers,omitempty"`
|
||||
ControlledBy string `json:"controlledBy,omitempty"`
|
||||
Created string `json:"created,omitempty"`
|
||||
Deleted string `json:"deleted,omitempty"`
|
||||
DNSPolicy string `json:"dnsPolicy,omitempty"`
|
||||
EphemeralContainerStatuses []ContainerStatus `json:"ephemeralContainerStatuses,omitempty"`
|
||||
EphemeralContainers []EphemeralContainer `json:"ephemeralContainers,omitempty"`
|
||||
InitContainerStatuses []ContainerStatus `json:"initContainerStatuses,omitempty"`
|
||||
InitContainers []Container `json:"initContainers,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
LabelsCount int64 `json:"labelsCount,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Node string `json:"node,omitempty"`
|
||||
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
|
||||
NodeSelectorCount int64 `json:"nodeSelectorCount,omitempty"`
|
||||
Phase string `json:"phase,omitempty"`
|
||||
PodIP string `json:"podIP,omitempty"`
|
||||
PodIPs []string `json:"podIPs,omitempty"`
|
||||
PodVolumes []Volume `json:"podVolumes,omitempty"`
|
||||
PreemptionPolicy string `json:"preemptionPolicy,omitempty"`
|
||||
Priority int64 `json:"priority,omitempty"`
|
||||
PriorityClassName string `json:"priorityClassName,omitempty"`
|
||||
QoSClass string `json:"qosClass,omitempty"`
|
||||
ReadinessGates []string `json:"readinessGates,omitempty"`
|
||||
ResourceClaimStatuses []PodResourceClaimStatus `json:"resourceClaimStatuses,omitempty"`
|
||||
RestartPolicy string `json:"restartPolicy,omitempty"`
|
||||
RuntimeClassName string `json:"runtimeClassName,omitempty"`
|
||||
SecurityContext PodSecurityContext `json:"securityContext,omitempty"`
|
||||
ServiceAccount string `json:"serviceAccount,omitempty"`
|
||||
StartTime string `json:"startTime,omitempty"`
|
||||
Tolerations []Toleration `json:"tolerations,omitempty"`
|
||||
TolerationsCount int64 `json:"tolerationsCount,omitempty"`
|
||||
}
|
||||
|
||||
type PodCondition struct {
|
||||
LastProbeTime string `json:"lastProbeTime,omitempty"`
|
||||
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type PodResourceClaimStatus struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
ResourceClaimName string `json:"resourceClaimName,omitempty"`
|
||||
}
|
||||
|
||||
type PodTemplateSpec struct {
|
||||
Containers []Container `json:"containers,omitempty"`
|
||||
InitContainers []Container `json:"initContainers,omitempty"`
|
||||
PodVolumes []Volume `json:"podVolumes,omitempty"`
|
||||
Tolerations []Toleration `json:"tolerations,omitempty"`
|
||||
}
|
||||
|
||||
type PolicyBrief struct {
|
||||
Background bool `json:"background,omitempty"`
|
||||
Category string `json:"category,omitempty"`
|
||||
@@ -652,6 +1353,14 @@ type SetWorkerStatusResultWithError struct {
|
||||
Result any `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type Toleration struct {
|
||||
Effect string `json:"effect,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
Operator string `json:"operator,omitempty"`
|
||||
TolerationSeconds int64 `json:"tolerationSeconds,omitempty"`
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateClusterConfigResult struct {
|
||||
KubeConfig string `json:"kubeConfig,omitempty"`
|
||||
}
|
||||
@@ -681,6 +1390,13 @@ type UpdateCNIConfigResultWithError struct {
|
||||
Result UpdateCNIConfigResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateForwardingSettingsResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result any `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateProxySettingsResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
|
||||
@@ -3,10 +3,46 @@
|
||||
package de_cluster
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
autoscalingv2 "k8s.io/api/autoscaling/v2"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
discoveryv1 "k8s.io/api/discovery/v1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type Affinity = corev1.Affinity
|
||||
type ConfigMap = corev1.ConfigMap
|
||||
type Container = corev1.Container
|
||||
type ContainerStatus = corev1.ContainerStatus
|
||||
type DeploymentCondition = appsv1.DeploymentCondition
|
||||
type EndpointSlice = discoveryv1.EndpointSlice
|
||||
type EphemeralContainer = corev1.EphemeralContainer
|
||||
type HorizontalPodAutoscaler = autoscalingv2.HorizontalPodAutoscaler
|
||||
type Ingress = networkingv1.Ingress
|
||||
type IngressClass = networkingv1.IngressClass
|
||||
type K8sIoAPICoreV1Event = corev1.Event
|
||||
type K8sIoAPICoreV1Namespace = corev1.Namespace
|
||||
type LabelSelector = metav1.LabelSelector
|
||||
type LimitRange = corev1.LimitRange
|
||||
type NetworkPolicy = networkingv1.NetworkPolicy
|
||||
type PersistentVolumeClaim = corev1.PersistentVolumeClaim
|
||||
type PodSecurityContext = corev1.PodSecurityContext
|
||||
type ReplicaSet = appsv1.ReplicaSet
|
||||
type ReplicationController = corev1.ReplicationController
|
||||
type ResourceQuota = corev1.ResourceQuota
|
||||
type Secret = corev1.Secret
|
||||
type Service = corev1.Service
|
||||
type StatefulSet = appsv1.StatefulSet
|
||||
type StorageClass = storagev1.StorageClass
|
||||
type V1PodTemplateSpec = corev1.PodTemplateSpec
|
||||
type Volume = corev1.Volume
|
||||
type CreateClusterRequest = shared.CreateClusterRequest
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type DynamixPlatform = shared.DynamixPlatform
|
||||
type Rule = shared.Rule
|
||||
type TaskBrief = shared.TaskBrief
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeClusterTemplateService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_cluster_template
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -28,18 +28,11 @@ type ClusterTemplate struct {
|
||||
DenergyRuntimeType string `json:"denergyRuntimeType,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DomainResolvers []string `json:"domainResolvers,omitempty"`
|
||||
DynamixAppID string `json:"dynamixAppId,omitempty"`
|
||||
DynamixAppSecret string `json:"dynamixAppSecret,omitempty"`
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain,omitempty"`
|
||||
DynamixAuthType string `json:"dynamixAuthType,omitempty"`
|
||||
DynamixK8CIID int64 `json:"dynamixK8CIId,omitempty"`
|
||||
DynamixPassword string `json:"dynamixPassword,omitempty"`
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId,omitempty"`
|
||||
DynamixRGID int64 `json:"dynamixRGId,omitempty"`
|
||||
DynamixSEPID int64 `json:"dynamixSEPId,omitempty"`
|
||||
DynamixSEPPool string `json:"dynamixSEPPool,omitempty"`
|
||||
DynamixSSOURL string `json:"dynamixSSOURL,omitempty"`
|
||||
DynamixURL string `json:"dynamixURL,omitempty"`
|
||||
DynamixUsername string `json:"dynamixUsername,omitempty"`
|
||||
EnableCustomLoadBalancerHostnames bool `json:"enableCustomLoadBalancerHostnames,omitempty"`
|
||||
EnableCustomMasterHostnames bool `json:"enableCustomMasterHostnames,omitempty"`
|
||||
EnableCustomWorkerHostnames bool `json:"enableCustomWorkerHostnames,omitempty"`
|
||||
@@ -66,6 +59,7 @@ type ClusterTemplate struct {
|
||||
InstallMonitoring bool `json:"installMonitoring,omitempty"`
|
||||
InstallPodLogger bool `json:"installPodLogger,omitempty"`
|
||||
InstallRBACManager bool `json:"installRbacManager,omitempty"`
|
||||
InstallTekton bool `json:"installTekton,omitempty"`
|
||||
InstallTrivy bool `json:"installTrivy,omitempty"`
|
||||
IntVirtualAddress string `json:"intVirtualAddress,omitempty"`
|
||||
InternalLBAddresses []string `json:"internalLBAddresses,omitempty"`
|
||||
@@ -160,146 +154,6 @@ type ClusterTemplateBrief struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
}
|
||||
|
||||
type CreateClusterRequest struct {
|
||||
AppContainerRepository int64 `json:"appContainerRepository"`
|
||||
AuditEnable bool `json:"auditEnable"`
|
||||
AuditLogMaxAge int64 `json:"auditLogMaxAge"`
|
||||
AuditLogMaxBackup int64 `json:"auditLogMaxBackup"`
|
||||
AuditLogMaxSize int64 `json:"auditLogMaxSize"`
|
||||
AuditPolicy string `json:"auditPolicy"`
|
||||
BalancersDynamixSEPID int64 `json:"balancersDynamixSEPId"`
|
||||
BalancersDynamixSEPPool string `json:"balancersDynamixSEPPool"`
|
||||
CertificateIssuerID int64 `json:"certificateIssuerId"`
|
||||
CertificateKey string `json:"certificateKey"`
|
||||
CertificateValidityBefore string `json:"certificateValidityBefore"`
|
||||
ChartRepository int64 `json:"chartRepository"`
|
||||
ClusterHostname string `json:"clusterHostname"`
|
||||
ClusterMachineOSBuild string `json:"clusterMachineOSBuild"`
|
||||
ClusterMachineOSType string `json:"clusterMachineOSType"`
|
||||
ClusterName string `json:"clusterName"`
|
||||
ClusterTemplateDescription string `json:"clusterTemplateDescription"`
|
||||
ClusterTemplateName string `json:"clusterTemplateName"`
|
||||
ClusterType string `json:"clusterType"`
|
||||
ContainerNetworkType string `json:"containerNetworkType"`
|
||||
CreateClusterTemplate bool `json:"createClusterTemplate"`
|
||||
CustomMTU int64 `json:"customMTU"`
|
||||
DenergyRuntimeType string `json:"denergyRuntimeType"`
|
||||
Description string `json:"description"`
|
||||
DomainResolvers []string `json:"domainResolvers,omitempty"`
|
||||
DynamixAppID string `json:"dynamixAppId"`
|
||||
DynamixAppSecret string `json:"dynamixAppSecret"`
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain"`
|
||||
DynamixAuthType string `json:"dynamixAuthType"`
|
||||
DynamixK8CIID int64 `json:"dynamixK8CIId"`
|
||||
DynamixPassword string `json:"dynamixPassword"`
|
||||
DynamixRGID int64 `json:"dynamixRGId"`
|
||||
DynamixSEPID int64 `json:"dynamixSEPId"`
|
||||
DynamixSEPPool string `json:"dynamixSEPPool"`
|
||||
DynamixSSOURL string `json:"dynamixSSOURL"`
|
||||
DynamixURL string `json:"dynamixURL"`
|
||||
DynamixUsername string `json:"dynamixUsername"`
|
||||
EnableCustomLoadBalancerHostnames bool `json:"enableCustomLoadBalancerHostnames"`
|
||||
EnableCustomMasterHostnames bool `json:"enableCustomMasterHostnames"`
|
||||
EnableCustomWorkerHostnames bool `json:"enableCustomWorkerHostnames"`
|
||||
EssAuthToken string `json:"essAuthToken"`
|
||||
// VirtualAddresses Section
|
||||
ExtVirtualAddress string `json:"extVirtualAddress"`
|
||||
ExternalLBAddresses []string `json:"externalLBAddresses,omitempty"`
|
||||
GlobalNetworkID int64 `json:"globalNetworkId"`
|
||||
ILoadBalancerCPUCount int64 `json:"iLoadBalancerCPUCount"`
|
||||
ILoadBalancerCloudInit string `json:"iLoadBalancerCloudInit"`
|
||||
ILoadBalancerCount int64 `json:"iLoadBalancerCount"`
|
||||
ILoadBalancerDiskSize int64 `json:"iLoadBalancerDiskSize"`
|
||||
ILoadBalancerGPUIDs []int64 `json:"iLoadBalancerGpuIds,omitempty"`
|
||||
ILoadBalancerMemorySize int64 `json:"iLoadBalancerMemorySize"`
|
||||
InitialSecureShellPort int64 `json:"initialSecureShellPort"`
|
||||
InstallCriobox bool `json:"installCriobox"`
|
||||
InstallCsiDynamix bool `json:"installCsiDynamix"`
|
||||
InstallEss bool `json:"installEss"`
|
||||
InstallKyverno bool `json:"installKyverno"`
|
||||
InstallMetrics bool `json:"installMetrics"`
|
||||
InstallMonitoring bool `json:"installMonitoring"`
|
||||
InstallPodLogger bool `json:"installPodLogger"`
|
||||
InstallRBACManager bool `json:"installRbacManager"`
|
||||
InstallTrivy bool `json:"installTrivy"`
|
||||
IntVirtualAddress string `json:"intVirtualAddress"`
|
||||
InternalLBAddresses []string `json:"internalLBAddresses,omitempty"`
|
||||
KubeConfig string `json:"kubeConfig"`
|
||||
KubeContainerRepository int64 `json:"kubeContainerRepository"`
|
||||
KubeVersion string `json:"kubeVersion"`
|
||||
LoadBalancerExternalIPAddresses []string `json:"loadBalancerExternalIPAddresses,omitempty"`
|
||||
LoadBalancerHostnames []string `json:"loadBalancerHostnames,omitempty"`
|
||||
LoadBalancerInternalIPAddresses []string `json:"loadBalancerInternalIPAddresses,omitempty"`
|
||||
LoadBalancerMachineOSBuild []string `json:"loadBalancerMachineOSBuild,omitempty"`
|
||||
LoadBalancerMachineOSType []string `json:"loadBalancerMachineOSType,omitempty"`
|
||||
LoadBalancerRootPasswords []string `json:"loadBalancerRootPasswords,omitempty"`
|
||||
LoadBalancerRootUsernames []string `json:"loadBalancerRootUsernames,omitempty"`
|
||||
LoadBalancerSecureShellPorts []int64 `json:"loadBalancerSecureShellPorts,omitempty"`
|
||||
LoadBalancerUserPasswords []string `json:"loadBalancerUserPasswords,omitempty"`
|
||||
LoadBalancerUserUsernames []string `json:"loadBalancerUserUsernames,omitempty"`
|
||||
LocalNetworkID int64 `json:"localNetworkId"`
|
||||
MachineOSBuild string `json:"machineOSBuild"`
|
||||
MachineOSImageID int64 `json:"machineOSImageId"`
|
||||
MachineOSType string `json:"machineOSType"`
|
||||
MachineProvider string `json:"machineProvider"`
|
||||
MasterAddresses []string `json:"masterAddresses,omitempty"`
|
||||
MasterCPUCount int64 `json:"masterCPUCount"`
|
||||
MasterCloudInit string `json:"masterCloudInit"`
|
||||
MasterCount int64 `json:"masterCount"`
|
||||
MasterDiskSize int64 `json:"masterDiskSize"`
|
||||
MasterGPUIDs []int64 `json:"masterGpuIds,omitempty"`
|
||||
MasterHostnames []string `json:"masterHostnames,omitempty"`
|
||||
MasterMemorySize int64 `json:"masterMemorySize"`
|
||||
MasterNodesExternalIPAdresses []string `json:"masterNodesExternalIPAdresses,omitempty"`
|
||||
MasterNodesMachineOSBuilds []string `json:"masterNodesMachineOSBuilds,omitempty"`
|
||||
MasterNodesMachineOSTypes []string `json:"masterNodesMachineOSTypes,omitempty"`
|
||||
MasterNodesRootPasswords []string `json:"masterNodesRootPasswords,omitempty"`
|
||||
MasterNodesRootUsernames []string `json:"masterNodesRootUsernames,omitempty"`
|
||||
MasterNodesSecureShellPorts []int64 `json:"masterNodesSecureShellPorts,omitempty"`
|
||||
MasterNodesUserPasswords []string `json:"masterNodesUserPasswords,omitempty"`
|
||||
MasterNodesUserUsernames []string `json:"masterNodesUserUsernames,omitempty"`
|
||||
MastersDynamixSEPID int64 `json:"mastersDynamixSEPId"`
|
||||
MastersDynamixSEPPool string `json:"mastersDynamixSEPPool"`
|
||||
PackageRepository int64 `json:"packageRepository"`
|
||||
Podkiller bool `json:"podkiller"`
|
||||
ProvideDNS bool `json:"provideDNS"`
|
||||
RequeueInterval int64 `json:"requeueInterval"`
|
||||
SaveComputesOnFailedK8SCreation bool `json:"saveComputesOnFailedK8SCreation"`
|
||||
Severities []string `json:"severities,omitempty"`
|
||||
SharedClusterTemplate bool `json:"sharedClusterTemplate"`
|
||||
SkipNamespaces []string `json:"skipNamespaces,omitempty"`
|
||||
StoragePolicyID int64 `json:"storagePolicyId"`
|
||||
UseCustomExternalLBAddresses bool `json:"useCustomExternalLBAddresses"`
|
||||
UseCustomInternalLBAddresses bool `json:"useCustomInternalLBAddresses"`
|
||||
UseCustomMasterIPAddresses bool `json:"useCustomMasterIPAddresses"`
|
||||
UseCustomWorkerIPAddresses bool `json:"useCustomWorkerIPAddresses"`
|
||||
UseDynamixExtNet bool `json:"useDynamixExtnet"`
|
||||
ViNSGlobalNetworkID int64 `json:"vinsGlobalNetworkId"`
|
||||
WorkerAddresses []string `json:"workerAddresses,omitempty"`
|
||||
WorkerAnnotations []string `json:"workerAnnotations,omitempty"`
|
||||
WorkerCPUCount int64 `json:"workerCPUCount"`
|
||||
WorkerCloudInit string `json:"workerCloudInit"`
|
||||
WorkerCount int64 `json:"workerCount"`
|
||||
WorkerDiskSize int64 `json:"workerDiskSize"`
|
||||
WorkerGPUIDs []int64 `json:"workerGpuIds,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
WorkerHostnames []string `json:"workerHostnames,omitempty"`
|
||||
// WorkerGroup string `json:\"workerGroup\" form:\"workerGroup\"`
|
||||
WorkerLabels []string `json:"workerLabels,omitempty"`
|
||||
WorkerMemorySize int64 `json:"workerMemorySize"`
|
||||
WorkerNodesExternalIPAdresses []string `json:"workerNodesExternalIPAdresses,omitempty"`
|
||||
WorkerNodesMachineOSBuilds []string `json:"workerNodesMachineOSBuilds,omitempty"`
|
||||
WorkerNodesMachineOSTypes []string `json:"workerNodesMachineOSTypes,omitempty"`
|
||||
WorkerNodesRootPasswords []string `json:"workerNodesRootPasswords,omitempty"`
|
||||
WorkerNodesRootUsernames []string `json:"workerNodesRootUsernames,omitempty"`
|
||||
WorkerNodesSecureShellPorts []int64 `json:"workerNodesSecureShellPorts,omitempty"`
|
||||
WorkerNodesUserPasswords []string `json:"workerNodesUserPasswords,omitempty"`
|
||||
WorkerNodesUserUsernames []string `json:"workerNodesUserUsernames,omitempty"`
|
||||
WorkerTaints []string `json:"workerTaints,omitempty"`
|
||||
WorkersDynamixSEPID int64 `json:"workersDynamixSEPId"`
|
||||
WorkersDynamixSEPPool string `json:"workersDynamixSEPPool"`
|
||||
}
|
||||
|
||||
type DeleteClusterTemplateResult struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_cluster_template
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateClusterRequest = shared.CreateClusterRequest
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCodeScoringService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the codescoring is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s codescoring pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get codescoring by id
|
||||
func (a *DeCodeScoringService) Describe(ctx context.Context, req DescribeRequest) (DescribeCodeScoringResult, error) {
|
||||
func (a *DeCodeScoringService) Describe(ctx context.Context, body DescribeCodeScoringRequest) (DescribeCodeScoringResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeCodeScoringService) Describe(ctx context.Context, req DescribeRequest
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeCodeScoringService) Describe(ctx context.Context, req DescribeRequest
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/codescoring/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeCodeScoringService) Describe(ctx context.Context, req DescribeRequest
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,48 +94,8 @@ func (a *DeCodeScoringService) Describe(ctx context.Context, req DescribeRequest
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// username codescoring
|
||||
//
|
||||
// Required.
|
||||
Username string `json:"username" form:"username"`
|
||||
// password for codescoring
|
||||
//
|
||||
// Required.
|
||||
Password string `json:"password" form:"password"`
|
||||
// secret key for codescoring
|
||||
//
|
||||
// Required.
|
||||
SecretKey string `json:"secretKey" form:"secretKey"`
|
||||
// hostname for codescoring
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// storage type
|
||||
//
|
||||
// Allowed values:
|
||||
// - "longhorn"
|
||||
// - "glusterfs"
|
||||
// - ""
|
||||
StorageClass string `json:"storageClass" form:"storageClass"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install codescoring in cluster
|
||||
func (a *DeCodeScoringService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeCodeScoringService) Install(ctx context.Context, body InstallCodeScoringRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -160,48 +107,17 @@ func (a *DeCodeScoringService) Install(ctx context.Context, req InstallRequest)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Username) {
|
||||
missingRequiredParams = append(missingRequiredParams, "username")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Password) {
|
||||
missingRequiredParams = append(missingRequiredParams, "password")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.SecretKey) {
|
||||
missingRequiredParams = append(missingRequiredParams, "secretKey")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.StorageClass) {
|
||||
storageClassValue := req.StorageClass
|
||||
storageClassAllowedValues := []string{
|
||||
"longhorn",
|
||||
"glusterfs",
|
||||
"",
|
||||
}
|
||||
storageClassValid := false
|
||||
for _, allowed := range storageClassAllowedValues {
|
||||
if storageClassValue == allowed {
|
||||
storageClassValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !storageClassValid {
|
||||
return result, fmt.Errorf("storageClass must be one of %v", storageClassAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/codescoring/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -215,17 +131,7 @@ func (a *DeCodeScoringService) Install(ctx context.Context, req InstallRequest)
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "username", req.Username, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "password", req.Password, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "secretKey", req.SecretKey, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "storageClass", req.StorageClass, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -268,19 +174,8 @@ func (a *DeCodeScoringService) Install(ctx context.Context, req InstallRequest)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the codescoring even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall codescoring from cluster
|
||||
func (a *DeCodeScoringService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeCodeScoringService) Uninstall(ctx context.Context, body UninstallCodeScoringRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -292,8 +187,8 @@ func (a *DeCodeScoringService) Uninstall(ctx context.Context, req UninstallReque
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -302,7 +197,7 @@ func (a *DeCodeScoringService) Uninstall(ctx context.Context, req UninstallReque
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/codescoring/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -316,9 +211,7 @@ func (a *DeCodeScoringService) Uninstall(ctx context.Context, req UninstallReque
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_codescoring
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,26 @@
|
||||
|
||||
package de_codescoring
|
||||
|
||||
type CodeScoringInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type CodeScoringRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -19,6 +39,12 @@ type CodeScoringRecord struct {
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeCodeScoringRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeCodeScoringResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -33,3 +59,18 @@ type DescribeCodeScoringResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeCodeScoringResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCodeScoringRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params CodeScoringInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallCodeScoringRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_codescoring
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeComputesService service
|
||||
@@ -29,22 +29,8 @@ type DiskAttachRequest struct {
|
||||
BusNumber string `json:"busNumber" form:"busNumber"`
|
||||
// Mount disk in read-only mode
|
||||
ReadOnly bool `json:"readOnly" form:"readOnly"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Attach disk
|
||||
@@ -92,14 +78,7 @@ func (a *DeComputesService) DiskAttach(ctx context.Context, req DiskAttachReques
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "pciSlot", req.PCISlot, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "busNumber", req.BusNumber, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "readOnly", req.ReadOnly, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -151,22 +130,8 @@ type DiskDetachRequest struct {
|
||||
//
|
||||
// Required.
|
||||
DiskID int64 `json:"diskId" form:"diskId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Detach disk
|
||||
@@ -211,14 +176,7 @@ func (a *DeComputesService) DiskDetach(ctx context.Context, req DiskDetachReques
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "computeId", req.ComputeID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "diskId", req.DiskID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -266,22 +224,8 @@ type GetRequest struct {
|
||||
//
|
||||
// Required.
|
||||
ComputeID int64 `json:"computeId" form:"computeId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Get compute
|
||||
@@ -322,14 +266,7 @@ func (a *DeComputesService) Get(ctx context.Context, req GetRequest) (GetCompute
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "computeId", req.ComputeID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -403,22 +340,8 @@ type ListRequest struct {
|
||||
Page int64 `json:"page" form:"page"`
|
||||
// Page size
|
||||
Size int64 `json:"size" form:"size"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// List computes
|
||||
@@ -466,14 +389,7 @@ func (a *DeComputesService) List(ctx context.Context, req ListRequest) (ListComp
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "zoneId", req.ZoneID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "page", req.Page, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "size", req.Size, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_computes
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCrioboxService service
|
||||
@@ -128,12 +128,12 @@ type InstallRequest struct {
|
||||
}
|
||||
|
||||
// Install Criobox
|
||||
func (a *DeCrioboxService) Install(ctx context.Context, req InstallRequest) (InstallCrioboxResult, error) {
|
||||
func (a *DeCrioboxService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result InstallCrioboxResult
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@@ -216,7 +216,7 @@ func (a *DeCrioboxService) Install(ctx context.Context, req InstallRequest) (Ins
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp InstallCrioboxResultWithError
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
@@ -245,12 +245,12 @@ type UninstallRequest struct {
|
||||
}
|
||||
|
||||
// Uninstall Criobox
|
||||
func (a *DeCrioboxService) Uninstall(ctx context.Context, req UninstallRequest) (UninstallCrioboxResult, error) {
|
||||
func (a *DeCrioboxService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result UninstallCrioboxResult
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@@ -309,7 +309,7 @@ func (a *DeCrioboxService) Uninstall(ctx context.Context, req UninstallRequest)
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp UninstallCrioboxResultWithError
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_criobox
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -29,25 +29,3 @@ type DescribeCrioboxResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeCrioboxResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCrioboxResult struct {
|
||||
TaskID int64 `json:"taskId,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCrioboxResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result InstallCrioboxResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type UninstallCrioboxResult struct {
|
||||
TaskID int64 `json:"taskId,omitempty"`
|
||||
}
|
||||
|
||||
type UninstallCrioboxResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result UninstallCrioboxResult `json:"result,omitempty"`
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
package de_criobox
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCsidynamixService service
|
||||
@@ -118,33 +118,19 @@ type InstallRequest struct {
|
||||
DynamixPool string `json:"dynamixPool" form:"dynamixPool"`
|
||||
// Storage policy id (for denergy)
|
||||
DynamixStoragePolicyID int64 `json:"dynamixStoragePolicyId" form:"dynamixStoragePolicyId"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
// Resourse group ID for the cluster (for dynamix and denergy type)
|
||||
DynamixRGID int64 `json:"dynamixRGId" form:"dynamixRGId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
}
|
||||
|
||||
// Install CsiDynamix
|
||||
func (a *DeCsidynamixService) Install(ctx context.Context, req InstallRequest) (InstallCsiDynamixResult, error) {
|
||||
func (a *DeCsidynamixService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result InstallCsiDynamixResult
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@@ -182,15 +168,8 @@ func (a *DeCsidynamixService) Install(ctx context.Context, req InstallRequest) (
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSepId", req.DynamixSEPID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPool", req.DynamixPool, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixStoragePolicyId", req.DynamixStoragePolicyID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixRGId", req.DynamixRGID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -216,7 +195,7 @@ func (a *DeCsidynamixService) Install(ctx context.Context, req InstallRequest) (
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp InstallCsiDynamixResultWithError
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
@@ -250,33 +229,19 @@ type ReinstallRequest struct {
|
||||
DynamixPool string `json:"dynamixPool" form:"dynamixPool"`
|
||||
// Storage policy id (for denergy)
|
||||
DynamixStoragePolicyID int64 `json:"dynamixStoragePolicyId" form:"dynamixStoragePolicyId"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
// Resourse group ID for the cluster (for dynamix and denergy type)
|
||||
DynamixRGID int64 `json:"dynamixRGId" form:"dynamixRGId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
}
|
||||
|
||||
// Reinstall CsiDynamix
|
||||
func (a *DeCsidynamixService) Reinstall(ctx context.Context, req ReinstallRequest) (ReinstallCsiDynamixResult, error) {
|
||||
func (a *DeCsidynamixService) Reinstall(ctx context.Context, req ReinstallRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result ReinstallCsiDynamixResult
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@@ -314,15 +279,8 @@ func (a *DeCsidynamixService) Reinstall(ctx context.Context, req ReinstallReques
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSepId", req.DynamixSEPID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPool", req.DynamixPool, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixStoragePolicyId", req.DynamixStoragePolicyID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixRGId", req.DynamixRGID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -348,7 +306,7 @@ func (a *DeCsidynamixService) Reinstall(ctx context.Context, req ReinstallReques
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp ReinstallCsiDynamixResultWithError
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
@@ -375,12 +333,12 @@ type UninstallRequest struct {
|
||||
}
|
||||
|
||||
// Uninstall CsiDynamix
|
||||
func (a *DeCsidynamixService) Uninstall(ctx context.Context, req UninstallRequest) (UninstallCsiDynamixResult, error) {
|
||||
func (a *DeCsidynamixService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result UninstallCsiDynamixResult
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
@@ -438,7 +396,7 @@ func (a *DeCsidynamixService) Uninstall(ctx context.Context, req UninstallReques
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp UninstallCsiDynamixResultWithError
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_csidynamix
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -13,36 +13,3 @@ type DescribeCsiDynamixResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeCsiDynamixResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCsiDynamixResult struct {
|
||||
TaskID int64 `json:"taskId,omitempty"`
|
||||
}
|
||||
|
||||
type InstallCsiDynamixResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result InstallCsiDynamixResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type ReinstallCsiDynamixResult struct {
|
||||
TaskID int64 `json:"taskId,omitempty"`
|
||||
}
|
||||
|
||||
type ReinstallCsiDynamixResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result ReinstallCsiDynamixResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type UninstallCsiDynamixResult struct {
|
||||
TaskID int64 `json:"taskId,omitempty"`
|
||||
}
|
||||
|
||||
type UninstallCsiDynamixResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result UninstallCsiDynamixResult `json:"result,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_csidynamix
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeCustomAppService service
|
||||
@@ -124,6 +124,12 @@ type InstallRequest struct {
|
||||
//
|
||||
// Required.
|
||||
ReleaseNamespace string `json:"releaseNamespace" form:"releaseNamespace"`
|
||||
// full observes pods over time; lite waits until all pods are Running and Ready, then succeeds immediately.
|
||||
//
|
||||
// Allowed values:
|
||||
// - "full"
|
||||
// - "lite"
|
||||
CheckType string `json:"checkType" form:"checkType"`
|
||||
// Hostname for custom app
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Install timeout in minutes. Max is 60 minutes, min is 5 minutes. If not specified, default timeout of 10 minutes will be used
|
||||
@@ -161,6 +167,24 @@ func (a *DeCustomAppService) Install(ctx context.Context, req InstallRequest) (C
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.CheckType) {
|
||||
checkTypeValue := req.CheckType
|
||||
checkTypeAllowedValues := []string{
|
||||
"full",
|
||||
"lite",
|
||||
}
|
||||
checkTypeValid := false
|
||||
for _, allowed := range checkTypeAllowedValues {
|
||||
if checkTypeValue == allowed {
|
||||
checkTypeValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !checkTypeValid {
|
||||
return result, fmt.Errorf("checkType must be one of %v", checkTypeAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/customapp/install"
|
||||
|
||||
@@ -178,6 +202,7 @@ func (a *DeCustomAppService) Install(ctx context.Context, req InstallRequest) (C
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkType", req.CheckType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartId", req.ChartID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "releaseName", req.ReleaseName, "", "")
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_customapp
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_customapp
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeDatabaseService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_database
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_defectdojo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeDefectdojoService service
|
||||
|
||||
// Get defectdojo by id
|
||||
func (a *DeDefectdojoService) Describe(ctx context.Context, body DescribeDefectDojoRequest) (DescribeDefectDojoResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeDefectDojoResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/defectdojo/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeDefectDojoResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install defectdojo in cluster
|
||||
func (a *DeDefectdojoService) Install(ctx context.Context, body InstallDefectDojoRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/defectdojo/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall defectdojo from cluster
|
||||
func (a *DeDefectdojoService) Uninstall(ctx context.Context, body UninstallDefectDojoRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/defectdojo/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_defectdojo
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeDefectdojo *DeDefectdojoService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeDefectdojo = (*DeDefectdojoService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_defectdojo
|
||||
|
||||
type DefectDojoInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type DefectDojoRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
PsqlPassword string `json:"psqlPassword,omitempty"`
|
||||
PsqlUsername string `json:"psqlUsername,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeDefectDojoRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeDefectDojoResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry DefectDojoRecord `json:"registry,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeDefectDojoResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeDefectDojoResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallDefectDojoRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params DefectDojoInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallDefectDojoRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_defectdojo
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeDependencyTrackService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the dtrack is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s dtrack pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get dependency-track by id
|
||||
func (a *DeDependencyTrackService) Describe(ctx context.Context, req DescribeRequest) (DescribeDeptrackResult, error) {
|
||||
func (a *DeDependencyTrackService) Describe(ctx context.Context, body DescribeDeptrackRequest) (DescribeDeptrackResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeDependencyTrackService) Describe(ctx context.Context, req DescribeReq
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeDependencyTrackService) Describe(ctx context.Context, req DescribeReq
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/dependency-track/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeDependencyTrackService) Describe(ctx context.Context, req DescribeReq
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,38 +94,8 @@ func (a *DeDependencyTrackService) Describe(ctx context.Context, req DescribeReq
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// hostname for dependency track
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// password for the admin user. Do not use the password 'admin' because it will not work
|
||||
Password string `json:"password" form:"password"`
|
||||
// storage type
|
||||
//
|
||||
// Allowed values:
|
||||
// - "longhorn"
|
||||
// - "glusterfs"
|
||||
// - ""
|
||||
StorageClass string `json:"storageClass" form:"storageClass"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install dependency-track in cluster
|
||||
func (a *DeDependencyTrackService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeDependencyTrackService) Install(ctx context.Context, body InstallDeptrackRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -150,39 +107,17 @@ func (a *DeDependencyTrackService) Install(ctx context.Context, req InstallReque
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.StorageClass) {
|
||||
storageClassValue := req.StorageClass
|
||||
storageClassAllowedValues := []string{
|
||||
"longhorn",
|
||||
"glusterfs",
|
||||
"",
|
||||
}
|
||||
storageClassValid := false
|
||||
for _, allowed := range storageClassAllowedValues {
|
||||
if storageClassValue == allowed {
|
||||
storageClassValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !storageClassValid {
|
||||
return result, fmt.Errorf("storageClass must be one of %v", storageClassAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/dependency-track/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -196,15 +131,7 @@ func (a *DeDependencyTrackService) Install(ctx context.Context, req InstallReque
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "password", req.Password, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "storageClass", req.StorageClass, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -247,19 +174,8 @@ func (a *DeDependencyTrackService) Install(ctx context.Context, req InstallReque
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the dtrack even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall dependency-track from cluster
|
||||
func (a *DeDependencyTrackService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeDependencyTrackService) Uninstall(ctx context.Context, body UninstallDeptrackRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -271,8 +187,8 @@ func (a *DeDependencyTrackService) Uninstall(ctx context.Context, req UninstallR
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -281,7 +197,7 @@ func (a *DeDependencyTrackService) Uninstall(ctx context.Context, req UninstallR
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/dependency-track/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -295,9 +211,7 @@ func (a *DeDependencyTrackService) Uninstall(ctx context.Context, req UninstallR
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_dependency_track
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,25 @@
|
||||
|
||||
package de_dependency_track
|
||||
|
||||
type DeptrackInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type DeptrackRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -20,6 +39,12 @@ type DeptrackRecord struct {
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeDeptrackRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeDeptrackResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -34,3 +59,18 @@ type DescribeDeptrackResultWithError struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeDeptrackResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type InstallDeptrackRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params DeptrackInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallDeptrackRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_dependency_track
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeDeploymentService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_deployment
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
package de_deployment
|
||||
|
||||
type GetDeploymentResult struct {
|
||||
BuildBranchName string `json:"buildBranchName,omitempty"`
|
||||
BuildTime string `json:"buildTime,omitempty"`
|
||||
BuildVersionShort string `json:"buildVersionShort,omitempty"`
|
||||
CheckIstoreEntityResult string `json:"checkIstoreEntityResult,omitempty"`
|
||||
ReleaseVersion string `json:"releaseVersion,omitempty"`
|
||||
BuildBranchName string `json:"buildBranchName,omitempty"`
|
||||
BuildTime string `json:"buildTime,omitempty"`
|
||||
BuildVersionShort string `json:"buildVersionShort,omitempty"`
|
||||
CheckIstoreEntityResult []string `json:"checkIstoreEntityResult,omitempty"`
|
||||
ReleaseVersion string `json:"releaseVersion,omitempty"`
|
||||
}
|
||||
|
||||
type GetDeploymentResultWithError struct {
|
||||
|
||||
+17
-122
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeDisksService service
|
||||
@@ -33,22 +33,8 @@ type CreateRequest struct {
|
||||
DynamixPool string `json:"dynamixPool" form:"dynamixPool"`
|
||||
// Storage policy id (for denergy)
|
||||
DynamixStoragePolicyID int64 `json:"dynamixStoragePolicyId" form:"dynamixStoragePolicyId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Create disk
|
||||
@@ -97,15 +83,8 @@ func (a *DeDisksService) Create(ctx context.Context, req CreateRequest) (CreateD
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSepId", req.DynamixSEPID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPool", req.DynamixPool, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixStoragePolicyId", req.DynamixStoragePolicyID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixRGId", req.DynamixRGID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -157,22 +136,8 @@ type DeleteRequest struct {
|
||||
Detach bool `json:"detach" form:"detach"`
|
||||
// Whether to completely delete the disk, works only with non attached disks
|
||||
Permanently bool `json:"permanently" form:"permanently"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Delete disk
|
||||
@@ -215,14 +180,7 @@ func (a *DeDisksService) Delete(ctx context.Context, req DeleteRequest) (any, er
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "diskId", req.DiskID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "detach", req.Detach, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "permanently", req.Permanently, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -270,22 +228,8 @@ type GetRequest struct {
|
||||
//
|
||||
// Required.
|
||||
DiskID int64 `json:"diskId" form:"diskId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Get disk
|
||||
@@ -326,14 +270,7 @@ func (a *DeDisksService) Get(ctx context.Context, req GetRequest) (GetDiskResult
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "diskId", req.DiskID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -407,22 +344,8 @@ type ListRequest struct {
|
||||
RGID int64 `json:"rgId" form:"rgId"`
|
||||
// Find by id of the compute
|
||||
ComputeID int64 `json:"computeId" form:"computeId"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// List disks
|
||||
@@ -470,14 +393,7 @@ func (a *DeDisksService) List(ctx context.Context, req ListRequest) (ListDisksRe
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "size", req.Size, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "rgId", req.RGID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "computeId", req.ComputeID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -529,22 +445,8 @@ type ResizeRequest struct {
|
||||
//
|
||||
// Required.
|
||||
Size int64 `json:"size" form:"size"`
|
||||
// Dynamix auth type: ssoAuth, bvsAuth
|
||||
DynamixAuthType string `json:"dynamixAuthType" form:"dynamixAuthType"`
|
||||
// Dynamix auth domain
|
||||
DynamixAuthDomain string `json:"dynamixAuthDomain" form:"dynamixAuthDomain"`
|
||||
// Dynamix username
|
||||
DynamixUsername string `json:"dynamixUsername" form:"dynamixUsername"`
|
||||
// Dynamix password
|
||||
DynamixPassword string `json:"dynamixPassword" form:"dynamixPassword"`
|
||||
// Dynamix app ID (for denergy type)
|
||||
DynamixAppID string `json:"dynamixAppId" form:"dynamixAppId"`
|
||||
// Dynamix app secret (for denergy type)
|
||||
DynamixAppSecret string `json:"dynamixAppSecret" form:"dynamixAppSecret"`
|
||||
// Dynamix URL (for denergy type)
|
||||
DynamixURL string `json:"dynamixURL" form:"dynamixURL"`
|
||||
// Dynamix SSO URL (for denergy type)
|
||||
DynamixSSOURL string `json:"dynamixSSOURL" form:"dynamixSSOURL"`
|
||||
// Specify which dynamix platform ID to use. If not specified, defaults to the first dynamix user data
|
||||
DynamixPlatformID int64 `json:"dynamixPlatformId" form:"dynamixPlatformId"`
|
||||
}
|
||||
|
||||
// Resize disk
|
||||
@@ -589,14 +491,7 @@ func (a *DeDisksService) Resize(ctx context.Context, req ResizeRequest) (any, er
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "diskId", req.DiskID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "size", req.Size, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthType", req.DynamixAuthType, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAuthDomain", req.DynamixAuthDomain, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixUsername", req.DynamixUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPassword", req.DynamixPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppId", req.DynamixAppID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixAppSecret", req.DynamixAppSecret, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixURL", req.DynamixURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixSSOURL", req.DynamixSSOURL, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "dynamixPlatformId", req.DynamixPlatformID, "", "")
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_disks
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeEssService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_ess
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_ess
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeFalcoService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the Falco is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for returning the actual loaded rules by nodes
|
||||
CheckRules bool `json:"checkRules" form:"checkRules"`
|
||||
}
|
||||
|
||||
// Get Falco info by cluster id
|
||||
func (a *DeFalcoService) Describe(ctx context.Context, req DescribeRequest) (DescribeFalcoResult, error) {
|
||||
func (a *DeFalcoService) Describe(ctx context.Context, body DescribeFalcoRequest) (DescribeFalcoResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeFalcoService) Describe(ctx context.Context, req DescribeRequest) (Des
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeFalcoService) Describe(ctx context.Context, req DescribeRequest) (Des
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/falco/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeFalcoService) Describe(ctx context.Context, req DescribeRequest) (Des
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkRules", req.CheckRules, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,21 +94,8 @@ func (a *DeFalcoService) Describe(ctx context.Context, req DescribeRequest) (Des
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install Falco in cluster
|
||||
func (a *DeFalcoService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeFalcoService) Install(ctx context.Context, body InstallFalcoRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -133,8 +107,8 @@ func (a *DeFalcoService) Install(ctx context.Context, req InstallRequest) (Creat
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -143,7 +117,7 @@ func (a *DeFalcoService) Install(ctx context.Context, req InstallRequest) (Creat
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/falco/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -157,10 +131,7 @@ func (a *DeFalcoService) Install(ctx context.Context, req InstallRequest) (Creat
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -203,15 +174,8 @@ func (a *DeFalcoService) Install(ctx context.Context, req InstallRequest) (Creat
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
}
|
||||
|
||||
// Uninstall Falco from cluster
|
||||
func (a *DeFalcoService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeFalcoService) Uninstall(ctx context.Context, body UninstallFalcoRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -223,8 +187,8 @@ func (a *DeFalcoService) Uninstall(ctx context.Context, req UninstallRequest) (C
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -233,7 +197,7 @@ func (a *DeFalcoService) Uninstall(ctx context.Context, req UninstallRequest) (C
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/falco/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -247,7 +211,7 @@ func (a *DeFalcoService) Uninstall(ctx context.Context, req UninstallRequest) (C
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_falco
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
+40
-1
@@ -2,12 +2,17 @@
|
||||
|
||||
package de_falco
|
||||
|
||||
type DescribeFalcoRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeFalcoResult struct {
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry FalcoRecord `json:"registry,omitempty"`
|
||||
Rules []string `json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeFalcoResultWithError struct {
|
||||
@@ -17,6 +22,25 @@ type DescribeFalcoResultWithError struct {
|
||||
Result DescribeFalcoResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type FalcoInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type FalcoRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -31,3 +55,18 @@ type FalcoRecord struct {
|
||||
UpdatedAt int64 `json:"updatedAt,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallFalcoRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params FalcoInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallFalcoRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_falco
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_filebeat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeFilebeatService service
|
||||
|
||||
// Get Filebeat info by cluster id
|
||||
func (a *DeFilebeatService) Describe(ctx context.Context, body DescribeFilebeatRequest) (DescribeFilebeatResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeFilebeatResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/filebeat/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeFilebeatResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install Filebeat in cluster
|
||||
func (a *DeFilebeatService) Install(ctx context.Context, body InstallFilebeatRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/filebeat/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall Filebeat from cluster
|
||||
func (a *DeFilebeatService) Uninstall(ctx context.Context, body UninstallFilebeatRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/filebeat/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_filebeat
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeFilebeat *DeFilebeatService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeFilebeat = (*DeFilebeatService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_filebeat
|
||||
|
||||
type DescribeFilebeatRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeFilebeatResult struct {
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry FilebeatRecord `json:"registry,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeFilebeatResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeFilebeatResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type FilebeatInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
FilebeatYMLConfig string `json:"filebeatYMLConfig"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
SecretParams map[string]string `json:"secretParams,omitempty"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type FilebeatRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallFilebeatRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params FilebeatInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallFilebeatRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_filebeat
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeFilesService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_files
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_fluentbit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeFluentbitService service
|
||||
|
||||
// Get FluentBit info by cluster id
|
||||
func (a *DeFluentbitService) Describe(ctx context.Context, body DescribeFluentBitRequest) (DescribeFluentBitResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeFluentBitResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/fluentbit/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeFluentBitResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install FluentBit in cluster
|
||||
func (a *DeFluentbitService) Install(ctx context.Context, body InstallFluentBitRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/fluentbit/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall FluentBit from cluster
|
||||
func (a *DeFluentbitService) Uninstall(ctx context.Context, body UninstallFluentBitRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/fluentbit/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_fluentbit
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeFluentbit *DeFluentbitService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeFluentbit = (*DeFluentbitService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_fluentbit
|
||||
|
||||
type DescribeFluentBitRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeFluentBitResult struct {
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry FluentBitRecord `json:"registry,omitempty"`
|
||||
Rules []string `json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeFluentBitResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeFluentBitResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type FluentBitInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
LogOutputHost string `json:"logOutputHost"`
|
||||
LogOutputPassword string `json:"logOutputPassword"`
|
||||
LogOutputPort string `json:"logOutputPort"`
|
||||
LogOutputUser string `json:"logOutputUser"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type FluentBitRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallFluentBitRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params FluentBitInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallFluentBitRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_fluentbit
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
type CreateTaskResultWithError = shared.CreateTaskResultWithError
|
||||
type ProductDescr = shared.ProductDescr
|
||||
@@ -0,0 +1,255 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_gitea
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeGiteaService service
|
||||
|
||||
// Get gitea by id
|
||||
func (a *DeGiteaService) Describe(ctx context.Context, body DescribeGiteaRequest) (DescribeGiteaResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result DescribeGiteaResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitea/describe"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp DescribeGiteaResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Install gitea in cluster
|
||||
func (a *DeGiteaService) Install(ctx context.Context, body InstallGiteaRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitea/install"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Uninstall gitea from cluster
|
||||
func (a *DeGiteaService) Uninstall(ctx context.Context, body UninstallGiteaRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
formFiles []utils.FormFile
|
||||
result CreateTaskResult
|
||||
)
|
||||
|
||||
headerParams := make(map[string]string)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitea/uninstall"
|
||||
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
accepts := []string{"application/json"}
|
||||
|
||||
accept := utils.SelectHeaderAccept(accepts)
|
||||
if accept != "" {
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("prepare request: %w", err)
|
||||
}
|
||||
|
||||
resp, err := a.client.CallAPI(httpReq, false)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
respBody, err := utils.ReadResponseBody(resp)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
httpErr := &core.HTTPError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Header: resp.Header.Clone(),
|
||||
Body: respBody,
|
||||
}
|
||||
return result, httpErr
|
||||
}
|
||||
|
||||
var wrappedResp CreateTaskResultWithError
|
||||
err = a.client.Decode(&wrappedResp, respBody, resp.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return result, fmt.Errorf("decode response body: %w", err)
|
||||
}
|
||||
|
||||
if wrappedResp.Error {
|
||||
return result, &core.BackendError{
|
||||
Code: wrappedResp.ErrorCode,
|
||||
Message: wrappedResp.Message,
|
||||
}
|
||||
}
|
||||
result = wrappedResp.Result
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by OpenAPI Generator; DO NOT EDIT.
|
||||
|
||||
package de_gitea
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
common service
|
||||
|
||||
DeGitea *DeGiteaService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *utils.Client
|
||||
}
|
||||
|
||||
func NewAPIClient(cfg *core.Configuration) *APIClient {
|
||||
c := &APIClient{}
|
||||
c.common.client = utils.NewClient(cfg)
|
||||
|
||||
c.DeGitea = (*DeGiteaService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_gitea
|
||||
|
||||
type DescribeGiteaRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeGiteaResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
Installed bool `json:"installed,omitempty"`
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
Registry GiteaRecord `json:"registry,omitempty"`
|
||||
}
|
||||
|
||||
type DescribeGiteaResultWithError struct {
|
||||
Error bool `json:"error,omitempty"`
|
||||
ErrorCode int64 `json:"errorCode,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Result DescribeGiteaResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GiteaInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type GiteaRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
Hostnames map[string]string `json:"hostnames,omitempty"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OwnerID int64 `json:"ownerId,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
ProductName string `json:"productName,omitempty"`
|
||||
ProductVersion string `json:"productVersion,omitempty"`
|
||||
PsqlPassword string `json:"psqlPassword,omitempty"`
|
||||
PsqlUsername string `json:"psqlUsername,omitempty"`
|
||||
StorageType string `json:"storageType,omitempty"`
|
||||
TaskIDs []int64 `json:"taskIds,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallGiteaRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params GiteaInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallGiteaRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
// Code generated by internal codegen utility; DO NOT EDIT.
|
||||
|
||||
package de_minio
|
||||
package de_gitea
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
+17
-112
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeGitLabService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the gitlab is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s gitlab pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get gitlab by id
|
||||
func (a *DeGitLabService) Describe(ctx context.Context, req DescribeRequest) (DescribeGitLabResult, error) {
|
||||
func (a *DeGitLabService) Describe(ctx context.Context, body DescribeGitLabRequest) (DescribeGitLabResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeGitLabService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeGitLabService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitlab/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeGitLabService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,44 +94,8 @@ func (a *DeGitLabService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// hostname for gitlab
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// storage type
|
||||
//
|
||||
// Allowed values:
|
||||
// - "longhorn"
|
||||
// - "glusterfs"
|
||||
// - ""
|
||||
StorageClass string `json:"storageClass" form:"storageClass"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
// external postgresql address (host with optional port); when set, the other psql fields are required and the internal cluster postgresql is not used
|
||||
PsqlAddress string `json:"psqlAddress" form:"psqlAddress"`
|
||||
// external postgresql user name (user and database must be pre-created)
|
||||
PsqlUsername string `json:"psqlUsername" form:"psqlUsername"`
|
||||
// external postgresql user password
|
||||
PsqlPassword string `json:"psqlPassword" form:"psqlPassword"`
|
||||
// external postgresql database name (the user must own the database)
|
||||
PsqlDatabase string `json:"psqlDatabase" form:"psqlDatabase"`
|
||||
}
|
||||
|
||||
// Install gitlab in cluster
|
||||
func (a *DeGitLabService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeGitLabService) Install(ctx context.Context, body InstallGitLabRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -156,39 +107,17 @@ func (a *DeGitLabService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.StorageClass) {
|
||||
storageClassValue := req.StorageClass
|
||||
storageClassAllowedValues := []string{
|
||||
"longhorn",
|
||||
"glusterfs",
|
||||
"",
|
||||
}
|
||||
storageClassValid := false
|
||||
for _, allowed := range storageClassAllowedValues {
|
||||
if storageClassValue == allowed {
|
||||
storageClassValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !storageClassValid {
|
||||
return result, fmt.Errorf("storageClass must be one of %v", storageClassAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitlab/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -202,18 +131,7 @@ func (a *DeGitLabService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "storageClass", req.StorageClass, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "psqlAddress", req.PsqlAddress, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "psqlUsername", req.PsqlUsername, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "psqlPassword", req.PsqlPassword, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "psqlDatabase", req.PsqlDatabase, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -256,19 +174,8 @@ func (a *DeGitLabService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the gitlab even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall gitlab from cluster
|
||||
func (a *DeGitLabService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeGitLabService) Uninstall(ctx context.Context, body UninstallGitLabRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -280,8 +187,8 @@ func (a *DeGitLabService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -290,7 +197,7 @@ func (a *DeGitLabService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/gitlab/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -304,9 +211,7 @@ func (a *DeGitLabService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_gitlab
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
package de_gitlab
|
||||
|
||||
type DescribeGitLabRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeGitLabResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -17,6 +23,30 @@ type DescribeGitLabResultWithError struct {
|
||||
Result DescribeGitLabResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GitLabInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
// External postgresql parameters. All four must be set together; when set, the in-cluster postgresql-ha product is not required.
|
||||
PsqlAddress string `json:"psqlAddress"`
|
||||
PsqlDatabase string `json:"psqlDatabase"`
|
||||
PsqlPassword string `json:"psqlPassword"`
|
||||
PsqlUsername string `json:"psqlUsername"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type GitLabRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -36,3 +66,18 @@ type GitLabRecord struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallGitLabRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params GitLabInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallGitLabRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_gitlab
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeGrafanaService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the grafana is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s grafana pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get grafana by id
|
||||
func (a *DeGrafanaService) Describe(ctx context.Context, req DescribeRequest) (DescribeGrafanaResult, error) {
|
||||
func (a *DeGrafanaService) Describe(ctx context.Context, body DescribeGrafanaRequest) (DescribeGrafanaResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeGrafanaService) Describe(ctx context.Context, req DescribeRequest) (D
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeGrafanaService) Describe(ctx context.Context, req DescribeRequest) (D
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/grafana/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeGrafanaService) Describe(ctx context.Context, req DescribeRequest) (D
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,44 +94,8 @@ func (a *DeGrafanaService) Describe(ctx context.Context, req DescribeRequest) (D
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// grafana hostname
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// username
|
||||
//
|
||||
// Required.
|
||||
Username string `json:"username" form:"username"`
|
||||
// password
|
||||
//
|
||||
// Required.
|
||||
Password string `json:"password" form:"password"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// storage type
|
||||
//
|
||||
// Allowed values:
|
||||
// - "longhorn"
|
||||
// - "glusterfs"
|
||||
// - ""
|
||||
StorageClass string `json:"storageClass" form:"storageClass"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install grafana in cluster
|
||||
func (a *DeGrafanaService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeGrafanaService) Install(ctx context.Context, body InstallGrafanaRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -156,45 +107,17 @@ func (a *DeGrafanaService) Install(ctx context.Context, req InstallRequest) (Cre
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Username) {
|
||||
missingRequiredParams = append(missingRequiredParams, "username")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Password) {
|
||||
missingRequiredParams = append(missingRequiredParams, "password")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.StorageClass) {
|
||||
storageClassValue := req.StorageClass
|
||||
storageClassAllowedValues := []string{
|
||||
"longhorn",
|
||||
"glusterfs",
|
||||
"",
|
||||
}
|
||||
storageClassValid := false
|
||||
for _, allowed := range storageClassAllowedValues {
|
||||
if storageClassValue == allowed {
|
||||
storageClassValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !storageClassValid {
|
||||
return result, fmt.Errorf("storageClass must be one of %v", storageClassAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/grafana/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -208,16 +131,7 @@ func (a *DeGrafanaService) Install(ctx context.Context, req InstallRequest) (Cre
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "username", req.Username, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "password", req.Password, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "storageClass", req.StorageClass, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -260,19 +174,8 @@ func (a *DeGrafanaService) Install(ctx context.Context, req InstallRequest) (Cre
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the grafana even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall grafana from cluster
|
||||
func (a *DeGrafanaService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeGrafanaService) Uninstall(ctx context.Context, body UninstallGrafanaRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -284,8 +187,8 @@ func (a *DeGrafanaService) Uninstall(ctx context.Context, req UninstallRequest)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -294,7 +197,7 @@ func (a *DeGrafanaService) Uninstall(ctx context.Context, req UninstallRequest)
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/grafana/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -308,9 +211,7 @@ func (a *DeGrafanaService) Uninstall(ctx context.Context, req UninstallRequest)
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_grafana
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
package de_grafana
|
||||
|
||||
type DescribeGrafanaRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeGrafanaResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -17,6 +23,25 @@ type DescribeGrafanaResultWithError struct {
|
||||
Result DescribeGrafanaResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type GrafanaInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type GrafanaRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -34,3 +59,18 @@ type GrafanaRecord struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallGrafanaRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params GrafanaInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallGrafanaRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_grafana
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeGroupService service
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_group
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
+17
-116
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeHarborService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the harbor is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s harbor pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get harbor by id
|
||||
func (a *DeHarborService) Describe(ctx context.Context, req DescribeRequest) (DescribeHarborResult, error) {
|
||||
func (a *DeHarborService) Describe(ctx context.Context, body DescribeHarborRequest) (DescribeHarborResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeHarborService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeHarborService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/harbor/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeHarborService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,44 +94,8 @@ func (a *DeHarborService) Describe(ctx context.Context, req DescribeRequest) (De
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// username for harbor
|
||||
//
|
||||
// Required.
|
||||
Username string `json:"username" form:"username"`
|
||||
// password for the admin user
|
||||
//
|
||||
// Required.
|
||||
Password string `json:"password" form:"password"`
|
||||
// hostname for harbor
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// storage type
|
||||
//
|
||||
// Allowed values:
|
||||
// - "longhorn"
|
||||
// - "glusterfs"
|
||||
// - ""
|
||||
StorageClass string `json:"storageClass" form:"storageClass"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install harbor in cluster
|
||||
func (a *DeHarborService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeHarborService) Install(ctx context.Context, body InstallHarborRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -156,45 +107,17 @@ func (a *DeHarborService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Username) {
|
||||
missingRequiredParams = append(missingRequiredParams, "username")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Password) {
|
||||
missingRequiredParams = append(missingRequiredParams, "password")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
}
|
||||
|
||||
if !utils.IsZeroValue(req.StorageClass) {
|
||||
storageClassValue := req.StorageClass
|
||||
storageClassAllowedValues := []string{
|
||||
"longhorn",
|
||||
"glusterfs",
|
||||
"",
|
||||
}
|
||||
storageClassValid := false
|
||||
for _, allowed := range storageClassAllowedValues {
|
||||
if storageClassValue == allowed {
|
||||
storageClassValid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !storageClassValid {
|
||||
return result, fmt.Errorf("storageClass must be one of %v", storageClassAllowedValues)
|
||||
}
|
||||
}
|
||||
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/harbor/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -208,16 +131,7 @@ func (a *DeHarborService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "username", req.Username, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "password", req.Password, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "storageClass", req.StorageClass, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -260,19 +174,8 @@ func (a *DeHarborService) Install(ctx context.Context, req InstallRequest) (Crea
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the harbor even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall harbor from cluster
|
||||
func (a *DeHarborService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeHarborService) Uninstall(ctx context.Context, body UninstallHarborRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -284,8 +187,8 @@ func (a *DeHarborService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -294,7 +197,7 @@ func (a *DeHarborService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/harbor/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -308,9 +211,7 @@ func (a *DeHarborService) Uninstall(ctx context.Context, req UninstallRequest) (
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_harbor
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
package de_harbor
|
||||
|
||||
type DescribeHarborRequest struct {
|
||||
CheckInstallation bool `json:"checkInstallation"`
|
||||
CheckLiveness bool `json:"checkLiveness"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
}
|
||||
|
||||
type DescribeHarborResult struct {
|
||||
CheckListOk bool `json:"checkListOk,omitempty"`
|
||||
Description ProductDescr `json:"description,omitempty"`
|
||||
@@ -17,6 +23,25 @@ type DescribeHarborResultWithError struct {
|
||||
Result DescribeHarborResult `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
type HarborInstallParams struct {
|
||||
Affinity string `json:"affinity"`
|
||||
CPULimit string `json:"cpuLimit"`
|
||||
CPURequest string `json:"cpuRequest"`
|
||||
Hostname string `json:"hostname"`
|
||||
MemoryLimit string `json:"memoryLimit"`
|
||||
MemoryRequest string `json:"memoryRequest"`
|
||||
Namespace string `json:"namespace"`
|
||||
Password string `json:"password"`
|
||||
Replicas int64 `json:"replicas"`
|
||||
ServicePort int64 `json:"servicePort"`
|
||||
ServiceTargetPort int64 `json:"serviceTargetPort"`
|
||||
StorageClass string `json:"storageClass"`
|
||||
StorageSize string `json:"storageSize"`
|
||||
Tolerations string `json:"tolerations"`
|
||||
Username string `json:"username"`
|
||||
WorkerGroupName string `json:"workerGroupName"`
|
||||
}
|
||||
|
||||
type HarborRecord struct {
|
||||
Addresses map[string]string `json:"addresses,omitempty"`
|
||||
ClusterID int64 `json:"clusterId,omitempty"`
|
||||
@@ -34,3 +59,18 @@ type HarborRecord struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
WorkerGroupName string `json:"workerGroupName,omitempty"`
|
||||
}
|
||||
|
||||
type InstallHarborRequest struct {
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId"`
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId"`
|
||||
CheckType string `json:"checkType"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway"`
|
||||
Params HarborInstallParams `json:"params"`
|
||||
}
|
||||
|
||||
type UninstallHarborRequest struct {
|
||||
CleanAlways bool `json:"cleanAlways"`
|
||||
ClusterID int64 `json:"clusterId"`
|
||||
IgnoreDNSError bool `json:"ignoreDnsError"`
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
package de_harbor
|
||||
|
||||
import (
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/shared"
|
||||
shared "repository.basistech.ru/BASIS/de-golang-sdk/v2/shared"
|
||||
)
|
||||
|
||||
type CreateTaskResult = shared.CreateTaskResult
|
||||
|
||||
@@ -8,25 +8,14 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type DeIngressNginxService service
|
||||
|
||||
type DescribeRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for checking whether the nginx is installed in the cluster
|
||||
CheckInstallation bool `json:"checkInstallation" form:"checkInstallation"`
|
||||
// true for checking k8s nginx pods liveness and the availability of the API
|
||||
CheckLiveness bool `json:"checkLiveness" form:"checkLiveness"`
|
||||
}
|
||||
|
||||
// Get nginx by id
|
||||
func (a *DeIngressNginxService) Describe(ctx context.Context, req DescribeRequest) (DescribeNginxResult, error) {
|
||||
func (a *DeIngressNginxService) Describe(ctx context.Context, body DescribeNginxRequest) (DescribeNginxResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -38,8 +27,8 @@ func (a *DeIngressNginxService) Describe(ctx context.Context, req DescribeReques
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -48,7 +37,7 @@ func (a *DeIngressNginxService) Describe(ctx context.Context, req DescribeReques
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/ingress-nginx/describe"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -62,9 +51,7 @@ func (a *DeIngressNginxService) Describe(ctx context.Context, req DescribeReques
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkInstallation", req.CheckInstallation, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "checkLiveness", req.CheckLiveness, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -107,35 +94,8 @@ func (a *DeIngressNginxService) Describe(ctx context.Context, req DescribeReques
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type InstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// hostname for nginx
|
||||
//
|
||||
// Required.
|
||||
Hostname string `json:"hostname" form:"hostname"`
|
||||
// http port
|
||||
//
|
||||
// Required.
|
||||
HTTPPort int64 `json:"httpPort" form:"httpPort"`
|
||||
// Hostname for integagent
|
||||
IntegagentHostname string `json:"integagentHostname" form:"integagentHostname"`
|
||||
// https port
|
||||
HTTPSPort int64 `json:"httpsPort" form:"httpsPort"`
|
||||
// images apps repository ID. If the ID is zero or the value is empty, the default images apps repository will be used.
|
||||
AppsRepositoryID int64 `json:"appsRepositoryId" form:"appsRepositoryId"`
|
||||
// charts repository ID. If the ID is zero or the value is empty, the default charts repository will be used.
|
||||
ChartsRepositoryID int64 `json:"chartsRepositoryId" form:"chartsRepositoryId"`
|
||||
// worker group name
|
||||
WorkerGroupName string `json:"workerGroupName" form:"workerGroupName"`
|
||||
// download chart anyway
|
||||
DownloadChartAnyway bool `json:"downloadChartAnyway" form:"downloadChartAnyway"`
|
||||
}
|
||||
|
||||
// Install nginx in cluster
|
||||
func (a *DeIngressNginxService) Install(ctx context.Context, req InstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeIngressNginxService) Install(ctx context.Context, body InstallNginxRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -147,14 +107,8 @@ func (a *DeIngressNginxService) Install(ctx context.Context, req InstallRequest)
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.Hostname) {
|
||||
missingRequiredParams = append(missingRequiredParams, "hostname")
|
||||
}
|
||||
if utils.IsRequiredParamMissing(req.HTTPPort) {
|
||||
missingRequiredParams = append(missingRequiredParams, "httpPort")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -163,7 +117,7 @@ func (a *DeIngressNginxService) Install(ctx context.Context, req InstallRequest)
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/ingress-nginx/install"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -177,15 +131,7 @@ func (a *DeIngressNginxService) Install(ctx context.Context, req InstallRequest)
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "hostname", req.Hostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "integagentHostname", req.IntegagentHostname, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "httpPort", req.HTTPPort, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "httpsPort", req.HTTPSPort, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "appsRepositoryId", req.AppsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "chartsRepositoryId", req.ChartsRepositoryID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "workerGroupName", req.WorkerGroupName, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "downloadChartAnyway", req.DownloadChartAnyway, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
@@ -228,19 +174,8 @@ func (a *DeIngressNginxService) Install(ctx context.Context, req InstallRequest)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UninstallRequest struct {
|
||||
// cluster ID
|
||||
//
|
||||
// Required.
|
||||
ClusterID int64 `json:"clusterId" form:"clusterId"`
|
||||
// true for deleting the nginx even if it is not registered
|
||||
CleanAlways bool `json:"cleanAlways" form:"cleanAlways"`
|
||||
// true for ignoring dns server errors
|
||||
IgnoreDNSError bool `json:"ignoreDnsError" form:"ignoreDnsError"`
|
||||
}
|
||||
|
||||
// Uninstall nginx from cluster
|
||||
func (a *DeIngressNginxService) Uninstall(ctx context.Context, req UninstallRequest) (CreateTaskResult, error) {
|
||||
func (a *DeIngressNginxService) Uninstall(ctx context.Context, body UninstallNginxRequest) (CreateTaskResult, error) {
|
||||
var (
|
||||
method = http.MethodPost
|
||||
requestBody any
|
||||
@@ -252,8 +187,8 @@ func (a *DeIngressNginxService) Uninstall(ctx context.Context, req UninstallRequ
|
||||
queryParams := url.Values{}
|
||||
formParams := url.Values{}
|
||||
missingRequiredParams := make([]string, 0)
|
||||
if utils.IsRequiredParamMissing(req.ClusterID) {
|
||||
missingRequiredParams = append(missingRequiredParams, "clusterId")
|
||||
if utils.IsRequiredBodyMissing(body) {
|
||||
missingRequiredParams = append(missingRequiredParams, "request")
|
||||
}
|
||||
if len(missingRequiredParams) > 0 {
|
||||
return result, utils.MissingRequiredParamsError(missingRequiredParams)
|
||||
@@ -262,7 +197,7 @@ func (a *DeIngressNginxService) Uninstall(ctx context.Context, req UninstallRequ
|
||||
basePath := a.client.BaseURL()
|
||||
requestPath := basePath + "/digitalenergy/ingress-nginx/uninstall"
|
||||
|
||||
contentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
contentTypes := []string{"application/json"}
|
||||
|
||||
contentType := utils.SelectHeaderContentType(contentTypes)
|
||||
if contentType != "" {
|
||||
@@ -276,9 +211,7 @@ func (a *DeIngressNginxService) Uninstall(ctx context.Context, req UninstallRequ
|
||||
headerParams["Accept"] = accept
|
||||
}
|
||||
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "clusterId", req.ClusterID, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "cleanAlways", req.CleanAlways, "", "")
|
||||
utils.ParameterAddToHeaderOrQuery(formParams, "ignoreDnsError", req.IgnoreDNSError, "", "")
|
||||
requestBody = body
|
||||
|
||||
httpReq, err := a.client.PrepareRequest(ctx, requestPath, method, requestBody, headerParams, queryParams, formParams, formFiles)
|
||||
if err != nil {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
package de_ingress_nginx
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/internal/utils"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/core"
|
||||
"repository.basistech.ru/BASIS/de-golang-sdk/v2/internal/utils"
|
||||
)
|
||||
|
||||
type APIClient struct {
|
||||
|
||||
Loaded 100 of 329 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user