Documentation
¶
Index ¶
- func EncodeAndWriteResponse(i any, w *echo.Response, lc log.Logger) error
- func EncodeAndWriteYamlResponse(i interface{}, w *echo.Response, lc log.Logger) error
- func ParseGetAllObjectsRequestQueryString(r *http.Request, maxOffSet, maxResultCount int) (offset int, limit int, labels []string, err errors.Error)
- func ParseGetLogsRequestQueryString(r *http.Request) (since int, until int, tail int, timestamps bool, err errors.Error)
- func ParseQueryStringToString(r *http.Request, queryStringKey string, defaultValue string) string
- func ParseStartEndRequestQueryString(r *http.Request) (start, end int64, err errors.Error)
- func WriteDefaultHttpHeader(w http.ResponseWriter, ctx context.Context, statusCode int)
- func WriteErrorResponse(w *echo.Response, ctx context.Context, lc log.Logger, err errors.Error, ...) error
- func WriteHttpContentTypeHeader(w http.ResponseWriter, ctx context.Context, statusCode int, contentType string)
- type BaseResponse
- type HTTPSender
- type Versionable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeAndWriteResponse ¶ added in v1.0.24
func EncodeAndWriteYamlResponse ¶ added in v1.0.41
func ParseGetAllObjectsRequestQueryString ¶ added in v1.0.34
func ParseGetAllObjectsRequestQueryString(r *http.Request, maxOffSet, maxResultCount int) (offset int, limit int, labels []string, err errors.Error)
ParseGetAllObjectsRequestQueryString parses offset, limit, and labels from the query parameters. And check that the offset and limit values are within the valid range when needed.
func ParseGetLogsRequestQueryString ¶ added in v1.0.34
func ParseGetLogsRequestQueryString(r *http.Request) (since int, until int, tail int, timestamps bool, err errors.Error)
ParseGetLogsRequestQueryString parses since, until, tail and timestamps from the query parameters.
func ParseQueryStringToString ¶ added in v1.0.34
func ParseStartEndRequestQueryString ¶ added in v1.0.34
func WriteDefaultHttpHeader ¶ added in v1.0.19
func WriteDefaultHttpHeader(w http.ResponseWriter, ctx context.Context, statusCode int)
func WriteErrorResponse ¶ added in v1.0.24
func WriteErrorResponse(w *echo.Response, ctx context.Context, lc log.Logger, err errors.Error, apiVersion, requestId string) error
WriteErrorResponse writes Http header, encode error response with JSON format and writes to the HTTP response.
func WriteHttpContentTypeHeader ¶ added in v1.0.24
Types ¶
type BaseResponse ¶ added in v1.0.24
type BaseResponse struct { Versionable `json:",inline"` RequestId string `json:"requestId,omitempty"` Message string `json:"message,omitempty"` StatusCode int `json:"statusCode"` }
BaseResponse defines the base content for response DTOs (data transfer objects).
func NewBaseResponse ¶ added in v1.0.24
func NewBaseResponse(apiVersion, requestId, message string, statusCode int) BaseResponse
type HTTPSender ¶
type HTTPSender interface { // SetHTTPRequestHeaders sets up http request headers SetHTTPRequestHeaders(httpRequestHeaders map[string]string) // SetSecretData sets up http secret header SetSecretData(name, valueKey, headerName, valuePrefix string) // HTTPPost sends http POST request with data HTTPPost(dic *di.Container, data any) errors.Error }
HTTPSender is the interface for http requests
func NewHTTPSender ¶
func NewHTTPSender(url string, mimeType string) HTTPSender
NewHTTPSender creates, initializes and returns a new instance of HTTPSender
type Versionable ¶ added in v1.0.24
type Versionable struct {
ApiVersion string `json:"apiVersion" validate:"required"`
}
Versionable shows the API version in DTOs
func NewVersionable ¶ added in v1.0.24
func NewVersionable() Versionable
Click to show internal directories.
Click to hide internal directories.