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()
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 struct {
// contains filtered or unexported fields
}
func NewEC2MetadataClient ¶
func NewEC2MetadataClient() *EC2MetadataClient
func (EC2MetadataClient) DefaultCredentials ¶
func (c EC2MetadataClient) DefaultCredentials() (*RoleCredentials, error)
func (EC2MetadataClient) InstanceIdentityDocument ¶
func (c EC2MetadataClient) InstanceIdentityDocument() (*InstanceIdentityDocument, error)
func (EC2MetadataClient) ReadResource ¶
func (c EC2MetadataClient) ReadResource(path string) ([]byte, error)
func (EC2MetadataClient) ResourceServiceUrl ¶
func (c EC2MetadataClient) ResourceServiceUrl(path string) string
type InstanceIdentityDocument ¶
type InstanceIdentityDocument struct { InstanceId string `json:"instanceId"` BillingProducts *string `json:"billingProducts"` ImageId string `json:"imageId"` Architecture *string `json:"architecture"` PendingTime time.Time `json:"pendingTime"` InstanceType string `json:"instanceType"` AccountId string `json:"accountId"` KernelId *string `json:"kernelId"` RamdiskId *string `json:"ramdiskId"` Region string `json:"region"` Version string `json:"version"` PrivateIp *string `json:"privateIp"` DevpayProductCodes *string `json:"devpayProductCodes"` 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
Click to show internal directories.
Click to hide internal directories.