mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
1
pkg/apiserver-gen/.openapi-generator/FILES
generated
1
pkg/apiserver-gen/.openapi-generator/FILES
generated
@@ -19,6 +19,7 @@ go/model__devstate_events_put_request.go
|
||||
go/model__devstate_exec_command_post_request.go
|
||||
go/model__devstate_image_post_request.go
|
||||
go/model__devstate_quantity_valid_post_request.go
|
||||
go/model__devstate_resource__resource_name__patch_request.go
|
||||
go/model__devstate_resource_post_request.go
|
||||
go/model__devstate_volume__volume_name__patch_request.go
|
||||
go/model__devstate_volume_post_request.go
|
||||
|
||||
2
pkg/apiserver-gen/go/api.go
generated
2
pkg/apiserver-gen/go/api.go
generated
@@ -51,6 +51,7 @@ type DevstateApiRouter interface {
|
||||
DevstateQuantityValidPost(http.ResponseWriter, *http.Request)
|
||||
DevstateResourcePost(http.ResponseWriter, *http.Request)
|
||||
DevstateResourceResourceNameDelete(http.ResponseWriter, *http.Request)
|
||||
DevstateResourceResourceNamePatch(http.ResponseWriter, *http.Request)
|
||||
DevstateVolumePost(http.ResponseWriter, *http.Request)
|
||||
DevstateVolumeVolumeNameDelete(http.ResponseWriter, *http.Request)
|
||||
DevstateVolumeVolumeNamePatch(http.ResponseWriter, *http.Request)
|
||||
@@ -95,6 +96,7 @@ type DevstateApiServicer interface {
|
||||
DevstateQuantityValidPost(context.Context, DevstateQuantityValidPostRequest) (ImplResponse, error)
|
||||
DevstateResourcePost(context.Context, DevstateResourcePostRequest) (ImplResponse, error)
|
||||
DevstateResourceResourceNameDelete(context.Context, string) (ImplResponse, error)
|
||||
DevstateResourceResourceNamePatch(context.Context, string, DevstateResourceResourceNamePatchRequest) (ImplResponse, error)
|
||||
DevstateVolumePost(context.Context, DevstateVolumePostRequest) (ImplResponse, error)
|
||||
DevstateVolumeVolumeNameDelete(context.Context, string) (ImplResponse, error)
|
||||
DevstateVolumeVolumeNamePatch(context.Context, string, DevstateVolumeVolumeNamePatchRequest) (ImplResponse, error)
|
||||
|
||||
32
pkg/apiserver-gen/go/api_devstate.go
generated
32
pkg/apiserver-gen/go/api_devstate.go
generated
@@ -170,6 +170,12 @@ func (c *DevstateApiController) Routes() Routes {
|
||||
"/api/v1/devstate/resource/{resourceName}",
|
||||
c.DevstateResourceResourceNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateResourceResourceNamePatch",
|
||||
strings.ToUpper("Patch"),
|
||||
"/api/v1/devstate/resource/{resourceName}",
|
||||
c.DevstateResourceResourceNamePatch,
|
||||
},
|
||||
{
|
||||
"DevstateVolumePost",
|
||||
strings.ToUpper("Post"),
|
||||
@@ -597,6 +603,32 @@ func (c *DevstateApiController) DevstateResourceResourceNameDelete(w http.Respon
|
||||
|
||||
}
|
||||
|
||||
// DevstateResourceResourceNamePatch -
|
||||
func (c *DevstateApiController) DevstateResourceResourceNamePatch(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
resourceNameParam := params["resourceName"]
|
||||
devstateResourceResourceNamePatchRequestParam := DevstateResourceResourceNamePatchRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateResourceResourceNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateResourceResourceNamePatchRequestRequired(devstateResourceResourceNamePatchRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateResourceResourceNamePatch(r.Context(), resourceNameParam, devstateResourceResourceNamePatchRequestParam)
|
||||
// If an error occurred, encode the error with the status code
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, err, &result)
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, w)
|
||||
|
||||
}
|
||||
|
||||
// DevstateVolumePost -
|
||||
func (c *DevstateApiController) DevstateVolumePost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateVolumePostRequestParam := DevstateVolumePostRequest{}
|
||||
|
||||
35
pkg/apiserver-gen/go/model__devstate_resource__resource_name__patch_request.go
generated
Normal file
35
pkg/apiserver-gen/go/model__devstate_resource__resource_name__patch_request.go
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* odo dev
|
||||
*
|
||||
* API interface for 'odo dev'
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
type DevstateResourceResourceNamePatchRequest struct {
|
||||
Inlined string `json:"inlined,omitempty"`
|
||||
|
||||
Uri string `json:"uri,omitempty"`
|
||||
|
||||
DeployByDefault string `json:"deployByDefault,omitempty"`
|
||||
}
|
||||
|
||||
// AssertDevstateResourceResourceNamePatchRequestRequired checks if the required fields are not zero-ed
|
||||
func AssertDevstateResourceResourceNamePatchRequestRequired(obj DevstateResourceResourceNamePatchRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseDevstateResourceResourceNamePatchRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of DevstateResourceResourceNamePatchRequest (e.g. [][]DevstateResourceResourceNamePatchRequest), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseDevstateResourceResourceNamePatchRequestRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aDevstateResourceResourceNamePatchRequest, ok := obj.(DevstateResourceResourceNamePatchRequest)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertDevstateResourceResourceNamePatchRequestRequired(aDevstateResourceResourceNamePatchRequest)
|
||||
})
|
||||
}
|
||||
@@ -312,5 +312,19 @@ func (s *DevstateApiService) DevstateVolumeVolumeNamePatch(ctx context.Context,
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
|
||||
}
|
||||
|
||||
func (s *DevstateApiService) DevstateResourceResourceNamePatch(ctx context.Context, name string, patch openapi.DevstateResourceResourceNamePatchRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.PatchResource(
|
||||
name,
|
||||
patch.Inlined,
|
||||
patch.Uri,
|
||||
patch.DeployByDefault,
|
||||
)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
Message: fmt.Sprintf("Error updating the resource: %s", err),
|
||||
}), nil
|
||||
}
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
@@ -228,6 +228,41 @@ func (o *DevfileState) AddResource(name string, inlined string, uri string, depl
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) PatchResource(name string, inlined string, uri string, deployByDefault string) (DevfileContent, error) {
|
||||
if inlined != "" && uri != "" {
|
||||
return DevfileContent{}, errors.New("both inlined and uri cannot be set at the same time")
|
||||
}
|
||||
found, err := o.Devfile.Data.GetComponents(common.DevfileOptions{
|
||||
ComponentOptions: common.ComponentOptions{
|
||||
ComponentType: v1alpha2.KubernetesComponentType,
|
||||
},
|
||||
FilterByName: name,
|
||||
})
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
if len(found) != 1 {
|
||||
return DevfileContent{}, fmt.Errorf("%d Resource found with name %q", len(found), name)
|
||||
}
|
||||
|
||||
resource := found[0]
|
||||
resource.Kubernetes.Inlined = inlined
|
||||
resource.Kubernetes.Uri = uri
|
||||
resource.Kubernetes.DeployByDefault = nil
|
||||
if deployByDefault == "never" {
|
||||
resource.Kubernetes.DeployByDefault = pointer.Bool(false)
|
||||
} else if deployByDefault == "always" {
|
||||
resource.Kubernetes.DeployByDefault = pointer.Bool(true)
|
||||
}
|
||||
|
||||
err = o.Devfile.Data.UpdateComponent(resource)
|
||||
if err != nil {
|
||||
return DevfileContent{}, err
|
||||
}
|
||||
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
func (o *DevfileState) DeleteResource(name string) (DevfileContent, error) {
|
||||
|
||||
err := o.checkResourceUsed(name)
|
||||
|
||||
@@ -856,6 +856,78 @@ paths:
|
||||
example:
|
||||
message: "Error deleting the resource"
|
||||
|
||||
patch:
|
||||
tags:
|
||||
- devstate
|
||||
description: Update a Kubernetes resource
|
||||
parameters:
|
||||
- name: resourceName
|
||||
in: path
|
||||
description: Resource name to update
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
inlined:
|
||||
type: string
|
||||
uri:
|
||||
type: string
|
||||
deployByDefault:
|
||||
type: string
|
||||
enum:
|
||||
- never
|
||||
- undefined
|
||||
- always
|
||||
responses:
|
||||
'200':
|
||||
description: resource was successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DevfileContent'
|
||||
example:
|
||||
{
|
||||
"content": "schemaVersion: 2.2.0\n",
|
||||
"commands": [],
|
||||
"containers": [],
|
||||
"images": [],
|
||||
"resources": [],
|
||||
"events": {
|
||||
"preStart": null,
|
||||
"postStart": null,
|
||||
"preStop": null,
|
||||
"postStop": null
|
||||
},
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"version": "",
|
||||
"displayName": "",
|
||||
description": "",
|
||||
"tags": "",
|
||||
"architectures": "",
|
||||
"icon": "",
|
||||
"globalMemoryLimit": "",
|
||||
"projectType": "",
|
||||
"language": "",
|
||||
"website": "",
|
||||
"provider": "",
|
||||
"supportUrl": ""
|
||||
}
|
||||
}
|
||||
'500':
|
||||
description: Error updating the resource
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GeneralError'
|
||||
example:
|
||||
message: "Error updating the resource"
|
||||
|
||||
/devstate/volume:
|
||||
post:
|
||||
tags:
|
||||
|
||||
2
pkg/apiserver-impl/ui/index.html
generated
2
pkg/apiserver-impl/ui/index.html
generated
@@ -11,6 +11,6 @@
|
||||
<body class="mat-typography">
|
||||
<div id="loading">Loading, please wait...</div>
|
||||
<app-root></app-root>
|
||||
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.32ba016d46c6a398.js" type="module"></script>
|
||||
<script src="runtime.1289ea0acffcdc5e.js" type="module"></script><script src="polyfills.8b3b37cedaf377c3.js" type="module"></script><script src="main.dccb7ac93e413890.js" type="module"></script>
|
||||
|
||||
</body></html>
|
||||
1
pkg/apiserver-impl/ui/main.32ba016d46c6a398.js
generated
1
pkg/apiserver-impl/ui/main.32ba016d46c6a398.js
generated
File diff suppressed because one or more lines are too long
1
pkg/apiserver-impl/ui/main.dccb7ac93e413890.js
generated
Normal file
1
pkg/apiserver-impl/ui/main.dccb7ac93e413890.js
generated
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user