Skip to content

Commit b901a01

Browse files
committed
chore: auto update client api apecloud/apecloud@c7f9e2e
1 parent 12d0889 commit b901a01

File tree

10 files changed

+392
-9
lines changed

10 files changed

+392
-9
lines changed

.generator/schemas/adminapi.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6853,6 +6853,45 @@ paths:
68536853
'404':
68546854
$ref: '#/components/responses/404'
68556855
/admin/v1/environments/{environmentName}/projects/{projectName}:
6856+
patch:
6857+
tags:
6858+
- project
6859+
operationId: updateProject
6860+
summary: Update a project in an environment
6861+
parameters:
6862+
- name: environmentName
6863+
in: path
6864+
description: environment name
6865+
schema:
6866+
type: string
6867+
required: true
6868+
- name: projectName
6869+
in: path
6870+
description: project name
6871+
schema:
6872+
type: string
6873+
required: true
6874+
requestBody:
6875+
content:
6876+
application/json:
6877+
schema:
6878+
$ref: '#/components/schemas/projectUpdate'
6879+
required: true
6880+
responses:
6881+
'200':
6882+
description: A successful response.
6883+
content:
6884+
application/json:
6885+
schema:
6886+
$ref: '#/components/schemas/project'
6887+
'400':
6888+
$ref: '#/components/responses/400'
6889+
'401':
6890+
$ref: '#/components/responses/401'
6891+
'403':
6892+
$ref: '#/components/responses/403'
6893+
'404':
6894+
$ref: '#/components/responses/404'
68566895
delete:
68576896
tags:
68586897
- project
@@ -21957,6 +21996,9 @@ components:
2195721996
status:
2195821997
type: string
2195921998
description: The status of project.
21999+
description:
22000+
type: string
22001+
description: The description of the project.
2196022002
projectList:
2196122003
description: Project list.
2196222004
type: object
@@ -21975,6 +22017,10 @@ components:
2197522017
name:
2197622018
type: string
2197722019
description: The name of the project.
22020+
description:
22021+
type: string
22022+
description: The description of the project.
22023+
maxLength: 128
2197822024
project:
2197922025
description: Project with detail information.
2198022026
type: object
@@ -21993,6 +22039,17 @@ components:
2199322039
envID:
2199422040
type: string
2199522041
description: The environment ID of the project.
22042+
description:
22043+
type: string
22044+
description: The description of the project.
22045+
projectUpdate:
22046+
description: Project update.
22047+
type: object
22048+
properties:
22049+
description:
22050+
type: string
22051+
description: The description of the project.
22052+
maxLength: 128
2199622053
backupRepoAccessMethod:
2199722054
description: the access method for backup repo
2199822055
default: Tool

.generator/schemas/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21180,6 +21180,9 @@ components:
2118021180
status:
2118121181
type: string
2118221182
description: The status of project.
21183+
description:
21184+
type: string
21185+
description: The description of the project.
2118321186
projectList:
2118421187
description: Project list.
2118521188
type: object

apecloud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 2a2fa6476c04f0400149438d3d3b57f854b36617
1+
Subproject commit c7f9e2eb5a7b289a25fb245726abf3480f1bc055

api/kbcloud/admin/api_project.go

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,88 @@ func (a *ProjectApi) ListProjects(ctx _context.Context, environmentName string)
245245
return localVarReturnValue, localVarHTTPResponse, nil
246246
}
247247

