diff --git a/pkg/api/errors/errors_test.go b/pkg/api/errors/errors_test.go index 49edec7880d..d33db59b4b4 100644 --- a/pkg/api/errors/errors_test.go +++ b/pkg/api/errors/errors_test.go @@ -29,26 +29,26 @@ import ( func TestErrorNew(t *testing.T) { err := NewAlreadyExists("test", "1") if !IsAlreadyExists(err) { - t.Errorf("expected to be already_exists") + t.Errorf("expected to be %s", api.StatusReasonAlreadyExists) } if IsConflict(err) { - t.Errorf("expected to not be confict") + t.Errorf("expected to not be %s", api.StatusReasonConflict) } if IsNotFound(err) { t.Errorf(fmt.Sprintf("expected to not be %s", api.StatusReasonNotFound)) } if IsInvalid(err) { - t.Errorf("expected to not be invalid") + t.Errorf("expected to not be %s", api.StatusReasonInvalid) } if !IsConflict(NewConflict("test", "2", errors.New("message"))) { t.Errorf("expected to be conflict") } if !IsNotFound(NewNotFound("test", "3")) { - t.Errorf("expected to be not found") + t.Errorf("expected to be %s", api.StatusReasonNotFound) } if !IsInvalid(NewInvalid("test", "2", nil)) { - t.Errorf("expected to be invalid") + t.Errorf("expected to be %s", api.StatusReasonInvalid) } } diff --git a/pkg/api/types.go b/pkg/api/types.go index 2cf12bb3a33..7a8eb24140d 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -522,7 +522,7 @@ const ( // "Location" - HTTP header populated with a URL that can retrieved the final // status of this operation. // Status code 202 - StatusReasonWorking StatusReason = "working" + StatusReasonWorking StatusReason = "Working" // StatusReasonNotFound means one or more resources required for this operation // could not be found. @@ -532,21 +532,21 @@ const ( // resource. // "id" string - the identifier of the missing resource // Status code 404 - StatusReasonNotFound StatusReason = "not_found" + StatusReasonNotFound StatusReason = "NotFound" // StatusReasonAlreadyExists means the resource you are creating already exists. // Details (optional): // "kind" string - the kind attribute of the conflicting resource // "id" string - the identifier of the conflicting resource // Status code 409 - StatusReasonAlreadyExists StatusReason = "already_exists" + StatusReasonAlreadyExists StatusReason = "AlreadyExists" // StatusReasonConflict means the requested update operation cannot be completed // due to a conflict in the operation. The client may need to alter the request. // Each resource may define custom details that indicate the nature of the // conflict. // Status code 409 - StatusReasonConflict StatusReason = "conflict" + StatusReasonConflict StatusReason = "Conflict" // StatusReasonInvalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. The client may @@ -559,7 +559,7 @@ const ( // provided resource that was invalid. The code, message, and // field attributes will be set. // Status code 422 - StatusReasonInvalid StatusReason = "invalid" + StatusReasonInvalid StatusReason = "Invalid" ) // StatusCause provides more information about an api.Status failure, including diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 5b8f3ae7a76..6d7ff9994d6 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -538,7 +538,7 @@ const ( // "Location" - HTTP header populated with a URL that can retrieved the final // status of this operation. // Status code 202 - StatusReasonWorking StatusReason = "working" + StatusReasonWorking StatusReason = "Working" // StatusReasonNotFound means one or more resources required for this operation // could not be found. @@ -548,21 +548,21 @@ const ( // resource. // "id" string - the identifier of the missing resource // Status code 404 - StatusReasonNotFound StatusReason = "notFound" + StatusReasonNotFound StatusReason = "NotFound" // StatusReasonAlreadyExists means the resource you are creating already exists. // Details (optional): // "kind" string - the kind attribute of the conflicting resource // "id" string - the identifier of the conflicting resource // Status code 409 - StatusReasonAlreadyExists StatusReason = "alreadyExists" + StatusReasonAlreadyExists StatusReason = "AlreadyExists" // StatusReasonConflict means the requested update operation cannot be completed // due to a conflict in the operation. The client may need to alter the request. // Each resource may define custom details that indicate the nature of the // conflict. // Status code 409 - StatusReasonConflict StatusReason = "conflict" + StatusReasonConflict StatusReason = "Conflict" ) // StatusCause provides more information about an api.Status failure, including diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index ae716f51dee..2cdbcf619dc 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -535,7 +535,7 @@ const ( // "Location" - HTTP header populated with a URL that can retrieved the final // status of this operation. // Status code 202 - StatusReasonWorking StatusReason = "working" + StatusReasonWorking StatusReason = "Working" // StatusReasonNotFound means one or more resources required for this operation // could not be found. @@ -545,21 +545,21 @@ const ( // resource. // "id" string - the identifier of the missing resource // Status code 404 - StatusReasonNotFound StatusReason = "not_found" + StatusReasonNotFound StatusReason = "NotFound" // StatusReasonAlreadyExists means the resource you are creating already exists. // Details (optional): // "kind" string - the kind attribute of the conflicting resource // "id" string - the identifier of the conflicting resource // Status code 409 - StatusReasonAlreadyExists StatusReason = "already_exists" + StatusReasonAlreadyExists StatusReason = "AlreadyExists" // StatusReasonConflict means the requested update operation cannot be completed // due to a conflict in the operation. The client may need to alter the request. // Each resource may define custom details that indicate the nature of the // conflict. // Status code 409 - StatusReasonConflict StatusReason = "conflict" + StatusReasonConflict StatusReason = "Conflict" // StatusReasonInvalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. The client may @@ -572,7 +572,7 @@ const ( // provided resource that was invalid. The code, message, and // field attributes will be set. // Status code 422 - StatusReasonInvalid StatusReason = "invalid" + StatusReasonInvalid StatusReason = "Invalid" ) // StatusCause provides more information about an api.Status failure, including diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index 29e3ab195e3..485307326b2 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -531,7 +531,7 @@ const ( // "Location" - HTTP header populated with a URL that can retrieved the final // status of this operation. // Status code 202 - StatusReasonWorking StatusReason = "working" + StatusReasonWorking StatusReason = "Working" // StatusReasonNotFound means one or more resources required for this operation // could not be found. @@ -541,21 +541,21 @@ const ( // resource. // "id" string - the identifier of the missing resource // Status code 404 - StatusReasonNotFound StatusReason = "not_found" + StatusReasonNotFound StatusReason = "NotFound" // StatusReasonAlreadyExists means the resource you are creating already exists. // Details (optional): // "kind" string - the kind attribute of the conflicting resource // "id" string - the identifier of the conflicting resource // Status code 409 - StatusReasonAlreadyExists StatusReason = "already_exists" + StatusReasonAlreadyExists StatusReason = "AlreadyExists" // StatusReasonConflict means the requested update operation cannot be completed // due to a conflict in the operation. The client may need to alter the request. // Each resource may define custom details that indicate the nature of the // conflict. // Status code 409 - StatusReasonConflict StatusReason = "conflict" + StatusReasonConflict StatusReason = "Conflict" // StatusReasonInvalid means the requested create or update operation cannot be // completed due to invalid data provided as part of the request. The client may @@ -568,7 +568,7 @@ const ( // provided resource that was invalid. The code, message, and // field attributes will be set. // Status code 422 - StatusReasonInvalid StatusReason = "invalid" + StatusReasonInvalid StatusReason = "Invalid" ) // StatusCause provides more information about an api.Status failure, including diff --git a/pkg/apiserver/apiserver_test.go b/pkg/apiserver/apiserver_test.go index c5d713a14a5..79fc5dfc4f4 100644 --- a/pkg/apiserver/apiserver_test.go +++ b/pkg/apiserver/apiserver_test.go @@ -706,7 +706,7 @@ func TestAsyncCreateError(t *testing.T) { expectedStatus := &api.Status{ Status: api.StatusFailure, Code: http.StatusConflict, - Reason: "already_exists", + Reason: "AlreadyExists", Message: expectedErr.Error(), Details: &api.StatusDetails{ Kind: "foo", diff --git a/pkg/apiserver/errors_test.go b/pkg/apiserver/errors_test.go index 13b3ae4ad83..62f6ed1311e 100644 --- a/pkg/apiserver/errors_test.go +++ b/pkg/apiserver/errors_test.go @@ -39,7 +39,7 @@ func TestErrorsToAPIStatus(t *testing.T) { errors.NewAlreadyExists("foo", "bar"): { Status: api.StatusFailure, Code: http.StatusConflict, - Reason: "already_exists", + Reason: "AlreadyExists", Message: "foo \"bar\" already exists", Details: &api.StatusDetails{ Kind: "foo", @@ -49,7 +49,7 @@ func TestErrorsToAPIStatus(t *testing.T) { errors.NewConflict("foo", "bar", stderrs.New("failure")): { Status: api.StatusFailure, Code: http.StatusConflict, - Reason: "conflict", + Reason: "Conflict", Message: "foo \"bar\" cannot be updated: failure", Details: &api.StatusDetails{ Kind: "foo",