Documentation ¶
Index ¶
- Constants
- func FailureRender(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) error
- func FailureWithCodeRender(ctx context.Context, w http.ResponseWriter, r *http.Request, err error, ...) error
- func HandleResult(w http.ResponseWriter, r *http.Request, ctx context.Context, err error, ...)
- func NotFoundRender(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) error
- func RemoveUnstructuredManagedFields(ctx context.Context, yaml *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func Response(ctx context.Context, data any, err error, statusCode int) render.Renderer
- func SuccessRender(ctx context.Context, w http.ResponseWriter, r *http.Request, data any)
- type Duration
- type Payload
Constants ¶
const SuccessMessage = "OK"
SuccessMessage is the default success message for successful responses.
Variables ¶
This section is empty.
Functions ¶
func FailureRender ¶ added in v0.4.6
FailureRender renders a failed response and status code and respond to the client request.
func FailureWithCodeRender ¶ added in v0.4.6
func FailureWithCodeRender(ctx context.Context, w http.ResponseWriter, r *http.Request, err error, statusCode int) error
FailureWithCodeRender renders a failed response and custom status code and respond to the client request.
func HandleResult ¶
HandleResult is a handler function that writes the response to the HTTP response writer based on the provided error and data.
func NotFoundRender ¶ added in v0.4.6
NotFoundRender renders a not found response and status code and respond to the client request.
func RemoveUnstructuredManagedFields ¶ added in v0.4.8
func RemoveUnstructuredManagedFields( ctx context.Context, yaml *unstructured.Unstructured, ) (*unstructured.Unstructured, error)
RemoveUnstructuredManagedFields remove managedFields information within a Unstructured
func SuccessRender ¶ added in v0.4.6
SuccessRender renders a success response and status code and respond to the client request.
Types ¶
type Duration ¶
Duration is a custom type that represents a duration of time.
func (Duration) MarshalJSON ¶
MarshalJSON customizes JSON representation of the Duration type.