github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_interface_templates_update_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  	"github.com/digitalocean/go-netbox/netbox/models"
    35  )
    36  
    37  // NewDcimInterfaceTemplatesUpdateParams creates a new DcimInterfaceTemplatesUpdateParams object,
    38  // with the default timeout for this client.
    39  //
    40  // Default values are not hydrated, since defaults are normally applied by the API server side.
    41  //
    42  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    43  func NewDcimInterfaceTemplatesUpdateParams() *DcimInterfaceTemplatesUpdateParams {
    44  	return &DcimInterfaceTemplatesUpdateParams{
    45  		timeout: cr.DefaultTimeout,
    46  	}
    47  }
    48  
    49  // NewDcimInterfaceTemplatesUpdateParamsWithTimeout creates a new DcimInterfaceTemplatesUpdateParams object
    50  // with the ability to set a timeout on a request.
    51  func NewDcimInterfaceTemplatesUpdateParamsWithTimeout(timeout time.Duration) *DcimInterfaceTemplatesUpdateParams {
    52  	return &DcimInterfaceTemplatesUpdateParams{
    53  		timeout: timeout,
    54  	}
    55  }
    56  
    57  // NewDcimInterfaceTemplatesUpdateParamsWithContext creates a new DcimInterfaceTemplatesUpdateParams object
    58  // with the ability to set a context for a request.
    59  func NewDcimInterfaceTemplatesUpdateParamsWithContext(ctx context.Context) *DcimInterfaceTemplatesUpdateParams {
    60  	return &DcimInterfaceTemplatesUpdateParams{
    61  		Context: ctx,
    62  	}
    63  }
    64  
    65  // NewDcimInterfaceTemplatesUpdateParamsWithHTTPClient creates a new DcimInterfaceTemplatesUpdateParams object
    66  // with the ability to set a custom HTTPClient for a request.
    67  func NewDcimInterfaceTemplatesUpdateParamsWithHTTPClient(client *http.Client) *DcimInterfaceTemplatesUpdateParams {
    68  	return &DcimInterfaceTemplatesUpdateParams{
    69  		HTTPClient: client,
    70  	}
    71  }
    72  
    73  /* DcimInterfaceTemplatesUpdateParams contains all the parameters to send to the API endpoint
    74     for the dcim interface templates update operation.
    75  
    76     Typically these are written to a http.Request.
    77  */
    78  type DcimInterfaceTemplatesUpdateParams struct {
    79  
    80  	// Data.
    81  	Data *models.WritableInterfaceTemplate
    82  
    83  	/* ID.
    84  
    85  	   A unique integer value identifying this interface template.
    86  	*/
    87  	ID int64
    88  
    89  	timeout    time.Duration
    90  	Context    context.Context
    91  	HTTPClient *http.Client
    92  }
    93  
    94  // WithDefaults hydrates default values in the dcim interface templates update params (not the query body).
    95  //
    96  // All values with no default are reset to their zero value.
    97  func (o *DcimInterfaceTemplatesUpdateParams) WithDefaults() *DcimInterfaceTemplatesUpdateParams {
    98  	o.SetDefaults()
    99  	return o
   100  }
   101  
   102  // SetDefaults hydrates default values in the dcim interface templates update params (not the query body).
   103  //
   104  // All values with no default are reset to their zero value.
   105  func (o *DcimInterfaceTemplatesUpdateParams) SetDefaults() {
   106  	// no default values defined for this parameter
   107  }
   108  
   109  // WithTimeout adds the timeout to the dcim interface templates update params
   110  func (o *DcimInterfaceTemplatesUpdateParams) WithTimeout(timeout time.Duration) *DcimInterfaceTemplatesUpdateParams {
   111  	o.SetTimeout(timeout)
   112  	return o
   113  }
   114  
   115  // SetTimeout adds the timeout to the dcim interface templates update params
   116  func (o *DcimInterfaceTemplatesUpdateParams) SetTimeout(timeout time.Duration) {
   117  	o.timeout = timeout
   118  }
   119  
   120  // WithContext adds the context to the dcim interface templates update params
   121  func (o *DcimInterfaceTemplatesUpdateParams) WithContext(ctx context.Context) *DcimInterfaceTemplatesUpdateParams {
   122  	o.SetContext(ctx)
   123  	return o
   124  }
   125  
   126  // SetContext adds the context to the dcim interface templates update params
   127  func (o *DcimInterfaceTemplatesUpdateParams) SetContext(ctx context.Context) {
   128  	o.Context = ctx
   129  }
   130  
   131  // WithHTTPClient adds the HTTPClient to the dcim interface templates update params
   132  func (o *DcimInterfaceTemplatesUpdateParams) WithHTTPClient(client *http.Client) *DcimInterfaceTemplatesUpdateParams {
   133  	o.SetHTTPClient(client)
   134  	return o
   135  }
   136  
   137  // SetHTTPClient adds the HTTPClient to the dcim interface templates update params
   138  func (o *DcimInterfaceTemplatesUpdateParams) SetHTTPClient(client *http.Client) {
   139  	o.HTTPClient = client
   140  }
   141  
   142  // WithData adds the data to the dcim interface templates update params
   143  func (o *DcimInterfaceTemplatesUpdateParams) WithData(data *models.WritableInterfaceTemplate) *DcimInterfaceTemplatesUpdateParams {
   144  	o.SetData(data)
   145  	return o
   146  }
   147  
   148  // SetData adds the data to the dcim interface templates update params
   149  func (o *DcimInterfaceTemplatesUpdateParams) SetData(data *models.WritableInterfaceTemplate) {
   150  	o.Data = data
   151  }
   152  
   153  // WithID adds the id to the dcim interface templates update params
   154  func (o *DcimInterfaceTemplatesUpdateParams) WithID(id int64) *DcimInterfaceTemplatesUpdateParams {
   155  	o.SetID(id)
   156  	return o
   157  }
   158  
   159  // SetID adds the id to the dcim interface templates update params
   160  func (o *DcimInterfaceTemplatesUpdateParams) SetID(id int64) {
   161  	o.ID = id
   162  }
   163  
   164  // WriteToRequest writes these params to a swagger request
   165  func (o *DcimInterfaceTemplatesUpdateParams) 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  	if o.Data != nil {
   172  		if err := r.SetBodyParam(o.Data); err != nil {
   173  			return err
   174  		}
   175  	}
   176  
   177  	// path param id
   178  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   179  		return err
   180  	}
   181  
   182  	if len(res) > 0 {
   183  		return errors.CompositeValidationError(res...)
   184  	}
   185  	return nil
   186  }