github.com/kubearmor/cilium@v1.6.12/api/v1/health/server/restapi/get_healthz_urlbuilder.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package restapi
     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  // GetHealthzURL generates an URL for the get healthz operation
    15  type GetHealthzURL struct {
    16  	_basePath string
    17  }
    18  
    19  // WithBasePath sets the base path for this url builder, only required when it's different from the
    20  // base path specified in the swagger spec.
    21  // When the value of the base path is an empty string
    22  func (o *GetHealthzURL) WithBasePath(bp string) *GetHealthzURL {
    23  	o.SetBasePath(bp)
    24  	return o
    25  }
    26  
    27  // SetBasePath sets the base path for this url builder, only required when it's different from the
    28  // base path specified in the swagger spec.
    29  // When the value of the base path is an empty string
    30  func (o *GetHealthzURL) SetBasePath(bp string) {
    31  	o._basePath = bp
    32  }
    33  
    34  // Build a url path and query string
    35  func (o *GetHealthzURL) Build() (*url.URL, error) {
    36  	var _result url.URL
    37  
    38  	var _path = "/healthz"
    39  
    40  	_basePath := o._basePath
    41  	if _basePath == "" {
    42  		_basePath = "/v1beta"
    43  	}
    44  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    45  
    46  	return &_result, nil
    47  }
    48  
    49  // Must is a helper function to panic when the url builder returns an error
    50  func (o *GetHealthzURL) Must(u *url.URL, err error) *url.URL {
    51  	if err != nil {
    52  		panic(err)
    53  	}
    54  	if u == nil {
    55  		panic("url can't be nil")
    56  	}
    57  	return u
    58  }
    59  
    60  // String returns the string representation of the path with query string
    61  func (o *GetHealthzURL) String() string {
    62  	return o.Must(o.Build()).String()
    63  }
    64  
    65  // BuildFull builds a full url with scheme, host, path and query string
    66  func (o *GetHealthzURL) BuildFull(scheme, host string) (*url.URL, error) {
    67  	if scheme == "" {
    68  		return nil, errors.New("scheme is required for a full url on GetHealthzURL")
    69  	}
    70  	if host == "" {
    71  		return nil, errors.New("host is required for a full url on GetHealthzURL")
    72  	}
    73  
    74  	base, err := o.Build()
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  
    79  	base.Scheme = scheme
    80  	base.Host = host
    81  	return base, nil
    82  }
    83  
    84  // StringFull returns the string representation of a complete url
    85  func (o *GetHealthzURL) StringFull(scheme, host string) string {
    86  	return o.Must(o.BuildFull(scheme, host)).String()
    87  }