Documentation
¶
Overview ¶
Package awsx is a small SigV4 client for AWS JSON 1.1 and Query APIs. It adds no SDK service modules and does nothing until a call is made.
Index ¶
- func CodeOf(err error) string
- type Class
- type Client
- func (c *Client) JSON(ctx context.Context, svc Service, region, op string, in, out any) error
- func (c *Client) Query(ctx context.Context, svc Service, region, action, version string, ...) error
- func (c *Client) REST(ctx context.Context, svc Service, host, region, method, path string, ...) error
- func (c *Client) RESTGet(ctx context.Context, svc Service, host, region, path string, out any) error
- type Credentials
- type Doer
- type EpochTime
- type Error
- type Options
- type Secret
- type Service
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Class ¶
type Class string
Class groups AWS error codes into the few outcomes callers act on.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client sends signed requests.
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, svc Service, region, action, version string, params url.Values, out any) error
Query sends one Query API call (EC2 style) and decodes the XML response.
type Credentials ¶
type Credentials struct {
AccessKeyID, SecretAccessKey, SessionToken string
}
Credentials uses the same keys as the stored AWS cloud account.
type EpochTime ¶
EpochTime decodes the JSON 1.1 timestamp, seconds since epoch as a number.
func (*EpochTime) UnmarshalJSON ¶
UnmarshalJSON accepts a number or null.
type Error ¶
Error is one AWS service error. Error() omits Message on purpose, because some services echo request values back.
type Options ¶
type Options struct {
Credentials Credentials
HTTP Doer
Now func() time.Time
Sleep func(ctx context.Context, d time.Duration) error
// BaseURL replaces the regional endpoint, for fake servers.
BaseURL string
MaxAttempts int
BaseDelay time.Duration
MaxResponseBytes int64
}
Options configures a Client. Zero fields take the DefaultOptions values.
func DefaultOptions ¶
func DefaultOptions(c Credentials) Options
DefaultOptions seeds limits from APP_AWSX_MAX_ATTEMPTS, APP_AWSX_BASE_DELAY_MS and APP_AWSX_MAX_RESPONSE_BYTES.
type Secret ¶
type Secret string
Secret holds a value that must never reach logs, errors or JSON output.
func (Secret) MarshalJSON ¶
MarshalJSON writes a placeholder, never the value.
func (*Secret) UnmarshalJSON ¶
UnmarshalJSON reads a plain JSON string into the secret.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acm requests and reads ACM certificates with DNS validation.
|
Package acm requests and reads ACM certificates with DNS validation. |
|
Package awsxtest gives service tests a fake AWS endpoint.
|
Package awsxtest gives service tests a fake AWS endpoint. |
|
Package cloudfront reads distributions and creates cache invalidations over signed REST/XML.
|
Package cloudfront reads distributions and creates cache invalidations over signed REST/XML. |
|
Package cloudtrail reads the CloudTrail event history for an audit feed.
|
Package cloudtrail reads the CloudTrail event history for an audit feed. |
|
Package cloudwatch reads CloudWatch metrics (Query API 2010-08-01) and CloudWatch Logs (JSON 1.1).
|
Package cloudwatch reads CloudWatch metrics (Query API 2010-08-01) and CloudWatch Logs (JSON 1.1). |
|
Package ec2snap manages EBS snapshots over the signed EC2 Query API (version 2016-11-15).
|
Package ec2snap manages EBS snapshots over the signed EC2 Query API (version 2016-11-15). |
|
Package ecr talks to Elastic Container Registry over signed JSON 1.1.
|
Package ecr talks to Elastic Container Registry over signed JSON 1.1. |
|
Package elasticache talks to ElastiCache (Redis and Valkey) over the signed Query API (version 2015-02-02).
|
Package elasticache talks to ElastiCache (Redis and Valkey) over the signed Query API (version 2015-02-02). |
|
Package iam reads IAM role policy attachments over the signed IAM Query API (version 2010-05-08).
|
Package iam reads IAM role policy attachments over the signed IAM Query API (version 2010-05-08). |
|
Package lightsail talks to Amazon Lightsail over the signed JSON 1.1 API (target prefix Lightsail_20161128).
|
Package lightsail talks to Amazon Lightsail over the signed JSON 1.1 API (target prefix Lightsail_20161128). |
|
Package rds talks to RDS and Aurora over the signed Query API (version 2014-10-31).
|
Package rds talks to RDS and Aurora over the signed Query API (version 2014-10-31). |
|
Package secrets reads and writes SSM Parameter Store and Secrets Manager.
|
Package secrets reads and writes SSM Parameter Store and Secrets Manager. |
|
Package ssm reads managed instance status and runs allowlisted commands over signed JSON 1.1.
|
Package ssm reads managed instance status and runs allowlisted commands over signed JSON 1.1. |