mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Do not display API logs (#7008)
* Do not regenerate apiserver-gen/go/routers.go * Regenerate after changes done in pr#6989 * Do not regenerate apiserver-gen/go/logger.go * Change logs * Fix comments
This commit is contained in:
3
pkg/apiserver-gen/.openapi-generator-ignore
generated
3
pkg/apiserver-gen/.openapi-generator-ignore
generated
@@ -21,3 +21,6 @@
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
|
||||
go/routers.go
|
||||
go/logger.go
|
||||
|
||||
3
pkg/apiserver-gen/.openapi-generator/FILES
generated
3
pkg/apiserver-gen/.openapi-generator/FILES
generated
@@ -2,10 +2,10 @@ README.md
|
||||
api/openapi.yaml
|
||||
go/api.go
|
||||
go/api_default.go
|
||||
go/api_devstate.go
|
||||
go/error.go
|
||||
go/helpers.go
|
||||
go/impl.go
|
||||
go/logger.go
|
||||
go/model__component_command_post_request.go
|
||||
go/model__component_get_200_response.go
|
||||
go/model__devfile_get_200_response.go
|
||||
@@ -38,4 +38,3 @@ go/model_metadata.go
|
||||
go/model_metadata_request.go
|
||||
go/model_resource.go
|
||||
go/model_telemetry_response.go
|
||||
go/routers.go
|
||||
|
||||
25
pkg/apiserver-gen/go/api.go
generated
25
pkg/apiserver-gen/go/api.go
generated
@@ -22,6 +22,15 @@ type DefaultApiRouter interface {
|
||||
ComponentGet(http.ResponseWriter, *http.Request)
|
||||
DevfileGet(http.ResponseWriter, *http.Request)
|
||||
DevfilePut(http.ResponseWriter, *http.Request)
|
||||
InstanceDelete(http.ResponseWriter, *http.Request)
|
||||
InstanceGet(http.ResponseWriter, *http.Request)
|
||||
TelemetryGet(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
// DevstateApiRouter defines the required methods for binding the api requests to a responses for the DevstateApi
|
||||
// The DevstateApiRouter implementation should parse necessary information from the http request,
|
||||
// pass the data to a DevstateApiServicer to perform the required actions, then write the service results to the http response.
|
||||
type DevstateApiRouter interface {
|
||||
DevstateApplyCommandPost(http.ResponseWriter, *http.Request)
|
||||
DevstateChartGet(http.ResponseWriter, *http.Request)
|
||||
DevstateCommandCommandNameDelete(http.ResponseWriter, *http.Request)
|
||||
@@ -42,9 +51,6 @@ type DefaultApiRouter interface {
|
||||
DevstateQuantityValidPost(http.ResponseWriter, *http.Request)
|
||||
DevstateResourcePost(http.ResponseWriter, *http.Request)
|
||||
DevstateResourceResourceNameDelete(http.ResponseWriter, *http.Request)
|
||||
InstanceDelete(http.ResponseWriter, *http.Request)
|
||||
InstanceGet(http.ResponseWriter, *http.Request)
|
||||
TelemetryGet(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
|
||||
// DefaultApiServicer defines the api actions for the DefaultApi service
|
||||
@@ -56,6 +62,16 @@ type DefaultApiServicer interface {
|
||||
ComponentGet(context.Context) (ImplResponse, error)
|
||||
DevfileGet(context.Context) (ImplResponse, error)
|
||||
DevfilePut(context.Context, DevfilePutRequest) (ImplResponse, error)
|
||||
InstanceDelete(context.Context) (ImplResponse, error)
|
||||
InstanceGet(context.Context) (ImplResponse, error)
|
||||
TelemetryGet(context.Context) (ImplResponse, error)
|
||||
}
|
||||
|
||||
// DevstateApiServicer defines the api actions for the DevstateApi service
|
||||
// This interface intended to stay up to date with the openapi yaml used to generate it,
|
||||
// while the service implementation can be ignored with the .openapi-generator-ignore file
|
||||
// and updated with the logic required for the API.
|
||||
type DevstateApiServicer interface {
|
||||
DevstateApplyCommandPost(context.Context, DevstateApplyCommandPostRequest) (ImplResponse, error)
|
||||
DevstateChartGet(context.Context) (ImplResponse, error)
|
||||
DevstateCommandCommandNameDelete(context.Context, string) (ImplResponse, error)
|
||||
@@ -76,7 +92,4 @@ type DefaultApiServicer interface {
|
||||
DevstateQuantityValidPost(context.Context, DevstateQuantityValidPostRequest) (ImplResponse, error)
|
||||
DevstateResourcePost(context.Context, DevstateResourcePostRequest) (ImplResponse, error)
|
||||
DevstateResourceResourceNameDelete(context.Context, string) (ImplResponse, error)
|
||||
InstanceDelete(context.Context) (ImplResponse, error)
|
||||
InstanceGet(context.Context) (ImplResponse, error)
|
||||
TelemetryGet(context.Context) (ImplResponse, error)
|
||||
}
|
||||
|
||||
528
pkg/apiserver-gen/go/api_default.go
generated
528
pkg/apiserver-gen/go/api_default.go
generated
@@ -13,8 +13,6 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// DefaultApiController binds http requests to an api service and writes the service results to the http response
|
||||
@@ -74,126 +72,6 @@ func (c *DefaultApiController) Routes() Routes {
|
||||
"/api/v1/devfile",
|
||||
c.DevfilePut,
|
||||
},
|
||||
{
|
||||
"DevstateApplyCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/applyCommand",
|
||||
c.DevstateApplyCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateChartGet",
|
||||
strings.ToUpper("Get"),
|
||||
"/api/v1/devstate/chart",
|
||||
c.DevstateChartGet,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/command/{commandName}",
|
||||
c.DevstateCommandCommandNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameMovePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/move",
|
||||
c.DevstateCommandCommandNameMovePost,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameSetDefaultPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/setDefault",
|
||||
c.DevstateCommandCommandNameSetDefaultPost,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameUnsetDefaultPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/unsetDefault",
|
||||
c.DevstateCommandCommandNameUnsetDefaultPost,
|
||||
},
|
||||
{
|
||||
"DevstateCompositeCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/compositeCommand",
|
||||
c.DevstateCompositeCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateContainerContainerNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/container/{containerName}",
|
||||
c.DevstateContainerContainerNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateContainerPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/container",
|
||||
c.DevstateContainerPost,
|
||||
},
|
||||
{
|
||||
"DevstateDevfileDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfileDelete,
|
||||
},
|
||||
{
|
||||
"DevstateDevfileGet",
|
||||
strings.ToUpper("Get"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfileGet,
|
||||
},
|
||||
{
|
||||
"DevstateDevfilePut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfilePut,
|
||||
},
|
||||
{
|
||||
"DevstateEventsPut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/events",
|
||||
c.DevstateEventsPut,
|
||||
},
|
||||
{
|
||||
"DevstateExecCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/execCommand",
|
||||
c.DevstateExecCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateImageImageNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/image/{imageName}",
|
||||
c.DevstateImageImageNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateImagePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/image",
|
||||
c.DevstateImagePost,
|
||||
},
|
||||
{
|
||||
"DevstateMetadataPut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/metadata",
|
||||
c.DevstateMetadataPut,
|
||||
},
|
||||
{
|
||||
"DevstateQuantityValidPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/quantityValid",
|
||||
c.DevstateQuantityValidPost,
|
||||
},
|
||||
{
|
||||
"DevstateResourcePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/resource",
|
||||
c.DevstateResourcePost,
|
||||
},
|
||||
{
|
||||
"DevstateResourceResourceNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/resource/{resourceName}",
|
||||
c.DevstateResourceResourceNameDelete,
|
||||
},
|
||||
{
|
||||
"InstanceDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
@@ -289,412 +167,6 @@ func (c *DefaultApiController) DevfilePut(w http.ResponseWriter, r *http.Request
|
||||
|
||||
}
|
||||
|
||||
// DevstateApplyCommandPost -
|
||||
func (c *DefaultApiController) DevstateApplyCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateApplyCommandPostRequestParam := DevstateApplyCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateApplyCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateApplyCommandPostRequestRequired(devstateApplyCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateApplyCommandPost(r.Context(), devstateApplyCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateChartGet -
|
||||
func (c *DefaultApiController) DevstateChartGet(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateChartGet(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameDelete -
|
||||
func (c *DefaultApiController) DevstateCommandCommandNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
result, err := c.service.DevstateCommandCommandNameDelete(r.Context(), commandNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameMovePost -
|
||||
func (c *DefaultApiController) DevstateCommandCommandNameMovePost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateCommandCommandNameMovePostRequestParam := DevstateCommandCommandNameMovePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCommandCommandNameMovePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCommandCommandNameMovePostRequestRequired(devstateCommandCommandNameMovePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCommandCommandNameMovePost(r.Context(), commandNameParam, devstateCommandCommandNameMovePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameSetDefaultPost -
|
||||
func (c *DefaultApiController) DevstateCommandCommandNameSetDefaultPost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateCommandCommandNameSetDefaultPostRequestParam := DevstateCommandCommandNameSetDefaultPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCommandCommandNameSetDefaultPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCommandCommandNameSetDefaultPostRequestRequired(devstateCommandCommandNameSetDefaultPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCommandCommandNameSetDefaultPost(r.Context(), commandNameParam, devstateCommandCommandNameSetDefaultPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameUnsetDefaultPost -
|
||||
func (c *DefaultApiController) DevstateCommandCommandNameUnsetDefaultPost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
result, err := c.service.DevstateCommandCommandNameUnsetDefaultPost(r.Context(), commandNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCompositeCommandPost -
|
||||
func (c *DefaultApiController) DevstateCompositeCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateCompositeCommandPostRequestParam := DevstateCompositeCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCompositeCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCompositeCommandPostRequestRequired(devstateCompositeCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCompositeCommandPost(r.Context(), devstateCompositeCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateContainerContainerNameDelete -
|
||||
func (c *DefaultApiController) DevstateContainerContainerNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
containerNameParam := params["containerName"]
|
||||
result, err := c.service.DevstateContainerContainerNameDelete(r.Context(), containerNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateContainerPost -
|
||||
func (c *DefaultApiController) DevstateContainerPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateContainerPostRequestParam := DevstateContainerPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateContainerPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateContainerPostRequestRequired(devstateContainerPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateContainerPost(r.Context(), devstateContainerPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfileDelete -
|
||||
func (c *DefaultApiController) DevstateDevfileDelete(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateDevfileDelete(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfileGet -
|
||||
func (c *DefaultApiController) DevstateDevfileGet(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateDevfileGet(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfilePut -
|
||||
func (c *DefaultApiController) DevstateDevfilePut(w http.ResponseWriter, r *http.Request) {
|
||||
devstateDevfilePutRequestParam := DevstateDevfilePutRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateDevfilePutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateDevfilePutRequestRequired(devstateDevfilePutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateDevfilePut(r.Context(), devstateDevfilePutRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateEventsPut -
|
||||
func (c *DefaultApiController) DevstateEventsPut(w http.ResponseWriter, r *http.Request) {
|
||||
devstateEventsPutRequestParam := DevstateEventsPutRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateEventsPutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateEventsPutRequestRequired(devstateEventsPutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateEventsPut(r.Context(), devstateEventsPutRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateExecCommandPost -
|
||||
func (c *DefaultApiController) DevstateExecCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateExecCommandPostRequestParam := DevstateExecCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateExecCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateExecCommandPostRequestRequired(devstateExecCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateExecCommandPost(r.Context(), devstateExecCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateImageImageNameDelete -
|
||||
func (c *DefaultApiController) DevstateImageImageNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
imageNameParam := params["imageName"]
|
||||
result, err := c.service.DevstateImageImageNameDelete(r.Context(), imageNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateImagePost -
|
||||
func (c *DefaultApiController) DevstateImagePost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateImagePostRequestParam := DevstateImagePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateImagePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateImagePostRequestRequired(devstateImagePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateImagePost(r.Context(), devstateImagePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateMetadataPut -
|
||||
func (c *DefaultApiController) DevstateMetadataPut(w http.ResponseWriter, r *http.Request) {
|
||||
metadataRequestParam := MetadataRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&metadataRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertMetadataRequestRequired(metadataRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateMetadataPut(r.Context(), metadataRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateQuantityValidPost -
|
||||
func (c *DefaultApiController) DevstateQuantityValidPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateQuantityValidPostRequestParam := DevstateQuantityValidPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateQuantityValidPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateQuantityValidPostRequestRequired(devstateQuantityValidPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateQuantityValidPost(r.Context(), devstateQuantityValidPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateResourcePost -
|
||||
func (c *DefaultApiController) DevstateResourcePost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateResourcePostRequestParam := DevstateResourcePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateResourcePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateResourcePostRequestRequired(devstateResourcePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateResourcePost(r.Context(), devstateResourcePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateResourceResourceNameDelete -
|
||||
func (c *DefaultApiController) DevstateResourceResourceNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
resourceNameParam := params["resourceName"]
|
||||
result, err := c.service.DevstateResourceResourceNameDelete(r.Context(), resourceNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// InstanceDelete -
|
||||
func (c *DefaultApiController) InstanceDelete(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.InstanceDelete(r.Context())
|
||||
|
||||
580
pkg/apiserver-gen/go/api_devstate.go
generated
Normal file
580
pkg/apiserver-gen/go/api_devstate.go
generated
Normal file
@@ -0,0 +1,580 @@
|
||||
/*
|
||||
* odo dev
|
||||
*
|
||||
* API interface for 'odo dev'
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// DevstateApiController binds http requests to an api service and writes the service results to the http response
|
||||
type DevstateApiController struct {
|
||||
service DevstateApiServicer
|
||||
errorHandler ErrorHandler
|
||||
}
|
||||
|
||||
// DevstateApiOption for how the controller is set up.
|
||||
type DevstateApiOption func(*DevstateApiController)
|
||||
|
||||
// WithDevstateApiErrorHandler inject ErrorHandler into controller
|
||||
func WithDevstateApiErrorHandler(h ErrorHandler) DevstateApiOption {
|
||||
return func(c *DevstateApiController) {
|
||||
c.errorHandler = h
|
||||
}
|
||||
}
|
||||
|
||||
// NewDevstateApiController creates a default api controller
|
||||
func NewDevstateApiController(s DevstateApiServicer, opts ...DevstateApiOption) Router {
|
||||
controller := &DevstateApiController{
|
||||
service: s,
|
||||
errorHandler: DefaultErrorHandler,
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(controller)
|
||||
}
|
||||
|
||||
return controller
|
||||
}
|
||||
|
||||
// Routes returns all the api routes for the DevstateApiController
|
||||
func (c *DevstateApiController) Routes() Routes {
|
||||
return Routes{
|
||||
{
|
||||
"DevstateApplyCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/applyCommand",
|
||||
c.DevstateApplyCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateChartGet",
|
||||
strings.ToUpper("Get"),
|
||||
"/api/v1/devstate/chart",
|
||||
c.DevstateChartGet,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/command/{commandName}",
|
||||
c.DevstateCommandCommandNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameMovePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/move",
|
||||
c.DevstateCommandCommandNameMovePost,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameSetDefaultPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/setDefault",
|
||||
c.DevstateCommandCommandNameSetDefaultPost,
|
||||
},
|
||||
{
|
||||
"DevstateCommandCommandNameUnsetDefaultPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/command/{commandName}/unsetDefault",
|
||||
c.DevstateCommandCommandNameUnsetDefaultPost,
|
||||
},
|
||||
{
|
||||
"DevstateCompositeCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/compositeCommand",
|
||||
c.DevstateCompositeCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateContainerContainerNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/container/{containerName}",
|
||||
c.DevstateContainerContainerNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateContainerPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/container",
|
||||
c.DevstateContainerPost,
|
||||
},
|
||||
{
|
||||
"DevstateDevfileDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfileDelete,
|
||||
},
|
||||
{
|
||||
"DevstateDevfileGet",
|
||||
strings.ToUpper("Get"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfileGet,
|
||||
},
|
||||
{
|
||||
"DevstateDevfilePut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/devfile",
|
||||
c.DevstateDevfilePut,
|
||||
},
|
||||
{
|
||||
"DevstateEventsPut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/events",
|
||||
c.DevstateEventsPut,
|
||||
},
|
||||
{
|
||||
"DevstateExecCommandPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/execCommand",
|
||||
c.DevstateExecCommandPost,
|
||||
},
|
||||
{
|
||||
"DevstateImageImageNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/image/{imageName}",
|
||||
c.DevstateImageImageNameDelete,
|
||||
},
|
||||
{
|
||||
"DevstateImagePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/image",
|
||||
c.DevstateImagePost,
|
||||
},
|
||||
{
|
||||
"DevstateMetadataPut",
|
||||
strings.ToUpper("Put"),
|
||||
"/api/v1/devstate/metadata",
|
||||
c.DevstateMetadataPut,
|
||||
},
|
||||
{
|
||||
"DevstateQuantityValidPost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/quantityValid",
|
||||
c.DevstateQuantityValidPost,
|
||||
},
|
||||
{
|
||||
"DevstateResourcePost",
|
||||
strings.ToUpper("Post"),
|
||||
"/api/v1/devstate/resource",
|
||||
c.DevstateResourcePost,
|
||||
},
|
||||
{
|
||||
"DevstateResourceResourceNameDelete",
|
||||
strings.ToUpper("Delete"),
|
||||
"/api/v1/devstate/resource/{resourceName}",
|
||||
c.DevstateResourceResourceNameDelete,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// DevstateApplyCommandPost -
|
||||
func (c *DevstateApiController) DevstateApplyCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateApplyCommandPostRequestParam := DevstateApplyCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateApplyCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateApplyCommandPostRequestRequired(devstateApplyCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateApplyCommandPost(r.Context(), devstateApplyCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateChartGet -
|
||||
func (c *DevstateApiController) DevstateChartGet(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateChartGet(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameDelete -
|
||||
func (c *DevstateApiController) DevstateCommandCommandNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
result, err := c.service.DevstateCommandCommandNameDelete(r.Context(), commandNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameMovePost -
|
||||
func (c *DevstateApiController) DevstateCommandCommandNameMovePost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateCommandCommandNameMovePostRequestParam := DevstateCommandCommandNameMovePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCommandCommandNameMovePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCommandCommandNameMovePostRequestRequired(devstateCommandCommandNameMovePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCommandCommandNameMovePost(r.Context(), commandNameParam, devstateCommandCommandNameMovePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameSetDefaultPost -
|
||||
func (c *DevstateApiController) DevstateCommandCommandNameSetDefaultPost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
devstateCommandCommandNameSetDefaultPostRequestParam := DevstateCommandCommandNameSetDefaultPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCommandCommandNameSetDefaultPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCommandCommandNameSetDefaultPostRequestRequired(devstateCommandCommandNameSetDefaultPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCommandCommandNameSetDefaultPost(r.Context(), commandNameParam, devstateCommandCommandNameSetDefaultPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCommandCommandNameUnsetDefaultPost -
|
||||
func (c *DevstateApiController) DevstateCommandCommandNameUnsetDefaultPost(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
commandNameParam := params["commandName"]
|
||||
result, err := c.service.DevstateCommandCommandNameUnsetDefaultPost(r.Context(), commandNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateCompositeCommandPost -
|
||||
func (c *DevstateApiController) DevstateCompositeCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateCompositeCommandPostRequestParam := DevstateCompositeCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateCompositeCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateCompositeCommandPostRequestRequired(devstateCompositeCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateCompositeCommandPost(r.Context(), devstateCompositeCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateContainerContainerNameDelete -
|
||||
func (c *DevstateApiController) DevstateContainerContainerNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
containerNameParam := params["containerName"]
|
||||
result, err := c.service.DevstateContainerContainerNameDelete(r.Context(), containerNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateContainerPost -
|
||||
func (c *DevstateApiController) DevstateContainerPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateContainerPostRequestParam := DevstateContainerPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateContainerPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateContainerPostRequestRequired(devstateContainerPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateContainerPost(r.Context(), devstateContainerPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfileDelete -
|
||||
func (c *DevstateApiController) DevstateDevfileDelete(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateDevfileDelete(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfileGet -
|
||||
func (c *DevstateApiController) DevstateDevfileGet(w http.ResponseWriter, r *http.Request) {
|
||||
result, err := c.service.DevstateDevfileGet(r.Context())
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateDevfilePut -
|
||||
func (c *DevstateApiController) DevstateDevfilePut(w http.ResponseWriter, r *http.Request) {
|
||||
devstateDevfilePutRequestParam := DevstateDevfilePutRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateDevfilePutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateDevfilePutRequestRequired(devstateDevfilePutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateDevfilePut(r.Context(), devstateDevfilePutRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateEventsPut -
|
||||
func (c *DevstateApiController) DevstateEventsPut(w http.ResponseWriter, r *http.Request) {
|
||||
devstateEventsPutRequestParam := DevstateEventsPutRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateEventsPutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateEventsPutRequestRequired(devstateEventsPutRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateEventsPut(r.Context(), devstateEventsPutRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateExecCommandPost -
|
||||
func (c *DevstateApiController) DevstateExecCommandPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateExecCommandPostRequestParam := DevstateExecCommandPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateExecCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateExecCommandPostRequestRequired(devstateExecCommandPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateExecCommandPost(r.Context(), devstateExecCommandPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateImageImageNameDelete -
|
||||
func (c *DevstateApiController) DevstateImageImageNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
imageNameParam := params["imageName"]
|
||||
result, err := c.service.DevstateImageImageNameDelete(r.Context(), imageNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateImagePost -
|
||||
func (c *DevstateApiController) DevstateImagePost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateImagePostRequestParam := DevstateImagePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateImagePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateImagePostRequestRequired(devstateImagePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateImagePost(r.Context(), devstateImagePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateMetadataPut -
|
||||
func (c *DevstateApiController) DevstateMetadataPut(w http.ResponseWriter, r *http.Request) {
|
||||
metadataRequestParam := MetadataRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&metadataRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertMetadataRequestRequired(metadataRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateMetadataPut(r.Context(), metadataRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateQuantityValidPost -
|
||||
func (c *DevstateApiController) DevstateQuantityValidPost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateQuantityValidPostRequestParam := DevstateQuantityValidPostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateQuantityValidPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateQuantityValidPostRequestRequired(devstateQuantityValidPostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateQuantityValidPost(r.Context(), devstateQuantityValidPostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateResourcePost -
|
||||
func (c *DevstateApiController) DevstateResourcePost(w http.ResponseWriter, r *http.Request) {
|
||||
devstateResourcePostRequestParam := DevstateResourcePostRequest{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
d.DisallowUnknownFields()
|
||||
if err := d.Decode(&devstateResourcePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
if err := AssertDevstateResourcePostRequestRequired(devstateResourcePostRequestParam); err != nil {
|
||||
c.errorHandler(w, r, err, nil)
|
||||
return
|
||||
}
|
||||
result, err := c.service.DevstateResourcePost(r.Context(), devstateResourcePostRequestParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
|
||||
// DevstateResourceResourceNameDelete -
|
||||
func (c *DevstateApiController) DevstateResourceResourceNameDelete(w http.ResponseWriter, r *http.Request) {
|
||||
params := mux.Vars(r)
|
||||
resourceNameParam := params["resourceName"]
|
||||
result, err := c.service.DevstateResourceResourceNameDelete(r.Context(), resourceNameParam)
|
||||
// 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)
|
||||
|
||||
}
|
||||
5
pkg/apiserver-gen/go/logger.go
generated
5
pkg/apiserver-gen/go/logger.go
generated
@@ -10,9 +10,10 @@
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
func Logger(inner http.Handler, name string) http.Handler {
|
||||
@@ -21,7 +22,7 @@ func Logger(inner http.Handler, name string) http.Handler {
|
||||
|
||||
inner.ServeHTTP(w, r)
|
||||
|
||||
log.Printf(
|
||||
klog.V(2).Infof(
|
||||
"%s %s %s %s",
|
||||
r.Method,
|
||||
r.RequestURI,
|
||||
|
||||
47
pkg/apiserver-impl/api_devstate_service.go
Normal file
47
pkg/apiserver-impl/api_devstate_service.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package apiserver_impl
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
openapi "github.com/redhat-developer/odo/pkg/apiserver-gen/go"
|
||||
"github.com/redhat-developer/odo/pkg/apiserver-impl/devstate"
|
||||
"github.com/redhat-developer/odo/pkg/kclient"
|
||||
"github.com/redhat-developer/odo/pkg/podman"
|
||||
"github.com/redhat-developer/odo/pkg/preference"
|
||||
"github.com/redhat-developer/odo/pkg/state"
|
||||
)
|
||||
|
||||
// DevstateApiService is a service that implements the logic for the DevstateApiServicer
|
||||
// This service should implement the business logic for every endpoint for the DevstateApi API.
|
||||
// Include any external packages or services that will be required by this service.
|
||||
type DevstateApiService struct {
|
||||
cancel context.CancelFunc
|
||||
pushWatcher chan<- struct{}
|
||||
kubeClient kclient.ClientInterface
|
||||
podmanClient podman.Client
|
||||
stateClient state.Client
|
||||
preferenceClient preference.Client
|
||||
|
||||
devfileState devstate.DevfileState
|
||||
}
|
||||
|
||||
// NewDevstateApiService creates a devstate api service
|
||||
func NewDevstateApiService(
|
||||
cancel context.CancelFunc,
|
||||
pushWatcher chan<- struct{},
|
||||
kubeClient kclient.ClientInterface,
|
||||
podmanClient podman.Client,
|
||||
stateClient state.Client,
|
||||
preferenceClient preference.Client,
|
||||
) openapi.DevstateApiServicer {
|
||||
return &DevstateApiService{
|
||||
cancel: cancel,
|
||||
pushWatcher: pushWatcher,
|
||||
kubeClient: kubeClient,
|
||||
podmanClient: podmanClient,
|
||||
stateClient: stateClient,
|
||||
preferenceClient: preferenceClient,
|
||||
|
||||
devfileState: devstate.NewDevfileState(),
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/redhat-developer/odo/pkg/apiserver-impl/devstate"
|
||||
)
|
||||
|
||||
func (s *DefaultApiService) DevstateContainerPost(ctx context.Context, container openapi.DevstateContainerPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateContainerPost(ctx context.Context, container openapi.DevstateContainerPostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddContainer(
|
||||
container.Name,
|
||||
container.Image,
|
||||
@@ -28,7 +28,7 @@ func (s *DefaultApiService) DevstateContainerPost(ctx context.Context, container
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateContainerContainerNameDelete(ctx context.Context, containerName string) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateContainerContainerNameDelete(ctx context.Context, containerName string) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.DeleteContainer(containerName)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -38,7 +38,7 @@ func (s *DefaultApiService) DevstateContainerContainerNameDelete(ctx context.Con
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateImagePost(ctx context.Context, image openapi.DevstateImagePostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateImagePost(ctx context.Context, image openapi.DevstateImagePostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddImage(
|
||||
image.Name,
|
||||
image.ImageName,
|
||||
@@ -55,7 +55,7 @@ func (s *DefaultApiService) DevstateImagePost(ctx context.Context, image openapi
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateImageImageNameDelete(ctx context.Context, imageName string) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateImageImageNameDelete(ctx context.Context, imageName string) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.DeleteImage(imageName)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -65,7 +65,7 @@ func (s *DefaultApiService) DevstateImageImageNameDelete(ctx context.Context, im
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateResourcePost(ctx context.Context, resource openapi.DevstateResourcePostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateResourcePost(ctx context.Context, resource openapi.DevstateResourcePostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddResource(
|
||||
resource.Name,
|
||||
resource.Inlined,
|
||||
@@ -80,7 +80,7 @@ func (s *DefaultApiService) DevstateResourcePost(ctx context.Context, resource o
|
||||
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateResourceResourceNameDelete(ctx context.Context, resourceName string) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateResourceResourceNameDelete(ctx context.Context, resourceName string) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.DeleteResource(resourceName)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -90,7 +90,7 @@ func (s *DefaultApiService) DevstateResourceResourceNameDelete(ctx context.Conte
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateApplyCommandPost(ctx context.Context, command openapi.DevstateApplyCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateApplyCommandPost(ctx context.Context, command openapi.DevstateApplyCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddApplyCommand(
|
||||
command.Name,
|
||||
command.Component,
|
||||
@@ -103,7 +103,7 @@ func (s *DefaultApiService) DevstateApplyCommandPost(ctx context.Context, comman
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateCommandCommandNameDelete(ctx context.Context, commandName string) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateCommandCommandNameDelete(ctx context.Context, commandName string) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.DeleteCommand(commandName)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -113,7 +113,7 @@ func (s *DefaultApiService) DevstateCommandCommandNameDelete(ctx context.Context
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateCompositeCommandPost(ctx context.Context, command openapi.DevstateCompositeCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateCompositeCommandPost(ctx context.Context, command openapi.DevstateCompositeCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddCompositeCommand(
|
||||
command.Name,
|
||||
command.Parallel,
|
||||
@@ -128,7 +128,7 @@ func (s *DefaultApiService) DevstateCompositeCommandPost(ctx context.Context, co
|
||||
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateExecCommandPost(ctx context.Context, command openapi.DevstateExecCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateExecCommandPost(ctx context.Context, command openapi.DevstateExecCommandPostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.AddExecCommand(
|
||||
command.Name,
|
||||
command.Component,
|
||||
@@ -144,7 +144,7 @@ func (s *DefaultApiService) DevstateExecCommandPost(ctx context.Context, command
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateMetadataPut(ctx context.Context, metadata openapi.MetadataRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateMetadataPut(ctx context.Context, metadata openapi.MetadataRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.SetMetadata(
|
||||
metadata.Name,
|
||||
metadata.Version,
|
||||
@@ -168,7 +168,7 @@ func (s *DefaultApiService) DevstateMetadataPut(ctx context.Context, metadata op
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateChartGet(context.Context) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateChartGet(context.Context) (openapi.ImplResponse, error) {
|
||||
chart, err := s.devfileState.GetFlowChart()
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -180,7 +180,7 @@ func (s *DefaultApiService) DevstateChartGet(context.Context) (openapi.ImplRespo
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateCommandCommandNameMovePost(ctx context.Context, commandName string, params openapi.DevstateCommandCommandNameMovePostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateCommandCommandNameMovePost(ctx context.Context, commandName string, params openapi.DevstateCommandCommandNameMovePostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.MoveCommand(
|
||||
params.FromGroup,
|
||||
params.ToGroup,
|
||||
@@ -195,7 +195,7 @@ func (s *DefaultApiService) DevstateCommandCommandNameMovePost(ctx context.Conte
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateCommandCommandNameSetDefaultPost(ctx context.Context, commandName string, params openapi.DevstateCommandCommandNameSetDefaultPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateCommandCommandNameSetDefaultPost(ctx context.Context, commandName string, params openapi.DevstateCommandCommandNameSetDefaultPostRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.SetDefaultCommand(commandName, params.Group)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -205,7 +205,7 @@ func (s *DefaultApiService) DevstateCommandCommandNameSetDefaultPost(ctx context
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateCommandCommandNameUnsetDefaultPost(ctx context.Context, commandName string) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateCommandCommandNameUnsetDefaultPost(ctx context.Context, commandName string) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.UnsetDefaultCommand(commandName)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -215,7 +215,7 @@ func (s *DefaultApiService) DevstateCommandCommandNameUnsetDefaultPost(ctx conte
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateEventsPut(ctx context.Context, params openapi.DevstateEventsPutRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateEventsPut(ctx context.Context, params openapi.DevstateEventsPutRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.UpdateEvents(params.EventName, params.Commands)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -225,7 +225,7 @@ func (s *DefaultApiService) DevstateEventsPut(ctx context.Context, params openap
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateQuantityValidPost(ctx context.Context, params openapi.DevstateQuantityValidPostRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateQuantityValidPost(ctx context.Context, params openapi.DevstateQuantityValidPostRequest) (openapi.ImplResponse, error) {
|
||||
result := devstate.IsQuantityValid(params.Quantity)
|
||||
if !result {
|
||||
return openapi.Response(http.StatusBadRequest, openapi.GeneralError{
|
||||
@@ -237,7 +237,7 @@ func (s *DefaultApiService) DevstateQuantityValidPost(ctx context.Context, param
|
||||
}), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateDevfilePut(ctx context.Context, params openapi.DevstateDevfilePutRequest) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateDevfilePut(ctx context.Context, params openapi.DevstateDevfilePutRequest) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.SetDevfileContent(params.Content)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -247,7 +247,7 @@ func (s *DefaultApiService) DevstateDevfilePut(ctx context.Context, params opena
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateDevfileGet(context.Context) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateDevfileGet(context.Context) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.GetContent()
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
@@ -257,7 +257,7 @@ func (s *DefaultApiService) DevstateDevfileGet(context.Context) (openapi.ImplRes
|
||||
return openapi.Response(http.StatusOK, newContent), nil
|
||||
}
|
||||
|
||||
func (s *DefaultApiService) DevstateDevfileDelete(context.Context) (openapi.ImplResponse, error) {
|
||||
func (s *DevstateApiService) DevstateDevfileDelete(context.Context) (openapi.ImplResponse, error) {
|
||||
newContent, err := s.devfileState.SetDevfileContent(`schemaVersion: 2.2.0`)
|
||||
if err != nil {
|
||||
return openapi.Response(http.StatusInternalServerError, openapi.GeneralError{
|
||||
|
||||
@@ -56,13 +56,22 @@ func StartServer(
|
||||
preferenceClient,
|
||||
)
|
||||
defaultApiController := openapi.NewDefaultApiController(defaultApiService)
|
||||
devstateApiService := NewDevstateApiService(
|
||||
cancelFunc,
|
||||
pushWatcher,
|
||||
kubernetesClient,
|
||||
podmanClient,
|
||||
stateClient,
|
||||
preferenceClient,
|
||||
)
|
||||
devstateApiController := openapi.NewDevstateApiController(devstateApiService)
|
||||
|
||||
sseNotifier, err := sse.NewNotifier(ctx, fsys, devfilePath, devfileFiles)
|
||||
if err != nil {
|
||||
return ApiServer{}, err
|
||||
}
|
||||
|
||||
router := openapi.NewRouter(sseNotifier, defaultApiController)
|
||||
router := openapi.NewRouter(sseNotifier, defaultApiController, devstateApiController)
|
||||
|
||||
fSysSwagger, err := fs.Sub(swaggerFiles, "swagger-ui")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user