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