s3

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package s3 provides the data structures and logic necessary to enumerate and integrate AWS S3 resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	CreationDate       *time.Time                           `json:"creation_date" yaml:"creation_date"`
	Name               *string                              `json:"name" yaml:"name"`
	Owner              types.Owner                          `json:"owner" yaml:"owner"`
	Policy             *string                              `json:"policy" yaml:"policy"`
	BucketVersioning   types.BucketVersioningStatus         `json:"bucket_versioning" yaml:"bucket_versioning"`
	MFADelete          types.MFADeleteStatus                `json:"mfa_delete" yaml:"mfa_delete"`
	EncryptionRules    []EncryptionRule                     `json:"encryption_rules" yaml:"encryption_rules"`
	PublicAccessConfig types.PublicAccessBlockConfiguration `json:"public_access_config" yaml:"public_access_config"`
}

Bucket contains the metadata for an S3 bucket, including its creation date, name, owner, policy, bucket versioning status, etc. This data typically requires multiple API calls to retrieve, so collecting it all in one struct is useful for reporting purposes.

type BucketObject

type BucketObject struct {
	Name string `json:"name" yaml:"name"`
	Size int64  `json:"size" yaml:"size"`
}

BucketObject contains the name and size (in bytes) of an object stored in an S3 bucket.

type EncryptionRule

type EncryptionRule struct {
	SSEAlgorithm   types.ServerSideEncryption `json:"sse_algorithm" yaml:"sse_algorithm"`
	KMSMasterKeyID *string                    `json:"kms_master_key_id" yaml:"kms_master_key_id"`
}

EncryptionRule contains the server-side encryption configuration for an S3 bucket alongside the KMS master key ID used for encryption (if it exists).

type EnumerateResourceReport

type EnumerateResourceReport struct {
	AccountID string             `json:"account_id" yaml:"account_id"`
	Resources EnumerateResources `json:"resources" yaml:"resources"`
	Errors    []string           `json:"errors" yaml:"errors"`
}

EnumerateResourceReport contains the account ID that the S3 buckets were discovered in, the resources themselves, and any non-fatal errors that occurred during the execution of the `methodaws s3 enumerate` subcommand.

func EnumerateS3

func EnumerateS3(ctx context.Context, cfg aws.Config) (*EnumerateResourceReport, error)

EnumerateS3 retrieves all S3 buckets available to the caller and returns an EnumerateResourceReport struct. Non-fatal errors that occur during the execution of the `methodaws s3 enumerate` subcommand are included in the report, but the function will not return an error unless there is an issue retrieving the account ID.

type EnumerateResources

type EnumerateResources struct {
	S3Buckets []Bucket `json:"s3_buckets" yaml:"s3_buckets"`
}

EnumerateResources contains the S3 buckets that were enumerated.

type LsResourceReport

type LsResourceReport struct {
	Resources LsResources `json:"resources" yaml:"resources"`
	Errors    []string    `json:"errors" yaml:"errors"`
}

LsResourceReport contains the resources discovered in an S3 bucket and any non-fatal errors that occurred during the execution of the `methodaws s3 ls` subcommand.

func LsS3Bucket

func LsS3Bucket(ctx context.Context, cfg aws.Config, bucketName string) (*LsResourceReport, error)

LsS3Bucket retrieves the objects stored in an S3 bucket and returns an LsResourceReport struct

type LsResources

type LsResources struct {
	S3BucketName  *string        `json:"name" yaml:"name"`
	BucketObjects []BucketObject `json:"objects" yaml:"objects"`
}

LsResources contains the S3 bucket name and the objects stored in the bucket.

Jump to

Keyboard shortcuts

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