...

Source file src/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go

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

     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 index
    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  // SearchIndexReader is a Reader for the SearchIndex structure.
    35  type SearchIndexReader struct {
    36  	formats strfmt.Registry
    37  }
    38  
    39  // ReadResponse reads a server response into the received o.
    40  func (o *SearchIndexReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    41  	switch response.Code() {
    42  	case 200:
    43  		result := NewSearchIndexOK()
    44  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    45  			return nil, err
    46  		}
    47  		return result, nil
    48  	case 400:
    49  		result := NewSearchIndexBadRequest()
    50  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    51  			return nil, err
    52  		}
    53  		return nil, result
    54  	default:
    55  		result := NewSearchIndexDefault(response.Code())
    56  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    57  			return nil, err
    58  		}
    59  		if response.Code()/100 == 2 {
    60  			return result, nil
    61  		}
    62  		return nil, result
    63  	}
    64  }
    65  
    66  // NewSearchIndexOK creates a SearchIndexOK with default headers values
    67  func NewSearchIndexOK() *SearchIndexOK {
    68  	return &SearchIndexOK{}
    69  }
    70  
    71  /*
    72  SearchIndexOK describes a response with status code 200, with default header values.
    73  
    74  Returns zero or more entry UUIDs from the transparency log based on search query
    75  */
    76  type SearchIndexOK struct {
    77  	Payload []string
    78  }
    79  
    80  // IsSuccess returns true when this search index o k response has a 2xx status code
    81  func (o *SearchIndexOK) IsSuccess() bool {
    82  	return true
    83  }
    84  
    85  // IsRedirect returns true when this search index o k response has a 3xx status code
    86  func (o *SearchIndexOK) IsRedirect() bool {
    87  	return false
    88  }
    89  
    90  // IsClientError returns true when this search index o k response has a 4xx status code
    91  func (o *SearchIndexOK) IsClientError() bool {
    92  	return false
    93  }
    94  
    95  // IsServerError returns true when this search index o k response has a 5xx status code
    96  func (o *SearchIndexOK) IsServerError() bool {
    97  	return false
    98  }
    99  
   100  // IsCode returns true when this search index o k response a status code equal to that given
   101  func (o *SearchIndexOK) IsCode(code int) bool {
   102  	return code == 200
   103  }
   104  
   105  // Code gets the status code for the search index o k response
   106  func (o *SearchIndexOK) Code() int {
   107  	return 200
   108  }
   109  
   110  func (o *SearchIndexOK) Error() string {
   111  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexOK  %+v", 200, o.Payload)
   112  }
   113  
   114  func (o *SearchIndexOK) String() string {
   115  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexOK  %+v", 200, o.Payload)
   116  }
   117  
   118  func (o *SearchIndexOK) GetPayload() []string {
   119  	return o.Payload
   120  }
   121  
   122  func (o *SearchIndexOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   123  
   124  	// response payload
   125  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   126  		return err
   127  	}
   128  
   129  	return nil
   130  }
   131  
   132  // NewSearchIndexBadRequest creates a SearchIndexBadRequest with default headers values
   133  func NewSearchIndexBadRequest() *SearchIndexBadRequest {
   134  	return &SearchIndexBadRequest{}
   135  }
   136  
   137  /*
   138  SearchIndexBadRequest describes a response with status code 400, with default header values.
   139  
   140  The content supplied to the server was invalid
   141  */
   142  type SearchIndexBadRequest struct {
   143  	Payload *models.Error
   144  }
   145  
   146  // IsSuccess returns true when this search index bad request response has a 2xx status code
   147  func (o *SearchIndexBadRequest) IsSuccess() bool {
   148  	return false
   149  }
   150  
   151  // IsRedirect returns true when this search index bad request response has a 3xx status code
   152  func (o *SearchIndexBadRequest) IsRedirect() bool {
   153  	return false
   154  }
   155  
   156  // IsClientError returns true when this search index bad request response has a 4xx status code
   157  func (o *SearchIndexBadRequest) IsClientError() bool {
   158  	return true
   159  }
   160  
   161  // IsServerError returns true when this search index bad request response has a 5xx status code
   162  func (o *SearchIndexBadRequest) IsServerError() bool {
   163  	return false
   164  }
   165  
   166  // IsCode returns true when this search index bad request response a status code equal to that given
   167  func (o *SearchIndexBadRequest) IsCode(code int) bool {
   168  	return code == 400
   169  }
   170  
   171  // Code gets the status code for the search index bad request response
   172  func (o *SearchIndexBadRequest) Code() int {
   173  	return 400
   174  }
   175  
   176  func (o *SearchIndexBadRequest) Error() string {
   177  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexBadRequest  %+v", 400, o.Payload)
   178  }
   179  
   180  func (o *SearchIndexBadRequest) String() string {
   181  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexBadRequest  %+v", 400, o.Payload)
   182  }
   183  
   184  func (o *SearchIndexBadRequest) GetPayload() *models.Error {
   185  	return o.Payload
   186  }
   187  
   188  func (o *SearchIndexBadRequest) 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  
   200  // NewSearchIndexDefault creates a SearchIndexDefault with default headers values
   201  func NewSearchIndexDefault(code int) *SearchIndexDefault {
   202  	return &SearchIndexDefault{
   203  		_statusCode: code,
   204  	}
   205  }
   206  
   207  /*
   208  SearchIndexDefault describes a response with status code -1, with default header values.
   209  
   210  There was an internal error in the server while processing the request
   211  */
   212  type SearchIndexDefault struct {
   213  	_statusCode int
   214  
   215  	Payload *models.Error
   216  }
   217  
   218  // IsSuccess returns true when this search index default response has a 2xx status code
   219  func (o *SearchIndexDefault) IsSuccess() bool {
   220  	return o._statusCode/100 == 2
   221  }
   222  
   223  // IsRedirect returns true when this search index default response has a 3xx status code
   224  func (o *SearchIndexDefault) IsRedirect() bool {
   225  	return o._statusCode/100 == 3
   226  }
   227  
   228  // IsClientError returns true when this search index default response has a 4xx status code
   229  func (o *SearchIndexDefault) IsClientError() bool {
   230  	return o._statusCode/100 == 4
   231  }
   232  
   233  // IsServerError returns true when this search index default response has a 5xx status code
   234  func (o *SearchIndexDefault) IsServerError() bool {
   235  	return o._statusCode/100 == 5
   236  }
   237  
   238  // IsCode returns true when this search index default response a status code equal to that given
   239  func (o *SearchIndexDefault) IsCode(code int) bool {
   240  	return o._statusCode == code
   241  }
   242  
   243  // Code gets the status code for the search index default response
   244  func (o *SearchIndexDefault) Code() int {
   245  	return o._statusCode
   246  }
   247  
   248  func (o *SearchIndexDefault) Error() string {
   249  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndex default  %+v", o._statusCode, o.Payload)
   250  }
   251  
   252  func (o *SearchIndexDefault) String() string {
   253  	return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndex default  %+v", o._statusCode, o.Payload)
   254  }
   255  
   256  func (o *SearchIndexDefault) GetPayload() *models.Error {
   257  	return o.Payload
   258  }
   259  
   260  func (o *SearchIndexDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   261  
   262  	o.Payload = new(models.Error)
   263  
   264  	// response payload
   265  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   266  		return err
   267  	}
   268  
   269  	return nil
   270  }
   271  

View as plain text