github.com/minio/console@v1.4.1/api/operations/bucket/get_bucket_rewind_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 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 "errors" 27 "net/url" 28 golangswaggerpaths "path" 29 "strings" 30 ) 31 32 // GetBucketRewindURL generates an URL for the get bucket rewind operation 33 type GetBucketRewindURL struct { 34 BucketName string 35 Date string 36 37 Prefix *string 38 39 _basePath string 40 // avoid unkeyed usage 41 _ struct{} 42 } 43 44 // WithBasePath sets the base path for this url builder, only required when it's different from the 45 // base path specified in the swagger spec. 46 // When the value of the base path is an empty string 47 func (o *GetBucketRewindURL) WithBasePath(bp string) *GetBucketRewindURL { 48 o.SetBasePath(bp) 49 return o 50 } 51 52 // SetBasePath sets the base path for this url builder, only required when it's different from the 53 // base path specified in the swagger spec. 54 // When the value of the base path is an empty string 55 func (o *GetBucketRewindURL) SetBasePath(bp string) { 56 o._basePath = bp 57 } 58 59 // Build a url path and query string 60 func (o *GetBucketRewindURL) Build() (*url.URL, error) { 61 var _result url.URL 62 63 var _path = "/buckets/{bucket_name}/rewind/{date}" 64 65 bucketName := o.BucketName 66 if bucketName != "" { 67 _path = strings.Replace(_path, "{bucket_name}", bucketName, -1) 68 } else { 69 return nil, errors.New("bucketName is required on GetBucketRewindURL") 70 } 71 72 date := o.Date 73 if date != "" { 74 _path = strings.Replace(_path, "{date}", date, -1) 75 } else { 76 return nil, errors.New("date is required on GetBucketRewindURL") 77 } 78 79 _basePath := o._basePath 80 if _basePath == "" { 81 _basePath = "/api/v1" 82 } 83 _result.Path = golangswaggerpaths.Join(_basePath, _path) 84 85 qs := make(url.Values) 86 87 var prefixQ string 88 if o.Prefix != nil { 89 prefixQ = *o.Prefix 90 } 91 if prefixQ != "" { 92 qs.Set("prefix", prefixQ) 93 } 94 95 _result.RawQuery = qs.Encode() 96 97 return &_result, nil 98 } 99 100 // Must is a helper function to panic when the url builder returns an error 101 func (o *GetBucketRewindURL) Must(u *url.URL, err error) *url.URL { 102 if err != nil { 103 panic(err) 104 } 105 if u == nil { 106 panic("url can't be nil") 107 } 108 return u 109 } 110 111 // String returns the string representation of the path with query string 112 func (o *GetBucketRewindURL) String() string { 113 return o.Must(o.Build()).String() 114 } 115 116 // BuildFull builds a full url with scheme, host, path and query string 117 func (o *GetBucketRewindURL) BuildFull(scheme, host string) (*url.URL, error) { 118 if scheme == "" { 119 return nil, errors.New("scheme is required for a full url on GetBucketRewindURL") 120 } 121 if host == "" { 122 return nil, errors.New("host is required for a full url on GetBucketRewindURL") 123 } 124 125 base, err := o.Build() 126 if err != nil { 127 return nil, err 128 } 129 130 base.Scheme = scheme 131 base.Host = host 132 return base, nil 133 } 134 135 // StringFull returns the string representation of a complete url 136 func (o *GetBucketRewindURL) StringFull(scheme, host string) string { 137 return o.Must(o.BuildFull(scheme, host)).String() 138 }