github.com/digitalocean/go-netbox@v0.0.2/netbox/client/dcim/dcim_devices_napalm_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  // NewDcimDevicesNapalmParams creates a new DcimDevicesNapalmParams 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 NewDcimDevicesNapalmParams() *DcimDevicesNapalmParams {
    42  	return &DcimDevicesNapalmParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewDcimDevicesNapalmParamsWithTimeout creates a new DcimDevicesNapalmParams object
    48  // with the ability to set a timeout on a request.
    49  func NewDcimDevicesNapalmParamsWithTimeout(timeout time.Duration) *DcimDevicesNapalmParams {
    50  	return &DcimDevicesNapalmParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewDcimDevicesNapalmParamsWithContext creates a new DcimDevicesNapalmParams object
    56  // with the ability to set a context for a request.
    57  func NewDcimDevicesNapalmParamsWithContext(ctx context.Context) *DcimDevicesNapalmParams {
    58  	return &DcimDevicesNapalmParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewDcimDevicesNapalmParamsWithHTTPClient creates a new DcimDevicesNapalmParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewDcimDevicesNapalmParamsWithHTTPClient(client *http.Client) *DcimDevicesNapalmParams {
    66  	return &DcimDevicesNapalmParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /* DcimDevicesNapalmParams contains all the parameters to send to the API endpoint
    72     for the dcim devices napalm operation.
    73  
    74     Typically these are written to a http.Request.
    75  */
    76  type DcimDevicesNapalmParams struct {
    77  
    78  	/* ID.
    79  
    80  	   A unique integer value identifying this device.
    81  	*/
    82  	ID int64
    83  
    84  	// Method.
    85  	Method string
    86  
    87  	timeout    time.Duration
    88  	Context    context.Context
    89  	HTTPClient *http.Client
    90  }
    91  
    92  // WithDefaults hydrates default values in the dcim devices napalm params (not the query body).
    93  //
    94  // All values with no default are reset to their zero value.
    95  func (o *DcimDevicesNapalmParams) WithDefaults() *DcimDevicesNapalmParams {
    96  	o.SetDefaults()
    97  	return o
    98  }
    99  
   100  // SetDefaults hydrates default values in the dcim devices napalm params (not the query body).
   101  //
   102  // All values with no default are reset to their zero value.
   103  func (o *DcimDevicesNapalmParams) SetDefaults() {
   104  	// no default values defined for this parameter
   105  }
   106  
   107  // WithTimeout adds the timeout to the dcim devices napalm params
   108  func (o *DcimDevicesNapalmParams) WithTimeout(timeout time.Duration) *DcimDevicesNapalmParams {
   109  	o.SetTimeout(timeout)
   110  	return o
   111  }
   112  
   113  // SetTimeout adds the timeout to the dcim devices napalm params
   114  func (o *DcimDevicesNapalmParams) SetTimeout(timeout time.Duration) {
   115  	o.timeout = timeout
   116  }
   117  
   118  // WithContext adds the context to the dcim devices napalm params
   119  func (o *DcimDevicesNapalmParams) WithContext(ctx context.Context) *DcimDevicesNapalmParams {
   120  	o.SetContext(ctx)
   121  	return o
   122  }
   123  
   124  // SetContext adds the context to the dcim devices napalm params
   125  func (o *DcimDevicesNapalmParams) SetContext(ctx context.Context) {
   126  	o.Context = ctx
   127  }
   128  
   129  // WithHTTPClient adds the HTTPClient to the dcim devices napalm params
   130  func (o *DcimDevicesNapalmParams) WithHTTPClient(client *http.Client) *DcimDevicesNapalmParams {
   131  	o.SetHTTPClient(client)
   132  	return o
   133  }
   134  
   135  // SetHTTPClient adds the HTTPClient to the dcim devices napalm params
   136  func (o *DcimDevicesNapalmParams) SetHTTPClient(client *http.Client) {
   137  	o.HTTPClient = client
   138  }
   139  
   140  // WithID adds the id to the dcim devices napalm params
   141  func (o *DcimDevicesNapalmParams) WithID(id int64) *DcimDevicesNapalmParams {
   142  	o.SetID(id)
   143  	return o
   144  }
   145  
   146  // SetID adds the id to the dcim devices napalm params
   147  func (o *DcimDevicesNapalmParams) SetID(id int64) {
   148  	o.ID = id
   149  }
   150  
   151  // WithMethod adds the method to the dcim devices napalm params
   152  func (o *DcimDevicesNapalmParams) WithMethod(method string) *DcimDevicesNapalmParams {
   153  	o.SetMethod(method)
   154  	return o
   155  }
   156  
   157  // SetMethod adds the method to the dcim devices napalm params
   158  func (o *DcimDevicesNapalmParams) SetMethod(method string) {
   159  	o.Method = method
   160  }
   161  
   162  // WriteToRequest writes these params to a swagger request
   163  func (o *DcimDevicesNapalmParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   164  
   165  	if err := r.SetTimeout(o.timeout); err != nil {
   166  		return err
   167  	}
   168  	var res []error
   169  
   170  	// path param id
   171  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   172  		return err
   173  	}
   174  
   175  	// query param method
   176  	qrMethod := o.Method
   177  	qMethod := qrMethod
   178  	if qMethod != "" {
   179  
   180  		if err := r.SetQueryParam("method", qMethod); err != nil {
   181  			return err
   182  		}
   183  	}
   184  
   185  	if len(res) > 0 {
   186  		return errors.CompositeValidationError(res...)
   187  	}
   188  	return nil
   189  }