github.com/cilium/cilium@v1.16.2/api/v1/client/bgp/get_bgp_route_policies_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Authors of Cilium
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package bgp
     7  
     8  // This file was generated by the swagger tool.
     9  // Editing this file might prove futile when you re-run the swagger generate command
    10  
    11  import (
    12  	"context"
    13  	"net/http"
    14  	"time"
    15  
    16  	"github.com/go-openapi/errors"
    17  	"github.com/go-openapi/runtime"
    18  	cr "github.com/go-openapi/runtime/client"
    19  	"github.com/go-openapi/strfmt"
    20  	"github.com/go-openapi/swag"
    21  )
    22  
    23  // NewGetBgpRoutePoliciesParams creates a new GetBgpRoutePoliciesParams object,
    24  // with the default timeout for this client.
    25  //
    26  // Default values are not hydrated, since defaults are normally applied by the API server side.
    27  //
    28  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    29  func NewGetBgpRoutePoliciesParams() *GetBgpRoutePoliciesParams {
    30  	return &GetBgpRoutePoliciesParams{
    31  		timeout: cr.DefaultTimeout,
    32  	}
    33  }
    34  
    35  // NewGetBgpRoutePoliciesParamsWithTimeout creates a new GetBgpRoutePoliciesParams object
    36  // with the ability to set a timeout on a request.
    37  func NewGetBgpRoutePoliciesParamsWithTimeout(timeout time.Duration) *GetBgpRoutePoliciesParams {
    38  	return &GetBgpRoutePoliciesParams{
    39  		timeout: timeout,
    40  	}
    41  }
    42  
    43  // NewGetBgpRoutePoliciesParamsWithContext creates a new GetBgpRoutePoliciesParams object
    44  // with the ability to set a context for a request.
    45  func NewGetBgpRoutePoliciesParamsWithContext(ctx context.Context) *GetBgpRoutePoliciesParams {
    46  	return &GetBgpRoutePoliciesParams{
    47  		Context: ctx,
    48  	}
    49  }
    50  
    51  // NewGetBgpRoutePoliciesParamsWithHTTPClient creates a new GetBgpRoutePoliciesParams object
    52  // with the ability to set a custom HTTPClient for a request.
    53  func NewGetBgpRoutePoliciesParamsWithHTTPClient(client *http.Client) *GetBgpRoutePoliciesParams {
    54  	return &GetBgpRoutePoliciesParams{
    55  		HTTPClient: client,
    56  	}
    57  }
    58  
    59  /*
    60  GetBgpRoutePoliciesParams contains all the parameters to send to the API endpoint
    61  
    62  	for the get bgp route policies operation.
    63  
    64  	Typically these are written to a http.Request.
    65  */
    66  type GetBgpRoutePoliciesParams struct {
    67  
    68  	/* RouterAsn.
    69  
    70  	     Autonomous System Number (ASN) identifying a BGP virtual router instance.
    71  	If not specified, all virtual router instances are selected.
    72  
    73  	*/
    74  	RouterAsn *int64
    75  
    76  	timeout    time.Duration
    77  	Context    context.Context
    78  	HTTPClient *http.Client
    79  }
    80  
    81  // WithDefaults hydrates default values in the get bgp route policies params (not the query body).
    82  //
    83  // All values with no default are reset to their zero value.
    84  func (o *GetBgpRoutePoliciesParams) WithDefaults() *GetBgpRoutePoliciesParams {
    85  	o.SetDefaults()
    86  	return o
    87  }
    88  
    89  // SetDefaults hydrates default values in the get bgp route policies params (not the query body).
    90  //
    91  // All values with no default are reset to their zero value.
    92  func (o *GetBgpRoutePoliciesParams) SetDefaults() {
    93  	// no default values defined for this parameter
    94  }
    95  
    96  // WithTimeout adds the timeout to the get bgp route policies params
    97  func (o *GetBgpRoutePoliciesParams) WithTimeout(timeout time.Duration) *GetBgpRoutePoliciesParams {
    98  	o.SetTimeout(timeout)
    99  	return o
   100  }
   101  
   102  // SetTimeout adds the timeout to the get bgp route policies params
   103  func (o *GetBgpRoutePoliciesParams) SetTimeout(timeout time.Duration) {
   104  	o.timeout = timeout
   105  }
   106  
   107  // WithContext adds the context to the get bgp route policies params
   108  func (o *GetBgpRoutePoliciesParams) WithContext(ctx context.Context) *GetBgpRoutePoliciesParams {
   109  	o.SetContext(ctx)
   110  	return o
   111  }
   112  
   113  // SetContext adds the context to the get bgp route policies params
   114  func (o *GetBgpRoutePoliciesParams) SetContext(ctx context.Context) {
   115  	o.Context = ctx
   116  }
   117  
   118  // WithHTTPClient adds the HTTPClient to the get bgp route policies params
   119  func (o *GetBgpRoutePoliciesParams) WithHTTPClient(client *http.Client) *GetBgpRoutePoliciesParams {
   120  	o.SetHTTPClient(client)
   121  	return o
   122  }
   123  
   124  // SetHTTPClient adds the HTTPClient to the get bgp route policies params
   125  func (o *GetBgpRoutePoliciesParams) SetHTTPClient(client *http.Client) {
   126  	o.HTTPClient = client
   127  }
   128  
   129  // WithRouterAsn adds the routerAsn to the get bgp route policies params
   130  func (o *GetBgpRoutePoliciesParams) WithRouterAsn(routerAsn *int64) *GetBgpRoutePoliciesParams {
   131  	o.SetRouterAsn(routerAsn)
   132  	return o
   133  }
   134  
   135  // SetRouterAsn adds the routerAsn to the get bgp route policies params
   136  func (o *GetBgpRoutePoliciesParams) SetRouterAsn(routerAsn *int64) {
   137  	o.RouterAsn = routerAsn
   138  }
   139  
   140  // WriteToRequest writes these params to a swagger request
   141  func (o *GetBgpRoutePoliciesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   142  
   143  	if err := r.SetTimeout(o.timeout); err != nil {
   144  		return err
   145  	}
   146  	var res []error
   147  
   148  	if o.RouterAsn != nil {
   149  
   150  		// query param router_asn
   151  		var qrRouterAsn int64
   152  
   153  		if o.RouterAsn != nil {
   154  			qrRouterAsn = *o.RouterAsn
   155  		}
   156  		qRouterAsn := swag.FormatInt64(qrRouterAsn)
   157  		if qRouterAsn != "" {
   158  
   159  			if err := r.SetQueryParam("router_asn", qRouterAsn); err != nil {
   160  				return err
   161  			}
   162  		}
   163  	}
   164  
   165  	if len(res) > 0 {
   166  		return errors.CompositeValidationError(res...)
   167  	}
   168  	return nil
   169  }