Documentation
¶
Index ¶
- Constants
- func DecodeError(statusCode int, body []byte) error
- func ErrorCode(err error) string
- func IsAccessDenied(err error) bool
- func NewHTTPClient() *http.Client
- func NewTransport() *http.Transport
- func RandomPassword() (string, error)
- type APIError
- type AttachedUserPolicy
- type Client
- func (c *Client) AttachUserPolicy(ctx context.Context, region, userName, policyArn string) error
- func (c *Client) CloudTrailLookupEvents(ctx context.Context, region string, startTime, endTime int64, maxResults int64, ...) (LookupEventsOutput, error)
- func (c *Client) CloudWatchLogsDescribeLogGroups(ctx context.Context, region string, limit int64, nextToken string) (DescribeLogGroupsOutput, error)
- func (c *Client) CostExplorerCurrentMonthSpend(ctx context.Context) (string, string, error)
- func (c *Client) CreateAccessKey(ctx context.Context, region, userName string) (CreateAccessKeyOutput, error)
- func (c *Client) CreateLoginProfile(ctx context.Context, region, userName, password string) error
- func (c *Client) CreateUser(ctx context.Context, region, userName string) (CreateUserOutput, error)
- func (c *Client) DeleteAccessKey(ctx context.Context, region, userName, accessKeyID string) error
- func (c *Client) DeleteLoginProfile(ctx context.Context, region, userName string) error
- func (c *Client) DeletePublicAccessBlock(ctx context.Context, region, bucket string) error
- func (c *Client) DeleteUser(ctx context.Context, region, userName string) error
- func (c *Client) DescribeDBInstances(ctx context.Context, region, marker string) (DescribeDBInstancesOutput, error)
- func (c *Client) DescribeInstances(ctx context.Context, region, nextToken string, maxResults int) (DescribeInstancesOutput, error)
- func (c *Client) DescribeRegions(ctx context.Context, region string) (DescribeRegionsOutput, error)
- func (c *Client) DetachUserPolicy(ctx context.Context, region, userName, policyArn string) error
- func (c *Client) DoRESTJSON(ctx context.Context, req Request, resp any) error
- func (c *Client) DoRESTXML(ctx context.Context, req Request, resp any) error
- func (c *Client) DoXML(ctx context.Context, req Request, resp any) error
- func (c *Client) GetBucketAcl(ctx context.Context, region, bucket string) (GetBucketAclOutput, error)
- func (c *Client) GetBucketLocation(ctx context.Context, region, bucket string) (GetBucketLocationOutput, error)
- func (c *Client) GetCallerIdentity(ctx context.Context, region string) (GetCallerIdentityOutput, error)
- func (c *Client) GetLoginProfile(ctx context.Context, region, userName string) (GetLoginProfileOutput, error)
- func (c *Client) ListAccessKeys(ctx context.Context, region, userName, marker string) (ListAccessKeysOutput, error)
- func (c *Client) ListAttachedUserPolicies(ctx context.Context, region, userName, marker string) (ListAttachedUserPoliciesOutput, error)
- func (c *Client) ListBuckets(ctx context.Context, region string) (ListBucketsOutput, error)
- func (c *Client) ListObjectsV2(ctx context.Context, region, bucket, continuationToken string, maxKeys int) (ListObjectsV2Output, error)
- func (c *Client) ListUsers(ctx context.Context, region, marker string) (ListUsersOutput, error)
- func (c *Client) ModifyDBInstanceMasterPassword(ctx context.Context, region, instanceID, masterPassword string) (ModifyDBInstanceOutput, error)
- func (c *Client) PutBucketAcl(ctx context.Context, region, bucket, cannedACL string) error
- func (c *Client) Route53ListHostedZones(ctx context.Context, marker string, maxItems int) (ListHostedZonesOutput, error)
- func (c *Client) Route53ListResourceRecordSets(ctx context.Context, zoneID, startName, startType, startIdentifier string, ...) (ListResourceRecordSetsOutput, error)
- func (c *Client) SSMGetCommandInvocation(ctx context.Context, region, commandID, instanceID string) (GetCommandInvocationOutput, error)
- func (c *Client) SSMSendCommand(ctx context.Context, region, documentName string, ...) (SendCommandOutput, error)
- type CloudTrailEvent
- type CloudTrailResource
- type CostMetric
- type CostResultByTime
- type CostTimePeriod
- type CreateAccessKeyOutput
- type CreateUserOutput
- type DBInstance
- type DescribeDBInstancesOutput
- type DescribeInstancesOutput
- type DescribeLogGroupsInput
- type DescribeLogGroupsOutput
- type DescribeRegionsOutput
- type EC2Instance
- type EC2Region
- type EC2Tag
- type GetBucketAclOutput
- type GetBucketLocationOutput
- type GetCallerIdentityOutput
- type GetCommandInvocationInput
- type GetCommandInvocationOutput
- type GetCostAndUsageInput
- type GetCostAndUsageOutput
- type GetLoginProfileOutput
- type HostedZone
- type IAMAccessKey
- type IAMAccessKeySecret
- type IAMUser
- type ListAccessKeysOutput
- type ListAttachedUserPoliciesOutput
- type ListBucketsOutput
- type ListHostedZonesOutput
- type ListObjectsV2Output
- type ListResourceRecordSetsOutput
- type ListUsersOutput
- type LogGroup
- type LookupAttribute
- type LookupEventsInput
- type LookupEventsOutput
- type ModifyDBInstanceOutput
- type Option
- type Request
- type RetryPolicy
- type Route53Record
- type S3Bucket
- type S3Grant
- type S3Object
- type S3Owner
- type SendCommandInput
- type SendCommandOutput
- type SigV4Signer
- type SignInput
- type Signature
Constants ¶
const ( // SSMDocumentLinux / SSMDocumentWindows are the canonical AWS-managed SSM // documents the validation flow uses to run shell or PowerShell commands. SSMDocumentLinux = "AWS-RunShellScript" SSMDocumentWindows = "AWS-RunPowerShellScript" )
AWS SSM API constants — JSON-1.1 RPC endpoint with X-Amz-Target dispatch.
const (
DefaultTimeout = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func DecodeError ¶
func IsAccessDenied ¶ added in v0.2.5
func NewHTTPClient ¶
func NewTransport ¶
func RandomPassword ¶ added in v0.3.1
RandomPassword returns a base64 string suitable for an AWS RDS master password rotation when callers want to lock out access (the `userdel` branch). 24 random bytes encode to 32 base64 chars — well below the RDS 41-char limit and above the 8-char minimum.
Types ¶
type AttachedUserPolicy ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AttachUserPolicy ¶
func (*Client) CloudTrailLookupEvents ¶ added in v0.3.1
func (c *Client) CloudTrailLookupEvents(ctx context.Context, region string, startTime, endTime int64, maxResults int64, nextToken string) (LookupEventsOutput, error)
CloudTrailLookupEvents reads recent management-event entries from AWS CloudTrail. startTime / endTime are Unix seconds (0 = unset → CloudTrail default 90-day window). nextToken paginates. The response includes both the parsed event header *and* the original `CloudTrailEvent` JSON blob, which the caller can re-parse for richer fields.
func (*Client) CloudWatchLogsDescribeLogGroups ¶ added in v0.3.1
func (c *Client) CloudWatchLogsDescribeLogGroups(ctx context.Context, region string, limit int64, nextToken string) (DescribeLogGroupsOutput, error)
CloudWatchLogsDescribeLogGroups lists log groups in `region`. nextToken paginates; pass "" for the first call.
func (*Client) CostExplorerCurrentMonthSpend ¶ added in v0.3.1
CostExplorerCurrentMonthSpend returns the unblended cost for the current calendar month in USD. The first day of the month inclusive → today exclusive matches Cost Explorer's expected window.
func (*Client) CreateAccessKey ¶ added in v0.3.1
func (*Client) CreateLoginProfile ¶
func (*Client) CreateUser ¶
func (*Client) DeleteAccessKey ¶ added in v0.3.1
func (*Client) DeleteLoginProfile ¶
func (*Client) DeletePublicAccessBlock ¶ added in v0.3.1
DeletePublicAccessBlock clears the BlockPublicAcls / IgnorePublicAcls settings on bucket so a subsequent canned ACL change actually surfaces. New AWS accounts ship with BPA enabled by default; without this call the `expose` flow will silently no-op even after PutBucketAcl returns 200.
func (*Client) DeleteUser ¶
func (*Client) DescribeDBInstances ¶ added in v0.3.1
func (c *Client) DescribeDBInstances(ctx context.Context, region, marker string) (DescribeDBInstancesOutput, error)
DescribeDBInstances paginates through RDS DescribeDBInstances. Pass an empty marker for the first call.
func (*Client) DescribeInstances ¶
func (*Client) DescribeRegions ¶
func (*Client) DetachUserPolicy ¶
func (*Client) DoRESTJSON ¶ added in v0.3.1
DoRESTJSON sends req as a JSON-bodied REST call (used by SSM, ECS-style services that speak JSON-1.1). Caller provides Headers including `Content-Type: application/x-amz-json-1.1` and `X-Amz-Target: <service>.<action>`.
func (*Client) GetBucketAcl ¶ added in v0.3.1
func (c *Client) GetBucketAcl(ctx context.Context, region, bucket string) (GetBucketAclOutput, error)
GetBucketAcl returns the parsed `?acl` response for bucket. Callers collapse the grant list into a canned-ACL summary via S3CannedACLFromGrants.
func (*Client) GetBucketLocation ¶
func (*Client) GetCallerIdentity ¶
func (*Client) GetLoginProfile ¶
func (*Client) ListAccessKeys ¶ added in v0.3.1
func (*Client) ListAttachedUserPolicies ¶
func (*Client) ListBuckets ¶
func (*Client) ListObjectsV2 ¶
func (*Client) ModifyDBInstanceMasterPassword ¶ added in v0.3.1
func (c *Client) ModifyDBInstanceMasterPassword(ctx context.Context, region, instanceID, masterPassword string) (ModifyDBInstanceOutput, error)
ModifyDBInstanceMasterPassword rotates the master user password on an RDS instance. AWS RDS has no notion of "create user via API" — accounts live in the database engine itself; the CSPM-relevant management-plane signal is the master password rotation captured in CloudTrail.
func (*Client) PutBucketAcl ¶ added in v0.3.1
PutBucketAcl sets a canned ACL on bucket via the `x-amz-acl` header. Common values: private, public-read, public-read-write, authenticated-read.
func (*Client) Route53ListHostedZones ¶ added in v0.3.1
func (c *Client) Route53ListHostedZones(ctx context.Context, marker string, maxItems int) (ListHostedZonesOutput, error)
Route53ListHostedZones lists hosted zones in the caller's account. AWS Route53 is a global service; the SigV4 region is fixed to `us-east-1` by the signer (see normalizeServiceRegion).
func (*Client) Route53ListResourceRecordSets ¶ added in v0.3.1
func (c *Client) Route53ListResourceRecordSets(ctx context.Context, zoneID, startName, startType, startIdentifier string, maxItems int) (ListResourceRecordSetsOutput, error)
Route53ListResourceRecordSets lists record sets within a hosted zone. `zoneID` may be either the bare ID ("Z2ABCDE") or the prefixed form ("/hostedzone/Z2ABCDE") — both are accepted.
func (*Client) SSMGetCommandInvocation ¶ added in v0.3.1
func (c *Client) SSMGetCommandInvocation(ctx context.Context, region, commandID, instanceID string) (GetCommandInvocationOutput, error)
SSMGetCommandInvocation polls SSM for the result of a previously-sent command on a single instance.
func (*Client) SSMSendCommand ¶ added in v0.3.1
func (c *Client) SSMSendCommand(ctx context.Context, region, documentName string, instanceIDs, commands []string) (SendCommandOutput, error)
SSMSendCommand kicks off a command execution against one or more instances. `documentName` is `AWS-RunShellScript` (linux) or `AWS-RunPowerShellScript` (windows). `commands` is the list of shell lines to execute.
type CloudTrailEvent ¶ added in v0.3.1
type CloudTrailEvent struct {
EventID string `json:"EventId"`
EventName string `json:"EventName"`
EventTime float64 `json:"EventTime"`
EventSource string `json:"EventSource"`
Username string `json:"Username"`
AccessKeyID string `json:"AccessKeyId"`
Resources []CloudTrailResource `json:"Resources"`
CloudTrailEvent string `json:"CloudTrailEvent"`
}
type CloudTrailResource ¶ added in v0.3.1
type CostMetric ¶ added in v0.3.1
type CostResultByTime ¶ added in v0.3.1
type CostResultByTime struct {
TimePeriod CostTimePeriod `json:"TimePeriod"`
Total map[string]CostMetric `json:"Total"`
Estimated bool `json:"Estimated"`
}
type CostTimePeriod ¶ added in v0.3.1
type CreateAccessKeyOutput ¶ added in v0.3.1
type CreateAccessKeyOutput struct {
AccessKey IAMAccessKeySecret
RequestID string
}
type CreateUserOutput ¶
type DBInstance ¶ added in v0.3.1
type DBInstance struct {
DBInstanceIdentifier string
Engine string
EngineVersion string
DBName string
Status string
PubliclyAccessible bool
Address string
Port int64
AvailabilityZone string
}
DBInstance is the typed AWS RDS instance shape returned by DescribeDBInstances. Only the fields cloudlist surfaces are projected.
type DescribeDBInstancesOutput ¶ added in v0.3.1
type DescribeDBInstancesOutput struct {
DBInstances []DBInstance
Marker string
RequestID string
}
type DescribeInstancesOutput ¶
type DescribeInstancesOutput struct {
Instances []EC2Instance
NextToken string
}
type DescribeLogGroupsInput ¶ added in v0.3.1
type DescribeLogGroupsOutput ¶ added in v0.3.1
type DescribeRegionsOutput ¶
type DescribeRegionsOutput struct {
Regions []EC2Region
}
type EC2Instance ¶
type GetBucketAclOutput ¶ added in v0.3.1
GetBucketAclOutput is a slimmed projection of the GetBucketAcl response. Only the fields needed to derive a canonical canned-ACL summary are kept.
type GetBucketLocationOutput ¶
type GetBucketLocationOutput struct {
Region string
}
type GetCallerIdentityOutput ¶
type GetCommandInvocationInput ¶ added in v0.3.1
type GetCommandInvocationOutput ¶ added in v0.3.1
type GetCommandInvocationOutput struct {
CommandID string `json:"CommandId"`
InstanceID string `json:"InstanceId"`
Status string `json:"Status"`
StatusDetails string `json:"StatusDetails"`
StandardOutputContent string `json:"StandardOutputContent"`
StandardErrorContent string `json:"StandardErrorContent"`
}
type GetCostAndUsageInput ¶ added in v0.3.1
type GetCostAndUsageInput struct {
TimePeriod CostTimePeriod `json:"TimePeriod"`
Granularity string `json:"Granularity"`
Metrics []string `json:"Metrics"`
}
type GetCostAndUsageOutput ¶ added in v0.3.1
type GetCostAndUsageOutput struct {
ResultsByTime []CostResultByTime `json:"ResultsByTime"`
}
type GetLoginProfileOutput ¶
type HostedZone ¶ added in v0.3.1
type HostedZone struct {
ID string
Name string
PrivateZone bool
ResourceCount int64
CallerReference string
Comment string
}
HostedZone is the public/private DNS zone record returned by ListHostedZones.
type IAMAccessKey ¶ added in v0.3.1
type IAMAccessKeySecret ¶ added in v0.3.1
type ListAccessKeysOutput ¶ added in v0.3.1
type ListAccessKeysOutput struct {
AccessKeys []IAMAccessKey
Marker string
IsTruncated bool
RequestID string
}
type ListAttachedUserPoliciesOutput ¶
type ListAttachedUserPoliciesOutput struct {
Policies []AttachedUserPolicy
Marker string
IsTruncated bool
RequestID string
}
type ListBucketsOutput ¶
type ListBucketsOutput struct {
Buckets []S3Bucket
}
type ListHostedZonesOutput ¶ added in v0.3.1
type ListHostedZonesOutput struct {
HostedZones []HostedZone
NextMarker string
IsTruncated bool
RequestID string
}
ListHostedZonesOutput is the typed result of Route53 ListHostedZones.
type ListObjectsV2Output ¶
type ListResourceRecordSetsOutput ¶ added in v0.3.1
type ListResourceRecordSetsOutput struct {
Records []Route53Record
NextRecordName string
NextRecordType string
NextRecordIdentifier string
IsTruncated bool
RequestID string
}
ListResourceRecordSetsOutput is the typed result of Route53 ListResourceRecordSets.
type ListUsersOutput ¶
type LogGroup ¶ added in v0.3.1
type LogGroup struct {
LogGroupName string `json:"logGroupName"`
CreationTime int64 `json:"creationTime"`
RetentionInDays int64 `json:"retentionInDays"`
StoredBytes int64 `json:"storedBytes"`
Arn string `json:"arn"`
}
func (LogGroup) CreationTimeFormatted ¶ added in v0.3.1
CreationTimeFormatted converts CloudWatch's millisecond epoch into the `YYYY-MM-DD HH:MM:SS` format the cloudlist `log` asset expects.
type LookupAttribute ¶ added in v0.3.1
type LookupEventsInput ¶ added in v0.3.1
type LookupEventsInput struct {
StartTime *float64 `json:"StartTime,omitempty"`
EndTime *float64 `json:"EndTime,omitempty"`
MaxResults *int64 `json:"MaxResults,omitempty"`
NextToken *string `json:"NextToken,omitempty"`
LookupAttributes []LookupAttribute `json:"LookupAttributes,omitempty"`
}
type LookupEventsOutput ¶ added in v0.3.1
type LookupEventsOutput struct {
NextToken string `json:"NextToken"`
Events []CloudTrailEvent `json:"Events"`
}
type ModifyDBInstanceOutput ¶ added in v0.3.1
type Option ¶
type Option func(*Client)
func WithBaseURL ¶
func WithHTTPClient ¶
func WithRetryPolicy ¶
func WithRetryPolicy(policy RetryPolicy) Option
type RetryPolicy ¶
type RetryPolicy = httpclient.RetryPolicy
func DefaultRetryPolicy ¶
func DefaultRetryPolicy() RetryPolicy
type Route53Record ¶ added in v0.3.1
type Route53Record struct {
Name string
Type string
TTL int64
// Values aggregates ResourceRecords[].Value entries plus any AliasTarget DNS
// name when the record is an alias.
Values []string
Status string
IsAlias bool
}
Route53Record is a single resource-record-set entry under a hosted zone.
type SendCommandInput ¶ added in v0.3.1
type SendCommandOutput ¶ added in v0.3.1
type SendCommandOutput struct {
Command struct {
CommandID string `json:"CommandId"`
} `json:"Command"`
}
type SigV4Signer ¶
type SigV4Signer struct{}
func (SigV4Signer) Sign ¶
func (s SigV4Signer) Sign(credential auth.Credential, input SignInput) (Signature, error)