...

Source file src/github.com/prometheus/alertmanager/api/v2/client/silence/get_silence_parameters.go

Documentation: github.com/prometheus/alertmanager/api/v2/client/silence

     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 silence
    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  // NewGetSilenceParams creates a new GetSilenceParams 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 NewGetSilenceParams() *GetSilenceParams {
    40  	return &GetSilenceParams{
    41  		timeout: cr.DefaultTimeout,
    42  	}
    43  }
    44  
    45  // NewGetSilenceParamsWithTimeout creates a new GetSilenceParams object
    46  // with the ability to set a timeout on a request.
    47  func NewGetSilenceParamsWithTimeout(timeout time.Duration) *GetSilenceParams {
    48  	return &GetSilenceParams{
    49  		timeout: timeout,
    50  	}
    51  }
    52  
    53  // NewGetSilenceParamsWithContext creates a new GetSilenceParams object
    54  // with the ability to set a context for a request.
    55  func NewGetSilenceParamsWithContext(ctx context.Context) *GetSilenceParams {
    56  	return &GetSilenceParams{
    57  		Context: ctx,
    58  	}
    59  }
    60  
    61  // NewGetSilenceParamsWithHTTPClient creates a new GetSilenceParams object
    62  // with the ability to set a custom HTTPClient for a request.
    63  func NewGetSilenceParamsWithHTTPClient(client *http.Client) *GetSilenceParams {
    64  	return &GetSilenceParams{
    65  		HTTPClient: client,
    66  	}
    67  }
    68  
    69  /*
    70  GetSilenceParams contains all the parameters to send to the API endpoint
    71  
    72  	for the get silence operation.
    73  
    74  	Typically these are written to a http.Request.
    75  */
    76  type GetSilenceParams struct {
    77  
    78  	/* SilenceID.
    79  
    80  	   ID of the silence to get
    81  
    82  	   Format: uuid
    83  	*/
    84  	SilenceID strfmt.UUID
    85  
    86  	timeout    time.Duration
    87  	Context    context.Context
    88  	HTTPClient *http.Client
    89  }
    90  
    91  // WithDefaults hydrates default values in the get silence params (not the query body).
    92  //
    93  // All values with no default are reset to their zero value.
    94  func (o *GetSilenceParams) WithDefaults() *GetSilenceParams {
    95  	o.SetDefaults()
    96  	return o
    97  }
    98  
    99  // SetDefaults hydrates default values in the get silence params (not the query body).
   100  //
   101  // All values with no default are reset to their zero value.
   102  func (o *GetSilenceParams) SetDefaults() {
   103  	// no default values defined for this parameter
   104  }
   105  
   106  // WithTimeout adds the timeout to the get silence params
   107  func (o *GetSilenceParams) WithTimeout(timeout time.Duration) *GetSilenceParams {
   108  	o.SetTimeout(timeout)
   109  	return o
   110  }
   111  
   112  // SetTimeout adds the timeout to the get silence params
   113  func (o *GetSilenceParams) SetTimeout(timeout time.Duration) {
   114  	o.timeout = timeout
   115  }
   116  
   117  // WithContext adds the context to the get silence params
   118  func (o *GetSilenceParams) WithContext(ctx context.Context) *GetSilenceParams {
   119  	o.SetContext(ctx)
   120  	return o
   121  }
   122  
   123  // SetContext adds the context to the get silence params
   124  func (o *GetSilenceParams) SetContext(ctx context.Context) {
   125  	o.Context = ctx
   126  }
   127  
   128  // WithHTTPClient adds the HTTPClient to the get silence params
   129  func (o *GetSilenceParams) WithHTTPClient(client *http.Client) *GetSilenceParams {
   130  	o.SetHTTPClient(client)
   131  	return o
   132  }
   133  
   134  // SetHTTPClient adds the HTTPClient to the get silence params
   135  func (o *GetSilenceParams) SetHTTPClient(client *http.Client) {
   136  	o.HTTPClient = client
   137  }
   138  
   139  // WithSilenceID adds the silenceID to the get silence params
   140  func (o *GetSilenceParams) WithSilenceID(silenceID strfmt.UUID) *GetSilenceParams {
   141  	o.SetSilenceID(silenceID)
   142  	return o
   143  }
   144  
   145  // SetSilenceID adds the silenceId to the get silence params
   146  func (o *GetSilenceParams) SetSilenceID(silenceID strfmt.UUID) {
   147  	o.SilenceID = silenceID
   148  }
   149  
   150  // WriteToRequest writes these params to a swagger request
   151  func (o *GetSilenceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   152  
   153  	if err := r.SetTimeout(o.timeout); err != nil {
   154  		return err
   155  	}
   156  	var res []error
   157  
   158  	// path param silenceID
   159  	if err := r.SetPathParam("silenceID", o.SilenceID.String()); err != nil {
   160  		return err
   161  	}
   162  
   163  	if len(res) > 0 {
   164  		return errors.CompositeValidationError(res...)
   165  	}
   166  	return nil
   167  }
   168  

View as plain text