Add missing KMS handlers for version, apis and metrics (#2376)

This commit is contained in:
Javier Adriel
2022-10-12 14:00:48 -05:00
committed by GitHub
parent d2d735c5c0
commit 9587e4105f
25 changed files with 2592 additions and 38 deletions

View File

@@ -265,6 +265,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
InspectInspectHandler: inspect.InspectHandlerFunc(func(params inspect.InspectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation inspect.Inspect has not yet been implemented")
}),
KmsKMSAPIsHandler: k_m_s.KMSAPIsHandlerFunc(func(params k_m_s.KMSAPIsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSAPIs has not yet been implemented")
}),
KmsKMSAssignPolicyHandler: k_m_s.KMSAssignPolicyHandlerFunc(func(params k_m_s.KMSAssignPolicyParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSAssignPolicy has not yet been implemented")
}),
@@ -307,12 +310,18 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
KmsKMSListPoliciesHandler: k_m_s.KMSListPoliciesHandlerFunc(func(params k_m_s.KMSListPoliciesParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSListPolicies has not yet been implemented")
}),
KmsKMSMetricsHandler: k_m_s.KMSMetricsHandlerFunc(func(params k_m_s.KMSMetricsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSMetrics has not yet been implemented")
}),
KmsKMSSetPolicyHandler: k_m_s.KMSSetPolicyHandlerFunc(func(params k_m_s.KMSSetPolicyParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSSetPolicy has not yet been implemented")
}),
KmsKMSStatusHandler: k_m_s.KMSStatusHandlerFunc(func(params k_m_s.KMSStatusParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSStatus has not yet been implemented")
}),
KmsKMSVersionHandler: k_m_s.KMSVersionHandlerFunc(func(params k_m_s.KMSVersionParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation k_m_s.KMSVersion has not yet been implemented")
}),
UserListAUserServiceAccountsHandler: user.ListAUserServiceAccountsHandlerFunc(func(params user.ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation user.ListAUserServiceAccounts has not yet been implemented")
}),
@@ -686,6 +695,8 @@ type ConsoleAPI struct {
GroupGroupInfoHandler group.GroupInfoHandler
// InspectInspectHandler sets the operation handler for the inspect operation
InspectInspectHandler inspect.InspectHandler
// KmsKMSAPIsHandler sets the operation handler for the k m s a p is operation
KmsKMSAPIsHandler k_m_s.KMSAPIsHandler
// KmsKMSAssignPolicyHandler sets the operation handler for the k m s assign policy operation
KmsKMSAssignPolicyHandler k_m_s.KMSAssignPolicyHandler
// KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation
@@ -714,10 +725,14 @@ type ConsoleAPI struct {
KmsKMSListKeysHandler k_m_s.KMSListKeysHandler
// KmsKMSListPoliciesHandler sets the operation handler for the k m s list policies operation
KmsKMSListPoliciesHandler k_m_s.KMSListPoliciesHandler
// KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation
KmsKMSMetricsHandler k_m_s.KMSMetricsHandler
// KmsKMSSetPolicyHandler sets the operation handler for the k m s set policy operation
KmsKMSSetPolicyHandler k_m_s.KMSSetPolicyHandler
// KmsKMSStatusHandler sets the operation handler for the k m s status operation
KmsKMSStatusHandler k_m_s.KMSStatusHandler
// KmsKMSVersionHandler sets the operation handler for the k m s version operation
KmsKMSVersionHandler k_m_s.KMSVersionHandler
// UserListAUserServiceAccountsHandler sets the operation handler for the list a user service accounts operation
UserListAUserServiceAccountsHandler user.ListAUserServiceAccountsHandler
// BucketListAccessRulesWithBucketHandler sets the operation handler for the list access rules with bucket operation
@@ -1118,6 +1133,9 @@ func (o *ConsoleAPI) Validate() error {
if o.InspectInspectHandler == nil {
unregistered = append(unregistered, "inspect.InspectHandler")
}
if o.KmsKMSAPIsHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSAPIsHandler")
}
if o.KmsKMSAssignPolicyHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSAssignPolicyHandler")
}
@@ -1160,12 +1178,18 @@ func (o *ConsoleAPI) Validate() error {
if o.KmsKMSListPoliciesHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSListPoliciesHandler")
}
if o.KmsKMSMetricsHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSMetricsHandler")
}
if o.KmsKMSSetPolicyHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSSetPolicyHandler")
}
if o.KmsKMSStatusHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSStatusHandler")
}
if o.KmsKMSVersionHandler == nil {
unregistered = append(unregistered, "k_m_s.KMSVersionHandler")
}
if o.UserListAUserServiceAccountsHandler == nil {
unregistered = append(unregistered, "user.ListAUserServiceAccountsHandler")
}
@@ -1705,6 +1729,10 @@ func (o *ConsoleAPI) initHandlerCache() {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/admin/inspect"] = inspect.NewInspect(o.context, o.InspectInspectHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kms/apis"] = k_m_s.NewKMSAPIs(o.context, o.KmsKMSAPIsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
@@ -1761,6 +1789,10 @@ func (o *ConsoleAPI) initHandlerCache() {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kms/policies"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kms/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
@@ -1772,6 +1804,10 @@ func (o *ConsoleAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kms/version"] = k_m_s.NewKMSVersion(o.context, o.KmsKMSVersionHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/user/{name}/service-accounts"] = user.NewListAUserServiceAccounts(o.context, o.UserListAUserServiceAccountsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSAPIsHandlerFunc turns a function with the right signature into a k m s a p is handler
type KMSAPIsHandlerFunc func(KMSAPIsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn KMSAPIsHandlerFunc) Handle(params KMSAPIsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// KMSAPIsHandler interface for that can handle valid k m s a p is params
type KMSAPIsHandler interface {
Handle(KMSAPIsParams, *models.Principal) middleware.Responder
}
// NewKMSAPIs creates a new http.Handler for the k m s a p is operation
func NewKMSAPIs(ctx *middleware.Context, handler KMSAPIsHandler) *KMSAPIs {
return &KMSAPIs{Context: ctx, Handler: handler}
}
/*
KMSAPIs swagger:route GET /kms/apis KMS kMSAPIs
KMS apis
*/
type KMSAPIs struct {
Context *middleware.Context
Handler KMSAPIsHandler
}
func (o *KMSAPIs) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewKMSAPIsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,63 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewKMSAPIsParams creates a new KMSAPIsParams object
//
// There are no default values defined in the spec.
func NewKMSAPIsParams() KMSAPIsParams {
return KMSAPIsParams{}
}
// KMSAPIsParams contains all the bound params for the k m s a p is operation
// typically these are obtained from a http.Request
//
// swagger:parameters KMSAPIs
type KMSAPIsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewKMSAPIsParams() beforehand.
func (o *KMSAPIsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSAPIsOKCode is the HTTP code returned for type KMSAPIsOK
const KMSAPIsOKCode int = 200
/*
KMSAPIsOK A successful response.
swagger:response kMSAPIsOK
*/
type KMSAPIsOK struct {
/*
In: Body
*/
Payload *models.KmsAPIsResponse `json:"body,omitempty"`
}
// NewKMSAPIsOK creates KMSAPIsOK with default headers values
func NewKMSAPIsOK() *KMSAPIsOK {
return &KMSAPIsOK{}
}
// WithPayload adds the payload to the k m s a p is o k response
func (o *KMSAPIsOK) WithPayload(payload *models.KmsAPIsResponse) *KMSAPIsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s a p is o k response
func (o *KMSAPIsOK) SetPayload(payload *models.KmsAPIsResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSAPIsOK) 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
}
}
}
/*
KMSAPIsDefault Generic error response.
swagger:response kMSAPIsDefault
*/
type KMSAPIsDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewKMSAPIsDefault creates KMSAPIsDefault with default headers values
func NewKMSAPIsDefault(code int) *KMSAPIsDefault {
if code <= 0 {
code = 500
}
return &KMSAPIsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the k m s a p is default response
func (o *KMSAPIsDefault) WithStatusCode(code int) *KMSAPIsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the k m s a p is default response
func (o *KMSAPIsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the k m s a p is default response
func (o *KMSAPIsDefault) WithPayload(payload *models.Error) *KMSAPIsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s a p is default response
func (o *KMSAPIsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSAPIsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSAPIsURL generates an URL for the k m s a p is operation
type KMSAPIsURL 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 *KMSAPIsURL) WithBasePath(bp string) *KMSAPIsURL {
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 *KMSAPIsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *KMSAPIsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/kms/apis"
_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 *KMSAPIsURL) 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 *KMSAPIsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *KMSAPIsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on KMSAPIsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on KMSAPIsURL")
}
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 *KMSAPIsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSMetricsHandlerFunc turns a function with the right signature into a k m s metrics handler
type KMSMetricsHandlerFunc func(KMSMetricsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn KMSMetricsHandlerFunc) Handle(params KMSMetricsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// KMSMetricsHandler interface for that can handle valid k m s metrics params
type KMSMetricsHandler interface {
Handle(KMSMetricsParams, *models.Principal) middleware.Responder
}
// NewKMSMetrics creates a new http.Handler for the k m s metrics operation
func NewKMSMetrics(ctx *middleware.Context, handler KMSMetricsHandler) *KMSMetrics {
return &KMSMetrics{Context: ctx, Handler: handler}
}
/*
KMSMetrics swagger:route GET /kms/metrics KMS kMSMetrics
KMS metrics
*/
type KMSMetrics struct {
Context *middleware.Context
Handler KMSMetricsHandler
}
func (o *KMSMetrics) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewKMSMetricsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,63 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewKMSMetricsParams creates a new KMSMetricsParams object
//
// There are no default values defined in the spec.
func NewKMSMetricsParams() KMSMetricsParams {
return KMSMetricsParams{}
}
// KMSMetricsParams contains all the bound params for the k m s metrics operation
// typically these are obtained from a http.Request
//
// swagger:parameters KMSMetrics
type KMSMetricsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewKMSMetricsParams() beforehand.
func (o *KMSMetricsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSMetricsOKCode is the HTTP code returned for type KMSMetricsOK
const KMSMetricsOKCode int = 200
/*
KMSMetricsOK A successful response.
swagger:response kMSMetricsOK
*/
type KMSMetricsOK struct {
/*
In: Body
*/
Payload *models.KmsMetricsResponse `json:"body,omitempty"`
}
// NewKMSMetricsOK creates KMSMetricsOK with default headers values
func NewKMSMetricsOK() *KMSMetricsOK {
return &KMSMetricsOK{}
}
// WithPayload adds the payload to the k m s metrics o k response
func (o *KMSMetricsOK) WithPayload(payload *models.KmsMetricsResponse) *KMSMetricsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s metrics o k response
func (o *KMSMetricsOK) SetPayload(payload *models.KmsMetricsResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSMetricsOK) 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
}
}
}
/*
KMSMetricsDefault Generic error response.
swagger:response kMSMetricsDefault
*/
type KMSMetricsDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewKMSMetricsDefault creates KMSMetricsDefault with default headers values
func NewKMSMetricsDefault(code int) *KMSMetricsDefault {
if code <= 0 {
code = 500
}
return &KMSMetricsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the k m s metrics default response
func (o *KMSMetricsDefault) WithStatusCode(code int) *KMSMetricsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the k m s metrics default response
func (o *KMSMetricsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the k m s metrics default response
func (o *KMSMetricsDefault) WithPayload(payload *models.Error) *KMSMetricsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s metrics default response
func (o *KMSMetricsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSMetricsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSMetricsURL generates an URL for the k m s metrics operation
type KMSMetricsURL 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 *KMSMetricsURL) WithBasePath(bp string) *KMSMetricsURL {
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 *KMSMetricsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *KMSMetricsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/kms/metrics"
_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 *KMSMetricsURL) 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 *KMSMetricsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *KMSMetricsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on KMSMetricsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on KMSMetricsURL")
}
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 *KMSMetricsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSVersionHandlerFunc turns a function with the right signature into a k m s version handler
type KMSVersionHandlerFunc func(KMSVersionParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn KMSVersionHandlerFunc) Handle(params KMSVersionParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// KMSVersionHandler interface for that can handle valid k m s version params
type KMSVersionHandler interface {
Handle(KMSVersionParams, *models.Principal) middleware.Responder
}
// NewKMSVersion creates a new http.Handler for the k m s version operation
func NewKMSVersion(ctx *middleware.Context, handler KMSVersionHandler) *KMSVersion {
return &KMSVersion{Context: ctx, Handler: handler}
}
/*
KMSVersion swagger:route GET /kms/version KMS kMSVersion
KMS version
*/
type KMSVersion struct {
Context *middleware.Context
Handler KMSVersionHandler
}
func (o *KMSVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewKMSVersionParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,63 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
)
// NewKMSVersionParams creates a new KMSVersionParams object
//
// There are no default values defined in the spec.
func NewKMSVersionParams() KMSVersionParams {
return KMSVersionParams{}
}
// KMSVersionParams contains all the bound params for the k m s version operation
// typically these are obtained from a http.Request
//
// swagger:parameters KMSVersion
type KMSVersionParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewKMSVersionParams() beforehand.
func (o *KMSVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,135 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSVersionOKCode is the HTTP code returned for type KMSVersionOK
const KMSVersionOKCode int = 200
/*
KMSVersionOK A successful response.
swagger:response kMSVersionOK
*/
type KMSVersionOK struct {
/*
In: Body
*/
Payload *models.KmsVersionResponse `json:"body,omitempty"`
}
// NewKMSVersionOK creates KMSVersionOK with default headers values
func NewKMSVersionOK() *KMSVersionOK {
return &KMSVersionOK{}
}
// WithPayload adds the payload to the k m s version o k response
func (o *KMSVersionOK) WithPayload(payload *models.KmsVersionResponse) *KMSVersionOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s version o k response
func (o *KMSVersionOK) SetPayload(payload *models.KmsVersionResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSVersionOK) 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
}
}
}
/*
KMSVersionDefault Generic error response.
swagger:response kMSVersionDefault
*/
type KMSVersionDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewKMSVersionDefault creates KMSVersionDefault with default headers values
func NewKMSVersionDefault(code int) *KMSVersionDefault {
if code <= 0 {
code = 500
}
return &KMSVersionDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the k m s version default response
func (o *KMSVersionDefault) WithStatusCode(code int) *KMSVersionDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the k m s version default response
func (o *KMSVersionDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the k m s version default response
func (o *KMSVersionDefault) WithPayload(payload *models.Error) *KMSVersionDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the k m s version default response
func (o *KMSVersionDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *KMSVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,104 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 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 k_m_s
// 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"
)
// KMSVersionURL generates an URL for the k m s version operation
type KMSVersionURL 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 *KMSVersionURL) WithBasePath(bp string) *KMSVersionURL {
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 *KMSVersionURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *KMSVersionURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/kms/version"
_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 *KMSVersionURL) 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 *KMSVersionURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *KMSVersionURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on KMSVersionURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on KMSVersionURL")
}
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 *KMSVersionURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}