Rename restapi to api (#3176)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2023-12-26 15:07:30 -06:00
committed by GitHub
parent 8aa0ec17c5
commit 616f262d09
733 changed files with 396 additions and 372 deletions

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// ProfilingStartHandlerFunc turns a function with the right signature into a profiling start handler
type ProfilingStartHandlerFunc func(ProfilingStartParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ProfilingStartHandlerFunc) Handle(params ProfilingStartParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// ProfilingStartHandler interface for that can handle valid profiling start params
type ProfilingStartHandler interface {
Handle(ProfilingStartParams, *models.Principal) middleware.Responder
}
// NewProfilingStart creates a new http.Handler for the profiling start operation
func NewProfilingStart(ctx *middleware.Context, handler ProfilingStartHandler) *ProfilingStart {
return &ProfilingStart{Context: ctx, Handler: handler}
}
/*
ProfilingStart swagger:route POST /profiling/start Profile profilingStart
Start recording profile data
*/
type ProfilingStart struct {
Context *middleware.Context
Handler ProfilingStartHandler
}
func (o *ProfilingStart) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewProfilingStartParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,101 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/validate"
"github.com/minio/console/models"
)
// NewProfilingStartParams creates a new ProfilingStartParams object
//
// There are no default values defined in the spec.
func NewProfilingStartParams() ProfilingStartParams {
return ProfilingStartParams{}
}
// ProfilingStartParams contains all the bound params for the profiling start operation
// typically these are obtained from a http.Request
//
// swagger:parameters ProfilingStart
type ProfilingStartParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: body
*/
Body *models.ProfilingStartRequest
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewProfilingStartParams() beforehand.
func (o *ProfilingStartParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body models.ProfilingStartRequest
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("body", "body", ""))
} else {
res = append(res, errors.NewParseError("body", "body", "", err))
}
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Body = &body
}
}
} else {
res = append(res, errors.Required("body", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/minio/console/models"
)
// ProfilingStartCreatedCode is the HTTP code returned for type ProfilingStartCreated
const ProfilingStartCreatedCode int = 201
/*
ProfilingStartCreated A successful response.
swagger:response profilingStartCreated
*/
type ProfilingStartCreated struct {
/*
In: Body
*/
Payload *models.StartProfilingList `json:"body,omitempty"`
}
// NewProfilingStartCreated creates ProfilingStartCreated with default headers values
func NewProfilingStartCreated() *ProfilingStartCreated {
return &ProfilingStartCreated{}
}
// WithPayload adds the payload to the profiling start created response
func (o *ProfilingStartCreated) WithPayload(payload *models.StartProfilingList) *ProfilingStartCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the profiling start created response
func (o *ProfilingStartCreated) SetPayload(payload *models.StartProfilingList) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ProfilingStartCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(201)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*
ProfilingStartDefault Generic error response.
swagger:response profilingStartDefault
*/
type ProfilingStartDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.APIError `json:"body,omitempty"`
}
// NewProfilingStartDefault creates ProfilingStartDefault with default headers values
func NewProfilingStartDefault(code int) *ProfilingStartDefault {
if code <= 0 {
code = 500
}
return &ProfilingStartDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the profiling start default response
func (o *ProfilingStartDefault) WithStatusCode(code int) *ProfilingStartDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the profiling start default response
func (o *ProfilingStartDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the profiling start default response
func (o *ProfilingStartDefault) WithPayload(payload *models.APIError) *ProfilingStartDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the profiling start default response
func (o *ProfilingStartDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ProfilingStartDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
)
// ProfilingStartURL generates an URL for the profiling start operation
type ProfilingStartURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ProfilingStartURL) WithBasePath(bp string) *ProfilingStartURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ProfilingStartURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *ProfilingStartURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/profiling/start"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *ProfilingStartURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *ProfilingStartURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *ProfilingStartURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on ProfilingStartURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on ProfilingStartURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *ProfilingStartURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// ProfilingStopHandlerFunc turns a function with the right signature into a profiling stop handler
type ProfilingStopHandlerFunc func(ProfilingStopParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ProfilingStopHandlerFunc) Handle(params ProfilingStopParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// ProfilingStopHandler interface for that can handle valid profiling stop params
type ProfilingStopHandler interface {
Handle(ProfilingStopParams, *models.Principal) middleware.Responder
}
// NewProfilingStop creates a new http.Handler for the profiling stop operation
func NewProfilingStop(ctx *middleware.Context, handler ProfilingStopHandler) *ProfilingStop {
return &ProfilingStop{Context: ctx, Handler: handler}
}
/*
ProfilingStop swagger:route POST /profiling/stop Profile profilingStop
Stop and download profile data
*/
type ProfilingStop struct {
Context *middleware.Context
Handler ProfilingStopHandler
}
func (o *ProfilingStop) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewProfilingStopParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,63 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewProfilingStopParams creates a new ProfilingStopParams object
//
// There are no default values defined in the spec.
func NewProfilingStopParams() ProfilingStopParams {
return ProfilingStopParams{}
}
// ProfilingStopParams contains all the bound params for the profiling stop operation
// typically these are obtained from a http.Request
//
// swagger:parameters ProfilingStop
type ProfilingStopParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewProfilingStopParams() beforehand.
func (o *ProfilingStopParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,134 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"io"
"net/http"
"github.com/go-openapi/runtime"
"github.com/minio/console/models"
)
// ProfilingStopCreatedCode is the HTTP code returned for type ProfilingStopCreated
const ProfilingStopCreatedCode int = 201
/*
ProfilingStopCreated A successful response.
swagger:response profilingStopCreated
*/
type ProfilingStopCreated struct {
/*
In: Body
*/
Payload io.ReadCloser `json:"body,omitempty"`
}
// NewProfilingStopCreated creates ProfilingStopCreated with default headers values
func NewProfilingStopCreated() *ProfilingStopCreated {
return &ProfilingStopCreated{}
}
// WithPayload adds the payload to the profiling stop created response
func (o *ProfilingStopCreated) WithPayload(payload io.ReadCloser) *ProfilingStopCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the profiling stop created response
func (o *ProfilingStopCreated) SetPayload(payload io.ReadCloser) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ProfilingStopCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(201)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
/*
ProfilingStopDefault Generic error response.
swagger:response profilingStopDefault
*/
type ProfilingStopDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.APIError `json:"body,omitempty"`
}
// NewProfilingStopDefault creates ProfilingStopDefault with default headers values
func NewProfilingStopDefault(code int) *ProfilingStopDefault {
if code <= 0 {
code = 500
}
return &ProfilingStopDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the profiling stop default response
func (o *ProfilingStopDefault) WithStatusCode(code int) *ProfilingStopDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the profiling stop default response
func (o *ProfilingStopDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the profiling stop default response
func (o *ProfilingStopDefault) WithPayload(payload *models.APIError) *ProfilingStopDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the profiling stop default response
func (o *ProfilingStopDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *ProfilingStopDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package profile
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
)
// ProfilingStopURL generates an URL for the profiling stop operation
type ProfilingStopURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ProfilingStopURL) WithBasePath(bp string) *ProfilingStopURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *ProfilingStopURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *ProfilingStopURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/profiling/stop"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *ProfilingStopURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *ProfilingStopURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *ProfilingStopURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on ProfilingStopURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on ProfilingStopURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *ProfilingStopURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}