github.com/minio/console@v1.4.1/api/operations/object/delete_object_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 object 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" 30 "github.com/go-openapi/runtime/middleware" 31 "github.com/go-openapi/strfmt" 32 "github.com/go-openapi/swag" 33 "github.com/go-openapi/validate" 34 ) 35 36 // NewDeleteObjectParams creates a new DeleteObjectParams object 37 // 38 // There are no default values defined in the spec. 39 func NewDeleteObjectParams() DeleteObjectParams { 40 41 return DeleteObjectParams{} 42 } 43 44 // DeleteObjectParams contains all the bound params for the delete object operation 45 // typically these are obtained from a http.Request 46 // 47 // swagger:parameters DeleteObject 48 type DeleteObjectParams struct { 49 50 // HTTP Request Object 51 HTTPRequest *http.Request `json:"-"` 52 53 /* 54 In: query 55 */ 56 AllVersions *bool 57 /* 58 Required: true 59 In: path 60 */ 61 BucketName string 62 /* 63 In: query 64 */ 65 Bypass *bool 66 /* 67 In: query 68 */ 69 NonCurrentVersions *bool 70 /* 71 Required: true 72 In: query 73 */ 74 Prefix string 75 /* 76 In: query 77 */ 78 Recursive *bool 79 /* 80 In: query 81 */ 82 VersionID *string 83 } 84 85 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 86 // for simple values it will use straight method calls. 87 // 88 // To ensure default values, the struct must have been initialized with NewDeleteObjectParams() beforehand. 89 func (o *DeleteObjectParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 90 var res []error 91 92 o.HTTPRequest = r 93 94 qs := runtime.Values(r.URL.Query()) 95 96 qAllVersions, qhkAllVersions, _ := qs.GetOK("all_versions") 97 if err := o.bindAllVersions(qAllVersions, qhkAllVersions, route.Formats); err != nil { 98 res = append(res, err) 99 } 100 101 rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name") 102 if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil { 103 res = append(res, err) 104 } 105 106 qBypass, qhkBypass, _ := qs.GetOK("bypass") 107 if err := o.bindBypass(qBypass, qhkBypass, route.Formats); err != nil { 108 res = append(res, err) 109 } 110 111 qNonCurrentVersions, qhkNonCurrentVersions, _ := qs.GetOK("non_current_versions") 112 if err := o.bindNonCurrentVersions(qNonCurrentVersions, qhkNonCurrentVersions, route.Formats); err != nil { 113 res = append(res, err) 114 } 115 116 qPrefix, qhkPrefix, _ := qs.GetOK("prefix") 117 if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil { 118 res = append(res, err) 119 } 120 121 qRecursive, qhkRecursive, _ := qs.GetOK("recursive") 122 if err := o.bindRecursive(qRecursive, qhkRecursive, route.Formats); err != nil { 123 res = append(res, err) 124 } 125 126 qVersionID, qhkVersionID, _ := qs.GetOK("version_id") 127 if err := o.bindVersionID(qVersionID, qhkVersionID, route.Formats); err != nil { 128 res = append(res, err) 129 } 130 if len(res) > 0 { 131 return errors.CompositeValidationError(res...) 132 } 133 return nil 134 } 135 136 // bindAllVersions binds and validates parameter AllVersions from query. 137 func (o *DeleteObjectParams) bindAllVersions(rawData []string, hasKey bool, formats strfmt.Registry) error { 138 var raw string 139 if len(rawData) > 0 { 140 raw = rawData[len(rawData)-1] 141 } 142 143 // Required: false 144 // AllowEmptyValue: false 145 146 if raw == "" { // empty values pass all other validations 147 return nil 148 } 149 150 value, err := swag.ConvertBool(raw) 151 if err != nil { 152 return errors.InvalidType("all_versions", "query", "bool", raw) 153 } 154 o.AllVersions = &value 155 156 return nil 157 } 158 159 // bindBucketName binds and validates parameter BucketName from path. 160 func (o *DeleteObjectParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error { 161 var raw string 162 if len(rawData) > 0 { 163 raw = rawData[len(rawData)-1] 164 } 165 166 // Required: true 167 // Parameter is provided by construction from the route 168 o.BucketName = raw 169 170 return nil 171 } 172 173 // bindBypass binds and validates parameter Bypass from query. 174 func (o *DeleteObjectParams) bindBypass(rawData []string, hasKey bool, formats strfmt.Registry) error { 175 var raw string 176 if len(rawData) > 0 { 177 raw = rawData[len(rawData)-1] 178 } 179 180 // Required: false 181 // AllowEmptyValue: false 182 183 if raw == "" { // empty values pass all other validations 184 return nil 185 } 186 187 value, err := swag.ConvertBool(raw) 188 if err != nil { 189 return errors.InvalidType("bypass", "query", "bool", raw) 190 } 191 o.Bypass = &value 192 193 return nil 194 } 195 196 // bindNonCurrentVersions binds and validates parameter NonCurrentVersions from query. 197 func (o *DeleteObjectParams) bindNonCurrentVersions(rawData []string, hasKey bool, formats strfmt.Registry) error { 198 var raw string 199 if len(rawData) > 0 { 200 raw = rawData[len(rawData)-1] 201 } 202 203 // Required: false 204 // AllowEmptyValue: false 205 206 if raw == "" { // empty values pass all other validations 207 return nil 208 } 209 210 value, err := swag.ConvertBool(raw) 211 if err != nil { 212 return errors.InvalidType("non_current_versions", "query", "bool", raw) 213 } 214 o.NonCurrentVersions = &value 215 216 return nil 217 } 218 219 // bindPrefix binds and validates parameter Prefix from query. 220 func (o *DeleteObjectParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error { 221 if !hasKey { 222 return errors.Required("prefix", "query", rawData) 223 } 224 var raw string 225 if len(rawData) > 0 { 226 raw = rawData[len(rawData)-1] 227 } 228 229 // Required: true 230 // AllowEmptyValue: false 231 232 if err := validate.RequiredString("prefix", "query", raw); err != nil { 233 return err 234 } 235 o.Prefix = raw 236 237 return nil 238 } 239 240 // bindRecursive binds and validates parameter Recursive from query. 241 func (o *DeleteObjectParams) bindRecursive(rawData []string, hasKey bool, formats strfmt.Registry) error { 242 var raw string 243 if len(rawData) > 0 { 244 raw = rawData[len(rawData)-1] 245 } 246 247 // Required: false 248 // AllowEmptyValue: false 249 250 if raw == "" { // empty values pass all other validations 251 return nil 252 } 253 254 value, err := swag.ConvertBool(raw) 255 if err != nil { 256 return errors.InvalidType("recursive", "query", "bool", raw) 257 } 258 o.Recursive = &value 259 260 return nil 261 } 262 263 // bindVersionID binds and validates parameter VersionID from query. 264 func (o *DeleteObjectParams) bindVersionID(rawData []string, hasKey bool, formats strfmt.Registry) error { 265 var raw string 266 if len(rawData) > 0 { 267 raw = rawData[len(rawData)-1] 268 } 269 270 // Required: false 271 // AllowEmptyValue: false 272 273 if raw == "" { // empty values pass all other validations 274 return nil 275 } 276 o.VersionID = &raw 277 278 return nil 279 }