Delete pods (#844)
Co-authored-by: Adam Stafford <adam@minio.io> Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,8 @@ export interface IPodListElement {
|
||||
restarts: number;
|
||||
node: string;
|
||||
time: string;
|
||||
namespace?: string;
|
||||
tenant?: string;
|
||||
}
|
||||
|
||||
export interface IAddPoolRequest {
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// 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, { useEffect, useState } from "react";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
LinearProgress,
|
||||
} from "@material-ui/core";
|
||||
import api from "../../../../common/api";
|
||||
import { IPodListElement, ITenant } from "../ListTenants/types";
|
||||
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import { connect } from "react-redux";
|
||||
import { setErrorSnackMessage } from "../../../../actions";
|
||||
|
||||
interface IDeletePod {
|
||||
deleteOpen: boolean;
|
||||
selectedPod: IPodListElement;
|
||||
closeDeleteModalAndRefresh: (refreshList: boolean) => any;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
}
|
||||
|
||||
const DeletePod = ({
|
||||
deleteOpen,
|
||||
selectedPod,
|
||||
closeDeleteModalAndRefresh,
|
||||
setErrorSnackMessage,
|
||||
}: IDeletePod) => {
|
||||
const [deleteLoading, setDeleteLoading] = useState(false);
|
||||
const [retypePod, setRetypePod] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (deleteLoading) {
|
||||
api
|
||||
.invoke(
|
||||
"DELETE",
|
||||
`/api/v1/namespaces/${selectedPod.namespace}/tenants/${selectedPod.tenant}/pods/${selectedPod.name}`
|
||||
)
|
||||
.then(() => {
|
||||
setDeleteLoading(false);
|
||||
closeDeleteModalAndRefresh(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
setDeleteLoading(false);
|
||||
setErrorSnackMessage(err);
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [deleteLoading]);
|
||||
|
||||
const removeRecord = () => {
|
||||
if (retypePod !== selectedPod.name) {
|
||||
setErrorSnackMessage("Tenant name is not correct");
|
||||
return;
|
||||
}
|
||||
setDeleteLoading(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={deleteOpen}
|
||||
onClose={() => {
|
||||
closeDeleteModalAndRefresh(false);
|
||||
}}
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
>
|
||||
<DialogTitle id="alert-dialog-title">Delete Pod</DialogTitle>
|
||||
<DialogContent>
|
||||
{deleteLoading && <LinearProgress />}
|
||||
<DialogContentText id="alert-dialog-description">
|
||||
To continue please type <b>{selectedPod.name}</b> in the box.
|
||||
<Grid item xs={12}>
|
||||
<InputBoxWrapper
|
||||
id="retype-pod"
|
||||
name="retype-pod"
|
||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setRetypePod(event.target.value);
|
||||
}}
|
||||
label=""
|
||||
value={retypePod}
|
||||
/>
|
||||
</Grid>
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() => {
|
||||
closeDeleteModalAndRefresh(false);
|
||||
}}
|
||||
color="primary"
|
||||
disabled={deleteLoading}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={removeRecord}
|
||||
color="secondary"
|
||||
autoFocus
|
||||
disabled={retypePod !== selectedPod.name}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
const connector = connect(null, {
|
||||
setErrorSnackMessage,
|
||||
});
|
||||
|
||||
export default connector(DeletePod);
|
||||
@@ -28,6 +28,7 @@ import api from "../../../../common/api";
|
||||
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
|
||||
import { AppState } from "../../../../store";
|
||||
import { setTenantDetailsLoad } from "../actions";
|
||||
import DeletePod from "./DeletePod";
|
||||
|
||||
interface IPodsSummary {
|
||||
match: any;
|
||||
@@ -45,6 +46,9 @@ const styles = (theme: Theme) =>
|
||||
const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
const [pods, setPods] = useState<IPodListElement[]>([]);
|
||||
const [loadingPods, setLoadingPods] = useState<boolean>(true);
|
||||
const [deleteOpen, setDeleteOpen] = useState<boolean>(false);
|
||||
const [selectedPod, setSelectedPod] = useState<any>(null);
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const tenantName = match.params["tenantName"];
|
||||
const tenantNamespace = match.params["tenantNamespace"];
|
||||
@@ -55,7 +59,26 @@ const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
);
|
||||
return;
|
||||
};
|
||||
const podTableActions = [{ type: "view", onClick: podViewAction }];
|
||||
|
||||
const closeDeleteModalAndRefresh = (reloadData: boolean) => {
|
||||
setDeleteOpen(false);
|
||||
|
||||
if (reloadData) {
|
||||
setIsLoading(true);
|
||||
}
|
||||
};
|
||||
|
||||
const confirmDeletePod = (pod: IPodListElement) => {
|
||||
pod.tenant = tenantName;
|
||||
pod.namespace = tenantNamespace;
|
||||
setSelectedPod(pod);
|
||||
setDeleteOpen(true);
|
||||
};
|
||||
|
||||
const podTableActions = [
|
||||
{ type: "view", onClick: podViewAction },
|
||||
{ type: "delete", onClick: confirmDeletePod },
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingTenant) {
|
||||
@@ -88,6 +111,13 @@ const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{deleteOpen && (
|
||||
<DeletePod
|
||||
deleteOpen={deleteOpen}
|
||||
selectedPod={selectedPod}
|
||||
closeDeleteModalAndRefresh={closeDeleteModalAndRefresh}
|
||||
/>
|
||||
)}
|
||||
<br />
|
||||
<TableWrapper
|
||||
columns={[
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
setTenantInfo,
|
||||
setTenantTab,
|
||||
} from "../actions";
|
||||
import { ITenant } from "../ListTenants/types";
|
||||
import { IPodListElement, ITenant } from "../ListTenants/types";
|
||||
import {
|
||||
containerForHeader,
|
||||
tenantDetailsStyles,
|
||||
@@ -99,7 +99,6 @@ const TenantDetails = ({
|
||||
|
||||
const tenantName = match.params["tenantName"];
|
||||
const tenantNamespace = match.params["tenantNamespace"];
|
||||
|
||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -135,6 +135,16 @@ func registerTenantHandlers(api *operations.ConsoleAPI) {
|
||||
|
||||
})
|
||||
|
||||
// Delete Pod
|
||||
api.AdminAPIDeletePodHandler = admin_api.DeletePodHandlerFunc(func(params admin_api.DeletePodParams, session *models.Principal) middleware.Responder {
|
||||
err := getDeletePodResponse(session, params)
|
||||
if err != nil {
|
||||
return admin_api.NewTenantInfoDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return admin_api.NewTenantInfoOK()
|
||||
|
||||
})
|
||||
|
||||
// Update Tenant
|
||||
api.AdminAPIUpdateTenantHandler = admin_api.UpdateTenantHandlerFunc(func(params admin_api.UpdateTenantParams, session *models.Principal) middleware.Responder {
|
||||
err := getUpdateTenantResponse(session, params)
|
||||
@@ -288,6 +298,24 @@ func deleteTenantAction(
|
||||
return nil
|
||||
}
|
||||
|
||||
// getDeleteTenantResponse gets the output of deleting a minio instance
|
||||
func getDeletePodResponse(session *models.Principal, params admin_api.DeletePodParams) *models.Error {
|
||||
ctx := context.Background()
|
||||
// get Kubernetes Client
|
||||
clientset, err := cluster.K8sClient(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
listOpts := metav1.ListOptions{
|
||||
LabelSelector: fmt.Sprintf("v1.min.io/tenant=%s", params.Tenant),
|
||||
FieldSelector: fmt.Sprintf("metadata.name=%s%s", params.Tenant, params.PodName[len(params.Tenant):]),
|
||||
}
|
||||
if err = clientset.CoreV1().Pods(params.Namespace).DeleteCollection(ctx, metav1.DeleteOptions{}, listOpts); err != nil {
|
||||
return prepareError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTenantServiceURL gets tenant's service url with the proper scheme and port
|
||||
func GetTenantServiceURL(mi *miniov2.Tenant) (svcURL string) {
|
||||
scheme := "http"
|
||||
|
||||
@@ -2975,6 +2975,44 @@ func init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Delete pod",
|
||||
"operationId": "DeletePod",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "tenant",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "podName",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "A successful response."
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events": {
|
||||
@@ -10813,6 +10851,44 @@ func init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"AdminAPI"
|
||||
],
|
||||
"summary": "Delete pod",
|
||||
"operationId": "DeletePod",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "tenant",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "podName",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "A successful response."
|
||||
},
|
||||
"default": {
|
||||
"description": "Generic error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events": {
|
||||
|
||||
88
restapi/operations/admin_api/delete_pod.go
Normal file
88
restapi/operations/admin_api/delete_pod.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// DeletePodHandlerFunc turns a function with the right signature into a delete pod handler
|
||||
type DeletePodHandlerFunc func(DeletePodParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DeletePodHandlerFunc) Handle(params DeletePodParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// DeletePodHandler interface for that can handle valid delete pod params
|
||||
type DeletePodHandler interface {
|
||||
Handle(DeletePodParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDeletePod creates a new http.Handler for the delete pod operation
|
||||
func NewDeletePod(ctx *middleware.Context, handler DeletePodHandler) *DeletePod {
|
||||
return &DeletePod{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* DeletePod swagger:route DELETE /namespaces/{namespace}/tenants/{tenant}/pods/{podName} AdminAPI deletePod
|
||||
|
||||
Delete pod
|
||||
|
||||
*/
|
||||
type DeletePod struct {
|
||||
Context *middleware.Context
|
||||
Handler DeletePodHandler
|
||||
}
|
||||
|
||||
func (o *DeletePod) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewDeletePodParams()
|
||||
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)
|
||||
|
||||
}
|
||||
136
restapi/operations/admin_api/delete_pod_parameters.go
Normal file
136
restapi/operations/admin_api/delete_pod_parameters.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeletePodParams creates a new DeletePodParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewDeletePodParams() DeletePodParams {
|
||||
|
||||
return DeletePodParams{}
|
||||
}
|
||||
|
||||
// DeletePodParams contains all the bound params for the delete pod operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters DeletePod
|
||||
type DeletePodParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Namespace string
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
PodName string
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Tenant 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 NewDeletePodParams() beforehand.
|
||||
func (o *DeletePodParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
|
||||
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rPodName, rhkPodName, _ := route.Params.GetOK("podName")
|
||||
if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
|
||||
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindNamespace binds and validates parameter Namespace from path.
|
||||
func (o *DeletePodParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Namespace = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindPodName binds and validates parameter PodName from path.
|
||||
func (o *DeletePodParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.PodName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindTenant binds and validates parameter Tenant from path.
|
||||
func (o *DeletePodParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Tenant = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
113
restapi/operations/admin_api/delete_pod_responses.go
Normal file
113
restapi/operations/admin_api/delete_pod_responses.go
Normal file
@@ -0,0 +1,113 @@
|
||||
// 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// DeletePodNoContentCode is the HTTP code returned for type DeletePodNoContent
|
||||
const DeletePodNoContentCode int = 204
|
||||
|
||||
/*DeletePodNoContent A successful response.
|
||||
|
||||
swagger:response deletePodNoContent
|
||||
*/
|
||||
type DeletePodNoContent struct {
|
||||
}
|
||||
|
||||
// NewDeletePodNoContent creates DeletePodNoContent with default headers values
|
||||
func NewDeletePodNoContent() *DeletePodNoContent {
|
||||
|
||||
return &DeletePodNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeletePodNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*DeletePodDefault Generic error response.
|
||||
|
||||
swagger:response deletePodDefault
|
||||
*/
|
||||
type DeletePodDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeletePodDefault creates DeletePodDefault with default headers values
|
||||
func NewDeletePodDefault(code int) *DeletePodDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DeletePodDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the delete pod default response
|
||||
func (o *DeletePodDefault) WithStatusCode(code int) *DeletePodDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the delete pod default response
|
||||
func (o *DeletePodDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete pod default response
|
||||
func (o *DeletePodDefault) WithPayload(payload *models.Error) *DeletePodDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete pod default response
|
||||
func (o *DeletePodDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeletePodDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
132
restapi/operations/admin_api/delete_pod_urlbuilder.go
Normal file
132
restapi/operations/admin_api/delete_pod_urlbuilder.go
Normal file
@@ -0,0 +1,132 @@
|
||||
// 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 admin_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DeletePodURL generates an URL for the delete pod operation
|
||||
type DeletePodURL struct {
|
||||
Namespace string
|
||||
PodName string
|
||||
Tenant 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 *DeletePodURL) WithBasePath(bp string) *DeletePodURL {
|
||||
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 *DeletePodURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *DeletePodURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"
|
||||
|
||||
namespace := o.Namespace
|
||||
if namespace != "" {
|
||||
_path = strings.Replace(_path, "{namespace}", namespace, -1)
|
||||
} else {
|
||||
return nil, errors.New("namespace is required on DeletePodURL")
|
||||
}
|
||||
|
||||
podName := o.PodName
|
||||
if podName != "" {
|
||||
_path = strings.Replace(_path, "{podName}", podName, -1)
|
||||
} else {
|
||||
return nil, errors.New("podName is required on DeletePodURL")
|
||||
}
|
||||
|
||||
tenant := o.Tenant
|
||||
if tenant != "" {
|
||||
_path = strings.Replace(_path, "{tenant}", tenant, -1)
|
||||
} else {
|
||||
return nil, errors.New("tenant is required on DeletePodURL")
|
||||
}
|
||||
|
||||
_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 *DeletePodURL) 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 *DeletePodURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *DeletePodURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on DeletePodURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on DeletePodURL")
|
||||
}
|
||||
|
||||
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 *DeletePodURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -141,6 +141,9 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
UserAPIDeleteObjectRetentionHandler: user_api.DeleteObjectRetentionHandlerFunc(func(params user_api.DeleteObjectRetentionParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.DeleteObjectRetention has not yet been implemented")
|
||||
}),
|
||||
AdminAPIDeletePodHandler: admin_api.DeletePodHandlerFunc(func(params admin_api.DeletePodParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin_api.DeletePod has not yet been implemented")
|
||||
}),
|
||||
UserAPIDeleteRemoteBucketHandler: user_api.DeleteRemoteBucketHandlerFunc(func(params user_api.DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user_api.DeleteRemoteBucket has not yet been implemented")
|
||||
}),
|
||||
@@ -540,6 +543,8 @@ type ConsoleAPI struct {
|
||||
UserAPIDeleteObjectHandler user_api.DeleteObjectHandler
|
||||
// UserAPIDeleteObjectRetentionHandler sets the operation handler for the delete object retention operation
|
||||
UserAPIDeleteObjectRetentionHandler user_api.DeleteObjectRetentionHandler
|
||||
// AdminAPIDeletePodHandler sets the operation handler for the delete pod operation
|
||||
AdminAPIDeletePodHandler admin_api.DeletePodHandler
|
||||
// UserAPIDeleteRemoteBucketHandler sets the operation handler for the delete remote bucket operation
|
||||
UserAPIDeleteRemoteBucketHandler user_api.DeleteRemoteBucketHandler
|
||||
// UserAPIDeleteServiceAccountHandler sets the operation handler for the delete service account operation
|
||||
@@ -898,6 +903,9 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.UserAPIDeleteObjectRetentionHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.DeleteObjectRetentionHandler")
|
||||
}
|
||||
if o.AdminAPIDeletePodHandler == nil {
|
||||
unregistered = append(unregistered, "admin_api.DeletePodHandler")
|
||||
}
|
||||
if o.UserAPIDeleteRemoteBucketHandler == nil {
|
||||
unregistered = append(unregistered, "user_api.DeleteRemoteBucketHandler")
|
||||
}
|
||||
@@ -1397,6 +1405,10 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}"] = admin_api.NewDeletePod(o.context, o.AdminAPIDeletePodHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/remote-buckets/{source-bucket-name}/{arn}"] = user_api.NewDeleteRemoteBucket(o.context, o.UserAPIDeleteRemoteBucketHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
|
||||
25
swagger.yml
25
swagger.yml
@@ -2608,6 +2608,31 @@ paths:
|
||||
$ref: "#/definitions/error"
|
||||
tags:
|
||||
- AdminAPI
|
||||
delete:
|
||||
summary: Delete pod
|
||||
operationId: DeletePod
|
||||
parameters:
|
||||
- name: namespace
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
- name: tenant
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
- name: podName
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
204:
|
||||
description: A successful response.
|
||||
default:
|
||||
description: Generic error response.
|
||||
schema:
|
||||
$ref: "#/definitions/error"
|
||||
tags:
|
||||
- AdminAPI
|
||||
|
||||
/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events:
|
||||
get:
|
||||
|
||||
Reference in New Issue
Block a user