Documentation ¶
Index ¶
Constants ¶
View Source
const ( EC2_METADATA_SERVICE_URL = "http://169.254.169.254" SECURITY_CREDENTIALS_RESOURCE = "/2014-02-25/meta-data/iam/security-credentials/" INSTANCE_IDENTITY_DOCUMENT_RESOURCE = "/2014-02-25/dynamic/instance-identity/document" INSTANCE_IDENTITY_DOCUMENT_SIGNATURE_RESOURCE = "/2014-02-25/dynamic/instance-identity/signature" SIGNED_INSTANCE_IDENTITY_DOCUMENT_RESOURCE = "/2014-02-25/dynamic/instance-identity/pkcs7" EC2_METADATA_REQUEST_TIMEOUT = time.Duration(1 * time.Second) )
Variables ¶
View Source
var DefaultClient = NewEC2MetadataClient(nil)
DefaultClient is the client used for package level methods.
Functions ¶
func ReadResource ¶
ReadResource reads a given path from the EC2 metadata service using the default client
Types ¶
type EC2MetadataClient ¶
type EC2MetadataClient interface { DefaultCredentials() (*RoleCredentials, error) ReadResource(string) ([]byte, error) InstanceIdentityDocument() (*InstanceIdentityDocument, error) }
func NewBlackholeEC2MetadataClient ¶ added in v1.5.0
func NewBlackholeEC2MetadataClient() EC2MetadataClient
func NewEC2MetadataClient ¶
func NewEC2MetadataClient(httpClient HttpClient) EC2MetadataClient
type InstanceIdentityDocument ¶
type InstanceIdentityDocument struct { InstanceId string `json:"instanceId"` InstanceType string `json:"instanceType"` Region string `json:"region"` PrivateIp *string `json:"privateIp"` AvailabilityZone string `json:"availabilityZone"` }
func GetInstanceIdentityDocument ¶
func GetInstanceIdentityDocument() (*InstanceIdentityDocument, error)
GetInstanceIdentityDocument returns an InstanceIdentityDocument read using the default client
type RoleCredentials ¶
type RoleCredentials struct { Code string `json:"Code"` LastUpdated time.Time `json:"LastUpdated"` Type string `json:"Type"` AccessKeyId string `json:"AccessKeyId"` SecretAccessKey string `json:"SecretAccessKey"` Token string `json:"Token"` Expiration time.Time `json:"Expiration"` }
func DefaultCredentials ¶
func DefaultCredentials() (*RoleCredentials, error)
DefaultCredentials returns the instance's default role read using the default client
Source Files ¶
Click to show internal directories.
Click to hide internal directories.