...

Source file src/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go

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

     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 pubkey
    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  )
    34  
    35  // NewGetPublicKeyParams creates a new GetPublicKeyParams object,
    36  // with the default timeout for this client.
    37  //
    38  // Default values are not hydrated, since defaults are normally applied by the API server side.
    39  //
    40  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    41  func NewGetPublicKeyParams() *GetPublicKeyParams {
    42  	return &GetPublicKeyParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewGetPublicKeyParamsWithTimeout creates a new GetPublicKeyParams object
    48  // with the ability to set a timeout on a request.
    49  func NewGetPublicKeyParamsWithTimeout(timeout time.Duration) *GetPublicKeyParams {
    50  	return &GetPublicKeyParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewGetPublicKeyParamsWithContext creates a new GetPublicKeyParams object
    56  // with the ability to set a context for a request.
    57  func NewGetPublicKeyParamsWithContext(ctx context.Context) *GetPublicKeyParams {
    58  	return &GetPublicKeyParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewGetPublicKeyParamsWithHTTPClient creates a new GetPublicKeyParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewGetPublicKeyParamsWithHTTPClient(client *http.Client) *GetPublicKeyParams {
    66  	return &GetPublicKeyParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /*
    72  GetPublicKeyParams contains all the parameters to send to the API endpoint
    73  
    74  	for the get public key operation.
    75  
    76  	Typically these are written to a http.Request.
    77  */
    78  type GetPublicKeyParams struct {
    79  
    80  	/* TreeID.
    81  
    82  	   The tree ID of the tree you wish to get a public key for
    83  	*/
    84  	TreeID *string
    85  
    86  	timeout    time.Duration
    87  	Context    context.Context
    88  	HTTPClient *http.Client
    89  }
    90  
    91  // WithDefaults hydrates default values in the get public key params (not the query body).
    92  //
    93  // All values with no default are reset to their zero value.
    94  func (o *GetPublicKeyParams) WithDefaults() *GetPublicKeyParams {
    95  	o.SetDefaults()
    96  	return o
    97  }
    98  
    99  // SetDefaults hydrates default values in the get public key params (not the query body).
   100  //
   101  // All values with no default are reset to their zero value.
   102  func (o *GetPublicKeyParams) SetDefaults() {
   103  	// no default values defined for this parameter
   104  }
   105  
   106  // WithTimeout adds the timeout to the get public key params
   107  func (o *GetPublicKeyParams) WithTimeout(timeout time.Duration) *GetPublicKeyParams {
   108  	o.SetTimeout(timeout)
   109  	return o
   110  }
   111  
   112  // SetTimeout adds the timeout to the get public key params
   113  func (o *GetPublicKeyParams) SetTimeout(timeout time.Duration) {
   114  	o.timeout = timeout
   115  }
   116  
   117  // WithContext adds the context to the get public key params
   118  func (o *GetPublicKeyParams) WithContext(ctx context.Context) *GetPublicKeyParams {
   119  	o.SetContext(ctx)
   120  	return o
   121  }
   122  
   123  // SetContext adds the context to the get public key params
   124  func (o *GetPublicKeyParams) SetContext(ctx context.Context) {
   125  	o.Context = ctx
   126  }
   127  
   128  // WithHTTPClient adds the HTTPClient to the get public key params
   129  func (o *GetPublicKeyParams) WithHTTPClient(client *http.Client) *GetPublicKeyParams {
   130  	o.SetHTTPClient(client)
   131  	return o
   132  }
   133  
   134  // SetHTTPClient adds the HTTPClient to the get public key params
   135  func (o *GetPublicKeyParams) SetHTTPClient(client *http.Client) {
   136  	o.HTTPClient = client
   137  }
   138  
   139  // WithTreeID adds the treeID to the get public key params
   140  func (o *GetPublicKeyParams) WithTreeID(treeID *string) *GetPublicKeyParams {
   141  	o.SetTreeID(treeID)
   142  	return o
   143  }
   144  
   145  // SetTreeID adds the treeId to the get public key params
   146  func (o *GetPublicKeyParams) SetTreeID(treeID *string) {
   147  	o.TreeID = treeID
   148  }
   149  
   150  // WriteToRequest writes these params to a swagger request
   151  func (o *GetPublicKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   152  
   153  	if err := r.SetTimeout(o.timeout); err != nil {
   154  		return err
   155  	}
   156  	var res []error
   157  
   158  	if o.TreeID != nil {
   159  
   160  		// query param treeID
   161  		var qrTreeID string
   162  
   163  		if o.TreeID != nil {
   164  			qrTreeID = *o.TreeID
   165  		}
   166  		qTreeID := qrTreeID
   167  		if qTreeID != "" {
   168  
   169  			if err := r.SetQueryParam("treeID", qTreeID); err != nil {
   170  				return err
   171  			}
   172  		}
   173  	}
   174  
   175  	if len(res) > 0 {
   176  		return errors.CompositeValidationError(res...)
   177  	}
   178  	return nil
   179  }
   180  

View as plain text