github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_interface_connections_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  	"github.com/go-openapi/swag"
    33  )
    34  
    35  // NewDcimInterfaceConnectionsListParams creates a new DcimInterfaceConnectionsListParams object,
    36  // with the default timeout for this client.
    37  //
    38  // Default values are not hydrated, since defaults are normally applied by the API server side.
    39  //
    40  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    41  func NewDcimInterfaceConnectionsListParams() *DcimInterfaceConnectionsListParams {
    42  	return &DcimInterfaceConnectionsListParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewDcimInterfaceConnectionsListParamsWithTimeout creates a new DcimInterfaceConnectionsListParams object
    48  // with the ability to set a timeout on a request.
    49  func NewDcimInterfaceConnectionsListParamsWithTimeout(timeout time.Duration) *DcimInterfaceConnectionsListParams {
    50  	return &DcimInterfaceConnectionsListParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewDcimInterfaceConnectionsListParamsWithContext creates a new DcimInterfaceConnectionsListParams object
    56  // with the ability to set a context for a request.
    57  func NewDcimInterfaceConnectionsListParamsWithContext(ctx context.Context) *DcimInterfaceConnectionsListParams {
    58  	return &DcimInterfaceConnectionsListParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewDcimInterfaceConnectionsListParamsWithHTTPClient creates a new DcimInterfaceConnectionsListParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewDcimInterfaceConnectionsListParamsWithHTTPClient(client *http.Client) *DcimInterfaceConnectionsListParams {
    66  	return &DcimInterfaceConnectionsListParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /* DcimInterfaceConnectionsListParams contains all the parameters to send to the API endpoint
    72     for the dcim interface connections list operation.
    73  
    74     Typically these are written to a http.Request.
    75  */
    76  type DcimInterfaceConnectionsListParams struct {
    77  
    78  	// Device.
    79  	Device *string
    80  
    81  	// DeviceID.
    82  	DeviceID *string
    83  
    84  	/* Limit.
    85  
    86  	   Number of results to return per page.
    87  	*/
    88  	Limit *int64
    89  
    90  	/* Offset.
    91  
    92  	   The initial index from which to return the results.
    93  	*/
    94  	Offset *int64
    95  
    96  	// Site.
    97  	Site *string
    98  
    99  	timeout    time.Duration
   100  	Context    context.Context
   101  	HTTPClient *http.Client
   102  }
   103  
   104  // WithDefaults hydrates default values in the dcim interface connections list params (not the query body).
   105  //
   106  // All values with no default are reset to their zero value.
   107  func (o *DcimInterfaceConnectionsListParams) WithDefaults() *DcimInterfaceConnectionsListParams {
   108  	o.SetDefaults()
   109  	return o
   110  }
   111  
   112  // SetDefaults hydrates default values in the dcim interface connections list params (not the query body).
   113  //
   114  // All values with no default are reset to their zero value.
   115  func (o *DcimInterfaceConnectionsListParams) SetDefaults() {
   116  	// no default values defined for this parameter
   117  }
   118  
   119  // WithTimeout adds the timeout to the dcim interface connections list params
   120  func (o *DcimInterfaceConnectionsListParams) WithTimeout(timeout time.Duration) *DcimInterfaceConnectionsListParams {
   121  	o.SetTimeout(timeout)
   122  	return o
   123  }
   124  
   125  // SetTimeout adds the timeout to the dcim interface connections list params
   126  func (o *DcimInterfaceConnectionsListParams) SetTimeout(timeout time.Duration) {
   127  	o.timeout = timeout
   128  }
   129  
   130  // WithContext adds the context to the dcim interface connections list params
   131  func (o *DcimInterfaceConnectionsListParams) WithContext(ctx context.Context) *DcimInterfaceConnectionsListParams {
   132  	o.SetContext(ctx)
   133  	return o
   134  }
   135  
   136  // SetContext adds the context to the dcim interface connections list params
   137  func (o *DcimInterfaceConnectionsListParams) SetContext(ctx context.Context) {
   138  	o.Context = ctx
   139  }
   140  
   141  // WithHTTPClient adds the HTTPClient to the dcim interface connections list params
   142  func (o *DcimInterfaceConnectionsListParams) WithHTTPClient(client *http.Client) *DcimInterfaceConnectionsListParams {
   143  	o.SetHTTPClient(client)
   144  	return o
   145  }
   146  
   147  // SetHTTPClient adds the HTTPClient to the dcim interface connections list params
   148  func (o *DcimInterfaceConnectionsListParams) SetHTTPClient(client *http.Client) {
   149  	o.HTTPClient = client
   150  }
   151  
   152  // WithDevice adds the device to the dcim interface connections list params
   153  func (o *DcimInterfaceConnectionsListParams) WithDevice(device *string) *DcimInterfaceConnectionsListParams {
   154  	o.SetDevice(device)
   155  	return o
   156  }
   157  
   158  // SetDevice adds the device to the dcim interface connections list params
   159  func (o *DcimInterfaceConnectionsListParams) SetDevice(device *string) {
   160  	o.Device = device
   161  }
   162  
   163  // WithDeviceID adds the deviceID to the dcim interface connections list params
   164  func (o *DcimInterfaceConnectionsListParams) WithDeviceID(deviceID *string) *DcimInterfaceConnectionsListParams {
   165  	o.SetDeviceID(deviceID)
   166  	return o
   167  }
   168  
   169  // SetDeviceID adds the deviceId to the dcim interface connections list params
   170  func (o *DcimInterfaceConnectionsListParams) SetDeviceID(deviceID *string) {
   171  	o.DeviceID = deviceID
   172  }
   173  
   174  // WithLimit adds the limit to the dcim interface connections list params
   175  func (o *DcimInterfaceConnectionsListParams) WithLimit(limit *int64) *DcimInterfaceConnectionsListParams {
   176  	o.SetLimit(limit)
   177  	return o
   178  }
   179  
   180  // SetLimit adds the limit to the dcim interface connections list params
   181  func (o *DcimInterfaceConnectionsListParams) SetLimit(limit *int64) {
   182  	o.Limit = limit
   183  }
   184  
   185  // WithOffset adds the offset to the dcim interface connections list params
   186  func (o *DcimInterfaceConnectionsListParams) WithOffset(offset *int64) *DcimInterfaceConnectionsListParams {
   187  	o.SetOffset(offset)
   188  	return o
   189  }
   190  
   191  // SetOffset adds the offset to the dcim interface connections list params
   192  func (o *DcimInterfaceConnectionsListParams) SetOffset(offset *int64) {
   193  	o.Offset = offset
   194  }
   195  
   196  // WithSite adds the site to the dcim interface connections list params
   197  func (o *DcimInterfaceConnectionsListParams) WithSite(site *string) *DcimInterfaceConnectionsListParams {
   198  	o.SetSite(site)
   199  	return o
   200  }
   201  
   202  // SetSite adds the site to the dcim interface connections list params
   203  func (o *DcimInterfaceConnectionsListParams) SetSite(site *string) {
   204  	o.Site = site
   205  }
   206  
   207  // WriteToRequest writes these params to a swagger request
   208  func (o *DcimInterfaceConnectionsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   209  
   210  	if err := r.SetTimeout(o.timeout); err != nil {
   211  		return err
   212  	}
   213  	var res []error
   214  
   215  	if o.Device != nil {
   216  
   217  		// query param device
   218  		var qrDevice string
   219  
   220  		if o.Device != nil {
   221  			qrDevice = *o.Device
   222  		}
   223  		qDevice := qrDevice
   224  		if qDevice != "" {
   225  
   226  			if err := r.SetQueryParam("device", qDevice); err != nil {
   227  				return err
   228  			}
   229  		}
   230  	}
   231  
   232  	if o.DeviceID != nil {
   233  
   234  		// query param device_id
   235  		var qrDeviceID string
   236  
   237  		if o.DeviceID != nil {
   238  			qrDeviceID = *o.DeviceID
   239  		}
   240  		qDeviceID := qrDeviceID
   241  		if qDeviceID != "" {
   242  
   243  			if err := r.SetQueryParam("device_id", qDeviceID); err != nil {
   244  				return err
   245  			}
   246  		}
   247  	}
   248  
   249  	if o.Limit != nil {
   250  
   251  		// query param limit
   252  		var qrLimit int64
   253  
   254  		if o.Limit != nil {
   255  			qrLimit = *o.Limit
   256  		}
   257  		qLimit := swag.FormatInt64(qrLimit)
   258  		if qLimit != "" {
   259  
   260  			if err := r.SetQueryParam("limit", qLimit); err != nil {
   261  				return err
   262  			}
   263  		}
   264  	}
   265  
   266  	if o.Offset != nil {
   267  
   268  		// query param offset
   269  		var qrOffset int64
   270  
   271  		if o.Offset != nil {
   272  			qrOffset = *o.Offset
   273  		}
   274  		qOffset := swag.FormatInt64(qrOffset)
   275  		if qOffset != "" {
   276  
   277  			if err := r.SetQueryParam("offset", qOffset); err != nil {
   278  				return err
   279  			}
   280  		}
   281  	}
   282  
   283  	if o.Site != nil {
   284  
   285  		// query param site
   286  		var qrSite string
   287  
   288  		if o.Site != nil {
   289  			qrSite = *o.Site
   290  		}
   291  		qSite := qrSite
   292  		if qSite != "" {
   293  
   294  			if err := r.SetQueryParam("site", qSite); err != nil {
   295  				return err
   296  			}
   297  		}
   298  	}
   299  
   300  	if len(res) > 0 {
   301  		return errors.CompositeValidationError(res...)
   302  	}
   303  	return nil
   304  }