github.com/minio/console@v1.4.1/api/operations/object/delete_object_urlbuilder.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 generate command 24 25 import ( 26 "errors" 27 "net/url" 28 golangswaggerpaths "path" 29 "strings" 30 31 "github.com/go-openapi/swag" 32 ) 33 34 // DeleteObjectURL generates an URL for the delete object operation 35 type DeleteObjectURL struct { 36 BucketName string 37 38 AllVersions *bool 39 Bypass *bool 40 NonCurrentVersions *bool 41 Prefix string 42 Recursive *bool 43 VersionID *string 44 45 _basePath string 46 // avoid unkeyed usage 47 _ struct{} 48 } 49 50 // WithBasePath sets the base path for this url builder, only required when it's different from the 51 // base path specified in the swagger spec. 52 // When the value of the base path is an empty string 53 func (o *DeleteObjectURL) WithBasePath(bp string) *DeleteObjectURL { 54 o.SetBasePath(bp) 55 return o 56 } 57 58 // SetBasePath sets the base path for this url builder, only required when it's different from the 59 // base path specified in the swagger spec. 60 // When the value of the base path is an empty string 61 func (o *DeleteObjectURL) SetBasePath(bp string) { 62 o._basePath = bp 63 } 64 65 // Build a url path and query string 66 func (o *DeleteObjectURL) Build() (*url.URL, error) { 67 var _result url.URL 68 69 var _path = "/buckets/{bucket_name}/objects" 70 71 bucketName := o.BucketName 72 if bucketName != "" { 73 _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) 74 } else { 75 return nil, errors.New("bucketName is required on DeleteObjectURL") 76 } 77 78 _basePath := o._basePath 79 if _basePath == "" { 80 _basePath = "/api/v1" 81 } 82 _result.Path = golangswaggerpaths.Join(_basePath, _path) 83 84 qs := make(url.Values) 85 86 var allVersionsQ string 87 if o.AllVersions != nil { 88 allVersionsQ = swag.FormatBool(*o.AllVersions) 89 } 90 if allVersionsQ != "" { 91 qs.Set("all_versions", allVersionsQ) 92 } 93 94 var bypassQ string 95 if o.Bypass != nil { 96 bypassQ = swag.FormatBool(*o.Bypass) 97 } 98 if bypassQ != "" { 99 qs.Set("bypass", bypassQ) 100 } 101 102 var nonCurrentVersionsQ string 103 if o.NonCurrentVersions != nil { 104 nonCurrentVersionsQ = swag.FormatBool(*o.NonCurrentVersions) 105 } 106 if nonCurrentVersionsQ != "" { 107 qs.Set("non_current_versions", nonCurrentVersionsQ) 108 } 109 110 prefixQ := o.Prefix 111 if prefixQ != "" { 112 qs.Set("prefix", prefixQ) 113 } 114 115 var recursiveQ string 116 if o.Recursive != nil { 117 recursiveQ = swag.FormatBool(*o.Recursive) 118 } 119 if recursiveQ != "" { 120 qs.Set("recursive", recursiveQ) 121 } 122 123 var versionIDQ string 124 if o.VersionID != nil { 125 versionIDQ = *o.VersionID 126 } 127 if versionIDQ != "" { 128 qs.Set("version_id", versionIDQ) 129 } 130 131 _result.RawQuery = qs.Encode() 132 133 return &_result, nil 134 } 135 136 // Must is a helper function to panic when the url builder returns an error 137 func (o *DeleteObjectURL) Must(u *url.URL, err error) *url.URL { 138 if err != nil { 139 panic(err) 140 } 141 if u == nil { 142 panic("url can't be nil") 143 } 144 return u 145 } 146 147 // String returns the string representation of the path with query string 148 func (o *DeleteObjectURL) String() string { 149 return o.Must(o.Build()).String() 150 } 151 152 // BuildFull builds a full url with scheme, host, path and query string 153 func (o *DeleteObjectURL) BuildFull(scheme, host string) (*url.URL, error) { 154 if scheme == "" { 155 return nil, errors.New("scheme is required for a full url on DeleteObjectURL") 156 } 157 if host == "" { 158 return nil, errors.New("host is required for a full url on DeleteObjectURL") 159 } 160 161 base, err := o.Build() 162 if err != nil { 163 return nil, err 164 } 165 166 base.Scheme = scheme 167 base.Host = host 168 return base, nil 169 } 170 171 // StringFull returns the string representation of a complete url 172 func (o *DeleteObjectURL) StringFull(scheme, host string) string { 173 return o.Must(o.BuildFull(scheme, host)).String() 174 }