diff --git a/Makefile b/Makefile
index ae2f4ea8b..80bd6fe88 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,8 @@ install: mcs
swagger-gen:
@echo "Generating swagger server code from yaml"
+ @rm -rf models
+ @rm -rf restapi/operations
@swagger generate server -A mcs --main-package=mcs --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
assets:
diff --git a/models/add_notification_endpoint.go b/models/add_notification_endpoint.go
deleted file mode 100644
index 181c0b590..000000000
--- a/models/add_notification_endpoint.go
+++ /dev/null
@@ -1,147 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "encoding/json"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
-)
-
-// AddNotificationEndpoint add notification endpoint
-//
-// swagger:model addNotificationEndpoint
-type AddNotificationEndpoint struct {
-
- // account
- Account string `json:"account,omitempty"`
-
- // properties
- Properties map[string]string `json:"properties,omitempty"`
-
- // service
- // Enum: [webhook amqp kafka mqtt nats nsq mysql postgres elasticsearch redis]
- Service string `json:"service,omitempty"`
-}
-
-// Validate validates this add notification endpoint
-func (m *AddNotificationEndpoint) Validate(formats strfmt.Registry) error {
- var res []error
-
- if err := m.validateService(formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-var addNotificationEndpointTypeServicePropEnum []interface{}
-
-func init() {
- var res []string
- if err := json.Unmarshal([]byte(`["webhook","amqp","kafka","mqtt","nats","nsq","mysql","postgres","elasticsearch","redis"]`), &res); err != nil {
- panic(err)
- }
- for _, v := range res {
- addNotificationEndpointTypeServicePropEnum = append(addNotificationEndpointTypeServicePropEnum, v)
- }
-}
-
-const (
-
- // AddNotificationEndpointServiceWebhook captures enum value "webhook"
- AddNotificationEndpointServiceWebhook string = "webhook"
-
- // AddNotificationEndpointServiceAmqp captures enum value "amqp"
- AddNotificationEndpointServiceAmqp string = "amqp"
-
- // AddNotificationEndpointServiceKafka captures enum value "kafka"
- AddNotificationEndpointServiceKafka string = "kafka"
-
- // AddNotificationEndpointServiceMqtt captures enum value "mqtt"
- AddNotificationEndpointServiceMqtt string = "mqtt"
-
- // AddNotificationEndpointServiceNats captures enum value "nats"
- AddNotificationEndpointServiceNats string = "nats"
-
- // AddNotificationEndpointServiceNsq captures enum value "nsq"
- AddNotificationEndpointServiceNsq string = "nsq"
-
- // AddNotificationEndpointServiceMysql captures enum value "mysql"
- AddNotificationEndpointServiceMysql string = "mysql"
-
- // AddNotificationEndpointServicePostgres captures enum value "postgres"
- AddNotificationEndpointServicePostgres string = "postgres"
-
- // AddNotificationEndpointServiceElasticsearch captures enum value "elasticsearch"
- AddNotificationEndpointServiceElasticsearch string = "elasticsearch"
-
- // AddNotificationEndpointServiceRedis captures enum value "redis"
- AddNotificationEndpointServiceRedis string = "redis"
-)
-
-// prop value enum
-func (m *AddNotificationEndpoint) validateServiceEnum(path, location string, value string) error {
- if err := validate.Enum(path, location, value, addNotificationEndpointTypeServicePropEnum); err != nil {
- return err
- }
- return nil
-}
-
-func (m *AddNotificationEndpoint) validateService(formats strfmt.Registry) error {
-
- if swag.IsZero(m.Service) { // not required
- return nil
- }
-
- // value enum
- if err := m.validateServiceEnum("service", "body", m.Service); err != nil {
- return err
- }
-
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *AddNotificationEndpoint) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *AddNotificationEndpoint) UnmarshalBinary(b []byte) error {
- var res AddNotificationEndpoint
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/models/policy_statement.go b/models/policy_statement.go
deleted file mode 100644
index b9c1f2d8d..000000000
--- a/models/policy_statement.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
-)
-
-// PolicyStatement policy statement
-//
-// swagger:model policyStatement
-type PolicyStatement struct {
-
- // action
- Action []string `json:"Action"`
-
- // condition
- Condition string `json:"Condition,omitempty"`
-
- // effect
- Effect string `json:"Effect,omitempty"`
-
- // resource
- Resource string `json:"Resource,omitempty"`
-
- // sid
- Sid string `json:"Sid,omitempty"`
-}
-
-// Validate validates this policy statement
-func (m *PolicyStatement) Validate(formats strfmt.Registry) error {
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *PolicyStatement) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *PolicyStatement) UnmarshalBinary(b []byte) error {
- var res PolicyStatement
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/models/policy_statements.go b/models/policy_statements.go
deleted file mode 100644
index 86630ed85..000000000
--- a/models/policy_statements.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "strconv"
-
- "github.com/go-openapi/errors"
- "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
-)
-
-// PolicyStatements policy statements
-//
-// swagger:model policyStatements
-type PolicyStatements []*PolicyStatement
-
-// Validate validates this policy statements
-func (m PolicyStatements) Validate(formats strfmt.Registry) error {
- var res []error
-
- for i := 0; i < len(m); i++ {
- if swag.IsZero(m[i]) { // not required
- continue
- }
-
- if m[i] != nil {
- if err := m[i].Validate(formats); err != nil {
- if ve, ok := err.(*errors.Validation); ok {
- return ve.ValidateName(strconv.Itoa(i))
- }
- return err
- }
- }
-
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/restapi/admin_users.go b/restapi/admin_users.go
index 259608795..987a84687 100644
--- a/restapi/admin_users.go
+++ b/restapi/admin_users.go
@@ -74,10 +74,10 @@ func registerUsersHandlers(api *operations.McsAPI) {
sessionID := string(*principal)
userInfoResponse, err := getUserInfoResponse(sessionID, params)
if err != nil {
- return admin_api.NewGetUserDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(err.Error())})
+ return admin_api.NewGetUserInfoDefault(500).WithPayload(&models.Error{Code: 500, Message: swag.String(err.Error())})
}
- return admin_api.NewGetUserOK().WithPayload(userInfoResponse)
+ return admin_api.NewGetUserInfoOK().WithPayload(userInfoResponse)
})
// Update User
api.AdminAPIUpdateUserInfoHandler = admin_api.UpdateUserInfoHandlerFunc(func(params admin_api.UpdateUserInfoParams, principal *models.Principal) middleware.Responder {
diff --git a/restapi/operations/admin_api/get_user.go b/restapi/operations/admin_api/get_user.go
deleted file mode 100644
index 4c70d0300..000000000
--- a/restapi/operations/admin_api/get_user.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package admin_api
-
-// 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/mcs/models"
-)
-
-// GetUserHandlerFunc turns a function with the right signature into a get user handler
-type GetUserHandlerFunc func(GetUserParams, *models.Principal) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn GetUserHandlerFunc) Handle(params GetUserParams, principal *models.Principal) middleware.Responder {
- return fn(params, principal)
-}
-
-// GetUserHandler interface for that can handle valid get user params
-type GetUserHandler interface {
- Handle(GetUserParams, *models.Principal) middleware.Responder
-}
-
-// NewGetUser creates a new http.Handler for the get user operation
-func NewGetUser(ctx *middleware.Context, handler GetUserHandler) *GetUser {
- return &GetUser{Context: ctx, Handler: handler}
-}
-
-/*GetUser swagger:route GET /users/{name} AdminAPI getUser
-
-Get User
-
-*/
-type GetUser struct {
- Context *middleware.Context
- Handler GetUserHandler
-}
-
-func (o *GetUser) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewGetUserParams()
-
- 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)
-
-}
diff --git a/restapi/operations/admin_api/get_user_parameters.go b/restapi/operations/admin_api/get_user_parameters.go
deleted file mode 100644
index 1c2cff4c3..000000000
--- a/restapi/operations/admin_api/get_user_parameters.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package admin_api
-
-// 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"
- "github.com/go-openapi/strfmt"
-)
-
-// NewGetUserParams creates a new GetUserParams object
-// no default values defined in spec.
-func NewGetUserParams() GetUserParams {
-
- return GetUserParams{}
-}
-
-// GetUserParams contains all the bound params for the get user operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters GetUser
-type GetUserParams struct {
-
- // HTTP Request Object
- HTTPRequest *http.Request `json:"-"`
-
- /*
- Required: true
- In: path
- */
- Name string
-}
-
-// 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 NewGetUserParams() beforehand.
-func (o *GetUserParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- rName, rhkName, _ := route.Params.GetOK("name")
- if err := o.bindName(rName, rhkName, route.Formats); err != nil {
- res = append(res, err)
- }
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
-
-// bindName binds and validates parameter Name from path.
-func (o *GetUserParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
- var raw string
- if len(rawData) > 0 {
- raw = rawData[len(rawData)-1]
- }
-
- // Required: true
- // Parameter is provided by construction from the route
-
- o.Name = raw
-
- return nil
-}
diff --git a/restapi/operations/admin_api/get_user_responses.go b/restapi/operations/admin_api/get_user_responses.go
deleted file mode 100644
index 11850d866..000000000
--- a/restapi/operations/admin_api/get_user_responses.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package admin_api
-
-// 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/mcs/models"
-)
-
-// GetUserOKCode is the HTTP code returned for type GetUserOK
-const GetUserOKCode int = 200
-
-/*GetUserOK A successful response.
-
-swagger:response getUserOK
-*/
-type GetUserOK struct {
-
- /*
- In: Body
- */
- Payload *models.User `json:"body,omitempty"`
-}
-
-// NewGetUserOK creates GetUserOK with default headers values
-func NewGetUserOK() *GetUserOK {
-
- return &GetUserOK{}
-}
-
-// WithPayload adds the payload to the get user o k response
-func (o *GetUserOK) WithPayload(payload *models.User) *GetUserOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get user o k response
-func (o *GetUserOK) SetPayload(payload *models.User) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetUserOK) 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
- }
- }
-}
-
-/*GetUserDefault Generic error response.
-
-swagger:response getUserDefault
-*/
-type GetUserDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewGetUserDefault creates GetUserDefault with default headers values
-func NewGetUserDefault(code int) *GetUserDefault {
- if code <= 0 {
- code = 500
- }
-
- return &GetUserDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the get user default response
-func (o *GetUserDefault) WithStatusCode(code int) *GetUserDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the get user default response
-func (o *GetUserDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the get user default response
-func (o *GetUserDefault) WithPayload(payload *models.Error) *GetUserDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the get user default response
-func (o *GetUserDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *GetUserDefault) 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
- }
- }
-}
diff --git a/restapi/operations/admin_api/get_user_urlbuilder.go b/restapi/operations/admin_api/get_user_urlbuilder.go
deleted file mode 100644
index a949ec77f..000000000
--- a/restapi/operations/admin_api/get_user_urlbuilder.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package admin_api
-
-// 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"
- "strings"
-)
-
-// GetUserURL generates an URL for the get user operation
-type GetUserURL struct {
- Name string
-
- _basePath string
- // avoid unkeyed usage
- _ struct{}
-}
-
-// 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 *GetUserURL) WithBasePath(bp string) *GetUserURL {
- 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 *GetUserURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *GetUserURL) Build() (*url.URL, error) {
- var _result url.URL
-
- var _path = "/users/{name}"
-
- name := o.Name
- if name != "" {
- _path = strings.Replace(_path, "{name}", name, -1)
- } else {
- return nil, errors.New("name is required on GetUserURL")
- }
-
- _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 *GetUserURL) 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 *GetUserURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *GetUserURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on GetUserURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on GetUserURL")
- }
-
- 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 *GetUserURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/restapi/operations/user_api/login_oauth2_callback.go b/restapi/operations/user_api/login_oauth2_callback.go
deleted file mode 100644
index e68e31d7f..000000000
--- a/restapi/operations/user_api/login_oauth2_callback.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// LoginOauth2CallbackHandlerFunc turns a function with the right signature into a login oauth2 callback handler
-type LoginOauth2CallbackHandlerFunc func(LoginOauth2CallbackParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn LoginOauth2CallbackHandlerFunc) Handle(params LoginOauth2CallbackParams) middleware.Responder {
- return fn(params)
-}
-
-// LoginOauth2CallbackHandler interface for that can handle valid login oauth2 callback params
-type LoginOauth2CallbackHandler interface {
- Handle(LoginOauth2CallbackParams) middleware.Responder
-}
-
-// NewLoginOauth2Callback creates a new http.Handler for the login oauth2 callback operation
-func NewLoginOauth2Callback(ctx *middleware.Context, handler LoginOauth2CallbackHandler) *LoginOauth2Callback {
- return &LoginOauth2Callback{Context: ctx, Handler: handler}
-}
-
-/*LoginOauth2Callback swagger:route GET /login/oauth2/callback UserAPI loginOauth2Callback
-
-Identity Provider oauth2 callback endpoint.
-
-*/
-type LoginOauth2Callback struct {
- Context *middleware.Context
- Handler LoginOauth2CallbackHandler
-}
-
-func (o *LoginOauth2Callback) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewLoginOauth2CallbackParams()
-
- 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) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/restapi/operations/user_api/login_oauth2_callback_parameters.go b/restapi/operations/user_api/login_oauth2_callback_parameters.go
deleted file mode 100644
index cfa3ad4da..000000000
--- a/restapi/operations/user_api/login_oauth2_callback_parameters.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// NewLoginOauth2CallbackParams creates a new LoginOauth2CallbackParams object
-// no default values defined in spec.
-func NewLoginOauth2CallbackParams() LoginOauth2CallbackParams {
-
- return LoginOauth2CallbackParams{}
-}
-
-// LoginOauth2CallbackParams contains all the bound params for the login oauth2 callback operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters LoginOauth2Callback
-type LoginOauth2CallbackParams 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 NewLoginOauth2CallbackParams() beforehand.
-func (o *LoginOauth2CallbackParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/restapi/operations/user_api/login_oauth2_callback_responses.go b/restapi/operations/user_api/login_oauth2_callback_responses.go
deleted file mode 100644
index 63df5bfed..000000000
--- a/restapi/operations/user_api/login_oauth2_callback_responses.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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/mcs/models"
-)
-
-// LoginOauth2CallbackOKCode is the HTTP code returned for type LoginOauth2CallbackOK
-const LoginOauth2CallbackOKCode int = 200
-
-/*LoginOauth2CallbackOK A successful response.
-
-swagger:response loginOauth2CallbackOK
-*/
-type LoginOauth2CallbackOK struct {
-}
-
-// NewLoginOauth2CallbackOK creates LoginOauth2CallbackOK with default headers values
-func NewLoginOauth2CallbackOK() *LoginOauth2CallbackOK {
-
- return &LoginOauth2CallbackOK{}
-}
-
-// WriteResponse to the client
-func (o *LoginOauth2CallbackOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
-
- rw.WriteHeader(200)
-}
-
-/*LoginOauth2CallbackDefault Generic error response.
-
-swagger:response loginOauth2CallbackDefault
-*/
-type LoginOauth2CallbackDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewLoginOauth2CallbackDefault creates LoginOauth2CallbackDefault with default headers values
-func NewLoginOauth2CallbackDefault(code int) *LoginOauth2CallbackDefault {
- if code <= 0 {
- code = 500
- }
-
- return &LoginOauth2CallbackDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the login oauth2 callback default response
-func (o *LoginOauth2CallbackDefault) WithStatusCode(code int) *LoginOauth2CallbackDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the login oauth2 callback default response
-func (o *LoginOauth2CallbackDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the login oauth2 callback default response
-func (o *LoginOauth2CallbackDefault) WithPayload(payload *models.Error) *LoginOauth2CallbackDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the login oauth2 callback default response
-func (o *LoginOauth2CallbackDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *LoginOauth2CallbackDefault) 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
- }
- }
-}
diff --git a/restapi/operations/user_api/login_oauth2_callback_urlbuilder.go b/restapi/operations/user_api/login_oauth2_callback_urlbuilder.go
deleted file mode 100644
index 827224591..000000000
--- a/restapi/operations/user_api/login_oauth2_callback_urlbuilder.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// LoginOauth2CallbackURL generates an URL for the login oauth2 callback operation
-type LoginOauth2CallbackURL 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 *LoginOauth2CallbackURL) WithBasePath(bp string) *LoginOauth2CallbackURL {
- 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 *LoginOauth2CallbackURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *LoginOauth2CallbackURL) Build() (*url.URL, error) {
- var _result url.URL
-
- var _path = "/login/oauth2/callback"
-
- _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 *LoginOauth2CallbackURL) 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 *LoginOauth2CallbackURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *LoginOauth2CallbackURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on LoginOauth2CallbackURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on LoginOauth2CallbackURL")
- }
-
- 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 *LoginOauth2CallbackURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/restapi/operations/user_api/oauth2_callback.go b/restapi/operations/user_api/oauth2_callback.go
deleted file mode 100644
index e87cb4fde..000000000
--- a/restapi/operations/user_api/oauth2_callback.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// Oauth2CallbackHandlerFunc turns a function with the right signature into a oauth2 callback handler
-type Oauth2CallbackHandlerFunc func(Oauth2CallbackParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn Oauth2CallbackHandlerFunc) Handle(params Oauth2CallbackParams) middleware.Responder {
- return fn(params)
-}
-
-// Oauth2CallbackHandler interface for that can handle valid oauth2 callback params
-type Oauth2CallbackHandler interface {
- Handle(Oauth2CallbackParams) middleware.Responder
-}
-
-// NewOauth2Callback creates a new http.Handler for the oauth2 callback operation
-func NewOauth2Callback(ctx *middleware.Context, handler Oauth2CallbackHandler) *Oauth2Callback {
- return &Oauth2Callback{Context: ctx, Handler: handler}
-}
-
-/*Oauth2Callback swagger:route GET /login/oauth2/callback UserAPI oauth2Callback
-
-Identity Provider oauth2 callback endpoint.
-
-*/
-type Oauth2Callback struct {
- Context *middleware.Context
- Handler Oauth2CallbackHandler
-}
-
-func (o *Oauth2Callback) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- r = rCtx
- }
- var Params = NewOauth2CallbackParams()
-
- 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) // actually handle the request
-
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/restapi/operations/user_api/oauth2_callback_parameters.go b/restapi/operations/user_api/oauth2_callback_parameters.go
deleted file mode 100644
index a3d2d6b6c..000000000
--- a/restapi/operations/user_api/oauth2_callback_parameters.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// NewOauth2CallbackParams creates a new Oauth2CallbackParams object
-// no default values defined in spec.
-func NewOauth2CallbackParams() Oauth2CallbackParams {
-
- return Oauth2CallbackParams{}
-}
-
-// Oauth2CallbackParams contains all the bound params for the oauth2 callback operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters Oauth2Callback
-type Oauth2CallbackParams 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 NewOauth2CallbackParams() beforehand.
-func (o *Oauth2CallbackParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/restapi/operations/user_api/oauth2_callback_responses.go b/restapi/operations/user_api/oauth2_callback_responses.go
deleted file mode 100644
index 158073fd4..000000000
--- a/restapi/operations/user_api/oauth2_callback_responses.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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/mcs/models"
-)
-
-// Oauth2CallbackOKCode is the HTTP code returned for type Oauth2CallbackOK
-const Oauth2CallbackOKCode int = 200
-
-/*Oauth2CallbackOK A successful response.
-
-swagger:response oauth2CallbackOK
-*/
-type Oauth2CallbackOK struct {
-}
-
-// NewOauth2CallbackOK creates Oauth2CallbackOK with default headers values
-func NewOauth2CallbackOK() *Oauth2CallbackOK {
-
- return &Oauth2CallbackOK{}
-}
-
-// WriteResponse to the client
-func (o *Oauth2CallbackOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
-
- rw.WriteHeader(200)
-}
-
-/*Oauth2CallbackDefault Generic error response.
-
-swagger:response oauth2CallbackDefault
-*/
-type Oauth2CallbackDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.Error `json:"body,omitempty"`
-}
-
-// NewOauth2CallbackDefault creates Oauth2CallbackDefault with default headers values
-func NewOauth2CallbackDefault(code int) *Oauth2CallbackDefault {
- if code <= 0 {
- code = 500
- }
-
- return &Oauth2CallbackDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the oauth2 callback default response
-func (o *Oauth2CallbackDefault) WithStatusCode(code int) *Oauth2CallbackDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the oauth2 callback default response
-func (o *Oauth2CallbackDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the oauth2 callback default response
-func (o *Oauth2CallbackDefault) WithPayload(payload *models.Error) *Oauth2CallbackDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the oauth2 callback default response
-func (o *Oauth2CallbackDefault) SetPayload(payload *models.Error) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *Oauth2CallbackDefault) 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
- }
- }
-}
diff --git a/restapi/operations/user_api/oauth2_callback_urlbuilder.go b/restapi/operations/user_api/oauth2_callback_urlbuilder.go
deleted file mode 100644
index a2dd37292..000000000
--- a/restapi/operations/user_api/oauth2_callback_urlbuilder.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2020 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 .
-//
-
-package user_api
-
-// 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"
-)
-
-// Oauth2CallbackURL generates an URL for the oauth2 callback operation
-type Oauth2CallbackURL 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 *Oauth2CallbackURL) WithBasePath(bp string) *Oauth2CallbackURL {
- 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 *Oauth2CallbackURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *Oauth2CallbackURL) Build() (*url.URL, error) {
- var _result url.URL
-
- var _path = "/login/oauth2/callback"
-
- _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 *Oauth2CallbackURL) 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 *Oauth2CallbackURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *Oauth2CallbackURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on Oauth2CallbackURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on Oauth2CallbackURL")
- }
-
- 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 *Oauth2CallbackURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}