func NewAlreadyExists(kind, name string) error {
	return &StatusError{api.Status{
		Status: api.StatusFailure,
		Code:   http.StatusConflict,
		Reason: api.StatusReasonAlreadyExists,
		Details: &api.StatusDetails{
			Kind: kind,
			ID:   name,
		},
		Message: fmt.Sprintf("%s %q already exists", kind, name),
	}}
}
NewAlreadyExists returns an error indicating the item requested exists by that identifier.
package errors
import (
	"fmt"
	"net/http"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
)
const (
	StatusUnprocessableEntity = 422
	StatusTooManyRequests     = 429
	StatusServerTimeout = 504
)
type StatusError struct {
	ErrStatus api.Status
}
var _ error = &StatusError{}
func (e *StatusError) Error() string {
	return e.ErrStatus.Message
}
func (e *StatusError) Status() api.Status {
	return e.ErrStatus
}
type UnexpectedObjectError struct {
	Object runtime.Object
}
func (u *UnexpectedObjectError) Error() string {
	return fmt.Sprintf("unexpected object: %v", u.Object)
}
func FromObject(obj runtime.Object) error {
	switch t := obj.(type) {
	case *api.Status:
		return &StatusError{*t}
	}
	return &UnexpectedObjectError{obj}
}
func NewNotFound(kind, name string) error {
	return &StatusError{api.Status{
		Status: api.StatusFailure,
		Code:   http.StatusNotFound,
		Reason: api.StatusReasonNotFound,
		Details: &api.StatusDetails{
			Kind: kind,
			ID:   name,
		},
		Message: fmt.Sprintf("%s %q not found", kind, name),
	}}
}