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