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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package securityhub
     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  // GetSecuritySummaryReader is a Reader for the GetSecuritySummary structure.
    19  type GetSecuritySummaryReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *GetSecuritySummaryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewGetSecuritySummaryOK()
    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 := NewGetSecuritySummaryUnauthorized()
    34  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    35  			return nil, err
    36  		}
    37  		return nil, result
    38  	case 403:
    39  		result := NewGetSecuritySummaryForbidden()
    40  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    41  			return nil, err
    42  		}
    43  		return nil, result
    44  	case 404:
    45  		result := NewGetSecuritySummaryNotFound()
    46  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    47  			return nil, err
    48  		}
    49  		return nil, result
    50  	case 500:
    51  		result := NewGetSecuritySummaryInternalServerError()
    52  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    53  			return nil, err
    54  		}
    55  		return nil, result
    56  	default:
    57  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    58  	}
    59  }
    60  
    61  // NewGetSecuritySummaryOK creates a GetSecuritySummaryOK with default headers values
    62  func NewGetSecuritySummaryOK() *GetSecuritySummaryOK {
    63  	return &GetSecuritySummaryOK{}
    64  }
    65  
    66  /*
    67  GetSecuritySummaryOK describes a response with status code 200, with default header values.
    68  
    69  Success
    70  */
    71  type GetSecuritySummaryOK struct {
    72  	Payload *models.SecuritySummary
    73  }
    74  
    75  // IsSuccess returns true when this get security summary o k response has a 2xx status code
    76  func (o *GetSecuritySummaryOK) IsSuccess() bool {
    77  	return true
    78  }
    79  
    80  // IsRedirect returns true when this get security summary o k response has a 3xx status code
    81  func (o *GetSecuritySummaryOK) IsRedirect() bool {
    82  	return false
    83  }
    84  
    85  // IsClientError returns true when this get security summary o k response has a 4xx status code
    86  func (o *GetSecuritySummaryOK) IsClientError() bool {
    87  	return false
    88  }
    89  
    90  // IsServerError returns true when this get security summary o k response has a 5xx status code
    91  func (o *GetSecuritySummaryOK) IsServerError() bool {
    92  	return false
    93  }
    94  
    95  // IsCode returns true when this get security summary o k response a status code equal to that given
    96  func (o *GetSecuritySummaryOK) IsCode(code int) bool {
    97  	return code == 200
    98  }
    99  
   100  func (o *GetSecuritySummaryOK) Error() string {
   101  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryOK  %+v", 200, o.Payload)
   102  }
   103  
   104  func (o *GetSecuritySummaryOK) String() string {
   105  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryOK  %+v", 200, o.Payload)
   106  }
   107  
   108  func (o *GetSecuritySummaryOK) GetPayload() *models.SecuritySummary {
   109  	return o.Payload
   110  }
   111  
   112  func (o *GetSecuritySummaryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   113  
   114  	o.Payload = new(models.SecuritySummary)
   115  
   116  	// response payload
   117  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   118  		return err
   119  	}
   120  
   121  	return nil
   122  }
   123  
   124  // NewGetSecuritySummaryUnauthorized creates a GetSecuritySummaryUnauthorized with default headers values
   125  func NewGetSecuritySummaryUnauthorized() *GetSecuritySummaryUnauthorized {
   126  	return &GetSecuritySummaryUnauthorized{}
   127  }
   128  
   129  /*
   130  GetSecuritySummaryUnauthorized describes a response with status code 401, with default header values.
   131  
   132  Unauthorized
   133  */
   134  type GetSecuritySummaryUnauthorized struct {
   135  
   136  	/* The ID of the corresponding request for the response
   137  	 */
   138  	XRequestID string
   139  
   140  	Payload *models.Errors
   141  }
   142  
   143  // IsSuccess returns true when this get security summary unauthorized response has a 2xx status code
   144  func (o *GetSecuritySummaryUnauthorized) IsSuccess() bool {
   145  	return false
   146  }
   147  
   148  // IsRedirect returns true when this get security summary unauthorized response has a 3xx status code
   149  func (o *GetSecuritySummaryUnauthorized) IsRedirect() bool {
   150  	return false
   151  }
   152  
   153  // IsClientError returns true when this get security summary unauthorized response has a 4xx status code
   154  func (o *GetSecuritySummaryUnauthorized) IsClientError() bool {
   155  	return true
   156  }
   157  
   158  // IsServerError returns true when this get security summary unauthorized response has a 5xx status code
   159  func (o *GetSecuritySummaryUnauthorized) IsServerError() bool {
   160  	return false
   161  }
   162  
   163  // IsCode returns true when this get security summary unauthorized response a status code equal to that given
   164  func (o *GetSecuritySummaryUnauthorized) IsCode(code int) bool {
   165  	return code == 401
   166  }
   167  
   168  func (o *GetSecuritySummaryUnauthorized) Error() string {
   169  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryUnauthorized  %+v", 401, o.Payload)
   170  }
   171  
   172  func (o *GetSecuritySummaryUnauthorized) String() string {
   173  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryUnauthorized  %+v", 401, o.Payload)
   174  }
   175  
   176  func (o *GetSecuritySummaryUnauthorized) GetPayload() *models.Errors {
   177  	return o.Payload
   178  }
   179  
   180  func (o *GetSecuritySummaryUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   181  
   182  	// hydrates response header X-Request-Id
   183  	hdrXRequestID := response.GetHeader("X-Request-Id")
   184  
   185  	if hdrXRequestID != "" {
   186  		o.XRequestID = hdrXRequestID
   187  	}
   188  
   189  	o.Payload = new(models.Errors)
   190  
   191  	// response payload
   192  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   193  		return err
   194  	}
   195  
   196  	return nil
   197  }
   198  
   199  // NewGetSecuritySummaryForbidden creates a GetSecuritySummaryForbidden with default headers values
   200  func NewGetSecuritySummaryForbidden() *GetSecuritySummaryForbidden {
   201  	return &GetSecuritySummaryForbidden{}
   202  }
   203  
   204  /*
   205  GetSecuritySummaryForbidden describes a response with status code 403, with default header values.
   206  
   207  Forbidden
   208  */
   209  type GetSecuritySummaryForbidden struct {
   210  
   211  	/* The ID of the corresponding request for the response
   212  	 */
   213  	XRequestID string
   214  
   215  	Payload *models.Errors
   216  }
   217  
   218  // IsSuccess returns true when this get security summary forbidden response has a 2xx status code
   219  func (o *GetSecuritySummaryForbidden) IsSuccess() bool {
   220  	return false
   221  }
   222  
   223  // IsRedirect returns true when this get security summary forbidden response has a 3xx status code
   224  func (o *GetSecuritySummaryForbidden) IsRedirect() bool {
   225  	return false
   226  }
   227  
   228  // IsClientError returns true when this get security summary forbidden response has a 4xx status code
   229  func (o *GetSecuritySummaryForbidden) IsClientError() bool {
   230  	return true
   231  }
   232  
   233  // IsServerError returns true when this get security summary forbidden response has a 5xx status code
   234  func (o *GetSecuritySummaryForbidden) IsServerError() bool {
   235  	return false
   236  }
   237  
   238  // IsCode returns true when this get security summary forbidden response a status code equal to that given
   239  func (o *GetSecuritySummaryForbidden) IsCode(code int) bool {
   240  	return code == 403
   241  }
   242  
   243  func (o *GetSecuritySummaryForbidden) Error() string {
   244  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryForbidden  %+v", 403, o.Payload)
   245  }
   246  
   247  func (o *GetSecuritySummaryForbidden) String() string {
   248  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryForbidden  %+v", 403, o.Payload)
   249  }
   250  
   251  func (o *GetSecuritySummaryForbidden) GetPayload() *models.Errors {
   252  	return o.Payload
   253  }
   254  
   255  func (o *GetSecuritySummaryForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   256  
   257  	// hydrates response header X-Request-Id
   258  	hdrXRequestID := response.GetHeader("X-Request-Id")
   259  
   260  	if hdrXRequestID != "" {
   261  		o.XRequestID = hdrXRequestID
   262  	}
   263  
   264  	o.Payload = new(models.Errors)
   265  
   266  	// response payload
   267  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   268  		return err
   269  	}
   270  
   271  	return nil
   272  }
   273  
   274  // NewGetSecuritySummaryNotFound creates a GetSecuritySummaryNotFound with default headers values
   275  func NewGetSecuritySummaryNotFound() *GetSecuritySummaryNotFound {
   276  	return &GetSecuritySummaryNotFound{}
   277  }
   278  
   279  /*
   280  GetSecuritySummaryNotFound describes a response with status code 404, with default header values.
   281  
   282  Not found
   283  */
   284  type GetSecuritySummaryNotFound struct {
   285  
   286  	/* The ID of the corresponding request for the response
   287  	 */
   288  	XRequestID string
   289  
   290  	Payload *models.Errors
   291  }
   292  
   293  // IsSuccess returns true when this get security summary not found response has a 2xx status code
   294  func (o *GetSecuritySummaryNotFound) IsSuccess() bool {
   295  	return false
   296  }
   297  
   298  // IsRedirect returns true when this get security summary not found response has a 3xx status code
   299  func (o *GetSecuritySummaryNotFound) IsRedirect() bool {
   300  	return false
   301  }
   302  
   303  // IsClientError returns true when this get security summary not found response has a 4xx status code
   304  func (o *GetSecuritySummaryNotFound) IsClientError() bool {
   305  	return true
   306  }
   307  
   308  // IsServerError returns true when this get security summary not found response has a 5xx status code
   309  func (o *GetSecuritySummaryNotFound) IsServerError() bool {
   310  	return false
   311  }
   312  
   313  // IsCode returns true when this get security summary not found response a status code equal to that given
   314  func (o *GetSecuritySummaryNotFound) IsCode(code int) bool {
   315  	return code == 404
   316  }
   317  
   318  func (o *GetSecuritySummaryNotFound) Error() string {
   319  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryNotFound  %+v", 404, o.Payload)
   320  }
   321  
   322  func (o *GetSecuritySummaryNotFound) String() string {
   323  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryNotFound  %+v", 404, o.Payload)
   324  }
   325  
   326  func (o *GetSecuritySummaryNotFound) GetPayload() *models.Errors {
   327  	return o.Payload
   328  }
   329  
   330  func (o *GetSecuritySummaryNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   331  
   332  	// hydrates response header X-Request-Id
   333  	hdrXRequestID := response.GetHeader("X-Request-Id")
   334  
   335  	if hdrXRequestID != "" {
   336  		o.XRequestID = hdrXRequestID
   337  	}
   338  
   339  	o.Payload = new(models.Errors)
   340  
   341  	// response payload
   342  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   343  		return err
   344  	}
   345  
   346  	return nil
   347  }
   348  
   349  // NewGetSecuritySummaryInternalServerError creates a GetSecuritySummaryInternalServerError with default headers values
   350  func NewGetSecuritySummaryInternalServerError() *GetSecuritySummaryInternalServerError {
   351  	return &GetSecuritySummaryInternalServerError{}
   352  }
   353  
   354  /*
   355  GetSecuritySummaryInternalServerError describes a response with status code 500, with default header values.
   356  
   357  Internal server error
   358  */
   359  type GetSecuritySummaryInternalServerError struct {
   360  
   361  	/* The ID of the corresponding request for the response
   362  	 */
   363  	XRequestID string
   364  
   365  	Payload *models.Errors
   366  }
   367  
   368  // IsSuccess returns true when this get security summary internal server error response has a 2xx status code
   369  func (o *GetSecuritySummaryInternalServerError) IsSuccess() bool {
   370  	return false
   371  }
   372  
   373  // IsRedirect returns true when this get security summary internal server error response has a 3xx status code
   374  func (o *GetSecuritySummaryInternalServerError) IsRedirect() bool {
   375  	return false
   376  }
   377  
   378  // IsClientError returns true when this get security summary internal server error response has a 4xx status code
   379  func (o *GetSecuritySummaryInternalServerError) IsClientError() bool {
   380  	return false
   381  }
   382  
   383  // IsServerError returns true when this get security summary internal server error response has a 5xx status code
   384  func (o *GetSecuritySummaryInternalServerError) IsServerError() bool {
   385  	return true
   386  }
   387  
   388  // IsCode returns true when this get security summary internal server error response a status code equal to that given
   389  func (o *GetSecuritySummaryInternalServerError) IsCode(code int) bool {
   390  	return code == 500
   391  }
   392  
   393  func (o *GetSecuritySummaryInternalServerError) Error() string {
   394  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryInternalServerError  %+v", 500, o.Payload)
   395  }
   396  
   397  func (o *GetSecuritySummaryInternalServerError) String() string {
   398  	return fmt.Sprintf("[GET /security/summary][%d] getSecuritySummaryInternalServerError  %+v", 500, o.Payload)
   399  }
   400  
   401  func (o *GetSecuritySummaryInternalServerError) GetPayload() *models.Errors {
   402  	return o.Payload
   403  }
   404  
   405  func (o *GetSecuritySummaryInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   406  
   407  	// hydrates response header X-Request-Id
   408  	hdrXRequestID := response.GetHeader("X-Request-Id")
   409  
   410  	if hdrXRequestID != "" {
   411  		o.XRequestID = hdrXRequestID
   412  	}
   413  
   414  	o.Payload = new(models.Errors)
   415  
   416  	// response payload
   417  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   418  		return err
   419  	}
   420  
   421  	return nil
   422  }