...

Source file src/github.com/prometheus/alertmanager/api/v2/client/receiver/get_receivers_parameters.go

Documentation: github.com/prometheus/alertmanager/api/v2/client/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 swagger generate command
    21  
    22  import (
    23  	"context"
    24  	"net/http"
    25  	"time"
    26  
    27  	"github.com/go-openapi/errors"
    28  	"github.com/go-openapi/runtime"
    29  	cr "github.com/go-openapi/runtime/client"
    30  	"github.com/go-openapi/strfmt"
    31  )
    32  
    33  // NewGetReceiversParams creates a new GetReceiversParams object,
    34  // with the default timeout for this client.
    35  //
    36  // Default values are not hydrated, since defaults are normally applied by the API server side.
    37  //
    38  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    39  func NewGetReceiversParams() *GetReceiversParams {
    40  	return &GetReceiversParams{
    41  		timeout: cr.DefaultTimeout,
    42  	}
    43  }
    44  
    45  // NewGetReceiversParamsWithTimeout creates a new GetReceiversParams object
    46  // with the ability to set a timeout on a request.
    47  func NewGetReceiversParamsWithTimeout(timeout time.Duration) *GetReceiversParams {
    48  	return &GetReceiversParams{
    49  		timeout: timeout,
    50  	}
    51  }
    52  
    53  // NewGetReceiversParamsWithContext creates a new GetReceiversParams object
    54  // with the ability to set a context for a request.
    55  func NewGetReceiversParamsWithContext(ctx context.Context) *GetReceiversParams {
    56  	return &GetReceiversParams{
    57  		Context: ctx,
    58  	}
    59  }
    60  
    61  // NewGetReceiversParamsWithHTTPClient creates a new GetReceiversParams object
    62  // with the ability to set a custom HTTPClient for a request.
    63  func NewGetReceiversParamsWithHTTPClient(client *http.Client) *GetReceiversParams {
    64  	return &GetReceiversParams{
    65  		HTTPClient: client,
    66  	}
    67  }
    68  
    69  /*
    70  GetReceiversParams contains all the parameters to send to the API endpoint
    71  
    72  	for the get receivers operation.
    73  
    74  	Typically these are written to a http.Request.
    75  */
    76  type GetReceiversParams struct {
    77  	timeout    time.Duration
    78  	Context    context.Context
    79  	HTTPClient *http.Client
    80  }
    81  
    82  // WithDefaults hydrates default values in the get receivers params (not the query body).
    83  //
    84  // All values with no default are reset to their zero value.
    85  func (o *GetReceiversParams) WithDefaults() *GetReceiversParams {
    86  	o.SetDefaults()
    87  	return o
    88  }
    89  
    90  // SetDefaults hydrates default values in the get receivers params (not the query body).
    91  //
    92  // All values with no default are reset to their zero value.
    93  func (o *GetReceiversParams) SetDefaults() {
    94  	// no default values defined for this parameter
    95  }
    96  
    97  // WithTimeout adds the timeout to the get receivers params
    98  func (o *GetReceiversParams) WithTimeout(timeout time.Duration) *GetReceiversParams {
    99  	o.SetTimeout(timeout)
   100  	return o
   101  }
   102  
   103  // SetTimeout adds the timeout to the get receivers params
   104  func (o *GetReceiversParams) SetTimeout(timeout time.Duration) {
   105  	o.timeout = timeout
   106  }
   107  
   108  // WithContext adds the context to the get receivers params
   109  func (o *GetReceiversParams) WithContext(ctx context.Context) *GetReceiversParams {
   110  	o.SetContext(ctx)
   111  	return o
   112  }
   113  
   114  // SetContext adds the context to the get receivers params
   115  func (o *GetReceiversParams) SetContext(ctx context.Context) {
   116  	o.Context = ctx
   117  }
   118  
   119  // WithHTTPClient adds the HTTPClient to the get receivers params
   120  func (o *GetReceiversParams) WithHTTPClient(client *http.Client) *GetReceiversParams {
   121  	o.SetHTTPClient(client)
   122  	return o
   123  }
   124  
   125  // SetHTTPClient adds the HTTPClient to the get receivers params
   126  func (o *GetReceiversParams) SetHTTPClient(client *http.Client) {
   127  	o.HTTPClient = client
   128  }
   129  
   130  // WriteToRequest writes these params to a swagger request
   131  func (o *GetReceiversParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   132  
   133  	if err := r.SetTimeout(o.timeout); err != nil {
   134  		return err
   135  	}
   136  	var res []error
   137  
   138  	if len(res) > 0 {
   139  		return errors.CompositeValidationError(res...)
   140  	}
   141  	return nil
   142  }
   143  

View as plain text