...

Source file src/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_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  // NewGetLogInfoParams creates a new GetLogInfoParams 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 NewGetLogInfoParams() *GetLogInfoParams {
    43  	return &GetLogInfoParams{
    44  		timeout: cr.DefaultTimeout,
    45  	}
    46  }
    47  
    48  // NewGetLogInfoParamsWithTimeout creates a new GetLogInfoParams object
    49  // with the ability to set a timeout on a request.
    50  func NewGetLogInfoParamsWithTimeout(timeout time.Duration) *GetLogInfoParams {
    51  	return &GetLogInfoParams{
    52  		timeout: timeout,
    53  	}
    54  }
    55  
    56  // NewGetLogInfoParamsWithContext creates a new GetLogInfoParams object
    57  // with the ability to set a context for a request.
    58  func NewGetLogInfoParamsWithContext(ctx context.Context) *GetLogInfoParams {
    59  	return &GetLogInfoParams{
    60  		Context: ctx,
    61  	}
    62  }
    63  
    64  // NewGetLogInfoParamsWithHTTPClient creates a new GetLogInfoParams object
    65  // with the ability to set a custom HTTPClient for a request.
    66  func NewGetLogInfoParamsWithHTTPClient(client *http.Client) *GetLogInfoParams {
    67  	return &GetLogInfoParams{
    68  		HTTPClient: client,
    69  	}
    70  }
    71  
    72  /*
    73  GetLogInfoParams contains all the parameters to send to the API endpoint
    74  
    75  	for the get log info operation.
    76  
    77  	Typically these are written to a http.Request.
    78  */
    79  type GetLogInfoParams struct {
    80  
    81  	/* Stable.
    82  
    83  	   Whether to return a stable checkpoint for the active shard
    84  	*/
    85  	Stable *bool
    86  
    87  	timeout    time.Duration
    88  	Context    context.Context
    89  	HTTPClient *http.Client
    90  }
    91  
    92  // WithDefaults hydrates default values in the get log info params (not the query body).
    93  //
    94  // All values with no default are reset to their zero value.
    95  func (o *GetLogInfoParams) WithDefaults() *GetLogInfoParams {
    96  	o.SetDefaults()
    97  	return o
    98  }
    99  
   100  // SetDefaults hydrates default values in the get log info params (not the query body).
   101  //
   102  // All values with no default are reset to their zero value.
   103  func (o *GetLogInfoParams) SetDefaults() {
   104  	var (
   105  		stableDefault = bool(false)
   106  	)
   107  
   108  	val := GetLogInfoParams{
   109  		Stable: &stableDefault,
   110  	}
   111  
   112  	val.timeout = o.timeout
   113  	val.Context = o.Context
   114  	val.HTTPClient = o.HTTPClient
   115  	*o = val
   116  }
   117  
   118  // WithTimeout adds the timeout to the get log info params
   119  func (o *GetLogInfoParams) WithTimeout(timeout time.Duration) *GetLogInfoParams {
   120  	o.SetTimeout(timeout)
   121  	return o
   122  }
   123  
   124  // SetTimeout adds the timeout to the get log info params
   125  func (o *GetLogInfoParams) SetTimeout(timeout time.Duration) {
   126  	o.timeout = timeout
   127  }
   128  
   129  // WithContext adds the context to the get log info params
   130  func (o *GetLogInfoParams) WithContext(ctx context.Context) *GetLogInfoParams {
   131  	o.SetContext(ctx)
   132  	return o
   133  }
   134  
   135  // SetContext adds the context to the get log info params
   136  func (o *GetLogInfoParams) SetContext(ctx context.Context) {
   137  	o.Context = ctx
   138  }
   139  
   140  // WithHTTPClient adds the HTTPClient to the get log info params
   141  func (o *GetLogInfoParams) WithHTTPClient(client *http.Client) *GetLogInfoParams {
   142  	o.SetHTTPClient(client)
   143  	return o
   144  }
   145  
   146  // SetHTTPClient adds the HTTPClient to the get log info params
   147  func (o *GetLogInfoParams) SetHTTPClient(client *http.Client) {
   148  	o.HTTPClient = client
   149  }
   150  
   151  // WithStable adds the stable to the get log info params
   152  func (o *GetLogInfoParams) WithStable(stable *bool) *GetLogInfoParams {
   153  	o.SetStable(stable)
   154  	return o
   155  }
   156  
   157  // SetStable adds the stable to the get log info params
   158  func (o *GetLogInfoParams) SetStable(stable *bool) {
   159  	o.Stable = stable
   160  }
   161  
   162  // WriteToRequest writes these params to a swagger request
   163  func (o *GetLogInfoParams) 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  	if o.Stable != nil {
   171  
   172  		// query param stable
   173  		var qrStable bool
   174  
   175  		if o.Stable != nil {
   176  			qrStable = *o.Stable
   177  		}
   178  		qStable := swag.FormatBool(qrStable)
   179  		if qStable != "" {
   180  
   181  			if err := r.SetQueryParam("stable", qStable); err != nil {
   182  				return err
   183  			}
   184  		}
   185  	}
   186  
   187  	if len(res) > 0 {
   188  		return errors.CompositeValidationError(res...)
   189  	}
   190  	return nil
   191  }
   192  

View as plain text