ec2

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2015 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func ReadResource(path string) ([]byte, error)

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 NewEC2MetadataClient

func NewEC2MetadataClient() EC2MetadataClient

type HttpClient

type HttpClient interface {
	Get(string) (*http.Response, error)
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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