Documentation ¶
Overview ¶
Package download provides a download with retries for machine configuration and userdata.
Index ¶
- func Download(ctx context.Context, endpoint string, opts ...Option) (b []byte, err error)
- func NewTFTPTransport() http.RoundTripper
- type Option
- func WithEndpointFunc(endpointFunc func(context.Context) (string, error)) Option
- func WithErrorOnBadRequest(e error) Option
- func WithErrorOnEmptyResponse(e error) Option
- func WithErrorOnNotFound(e error) Option
- func WithFormat(format string) Option
- func WithHeaders(headers map[string]string) Option
- func WithLowSrcPort() Option
- func WithRetryOptions(opts ...retry.Option) Option
- func WithTimeout(timeout time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTFTPTransport ¶
func NewTFTPTransport() http.RoundTripper
NewTFTPTransport returns an http.RoundTripper capable of handling the TFTP protocol.
Types ¶
type Option ¶
type Option func(*downloadOptions)
Option configures the download options.
func WithEndpointFunc ¶
WithEndpointFunc provides a function that sets the endpoint of the download options.
func WithErrorOnBadRequest ¶ added in v1.7.5
WithErrorOnBadRequest provides specific error to return when response has HTTP 400 error.
func WithErrorOnEmptyResponse ¶
WithErrorOnEmptyResponse provides specific error to return when response is empty.
func WithErrorOnNotFound ¶
WithErrorOnNotFound provides specific error to return when response has HTTP 404 error.
func WithFormat ¶
WithFormat specifies the source format. This ultimately will be a yaml but may be represented in different formats. For example, the config may be base64 encoded.
func WithHeaders ¶
WithHeaders specifies any http headers that are needed for downloading the config.
func WithLowSrcPort ¶
func WithLowSrcPort() Option
WithLowSrcPort sets low source port to download the config.
func WithRetryOptions ¶ added in v1.4.0
WithRetryOptions sets the retry options for the download.
func WithTimeout ¶ added in v1.4.0
WithTimeout sets the timeout for the download.