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 support
// 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"
)
// GetCallHomeOptionValueHandlerFunc turns a function with the right signature into a get call home option value handler
type GetCallHomeOptionValueHandlerFunc func(GetCallHomeOptionValueParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn GetCallHomeOptionValueHandlerFunc) Handle(params GetCallHomeOptionValueParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// GetCallHomeOptionValueHandler interface for that can handle valid get call home option value params
type GetCallHomeOptionValueHandler interface {
Handle(GetCallHomeOptionValueParams, *models.Principal) middleware.Responder
}
// NewGetCallHomeOptionValue creates a new http.Handler for the get call home option value operation
func NewGetCallHomeOptionValue(ctx *middleware.Context, handler GetCallHomeOptionValueHandler) *GetCallHomeOptionValue {
return &GetCallHomeOptionValue{Context: ctx, Handler: handler}
}
/*
GetCallHomeOptionValue swagger:route GET /support/callhome Support getCallHomeOptionValue
Get Callhome current status
*/
type GetCallHomeOptionValue struct {
Context *middleware.Context
Handler GetCallHomeOptionValueHandler
}
func (o *GetCallHomeOptionValue) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewGetCallHomeOptionValueParams()
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 support
// 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"
)
// NewGetCallHomeOptionValueParams creates a new GetCallHomeOptionValueParams object
//
// There are no default values defined in the spec.
func NewGetCallHomeOptionValueParams() GetCallHomeOptionValueParams {
return GetCallHomeOptionValueParams{}
}
// GetCallHomeOptionValueParams contains all the bound params for the get call home option value operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetCallHomeOptionValue
type GetCallHomeOptionValueParams 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 NewGetCallHomeOptionValueParams() beforehand.
func (o *GetCallHomeOptionValueParams) 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,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 support
// 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"
)
// GetCallHomeOptionValueOKCode is the HTTP code returned for type GetCallHomeOptionValueOK
const GetCallHomeOptionValueOKCode int = 200
/*
GetCallHomeOptionValueOK A successful response.
swagger:response getCallHomeOptionValueOK
*/
type GetCallHomeOptionValueOK struct {
/*
In: Body
*/
Payload *models.CallHomeGetResponse `json:"body,omitempty"`
}
// NewGetCallHomeOptionValueOK creates GetCallHomeOptionValueOK with default headers values
func NewGetCallHomeOptionValueOK() *GetCallHomeOptionValueOK {
return &GetCallHomeOptionValueOK{}
}
// WithPayload adds the payload to the get call home option value o k response
func (o *GetCallHomeOptionValueOK) WithPayload(payload *models.CallHomeGetResponse) *GetCallHomeOptionValueOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get call home option value o k response
func (o *GetCallHomeOptionValueOK) SetPayload(payload *models.CallHomeGetResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetCallHomeOptionValueOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*
GetCallHomeOptionValueDefault Generic error response.
swagger:response getCallHomeOptionValueDefault
*/
type GetCallHomeOptionValueDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.APIError `json:"body,omitempty"`
}
// NewGetCallHomeOptionValueDefault creates GetCallHomeOptionValueDefault with default headers values
func NewGetCallHomeOptionValueDefault(code int) *GetCallHomeOptionValueDefault {
if code <= 0 {
code = 500
}
return &GetCallHomeOptionValueDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get call home option value default response
func (o *GetCallHomeOptionValueDefault) WithStatusCode(code int) *GetCallHomeOptionValueDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get call home option value default response
func (o *GetCallHomeOptionValueDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get call home option value default response
func (o *GetCallHomeOptionValueDefault) WithPayload(payload *models.APIError) *GetCallHomeOptionValueDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get call home option value default response
func (o *GetCallHomeOptionValueDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetCallHomeOptionValueDefault) 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 support
// 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"
)
// GetCallHomeOptionValueURL generates an URL for the get call home option value operation
type GetCallHomeOptionValueURL 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 *GetCallHomeOptionValueURL) WithBasePath(bp string) *GetCallHomeOptionValueURL {
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 *GetCallHomeOptionValueURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *GetCallHomeOptionValueURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/support/callhome"
_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 *GetCallHomeOptionValueURL) 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 *GetCallHomeOptionValueURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *GetCallHomeOptionValueURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on GetCallHomeOptionValueURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on GetCallHomeOptionValueURL")
}
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 *GetCallHomeOptionValueURL) 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 support
// 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"
)
// SetCallHomeStatusHandlerFunc turns a function with the right signature into a set call home status handler
type SetCallHomeStatusHandlerFunc func(SetCallHomeStatusParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn SetCallHomeStatusHandlerFunc) Handle(params SetCallHomeStatusParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// SetCallHomeStatusHandler interface for that can handle valid set call home status params
type SetCallHomeStatusHandler interface {
Handle(SetCallHomeStatusParams, *models.Principal) middleware.Responder
}
// NewSetCallHomeStatus creates a new http.Handler for the set call home status operation
func NewSetCallHomeStatus(ctx *middleware.Context, handler SetCallHomeStatusHandler) *SetCallHomeStatus {
return &SetCallHomeStatus{Context: ctx, Handler: handler}
}
/*
SetCallHomeStatus swagger:route PUT /support/callhome Support setCallHomeStatus
Sets callhome status
*/
type SetCallHomeStatus struct {
Context *middleware.Context
Handler SetCallHomeStatusHandler
}
func (o *SetCallHomeStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewSetCallHomeStatusParams()
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 support
// 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"
)
// NewSetCallHomeStatusParams creates a new SetCallHomeStatusParams object
//
// There are no default values defined in the spec.
func NewSetCallHomeStatusParams() SetCallHomeStatusParams {
return SetCallHomeStatusParams{}
}
// SetCallHomeStatusParams contains all the bound params for the set call home status operation
// typically these are obtained from a http.Request
//
// swagger:parameters SetCallHomeStatus
type SetCallHomeStatusParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: body
*/
Body *models.CallHomeSetStatus
}
// 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 NewSetCallHomeStatusParams() beforehand.
func (o *SetCallHomeStatusParams) 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.CallHomeSetStatus
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,115 @@
// 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 support
// 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"
)
// SetCallHomeStatusNoContentCode is the HTTP code returned for type SetCallHomeStatusNoContent
const SetCallHomeStatusNoContentCode int = 204
/*
SetCallHomeStatusNoContent A successful response.
swagger:response setCallHomeStatusNoContent
*/
type SetCallHomeStatusNoContent struct {
}
// NewSetCallHomeStatusNoContent creates SetCallHomeStatusNoContent with default headers values
func NewSetCallHomeStatusNoContent() *SetCallHomeStatusNoContent {
return &SetCallHomeStatusNoContent{}
}
// WriteResponse to the client
func (o *SetCallHomeStatusNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(204)
}
/*
SetCallHomeStatusDefault Generic error response.
swagger:response setCallHomeStatusDefault
*/
type SetCallHomeStatusDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.APIError `json:"body,omitempty"`
}
// NewSetCallHomeStatusDefault creates SetCallHomeStatusDefault with default headers values
func NewSetCallHomeStatusDefault(code int) *SetCallHomeStatusDefault {
if code <= 0 {
code = 500
}
return &SetCallHomeStatusDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the set call home status default response
func (o *SetCallHomeStatusDefault) WithStatusCode(code int) *SetCallHomeStatusDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the set call home status default response
func (o *SetCallHomeStatusDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the set call home status default response
func (o *SetCallHomeStatusDefault) WithPayload(payload *models.APIError) *SetCallHomeStatusDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the set call home status default response
func (o *SetCallHomeStatusDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *SetCallHomeStatusDefault) 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 support
// 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"
)
// SetCallHomeStatusURL generates an URL for the set call home status operation
type SetCallHomeStatusURL 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 *SetCallHomeStatusURL) WithBasePath(bp string) *SetCallHomeStatusURL {
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 *SetCallHomeStatusURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *SetCallHomeStatusURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/support/callhome"
_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 *SetCallHomeStatusURL) 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 *SetCallHomeStatusURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *SetCallHomeStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on SetCallHomeStatusURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on SetCallHomeStatusURL")
}
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 *SetCallHomeStatusURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}