248+
// UpdateProject Update a project in an environment.
249+
func (a *ProjectApi) UpdateProject(ctx _context.Context, environmentName string, projectName string, body ProjectUpdate) (Project, *_nethttp.Response, error) {
250+
var (
251+
localVarHTTPMethod = _nethttp.MethodPatch
252+
localVarPostBody interface{}
253+
localVarReturnValue Project
254+
)
255+
256+
// Add api info to context
257+
apiInfo := common.APIInfo{
258+
Tag: "project",
259+
OperationID: "updateProject",
260+
Path: "/admin/v1/environments/{environmentName}/projects/{projectName}",
261+
Version: "",
262+
}
263+
ctx = context.WithValue(ctx, common.APIInfoCtxKey, apiInfo)
264+
265+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, ".ProjectApi.UpdateProject")
266+
if err != nil {
267+
return localVarReturnValue, nil, common.GenericOpenAPIError{ErrorMessage: err.Error()}
268+
}
269+
270+
localVarPath := localBasePath + "/admin/v1/environments/{environmentName}/projects/{projectName}"
271+
localVarPath = strings.Replace(localVarPath, "{"+"environmentName"+"}", _neturl.PathEscape(common.ParameterToString(environmentName, "")), -1)
272+
localVarPath = strings.Replace(localVarPath, "{"+"projectName"+"}", _neturl.PathEscape(common.ParameterToString(projectName, "")), -1)
273+
274+
localVarHeaderParams := make(map[string]string)
275+
localVarQueryParams := _neturl.Values{}
276+
localVarFormParams := _neturl.Values{}
277+
localVarHeaderParams["Content-Type"] = "application/json"
278+
localVarHeaderParams["Accept"] = "application/json"
279+
280+
// body params
281+
localVarPostBody = &body
282+
common.SetAuthKeys(
283+
ctx,
284+
&localVarHeaderParams,
285+
[2]string{"BearerToken", "authorization"},
286+
)
287+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
288+
if err != nil {
289+
return localVarReturnValue, nil, err
290+
}
291+
292+
localVarHTTPResponse, err := a.Client.CallAPI(req)
293+
if err != nil || localVarHTTPResponse == nil {
294+
return localVarReturnValue, localVarHTTPResponse, err
295+
}
296+
297+
localVarBody, err := common.ReadBody(localVarHTTPResponse)
298+
if err != nil {
299+
return localVarReturnValue, localVarHTTPResponse, err
300+
}
301+
302+
if localVarHTTPResponse.StatusCode >= 300 {
303+
newErr := common.GenericOpenAPIError{
304+
ErrorBody: localVarBody,
305+
ErrorMessage: localVarHTTPResponse.Status,
306+
}
307+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 {
308+
var v APIErrorResponse
309+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
310+
if err != nil {
311+
return localVarReturnValue, localVarHTTPResponse, newErr
312+
}
313+
newErr.ErrorModel = v
314+
}
315+
return localVarReturnValue, localVarHTTPResponse, newErr
316+
}
317+
318+
err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
319+
if err != nil {
320+
newErr := common.GenericOpenAPIError{
321+
ErrorBody: localVarBody,
322+
ErrorMessage: err.Error(),
323+
}
324+
return localVarReturnValue, localVarHTTPResponse, newErr
325+
}
326+
327+
return localVarReturnValue, localVarHTTPResponse, nil
328+
}
329+
248330
// NewProjectApi Returns NewProjectApi.
249331
func NewProjectApi(client *common.APIClient) *ProjectApi {
250332
return &ProjectApi{

api/kbcloud/admin/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
// - [projectApi.createProject]
398398
// - [projectApi.deleteProject]
399399
// - [projectApi.listProjects]
400+
// - [projectApi.updateProject]
400401
// - [providerApi.createCloudProvider]
401402
// - [providerApi.deleteCloudProvider]
402403
// - [providerApi.getCloudProvider]

api/kbcloud/admin/model_project.go

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Project struct {
1919
CreatedAt time.Time `json:"createdAt"`
2020
// The environment ID of the project.
2121
EnvId string `json:"envID"`
22+
// The description of the project.
23+
Description *string `json:"description,omitempty"`
2224
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2325
UnparsedObject map[string]interface{} `json:"-"`
2426
AdditionalProperties map[string]interface{} `json:"-"`
@@ -113,6 +115,34 @@ func (o *Project) SetEnvId(v string) {
113115
o.EnvId = v
114116
}
115117

118+
// GetDescription returns the Description field value if set, zero value otherwise.
119+
func (o *Project) GetDescription() string {
120+
if o == nil || o.Description == nil {
121+
var ret string
122+
return ret
123+
}
124+
return *o.Description
125+
}
126+
127+
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
128+
// and a boolean to check if the value has been set.
129+
func (o *Project) GetDescriptionOk() (*string, bool) {
130+
if o == nil || o.Description == nil {
131+
return nil, false
132+
}
133+
return o.Description, true
134+
}
135+
136+
// HasDescription returns a boolean if a field has been set.
137+
func (o *Project) HasDescription() bool {
138+
return o != nil && o.Description != nil
139+
}
140+
141+
// SetDescription gets a reference to the given string and assigns it to the Description field.
142+
func (o *Project) SetDescription(v string) {
143+
o.Description = &v
144+
}
145+
116146
// MarshalJSON serializes the struct using spec logic.
117147
func (o Project) MarshalJSON() ([]byte, error) {
118148
toSerialize := map[string]interface{}{}
@@ -126,6 +156,9 @@ func (o Project) MarshalJSON() ([]byte, error) {
126156
toSerialize["createdAt"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
127157
}
128158
toSerialize["envID"] = o.EnvId
159+
if o.Description != nil {
160+
toSerialize["description"] = o.Description
161+
}
129162

130163
for key, value := range o.AdditionalProperties {
131164
toSerialize[key] = value
@@ -136,9 +169,10 @@ func (o Project) MarshalJSON() ([]byte, error) {
136169
// UnmarshalJSON deserializes the given payload.
137170
func (o *Project) UnmarshalJSON(bytes []byte) (err error) {
138171
all := struct {
139-
Name *string `json:"name"`
140-
CreatedAt *time.Time `json:"createdAt"`
141-
EnvId *string `json:"envID"`
172+
Name *string `json:"name"`
173+
CreatedAt *time.Time `json:"createdAt"`
174+
EnvId *string `json:"envID"`
175+
Description *string `json:"description,omitempty"`
142176
}{}
143177
if err = common.Unmarshal(bytes, &all); err != nil {
144178
return err
@@ -154,13 +188,14 @@ func (o *Project) UnmarshalJSON(bytes []byte) (err error) {
154188
}
155189
additionalProperties := make(map[string]interface{})
156190
if err = common.Unmarshal(bytes, &additionalProperties); err == nil {
157-
common.DeleteKeys(additionalProperties, &[]string{"name", "createdAt", "envID"})
191+
common.DeleteKeys(additionalProperties, &[]string{"name", "createdAt", "envID", "description"})
158192
} else {
159193
return err
160194
}
161195
o.Name = *all.Name
162196
o.CreatedAt = *all.CreatedAt
163197
o.EnvId = *all.EnvId
198+
o.Description = all.Description
164199

165200
if len(additionalProperties) > 0 {
166201
o.AdditionalProperties = additionalProperties

api/kbcloud/admin/model_project_create.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
type ProjectCreate struct {
1515
// The name of the project.
1616
Name string `json:"name"`
17+
// The description of the project.
18+
Description *string `json:"description,omitempty"`
1719
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1820
UnparsedObject map[string]interface{} `json:"-"`
1921
AdditionalProperties map[string]interface{} `json:"-"`
@@ -60,13 +62,44 @@ func (o *ProjectCreate) SetName(v string) {
6062
o.Name = v
6163
}
6264

65+
// GetDescription returns the Description field value if set, zero value otherwise.
66+
func (o *ProjectCreate) GetDescription() string {
67+
if o == nil || o.Description == nil {
68+
var ret string
69+
return ret
70+
}
71+
return *o.Description
72+
}
73+
74+
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
75+
// and a boolean to check if the value has been set.
76+
func (o *ProjectCreate) GetDescriptionOk() (*string, bool) {
77+
if o == nil || o.Description == nil {
78+
return nil, false
79+
}
80+
return o.Description, true
81+
}
82+
83+
// HasDescription returns a boolean if a field has been set.
84+
func (o *ProjectCreate) HasDescription() bool {
85+
return o != nil && o.Description != nil
86+
}
87+
88+
// SetDescription gets a reference to the given string and assigns it to the Description field.
89+
func (o *ProjectCreate) SetDescription(v string) {
90+
o.Description = &v
91+
}
92+
6393
// MarshalJSON serializes the struct using spec logic.
6494
func (o ProjectCreate) MarshalJSON() ([]byte, error) {
6595
toSerialize := map[string]interface{}{}
6696
if o.UnparsedObject != nil {
6797
return common.Marshal(o.UnparsedObject)
6898
}
6999
toSerialize["name"] = o.Name
100+
if o.Description != nil {
101+
toSerialize["description"] = o.Description
102+
}
70103

71104
for key, value := range o.AdditionalProperties {
72105
toSerialize[key] = value
@@ -77,7 +110,8 @@ func (o ProjectCreate) MarshalJSON() ([]byte, error) {
77110
// UnmarshalJSON deserializes the given payload.
78111
func (o *ProjectCreate) UnmarshalJSON(bytes []byte) (err error) {
79112
all := struct {
80-
Name *string `json:"name"`
113+
Name *string `json:"name"`
114+
Description *string `json:"description,omitempty"`
81115
}{}
82116
if err = common.Unmarshal(bytes, &all); err != nil {
83117
return err
@@ -87,11 +121,12 @@ func (o *ProjectCreate) UnmarshalJSON(bytes []byte) (err error) {
87121
}
88122
additionalProperties := make(map[string]interface{})
89123
if err = common.Unmarshal(bytes, &additionalProperties); err == nil {
90-
common.DeleteKeys(additionalProperties, &[]string{"name"})
124+
common.DeleteKeys(additionalProperties, &[]string{"name", "description"})
91125
} else {
92126
return err
93127
}
94128
o.Name = *all.Name
129+
o.Description = all.Description
95130

96131
if len(additionalProperties) > 0 {
97132
o.AdditionalProperties = additionalProperties

0 commit comments

Comments
 (0)