api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func DecodeError

func DecodeError(statusCode int, body []byte) error

func ErrorCode

func ErrorCode(err error) string

func IsAccessDenied added in v0.2.5

func IsAccessDenied(err error) bool

func NewHTTPClient

func NewHTTPClient() *http.Client

func NewTransport

func NewTransport() *http.Transport

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
	RequestID  string
}

func (*APIError) Error

func (e *APIError) Error() string

type AttachedUserPolicy

type AttachedUserPolicy struct {
	PolicyName string
	PolicyArn  string
}

type Client

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

func NewClient

func NewClient(credential auth.Credential, opts ...Option) *Client

func (*Client) AttachUserPolicy

func (c *Client) AttachUserPolicy(ctx context.Context, region, userName, policyArn string) error

func (*Client) CreateLoginProfile

func (c *Client) CreateLoginProfile(ctx context.Context, region, userName, password string) error

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, region, userName string) (CreateUserOutput, error)

func (*Client) DeleteLoginProfile

func (c *Client) DeleteLoginProfile(ctx context.Context, region, userName string) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, region, userName string) error

func (*Client) DescribeInstances

func (c *Client) DescribeInstances(ctx context.Context, region, nextToken string, maxResults int) (DescribeInstancesOutput, error)

func (*Client) DescribeRegions

func (c *Client) DescribeRegions(ctx context.Context, region string) (DescribeRegionsOutput, error)

func (*Client) DetachUserPolicy

func (c *Client) DetachUserPolicy(ctx context.Context, region, userName, policyArn string) error

func (*Client) DoRESTXML

func (c *Client) DoRESTXML(ctx context.Context, req Request, resp any) error

func (*Client) DoXML

func (c *Client) DoXML(ctx context.Context, req Request, resp any) error

func (*Client) GetBucketLocation

func (c *Client) GetBucketLocation(ctx context.Context, region, bucket string) (GetBucketLocationOutput, error)

func (*Client) GetCallerIdentity

func (c *Client) GetCallerIdentity(ctx context.Context, region string) (GetCallerIdentityOutput, error)

func (*Client) GetLoginProfile

func (c *Client) GetLoginProfile(ctx context.Context, region, userName string) (GetLoginProfileOutput, error)

func (*Client) ListAttachedUserPolicies

func (c *Client) ListAttachedUserPolicies(ctx context.Context, region, userName, marker string) (ListAttachedUserPoliciesOutput, error)

func (*Client) ListBuckets

func (c *Client) ListBuckets(ctx context.Context, region string) (ListBucketsOutput, error)

func (*Client) ListObjectsV2

func (c *Client) ListObjectsV2(ctx context.Context, region, bucket, continuationToken string, maxKeys int) (ListObjectsV2Output, error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, region, marker string) (ListUsersOutput, error)

type CreateUserOutput

type CreateUserOutput struct {
	Arn       string
	RequestID string
}

type DescribeInstancesOutput

type DescribeInstancesOutput struct {
	Instances []EC2Instance
	NextToken string
}

type DescribeRegionsOutput

type DescribeRegionsOutput struct {
	Regions []EC2Region
}

type EC2Instance

type EC2Instance struct {
	InstanceID    string
	PublicIP      string
	PrivateIP     string
	PublicDNSName string
	State         string
	Tags          []EC2Tag
}

type EC2Region

type EC2Region struct {
	Name string
}

type EC2Tag

type EC2Tag struct {
	Key   string
	Value string
}

type GetBucketLocationOutput

type GetBucketLocationOutput struct {
	Region string
}

type GetCallerIdentityOutput

type GetCallerIdentityOutput struct {
	Account   string
	Arn       string
	UserID    string
	RequestID string
}

type GetLoginProfileOutput

type GetLoginProfileOutput struct {
	CreateDate            *time.Time
	PasswordResetRequired bool
	RequestID             string
}

type IAMUser

type IAMUser struct {
	UserName         string
	UserID           string
	Arn              string
	CreateDate       *time.Time
	PasswordLastUsed *time.Time
}

type ListAttachedUserPoliciesOutput

type ListAttachedUserPoliciesOutput struct {
	Policies    []AttachedUserPolicy
	Marker      string
	IsTruncated bool
	RequestID   string
}

type ListBucketsOutput

type ListBucketsOutput struct {
	Buckets []S3Bucket
}

type ListObjectsV2Output

type ListObjectsV2Output struct {
	Objects               []S3Object
	IsTruncated           bool
	NextContinuationToken string
}

type ListUsersOutput

type ListUsersOutput struct {
	Users       []IAMUser
	Marker      string
	IsTruncated bool
	RequestID   string
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(rawURL string) Option

func WithClock

func WithClock(now func() time.Time) Option

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithRetryPolicy

func WithRetryPolicy(policy RetryPolicy) Option

type Request

type Request struct {
	Service    string
	Region     string
	Action     string
	Version    string
	Method     string
	Path       string
	Query      url.Values
	Body       []byte
	Headers    http.Header
	Idempotent bool
	Scheme     string
	Host       string
}

type RetryPolicy

type RetryPolicy = httpclient.RetryPolicy

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

type S3Bucket

type S3Bucket struct {
	Name         string
	BucketRegion string
}

type S3Object

type S3Object struct {
	Key          string
	Size         int64
	LastModified string
	StorageClass string
}

type SigV4Signer

type SigV4Signer struct{}

func (SigV4Signer) Sign

func (s SigV4Signer) Sign(credential auth.Credential, input SignInput) (Signature, error)

type SignInput

type SignInput struct {
	Method      string
	Service     string
	Region      string
	Host        string
	Path        string
	Query       url.Values
	ContentType string
	Payload     []byte
	Timestamp   time.Time
	Headers     http.Header
}

type Signature

type Signature struct {
	Authorization    string
	SignedHeaders    string
	CredentialScope  string
	CanonicalRequest string
	StringToSign     string
	AmzDate          string
	PayloadHash      string
}

Jump to

Keyboard shortcuts

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