github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/ipam/post_ip_a_m_urlbuilder.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package ipam 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the generate command 7 8 import ( 9 "errors" 10 "net/url" 11 golangswaggerpaths "path" 12 ) 13 14 // PostIPAMURL generates an URL for the post IP a m operation 15 type PostIPAMURL struct { 16 Family *string 17 Owner *string 18 19 _basePath string 20 // avoid unkeyed usage 21 _ struct{} 22 } 23 24 // WithBasePath sets the base path for this url builder, only required when it's different from the 25 // base path specified in the swagger spec. 26 // When the value of the base path is an empty string 27 func (o *PostIPAMURL) WithBasePath(bp string) *PostIPAMURL { 28 o.SetBasePath(bp) 29 return o 30 } 31 32 // SetBasePath sets the base path for this url builder, only required when it's different from the 33 // base path specified in the swagger spec. 34 // When the value of the base path is an empty string 35 func (o *PostIPAMURL) SetBasePath(bp string) { 36 o._basePath = bp 37 } 38 39 // Build a url path and query string 40 func (o *PostIPAMURL) Build() (*url.URL, error) { 41 var _result url.URL 42 43 var _path = "/ipam" 44 45 _basePath := o._basePath 46 if _basePath == "" { 47 _basePath = "/v1" 48 } 49 _result.Path = golangswaggerpaths.Join(_basePath, _path) 50 51 qs := make(url.Values) 52 53 var family string 54 if o.Family != nil { 55 family = *o.Family 56 } 57 if family != "" { 58 qs.Set("family", family) 59 } 60 61 var owner string 62 if o.Owner != nil { 63 owner = *o.Owner 64 } 65 if owner != "" { 66 qs.Set("owner", owner) 67 } 68 69 _result.RawQuery = qs.Encode() 70 71 return &_result, nil 72 } 73 74 // Must is a helper function to panic when the url builder returns an error 75 func (o *PostIPAMURL) Must(u *url.URL, err error) *url.URL { 76 if err != nil { 77 panic(err) 78 } 79 if u == nil { 80 panic("url can't be nil") 81 } 82 return u 83 } 84 85 // String returns the string representation of the path with query string 86 func (o *PostIPAMURL) String() string { 87 return o.Must(o.Build()).String() 88 } 89 90 // BuildFull builds a full url with scheme, host, path and query string 91 func (o *PostIPAMURL) BuildFull(scheme, host string) (*url.URL, error) { 92 if scheme == "" { 93 return nil, errors.New("scheme is required for a full url on PostIPAMURL") 94 } 95 if host == "" { 96 return nil, errors.New("host is required for a full url on PostIPAMURL") 97 } 98 99 base, err := o.Build() 100 if err != nil { 101 return nil, err 102 } 103 104 base.Scheme = scheme 105 base.Host = host 106 return base, nil 107 } 108 109 // StringFull returns the string representation of a complete url 110 func (o *PostIPAMURL) StringFull(scheme, host string) string { 111 return o.Must(o.BuildFull(scheme, host)).String() 112 }