Documentation ¶
Index ¶
Constants ¶
const DefaultRetries = 3
DefaultRetries states the default number of times the service client will attempt to retry a failed request before failing.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
A Client is an EC2 Metadata service Client.
func New ¶
New creates a new instance of the EC2 Metadata service client.
In the general use case the configuration for this service client should not be needed and `nil` can be provided. Configuration is only needed if the `ec2metadata.Config` defaults need to be overridden. Eg. Setting LogLevel.
@note This configuration will NOT be merged with the default AWS service client configuration `defaults.DefaultConfig`. Due to circular dependencies with the defaults package and credentials EC2 Role Provider.
func (*Client) Available ¶
Available returns if the application has access to the EC2 Metadata service. Can be used to determine if application is running within an EC2 Instance and the metadata service is available.
func (*Client) GetMetadata ¶
GetMetadata uses the path provided to request
type Config ¶
type Config struct { // An optional endpoint URL (hostname only or fully qualified URI) // that overrides the default service endpoint for a client. Set this // to nil, or `""` to use the default service endpoint. Endpoint *string // The HTTP client to use when sending requests. Defaults to // `http.DefaultClient`. HTTPClient *http.Client // An integer value representing the logging level. The default log level // is zero (LogOff), which represents no logging. To enable logging set // to a LogLevel Value. Logger aws.Logger // The logger writer interface to write logging messages to. Defaults to // standard out. LogLevel *aws.LogLevelType // The maximum number of times that a request will be retried for failures. // Defaults to DefaultRetries for the number of retries to be performed // per request. MaxRetries *int }
A Config provides the configuration for the EC2 Metadata service.