github.com/minio/console@v1.4.1/api/operations/site_replication/site_replication_remove.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // This file is part of MinIO Console Server
     4  // Copyright (c) 2023 MinIO, Inc.
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU Affero General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // (at your option) any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU Affero General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU Affero General Public License
    17  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  //
    19  
    20  package site_replication
    21  
    22  // This file was generated by the swagger tool.
    23  // Editing this file might prove futile when you re-run the generate command
    24  
    25  import (
    26  	"net/http"
    27  
    28  	"github.com/go-openapi/runtime/middleware"
    29  
    30  	"github.com/minio/console/models"
    31  )
    32  
    33  // SiteReplicationRemoveHandlerFunc turns a function with the right signature into a site replication remove handler
    34  type SiteReplicationRemoveHandlerFunc func(SiteReplicationRemoveParams, *models.Principal) middleware.Responder
    35  
    36  // Handle executing the request and returning a response
    37  func (fn SiteReplicationRemoveHandlerFunc) Handle(params SiteReplicationRemoveParams, principal *models.Principal) middleware.Responder {
    38  	return fn(params, principal)
    39  }
    40  
    41  // SiteReplicationRemoveHandler interface for that can handle valid site replication remove params
    42  type SiteReplicationRemoveHandler interface {
    43  	Handle(SiteReplicationRemoveParams, *models.Principal) middleware.Responder
    44  }
    45  
    46  // NewSiteReplicationRemove creates a new http.Handler for the site replication remove operation
    47  func NewSiteReplicationRemove(ctx *middleware.Context, handler SiteReplicationRemoveHandler) *SiteReplicationRemove {
    48  	return &SiteReplicationRemove{Context: ctx, Handler: handler}
    49  }
    50  
    51  /*
    52  	SiteReplicationRemove swagger:route DELETE /admin/site-replication SiteReplication siteReplicationRemove
    53  
    54  Remove a Replication Site
    55  */
    56  type SiteReplicationRemove struct {
    57  	Context *middleware.Context
    58  	Handler SiteReplicationRemoveHandler
    59  }
    60  
    61  func (o *SiteReplicationRemove) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    62  	route, rCtx, _ := o.Context.RouteInfo(r)
    63  	if rCtx != nil {
    64  		*r = *rCtx
    65  	}
    66  	var Params = NewSiteReplicationRemoveParams()
    67  	uprinc, aCtx, err := o.Context.Authorize(r, route)
    68  	if err != nil {
    69  		o.Context.Respond(rw, r, route.Produces, route, err)
    70  		return
    71  	}
    72  	if aCtx != nil {
    73  		*r = *aCtx
    74  	}
    75  	var principal *models.Principal
    76  	if uprinc != nil {
    77  		principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
    78  	}
    79  
    80  	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    81  		o.Context.Respond(rw, r, route.Produces, route, err)
    82  		return
    83  	}
    84  
    85  	res := o.Handler.Handle(Params, principal) // actually handle the request
    86  	o.Context.Respond(rw, r, route.Produces, route, res)
    87  
    88  }