Remove Operator UI Storage Page (#1639)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -86,8 +86,6 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
|
||||
// Register Parity' handlers
|
||||
registerParityHandlers(api)
|
||||
|
||||
// Direct CSI handlers
|
||||
registerDirectCSIHandlers(api)
|
||||
// Volumes handlers
|
||||
registerVolumesHandlers(api)
|
||||
// Namespaces handlers
|
||||
|
||||
@@ -118,109 +118,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/drives": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Get direct-csi drives list",
|
||||
"operationId": "GetDirectCSIDriveList",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "nodes",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "drives",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/getDirectCSIDriveListResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/drives/format": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Format direct-csi drives from a list",
|
||||
"operationId": "DirectCSIFormatDrive",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/formatConfiguration"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/formatDirectCSIDrivesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/volumes": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Get direct-csi volumes list",
|
||||
"operationId": "GetDirectCSIVolumeList",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "nodes",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "drives",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/getDirectCSIVolumeListResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/get-parity/{nodes}/{disksPerNode}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -3851,109 +3748,6 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/drives": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Get direct-csi drives list",
|
||||
"operationId": "GetDirectCSIDriveList",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "nodes",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "drives",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/getDirectCSIDriveListResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/drives/format": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Format direct-csi drives from a list",
|
||||
"operationId": "DirectCSIFormatDrive",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/formatConfiguration"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/formatDirectCSIDrivesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/direct-csi/volumes": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"OperatorAPI"
|
||||
],
|
||||
"summary": "Get direct-csi volumes list",
|
||||
"operationId": "GetDirectCSIVolumeList",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "nodes",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "drives",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/getDirectCSIVolumeListResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/get-parity/{nodes}/{disksPerNode}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
||||
@@ -78,9 +78,6 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
OperatorAPIDeleteTenantHandler: operator_api.DeleteTenantHandlerFunc(func(params operator_api.DeleteTenantParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DeleteTenant has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDirectCSIFormatDriveHandler: operator_api.DirectCSIFormatDriveHandlerFunc(func(params operator_api.DirectCSIFormatDriveParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DirectCSIFormatDrive has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDisableTenantLoggingHandler: operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DisableTenantLogging has not yet been implemented")
|
||||
}),
|
||||
@@ -90,12 +87,6 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
OperatorAPIGetAllocatableResourcesHandler: operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetAllocatableResources has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectCSIDriveListHandler: operator_api.GetDirectCSIDriveListHandlerFunc(func(params operator_api.GetDirectCSIDriveListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectCSIDriveList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectCSIVolumeListHandler: operator_api.GetDirectCSIVolumeListHandlerFunc(func(params operator_api.GetDirectCSIVolumeListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectCSIVolumeList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetMaxAllocatableMemHandler: operator_api.GetMaxAllocatableMemHandlerFunc(func(params operator_api.GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetMaxAllocatableMem has not yet been implemented")
|
||||
}),
|
||||
@@ -266,18 +257,12 @@ type OperatorAPI struct {
|
||||
OperatorAPIDeletePodHandler operator_api.DeletePodHandler
|
||||
// OperatorAPIDeleteTenantHandler sets the operation handler for the delete tenant operation
|
||||
OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler
|
||||
// OperatorAPIDirectCSIFormatDriveHandler sets the operation handler for the direct c s i format drive operation
|
||||
OperatorAPIDirectCSIFormatDriveHandler operator_api.DirectCSIFormatDriveHandler
|
||||
// OperatorAPIDisableTenantLoggingHandler sets the operation handler for the disable tenant logging operation
|
||||
OperatorAPIDisableTenantLoggingHandler operator_api.DisableTenantLoggingHandler
|
||||
// OperatorAPIEnableTenantLoggingHandler sets the operation handler for the enable tenant logging operation
|
||||
OperatorAPIEnableTenantLoggingHandler operator_api.EnableTenantLoggingHandler
|
||||
// OperatorAPIGetAllocatableResourcesHandler sets the operation handler for the get allocatable resources operation
|
||||
OperatorAPIGetAllocatableResourcesHandler operator_api.GetAllocatableResourcesHandler
|
||||
// OperatorAPIGetDirectCSIDriveListHandler sets the operation handler for the get direct c s i drive list operation
|
||||
OperatorAPIGetDirectCSIDriveListHandler operator_api.GetDirectCSIDriveListHandler
|
||||
// OperatorAPIGetDirectCSIVolumeListHandler sets the operation handler for the get direct c s i volume list operation
|
||||
OperatorAPIGetDirectCSIVolumeListHandler operator_api.GetDirectCSIVolumeListHandler
|
||||
// OperatorAPIGetMaxAllocatableMemHandler sets the operation handler for the get max allocatable mem operation
|
||||
OperatorAPIGetMaxAllocatableMemHandler operator_api.GetMaxAllocatableMemHandler
|
||||
// OperatorAPIGetPVCEventsHandler sets the operation handler for the get p v c events operation
|
||||
@@ -448,9 +433,6 @@ func (o *OperatorAPI) Validate() error {
|
||||
if o.OperatorAPIDeleteTenantHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DeleteTenantHandler")
|
||||
}
|
||||
if o.OperatorAPIDirectCSIFormatDriveHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DirectCSIFormatDriveHandler")
|
||||
}
|
||||
if o.OperatorAPIDisableTenantLoggingHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DisableTenantLoggingHandler")
|
||||
}
|
||||
@@ -460,12 +442,6 @@ func (o *OperatorAPI) Validate() error {
|
||||
if o.OperatorAPIGetAllocatableResourcesHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetAllocatableResourcesHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectCSIDriveListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectCSIDriveListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectCSIVolumeListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectCSIVolumeListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetMaxAllocatableMemHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetMaxAllocatableMemHandler")
|
||||
}
|
||||
@@ -698,10 +674,6 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/direct-csi/drives/format"] = operator_api.NewDirectCSIFormatDrive(o.context, o.OperatorAPIDirectCSIFormatDriveHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/disable-logging"] = operator_api.NewDisableTenantLogging(o.context, o.OperatorAPIDisableTenantLoggingHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -714,14 +686,6 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/direct-csi/drives"] = operator_api.NewGetDirectCSIDriveList(o.context, o.OperatorAPIGetDirectCSIDriveListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/direct-csi/volumes"] = operator_api.NewGetDirectCSIVolumeList(o.context, o.OperatorAPIGetDirectCSIVolumeListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/cluster/max-allocatable-memory"] = operator_api.NewGetMaxAllocatableMem(o.context, o.OperatorAPIGetMaxAllocatableMemHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// DirectCSIFormatDriveHandlerFunc turns a function with the right signature into a direct c s i format drive handler
|
||||
type DirectCSIFormatDriveHandlerFunc func(DirectCSIFormatDriveParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DirectCSIFormatDriveHandlerFunc) Handle(params DirectCSIFormatDriveParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// DirectCSIFormatDriveHandler interface for that can handle valid direct c s i format drive params
|
||||
type DirectCSIFormatDriveHandler interface {
|
||||
Handle(DirectCSIFormatDriveParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDirectCSIFormatDrive creates a new http.Handler for the direct c s i format drive operation
|
||||
func NewDirectCSIFormatDrive(ctx *middleware.Context, handler DirectCSIFormatDriveHandler) *DirectCSIFormatDrive {
|
||||
return &DirectCSIFormatDrive{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* DirectCSIFormatDrive swagger:route POST /direct-csi/drives/format OperatorAPI directCSIFormatDrive
|
||||
|
||||
Format direct-csi drives from a list
|
||||
|
||||
*/
|
||||
type DirectCSIFormatDrive struct {
|
||||
Context *middleware.Context
|
||||
Handler DirectCSIFormatDriveHandler
|
||||
}
|
||||
|
||||
func (o *DirectCSIFormatDrive) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewDirectCSIFormatDriveParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewDirectCSIFormatDriveParams creates a new DirectCSIFormatDriveParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewDirectCSIFormatDriveParams() DirectCSIFormatDriveParams {
|
||||
|
||||
return DirectCSIFormatDriveParams{}
|
||||
}
|
||||
|
||||
// DirectCSIFormatDriveParams contains all the bound params for the direct c s i format drive operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters DirectCSIFormatDrive
|
||||
type DirectCSIFormatDriveParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.FormatConfiguration
|
||||
}
|
||||
|
||||
// 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 NewDirectCSIFormatDriveParams() beforehand.
|
||||
func (o *DirectCSIFormatDriveParams) 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.FormatConfiguration
|
||||
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(context.Background())
|
||||
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
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// DirectCSIFormatDriveOKCode is the HTTP code returned for type DirectCSIFormatDriveOK
|
||||
const DirectCSIFormatDriveOKCode int = 200
|
||||
|
||||
/*DirectCSIFormatDriveOK A successful response.
|
||||
|
||||
swagger:response directCSIFormatDriveOK
|
||||
*/
|
||||
type DirectCSIFormatDriveOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.FormatDirectCSIDrivesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDirectCSIFormatDriveOK creates DirectCSIFormatDriveOK with default headers values
|
||||
func NewDirectCSIFormatDriveOK() *DirectCSIFormatDriveOK {
|
||||
|
||||
return &DirectCSIFormatDriveOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the direct c s i format drive o k response
|
||||
func (o *DirectCSIFormatDriveOK) WithPayload(payload *models.FormatDirectCSIDrivesResponse) *DirectCSIFormatDriveOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the direct c s i format drive o k response
|
||||
func (o *DirectCSIFormatDriveOK) SetPayload(payload *models.FormatDirectCSIDrivesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DirectCSIFormatDriveOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*DirectCSIFormatDriveDefault Generic error response.
|
||||
|
||||
swagger:response directCSIFormatDriveDefault
|
||||
*/
|
||||
type DirectCSIFormatDriveDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDirectCSIFormatDriveDefault creates DirectCSIFormatDriveDefault with default headers values
|
||||
func NewDirectCSIFormatDriveDefault(code int) *DirectCSIFormatDriveDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DirectCSIFormatDriveDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the direct c s i format drive default response
|
||||
func (o *DirectCSIFormatDriveDefault) WithStatusCode(code int) *DirectCSIFormatDriveDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the direct c s i format drive default response
|
||||
func (o *DirectCSIFormatDriveDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the direct c s i format drive default response
|
||||
func (o *DirectCSIFormatDriveDefault) WithPayload(payload *models.Error) *DirectCSIFormatDriveDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the direct c s i format drive default response
|
||||
func (o *DirectCSIFormatDriveDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DirectCSIFormatDriveDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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"
|
||||
)
|
||||
|
||||
// DirectCSIFormatDriveURL generates an URL for the direct c s i format drive operation
|
||||
type DirectCSIFormatDriveURL 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 *DirectCSIFormatDriveURL) WithBasePath(bp string) *DirectCSIFormatDriveURL {
|
||||
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 *DirectCSIFormatDriveURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *DirectCSIFormatDriveURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/direct-csi/drives/format"
|
||||
|
||||
_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 *DirectCSIFormatDriveURL) 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 *DirectCSIFormatDriveURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *DirectCSIFormatDriveURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on DirectCSIFormatDriveURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on DirectCSIFormatDriveURL")
|
||||
}
|
||||
|
||||
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 *DirectCSIFormatDriveURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// GetDirectCSIDriveListHandlerFunc turns a function with the right signature into a get direct c s i drive list handler
|
||||
type GetDirectCSIDriveListHandlerFunc func(GetDirectCSIDriveListParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDirectCSIDriveListHandlerFunc) Handle(params GetDirectCSIDriveListParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetDirectCSIDriveListHandler interface for that can handle valid get direct c s i drive list params
|
||||
type GetDirectCSIDriveListHandler interface {
|
||||
Handle(GetDirectCSIDriveListParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDirectCSIDriveList creates a new http.Handler for the get direct c s i drive list operation
|
||||
func NewGetDirectCSIDriveList(ctx *middleware.Context, handler GetDirectCSIDriveListHandler) *GetDirectCSIDriveList {
|
||||
return &GetDirectCSIDriveList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectCSIDriveList swagger:route GET /direct-csi/drives OperatorAPI getDirectCSIDriveList
|
||||
|
||||
Get direct-csi drives list
|
||||
|
||||
*/
|
||||
type GetDirectCSIDriveList struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDirectCSIDriveListHandler
|
||||
}
|
||||
|
||||
func (o *GetDirectCSIDriveList) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetDirectCSIDriveListParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetDirectCSIDriveListParams creates a new GetDirectCSIDriveListParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetDirectCSIDriveListParams() GetDirectCSIDriveListParams {
|
||||
|
||||
return GetDirectCSIDriveListParams{}
|
||||
}
|
||||
|
||||
// GetDirectCSIDriveListParams contains all the bound params for the get direct c s i drive list operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDirectCSIDriveList
|
||||
type GetDirectCSIDriveListParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Drives *string
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Nodes *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 NewGetDirectCSIDriveListParams() beforehand.
|
||||
func (o *GetDirectCSIDriveListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qDrives, qhkDrives, _ := qs.GetOK("drives")
|
||||
if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qNodes, qhkNodes, _ := qs.GetOK("nodes")
|
||||
if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindDrives binds and validates parameter Drives from query.
|
||||
func (o *GetDirectCSIDriveListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Drives = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindNodes binds and validates parameter Nodes from query.
|
||||
func (o *GetDirectCSIDriveListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Nodes = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// GetDirectCSIDriveListOKCode is the HTTP code returned for type GetDirectCSIDriveListOK
|
||||
const GetDirectCSIDriveListOKCode int = 200
|
||||
|
||||
/*GetDirectCSIDriveListOK A successful response.
|
||||
|
||||
swagger:response getDirectCSIDriveListOK
|
||||
*/
|
||||
type GetDirectCSIDriveListOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.GetDirectCSIDriveListResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectCSIDriveListOK creates GetDirectCSIDriveListOK with default headers values
|
||||
func NewGetDirectCSIDriveListOK() *GetDirectCSIDriveListOK {
|
||||
|
||||
return &GetDirectCSIDriveListOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct c s i drive list o k response
|
||||
func (o *GetDirectCSIDriveListOK) WithPayload(payload *models.GetDirectCSIDriveListResponse) *GetDirectCSIDriveListOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct c s i drive list o k response
|
||||
func (o *GetDirectCSIDriveListOK) SetPayload(payload *models.GetDirectCSIDriveListResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectCSIDriveListOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDirectCSIDriveListDefault Generic error response.
|
||||
|
||||
swagger:response getDirectCSIDriveListDefault
|
||||
*/
|
||||
type GetDirectCSIDriveListDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectCSIDriveListDefault creates GetDirectCSIDriveListDefault with default headers values
|
||||
func NewGetDirectCSIDriveListDefault(code int) *GetDirectCSIDriveListDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDirectCSIDriveListDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get direct c s i drive list default response
|
||||
func (o *GetDirectCSIDriveListDefault) WithStatusCode(code int) *GetDirectCSIDriveListDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get direct c s i drive list default response
|
||||
func (o *GetDirectCSIDriveListDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct c s i drive list default response
|
||||
func (o *GetDirectCSIDriveListDefault) WithPayload(payload *models.Error) *GetDirectCSIDriveListDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct c s i drive list default response
|
||||
func (o *GetDirectCSIDriveListDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectCSIDriveListDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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"
|
||||
)
|
||||
|
||||
// GetDirectCSIDriveListURL generates an URL for the get direct c s i drive list operation
|
||||
type GetDirectCSIDriveListURL struct {
|
||||
Drives *string
|
||||
Nodes *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 *GetDirectCSIDriveListURL) WithBasePath(bp string) *GetDirectCSIDriveListURL {
|
||||
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 *GetDirectCSIDriveListURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetDirectCSIDriveListURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/direct-csi/drives"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var drivesQ string
|
||||
if o.Drives != nil {
|
||||
drivesQ = *o.Drives
|
||||
}
|
||||
if drivesQ != "" {
|
||||
qs.Set("drives", drivesQ)
|
||||
}
|
||||
|
||||
var nodesQ string
|
||||
if o.Nodes != nil {
|
||||
nodesQ = *o.Nodes
|
||||
}
|
||||
if nodesQ != "" {
|
||||
qs.Set("nodes", nodesQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *GetDirectCSIDriveListURL) 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 *GetDirectCSIDriveListURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetDirectCSIDriveListURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetDirectCSIDriveListURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetDirectCSIDriveListURL")
|
||||
}
|
||||
|
||||
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 *GetDirectCSIDriveListURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// GetDirectCSIVolumeListHandlerFunc turns a function with the right signature into a get direct c s i volume list handler
|
||||
type GetDirectCSIVolumeListHandlerFunc func(GetDirectCSIVolumeListParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDirectCSIVolumeListHandlerFunc) Handle(params GetDirectCSIVolumeListParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetDirectCSIVolumeListHandler interface for that can handle valid get direct c s i volume list params
|
||||
type GetDirectCSIVolumeListHandler interface {
|
||||
Handle(GetDirectCSIVolumeListParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDirectCSIVolumeList creates a new http.Handler for the get direct c s i volume list operation
|
||||
func NewGetDirectCSIVolumeList(ctx *middleware.Context, handler GetDirectCSIVolumeListHandler) *GetDirectCSIVolumeList {
|
||||
return &GetDirectCSIVolumeList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectCSIVolumeList swagger:route GET /direct-csi/volumes OperatorAPI getDirectCSIVolumeList
|
||||
|
||||
Get direct-csi volumes list
|
||||
|
||||
*/
|
||||
type GetDirectCSIVolumeList struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDirectCSIVolumeListHandler
|
||||
}
|
||||
|
||||
func (o *GetDirectCSIVolumeList) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetDirectCSIVolumeListParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetDirectCSIVolumeListParams creates a new GetDirectCSIVolumeListParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetDirectCSIVolumeListParams() GetDirectCSIVolumeListParams {
|
||||
|
||||
return GetDirectCSIVolumeListParams{}
|
||||
}
|
||||
|
||||
// GetDirectCSIVolumeListParams contains all the bound params for the get direct c s i volume list operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDirectCSIVolumeList
|
||||
type GetDirectCSIVolumeListParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Drives *string
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Nodes *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 NewGetDirectCSIVolumeListParams() beforehand.
|
||||
func (o *GetDirectCSIVolumeListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qDrives, qhkDrives, _ := qs.GetOK("drives")
|
||||
if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qNodes, qhkNodes, _ := qs.GetOK("nodes")
|
||||
if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindDrives binds and validates parameter Drives from query.
|
||||
func (o *GetDirectCSIVolumeListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Drives = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindNodes binds and validates parameter Nodes from query.
|
||||
func (o *GetDirectCSIVolumeListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Nodes = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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/console/models"
|
||||
)
|
||||
|
||||
// GetDirectCSIVolumeListOKCode is the HTTP code returned for type GetDirectCSIVolumeListOK
|
||||
const GetDirectCSIVolumeListOKCode int = 200
|
||||
|
||||
/*GetDirectCSIVolumeListOK A successful response.
|
||||
|
||||
swagger:response getDirectCSIVolumeListOK
|
||||
*/
|
||||
type GetDirectCSIVolumeListOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.GetDirectCSIVolumeListResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectCSIVolumeListOK creates GetDirectCSIVolumeListOK with default headers values
|
||||
func NewGetDirectCSIVolumeListOK() *GetDirectCSIVolumeListOK {
|
||||
|
||||
return &GetDirectCSIVolumeListOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct c s i volume list o k response
|
||||
func (o *GetDirectCSIVolumeListOK) WithPayload(payload *models.GetDirectCSIVolumeListResponse) *GetDirectCSIVolumeListOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct c s i volume list o k response
|
||||
func (o *GetDirectCSIVolumeListOK) SetPayload(payload *models.GetDirectCSIVolumeListResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectCSIVolumeListOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDirectCSIVolumeListDefault Generic error response.
|
||||
|
||||
swagger:response getDirectCSIVolumeListDefault
|
||||
*/
|
||||
type GetDirectCSIVolumeListDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectCSIVolumeListDefault creates GetDirectCSIVolumeListDefault with default headers values
|
||||
func NewGetDirectCSIVolumeListDefault(code int) *GetDirectCSIVolumeListDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDirectCSIVolumeListDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get direct c s i volume list default response
|
||||
func (o *GetDirectCSIVolumeListDefault) WithStatusCode(code int) *GetDirectCSIVolumeListDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get direct c s i volume list default response
|
||||
func (o *GetDirectCSIVolumeListDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct c s i volume list default response
|
||||
func (o *GetDirectCSIVolumeListDefault) WithPayload(payload *models.Error) *GetDirectCSIVolumeListDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct c s i volume list default response
|
||||
func (o *GetDirectCSIVolumeListDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectCSIVolumeListDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operator_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"
|
||||
)
|
||||
|
||||
// GetDirectCSIVolumeListURL generates an URL for the get direct c s i volume list operation
|
||||
type GetDirectCSIVolumeListURL struct {
|
||||
Drives *string
|
||||
Nodes *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 *GetDirectCSIVolumeListURL) WithBasePath(bp string) *GetDirectCSIVolumeListURL {
|
||||
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 *GetDirectCSIVolumeListURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetDirectCSIVolumeListURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/direct-csi/volumes"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var drivesQ string
|
||||
if o.Drives != nil {
|
||||
drivesQ = *o.Drives
|
||||
}
|
||||
if drivesQ != "" {
|
||||
qs.Set("drives", drivesQ)
|
||||
}
|
||||
|
||||
var nodesQ string
|
||||
if o.Nodes != nil {
|
||||
nodesQ = *o.Nodes
|
||||
}
|
||||
if nodesQ != "" {
|
||||
qs.Set("nodes", nodesQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *GetDirectCSIVolumeListURL) 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 *GetDirectCSIVolumeListURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetDirectCSIVolumeListURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetDirectCSIVolumeListURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetDirectCSIVolumeListURL")
|
||||
}
|
||||
|
||||
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 *GetDirectCSIVolumeListURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,317 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
|
||||
"github.com/minio/console/cluster"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
directv1beta1apis "github.com/minio/direct-csi/pkg/apis/direct.csi.min.io/v1beta1"
|
||||
directv1beta1 "github.com/minio/direct-csi/pkg/clientset/typed/direct.csi.min.io/v1beta1"
|
||||
"github.com/minio/direct-csi/pkg/sys"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const XFS = "xfs"
|
||||
|
||||
func registerDirectCSIHandlers(api *operations.OperatorAPI) {
|
||||
api.OperatorAPIGetDirectCSIDriveListHandler = operator_api.GetDirectCSIDriveListHandlerFunc(func(params operator_api.GetDirectCSIDriveListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectCSIDrivesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectCSIDriveListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectCSIDriveListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIGetDirectCSIVolumeListHandler = operator_api.GetDirectCSIVolumeListHandlerFunc(func(params operator_api.GetDirectCSIVolumeListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectCSIVolumesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectCSIVolumeListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectCSIVolumeListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIDirectCSIFormatDriveHandler = operator_api.DirectCSIFormatDriveHandlerFunc(func(params operator_api.DirectCSIFormatDriveParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := formatVolumesResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewDirectCSIFormatDriveDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewDirectCSIFormatDriveOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
// getDirectCSIVolumesList returns direct-csi drives
|
||||
func getDirectCSIDriveList(ctx context.Context, clientset directv1beta1.DirectV1beta1Interface) (*models.GetDirectCSIDriveListResponse, error) {
|
||||
drivesList, err := clientset.DirectCSIDrives().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
volList, err := clientset.DirectCSIVolumes().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &models.GetDirectCSIDriveListResponse{}
|
||||
|
||||
// implementation same as direct-csi `drives ls` command
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "")
|
||||
}
|
||||
drivesSorted := drivesList.Items
|
||||
// sort by nodename, path and status
|
||||
sort.Slice(drivesSorted, func(i, j int) bool {
|
||||
d1 := drivesSorted[i]
|
||||
d2 := drivesSorted[j]
|
||||
|
||||
if v := strings.Compare(d1.Status.NodeName, d2.Status.NodeName); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
if v := strings.Compare(d1.Status.Path, d2.Status.Path); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
return strings.Compare(string(d1.Status.DriveStatus), string(d2.Status.DriveStatus)) < 0
|
||||
})
|
||||
for _, d := range drivesSorted {
|
||||
var volumes int64
|
||||
for _, v := range volList.Items {
|
||||
if v.Status.Drive == d.Name {
|
||||
volumes++
|
||||
}
|
||||
}
|
||||
msg := ""
|
||||
dr := func(val string) string {
|
||||
dr := driveName(val)
|
||||
for _, c := range d.Status.Conditions {
|
||||
if c.Type == string(directv1beta1apis.DirectCSIDriveConditionInitialized) {
|
||||
if c.Status != metav1.ConditionTrue {
|
||||
msg = c.Message
|
||||
continue
|
||||
}
|
||||
}
|
||||
if c.Type == string(directv1beta1apis.DirectCSIDriveConditionOwned) {
|
||||
if c.Status != metav1.ConditionTrue {
|
||||
msg = c.Message
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings.ReplaceAll("/dev/"+dr, sys.DirectCSIPartitionInfix, "")
|
||||
}(d.Status.Path)
|
||||
drStatus := d.Status.DriveStatus
|
||||
if msg != "" {
|
||||
drStatus = drStatus + "*"
|
||||
msg = strings.ReplaceAll(msg, d.Name, "")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIDevRoot, "/dev")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIPartitionInfix, "")
|
||||
msg = strings.Split(msg, "\n")[0]
|
||||
}
|
||||
|
||||
driveInfo := &models.DirectCSIDriveInfo{
|
||||
Drive: dr,
|
||||
Capacity: d.Status.TotalCapacity,
|
||||
Allocated: d.Status.AllocatedCapacity,
|
||||
Node: d.Status.NodeName,
|
||||
Status: string(drStatus),
|
||||
Message: msg,
|
||||
Volumes: volumes,
|
||||
}
|
||||
res.Drives = append(res.Drives, driveInfo)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectCSIDrivesListResponse(session *models.Principal) (*models.GetDirectCSIDriveListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
client, err := cluster.DirectCSIClient(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
|
||||
drives, err := getDirectCSIDriveList(ctx, client.DirectV1beta1())
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return drives, nil
|
||||
}
|
||||
|
||||
// getDirectCSIVolumesList returns direct-csi volumes
|
||||
func getDirectCSIVolumesList(ctx context.Context, clientset directv1beta1.DirectV1beta1Interface) (*models.GetDirectCSIVolumeListResponse, error) {
|
||||
drivesList, err := clientset.DirectCSIDrives().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
volList, err := clientset.DirectCSIVolumes().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// implementation same as direct-csi `volumes ls` command
|
||||
drivePaths := map[string]string{}
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
}
|
||||
|
||||
for _, d := range drivesList.Items {
|
||||
drivePaths[d.Name] = driveName(d.Status.Path)
|
||||
}
|
||||
var volumes []*models.DirectCSIVolumeInfo
|
||||
for _, v := range volList.Items {
|
||||
vol := &models.DirectCSIVolumeInfo{
|
||||
Volume: v.Name,
|
||||
Capacity: v.Status.TotalCapacity,
|
||||
Drive: driveName(drivePaths[v.Status.Drive]),
|
||||
Node: v.Status.NodeName,
|
||||
}
|
||||
|
||||
volumes = append(volumes, vol)
|
||||
}
|
||||
|
||||
res := &models.GetDirectCSIVolumeListResponse{
|
||||
Volumes: volumes,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectCSIVolumesListResponse(session *models.Principal) (*models.GetDirectCSIVolumeListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
client, err := cluster.DirectCSIClient(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
|
||||
volumes, err := getDirectCSIVolumesList(ctx, client.DirectV1beta1())
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
return volumes, nil
|
||||
}
|
||||
|
||||
func formatDrives(ctx context.Context, clientset directv1beta1.DirectV1beta1Interface, drives []string, force bool) (*models.FormatDirectCSIDrivesResponse, error) {
|
||||
if len(drives) == 0 {
|
||||
return nil, errors.New("at least one drive needs to be set")
|
||||
}
|
||||
|
||||
driveList, err := clientset.DirectCSIDrives().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, "-part-", "")
|
||||
}
|
||||
|
||||
drivesArray := map[string]string{}
|
||||
|
||||
for _, driveFromAPI := range drives {
|
||||
drivesArray[driveFromAPI] = driveFromAPI
|
||||
}
|
||||
|
||||
if len(driveList.Items) == 0 {
|
||||
return nil, errors.New("no resources found globally")
|
||||
}
|
||||
|
||||
var errors []*models.CsiFormatErrorResponse
|
||||
|
||||
for _, driveItem := range driveList.Items {
|
||||
drName := "/dev/" + driveName(driveItem.Status.Path)
|
||||
driveName := driveItem.Status.NodeName + ":" + drName
|
||||
|
||||
base := &models.CsiFormatErrorResponse{
|
||||
Node: driveItem.Status.NodeName,
|
||||
Drive: drName,
|
||||
Error: "",
|
||||
}
|
||||
|
||||
// Element is requested to be formatted
|
||||
if _, ok := drivesArray[driveName]; ok {
|
||||
if driveItem.Status.DriveStatus == directv1beta1apis.DriveStatusUnavailable {
|
||||
base.Error = "Status is unavailable"
|
||||
errors = append(errors, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directv1beta1apis.DriveStatusInUse {
|
||||
base.Error = "Drive in use. Cannot be formatted"
|
||||
errors = append(errors, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if !force {
|
||||
if driveItem.Status.DriveStatus == directv1beta1apis.DriveStatusReady {
|
||||
base.Error = "Drive already owned and managed. Use force to overwrite"
|
||||
errors = append(errors, base)
|
||||
continue
|
||||
}
|
||||
if driveItem.Status.Filesystem != "" && !force {
|
||||
base.Error = "Drive already has a fs. Use force to overwrite"
|
||||
errors = append(errors, base)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Validation passes, we request format
|
||||
driveItem.Spec.DirectCSIOwned = true
|
||||
driveItem.Spec.RequestedFormat = &directv1beta1apis.RequestedFormat{
|
||||
Filesystem: XFS,
|
||||
Force: force,
|
||||
}
|
||||
|
||||
_, err := clientset.DirectCSIDrives().Update(ctx, &driveItem, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
base.Error = err.Error()
|
||||
errors = append(errors, base)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnErrors := &models.FormatDirectCSIDrivesResponse{
|
||||
FormatIssuesList: errors,
|
||||
}
|
||||
|
||||
return returnErrors, nil
|
||||
}
|
||||
|
||||
func formatVolumesResponse(session *models.Principal, params operator_api.DirectCSIFormatDriveParams) (*models.FormatDirectCSIDrivesResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
client, err := cluster.DirectCSIClient(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, prepareError(err)
|
||||
}
|
||||
|
||||
formatResult, errFormat := formatDrives(ctx, client.DirectV1beta1(), params.Body.Drives, *params.Body.Force)
|
||||
if errFormat != nil {
|
||||
return nil, prepareError(errFormat)
|
||||
}
|
||||
return formatResult, nil
|
||||
}
|
||||
Reference in New Issue
Block a user