Remove Operator UI Storage Page (#1639)

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
Daniel Valdivia
2022-02-28 22:58:20 -08:00
committed by GitHub
parent 69a3ee6c1a
commit 208afdfc3a
25 changed files with 507 additions and 2473 deletions

View File

@@ -17,7 +17,6 @@
package cluster
import (
direct "github.com/minio/direct-csi/pkg/clientset"
operator "github.com/minio/operator/pkg/client/clientset/versioned"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
@@ -64,8 +63,3 @@ func OperatorClient(token string) (*operator.Clientset, error) {
func K8sClient(token string) (*kubernetes.Clientset, error) {
return kubernetes.NewForConfig(GetK8sConfig(token))
}
// DirectCSIClient returns Direct CSI client using GetK8sConfig for its config
func DirectCSIClient(token string) (*direct.Clientset, error) {
return direct.NewForConfig(GetK8sConfig(token))
}

4
go.mod
View File

@@ -18,7 +18,6 @@ require (
github.com/jessevdk/go-flags v1.4.0
github.com/klauspost/compress v1.13.6
github.com/minio/cli v1.22.0
github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf
github.com/minio/kes v0.11.0
github.com/minio/madmin-go v1.3.4
github.com/minio/mc v0.0.0-20220204044644-e048c85d71a7
@@ -58,7 +57,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
@@ -71,7 +69,6 @@ require (
github.com/goccy/go-json v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.1.0 // indirect
@@ -99,7 +96,6 @@ require (
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect
github.com/minio/argon2 v1.0.0 // indirect
github.com/minio/colorjson v1.0.1 // indirect
github.com/minio/filepath v1.0.0 // indirect

634
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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": [

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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
}

View File

@@ -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
}
}
}

View File

@@ -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()
}

View File

@@ -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)
}

View File

@@ -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
}

View File

@@ -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
}
}
}

View File

@@ -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()
}

View File

@@ -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)
}

View File

@@ -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
}

View File

@@ -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
}
}
}

View File

@@ -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()
}

View File

@@ -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
}

View File

