github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_racks_elevation_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  // NewDcimRacksElevationParams creates a new DcimRacksElevationParams 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 NewDcimRacksElevationParams() *DcimRacksElevationParams {
    42  	return &DcimRacksElevationParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewDcimRacksElevationParamsWithTimeout creates a new DcimRacksElevationParams object
    48  // with the ability to set a timeout on a request.
    49  func NewDcimRacksElevationParamsWithTimeout(timeout time.Duration) *DcimRacksElevationParams {
    50  	return &DcimRacksElevationParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewDcimRacksElevationParamsWithContext creates a new DcimRacksElevationParams object
    56  // with the ability to set a context for a request.
    57  func NewDcimRacksElevationParamsWithContext(ctx context.Context) *DcimRacksElevationParams {
    58  	return &DcimRacksElevationParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewDcimRacksElevationParamsWithHTTPClient creates a new DcimRacksElevationParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewDcimRacksElevationParamsWithHTTPClient(client *http.Client) *DcimRacksElevationParams {
    66  	return &DcimRacksElevationParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /* DcimRacksElevationParams contains all the parameters to send to the API endpoint
    72     for the dcim racks elevation operation.
    73  
    74     Typically these are written to a http.Request.
    75  */
    76  type DcimRacksElevationParams struct {
    77  
    78  	// Exclude.
    79  	Exclude *int64
    80  
    81  	// ExpandDevices.
    82  	//
    83  	// Default: true
    84  	ExpandDevices *bool
    85  
    86  	// Face.
    87  	//
    88  	// Default: "front"
    89  	Face *string
    90  
    91  	/* ID.
    92  
    93  	   A unique integer value identifying this rack.
    94  	*/
    95  	ID int64
    96  
    97  	// IncludeImages.
    98  	//
    99  	// Default: true
   100  	IncludeImages *bool
   101  
   102  	// LegendWidth.
   103  	//
   104  	// Default: 30
   105  	LegendWidth *int64
   106  
   107  	// Q.
   108  	Q *string
   109  
   110  	// Render.
   111  	//
   112  	// Default: "json"
   113  	Render *string
   114  
   115  	// UnitHeight.
   116  	//
   117  	// Default: 22
   118  	UnitHeight *int64
   119  
   120  	// UnitWidth.
   121  	//
   122  	// Default: 220
   123  	UnitWidth *int64
   124  
   125  	timeout    time.Duration
   126  	Context    context.Context
   127  	HTTPClient *http.Client
   128  }
   129  
   130  // WithDefaults hydrates default values in the dcim racks elevation params (not the query body).
   131  //
   132  // All values with no default are reset to their zero value.
   133  func (o *DcimRacksElevationParams) WithDefaults() *DcimRacksElevationParams {
   134  	o.SetDefaults()
   135  	return o
   136  }
   137  
   138  // SetDefaults hydrates default values in the dcim racks elevation params (not the query body).
   139  //
   140  // All values with no default are reset to their zero value.
   141  func (o *DcimRacksElevationParams) SetDefaults() {
   142  	var (
   143  		expandDevicesDefault = bool(true)
   144  
   145  		faceDefault = string("front")
   146  
   147  		includeImagesDefault = bool(true)
   148  
   149  		legendWidthDefault = int64(30)
   150  
   151  		renderDefault = string("json")
   152  
   153  		unitHeightDefault = int64(22)
   154  
   155  		unitWidthDefault = int64(220)
   156  	)
   157  
   158  	val := DcimRacksElevationParams{
   159  		ExpandDevices: &expandDevicesDefault,
   160  		Face:          &faceDefault,
   161  		IncludeImages: &includeImagesDefault,
   162  		LegendWidth:   &legendWidthDefault,
   163  		Render:        &renderDefault,
   164  		UnitHeight:    &unitHeightDefault,
   165  		UnitWidth:     &unitWidthDefault,
   166  	}
   167  
   168  	val.timeout = o.timeout
   169  	val.Context = o.Context
   170  	val.HTTPClient = o.HTTPClient
   171  	*o = val
   172  }
   173  
   174  // WithTimeout adds the timeout to the dcim racks elevation params
   175  func (o *DcimRacksElevationParams) WithTimeout(timeout time.Duration) *DcimRacksElevationParams {
   176  	o.SetTimeout(timeout)
   177  	return o
   178  }
   179  
   180  // SetTimeout adds the timeout to the dcim racks elevation params
   181  func (o *DcimRacksElevationParams) SetTimeout(timeout time.Duration) {
   182  	o.timeout = timeout
   183  }
   184  
   185  // WithContext adds the context to the dcim racks elevation params
   186  func (o *DcimRacksElevationParams) WithContext(ctx context.Context) *DcimRacksElevationParams {
   187  	o.SetContext(ctx)
   188  	return o
   189  }
   190  
   191  // SetContext adds the context to the dcim racks elevation params
   192  func (o *DcimRacksElevationParams) SetContext(ctx context.Context) {
   193  	o.Context = ctx
   194  }
   195  
   196  // WithHTTPClient adds the HTTPClient to the dcim racks elevation params
   197  func (o *DcimRacksElevationParams) WithHTTPClient(client *http.Client) *DcimRacksElevationParams {
   198  	o.SetHTTPClient(client)
   199  	return o
   200  }
   201  
   202  // SetHTTPClient adds the HTTPClient to the dcim racks elevation params
   203  func (o *DcimRacksElevationParams) SetHTTPClient(client *http.Client) {
   204  	o.HTTPClient = client
   205  }
   206  
   207  // WithExclude adds the exclude to the dcim racks elevation params
   208  func (o *DcimRacksElevationParams) WithExclude(exclude *int64) *DcimRacksElevationParams {
   209  	o.SetExclude(exclude)
   210  	return o
   211  }
   212  
   213  // SetExclude adds the exclude to the dcim racks elevation params
   214  func (o *DcimRacksElevationParams) SetExclude(exclude *int64) {
   215  	o.Exclude = exclude
   216  }
   217  
   218  // WithExpandDevices adds the expandDevices to the dcim racks elevation params
   219  func (o *DcimRacksElevationParams) WithExpandDevices(expandDevices *bool) *DcimRacksElevationParams {
   220  	o.SetExpandDevices(expandDevices)
   221  	return o
   222  }
   223  
   224  // SetExpandDevices adds the expandDevices to the dcim racks elevation params
   225  func (o *DcimRacksElevationParams) SetExpandDevices(expandDevices *bool) {
   226  	o.ExpandDevices = expandDevices
   227  }
   228  
   229  // WithFace adds the face to the dcim racks elevation params
   230  func (o *DcimRacksElevationParams) WithFace(face *string) *DcimRacksElevationParams {
   231  	o.SetFace(face)
   232  	return o
   233  }
   234  
   235  // SetFace adds the face to the dcim racks elevation params
   236  func (o *DcimRacksElevationParams) SetFace(face *string) {
   237  	o.Face = face
   238  }
   239  
   240  // WithID adds the id to the dcim racks elevation params
   241  func (o *DcimRacksElevationParams) WithID(id int64) *DcimRacksElevationParams {
   242  	o.SetID(id)
   243  	return o
   244  }
   245  
   246  // SetID adds the id to the dcim racks elevation params
   247  func (o *DcimRacksElevationParams) SetID(id int64) {
   248  	o.ID = id
   249  }
   250  
   251  // WithIncludeImages adds the includeImages to the dcim racks elevation params
   252  func (o *DcimRacksElevationParams) WithIncludeImages(includeImages *bool) *DcimRacksElevationParams {
   253  	o.SetIncludeImages(includeImages)
   254  	return o
   255  }
   256  
   257  // SetIncludeImages adds the includeImages to the dcim racks elevation params
   258  func (o *DcimRacksElevationParams) SetIncludeImages(includeImages *bool) {
   259  	o.IncludeImages = includeImages
   260  }
   261  
   262  // WithLegendWidth adds the legendWidth to the dcim racks elevation params
   263  func (o *DcimRacksElevationParams) WithLegendWidth(legendWidth *int64) *DcimRacksElevationParams {
   264  	o.SetLegendWidth(legendWidth)
   265  	return o
   266  }
   267  
   268  // SetLegendWidth adds the legendWidth to the dcim racks elevation params
   269  func (o *DcimRacksElevationParams) SetLegendWidth(legendWidth *int64) {
   270  	o.LegendWidth = legendWidth
   271  }
   272  
   273  // WithQ adds the q to the dcim racks elevation params
   274  func (o *DcimRacksElevationParams) WithQ(q *string) *DcimRacksElevationParams {
   275  	o.SetQ(q)
   276  	return o
   277  }
   278  
   279  // SetQ adds the q to the dcim racks elevation params
   280  func (o *DcimRacksElevationParams) SetQ(q *string) {
   281  	o.Q = q
   282  }
   283  
   284  // WithRender adds the render to the dcim racks elevation params
   285  func (o *DcimRacksElevationParams) WithRender(render *string) *DcimRacksElevationParams {
   286  	o.SetRender(render)
   287  	return o
   288  }
   289  
   290  // SetRender adds the render to the dcim racks elevation params
   291  func (o *DcimRacksElevationParams) SetRender(render *string) {
   292  	o.Render = render
   293  }
   294  
   295  // WithUnitHeight adds the unitHeight to the dcim racks elevation params
   296  func (o *DcimRacksElevationParams) WithUnitHeight(unitHeight *int64) *DcimRacksElevationParams {
   297  	o.SetUnitHeight(unitHeight)
   298  	return o
   299  }
   300  
   301  // SetUnitHeight adds the unitHeight to the dcim racks elevation params
   302  func (o *DcimRacksElevationParams) SetUnitHeight(unitHeight *int64) {
   303  	o.UnitHeight = unitHeight
   304  }
   305  
   306  // WithUnitWidth adds the unitWidth to the dcim racks elevation params
   307  func (o *DcimRacksElevationParams) WithUnitWidth(unitWidth *int64) *DcimRacksElevationParams {
   308  	o.SetUnitWidth(unitWidth)
   309  	return o
   310  }
   311  
   312  // SetUnitWidth adds the unitWidth to the dcim racks elevation params
   313  func (o *DcimRacksElevationParams) SetUnitWidth(unitWidth *int64) {
   314  	o.UnitWidth = unitWidth
   315  }
   316  
   317  // WriteToRequest writes these params to a swagger request
   318  func (o *DcimRacksElevationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   319  
   320  	if err := r.SetTimeout(o.timeout); err != nil {
   321  		return err
   322  	}
   323  	var res []error
   324  
   325  	if o.Exclude != nil {
   326  
   327  		// query param exclude
   328  		var qrExclude int64
   329  
   330  		if o.Exclude != nil {
   331  			qrExclude = *o.Exclude
   332  		}
   333  		qExclude := swag.FormatInt64(qrExclude)
   334  		if qExclude != "" {
   335  
   336  			if err := r.SetQueryParam("exclude", qExclude); err != nil {
   337  				return err
   338  			}
   339  		}
   340  	}
   341  
   342  	if o.ExpandDevices != nil {
   343  
   344  		// query param expand_devices
   345  		var qrExpandDevices bool
   346  
   347  		if o.ExpandDevices != nil {
   348  			qrExpandDevices = *o.ExpandDevices
   349  		}
   350  		qExpandDevices := swag.FormatBool(qrExpandDevices)
   351  		if qExpandDevices != "" {
   352  
   353  			if err := r.SetQueryParam("expand_devices", qExpandDevices); err != nil {
   354  				return err
   355  			}
   356  		}
   357  	}
   358  
   359  	if o.Face != nil {
   360  
   361  		// query param face
   362  		var qrFace string
   363  
   364  		if o.Face != nil {
   365  			qrFace = *o.Face
   366  		}
   367  		qFace := qrFace
   368  		if qFace != "" {
   369  
   370  			if err := r.SetQueryParam("face", qFace); err != nil {
   371  				return err
   372  			}
   373  		}
   374  	}
   375  
   376  	// path param id
   377  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   378  		return err
   379  	}
   380  
   381  	if o.IncludeImages != nil {
   382  
   383  		// query param include_images
   384  		var qrIncludeImages bool
   385  
   386  		if o.IncludeImages != nil {
   387  			qrIncludeImages = *o.IncludeImages
   388  		}
   389  		qIncludeImages := swag.FormatBool(qrIncludeImages)
   390  		if qIncludeImages != "" {
   391  
   392  			if err := r.SetQueryParam("include_images", qIncludeImages); err != nil {
   393  				return err
   394  			}
   395  		}
   396  	}
   397  
   398  	if o.LegendWidth != nil {
   399  
   400  		// query param legend_width
   401  		var qrLegendWidth int64
   402  
   403  		if o.LegendWidth != nil {
   404  			qrLegendWidth = *o.LegendWidth
   405  		}
   406  		qLegendWidth := swag.FormatInt64(qrLegendWidth)
   407  		if qLegendWidth != "" {
   408  
   409  			if err := r.SetQueryParam("legend_width", qLegendWidth); err != nil {
   410  				return err
   411  			}
   412  		}
   413  	}
   414  
   415  	if o.Q != nil {
   416  
   417  		// query param q
   418  		var qrQ string
   419  
   420  		if o.Q != nil {
   421  			qrQ = *o.Q
   422  		}
   423  		qQ := qrQ
   424  		if qQ != "" {
   425  
   426  			if err := r.SetQueryParam("q", qQ); err != nil {
   427  				return err
   428  			}
   429  		}
   430  	}
   431  
   432  	if o.Render != nil {
   433  
   434  		// query param render
   435  		var qrRender string
   436  
   437  		if o.Render != nil {
   438  			qrRender = *o.Render
   439  		}
   440  		qRender := qrRender
   441  		if qRender != "" {
   442  
   443  			if err := r.SetQueryParam("render", qRender); err != nil {
   444  				return err
   445  			}
   446  		}
   447  	}
   448  
   449  	if o.UnitHeight != nil {
   450  
   451  		// query param unit_height
   452  		var qrUnitHeight int64
   453  
   454  		if o.UnitHeight != nil {
   455  			qrUnitHeight = *o.UnitHeight
   456  		}
   457  		qUnitHeight := swag.FormatInt64(qrUnitHeight)
   458  		if qUnitHeight != "" {
   459  
   460  			if err := r.SetQueryParam("unit_height", qUnitHeight); err != nil {
   461  				return err
   462  			}
   463  		}
   464  	}
   465  
   466  	if o.UnitWidth != nil {
   467  
   468  		// query param unit_width
   469  		var qrUnitWidth int64
   470  
   471  		if o.UnitWidth != nil {
   472  			qrUnitWidth = *o.UnitWidth
   473  		}
   474  		qUnitWidth := swag.FormatInt64(qrUnitWidth)
   475  		if qUnitWidth != "" {
   476  
   477  			if err := r.SetQueryParam("unit_width", qUnitWidth); err != nil {
   478  				return err
   479  			}
   480  		}
   481  	}
   482  
   483  	if len(res) > 0 {
   484  		return errors.CompositeValidationError(res...)
   485  	}
   486  	return nil
   487  }