Documentation
¶
Index ¶
- func AssertOrganizationOwnership(resource metav1.Object, organizationID string) error
- func AssertProjectOwnership(resource metav1.Object, organizationID, projectID string) error
- func DecodeTagSelectorParam(tags *openapi.TagSelectorParameter) (unikornv1core.TagList, error)
- func ReadJSONBody(r *http.Request, v any) error
- func WriteJSONResponse(w http.ResponseWriter, r *http.Request, code int, response any)
- func WriteOctetStreamResponse(w http.ResponseWriter, r *http.Request, code int, body []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertOrganizationOwnership ¶ added in v1.9.0
AssertOrganizationOwnership checks whether the resource has the correct organizationID. When we call an API the RBAC layer asserts that the user provided organizationID is allowable for the actor making the call. However for GET APIs it's quicker and easier to directly get an object by ID, rather than do a full list lookup with a full set of label selectors. This does however mean that a user can ostensibly read any resource if it knows the ID. Ensure we return a 404 here on error so we don't give away any facts about resources that shoudn't be visible to the client.
func AssertProjectOwnership ¶ added in v1.9.0
AssertProjectOwnership does the same as AssertOrganizationOwnership but with additional project scoping.
func DecodeTagSelectorParam ¶ added in v1.4.0
func DecodeTagSelectorParam(tags *openapi.TagSelectorParameter) (unikornv1core.TagList, error)
func ReadJSONBody ¶
ReadJSONBody is a generic request reader to unmarshal JSON bodies.
func WriteJSONResponse ¶
WriteJSONResponse is a generic wrapper for returning a JSON payload to the client.
func WriteOctetStreamResponse ¶
WriteOctetStreamResponse is a generic wrapper for returning a OctetStream payload to the client.
Types ¶
This section is empty.