@@ -163,9 +163,6 @@ export const IAM_PAGES = {
/* Operator */
TENANTS: "/tenants",
TENANTS_ADD: "/tenants/add",
STORAGE: "/storage",
STORAGE_VOLUMES: "/storage/volumes",
STORAGE_DRIVES: "/storage/drives",
NAMESPACE_TENANT: "/namespaces/:tenantNamespace/tenants/:tenantName",
NAMESPACE_TENANT_HOP: "/namespaces/:tenantNamespace/tenants/:tenantName/hop",
NAMESPACE_TENANT_PODS:

View File

@@ -55,7 +55,6 @@ const Trace = React.lazy(() => import("./Trace/Trace"));
const Heal = React.lazy(() => import("./Heal/Heal"));
const Watch = React.lazy(() => import("./Watch/Watch"));
const HealthInfo = React.lazy(() => import("./HealthInfo/HealthInfo"));
const Storage = React.lazy(() => import("./Storage/Storage"));
const Hop = React.lazy(() => import("./Tenants/TenantDetails/hop/Hop"));
const AddTenant = React.lazy(() => import("./Tenants/AddTenant/AddTenant"));
@@ -387,21 +386,6 @@ const Console = ({
path: IAM_PAGES.TENANTS_ADD,
forceDisplay: true,
},
{
component: Storage,
path: IAM_PAGES.STORAGE,
forceDisplay: true,
},
{
component: Storage,
path: IAM_PAGES.STORAGE_VOLUMES,
forceDisplay: true,
},
{
component: Storage,
path: IAM_PAGES.STORAGE_DRIVES,
forceDisplay: true,
},
{
component: TenantDetails,
path: IAM_PAGES.NAMESPACE_TENANT,

View File

@@ -1,111 +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/>.
import React, { Fragment, useEffect, useState } from "react";
import { Theme } from "@mui/material/styles";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { Link, Redirect, Route, Router, Switch } from "react-router-dom";
import {
actionsTray,
containerForHeader,
pageContentStyles,
searchField,
} from "../Common/FormComponents/common/styleLibrary";
import history from "../../../history";
import PageHeader from "../Common/PageHeader/PageHeader";
import PageLayout from "../Common/Layout/PageLayout";
import VerticalTabs from "../Common/VerticalTabs/VerticalTabs";
import withSuspense from "../Common/Components/withSuspense";
const StoragePVCs = withSuspense(React.lazy(() => import("./StoragePVCs")));
const DirectCSIDrives = withSuspense(
React.lazy(() => import("../DirectCSI/DirectCSIDrives"))
);
interface IStorageProps {
classes: any;
match: any;
}
const styles = (theme: Theme) =>
createStyles({
pageContainer: {
border: "1px solid #EAEAEA",
height: "100%",
},
...pageContentStyles,
...actionsTray,
...searchField,
...containerForHeader(theme.spacing(4)),
});
const routes = ["/storage/volumes", "/storage/drives"];
const Storage = ({ classes, match }: IStorageProps) => {
let selTab = match?.path;
selTab = selTab ? selTab : routes[0];
const [activeTab, setActiveTab] = useState(selTab);
useEffect(() => {
setActiveTab(selTab);
}, [selTab]);
return (
<Fragment>
<PageHeader label={"Storage"} />
<PageLayout className={classes.pageContainer}>
<VerticalTabs
selectedTab={activeTab}
isRouteTabs
routes={
<div className={classes.contentSpacer}>
<Router history={history}>
<Switch>
<Route exact path={routes[0]} component={StoragePVCs} />
<Route exact path={routes[1]} component={DirectCSIDrives} />
<Route render={() => <Redirect to={routes[0]} />} />
</Switch>
</Router>
</div>
}
>
{{
tabConfig: {
label: "Volumes",
value: routes[0],
component: Link,
to: routes[0],
},
}}
{{
tabConfig: {
label: "Drives",
value: routes[1],
component: Link,
to: routes[1],
},
}}
</VerticalTabs>
</PageLayout>
</Fragment>
);
};
export default withStyles(styles)(Storage);

View File

@@ -1,194 +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/>.
import React, { Fragment, useEffect, useState } from "react";
import get from "lodash/get";
import { connect } from "react-redux";
import { Theme } from "@mui/material/styles";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import { Grid, InputAdornment, TextField } from "@mui/material";
import history from "../../../history";
import {
actionsTray,
containerForHeader,
searchField,
} from "../Common/FormComponents/common/styleLibrary";
import { IPVCsResponse, IStoragePVCs } from "./types";
import { setErrorSnackMessage } from "../../../actions";
import { ErrorResponseHandler } from "../../../common/types";
import api from "../../../common/api";
import TableWrapper from "../Common/TableWrapper/TableWrapper";
import SearchIcon from "../../../icons/SearchIcon";
import DeletePVC from "../Tenants/TenantDetails/DeletePVC";
interface IStorageVolumesProps {
classes: any;
setErrorSnackMessage: typeof setErrorSnackMessage;
}
const styles = (theme: Theme) =>
createStyles({
tableWrapper: {
height: "calc(100vh - 267px)",
},
...actionsTray,
...searchField,
...containerForHeader(theme.spacing(4)),
});
const StorageVolumes = ({
classes,
setErrorSnackMessage,
}: IStorageVolumesProps) => {
const [records, setRecords] = useState<IStoragePVCs[]>([]);
const [filter, setFilter] = useState("");
const [loading, setLoading] = useState<boolean>(true);
const [selectedPVC, setSelectedPVC] = useState<any>(null);
const [deleteOpen, setDeleteOpen] = useState<boolean>(false);
useEffect(() => {
if (loading) {
api
.invoke("GET", `/api/v1/list-pvcs`)
.then((res: IPVCsResponse) => {
let volumes = get(res, "pvcs", []);
setRecords(volumes ? volumes : []);
setLoading(false);
})
.catch((err: ErrorResponseHandler) => {
setLoading(false);
setErrorSnackMessage(err);
});
}
}, [loading, setErrorSnackMessage]);
const filteredRecords: IStoragePVCs[] = records.filter((elementItem) =>
elementItem.name.toLowerCase().includes(filter.toLowerCase())
);
const confirmDeletePVC = (pvcItem: IStoragePVCs) => {
const delPvc = {
...pvcItem,
tenant: pvcItem.tenant,
namespace: pvcItem.namespace,
};
setSelectedPVC(delPvc);
setDeleteOpen(true);
};
const tableActions = [
{
type: "view",
onClick: (record: any) => {
history.push(
`/namespaces/${record.namespace}/tenants/${record.tenant}`
);
},
},
{ type: "delete", onClick: confirmDeletePVC },
];
const closeDeleteModalAndRefresh = (reloadData: boolean) => {
setDeleteOpen(false);
setLoading(true);
};
return (
<Fragment>
{deleteOpen && (
<DeletePVC
deleteOpen={deleteOpen}
selectedPVC={selectedPVC}
closeDeleteModalAndRefresh={closeDeleteModalAndRefresh}
/>
)}
<h1 className={classes.sectionTitle}>Persistent Volumes Claims</h1>
<Grid item xs={12} className={classes.actionsTray}>
<TextField
placeholder="Search Volumes (PVCs)"
className={classes.searchField}
id="search-resource"
label=""
InputProps={{
disableUnderline: true,
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
onChange={(e) => {
setFilter(e.target.value);
}}
variant="standard"
/>
</Grid>
<Grid item xs={12}>
<br />
</Grid>
<Grid item xs={12}>
<TableWrapper
itemActions={tableActions}
columns={[
{
label: "Name",
elementKey: "name",
},
{
label: "Namespace",
elementKey: "namespace",
width: 90,
},
{
label: "Status",
elementKey: "status",
width: 120,
},
{
label: "Tenant",
renderFullObject: true,
renderFunction: (record: any) =>
`${record.namespace}/${record.tenant}`,
},
{
label: "Capacity",
elementKey: "capacity",
width: 90,
},
{
label: "Storage Class",
elementKey: "storageClass",
},
]}
isLoading={loading}
records={filteredRecords}
entityName="PVCs"
idField="name"
customPaperHeight={classes.tableWrapper}
/>
</Grid>
</Fragment>
);
};
const mapDispatchToProps = {
setErrorSnackMessage,
};
const connector = connect(null, mapDispatchToProps);
export default withStyles(styles)(connector(StorageVolumes));

View File

@@ -48,7 +48,6 @@ import {
DocumentationIcon,
LambdaIcon,
LicenseIcon,
StorageIcon,
TenantsOutlineIcon,
TiersIcon,
} from "../../icons";
@@ -284,15 +283,6 @@ export const validRoutes = (
icon: TenantsOutlineIcon,
forceDisplay: true,
},
{
group: "Operator",
type: "item",
component: NavLink,
to: IAM_PAGES.STORAGE,
name: "Storage",
icon: StorageIcon,
forceDisplay: true,
},
{
group: "Operator",
type: "item",

View File

@@ -1020,78 +1020,6 @@ paths:
tags:
- OperatorAPI
/direct-csi/drives:
get:
summary: Get direct-csi drives list
operationId: GetDirectCSIDriveList
parameters:
- name: nodes
in: query
required: false
type: string
- name: drives
in: query
required: false
type: string
responses:
200:
description: A successful response.
schema:
$ref: "#/definitions/getDirectCSIDriveListResponse"
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
/direct-csi/volumes:
get:
summary: Get direct-csi volumes list
operationId: GetDirectCSIVolumeList
parameters:
- name: nodes
in: query
required: false
type: string
- name: drives
in: query
required: false
type: string
responses:
200:
description: A successful response.
schema:
$ref: "#/definitions/getDirectCSIVolumeListResponse"
default:
description: Generic error response.
schema:
$ref: "#/definitions/error"
tags:
- OperatorAPI
/direct-csi/drives/format:
post:
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"
tags:
- OperatorAPI
/list-pvcs:
get:
summary: List all PVCs from namespaces that the user has access to