Documentation ¶
Overview ¶
Package edgegrid allows you to sign http.Request's using the Akamai OPEN Edgegrid Signing Scheme
Index ¶
- Constants
- Variables
- func AddRequestHeader(config Config, req *http.Request) *http.Request
- func InitCache() (gocache.Cache, error)
- func LogMultiline(f func(args ...interface{}), args ...string)
- func LogMultilinef(f func(formatter string, args ...interface{}), formatter string, ...)
- func LogMultilineln(f func(args ...interface{}), args ...string)
- func PrintHttpRequest(req *http.Request, body bool)
- func PrintHttpRequestCorrelation(req *http.Request, body bool, correlationid string)
- func PrintHttpResponse(res *http.Response, body bool)
- func PrintHttpResponseCorrelation(res *http.Response, body bool, correlationid string)
- func PrintfCorrelation(level string, correlationid string, msg string)
- func SetupLogging()
- type Config
Constants ¶
const ( ErrUUIDGenerateFailed = 500 ErrHomeDirNotFound = 501 ErrConfigFile = 502 ErrConfigFileSection = 503 ErrConfigMissingOptions = 504 ErrMissingEnvVariables = 505 )
Error constants
Variables ¶
var EdgegridLog *log.Logger
var LogFile *os.File
Functions ¶
func AddRequestHeader ¶
AddRequestHeader sets the Authorization header to use Akamai Open API
func LogMultiline ¶ added in v0.9.0
func LogMultiline(f func(args ...interface{}), args ...string)
func LogMultilinef ¶ added in v0.9.0
func LogMultilineln ¶ added in v0.9.0
func LogMultilineln(f func(args ...interface{}), args ...string)
func PrintHttpRequest ¶ added in v0.9.11
Utility func to print http req
func PrintHttpRequestCorrelation ¶ added in v0.9.18
func PrintHttpResponse ¶ added in v0.9.11
Utility func to print http response
func PrintHttpResponseCorrelation ¶ added in v0.9.18
func PrintfCorrelation ¶ added in v0.9.18
func SetupLogging ¶ added in v0.9.0
func SetupLogging()
Types ¶
type Config ¶
type Config struct { Host string `ini:"host"` ClientToken string `ini:"client_token"` ClientSecret string `ini:"client_secret"` AccessToken string `ini:"access_token"` AccountKey string `ini:"account_key"` HeaderToSign []string `ini:"headers_to_sign"` MaxBody int `ini:"max_body"` Debug bool `ini:"debug"` }
Config struct provides all the necessary fields to create authorization header, debug is optional
func Init ¶
Init initializes by first attempting to use ENV vars, with .edgerc as a fallback
See: InitEnv() See: InitEdgeRc()
func InitEdgeRc ¶
InitEdgeRc initializes using a configuration file in standard INI format
By default, it uses the .edgerc found in the users home directory, and the "default" section.
func InitEnv ¶
InitEnv initializes using the Environment (ENV)
By default, it uses AKAMAI_HOST, AKAMAI_CLIENT_TOKEN, AKAMAI_CLIENT_SECRET, AKAMAI_ACCESS_TOKEN, and AKAMAI_MAX_BODY variables.
You can define multiple configurations by prefixing with the section name specified, e.g. passing "ccu" will cause it to look for AKAMAI_CCU_HOST, etc.
If AKAMAI_{SECTION} does not exist, it will fall back to just AKAMAI_.