...

Source file src/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go

Documentation: github.com/sigstore/rekor/pkg/generated/client/tlog

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  //
     4  // Copyright 2021 The Sigstore Authors.
     5  //
     6  // Licensed under the Apache License, Version 2.0 (the "License");
     7  // you may not use this file except in compliance with the License.
     8  // You may obtain a copy of the License at
     9  //
    10  //     http://www.apache.org/licenses/LICENSE-2.0
    11  //
    12  // Unless required by applicable law or agreed to in writing, software
    13  // distributed under the License is distributed on an "AS IS" BASIS,
    14  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15  // See the License for the specific language governing permissions and
    16  // limitations under the License.
    17  //
    18  
    19  package tlog
    20  
    21  // This file was generated by the swagger tool.
    22  // Editing this file might prove futile when you re-run the swagger generate command
    23  
    24  import (
    25  	"context"
    26  	"net/http"
    27  	"time"
    28  
    29  	"github.com/go-openapi/errors"
    30  	"github.com/go-openapi/runtime"
    31  	cr "github.com/go-openapi/runtime/client"
    32  	"github.com/go-openapi/strfmt"
    33  	"github.com/go-openapi/swag"
    34  )
    35  
    36  // NewGetLogProofParams creates a new GetLogProofParams 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 NewGetLogProofParams() *GetLogProofParams {
    43  	return &GetLogProofParams{
    44  		timeout: cr.DefaultTimeout,
    45  	}
    46  }
    47  
    48  // NewGetLogProofParamsWithTimeout creates a new GetLogProofParams object
    49  // with the ability to set a timeout on a request.
    50  func NewGetLogProofParamsWithTimeout(timeout time.Duration) *GetLogProofParams {
    51  	return &GetLogProofParams{
    52  		timeout: timeout,
    53  	}
    54  }
    55  
    56  // NewGetLogProofParamsWithContext creates a new GetLogProofParams object
    57  // with the ability to set a context for a request.
    58  func NewGetLogProofParamsWithContext(ctx context.Context) *GetLogProofParams {
    59  	return &GetLogProofParams{
    60  		Context: ctx,
    61  	}
    62  }
    63  
    64  // NewGetLogProofParamsWithHTTPClient creates a new GetLogProofParams object
    65  // with the ability to set a custom HTTPClient for a request.
    66  func NewGetLogProofParamsWithHTTPClient(client *http.Client) *GetLogProofParams {
    67  	return &GetLogProofParams{
    68  		HTTPClient: client,
    69  	}
    70  }
    71  
    72  /*
    73  GetLogProofParams contains all the parameters to send to the API endpoint
    74  
    75  	for the get log proof operation.
    76  
    77  	Typically these are written to a http.Request.
    78  */
    79  type GetLogProofParams struct {
    80  
    81  	/* FirstSize.
    82  
    83  	   The size of the tree that you wish to prove consistency from (1 means the beginning of the log) Defaults to 1 if not specified
    84  
    85  
    86  	   Default: 1
    87  	*/
    88  	FirstSize *int64
    89  
    90  	/* LastSize.
    91  
    92  	   The size of the tree that you wish to prove consistency to
    93  	*/
    94  	LastSize int64
    95  
    96  	/* TreeID.
    97  
    98  	   The tree ID of the tree that you wish to prove consistency for
    99  	*/
   100  	TreeID *string
   101  
   102  	timeout    time.Duration
   103  	Context    context.Context
   104  	HTTPClient *http.Client
   105  }
   106  
   107  // WithDefaults hydrates default values in the get log proof params (not the query body).
   108  //
   109  // All values with no default are reset to their zero value.
   110  func (o *GetLogProofParams) WithDefaults() *GetLogProofParams {
   111  	o.SetDefaults()
   112  	return o
   113  }
   114  
   115  // SetDefaults hydrates default values in the get log proof params (not the query body).
   116  //
   117  // All values with no default are reset to their zero value.
   118  func (o *GetLogProofParams) SetDefaults() {
   119  	var (
   120  		firstSizeDefault = int64(1)
   121  	)
   122  
   123  	val := GetLogProofParams{
   124  		FirstSize: &firstSizeDefault,
   125  	}
   126  
   127  	val.timeout = o.timeout
   128  	val.Context = o.Context
   129  	val.HTTPClient = o.HTTPClient
   130  	*o = val
   131  }
   132  
   133  // WithTimeout adds the timeout to the get log proof params
   134  func (o *GetLogProofParams) WithTimeout(timeout time.Duration) *GetLogProofParams {
   135  	o.SetTimeout(timeout)
   136  	return o
   137  }
   138  
   139  // SetTimeout adds the timeout to the get log proof params
   140  func (o *GetLogProofParams) SetTimeout(timeout time.Duration) {
   141  	o.timeout = timeout
   142  }
   143  
   144  // WithContext adds the context to the get log proof params
   145  func (o *GetLogProofParams) WithContext(ctx context.Context) *GetLogProofParams {
   146  	o.SetContext(ctx)
   147  	return o
   148  }
   149  
   150  // SetContext adds the context to the get log proof params
   151  func (o *GetLogProofParams) SetContext(ctx context.Context) {
   152  	o.Context = ctx
   153  }
   154  
   155  // WithHTTPClient adds the HTTPClient to the get log proof params
   156  func (o *GetLogProofParams) WithHTTPClient(client *http.Client) *GetLogProofParams {
   157  	o.SetHTTPClient(client)
   158  	return o
   159  }
   160  
   161  // SetHTTPClient adds the HTTPClient to the get log proof params
   162  func (o *GetLogProofParams) SetHTTPClient(client *http.Client) {
   163  	o.HTTPClient = client
   164  }
   165  
   166  // WithFirstSize adds the firstSize to the get log proof params
   167  func (o *GetLogProofParams) WithFirstSize(firstSize *int64) *GetLogProofParams {
   168  	o.SetFirstSize(firstSize)
   169  	return o
   170  }
   171  
   172  // SetFirstSize adds the firstSize to the get log proof params
   173  func (o *GetLogProofParams) SetFirstSize(firstSize *int64) {
   174  	o.FirstSize = firstSize
   175  }
   176  
   177  // WithLastSize adds the lastSize to the get log proof params
   178  func (o *GetLogProofParams) WithLastSize(lastSize int64) *GetLogProofParams {
   179  	o.SetLastSize(lastSize)
   180  	return o
   181  }
   182  
   183  // SetLastSize adds the lastSize to the get log proof params
   184  func (o *GetLogProofParams) SetLastSize(lastSize int64) {
   185  	o.LastSize = lastSize
   186  }
   187  
   188  // WithTreeID adds the treeID to the get log proof params
   189  func (o *GetLogProofParams) WithTreeID(treeID *string) *GetLogProofParams {
   190  	o.SetTreeID(treeID)
   191  	return o
   192  }
   193  
   194  // SetTreeID adds the treeId to the get log proof params
   195  func (o *GetLogProofParams) SetTreeID(treeID *string) {
   196  	o.TreeID = treeID
   197  }
   198  
   199  // WriteToRequest writes these params to a swagger request
   200  func (o *GetLogProofParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   201  
   202  	if err := r.SetTimeout(o.timeout); err != nil {
   203  		return err
   204  	}
   205  	var res []error
   206  
   207  	if o.FirstSize != nil {
   208  
   209  		// query param firstSize
   210  		var qrFirstSize int64
   211  
   212  		if o.FirstSize != nil {
   213  			qrFirstSize = *o.FirstSize
   214  		}
   215  		qFirstSize := swag.FormatInt64(qrFirstSize)
   216  		if qFirstSize != "" {
   217  
   218  			if err := r.SetQueryParam("firstSize", qFirstSize); err != nil {
   219  				return err
   220  			}
   221  		}
   222  	}
   223  
   224  	// query param lastSize
   225  	qrLastSize := o.LastSize
   226  	qLastSize := swag.FormatInt64(qrLastSize)
   227  	if qLastSize != "" {
   228  
   229  		if err := r.SetQueryParam("lastSize", qLastSize); err != nil {
   230  			return err
   231  		}
   232  	}
   233  
   234  	if o.TreeID != nil {
   235  
   236  		// query param treeID
   237  		var qrTreeID string
   238  
   239  		if o.TreeID != nil {
   240  			qrTreeID = *o.TreeID
   241  		}
   242  		qTreeID := qrTreeID
   243  		if qTreeID != "" {
   244  
   245  			if err := r.SetQueryParam("treeID", qTreeID); err != nil {
   246  				return err
   247  			}
   248  		}
   249  	}
   250  
   251  	if len(res) > 0 {
   252  		return errors.CompositeValidationError(res...)
   253  	}
   254  	return nil
   255  }
   256  

View as plain text