Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DynamicHeaderFunc ¶
type NetworkAccess ¶
type NetworkAccess interface { // AddHeaders adds all the custom and authentication headers to the request. AddHeaders(request *http.Request) error // GetRoundTripper returns the http.RoundTripper that is used by the http.Client. GetRoundTripper() http.RoundTripper // GetHttpClient returns the http client. GetHttpClient() *http.Client GetUnauthorizedHttpClient() *http.Client // AddHeaderField adds a header field to the default header. AddHeaderField(key, value string) // AddDynamicHeaderField adds a dynamic header field to the request. AddDynamicHeaderField(key string, f DynamicHeaderFunc) // AddRootCAs adds the root CAs from the given PEM file. AddRootCAs(pemFileLocation string) error // AddErrorHandler registers an error handler for the underlying http.RoundTripper. AddErrorHandler(networktypes.ErrorHandlerFunc) // GetErrorHandler returns the registered error handler. GetErrorHandler() networktypes.ErrorHandlerFunc // GetAuthenticator returns the authenticator. GetAuthenticator() auth.Authenticator SetLogger(logger *zerolog.Logger) SetConfiguration(configuration configuration.Configuration) GetLogger() *zerolog.Logger GetConfiguration() configuration.Configuration Clone() NetworkAccess }
NetworkAccess is the interface for network access. It provides methods to get an HTTP client with default behaviors that handle authentication headers for Snyk API calls.
func NewNetworkAccess ¶
func NewNetworkAccess(config configuration.Configuration) NetworkAccess
NewNetworkAccess returns a networkImpl instance.
type UserAgentInfo ¶
type UserAgentInfo struct { App string AppVersion string Integration string IntegrationVersion string IntegrationEnvironment string IntegrationEnvironmentVersion string OS string Arch string }
func UserAgent ¶
func UserAgent(opts ...UserAgentOptions) UserAgentInfo
func UserAgentFromConfig ¶
func UserAgentFromConfig(config configuration.Configuration, app string, appVersion string) UserAgentInfo
func (UserAgentInfo) String ¶
func (s UserAgentInfo) String() string
ToUserAgentHeader returns a string that can be used as a User-Agent header. The string is following this format: <app>/<appVer> (<os>;<arch>;<procName>) <integration>/<integrationVersion> (<integrationEnv>/<integrationEnvVersion>) Everything other than the app, app version and system information (os/arch/process name) is optional. The integration environment is only added if the integration is set.
type UserAgentOptions ¶
type UserAgentOptions func(ua *UserAgentInfo)
func UaWithApplication ¶
func UaWithApplication(app string, appVersion string) UserAgentOptions
func UaWithConfig ¶
func UaWithConfig(config configuration.Configuration) UserAgentOptions
func UaWithOS ¶
func UaWithOS(osName string) UserAgentOptions
func UaWithRuntimeInfo ¶
func UaWithRuntimeInfo(ri runtimeinfo.RuntimeInfo) UserAgentOptions
Click to show internal directories.
Click to hide internal directories.