...

Source file src/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.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  	"fmt"
    26  	"io"
    27  
    28  	"github.com/go-openapi/runtime"
    29  	"github.com/go-openapi/strfmt"
    30  
    31  	"github.com/sigstore/rekor/pkg/generated/models"
    32  )
    33  
    34  // GetPublicKeyReader is a Reader for the GetPublicKey structure.
    35  type GetPublicKeyReader struct {
    36  	formats strfmt.Registry
    37  }
    38  
    39  // ReadResponse reads a server response into the received o.
    40  func (o *GetPublicKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    41  	switch response.Code() {
    42  	case 200:
    43  		result := NewGetPublicKeyOK()
    44  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    45  			return nil, err
    46  		}
    47  		return result, nil
    48  	default:
    49  		result := NewGetPublicKeyDefault(response.Code())
    50  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    51  			return nil, err
    52  		}
    53  		if response.Code()/100 == 2 {
    54  			return result, nil
    55  		}
    56  		return nil, result
    57  	}
    58  }
    59  
    60  // NewGetPublicKeyOK creates a GetPublicKeyOK with default headers values
    61  func NewGetPublicKeyOK() *GetPublicKeyOK {
    62  	return &GetPublicKeyOK{}
    63  }
    64  
    65  /*
    66  GetPublicKeyOK describes a response with status code 200, with default header values.
    67  
    68  The public key
    69  */
    70  type GetPublicKeyOK struct {
    71  	Payload string
    72  }
    73  
    74  // IsSuccess returns true when this get public key o k response has a 2xx status code
    75  func (o *GetPublicKeyOK) IsSuccess() bool {
    76  	return true
    77  }
    78  
    79  // IsRedirect returns true when this get public key o k response has a 3xx status code
    80  func (o *GetPublicKeyOK) IsRedirect() bool {
    81  	return false
    82  }
    83  
    84  // IsClientError returns true when this get public key o k response has a 4xx status code
    85  func (o *GetPublicKeyOK) IsClientError() bool {
    86  	return false
    87  }
    88  
    89  // IsServerError returns true when this get public key o k response has a 5xx status code
    90  func (o *GetPublicKeyOK) IsServerError() bool {
    91  	return false
    92  }
    93  
    94  // IsCode returns true when this get public key o k response a status code equal to that given
    95  func (o *GetPublicKeyOK) IsCode(code int) bool {
    96  	return code == 200
    97  }
    98  
    99  // Code gets the status code for the get public key o k response
   100  func (o *GetPublicKeyOK) Code() int {
   101  	return 200
   102  }
   103  
   104  func (o *GetPublicKeyOK) Error() string {
   105  	return fmt.Sprintf("[GET /api/v1/log/publicKey][%d] getPublicKeyOK  %+v", 200, o.Payload)
   106  }
   107  
   108  func (o *GetPublicKeyOK) String() string {
   109  	return fmt.Sprintf("[GET /api/v1/log/publicKey][%d] getPublicKeyOK  %+v", 200, o.Payload)
   110  }
   111  
   112  func (o *GetPublicKeyOK) GetPayload() string {
   113  	return o.Payload
   114  }
   115  
   116  func (o *GetPublicKeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   117  
   118  	// response payload
   119  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   120  		return err
   121  	}
   122  
   123  	return nil
   124  }
   125  
   126  // NewGetPublicKeyDefault creates a GetPublicKeyDefault with default headers values
   127  func NewGetPublicKeyDefault(code int) *GetPublicKeyDefault {
   128  	return &GetPublicKeyDefault{
   129  		_statusCode: code,
   130  	}
   131  }
   132  
   133  /*
   134  GetPublicKeyDefault describes a response with status code -1, with default header values.
   135  
   136  There was an internal error in the server while processing the request
   137  */
   138  type GetPublicKeyDefault struct {
   139  	_statusCode int
   140  
   141  	Payload *models.Error
   142  }
   143  
   144  // IsSuccess returns true when this get public key default response has a 2xx status code
   145  func (o *GetPublicKeyDefault) IsSuccess() bool {
   146  	return o._statusCode/100 == 2
   147  }
   148  
   149  // IsRedirect returns true when this get public key default response has a 3xx status code
   150  func (o *GetPublicKeyDefault) IsRedirect() bool {
   151  	return o._statusCode/100 == 3
   152  }
   153  
   154  // IsClientError returns true when this get public key default response has a 4xx status code
   155  func (o *GetPublicKeyDefault) IsClientError() bool {
   156  	return o._statusCode/100 == 4
   157  }
   158  
   159  // IsServerError returns true when this get public key default response has a 5xx status code
   160  func (o *GetPublicKeyDefault) IsServerError() bool {
   161  	return o._statusCode/100 == 5
   162  }
   163  
   164  // IsCode returns true when this get public key default response a status code equal to that given
   165  func (o *GetPublicKeyDefault) IsCode(code int) bool {
   166  	return o._statusCode == code
   167  }
   168  
   169  // Code gets the status code for the get public key default response
   170  func (o *GetPublicKeyDefault) Code() int {
   171  	return o._statusCode
   172  }
   173  
   174  func (o *GetPublicKeyDefault) Error() string {
   175  	return fmt.Sprintf("[GET /api/v1/log/publicKey][%d] getPublicKey default  %+v", o._statusCode, o.Payload)
   176  }
   177  
   178  func (o *GetPublicKeyDefault) String() string {
   179  	return fmt.Sprintf("[GET /api/v1/log/publicKey][%d] getPublicKey default  %+v", o._statusCode, o.Payload)
   180  }
   181  
   182  func (o *GetPublicKeyDefault) GetPayload() *models.Error {
   183  	return o.Payload
   184  }
   185  
   186  func (o *GetPublicKeyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   187  
   188  	o.Payload = new(models.Error)
   189  
   190  	// response payload
   191  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   192  		return err
   193  	}
   194  
   195  	return nil
   196  }
   197  

View as plain text