github.com/minio/console@v1.4.1/api/operations/tiering/get_tier_parameters.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 tiering 21 22 // This file was generated by the swagger tool. 23 // Editing this file might prove futile when you re-run the swagger generate command 24 25 import ( 26 "net/http" 27 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/runtime/middleware" 30 "github.com/go-openapi/strfmt" 31 "github.com/go-openapi/validate" 32 ) 33 34 // NewGetTierParams creates a new GetTierParams object 35 // 36 // There are no default values defined in the spec. 37 func NewGetTierParams() GetTierParams { 38 39 return GetTierParams{} 40 } 41 42 // GetTierParams contains all the bound params for the get tier operation 43 // typically these are obtained from a http.Request 44 // 45 // swagger:parameters GetTier 46 type GetTierParams struct { 47 48 // HTTP Request Object 49 HTTPRequest *http.Request `json:"-"` 50 51 /* 52 Required: true 53 In: path 54 */ 55 Name string 56 /* 57 Required: true 58 In: path 59 */ 60 Type string 61 } 62 63 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 64 // for simple values it will use straight method calls. 65 // 66 // To ensure default values, the struct must have been initialized with NewGetTierParams() beforehand. 67 func (o *GetTierParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 68 var res []error 69 70 o.HTTPRequest = r 71 72 rName, rhkName, _ := route.Params.GetOK("name") 73 if err := o.bindName(rName, rhkName, route.Formats); err != nil { 74 res = append(res, err) 75 } 76 77 rType, rhkType, _ := route.Params.GetOK("type") 78 if err := o.bindType(rType, rhkType, route.Formats); err != nil { 79 res = append(res, err) 80 } 81 if len(res) > 0 { 82 return errors.CompositeValidationError(res...) 83 } 84 return nil 85 } 86 87 // bindName binds and validates parameter Name from path. 88 func (o *GetTierParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { 89 var raw string 90 if len(rawData) > 0 { 91 raw = rawData[len(rawData)-1] 92 } 93 94 // Required: true 95 // Parameter is provided by construction from the route 96 o.Name = raw 97 98 return nil 99 } 100 101 // bindType binds and validates parameter Type from path. 102 func (o *GetTierParams) bindType(rawData []string, hasKey bool, formats strfmt.Registry) error { 103 var raw string 104 if len(rawData) > 0 { 105 raw = rawData[len(rawData)-1] 106 } 107 108 // Required: true 109 // Parameter is provided by construction from the route 110 o.Type = raw 111 112 if err := o.validateType(formats); err != nil { 113 return err 114 } 115 116 return nil 117 } 118 119 // validateType carries on validations for parameter Type 120 func (o *GetTierParams) validateType(formats strfmt.Registry) error { 121 122 if err := validate.EnumCase("type", "path", o.Type, []interface{}{"s3", "gcs", "azure", "minio"}, true); err != nil { 123 return err 124 } 125 126 return nil 127 }