Skip to content

Commit

Permalink
chore: generate code from support/tidy-up-api-spec-for-028 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ldming committed Oct 30, 2024
1 parent 2b43434 commit 4ab1c14
Show file tree
Hide file tree
Showing 824 changed files with 23,288 additions and 15,131 deletions.
376 changes: 58 additions & 318 deletions .generator/schemas/adminapi.yaml

Large diffs are not rendered by default.

59 changes: 40 additions & 19 deletions .generator/schemas/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -776,16 +776,6 @@ paths:
required: true
schema:
type: string
- description: engine name
in: query
name: engine
schema:
type: string
- description: version of the engine
in: query
name: version
schema:
type: string
responses:
'200':
content:
Expand Down Expand Up @@ -956,6 +946,45 @@ paths:
tags:
- environment
x-codegen-request-body-name: body
/api/v1/organizations/{orgName}/engine/{engineName}/version/{version}/environments:
get:
operationId: filterEnvironment
description: List environments
summary: List environments
parameters:
- description: name of the org
in: path
name: orgName
required: true
schema:
type: string
- description: name of the engine
in: path
name: engineName
required: true
schema:
type: string
- description: version of the engine
in: path
name: version
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/environmentList'
description: A successful response.
'403':
content: {}
description: Returned when the user does not have permission to access the resource.
'404':
content: {}
description: Returned when the resource does not exist.
tags:
- environment
/api/v1/organizations/{orgName}/benchmark:
get:
tags:
Expand Down Expand Up @@ -1518,7 +1547,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/cluster'
description: Returned when project is updated successfully.
description: Returned when project is deleted successfully.
'401':
$ref: '#/components/responses/UnauthorizedResponse'
tags:
Expand Down Expand Up @@ -9207,9 +9236,7 @@ components:
- READY
- WARNING
- UNREACHABLE
- DELETING
- OUTOFSTOCK
- UPDATING
environmentType:
type: string
description: Type of this environment
Expand Down Expand Up @@ -10519,9 +10546,6 @@ components:
codeShort:
description: Cluster main component codeShort
type: string
displayName:
description: Display name of cluster.
type: string
description: KubeBlocks cluster information
clusterUpdate:
type: object
Expand Down Expand Up @@ -10574,9 +10598,6 @@ components:
title: Tolerations
type: string
description: Tolerations of cluster
displayName:
description: Display name of cluster.
type: string
description: ClusterUpdate is the payload to update a KubeBlocks cluster
instanceStorageItem:
description: Instance storage information
Expand Down
18 changes: 10 additions & 8 deletions api/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// This product includes software developed at ApeCloud (https://www.apecloud.com/).
// Copyright 2022-Present ApeCloud Co., Ltd


package common

import (
"bytes"
"compress/gzip"
"compress/zlib"
"context"
"compress/zlib"
"compress/gzip"
"encoding/xml"
"errors"
"fmt"
Expand All @@ -26,6 +27,7 @@ import (
"strconv"
"strings"
"time"
"unicode/utf8"

"golang.org/x/oauth2"
)
Expand All @@ -39,14 +41,14 @@ var (
// APIClient manages communication with the KubeBlocks Cloud API API v1.0.0.
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
Cfg *Configuration
Cfg *Configuration
}

// FormFile holds parameters for a file in multipart/form-data request.
type FormFile struct {
FormFileName string
FileName string
FileBytes []byte
FileName string
FileBytes []byte
}

// Service holds APIClient
Expand Down Expand Up @@ -180,7 +182,7 @@ func (c *APIClient) CallAPI(request *http.Request) (*http.Response, error) {
}
}

// Determine if a request should be retried
// Determine if a request should be retried
func (c *APIClient) shouldRetryRequest(response *http.Response, retryCount int) (*time.Duration, bool) {
enableRetry := c.Cfg.RetryConfiguration.EnableRetry
maxRetries := c.Cfg.RetryConfiguration.MaxRetries
Expand Down Expand Up @@ -512,9 +514,9 @@ func detectContentType(body interface{}) string {

// GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct {
ErrorBody []byte
ErrorBody []byte
ErrorMessage string
ErrorModel interface{}
ErrorModel interface{}
}

// Error returns non-empty string if there was an error.
Expand Down
19 changes: 12 additions & 7 deletions api/common/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at ApeCloud (https://www.apecloud.com/).
// Copyright 2022-Present ApeCloud Co., Ltd


package common

import (
Expand Down Expand Up @@ -108,33 +109,37 @@ type RetryConfiguration struct {
HTTPRetryTimeout time.Duration
MaxRetries int
}

// NewConfiguration returns a new Configuration object.
func NewConfiguration() *Configuration {
cfg := &Configuration{
DefaultHeader: make(map[string]string),
UserAgent: getUserAgent(),
Debug: false,
Compress: true,
Servers: ServerConfigurations{
Servers: ServerConfigurations{
{
URL: "http://127.0.0.1:8080",
Description: "local",
Variables: map[string]ServerVariable{},
Variables: map[string]ServerVariable{
},
},
{
URL: "https://api-dev.apecloud.cn",
Description: "dev",
Variables: map[string]ServerVariable{},
Variables: map[string]ServerVariable{
},
},
{
URL: "https://cloudapi.apecloud.cn",
Description: "demo",
Variables: map[string]ServerVariable{},
Variables: map[string]ServerVariable{
},
},
},
OperationServers: map[string]ServerConfigurations{},
unstableOperations: map[string]bool{},
OperationServers: map[string]ServerConfigurations{
},
unstableOperations: map[string]bool{
},
RetryConfiguration: RetryConfiguration{
EnableRetry: false,
BackOffMultiplier: 2,
Expand Down
3 changes: 2 additions & 1 deletion api/common/encoding_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at ApeCloud (https://www.apecloud.com/).
// Copyright 2022-Present ApeCloud Co., Ltd


//go:build !goccy_gojson

package common
Expand All @@ -25,4 +26,4 @@ func NewEncoder(w io.Writer) *json.Encoder {

func NewDecoder(r io.Reader) *json.Decoder {
return json.NewDecoder(r)
}
}
3 changes: 2 additions & 1 deletion api/common/goccy_gojson.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at ApeCloud (https://www.apecloud.com/).
// Copyright 2022-Present ApeCloud Co., Ltd


//go:build goccy_gojson

package common
Expand All @@ -26,4 +27,4 @@ func NewEncoder(w io.Writer) *json.Encoder {

func NewDecoder(r io.Reader) *json.Decoder {
return json.NewDecoder(r)
}
}
6 changes: 3 additions & 3 deletions api/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This product includes software developed at ApeCloud (https://www.apecloud.com/).
// Copyright 2022-Present ApeCloud Co., Ltd


package common

import (
Expand All @@ -11,7 +12,6 @@ import (
"reflect"
"strings"
"time"
"unicode/utf8"
)

// PtrBool is a helper routine that returns a pointer to given boolean value.
Expand Down Expand Up @@ -43,7 +43,7 @@ func Ptr[T any](v T) *T { return &v }

// PaginationResult pagination item helper struct
type PaginationResult[T any] struct {
Item T
Item T
Error error
}

Expand Down Expand Up @@ -513,4 +513,4 @@ func copyRequest(r *http.Request, rawBody *[]byte) *http.Request {
}
newRequest.Body = io.NopCloser(bytes.NewBuffer(*rawBody))
return &newRequest
}
}
Loading

0 comments on commit 4ab1c14

Please sign in to comment.