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