github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/user/get_current_user_permissions_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package user
     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/goharbor/go-client/pkg/sdk/v2.0/models"
    16  )
    17  
    18  // GetCurrentUserPermissionsReader is a Reader for the GetCurrentUserPermissions structure.
    19  type GetCurrentUserPermissionsReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetCurrentUserPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetCurrentUserPermissionsOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	case 401:
    33  		result := NewGetCurrentUserPermissionsUnauthorized()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 500:
    39  		result := NewGetCurrentUserPermissionsInternalServerError()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	default:
    45  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    46  	}
    47  }
    48  
    49  // NewGetCurrentUserPermissionsOK creates a GetCurrentUserPermissionsOK with default headers values
    50  func NewGetCurrentUserPermissionsOK() *GetCurrentUserPermissionsOK {
    51  	return &GetCurrentUserPermissionsOK{}
    52  }
    53  
    54  /*
    55  GetCurrentUserPermissionsOK describes a response with status code 200, with default header values.
    56  
    57  Get current user permission successfully.
    58  */
    59  type GetCurrentUserPermissionsOK struct {
    60  	Payload []*models.Permission
    61  }
    62  
    63  // IsSuccess returns true when this get current user permissions o k response has a 2xx status code
    64  func (o *GetCurrentUserPermissionsOK) IsSuccess() bool {
    65  	return true
    66  }
    67  
    68  // IsRedirect returns true when this get current user permissions o k response has a 3xx status code
    69  func (o *GetCurrentUserPermissionsOK) IsRedirect() bool {
    70  	return false
    71  }
    72  
    73  // IsClientError returns true when this get current user permissions o k response has a 4xx status code
    74  func (o *GetCurrentUserPermissionsOK) IsClientError() bool {
    75  	return false
    76  }
    77  
    78  // IsServerError returns true when this get current user permissions o k response has a 5xx status code
    79  func (o *GetCurrentUserPermissionsOK) IsServerError() bool {
    80  	return false
    81  }
    82  
    83  // IsCode returns true when this get current user permissions o k response a status code equal to that given
    84  func (o *GetCurrentUserPermissionsOK) IsCode(code int) bool {
    85  	return code == 200
    86  }
    87  
    88  func (o *GetCurrentUserPermissionsOK) Error() string {
    89  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsOK  %+v", 200, o.Payload)
    90  }
    91  
    92  func (o *GetCurrentUserPermissionsOK) String() string {
    93  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsOK  %+v", 200, o.Payload)
    94  }
    95  
    96  func (o *GetCurrentUserPermissionsOK) GetPayload() []*models.Permission {
    97  	return o.Payload
    98  }
    99  
   100  func (o *GetCurrentUserPermissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   101  
   102  	// response payload
   103  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
   104  		return err
   105  	}
   106  
   107  	return nil
   108  }
   109  
   110  // NewGetCurrentUserPermissionsUnauthorized creates a GetCurrentUserPermissionsUnauthorized with default headers values
   111  func NewGetCurrentUserPermissionsUnauthorized() *GetCurrentUserPermissionsUnauthorized {
   112  	return &GetCurrentUserPermissionsUnauthorized{}
   113  }
   114  
   115  /*
   116  GetCurrentUserPermissionsUnauthorized describes a response with status code 401, with default header values.
   117  
   118  User need to log in first.
   119  */
   120  type GetCurrentUserPermissionsUnauthorized struct {
   121  }
   122  
   123  // IsSuccess returns true when this get current user permissions unauthorized response has a 2xx status code
   124  func (o *GetCurrentUserPermissionsUnauthorized) IsSuccess() bool {
   125  	return false
   126  }
   127  
   128  // IsRedirect returns true when this get current user permissions unauthorized response has a 3xx status code
   129  func (o *GetCurrentUserPermissionsUnauthorized) IsRedirect() bool {
   130  	return false
   131  }
   132  
   133  // IsClientError returns true when this get current user permissions unauthorized response has a 4xx status code
   134  func (o *GetCurrentUserPermissionsUnauthorized) IsClientError() bool {
   135  	return true
   136  }
   137  
   138  // IsServerError returns true when this get current user permissions unauthorized response has a 5xx status code
   139  func (o *GetCurrentUserPermissionsUnauthorized) IsServerError() bool {
   140  	return false
   141  }
   142  
   143  // IsCode returns true when this get current user permissions unauthorized response a status code equal to that given
   144  func (o *GetCurrentUserPermissionsUnauthorized) IsCode(code int) bool {
   145  	return code == 401
   146  }
   147  
   148  func (o *GetCurrentUserPermissionsUnauthorized) Error() string {
   149  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsUnauthorized ", 401)
   150  }
   151  
   152  func (o *GetCurrentUserPermissionsUnauthorized) String() string {
   153  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsUnauthorized ", 401)
   154  }
   155  
   156  func (o *GetCurrentUserPermissionsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   157  
   158  	return nil
   159  }
   160  
   161  // NewGetCurrentUserPermissionsInternalServerError creates a GetCurrentUserPermissionsInternalServerError with default headers values
   162  func NewGetCurrentUserPermissionsInternalServerError() *GetCurrentUserPermissionsInternalServerError {
   163  	return &GetCurrentUserPermissionsInternalServerError{}
   164  }
   165  
   166  /*
   167  GetCurrentUserPermissionsInternalServerError describes a response with status code 500, with default header values.
   168  
   169  Internal errors.
   170  */
   171  type GetCurrentUserPermissionsInternalServerError struct {
   172  }
   173  
   174  // IsSuccess returns true when this get current user permissions internal server error response has a 2xx status code
   175  func (o *GetCurrentUserPermissionsInternalServerError) IsSuccess() bool {
   176  	return false
   177  }
   178  
   179  // IsRedirect returns true when this get current user permissions internal server error response has a 3xx status code
   180  func (o *GetCurrentUserPermissionsInternalServerError) IsRedirect() bool {
   181  	return false
   182  }
   183  
   184  // IsClientError returns true when this get current user permissions internal server error response has a 4xx status code
   185  func (o *GetCurrentUserPermissionsInternalServerError) IsClientError() bool {
   186  	return false
   187  }
   188  
   189  // IsServerError returns true when this get current user permissions internal server error response has a 5xx status code
   190  func (o *GetCurrentUserPermissionsInternalServerError) IsServerError() bool {
   191  	return true
   192  }
   193  
   194  // IsCode returns true when this get current user permissions internal server error response a status code equal to that given
   195  func (o *GetCurrentUserPermissionsInternalServerError) IsCode(code int) bool {
   196  	return code == 500
   197  }
   198  
   199  func (o *GetCurrentUserPermissionsInternalServerError) Error() string {
   200  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsInternalServerError ", 500)
   201  }
   202  
   203  func (o *GetCurrentUserPermissionsInternalServerError) String() string {
   204  	return fmt.Sprintf("[GET /users/current/permissions][%d] getCurrentUserPermissionsInternalServerError ", 500)
   205  }
   206  
   207  func (o *GetCurrentUserPermissionsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   208  
   209  	return nil
   210  }