...

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

View as plain text