...

Source file src/github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver/get_receivers_urlbuilder.go

Documentation: github.com/prometheus/alertmanager/api/v2/restapi/operations/receiver

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Prometheus Team
     4  // Licensed under the Apache License, Version 2.0 (the "License");
     5  // you may not use this file except in compliance with the License.
     6  // You may obtain a copy of the License at
     7  //
     8  // http://www.apache.org/licenses/LICENSE-2.0
     9  //
    10  // Unless required by applicable law or agreed to in writing, software
    11  // distributed under the License is distributed on an "AS IS" BASIS,
    12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  // See the License for the specific language governing permissions and
    14  // limitations under the License.
    15  //
    16  
    17  package receiver
    18  
    19  // This file was generated by the swagger tool.
    20  // Editing this file might prove futile when you re-run the generate command
    21  
    22  import (
    23  	"errors"
    24  	"net/url"
    25  	golangswaggerpaths "path"
    26  )
    27  
    28  // GetReceiversURL generates an URL for the get receivers operation
    29  type GetReceiversURL struct {
    30  	_basePath string
    31  }
    32  
    33  // WithBasePath sets the base path for this url builder, only required when it's different from the
    34  // base path specified in the swagger spec.
    35  // When the value of the base path is an empty string
    36  func (o *GetReceiversURL) WithBasePath(bp string) *GetReceiversURL {
    37  	o.SetBasePath(bp)
    38  	return o
    39  }
    40  
    41  // SetBasePath sets the base path for this url builder, only required when it's different from the
    42  // base path specified in the swagger spec.
    43  // When the value of the base path is an empty string
    44  func (o *GetReceiversURL) SetBasePath(bp string) {
    45  	o._basePath = bp
    46  }
    47  
    48  // Build a url path and query string
    49  func (o *GetReceiversURL) Build() (*url.URL, error) {
    50  	var _result url.URL
    51  
    52  	var _path = "/receivers"
    53  
    54  	_basePath := o._basePath
    55  	if _basePath == "" {
    56  		_basePath = "/api/v2/"
    57  	}
    58  	_result.Path = golangswaggerpaths.Join(_basePath, _path)
    59  
    60  	return &_result, nil
    61  }
    62  
    63  // Must is a helper function to panic when the url builder returns an error
    64  func (o *GetReceiversURL) Must(u *url.URL, err error) *url.URL {
    65  	if err != nil {
    66  		panic(err)
    67  	}
    68  	if u == nil {
    69  		panic("url can't be nil")
    70  	}
    71  	return u
    72  }
    73  
    74  // String returns the string representation of the path with query string
    75  func (o *GetReceiversURL) String() string {
    76  	return o.Must(o.Build()).String()
    77  }
    78  
    79  // BuildFull builds a full url with scheme, host, path and query string
    80  func (o *GetReceiversURL) BuildFull(scheme, host string) (*url.URL, error) {
    81  	if scheme == "" {
    82  		return nil, errors.New("scheme is required for a full url on GetReceiversURL")
    83  	}
    84  	if host == "" {
    85  		return nil, errors.New("host is required for a full url on GetReceiversURL")
    86  	}
    87  
    88  	base, err := o.Build()
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  
    93  	base.Scheme = scheme
    94  	base.Host = host
    95  	return base, nil
    96  }
    97  
    98  // StringFull returns the string representation of a complete url
    99  func (o *GetReceiversURL) StringFull(scheme, host string) string {
   100  	return o.Must(o.BuildFull(scheme, host)).String()
   101  }
   102  

View as plain text