Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeJSONResponse(ctx context.Context, i interface{}, status *int, w http.ResponseWriter) error
- func GetAuthCfg() (*openId.AuthCfg, error)
- func GetContextStringValue(ctx context.Context, key string) string
- func GetRequestDetails(r *http.Request) (body string, params map[string]string, err error)
- func HttpClientDo(ctx context.Context, req *http.Request) (res *http.Response, err error)
- func HttpClientDoWithAuthorisation(ctx context.Context, req *http.Request, tokenType, accessToken string) (res *http.Response, err error)
- func HttpLogger(ctx context.Context, inner http.Handler, name string) http.Handler
- func LoadFile(file string) (b []byte, err error)
- func Logger() *logger
- func NewContext(timeout time.Duration) (ctx context.Context, cancelFunc context.CancelFunc, err error)
- func NewFilesytem(fstype FilesystemType) fileSystem
- func SetAuthCfg(fname string) (err error)
- func SetContextStringValue(ctx context.Context, key, value string) context.Context
- type ContextValueType
- type FilesystemType
Constants ¶
View Source
const ( // below are not stored in context, and are used for ensuring tracing attributes are common. APPNAME_SAMPLEAPI = "sampleApi" CLI_DEVICETYPE_NAME = "sampleCtl" OTEL_FILENAME = "otel_sampleApi.txt" )
Variables ¶
View Source
var AuthConfig *openId.AuthCfg
View Source
var CorsWrapper = cors.New(cors.Options{ AllowedMethods: []string{"GET", "POST"}, AllowedHeaders: []string{"Content-Type", "Origin", "Accept", "*"}, })
For dev only - Set up CORS
Functions ¶
func EncodeJSONResponse ¶
func EncodeJSONResponse(ctx context.Context, i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func GetAuthCfg ¶
func GetRequestDetails ¶
func HttpClientDo ¶
Send http request without authorisation
func HttpClientDoWithAuthorisation ¶
func HttpClientDoWithAuthorisation(ctx context.Context, req *http.Request, tokenType, accessToken string) (res *http.Response, err error)
Send http request with authorisation
func HttpLogger ¶
func NewContext ¶
func NewFilesytem ¶
func NewFilesytem(fstype FilesystemType) fileSystem
func SetAuthCfg ¶
Types ¶
type ContextValueType ¶
type ContextValueType string
type FilesystemType ¶
type FilesystemType string
const (
FILESYSTEM_LOCAL FilesystemType = "LocalFS"
)
Click to show internal directories.
Click to hide internal directories.