github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_connected_device_list_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright 2020 The go-netbox Authors.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //   http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  //
    17  
    18  package dcim
    19  
    20  // This file was generated by the swagger tool.
    21  // Editing this file might prove futile when you re-run the swagger generate command
    22  
    23  import (
    24  	"context"
    25  	"net/http"
    26  	"time"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/runtime"
    30  	cr "github.com/go-openapi/runtime/client"
    31  	"github.com/go-openapi/strfmt"
    32  )
    33  
    34  // NewDcimConnectedDeviceListParams creates a new DcimConnectedDeviceListParams object,
    35  // with the default timeout for this client.
    36  //
    37  // Default values are not hydrated, since defaults are normally applied by the API server side.
    38  //
    39  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    40  func NewDcimConnectedDeviceListParams() *DcimConnectedDeviceListParams {
    41  	return &DcimConnectedDeviceListParams{
    42  		timeout: cr.DefaultTimeout,
    43  	}
    44  }
    45  
    46  // NewDcimConnectedDeviceListParamsWithTimeout creates a new DcimConnectedDeviceListParams object
    47  // with the ability to set a timeout on a request.
    48  func NewDcimConnectedDeviceListParamsWithTimeout(timeout time.Duration) *DcimConnectedDeviceListParams {
    49  	return &DcimConnectedDeviceListParams{
    50  		timeout: timeout,
    51  	}
    52  }
    53  
    54  // NewDcimConnectedDeviceListParamsWithContext creates a new DcimConnectedDeviceListParams object
    55  // with the ability to set a context for a request.
    56  func NewDcimConnectedDeviceListParamsWithContext(ctx context.Context) *DcimConnectedDeviceListParams {
    57  	return &DcimConnectedDeviceListParams{
    58  		Context: ctx,
    59  	}
    60  }
    61  
    62  // NewDcimConnectedDeviceListParamsWithHTTPClient creates a new DcimConnectedDeviceListParams object
    63  // with the ability to set a custom HTTPClient for a request.
    64  func NewDcimConnectedDeviceListParamsWithHTTPClient(client *http.Client) *DcimConnectedDeviceListParams {
    65  	return &DcimConnectedDeviceListParams{
    66  		HTTPClient: client,
    67  	}
    68  }
    69  
    70  /* DcimConnectedDeviceListParams contains all the parameters to send to the API endpoint
    71     for the dcim connected device list operation.
    72  
    73     Typically these are written to a http.Request.
    74  */
    75  type DcimConnectedDeviceListParams struct {
    76  
    77  	/* PeerDevice.
    78  
    79  	   The name of the peer device
    80  	*/
    81  	PeerDevice string
    82  
    83  	/* PeerInterface.
    84  
    85  	   The name of the peer interface
    86  	*/
    87  	PeerInterface string
    88  
    89  	timeout    time.Duration
    90  	Context    context.Context
    91  	HTTPClient *http.Client
    92  }
    93  
    94  // WithDefaults hydrates default values in the dcim connected device list params (not the query body).
    95  //
    96  // All values with no default are reset to their zero value.
    97  func (o *DcimConnectedDeviceListParams) WithDefaults() *DcimConnectedDeviceListParams {
    98  	o.SetDefaults()
    99  	return o
   100  }
   101  
   102  // SetDefaults hydrates default values in the dcim connected device list params (not the query body).
   103  //
   104  // All values with no default are reset to their zero value.
   105  func (o *DcimConnectedDeviceListParams) SetDefaults() {
   106  	// no default values defined for this parameter
   107  }
   108  
   109  // WithTimeout adds the timeout to the dcim connected device list params
   110  func (o *DcimConnectedDeviceListParams) WithTimeout(timeout time.Duration) *DcimConnectedDeviceListParams {
   111  	o.SetTimeout(timeout)
   112  	return o
   113  }
   114  
   115  // SetTimeout adds the timeout to the dcim connected device list params
   116  func (o *DcimConnectedDeviceListParams) SetTimeout(timeout time.Duration) {
   117  	o.timeout = timeout
   118  }
   119  
   120  // WithContext adds the context to the dcim connected device list params
   121  func (o *DcimConnectedDeviceListParams) WithContext(ctx context.Context) *DcimConnectedDeviceListParams {
   122  	o.SetContext(ctx)
   123  	return o
   124  }
   125  
   126  // SetContext adds the context to the dcim connected device list params
   127  func (o *DcimConnectedDeviceListParams) SetContext(ctx context.Context) {
   128  	o.Context = ctx
   129  }
   130  
   131  // WithHTTPClient adds the HTTPClient to the dcim connected device list params
   132  func (o *DcimConnectedDeviceListParams) WithHTTPClient(client *http.Client) *DcimConnectedDeviceListParams {
   133  	o.SetHTTPClient(client)
   134  	return o
   135  }
   136  
   137  // SetHTTPClient adds the HTTPClient to the dcim connected device list params
   138  func (o *DcimConnectedDeviceListParams) SetHTTPClient(client *http.Client) {
   139  	o.HTTPClient = client
   140  }
   141  
   142  // WithPeerDevice adds the peerDevice to the dcim connected device list params
   143  func (o *DcimConnectedDeviceListParams) WithPeerDevice(peerDevice string) *DcimConnectedDeviceListParams {
   144  	o.SetPeerDevice(peerDevice)
   145  	return o
   146  }
   147  
   148  // SetPeerDevice adds the peerDevice to the dcim connected device list params
   149  func (o *DcimConnectedDeviceListParams) SetPeerDevice(peerDevice string) {
   150  	o.PeerDevice = peerDevice
   151  }
   152  
   153  // WithPeerInterface adds the peerInterface to the dcim connected device list params
   154  func (o *DcimConnectedDeviceListParams) WithPeerInterface(peerInterface string) *DcimConnectedDeviceListParams {
   155  	o.SetPeerInterface(peerInterface)
   156  	return o
   157  }
   158  
   159  // SetPeerInterface adds the peerInterface to the dcim connected device list params
   160  func (o *DcimConnectedDeviceListParams) SetPeerInterface(peerInterface string) {
   161  	o.PeerInterface = peerInterface
   162  }
   163  
   164  // WriteToRequest writes these params to a swagger request
   165  func (o *DcimConnectedDeviceListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   166  
   167  	if err := r.SetTimeout(o.timeout); err != nil {
   168  		return err
   169  	}
   170  	var res []error
   171  
   172  	// query param peer_device
   173  	qrPeerDevice := o.PeerDevice
   174  	qPeerDevice := qrPeerDevice
   175  	if qPeerDevice != "" {
   176  
   177  		if err := r.SetQueryParam("peer_device", qPeerDevice); err != nil {
   178  			return err
   179  		}
   180  	}
   181  
   182  	// query param peer_interface
   183  	qrPeerInterface := o.PeerInterface
   184  	qPeerInterface := qrPeerInterface
   185  	if qPeerInterface != "" {
   186  
   187  		if err := r.SetQueryParam("peer_interface", qPeerInterface); err != nil {
   188  			return err
   189  		}
   190  	}
   191  
   192  	if len(res) > 0 {
   193  		return errors.CompositeValidationError(res...)
   194  	}
   195  	return nil
   196  }