github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/policy/get_fqdn_cache_urlbuilder.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package policy 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 // GetFqdnCacheURL generates an URL for the get fqdn cache operation 15 type GetFqdnCacheURL struct { 16 Cidr *string 17 Matchpattern *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 *GetFqdnCacheURL) WithBasePath(bp string) *GetFqdnCacheURL { 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 *GetFqdnCacheURL) SetBasePath(bp string) { 36 o._basePath = bp 37 } 38 39 // Build a url path and query string 40 func (o *GetFqdnCacheURL) Build() (*url.URL, error) { 41 var _result url.URL 42 43 var _path = "/fqdn/cache" 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 cidr string 54 if o.Cidr != nil { 55 cidr = *o.Cidr 56 } 57 if cidr != "" { 58 qs.Set("cidr", cidr) 59 } 60 61 var matchpattern string 62 if o.Matchpattern != nil { 63 matchpattern = *o.Matchpattern 64 } 65 if matchpattern != "" { 66 qs.Set("matchpattern", matchpattern) 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 *GetFqdnCacheURL) 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 *GetFqdnCacheURL) 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 *GetFqdnCacheURL) BuildFull(scheme, host string) (*url.URL, error) { 92 if scheme == "" { 93 return nil, errors.New("scheme is required for a full url on GetFqdnCacheURL") 94 } 95 if host == "" { 96 return nil, errors.New("host is required for a full url on GetFqdnCacheURL") 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 *GetFqdnCacheURL) StringFull(scheme, host string) string { 111 return o.Must(o.BuildFull(scheme, host)).String() 112 }