github.com/minio/console@v1.4.1/api/operations/bucket/bucket_info.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 bucket 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 // BucketInfoHandlerFunc turns a function with the right signature into a bucket info handler 34 type BucketInfoHandlerFunc func(BucketInfoParams, *models.Principal) middleware.Responder 35 36 // Handle executing the request and returning a response 37 func (fn BucketInfoHandlerFunc) Handle(params BucketInfoParams, principal *models.Principal) middleware.Responder { 38 return fn(params, principal) 39 } 40 41 // BucketInfoHandler interface for that can handle valid bucket info params 42 type BucketInfoHandler interface { 43 Handle(BucketInfoParams, *models.Principal) middleware.Responder 44 } 45 46 // NewBucketInfo creates a new http.Handler for the bucket info operation 47 func NewBucketInfo(ctx *middleware.Context, handler BucketInfoHandler) *BucketInfo { 48 return &BucketInfo{Context: ctx, Handler: handler} 49 } 50 51 /* 52 BucketInfo swagger:route GET /buckets/{name} Bucket bucketInfo 53 54 Bucket Info 55 */ 56 type BucketInfo struct { 57 Context *middleware.Context 58 Handler BucketInfoHandler 59 } 60 61 func (o *BucketInfo) 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 = NewBucketInfoParams() 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 }