k8s.io/kube-openapi@v0.0.0-20240228011516-70dd3763d340/pkg/common/restfuladapter/response_error_adapter.go (about)

     1  package restfuladapter
     2  
     3  import (
     4  	"github.com/emicklei/go-restful/v3"
     5  	"k8s.io/kube-openapi/pkg/common"
     6  )
     7  
     8  var _ common.StatusCodeResponse = &ResponseErrorAdapter{}
     9  
    10  // ResponseErrorAdapter adapts a restful.ResponseError to common.StatusCodeResponse.
    11  type ResponseErrorAdapter struct {
    12  	Err *restful.ResponseError
    13  }
    14  
    15  func (r *ResponseErrorAdapter) Message() string {
    16  	return r.Err.Message
    17  }
    18  
    19  func (r *ResponseErrorAdapter) Model() interface{} {
    20  	return r.Err.Model
    21  }
    22  
    23  func (r *ResponseErrorAdapter) Code() int {
    24  	return r.Err.Code
    25  }