Documentation
¶
Overview ¶
modified from github.com/aws/aws-sdk-go-v2/internal/v4a@7a32d707af
Index ¶
- Constants
- func DoRequestWithClient(req *http.Request, client *http.Client, desc string, logger logging.Logger) ([]byte, error)
- func SetRandomSource(reader io.Reader)
- func SignRequest(req *http.Request, service string, creds Credentials, theTime time.Time, ...) error
- func SignV4(headers map[string][]string, method string, theURL *url.URL, body []byte, ...) (string, map[string]string)
- func SignV4a(headers map[string][]string, method string, theURL *url.URL, body []byte, ...) map[string][]string
- type Credentials
- type ECR
- type ECRAuthorizationToken
Constants ¶
const (
// AmzRegionSetKey represents the region set header used for sigv4a
AmzRegionSetKey = "X-Amz-Region-Set"
)
Variables ¶
This section is empty.
Functions ¶
func DoRequestWithClient ¶ added in v0.52.0
func DoRequestWithClient(req *http.Request, client *http.Client, desc string, logger logging.Logger) ([]byte, error)
DoRequestWithClient is a convenience function to get the body of an http response with appropriate error-handling boilerplate and logging.
func SetRandomSource ¶
SetRandomSource used for testing to override rand so tests can expect stable output
func SignRequest ¶ added in v0.52.0
func SignRequest(req *http.Request, service string, creds Credentials, theTime time.Time, sigVersion string) error
SignRequest modifies an http.Request to include an AWS V4 signature based on the provided credentials.
func SignV4 ¶
func SignV4(headers map[string][]string, method string, theURL *url.URL, body []byte, service string, awsCreds Credentials, theTime time.Time) (string, map[string]string)
SignV4 modifies a map[string][]string of headers to generate an AWS V4 signature + headers based on the config/credentials provided.
func SignV4a ¶
func SignV4a(headers map[string][]string, method string, theURL *url.URL, body []byte, service string, awsCreds Credentials, theTime time.Time) map[string][]string
SignV4a returns a map[string][]string of headers, including an added AWS V4a signature based on the config/credentials provided.
Types ¶
type Credentials ¶
func CredentialsFromObject ¶
func CredentialsFromObject(v ast.Object) Credentials
type ECR ¶ added in v0.52.0
type ECR struct {
// contains filtered or unexported fields
}
ECR is used to request tokens from Elastic Container Registry.
func (*ECR) GetAuthorizationToken ¶ added in v0.52.0
func (e *ECR) GetAuthorizationToken(ctx context.Context, creds Credentials, signatureVersion string) (ECRAuthorizationToken, error)
GetAuthorizationToken requests a token that can be used to authenticate image pull requests.
type ECRAuthorizationToken ¶ added in v0.52.0
ECRAuthorizationToken can sign requests to AWS ECR.
It corresponds to data returned by the AWS GetAuthorizationToken API. See https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_AuthorizationData.html
func (*ECRAuthorizationToken) IsValid ¶ added in v0.52.0
func (t *ECRAuthorizationToken) IsValid() bool
IsValid returns true if the token is set and not expired. It respects a margin of error for time handling and will mark it as expired early.