package
0.0.0-20240930181715-1e9bb20ca874
Repository: https://github.com/redhatinsights/insights-operator-gathering-conditions-service.git
Documentation: pkg.go.dev

# Functions

BuildOkResponse builds simple "ok" response.
BuildOkResponseWithData builds response with status "ok" and data.
BuildResponse builds response for RestAPI request.
CORSMiddleware handles CORS HTTP headers For more info see https://en.wikipedia.org/wiki/Cross-origin_resource_sharing.
HandleServerError handles separate server errors and sends appropriate responses.
New function constructs new server instance.
Send sends HTTP response with a provided statusCode data can be either string or map[string]interface{} if data is string it will send response like this: {"status": data} which is helpful for explaining error to the client Returned error value is based on error returned from json.Encoder.
SendAccepted returns response with status Accepted 202.
SendBadRequest returns error response with status Bad Request 400.
SendCreated returns response with status Created 201.
SendForbidden returns response with status Forbidden 403.
SendInternalServerError returns response with status Internal Server Error 500.
SendNotFound returns response with status Not Found 404.
SendOK returns JSON response with status OK 200.
SendUnauthorized returns error response for unauthorized access with status Unauthorized 401.

# Constants

ContextKeyUser is a constant for user authentication token in request.

# Structs

AuthConfig structure represents auth.
Config data structure represents HTTP/HTTPS server configuration.
Identity contains internal user info.
Internal contains information about organization ID.
JWTPayload is structure that contain data from parsed JWT token.
Server data structure represents instances of HTTP/HTTPS server.
Token is x-rh-identity struct.

# Type aliases

ContextKey is a type for user authentication token in request.
OrgID represents organization ID.
UserID represents type for user id.