github.com/minio/console@v1.4.1/api/operations/system/admin_info_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 system 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 30 "github.com/go-openapi/swag" 31 ) 32 33 // AdminInfoURL generates an URL for the admin info operation 34 type AdminInfoURL struct { 35 DefaultOnly *bool 36 37 _basePath string 38 // avoid unkeyed usage 39 _ struct{} 40 } 41 42 // WithBasePath sets the base path for this url builder, only required when it's different from the 43 // base path specified in the swagger spec. 44 // When the value of the base path is an empty string 45 func (o *AdminInfoURL) WithBasePath(bp string) *AdminInfoURL { 46 o.SetBasePath(bp) 47 return o 48 } 49 50 // SetBasePath 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 *AdminInfoURL) SetBasePath(bp string) { 54 o._basePath = bp 55 } 56 57 // Build a url path and query string 58 func (o *AdminInfoURL) Build() (*url.URL, error) { 59 var _result url.URL 60 61 var _path = "/admin/info" 62 63 _basePath := o._basePath 64 if _basePath == "" { 65 _basePath = "/api/v1" 66 } 67 _result.Path = golangswaggerpaths.Join(_basePath, _path) 68 69 qs := make(url.Values) 70 71 var defaultOnlyQ string 72 if o.DefaultOnly != nil { 73 defaultOnlyQ = swag.FormatBool(*o.DefaultOnly) 74 } 75 if defaultOnlyQ != "" { 76 qs.Set("defaultOnly", defaultOnlyQ) 77 } 78 79 _result.RawQuery = qs.Encode() 80 81 return &_result, nil 82 } 83 84 // Must is a helper function to panic when the url builder returns an error 85 func (o *AdminInfoURL) Must(u *url.URL, err error) *url.URL { 86 if err != nil { 87 panic(err) 88 } 89 if u == nil { 90 panic("url can't be nil") 91 } 92 return u 93 } 94 95 // String returns the string representation of the path with query string 96 func (o *AdminInfoURL) String() string { 97 return o.Must(o.Build()).String() 98 } 99 100 // BuildFull builds a full url with scheme, host, path and query string 101 func (o *AdminInfoURL) BuildFull(scheme, host string) (*url.URL, error) { 102 if scheme == "" { 103 return nil, errors.New("scheme is required for a full url on AdminInfoURL") 104 } 105 if host == "" { 106 return nil, errors.New("host is required for a full url on AdminInfoURL") 107 } 108 109 base, err := o.Build() 110 if err != nil { 111 return nil, err 112 } 113 114 base.Scheme = scheme 115 base.Host = host 116 return base, nil 117 } 118 119 // StringFull returns the string representation of a complete url 120 func (o *AdminInfoURL) StringFull(scheme, host string) string { 121 return o.Must(o.BuildFull(scheme, host)).String() 122 }