From 6ef35c26a459d401463090662b07b552a8179e30 Mon Sep 17 00:00:00 2001
From: Cesar N <11819101+cesnietor@users.noreply.github.com>
Date: Wed, 13 Sep 2023 12:55:06 -0700
Subject: [PATCH] Remove unused check-version api (#3045)
---
integration/version_test.go | 73 ----------
models/check_version_response.go | 70 ---------
pkg/utils/version.go | 51 -------
portal-ui/src/api/consoleApi.ts | 22 ---
portal-ui/src/screens/LoginPage/Login.tsx | 11 +-
portal-ui/src/screens/LoginPage/loginSlice.ts | 22 +--
.../src/screens/LoginPage/loginThunks.ts | 18 ---
restapi/configure_console.go | 2 -
restapi/embedded_spec.go | 70 ---------
restapi/operations/console_api.go | 12 --
.../system/check_min_i_o_version.go | 73 ----------
.../check_min_i_o_version_parameters.go | 63 --------
.../system/check_min_i_o_version_responses.go | 135 ------------------
.../check_min_i_o_version_urlbuilder.go | 104 --------------
restapi/user_version.go | 59 --------
swagger.yml | 61 +++-----
16 files changed, 21 insertions(+), 825 deletions(-)
delete mode 100644 integration/version_test.go
delete mode 100644 models/check_version_response.go
delete mode 100644 pkg/utils/version.go
delete mode 100644 restapi/operations/system/check_min_i_o_version.go
delete mode 100644 restapi/operations/system/check_min_i_o_version_parameters.go
delete mode 100644 restapi/operations/system/check_min_i_o_version_responses.go
delete mode 100644 restapi/operations/system/check_min_i_o_version_urlbuilder.go
delete mode 100644 restapi/user_version.go
diff --git a/integration/version_test.go b/integration/version_test.go
deleted file mode 100644
index cb3737fa8..000000000
--- a/integration/version_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// 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 .
-
-package integration
-
-import (
- "fmt"
- "log"
- "net/http"
- "testing"
- "time"
-
- "github.com/stretchr/testify/assert"
-)
-
-func Test_VersionAPI(t *testing.T) {
- assert := assert.New(t)
-
- type args struct {
- api string
- }
- tests := []struct {
- name string
- args args
- expectedStatus int
- expectedError error
- }{
- {
- name: "Check Version",
- args: args{
- api: "/check-version",
- },
- expectedStatus: 200,
- expectedError: nil,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- client := &http.Client{
- Timeout: 3 * time.Second,
- }
- request, err := http.NewRequest(
- "GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
- if err != nil {
- log.Println(err)
- return
- }
- request.Header.Add("Content-Type", "application/json")
- response, err := client.Do(request)
- if err != nil {
- log.Println(err)
- return
- }
- if response != nil {
- assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
- }
- })
- }
-}
diff --git a/models/check_version_response.go b/models/check_version_response.go
deleted file mode 100644
index b21646a99..000000000
--- a/models/check_version_response.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2023 MinIO, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-//
-
-package models
-
-// This file was generated by the swagger tool.
-// Editing this file might prove futile when you re-run the swagger generate command
-
-import (
- "context"
-
- "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
-)
-
-// CheckVersionResponse check version response
-//
-// swagger:model checkVersionResponse
-type CheckVersionResponse struct {
-
- // current version
- CurrentVersion string `json:"current_version,omitempty"`
-
- // latest version
- LatestVersion string `json:"latest_version,omitempty"`
-}
-
-// Validate validates this check version response
-func (m *CheckVersionResponse) Validate(formats strfmt.Registry) error {
- return nil
-}
-
-// ContextValidate validates this check version response based on context it is used
-func (m *CheckVersionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
- return nil
-}
-
-// MarshalBinary interface implementation
-func (m *CheckVersionResponse) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
-}
-
-// UnmarshalBinary interface implementation
-func (m *CheckVersionResponse) UnmarshalBinary(b []byte) error {
- var res CheckVersionResponse
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
-}
diff --git a/pkg/utils/version.go b/pkg/utils/version.go
deleted file mode 100644
index 9ad77805d..000000000
--- a/pkg/utils/version.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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 .
-
-package utils
-
-import (
- "errors"
- "fmt"
- "io"
- "regexp"
-
- "github.com/minio/console/pkg/http"
-)
-
-var ErrCantDetermineMinIOImage = errors.New("can't determine MinIO Image")
-
-// getLatestMinIOImage returns the latest docker image for MinIO if found on the internet
-func GetLatestMinIOImage(client http.ClientI) (*string, error) {
- resp, err := client.Get("https://dl.min.io/server/minio/release/linux-amd64/")
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- body, err := io.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
- re := regexp.MustCompile(`minio\.(RELEASE.*?Z)"`)
- // look for a single match
- matches := re.FindAllStringSubmatch(string(body), 1)
- for i := range matches {
- release := matches[i][1]
- dockerImage := fmt.Sprintf("minio/minio:%s", release)
- return &dockerImage, nil
- }
- return nil, ErrCantDetermineMinIOImage
-}
diff --git a/portal-ui/src/api/consoleApi.ts b/portal-ui/src/api/consoleApi.ts
index 2daa065da..bc592d0a9 100644
--- a/portal-ui/src/api/consoleApi.ts
+++ b/portal-ui/src/api/consoleApi.ts
@@ -1228,11 +1228,6 @@ export interface SubnetOrganization {
shortName?: string;
}
-export interface CheckVersionResponse {
- current_version?: string;
- latest_version?: string;
-}
-
export interface PermissionResource {
resource?: string;
conditionOperator?: string;
@@ -1852,23 +1847,6 @@ export class Api<
...params,
}),
};
- checkVersion = {
- /**
- * No description
- *
- * @tags System
- * @name CheckMinIoVersion
- * @summary Checks the current MinIO version against the latest
- * @request GET:/check-version
- */
- checkMinIoVersion: (params: RequestParams = {}) =>
- this.request({
- path: `/check-version`,
- method: "GET",
- format: "json",
- ...params,
- }),
- };
account = {
/**
* No description
diff --git a/portal-ui/src/screens/LoginPage/Login.tsx b/portal-ui/src/screens/LoginPage/Login.tsx
index 4c8b90f05..a84c5008c 100644
--- a/portal-ui/src/screens/LoginPage/Login.tsx
+++ b/portal-ui/src/screens/LoginPage/Login.tsx
@@ -21,7 +21,7 @@ import { loginStrategyType } from "./login.types";
import MainError from "../Console/Common/MainError/MainError";
import { AppState, useAppDispatch } from "../../store";
import { useSelector } from "react-redux";
-import { getFetchConfigurationAsync, getVersionAsync } from "./loginThunks";
+import { getFetchConfigurationAsync } from "./loginThunks";
import { resetForm } from "./loginSlice";
import StrategyForm from "./StrategyForm";
import { getLogoVar } from "../../config";
@@ -57,9 +57,6 @@ const Login = () => {
const loadingFetchConfiguration = useSelector(
(state: AppState) => state.login.loadingFetchConfiguration,
);
- const loadingVersion = useSelector(
- (state: AppState) => state.login.loadingVersion,
- );
const navigateTo = useSelector((state: AppState) => state.login.navigateTo);
const isK8S = useSelector((state: AppState) => state.login.isK8S);
@@ -81,12 +78,6 @@ const Login = () => {
}
}, [loadingFetchConfiguration, dispatch]);
- useEffect(() => {
- if (loadingVersion) {
- dispatch(getVersionAsync());
- }
- }, [dispatch, loadingVersion]);
-
let loginComponent;
switch (loginStrategy.loginStrategy) {
diff --git a/portal-ui/src/screens/LoginPage/loginSlice.ts b/portal-ui/src/screens/LoginPage/loginSlice.ts
index ba6a9cb42..dd4de6f9c 100644
--- a/portal-ui/src/screens/LoginPage/loginSlice.ts
+++ b/portal-ui/src/screens/LoginPage/loginSlice.ts
@@ -16,11 +16,7 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { LoginDetails } from "api/consoleApi";
-import {
- doLoginAsync,
- getFetchConfigurationAsync,
- getVersionAsync,
-} from "./loginThunks";
+import { doLoginAsync, getFetchConfigurationAsync } from "./loginThunks";
export interface LoginState {
accessKey: string;
@@ -31,8 +27,6 @@ export interface LoginState {
loginStrategy: LoginDetails;
loginSending: boolean;
loadingFetchConfiguration: boolean;
- latestMinIOVersion: string;
- loadingVersion: boolean;
isK8S: boolean;
navigateTo: string;
ssoEmbeddedIDPDisplay: boolean;
@@ -49,8 +43,6 @@ const initialState: LoginState = {
},
loginSending: false,
loadingFetchConfiguration: true,
- latestMinIOVersion: "",
- loadingVersion: true,
isK8S: false,
backgroundAnimation: false,
navigateTo: "",
@@ -83,18 +75,6 @@ export const loginSlice = createSlice({
},
extraReducers: (builder) => {
builder
- .addCase(getVersionAsync.pending, (state, action) => {
- state.loadingVersion = true;
- })
- .addCase(getVersionAsync.rejected, (state, action) => {
- state.loadingVersion = false;
- })
- .addCase(getVersionAsync.fulfilled, (state, action) => {
- state.loadingVersion = false;
- if (action.payload) {
- state.latestMinIOVersion = action.payload;
- }
- })
.addCase(getFetchConfigurationAsync.pending, (state, action) => {
state.loadingFetchConfiguration = true;
})
diff --git a/portal-ui/src/screens/LoginPage/loginThunks.ts b/portal-ui/src/screens/LoginPage/loginThunks.ts
index c617e44a3..2e8cdeb6c 100644
--- a/portal-ui/src/screens/LoginPage/loginThunks.ts
+++ b/portal-ui/src/screens/LoginPage/loginThunks.ts
@@ -76,21 +76,3 @@ export const getFetchConfigurationAsync = createAsyncThunk(
});
},
);
-
-export const getVersionAsync = createAsyncThunk(
- "login/getVersionAsync",
- async (_, { getState, rejectWithValue, dispatch }) => {
- return api.checkVersion
- .checkMinIoVersion()
- .then((res) => {
- if (res.data !== undefined) {
- return res.data.latest_version;
- }
- })
- .catch(async (res) => {
- const err = (await res.json()) as ApiError;
- dispatch(setErrorSnackMessage(errorToHandler(err)));
- return rejectWithValue(false);
- });
- },
-);
diff --git a/restapi/configure_console.go b/restapi/configure_console.go
index 2f20f4e4b..6d074a6d2 100644
--- a/restapi/configure_console.go
+++ b/restapi/configure_console.go
@@ -127,8 +127,6 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
registerServiceHandlers(api)
// Register session handlers
registerSessionHandlers(api)
- // Register version handlers
- registerVersionHandlers(api)
// Register admin info handlers
registerAdminInfoHandlers(api)
// Register admin arns handlers
diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go
index bb10d894d..55ad9f15b 100644
--- a/restapi/embedded_spec.go
+++ b/restapi/embedded_spec.go
@@ -2561,30 +2561,6 @@ func init() {
}
}
},
- "/check-version": {
- "get": {
- "security": [],
- "tags": [
- "System"
- ],
- "summary": "Checks the current MinIO version against the latest",
- "operationId": "CheckMinIOVersion",
- "responses": {
- "200": {
- "description": "A successful response.",
- "schema": {
- "$ref": "#/definitions/checkVersionResponse"
- }
- },
- "default": {
- "description": "Generic error response.",
- "schema": {
- "$ref": "#/definitions/ApiError"
- }
- }
- }
- }
- },
"/configs": {
"get": {
"tags": [
@@ -6096,17 +6072,6 @@ func init() {
}
}
},
- "checkVersionResponse": {
- "type": "object",
- "properties": {
- "current_version": {
- "type": "string"
- },
- "latest_version": {
- "type": "string"
- }
- }
- },
"configDescription": {
"type": "object",
"properties": {
@@ -11637,30 +11602,6 @@ func init() {
}
}
},
- "/check-version": {
- "get": {
- "security": [],
- "tags": [
- "System"
- ],
- "summary": "Checks the current MinIO version against the latest",
- "operationId": "CheckMinIOVersion",
- "responses": {
- "200": {
- "description": "A successful response.",
- "schema": {
- "$ref": "#/definitions/checkVersionResponse"
- }
- },
- "default": {
- "description": "Generic error response.",
- "schema": {
- "$ref": "#/definitions/ApiError"
- }
- }
- }
- }
- },
"/configs": {
"get": {
"tags": [
@@ -15321,17 +15262,6 @@ func init() {
}
}
},
- "checkVersionResponse": {
- "type": "object",
- "properties": {
- "current_version": {
- "type": "string"
- },
- "latest_version": {
- "type": "string"
- }
- }
- },
"configDescription": {
"type": "object",
"properties": {
diff --git a/restapi/operations/console_api.go b/restapi/operations/console_api.go
index 14072c61c..2544103b3 100644
--- a/restapi/operations/console_api.go
+++ b/restapi/operations/console_api.go
@@ -133,9 +133,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
AccountChangeUserPasswordHandler: account.ChangeUserPasswordHandlerFunc(func(params account.ChangeUserPasswordParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation account.ChangeUserPassword has not yet been implemented")
}),
- SystemCheckMinIOVersionHandler: system.CheckMinIOVersionHandlerFunc(func(params system.CheckMinIOVersionParams) middleware.Responder {
- return middleware.NotImplemented("operation system.CheckMinIOVersion has not yet been implemented")
- }),
UserCheckUserServiceAccountsHandler: user.CheckUserServiceAccountsHandlerFunc(func(params user.CheckUserServiceAccountsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation user.CheckUserServiceAccounts has not yet been implemented")
}),
@@ -652,8 +649,6 @@ type ConsoleAPI struct {
UserBulkUpdateUsersGroupsHandler user.BulkUpdateUsersGroupsHandler
// AccountChangeUserPasswordHandler sets the operation handler for the change user password operation
AccountChangeUserPasswordHandler account.ChangeUserPasswordHandler
- // SystemCheckMinIOVersionHandler sets the operation handler for the check min i o version operation
- SystemCheckMinIOVersionHandler system.CheckMinIOVersionHandler
// UserCheckUserServiceAccountsHandler sets the operation handler for the check user service accounts operation
UserCheckUserServiceAccountsHandler user.CheckUserServiceAccountsHandler
// ConfigurationConfigInfoHandler sets the operation handler for the config info operation
@@ -1072,9 +1067,6 @@ func (o *ConsoleAPI) Validate() error {
if o.AccountChangeUserPasswordHandler == nil {
unregistered = append(unregistered, "account.ChangeUserPasswordHandler")
}
- if o.SystemCheckMinIOVersionHandler == nil {
- unregistered = append(unregistered, "system.CheckMinIOVersionHandler")
- }
if o.UserCheckUserServiceAccountsHandler == nil {
unregistered = append(unregistered, "user.CheckUserServiceAccountsHandler")
}
@@ -1665,10 +1657,6 @@ func (o *ConsoleAPI) initHandlerCache() {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/account/change-user-password"] = account.NewChangeUserPassword(o.context, o.AccountChangeUserPasswordHandler)
- if o.handlers["GET"] == nil {
- o.handlers["GET"] = make(map[string]http.Handler)
- }
- o.handlers["GET"]["/check-version"] = system.NewCheckMinIOVersion(o.context, o.SystemCheckMinIOVersionHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
diff --git a/restapi/operations/system/check_min_i_o_version.go b/restapi/operations/system/check_min_i_o_version.go
deleted file mode 100644
index 4f6499d2a..000000000
--- a/restapi/operations/system/check_min_i_o_version.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2023 MinIO, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-//
-
-package system
-
-// 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"
-)
-
-// CheckMinIOVersionHandlerFunc turns a function with the right signature into a check min i o version handler
-type CheckMinIOVersionHandlerFunc func(CheckMinIOVersionParams) middleware.Responder
-
-// Handle executing the request and returning a response
-func (fn CheckMinIOVersionHandlerFunc) Handle(params CheckMinIOVersionParams) middleware.Responder {
- return fn(params)
-}
-
-// CheckMinIOVersionHandler interface for that can handle valid check min i o version params
-type CheckMinIOVersionHandler interface {
- Handle(CheckMinIOVersionParams) middleware.Responder
-}
-
-// NewCheckMinIOVersion creates a new http.Handler for the check min i o version operation
-func NewCheckMinIOVersion(ctx *middleware.Context, handler CheckMinIOVersionHandler) *CheckMinIOVersion {
- return &CheckMinIOVersion{Context: ctx, Handler: handler}
-}
-
-/*
- CheckMinIOVersion swagger:route GET /check-version System checkMinIOVersion
-
-Checks the current MinIO version against the latest
-*/
-type CheckMinIOVersion struct {
- Context *middleware.Context
- Handler CheckMinIOVersionHandler
-}
-
-func (o *CheckMinIOVersion) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- route, rCtx, _ := o.Context.RouteInfo(r)
- if rCtx != nil {
- *r = *rCtx
- }
- var Params = NewCheckMinIOVersionParams()
- if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
- o.Context.Respond(rw, r, route.Produces, route, err)
- return
- }
-
- res := o.Handler.Handle(Params) // actually handle the request
- o.Context.Respond(rw, r, route.Produces, route, res)
-
-}
diff --git a/restapi/operations/system/check_min_i_o_version_parameters.go b/restapi/operations/system/check_min_i_o_version_parameters.go
deleted file mode 100644
index 9aa2447ed..000000000
--- a/restapi/operations/system/check_min_i_o_version_parameters.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2023 MinIO, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-//
-
-package system
-
-// 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"
-)
-
-// NewCheckMinIOVersionParams creates a new CheckMinIOVersionParams object
-//
-// There are no default values defined in the spec.
-func NewCheckMinIOVersionParams() CheckMinIOVersionParams {
-
- return CheckMinIOVersionParams{}
-}
-
-// CheckMinIOVersionParams contains all the bound params for the check min i o version operation
-// typically these are obtained from a http.Request
-//
-// swagger:parameters CheckMinIOVersion
-type CheckMinIOVersionParams 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 NewCheckMinIOVersionParams() beforehand.
-func (o *CheckMinIOVersionParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
- var res []error
-
- o.HTTPRequest = r
-
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
-}
diff --git a/restapi/operations/system/check_min_i_o_version_responses.go b/restapi/operations/system/check_min_i_o_version_responses.go
deleted file mode 100644
index eb9ba65c4..000000000
--- a/restapi/operations/system/check_min_i_o_version_responses.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2023 MinIO, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-//
-
-package system
-
-// 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"
-)
-
-// CheckMinIOVersionOKCode is the HTTP code returned for type CheckMinIOVersionOK
-const CheckMinIOVersionOKCode int = 200
-
-/*
-CheckMinIOVersionOK A successful response.
-
-swagger:response checkMinIOVersionOK
-*/
-type CheckMinIOVersionOK struct {
-
- /*
- In: Body
- */
- Payload *models.CheckVersionResponse `json:"body,omitempty"`
-}
-
-// NewCheckMinIOVersionOK creates CheckMinIOVersionOK with default headers values
-func NewCheckMinIOVersionOK() *CheckMinIOVersionOK {
-
- return &CheckMinIOVersionOK{}
-}
-
-// WithPayload adds the payload to the check min i o version o k response
-func (o *CheckMinIOVersionOK) WithPayload(payload *models.CheckVersionResponse) *CheckMinIOVersionOK {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the check min i o version o k response
-func (o *CheckMinIOVersionOK) SetPayload(payload *models.CheckVersionResponse) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *CheckMinIOVersionOK) 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
- }
- }
-}
-
-/*
-CheckMinIOVersionDefault Generic error response.
-
-swagger:response checkMinIOVersionDefault
-*/
-type CheckMinIOVersionDefault struct {
- _statusCode int
-
- /*
- In: Body
- */
- Payload *models.APIError `json:"body,omitempty"`
-}
-
-// NewCheckMinIOVersionDefault creates CheckMinIOVersionDefault with default headers values
-func NewCheckMinIOVersionDefault(code int) *CheckMinIOVersionDefault {
- if code <= 0 {
- code = 500
- }
-
- return &CheckMinIOVersionDefault{
- _statusCode: code,
- }
-}
-
-// WithStatusCode adds the status to the check min i o version default response
-func (o *CheckMinIOVersionDefault) WithStatusCode(code int) *CheckMinIOVersionDefault {
- o._statusCode = code
- return o
-}
-
-// SetStatusCode sets the status to the check min i o version default response
-func (o *CheckMinIOVersionDefault) SetStatusCode(code int) {
- o._statusCode = code
-}
-
-// WithPayload adds the payload to the check min i o version default response
-func (o *CheckMinIOVersionDefault) WithPayload(payload *models.APIError) *CheckMinIOVersionDefault {
- o.Payload = payload
- return o
-}
-
-// SetPayload sets the payload to the check min i o version default response
-func (o *CheckMinIOVersionDefault) SetPayload(payload *models.APIError) {
- o.Payload = payload
-}
-
-// WriteResponse to the client
-func (o *CheckMinIOVersionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
-
- rw.WriteHeader(o._statusCode)
- if o.Payload != nil {
- payload := o.Payload
- if err := producer.Produce(rw, payload); err != nil {
- panic(err) // let the recovery middleware deal with this
- }
- }
-}
diff --git a/restapi/operations/system/check_min_i_o_version_urlbuilder.go b/restapi/operations/system/check_min_i_o_version_urlbuilder.go
deleted file mode 100644
index 79db0347e..000000000
--- a/restapi/operations/system/check_min_i_o_version_urlbuilder.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Code generated by go-swagger; DO NOT EDIT.
-
-// This file is part of MinIO Console Server
-// Copyright (c) 2023 MinIO, Inc.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-//
-
-package system
-
-// 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"
-)
-
-// CheckMinIOVersionURL generates an URL for the check min i o version operation
-type CheckMinIOVersionURL 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 *CheckMinIOVersionURL) WithBasePath(bp string) *CheckMinIOVersionURL {
- 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 *CheckMinIOVersionURL) SetBasePath(bp string) {
- o._basePath = bp
-}
-
-// Build a url path and query string
-func (o *CheckMinIOVersionURL) Build() (*url.URL, error) {
- var _result url.URL
-
- var _path = "/check-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 *CheckMinIOVersionURL) 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 *CheckMinIOVersionURL) String() string {
- return o.Must(o.Build()).String()
-}
-
-// BuildFull builds a full url with scheme, host, path and query string
-func (o *CheckMinIOVersionURL) BuildFull(scheme, host string) (*url.URL, error) {
- if scheme == "" {
- return nil, errors.New("scheme is required for a full url on CheckMinIOVersionURL")
- }
- if host == "" {
- return nil, errors.New("host is required for a full url on CheckMinIOVersionURL")
- }
-
- 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 *CheckMinIOVersionURL) StringFull(scheme, host string) string {
- return o.Must(o.BuildFull(scheme, host)).String()
-}
diff --git a/restapi/user_version.go b/restapi/user_version.go
deleted file mode 100644
index ff2c2ba05..000000000
--- a/restapi/user_version.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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 .
-
-package restapi
-
-import (
- "context"
- "time"
-
- xhttp "github.com/minio/console/pkg/http"
-
- "github.com/go-openapi/runtime/middleware"
- "github.com/minio/console/models"
- "github.com/minio/console/pkg/utils"
- "github.com/minio/console/restapi/operations"
- systemApi "github.com/minio/console/restapi/operations/system"
-)
-
-func registerVersionHandlers(api *operations.ConsoleAPI) {
- api.SystemCheckMinIOVersionHandler = systemApi.CheckMinIOVersionHandlerFunc(func(params systemApi.CheckMinIOVersionParams) middleware.Responder {
- versionResponse, err := getVersionResponse(params)
- if err != nil {
- return systemApi.NewCheckMinIOVersionDefault(err.Code).WithPayload(err.APIError)
- }
- return systemApi.NewCheckMinIOVersionOK().WithPayload(versionResponse)
- })
-}
-
-// getSessionResponse parse the token of the current session and returns a list of allowed actions to render in the UI
-func getVersionResponse(params systemApi.CheckMinIOVersionParams) (*models.CheckVersionResponse, *CodedAPIError) {
- ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
- defer cancel()
-
- client := GetConsoleHTTPClient("", getClientIP(params.HTTPRequest))
- client.Timeout = 15 * time.Second
-
- ver, err := utils.GetLatestMinIOImage(&xhttp.Client{
- Client: client,
- })
- if err != nil {
- return nil, ErrorWithContext(ctx, err)
- }
- return &models.CheckVersionResponse{
- LatestVersion: *ver,
- }, nil
-}
diff --git a/swagger.yml b/swagger.yml
index bfee71629..42dfac370 100644
--- a/swagger.yml
+++ b/swagger.yml
@@ -1,3 +1,5 @@
+# @format
+
swagger: "2.0"
info:
title: MinIO Console Server
@@ -23,7 +25,7 @@ securityDefinitions:
type: apiKey
# Apply the key security definition to all APIs
security:
- - key: [ ]
+ - key: []
paths:
/login:
get:
@@ -39,7 +41,7 @@ paths:
schema:
$ref: "#/definitions/ApiError"
# Exclude this API from the authentication requirement
- security: [ ]
+ security: []
tags:
- Auth
post:
@@ -59,7 +61,7 @@ paths:
schema:
$ref: "#/definitions/ApiError"
# Exclude this API from the authentication requirement
- security: [ ]
+ security: []
tags:
- Auth
/login/oauth2/auth:
@@ -79,7 +81,7 @@ paths:
description: Generic error response.
schema:
$ref: "#/definitions/ApiError"
- security: [ ]
+ security: []
tags:
- Auth
@@ -119,23 +121,6 @@ paths:
tags:
- Auth
- /check-version:
- get:
- summary: Checks the current MinIO version against the latest
- operationId: CheckMinIOVersion
- responses:
- 200:
- description: A successful response.
- schema:
- $ref: "#/definitions/checkVersionResponse"
- default:
- description: Generic error response.
- schema:
- $ref: "#/definitions/ApiError"
- security: [ ]
- tags:
- - System
-
/account/change-password:
post:
summary: Change password of currently logged in user.
@@ -297,8 +282,8 @@ paths:
get:
summary: List Objects
security:
- - key: [ ]
- - anonymous: [ ]
+ - key: []
+ - anonymous: []
operationId: ListObjects
parameters:
- name: bucket_name
@@ -417,8 +402,8 @@ paths:
post:
summary: Uploads an Object.
security:
- - key: [ ]
- - anonymous: [ ]
+ - key: []
+ - anonymous: []
consumes:
- multipart/form-data
parameters:
@@ -444,8 +429,8 @@ paths:
summary: Download Multiple Objects
operationId: DownloadMultipleObjects
security:
- - key: [ ]
- - anonymous: [ ]
+ - key: []
+ - anonymous: []
produces:
- application/octet-stream
parameters:
@@ -477,8 +462,8 @@ paths:
summary: Download Object
operationId: Download Object
security:
- - key: [ ]
- - anonymous: [ ]
+ - key: []
+ - anonymous: []
produces:
- application/octet-stream
parameters:
@@ -2953,7 +2938,7 @@ paths:
- name: order
in: query
type: string
- enum: [ timeDesc, timeAsc ]
+ enum: [timeDesc, timeAsc]
default: timeDesc
- name: timeStart
in: query
@@ -4375,7 +4360,7 @@ definitions:
properties:
loginStrategy:
type: string
- enum: [ form, redirect, service-account, redirect-service-account ]
+ enum: [form, redirect, service-account, redirect-service-account]
redirectRules:
type: array
items:
@@ -4474,7 +4459,7 @@ definitions:
type: string
status:
type: string
- enum: [ ok ]
+ enum: [ok]
operator:
type: boolean
distributedMode:
@@ -4505,7 +4490,7 @@ definitions:
type: string
values:
type: array
- items: { }
+ items: {}
resultTarget:
type: object
properties:
@@ -4928,7 +4913,7 @@ definitions:
type: string
service:
type: string
- enum: [ replication ]
+ enum: [replication]
syncMode:
type: string
bandwidth:
@@ -5690,14 +5675,6 @@ definitions:
shortName:
type: string
- checkVersionResponse:
- type: object
- properties:
- current_version:
- type: string
- latest_version:
- type: string
-
permissionResource:
type: object
properties: