awsapi

package
v0.0.0-...-7d8b796 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFiltersQueryString

func GetFiltersQueryString(filters []Filter) string

GetFiltersQueryString returns query string formed from the given filters.

func HashHex

func HashHex(s []byte) string

HashHex hashes given s

Types

type AssumeRoleResponse

type AssumeRoleResponse struct {
	AssumeRoleResult struct {
		Credentials assumeCredentials `xml:"Credentials"`
	} `xml:"AssumeRoleResult"`
	AssumeRoleWithWebIdentityResult struct {
		Credentials assumeCredentials `xml:"Credentials"`
	} `xml:"AssumeRoleWithWebIdentityResult"`
}

AssumeRoleResponse represents AssumeRole response

See https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config represent aws access configuration.

func NewConfig

func NewConfig(ec2Endpoint, stsEndpoint, region, roleARN, accessKey, secretKey, service string) (*Config, error)

NewConfig returns new AWS Config from the given args.

func (*Config) GetEC2APIResponse

func (cfg *Config) GetEC2APIResponse(action, filtersQueryString, nextPageToken string) ([]byte, error)

GetEC2APIResponse performs EC2 API request with ghe given action.

filtersQueryString must contain an optional percent-encoded query string for aws filters. This string can be obtained by calling GetFiltersQueryString(). See https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html for examples. See also https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Filter.html

func (*Config) GetRegion

func (cfg *Config) GetRegion() string

GetRegion returns region for the given cfg.

func (*Config) SignRequest

func (cfg *Config) SignRequest(req *http.Request, payloadHash string) error

SignRequest signs request for service access and payloadHash.

type IdentityDocument

type IdentityDocument struct {
	Region string
}

IdentityDocument is identity document returned from AWS metadata server.

See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html

type MetadataSecurityCredentials

type MetadataSecurityCredentials struct {
	AccessKeyID     string    `json:"AccessKeyId"`
	SecretAccessKey string    `json:"SecretAccessKey"`
	Token           string    `json:"Token"`
	Expiration      time.Time `json:"Expiration"`
}

MetadataSecurityCredentials represents credentials obtained from http://169.254.169.254/latest/meta-data/iam/security-credentials/*

See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

Jump to

Keyboard shortcuts

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