github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_power_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  // NewDcimPowerConnectionsListParams creates a new DcimPowerConnectionsListParams 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 NewDcimPowerConnectionsListParams() *DcimPowerConnectionsListParams {
    42  	return &DcimPowerConnectionsListParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewDcimPowerConnectionsListParamsWithTimeout creates a new DcimPowerConnectionsListParams object
    48  // with the ability to set a timeout on a request.
    49  func NewDcimPowerConnectionsListParamsWithTimeout(timeout time.Duration) *DcimPowerConnectionsListParams {
    50  	return &DcimPowerConnectionsListParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewDcimPowerConnectionsListParamsWithContext creates a new DcimPowerConnectionsListParams object
    56  // with the ability to set a context for a request.
    57  func NewDcimPowerConnectionsListParamsWithContext(ctx context.Context) *DcimPowerConnectionsListParams {
    58  	return &DcimPowerConnectionsListParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewDcimPowerConnectionsListParamsWithHTTPClient creates a new DcimPowerConnectionsListParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewDcimPowerConnectionsListParamsWithHTTPClient(client *http.Client) *DcimPowerConnectionsListParams {
    66  	return &DcimPowerConnectionsListParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /* DcimPowerConnectionsListParams contains all the parameters to send to the API endpoint
    72     for the dcim power connections list operation.
    73  
    74     Typically these are written to a http.Request.
    75  */
    76  type DcimPowerConnectionsListParams 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  	// Name.
    91  	Name *string
    92  
    93  	// NameEmpty.
    94  	NameEmpty *string
    95  
    96  	// NameIc.
    97  	NameIc *string
    98  
    99  	// NameIe.
   100  	NameIe *string
   101  
   102  	// NameIew.
   103  	NameIew *string
   104  
   105  	// NameIsw.
   106  	NameIsw *string
   107  
   108  	// Namen.
   109  	Namen *string
   110  
   111  	// NameNic.
   112  	NameNic *string
   113  
   114  	// NameNie.
   115  	NameNie *string
   116  
   117  	// NameNiew.
   118  	NameNiew *string
   119  
   120  	// NameNisw.
   121  	NameNisw *string
   122  
   123  	/* Offset.
   124  
   125  	   The initial index from which to return the results.
   126  	*/
   127  	Offset *int64
   128  
   129  	// Site.
   130  	Site *string
   131  
   132  	timeout    time.Duration
   133  	Context    context.Context
   134  	HTTPClient *http.Client
   135  }
   136  
   137  // WithDefaults hydrates default values in the dcim power connections list params (not the query body).
   138  //
   139  // All values with no default are reset to their zero value.
   140  func (o *DcimPowerConnectionsListParams) WithDefaults() *DcimPowerConnectionsListParams {
   141  	o.SetDefaults()
   142  	return o
   143  }
   144  
   145  // SetDefaults hydrates default values in the dcim power connections list params (not the query body).
   146  //
   147  // All values with no default are reset to their zero value.
   148  func (o *DcimPowerConnectionsListParams) SetDefaults() {
   149  	// no default values defined for this parameter
   150  }
   151  
   152  // WithTimeout adds the timeout to the dcim power connections list params
   153  func (o *DcimPowerConnectionsListParams) WithTimeout(timeout time.Duration) *DcimPowerConnectionsListParams {
   154  	o.SetTimeout(timeout)
   155  	return o
   156  }
   157  
   158  // SetTimeout adds the timeout to the dcim power connections list params
   159  func (o *DcimPowerConnectionsListParams) SetTimeout(timeout time.Duration) {
   160  	o.timeout = timeout
   161  }
   162  
   163  // WithContext adds the context to the dcim power connections list params
   164  func (o *DcimPowerConnectionsListParams) WithContext(ctx context.Context) *DcimPowerConnectionsListParams {
   165  	o.SetContext(ctx)
   166  	return o
   167  }
   168  
   169  // SetContext adds the context to the dcim power connections list params
   170  func (o *DcimPowerConnectionsListParams) SetContext(ctx context.Context) {
   171  	o.Context = ctx
   172  }
   173  
   174  // WithHTTPClient adds the HTTPClient to the dcim power connections list params
   175  func (o *DcimPowerConnectionsListParams) WithHTTPClient(client *http.Client) *DcimPowerConnectionsListParams {
   176  	o.SetHTTPClient(client)
   177  	return o
   178  }
   179  
   180  // SetHTTPClient adds the HTTPClient to the dcim power connections list params
   181  func (o *DcimPowerConnectionsListParams) SetHTTPClient(client *http.Client) {
   182  	o.HTTPClient = client
   183  }
   184  
   185  // WithDevice adds the device to the dcim power connections list params
   186  func (o *DcimPowerConnectionsListParams) WithDevice(device *string) *DcimPowerConnectionsListParams {
   187  	o.SetDevice(device)
   188  	return o
   189  }
   190  
   191  // SetDevice adds the device to the dcim power connections list params
   192  func (o *DcimPowerConnectionsListParams) SetDevice(device *string) {
   193  	o.Device = device
   194  }
   195  
   196  // WithDeviceID adds the deviceID to the dcim power connections list params
   197  func (o *DcimPowerConnectionsListParams) WithDeviceID(deviceID *string) *DcimPowerConnectionsListParams {
   198  	o.SetDeviceID(deviceID)
   199  	return o
   200  }
   201  
   202  // SetDeviceID adds the deviceId to the dcim power connections list params
   203  func (o *DcimPowerConnectionsListParams) SetDeviceID(deviceID *string) {
   204  	o.DeviceID = deviceID
   205  }
   206  
   207  // WithLimit adds the limit to the dcim power connections list params
   208  func (o *DcimPowerConnectionsListParams) WithLimit(limit *int64) *DcimPowerConnectionsListParams {
   209  	o.SetLimit(limit)
   210  	return o
   211  }
   212  
   213  // SetLimit adds the limit to the dcim power connections list params
   214  func (o *DcimPowerConnectionsListParams) SetLimit(limit *int64) {
   215  	o.Limit = limit
   216  }
   217  
   218  // WithName adds the name to the dcim power connections list params
   219  func (o *DcimPowerConnectionsListParams) WithName(name *string) *DcimPowerConnectionsListParams {
   220  	o.SetName(name)
   221  	return o
   222  }
   223  
   224  // SetName adds the name to the dcim power connections list params
   225  func (o *DcimPowerConnectionsListParams) SetName(name *string) {
   226  	o.Name = name
   227  }
   228  
   229  // WithNameEmpty adds the nameEmpty to the dcim power connections list params
   230  func (o *DcimPowerConnectionsListParams) WithNameEmpty(nameEmpty *string) *DcimPowerConnectionsListParams {
   231  	o.SetNameEmpty(nameEmpty)
   232  	return o
   233  }
   234  
   235  // SetNameEmpty adds the nameEmpty to the dcim power connections list params
   236  func (o *DcimPowerConnectionsListParams) SetNameEmpty(nameEmpty *string) {
   237  	o.NameEmpty = nameEmpty
   238  }
   239  
   240  // WithNameIc adds the nameIc to the dcim power connections list params
   241  func (o *DcimPowerConnectionsListParams) WithNameIc(nameIc *string) *DcimPowerConnectionsListParams {
   242  	o.SetNameIc(nameIc)
   243  	return o
   244  }
   245  
   246  // SetNameIc adds the nameIc to the dcim power connections list params
   247  func (o *DcimPowerConnectionsListParams) SetNameIc(nameIc *string) {
   248  	o.NameIc = nameIc
   249  }
   250  
   251  // WithNameIe adds the nameIe to the dcim power connections list params
   252  func (o *DcimPowerConnectionsListParams) WithNameIe(nameIe *string) *DcimPowerConnectionsListParams {
   253  	o.SetNameIe(nameIe)
   254  	return o
   255  }
   256  
   257  // SetNameIe adds the nameIe to the dcim power connections list params
   258  func (o *DcimPowerConnectionsListParams) SetNameIe(nameIe *string) {
   259  	o.NameIe = nameIe
   260  }
   261  
   262  // WithNameIew adds the nameIew to the dcim power connections list params
   263  func (o *DcimPowerConnectionsListParams) WithNameIew(nameIew *string) *DcimPowerConnectionsListParams {
   264  	o.SetNameIew(nameIew)
   265  	return o
   266  }
   267  
   268  // SetNameIew adds the nameIew to the dcim power connections list params
   269  func (o *DcimPowerConnectionsListParams) SetNameIew(nameIew *string) {
   270  	o.NameIew = nameIew
   271  }
   272  
   273  // WithNameIsw adds the nameIsw to the dcim power connections list params
   274  func (o *DcimPowerConnectionsListParams) WithNameIsw(nameIsw *string) *DcimPowerConnectionsListParams {
   275  	o.SetNameIsw(nameIsw)
   276  	return o
   277  }
   278  
   279  // SetNameIsw adds the nameIsw to the dcim power connections list params
   280  func (o *DcimPowerConnectionsListParams) SetNameIsw(nameIsw *string) {
   281  	o.NameIsw = nameIsw
   282  }
   283  
   284  // WithNamen adds the namen to the dcim power connections list params
   285  func (o *DcimPowerConnectionsListParams) WithNamen(namen *string) *DcimPowerConnectionsListParams {
   286  	o.SetNamen(namen)
   287  	return o
   288  }
   289  
   290  // SetNamen adds the nameN to the dcim power connections list params
   291  func (o *DcimPowerConnectionsListParams) SetNamen(namen *string) {
   292  	o.Namen = namen
   293  }
   294  
   295  // WithNameNic adds the nameNic to the dcim power connections list params
   296  func (o *DcimPowerConnectionsListParams) WithNameNic(nameNic *string) *DcimPowerConnectionsListParams {
   297  	o.SetNameNic(nameNic)
   298  	return o
   299  }
   300  
   301  // SetNameNic adds the nameNic to the dcim power connections list params
   302  func (o *DcimPowerConnectionsListParams) SetNameNic(nameNic *string) {
   303  	o.NameNic = nameNic
   304  }
   305  
   306  // WithNameNie adds the nameNie to the dcim power connections list params
   307  func (o *DcimPowerConnectionsListParams) WithNameNie(nameNie *string) *DcimPowerConnectionsListParams {
   308  	o.SetNameNie(nameNie)
   309  	return o
   310  }
   311  
   312  // SetNameNie adds the nameNie to the dcim power connections list params
   313  func (o *DcimPowerConnectionsListParams) SetNameNie(nameNie *string) {
   314  	o.NameNie = nameNie
   315  }
   316  
   317  // WithNameNiew adds the nameNiew to the dcim power connections list params
   318  func (o *DcimPowerConnectionsListParams) WithNameNiew(nameNiew *string) *DcimPowerConnectionsListParams {
   319  	o.SetNameNiew(nameNiew)
   320  	return o
   321  }
   322  
   323  // SetNameNiew adds the nameNiew to the dcim power connections list params
   324  func (o *DcimPowerConnectionsListParams) SetNameNiew(nameNiew *string) {
   325  	o.NameNiew = nameNiew
   326  }
   327  
   328  // WithNameNisw adds the nameNisw to the dcim power connections list params
   329  func (o *DcimPowerConnectionsListParams) WithNameNisw(nameNisw *string) *DcimPowerConnectionsListParams {
   330  	o.SetNameNisw(nameNisw)
   331  	return o
   332  }
   333  
   334  // SetNameNisw adds the nameNisw to the dcim power connections list params
   335  func (o *DcimPowerConnectionsListParams) SetNameNisw(nameNisw *string) {
   336  	o.NameNisw = nameNisw
   337  }
   338  
   339  // WithOffset adds the offset to the dcim power connections list params
   340  func (o *DcimPowerConnectionsListParams) WithOffset(offset *int64) *DcimPowerConnectionsListParams {
   341  	o.SetOffset(offset)
   342  	return o
   343  }
   344  
   345  // SetOffset adds the offset to the dcim power connections list params
   346  func (o *DcimPowerConnectionsListParams) SetOffset(offset *int64) {
   347  	o.Offset = offset
   348  }
   349  
   350  // WithSite adds the site to the dcim power connections list params
   351  func (o *DcimPowerConnectionsListParams) WithSite(site *string) *DcimPowerConnectionsListParams {
   352  	o.SetSite(site)
   353  	return o
   354  }
   355  
   356  // SetSite adds the site to the dcim power connections list params
   357  func (o *DcimPowerConnectionsListParams) SetSite(site *string) {
   358  	o.Site = site
   359  }
   360  
   361  // WriteToRequest writes these params to a swagger request
   362  func (o *DcimPowerConnectionsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   363  
   364  	if err := r.SetTimeout(o.timeout); err != nil {
   365  		return err
   366  	}
   367  	var res []error
   368  
   369  	if o.Device != nil {
   370  
   371  		// query param device
   372  		var qrDevice string
   373  
   374  		if o.Device != nil {
   375  			qrDevice = *o.Device
   376  		}
   377  		qDevice := qrDevice
   378  		if qDevice != "" {
   379  
   380  			if err := r.SetQueryParam("device", qDevice); err != nil {
   381  				return err
   382  			}
   383  		}
   384  	}
   385  
   386  	if o.DeviceID != nil {
   387  
   388  		// query param device_id
   389  		var qrDeviceID string
   390  
   391  		if o.DeviceID != nil {
   392  			qrDeviceID = *o.DeviceID
   393  		}
   394  		qDeviceID := qrDeviceID
   395  		if qDeviceID != "" {
   396  
   397  			if err := r.SetQueryParam("device_id", qDeviceID); err != nil {
   398  				return err
   399  			}
   400  		}
   401  	}
   402  
   403  	if o.Limit != nil {
   404  
   405  		// query param limit
   406  		var qrLimit int64
   407  
   408  		if o.Limit != nil {
   409  			qrLimit = *o.Limit
   410  		}
   411  		qLimit := swag.FormatInt64(qrLimit)
   412  		if qLimit != "" {
   413  
   414  			if err := r.SetQueryParam("limit", qLimit); err != nil {
   415  				return err
   416  			}
   417  		}
   418  	}
   419  
   420  	if o.Name != nil {
   421  
   422  		// query param name
   423  		var qrName string
   424  
   425  		if o.Name != nil {
   426  			qrName = *o.Name
   427  		}
   428  		qName := qrName
   429  		if qName != "" {
   430  
   431  			if err := r.SetQueryParam("name", qName); err != nil {
   432  				return err
   433  			}
   434  		}
   435  	}
   436  
   437  	if o.NameEmpty != nil {
   438  
   439  		// query param name__empty
   440  		var qrNameEmpty string
   441  
   442  		if o.NameEmpty != nil {
   443  			qrNameEmpty = *o.NameEmpty
   444  		}
   445  		qNameEmpty := qrNameEmpty
   446  		if qNameEmpty != "" {
   447  
   448  			if err := r.SetQueryParam("name__empty", qNameEmpty); err != nil {
   449  				return err
   450  			}
   451  		}
   452  	}
   453  
   454  	if o.NameIc != nil {
   455  
   456  		// query param name__ic
   457  		var qrNameIc string
   458  
   459  		if o.NameIc != nil {
   460  			qrNameIc = *o.NameIc
   461  		}
   462  		qNameIc := qrNameIc
   463  		if qNameIc != "" {
   464  
   465  			if err := r.SetQueryParam("name__ic", qNameIc); err != nil {
   466  				return err
   467  			}
   468  		}
   469  	}
   470  
   471  	if o.NameIe != nil {
   472  
   473  		// query param name__ie
   474  		var qrNameIe string
   475  
   476  		if o.NameIe != nil {
   477  			qrNameIe = *o.NameIe
   478  		}
   479  		qNameIe := qrNameIe
   480  		if qNameIe != "" {
   481  
   482  			if err := r.SetQueryParam("name__ie", qNameIe); err != nil {
   483  				return err
   484  			}
   485  		}
   486  	}
   487  
   488  	if o.NameIew != nil {
   489  
   490  		// query param name__iew
   491  		var qrNameIew string
   492  
   493  		if o.NameIew != nil {
   494  			qrNameIew = *o.NameIew
   495  		}
   496  		qNameIew := qrNameIew
   497  		if qNameIew != "" {
   498  
   499  			if err := r.SetQueryParam("name__iew", qNameIew); err != nil {
   500  				return err
   501  			}
   502  		}
   503  	}
   504  
   505  	if o.NameIsw != nil {
   506  
   507  		// query param name__isw
   508  		var qrNameIsw string
   509  
   510  		if o.NameIsw != nil {
   511  			qrNameIsw = *o.NameIsw
   512  		}
   513  		qNameIsw := qrNameIsw
   514  		if qNameIsw != "" {
   515  
   516  			if err := r.SetQueryParam("name__isw", qNameIsw); err != nil {
   517  				return err
   518  			}
   519  		}
   520  	}
   521  
   522  	if o.Namen != nil {
   523  
   524  		// query param name__n
   525  		var qrNamen string
   526  
   527  		if o.Namen != nil {
   528  			qrNamen = *o.Namen
   529  		}
   530  		qNamen := qrNamen
   531  		if qNamen != "" {
   532  
   533  			if err := r.SetQueryParam("name__n", qNamen); err != nil {
   534  				return err
   535  			}
   536  		}
   537  	}
   538  
   539  	if o.NameNic != nil {
   540  
   541  		// query param name__nic
   542  		var qrNameNic string
   543  
   544  		if o.NameNic != nil {
   545  			qrNameNic = *o.NameNic
   546  		}
   547  		qNameNic := qrNameNic
   548  		if qNameNic != "" {
   549  
   550  			if err := r.SetQueryParam("name__nic", qNameNic); err != nil {
   551  				return err
   552  			}
   553  		}
   554  	}
   555  
   556  	if o.NameNie != nil {
   557  
   558  		// query param name__nie
   559  		var qrNameNie string
   560  
   561  		if o.NameNie != nil {
   562  			qrNameNie = *o.NameNie
   563  		}
   564  		qNameNie := qrNameNie
   565  		if qNameNie != "" {
   566  
   567  			if err := r.SetQueryParam("name__nie", qNameNie); err != nil {
   568  				return err
   569  			}
   570  		}
   571  	}
   572  
   573  	if o.NameNiew != nil {
   574  
   575  		// query param name__niew
   576  		var qrNameNiew string
   577  
   578  		if o.NameNiew != nil {
   579  			qrNameNiew = *o.NameNiew
   580  		}
   581  		qNameNiew := qrNameNiew
   582  		if qNameNiew != "" {
   583  
   584  			if err := r.SetQueryParam("name__niew", qNameNiew); err != nil {
   585  				return err
   586  			}
   587  		}
   588  	}
   589  
   590  	if o.NameNisw != nil {
   591  
   592  		// query param name__nisw
   593  		var qrNameNisw string
   594  
   595  		if o.NameNisw != nil {
   596  			qrNameNisw = *o.NameNisw
   597  		}
   598  		qNameNisw := qrNameNisw
   599  		if qNameNisw != "" {
   600  
   601  			if err := r.SetQueryParam("name__nisw", qNameNisw); err != nil {
   602  				return err
   603  			}
   604  		}
   605  	}
   606  
   607  	if o.Offset != nil {
   608  
   609  		// query param offset
   610  		var qrOffset int64
   611  
   612  		if o.Offset != nil {
   613  			qrOffset = *o.Offset
   614  		}
   615  		qOffset := swag.FormatInt64(qrOffset)
   616  		if qOffset != "" {
   617  
   618  			if err := r.SetQueryParam("offset", qOffset); err != nil {
   619  				return err
   620  			}
   621  		}
   622  	}
   623  
   624  	if o.Site != nil {
   625  
   626  		// query param site
   627  		var qrSite string
   628  
   629  		if o.Site != nil {
   630  			qrSite = *o.Site
   631  		}
   632  		qSite := qrSite
   633  		if qSite != "" {
   634  
   635  			if err := r.SetQueryParam("site", qSite); err != nil {
   636  				return err
   637  			}
   638  		}
   639  	}
   640  
   641  	if len(res) > 0 {
   642  		return errors.CompositeValidationError(res...)
   643  	}
   644  	return nil
   645  }