github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/authentication/login_as_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package authentication
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/go-openapi/runtime"
    13  	"github.com/go-openapi/strfmt"
    14  
    15  	"github.com/ActiveState/cli/pkg/platform/api/mono/mono_models"
    16  )
    17  
    18  // LoginAsReader is a Reader for the LoginAs structure.
    19  type LoginAsReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *LoginAsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewLoginAsOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	case 400:
    33  		result := NewLoginAsBadRequest()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 401:
    39  		result := NewLoginAsUnauthorized()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 500:
    45  		result := NewLoginAsInternalServerError()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	default:
    51  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    52  	}
    53  }
    54  
    55  // NewLoginAsOK creates a LoginAsOK with default headers values
    56  func NewLoginAsOK() *LoginAsOK {
    57  	return &LoginAsOK{}
    58  }
    59  
    60  /* LoginAsOK describes a response with status code 200, with default header values.
    61  
    62  Success
    63  */
    64  type LoginAsOK struct {
    65  	Payload *mono_models.JWT
    66  }
    67  
    68  func (o *LoginAsOK) Error() string {
    69  	return fmt.Sprintf("[POST /login/{username}][%d] loginAsOK  %+v", 200, o.Payload)
    70  }
    71  func (o *LoginAsOK) GetPayload() *mono_models.JWT {
    72  	return o.Payload
    73  }
    74  
    75  func (o *LoginAsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    76  
    77  	o.Payload = new(mono_models.JWT)
    78  
    79  	// response payload
    80  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
    81  		return err
    82  	}
    83  
    84  	return nil
    85  }
    86  
    87  // NewLoginAsBadRequest creates a LoginAsBadRequest with default headers values
    88  func NewLoginAsBadRequest() *LoginAsBadRequest {
    89  	return &LoginAsBadRequest{}
    90  }
    91  
    92  /* LoginAsBadRequest describes a response with status code 400, with default header values.
    93  
    94  Bad Request
    95  */
    96  type LoginAsBadRequest struct {
    97  	Payload *mono_models.Message
    98  }
    99  
   100  func (o *LoginAsBadRequest) Error() string {
   101  	return fmt.Sprintf("[POST /login/{username}][%d] loginAsBadRequest  %+v", 400, o.Payload)
   102  }
   103  func (o *LoginAsBadRequest) GetPayload() *mono_models.Message {
   104  	return o.Payload
   105  }
   106  
   107  func (o *LoginAsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   108  
   109  	o.Payload = new(mono_models.Message)
   110  
   111  	// response payload
   112  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   113  		return err
   114  	}
   115  
   116  	return nil
   117  }
   118  
   119  // NewLoginAsUnauthorized creates a LoginAsUnauthorized with default headers values
   120  func NewLoginAsUnauthorized() *LoginAsUnauthorized {
   121  	return &LoginAsUnauthorized{}
   122  }
   123  
   124  /* LoginAsUnauthorized describes a response with status code 401, with default header values.
   125  
   126  Invalid credentials
   127  */
   128  type LoginAsUnauthorized struct {
   129  	Payload *mono_models.Message
   130  }
   131  
   132  func (o *LoginAsUnauthorized) Error() string {
   133  	return fmt.Sprintf("[POST /login/{username}][%d] loginAsUnauthorized  %+v", 401, o.Payload)
   134  }
   135  func (o *LoginAsUnauthorized) GetPayload() *mono_models.Message {
   136  	return o.Payload
   137  }
   138  
   139  func (o *LoginAsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   140  
   141  	o.Payload = new(mono_models.Message)
   142  
   143  	// response payload
   144  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   145  		return err
   146  	}
   147  
   148  	return nil
   149  }
   150  
   151  // NewLoginAsInternalServerError creates a LoginAsInternalServerError with default headers values
   152  func NewLoginAsInternalServerError() *LoginAsInternalServerError {
   153  	return &LoginAsInternalServerError{}
   154  }
   155  
   156  /* LoginAsInternalServerError describes a response with status code 500, with default header values.
   157  
   158  Server Error
   159  */
   160  type LoginAsInternalServerError struct {
   161  	Payload *mono_models.Message
   162  }
   163  
   164  func (o *LoginAsInternalServerError) Error() string {
   165  	return fmt.Sprintf("[POST /login/{username}][%d] loginAsInternalServerError  %+v", 500, o.Payload)
   166  }
   167  func (o *LoginAsInternalServerError) GetPayload() *mono_models.Message {
   168  	return o.Payload
   169  }
   170  
   171  func (o *LoginAsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   172  
   173  	o.Payload = new(mono_models.Message)
   174  
   175  	// response payload
   176  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   177  		return err
   178  	}
   179  
   180  	return nil
   181  }