Help us shape the future of Go! Take the 2026 Go Developer Survey

aws

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAwsError added in v1.0.3

func ToAwsError(err error) awserr.Error

Types

type AwsHttp2Client

type AwsHttp2Client struct {
	Options *HttpClientSettings
}

AwsHttp2Client struct defines container for HttpClientSettings

func (*AwsHttp2Client) NewHttp2Client

func (h2 *AwsHttp2Client) NewHttp2Client() (*http.Client, error)

NewHttp2Client returns custom http2 client for aws connection

func (*AwsHttp2Client) SetDialContextConnectTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetDialContextConnectTimeout(v time.Duration)

SetDialContextConnectTimeout sets Dialer.Timeout: maximum amount of time a dial will wait for a connection to be created default = 10 seconds

func (*AwsHttp2Client) SetDialContextKeepAlive added in v1.6.8

func (h2 *AwsHttp2Client) SetDialContextKeepAlive(v time.Duration)

SetDialContextKeepAlive sets Dialer.KeepAlive: negative value disables keep-alive; 0 enables keep-alive default = keep-alive enabled = 0

func (*AwsHttp2Client) SetDisableCompressions added in v1.6.8

func (h2 *AwsHttp2Client) SetDisableCompressions(v bool)

SetDisableCompressions sets Transport.DisableCompression: if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. default = false

func (*AwsHttp2Client) SetDisableKeepAlives added in v1.6.8

func (h2 *AwsHttp2Client) SetDisableKeepAlives(v bool)

SetDisableKeepAlives sets Transport.DisableKeepAlives: if true, prevents re-use of TCP connections between different HTTP requests default = false

func (*AwsHttp2Client) SetExpectContinueTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetExpectContinueTimeout(v time.Duration)

SetExpectContinueTimeout sets Transport.ExpectContinueTimeout: maximum amount of time to wait for a server's first response headers after fully writing the request headers,

if the response has an "Expect: 100-continue" header,
this time does not include the time to send the request header,
the http client sends its payload after this timeout is exhausted

default = 1 second; set to 0 for no timeout and send request payload without waiting

func (*AwsHttp2Client) SetIdleConnTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetIdleConnTimeout(v time.Duration)

SetIdleConnTimeout sets Transport.IdleConnTimeout: maximum amount of time to keep an idle network connection alive between http requests default = 0 for no limit

func (*AwsHttp2Client) SetMaxConnsPerHost added in v1.6.8

func (h2 *AwsHttp2Client) SetMaxConnsPerHost(v int)

SetMaxConnsPerHost sets Transport.MaxConnsPerHost: limits the total number of connections per host, including connections in the dialing, active, and idle states default = 0 means no limit

func (*AwsHttp2Client) SetMaxIdleConns added in v1.6.8

func (h2 *AwsHttp2Client) SetMaxIdleConns(v int)

SetMaxIdleConns sets Transport.MaxIdleConns: maximum number of idle (keep-alive) connections across all hosts,

use case: increasing this value when many connections in a short period from same clients

default = 0 means no limit

func (*AwsHttp2Client) SetMaxIdleConnsPerHost added in v1.6.8

func (h2 *AwsHttp2Client) SetMaxIdleConnsPerHost(v int)

SetMaxIdleConnsPerHost sets Transport.MaxIdleConnsPerHost: maximum number of idle (keep-alive) connections to keep per-host,

use case: increasing this value when many connections in a short period from same clients

default = 0 means 2 idle connections per host suggest setting to 250 or higher for aws sdk usage use 500 as default here

func (*AwsHttp2Client) SetOverallTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetOverallTimeout(v time.Duration)

SetOverallTimeout sets Client.Timeout: overall timeout for http client including connection, request, response default = 60 seconds

func (*AwsHttp2Client) SetResponseHeaderTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetResponseHeaderTimeout(v time.Duration)

SetResponseHeaderTimeout sets Transport.ResponseHeaderTimeout: maximum amount of time to wait for a client to read the response header,

if the client isn't able to read the response's header within this duration, the request fails with a timeout error,
warning: when using long-running lambda functions, as the operation does not return any response headers until the lambda has finished or timeout

default = no timeout, waits forever use 30 seconds as default here

func (*AwsHttp2Client) SetTlsHandshakeTimeout added in v1.6.8

func (h2 *AwsHttp2Client) SetTlsHandshakeTimeout(v time.Duration)

SetTlsHandshakeTimeout sets Transport.TLSHandshakeTimeout: maximum amount of time waiting for a TLS handshake to be completed default = 10 seconds; 0 means no timeout

type HttpClientSettings

type HttpClientSettings struct {
	// Dialer.KeepAlive: negative value disables keep-alive; 0 enables keep-alive
	// default = keep-alive enabled
	DialContextKeepAlive *time.Duration

	// Dialer.Timeout: maximum amount of time a dial will wait for a connection to be created
	// default = 10 seconds
	DialContextConnectTimeout *time.Duration

	// Transport.ExpectContinueTimeout: maximum amount of time to wait for a server's first response headers after fully writing the request headers,
	// 		if the response has an "Expect: 100-continue" header,
	//		this time does not include the time to send the request header,
	//		the http client sends its payload after this timeout is exhausted
	// default = 1 second; set to 0 for no timeout and send request payload without waiting
	ExpectContinueTimeout *time.Duration

	// Client.Timeout: overall timeout for http client including connection, request, response
	// default = 60 seconds
	OverallTimeout *time.Duration

	// Transport.MaxIdleConns: maximum number of idle (keep-alive) connections across all hosts,
	// 		use case: increasing this value when many connections in a short period from same clients
	// default = 0 means no limit
	MaxIdleConns *int

	// Transport.MaxIdleConnsPerHost: maximum number of idle (keep-alive) connections to keep per-host,
	//		use case: increasing this value when many connections in a short period from same clients
	// default = 0 means 2 idle connections per host
	// suggest setting to 250 or higher for aws sdk usage
	// use 500 as default here
	MaxIdleConnsPerHost *int

	// Transport.MaxConnsPerHost: limits the total number of connections per host, including connections in the dialing, active, and idle states
	// default = 0 means no limit
	MaxConnsPerHost *int

	// Transport.IdleConnTimeout: maximum amount of time to keep an idle network connection alive between http requests
	// default = 0 for no limit
	// use 300 seconds (5 minutes) as default here
	IdleConnTimeout *time.Duration

	DisableKeepAlive   *bool
	DisableCompression *bool

	// Transport.TLSHandshakeTimeout: maximum amount of time waiting for a TLS handshake to be completed
	// default = 10 seconds; 0 means no timeout
	TlsHandshakeTimeout *time.Duration

	// Transport.ResponseHeaderTimeout: maximum amount of time to wait for a client to read the response header,
	//		if the client isn't able to read the response's header within this duration, the request fails with a timeout error,
	//		warning: when using long-running lambda functions, as the operation does not return any response headers until the lambda has finished or timeout
	// default = no timeout, waits forever
	// use 30 seconds as default here
	ResponseHeaderTimeout *time.Duration
}

HttpClientSettings based on aws documentation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL