...

Source file src/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go

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

     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 entries
    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/errors"
    29  	"github.com/go-openapi/runtime"
    30  	"github.com/go-openapi/strfmt"
    31  
    32  	"github.com/sigstore/rekor/pkg/generated/models"
    33  )
    34  
    35  // CreateLogEntryReader is a Reader for the CreateLogEntry structure.
    36  type CreateLogEntryReader struct {
    37  	formats strfmt.Registry
    38  }
    39  
    40  // ReadResponse reads a server response into the received o.
    41  func (o *CreateLogEntryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    42  	switch response.Code() {
    43  	case 201:
    44  		result := NewCreateLogEntryCreated()
    45  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    46  			return nil, err
    47  		}
    48  		return result, nil
    49  	case 400:
    50  		result := NewCreateLogEntryBadRequest()
    51  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    52  			return nil, err
    53  		}
    54  		return nil, result
    55  	case 409:
    56  		result := NewCreateLogEntryConflict()
    57  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    58  			return nil, err
    59  		}
    60  		return nil, result
    61  	default:
    62  		result := NewCreateLogEntryDefault(response.Code())
    63  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    64  			return nil, err
    65  		}
    66  		if response.Code()/100 == 2 {
    67  			return result, nil
    68  		}
    69  		return nil, result
    70  	}
    71  }
    72  
    73  // NewCreateLogEntryCreated creates a CreateLogEntryCreated with default headers values
    74  func NewCreateLogEntryCreated() *CreateLogEntryCreated {
    75  	return &CreateLogEntryCreated{}
    76  }
    77  
    78  /*
    79  CreateLogEntryCreated describes a response with status code 201, with default header values.
    80  
    81  Returns the entry created in the transparency log
    82  */
    83  type CreateLogEntryCreated struct {
    84  
    85  	/* UUID of log entry
    86  	 */
    87  	ETag string
    88  
    89  	/* URI location of log entry
    90  
    91  	   Format: uri
    92  	*/
    93  	Location strfmt.URI
    94  
    95  	Payload models.LogEntry
    96  }
    97  
    98  // IsSuccess returns true when this create log entry created response has a 2xx status code
    99  func (o *CreateLogEntryCreated) IsSuccess() bool {
   100  	return true
   101  }
   102  
   103  // IsRedirect returns true when this create log entry created response has a 3xx status code
   104  func (o *CreateLogEntryCreated) IsRedirect() bool {
   105  	return false
   106  }
   107  
   108  // IsClientError returns true when this create log entry created response has a 4xx status code
   109  func (o *CreateLogEntryCreated) IsClientError() bool {
   110  	return false
   111  }
   112  
   113  // IsServerError returns true when this create log entry created response has a 5xx status code
   114  func (o *CreateLogEntryCreated) IsServerError() bool {
   115  	return false
   116  }
   117  
   118  // IsCode returns true when this create log entry created response a status code equal to that given
   119  func (o *CreateLogEntryCreated) IsCode(code int) bool {
   120  	return code == 201
   121  }
   122  
   123  // Code gets the status code for the create log entry created response
   124  func (o *CreateLogEntryCreated) Code() int {
   125  	return 201
   126  }
   127  
   128  func (o *CreateLogEntryCreated) Error() string {
   129  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryCreated  %+v", 201, o.Payload)
   130  }
   131  
   132  func (o *CreateLogEntryCreated) String() string {
   133  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryCreated  %+v", 201, o.Payload)
   134  }
   135  
   136  func (o *CreateLogEntryCreated) GetPayload() models.LogEntry {
   137  	return o.Payload
   138  }
   139  
   140  func (o *CreateLogEntryCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   141  
   142  	// hydrates response header ETag
   143  	hdrETag := response.GetHeader("ETag")
   144  
   145  	if hdrETag != "" {
   146  		o.ETag = hdrETag
   147  	}
   148  
   149  	// hydrates response header Location
   150  	hdrLocation := response.GetHeader("Location")
   151  
   152  	if hdrLocation != "" {
   153  		vallocation, err := formats.Parse("uri", hdrLocation)
   154  		if err != nil {
   155  			return errors.InvalidType("Location", "header", "strfmt.URI", hdrLocation)
   156  		}
   157  		o.Location = *(vallocation.(*strfmt.URI))
   158  	}
   159  
   160  	// response payload
   161  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   162  		return err
   163  	}
   164  
   165  	return nil
   166  }
   167  
   168  // NewCreateLogEntryBadRequest creates a CreateLogEntryBadRequest with default headers values
   169  func NewCreateLogEntryBadRequest() *CreateLogEntryBadRequest {
   170  	return &CreateLogEntryBadRequest{}
   171  }
   172  
   173  /*
   174  CreateLogEntryBadRequest describes a response with status code 400, with default header values.
   175  
   176  The content supplied to the server was invalid
   177  */
   178  type CreateLogEntryBadRequest struct {
   179  	Payload *models.Error
   180  }
   181  
   182  // IsSuccess returns true when this create log entry bad request response has a 2xx status code
   183  func (o *CreateLogEntryBadRequest) IsSuccess() bool {
   184  	return false
   185  }
   186  
   187  // IsRedirect returns true when this create log entry bad request response has a 3xx status code
   188  func (o *CreateLogEntryBadRequest) IsRedirect() bool {
   189  	return false
   190  }
   191  
   192  // IsClientError returns true when this create log entry bad request response has a 4xx status code
   193  func (o *CreateLogEntryBadRequest) IsClientError() bool {
   194  	return true
   195  }
   196  
   197  // IsServerError returns true when this create log entry bad request response has a 5xx status code
   198  func (o *CreateLogEntryBadRequest) IsServerError() bool {
   199  	return false
   200  }
   201  
   202  // IsCode returns true when this create log entry bad request response a status code equal to that given
   203  func (o *CreateLogEntryBadRequest) IsCode(code int) bool {
   204  	return code == 400
   205  }
   206  
   207  // Code gets the status code for the create log entry bad request response
   208  func (o *CreateLogEntryBadRequest) Code() int {
   209  	return 400
   210  }
   211  
   212  func (o *CreateLogEntryBadRequest) Error() string {
   213  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryBadRequest  %+v", 400, o.Payload)
   214  }
   215  
   216  func (o *CreateLogEntryBadRequest) String() string {
   217  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryBadRequest  %+v", 400, o.Payload)
   218  }
   219  
   220  func (o *CreateLogEntryBadRequest) GetPayload() *models.Error {
   221  	return o.Payload
   222  }
   223  
   224  func (o *CreateLogEntryBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   225  
   226  	o.Payload = new(models.Error)
   227  
   228  	// response payload
   229  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   230  		return err
   231  	}
   232  
   233  	return nil
   234  }
   235  
   236  // NewCreateLogEntryConflict creates a CreateLogEntryConflict with default headers values
   237  func NewCreateLogEntryConflict() *CreateLogEntryConflict {
   238  	return &CreateLogEntryConflict{}
   239  }
   240  
   241  /*
   242  CreateLogEntryConflict describes a response with status code 409, with default header values.
   243  
   244  The request conflicts with the current state of the transparency log
   245  */
   246  type CreateLogEntryConflict struct {
   247  	Location strfmt.URI
   248  
   249  	Payload *models.Error
   250  }
   251  
   252  // IsSuccess returns true when this create log entry conflict response has a 2xx status code
   253  func (o *CreateLogEntryConflict) IsSuccess() bool {
   254  	return false
   255  }
   256  
   257  // IsRedirect returns true when this create log entry conflict response has a 3xx status code
   258  func (o *CreateLogEntryConflict) IsRedirect() bool {
   259  	return false
   260  }
   261  
   262  // IsClientError returns true when this create log entry conflict response has a 4xx status code
   263  func (o *CreateLogEntryConflict) IsClientError() bool {
   264  	return true
   265  }
   266  
   267  // IsServerError returns true when this create log entry conflict response has a 5xx status code
   268  func (o *CreateLogEntryConflict) IsServerError() bool {
   269  	return false
   270  }
   271  
   272  // IsCode returns true when this create log entry conflict response a status code equal to that given
   273  func (o *CreateLogEntryConflict) IsCode(code int) bool {
   274  	return code == 409
   275  }
   276  
   277  // Code gets the status code for the create log entry conflict response
   278  func (o *CreateLogEntryConflict) Code() int {
   279  	return 409
   280  }
   281  
   282  func (o *CreateLogEntryConflict) Error() string {
   283  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryConflict  %+v", 409, o.Payload)
   284  }
   285  
   286  func (o *CreateLogEntryConflict) String() string {
   287  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntryConflict  %+v", 409, o.Payload)
   288  }
   289  
   290  func (o *CreateLogEntryConflict) GetPayload() *models.Error {
   291  	return o.Payload
   292  }
   293  
   294  func (o *CreateLogEntryConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   295  
   296  	// hydrates response header Location
   297  	hdrLocation := response.GetHeader("Location")
   298  
   299  	if hdrLocation != "" {
   300  		vallocation, err := formats.Parse("uri", hdrLocation)
   301  		if err != nil {
   302  			return errors.InvalidType("Location", "header", "strfmt.URI", hdrLocation)
   303  		}
   304  		o.Location = *(vallocation.(*strfmt.URI))
   305  	}
   306  
   307  	o.Payload = new(models.Error)
   308  
   309  	// response payload
   310  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   311  		return err
   312  	}
   313  
   314  	return nil
   315  }
   316  
   317  // NewCreateLogEntryDefault creates a CreateLogEntryDefault with default headers values
   318  func NewCreateLogEntryDefault(code int) *CreateLogEntryDefault {
   319  	return &CreateLogEntryDefault{
   320  		_statusCode: code,
   321  	}
   322  }
   323  
   324  /*
   325  CreateLogEntryDefault describes a response with status code -1, with default header values.
   326  
   327  There was an internal error in the server while processing the request
   328  */
   329  type CreateLogEntryDefault struct {
   330  	_statusCode int
   331  
   332  	Payload *models.Error
   333  }
   334  
   335  // IsSuccess returns true when this create log entry default response has a 2xx status code
   336  func (o *CreateLogEntryDefault) IsSuccess() bool {
   337  	return o._statusCode/100 == 2
   338  }
   339  
   340  // IsRedirect returns true when this create log entry default response has a 3xx status code
   341  func (o *CreateLogEntryDefault) IsRedirect() bool {
   342  	return o._statusCode/100 == 3
   343  }
   344  
   345  // IsClientError returns true when this create log entry default response has a 4xx status code
   346  func (o *CreateLogEntryDefault) IsClientError() bool {
   347  	return o._statusCode/100 == 4
   348  }
   349  
   350  // IsServerError returns true when this create log entry default response has a 5xx status code
   351  func (o *CreateLogEntryDefault) IsServerError() bool {
   352  	return o._statusCode/100 == 5
   353  }
   354  
   355  // IsCode returns true when this create log entry default response a status code equal to that given
   356  func (o *CreateLogEntryDefault) IsCode(code int) bool {
   357  	return o._statusCode == code
   358  }
   359  
   360  // Code gets the status code for the create log entry default response
   361  func (o *CreateLogEntryDefault) Code() int {
   362  	return o._statusCode
   363  }
   364  
   365  func (o *CreateLogEntryDefault) Error() string {
   366  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntry default  %+v", o._statusCode, o.Payload)
   367  }
   368  
   369  func (o *CreateLogEntryDefault) String() string {
   370  	return fmt.Sprintf("[POST /api/v1/log/entries][%d] createLogEntry default  %+v", o._statusCode, o.Payload)
   371  }
   372  
   373  func (o *CreateLogEntryDefault) GetPayload() *models.Error {
   374  	return o.Payload
   375  }
   376  
   377  func (o *CreateLogEntryDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   378  
   379  	o.Payload = new(models.Error)
   380  
   381  	// response payload
   382  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   383  		return err
   384  	}
   385  
   386  	return nil
   387  }
   388  

View as plain text