github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/policy/delete_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  // DeleteFqdnCacheURL generates an URL for the delete fqdn cache operation
    15  type DeleteFqdnCacheURL struct {
    16  	Matchpattern *string
    17  
    18  	_basePath string
    19  	// avoid unkeyed usage
    20  	_ struct{}
    21  }
    22  
    23  // WithBasePath sets the base path for this url builder, only required when it's different from the
    24  // base path specified in the swagger spec.
    25  // When the value of the base path is an empty string
    26  func (o *DeleteFqdnCacheURL) WithBasePath(bp string) *DeleteFqdnCacheURL {
    27  	o.SetBasePath(bp)
    28  	return o
    29  }
    30  
    31  // SetBasePath sets the base path for this url builder, only required when it's different from the
    32  // base path specified in the swagger spec.
    33  // When the value of the base path is an empty string
    34  func (o *DeleteFqdnCacheURL) SetBasePath(bp string) {
    35  	o._basePath = bp
    36  }
    37  
    38  // Build a url path and query string
    39  func (o *DeleteFqdnCacheURL) Build() (*url.URL, error) {
    40  	var _result url.URL
    41  
    42  	var _path = "/fqdn/cache"
    43  
    44  	_basePath := o._basePath
    45  	if _basePath == "" {
    46  		_basePath = "/v1"
    47  	}
    48  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    49  
    50  	qs := make(url.Values)
    51  
    52  	var matchpattern string
    53  	if o.Matchpattern != nil {
    54  		matchpattern = *o.Matchpattern
    55  	}
    56  	if matchpattern != "" {
    57  		qs.Set("matchpattern", matchpattern)
    58  	}
    59  
    60  	_result.RawQuery = qs.Encode()
    61  
    62  	return &_result, nil
    63  }
    64  
    65  // Must is a helper function to panic when the url builder returns an error
    66  func (o *DeleteFqdnCacheURL) Must(u *url.URL, err error) *url.URL {
    67  	if err != nil {
    68  		panic(err)
    69  	}
    70  	if u == nil {
    71  		panic("url can't be nil")
    72  	}
    73  	return u
    74  }
    75  
    76  // String returns the string representation of the path with query string
    77  func (o *DeleteFqdnCacheURL) String() string {
    78  	return o.Must(o.Build()).String()
    79  }
    80  
    81  // BuildFull builds a full url with scheme, host, path and query string
    82  func (o *DeleteFqdnCacheURL) BuildFull(scheme, host string) (*url.URL, error) {
    83  	if scheme == "" {
    84  		return nil, errors.New("scheme is required for a full url on DeleteFqdnCacheURL")
    85  	}
    86  	if host == "" {
    87  		return nil, errors.New("host is required for a full url on DeleteFqdnCacheURL")
    88  	}
    89  
    90  	base, err := o.Build()
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  
    95  	base.Scheme = scheme
    96  	base.Host = host
    97  	return base, nil
    98  }
    99  
   100  // StringFull returns the string representation of a complete url
   101  func (o *DeleteFqdnCacheURL) StringFull(scheme, host string) string {
   102  	return o.Must(o.BuildFull(scheme, host)).String()
   103  }