github.com/digitalocean/go-netbox@v0.0.2/netbox/client/circuits/circuits_provider_networks_create_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 circuits
    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  // NewCircuitsProviderNetworksCreateParams creates a new CircuitsProviderNetworksCreateParams 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 NewCircuitsProviderNetworksCreateParams() *CircuitsProviderNetworksCreateParams {
    43  	return &CircuitsProviderNetworksCreateParams{
    44  		timeout: cr.DefaultTimeout,
    45  	}
    46  }
    47  
    48  // NewCircuitsProviderNetworksCreateParamsWithTimeout creates a new CircuitsProviderNetworksCreateParams object
    49  // with the ability to set a timeout on a request.
    50  func NewCircuitsProviderNetworksCreateParamsWithTimeout(timeout time.Duration) *CircuitsProviderNetworksCreateParams {
    51  	return &CircuitsProviderNetworksCreateParams{
    52  		timeout: timeout,
    53  	}
    54  }
    55  
    56  // NewCircuitsProviderNetworksCreateParamsWithContext creates a new CircuitsProviderNetworksCreateParams object
    57  // with the ability to set a context for a request.
    58  func NewCircuitsProviderNetworksCreateParamsWithContext(ctx context.Context) *CircuitsProviderNetworksCreateParams {
    59  	return &CircuitsProviderNetworksCreateParams{
    60  		Context: ctx,
    61  	}
    62  }
    63  
    64  // NewCircuitsProviderNetworksCreateParamsWithHTTPClient creates a new CircuitsProviderNetworksCreateParams object
    65  // with the ability to set a custom HTTPClient for a request.
    66  func NewCircuitsProviderNetworksCreateParamsWithHTTPClient(client *http.Client) *CircuitsProviderNetworksCreateParams {
    67  	return &CircuitsProviderNetworksCreateParams{
    68  		HTTPClient: client,
    69  	}
    70  }
    71  
    72  /* CircuitsProviderNetworksCreateParams contains all the parameters to send to the API endpoint
    73     for the circuits provider networks create operation.
    74  
    75     Typically these are written to a http.Request.
    76  */
    77  type CircuitsProviderNetworksCreateParams struct {
    78  
    79  	// Data.
    80  	Data *models.WritableProviderNetwork
    81  
    82  	timeout    time.Duration
    83  	Context    context.Context
    84  	HTTPClient *http.Client
    85  }
    86  
    87  // WithDefaults hydrates default values in the circuits provider networks create params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *CircuitsProviderNetworksCreateParams) WithDefaults() *CircuitsProviderNetworksCreateParams {
    91  	o.SetDefaults()
    92  	return o
    93  }
    94  
    95  // SetDefaults hydrates default values in the circuits provider networks create params (not the query body).
    96  //
    97  // All values with no default are reset to their zero value.
    98  func (o *CircuitsProviderNetworksCreateParams) SetDefaults() {
    99  	// no default values defined for this parameter
   100  }
   101  
   102  // WithTimeout adds the timeout to the circuits provider networks create params
   103  func (o *CircuitsProviderNetworksCreateParams) WithTimeout(timeout time.Duration) *CircuitsProviderNetworksCreateParams {
   104  	o.SetTimeout(timeout)
   105  	return o
   106  }
   107  
   108  // SetTimeout adds the timeout to the circuits provider networks create params
   109  func (o *CircuitsProviderNetworksCreateParams) SetTimeout(timeout time.Duration) {
   110  	o.timeout = timeout
   111  }
   112  
   113  // WithContext adds the context to the circuits provider networks create params
   114  func (o *CircuitsProviderNetworksCreateParams) WithContext(ctx context.Context) *CircuitsProviderNetworksCreateParams {
   115  	o.SetContext(ctx)
   116  	return o
   117  }
   118  
   119  // SetContext adds the context to the circuits provider networks create params
   120  func (o *CircuitsProviderNetworksCreateParams) SetContext(ctx context.Context) {
   121  	o.Context = ctx
   122  }
   123  
   124  // WithHTTPClient adds the HTTPClient to the circuits provider networks create params
   125  func (o *CircuitsProviderNetworksCreateParams) WithHTTPClient(client *http.Client) *CircuitsProviderNetworksCreateParams {
   126  	o.SetHTTPClient(client)
   127  	return o
   128  }
   129  
   130  // SetHTTPClient adds the HTTPClient to the circuits provider networks create params
   131  func (o *CircuitsProviderNetworksCreateParams) SetHTTPClient(client *http.Client) {
   132  	o.HTTPClient = client
   133  }
   134  
   135  // WithData adds the data to the circuits provider networks create params
   136  func (o *CircuitsProviderNetworksCreateParams) WithData(data *models.WritableProviderNetwork) *CircuitsProviderNetworksCreateParams {
   137  	o.SetData(data)
   138  	return o
   139  }
   140  
   141  // SetData adds the data to the circuits provider networks create params
   142  func (o *CircuitsProviderNetworksCreateParams) SetData(data *models.WritableProviderNetwork) {
   143  	o.Data = data
   144  }
   145  
   146  // WriteToRequest writes these params to a swagger request
   147  func (o *CircuitsProviderNetworksCreateParams) 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  }