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