mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
Migrate from snapClient.VolumesnapshotV1alpha1Client to
snapClient.SnapshotV1alpha1Client and also update kube dependency Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
3bc6771df8
commit
22ff5c0911
49
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
49
vendor/k8s.io/apimachinery/pkg/api/errors/errors.go
generated
vendored
@ -394,7 +394,11 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource schema.Gr
|
||||
case http.StatusNotAcceptable:
|
||||
reason = metav1.StatusReasonNotAcceptable
|
||||
// the server message has details about what types are acceptable
|
||||
message = serverMessage
|
||||
if len(serverMessage) == 0 || serverMessage == "unknown" {
|
||||
message = "the server was unable to respond with a content type that the client supports"
|
||||
} else {
|
||||
message = serverMessage
|
||||
}
|
||||
case http.StatusUnsupportedMediaType:
|
||||
reason = metav1.StatusReasonUnsupportedMediaType
|
||||
// the server message has details about what types are acceptable
|
||||
@ -617,3 +621,46 @@ func ReasonForError(err error) metav1.StatusReason {
|
||||
}
|
||||
return metav1.StatusReasonUnknown
|
||||
}
|
||||
|
||||
// ErrorReporter converts generic errors into runtime.Object errors without
|
||||
// requiring the caller to take a dependency on meta/v1 (where Status lives).
|
||||
// This prevents circular dependencies in core watch code.
|
||||
type ErrorReporter struct {
|
||||
code int
|
||||
verb string
|
||||
reason string
|
||||
}
|
||||
|
||||
// NewClientErrorReporter will respond with valid v1.Status objects that report
|
||||
// unexpected server responses. Primarily used by watch to report errors when
|
||||
// we attempt to decode a response from the server and it is not in the form
|
||||
// we expect. Because watch is a dependency of the core api, we can't return
|
||||
// meta/v1.Status in that package and so much inject this interface to convert a
|
||||
// generic error as appropriate. The reason is passed as a unique status cause
|
||||
// on the returned status, otherwise the generic "ClientError" is returned.
|
||||
func NewClientErrorReporter(code int, verb string, reason string) *ErrorReporter {
|
||||
return &ErrorReporter{
|
||||
code: code,
|
||||
verb: verb,
|
||||
reason: reason,
|
||||
}
|
||||
}
|
||||
|
||||
// AsObject returns a valid error runtime.Object (a v1.Status) for the given
|
||||
// error, using the code and verb of the reporter type. The error is set to
|
||||
// indicate that this was an unexpected server response.
|
||||
func (r *ErrorReporter) AsObject(err error) runtime.Object {
|
||||
status := NewGenericServerResponse(r.code, r.verb, schema.GroupResource{}, "", err.Error(), 0, true)
|
||||
if status.ErrStatus.Details == nil {
|
||||
status.ErrStatus.Details = &metav1.StatusDetails{}
|
||||
}
|
||||
reason := r.reason
|
||||
if len(reason) == 0 {
|
||||
reason = "ClientError"
|
||||
}
|
||||
status.ErrStatus.Details.Causes = append(status.ErrStatus.Details.Causes, metav1.StatusCause{
|
||||
Type: metav1.CauseType(reason),
|
||||
Message: err.Error(),
|
||||
})
|
||||
return &status.ErrStatus
|
||||
}
|
||||
|
Reference in New Issue
Block a user