s3

package
v0.23.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BucketNotFoundErrCode is the error code sent by AWS when a bucket does not exist
	BucketNotFoundErrCode = "NotFound"
	// CORSNotFoundErrCode is the error code sent by AWS when the CORS configuration does not exist
	CORSNotFoundErrCode = "NoSuchCORSConfiguration"
	// PublicAccessBlockNotFoundErrCode is NotFound error for PublicAccessBlock
	PublicAccessBlockNotFoundErrCode = "NoSuchPublicAccessBlockConfiguration"
	// ReplicationNotFoundErrCode is the error code sent by AWS when the replication config does not exist
	ReplicationNotFoundErrCode = "ReplicationConfigurationNotFoundError"
	// LifecycleNotFoundErrCode is the error code sent by AWS when the lifecycle config does not exist
	LifecycleNotFoundErrCode = "NoSuchLifecycleConfiguration"
	// SSENotFoundErrCode is the error code sent by AWS when the SSE config does not exist
	SSENotFoundErrCode = "ServerSideEncryptionConfigurationNotFoundError"
	// TaggingNotFoundErrCode is the error code sent by AWS when the tagging does not exist
	TaggingNotFoundErrCode = "NoSuchTagSet"
	// WebsiteNotFoundErrCode is the error code sent by AWS when the website config does not exist
	WebsiteNotFoundErrCode = "NoSuchWebsiteConfiguration"

	// MethodNotAllowed is the error code sent by AWS when the request method for an object is not allowed
	MethodNotAllowed = "MethodNotAllowed"
	// UnsupportedArgument is the error code sent by AWS when the request fields contain an argument that is not supported
	UnsupportedArgument = "UnsupportedArgument"
)

See - https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses

Functions

func ArgumentNotSupported added in v0.15.0

func ArgumentNotSupported(err error) bool

ArgumentNotSupported is parses the aws Error and validates if parameters are now allowed for a request

func CORSConfigurationNotFound added in v0.12.0

func CORSConfigurationNotFound(err error) bool

CORSConfigurationNotFound is parses the aws Error and validates if the cors configuration does not exist

func CopyAWSTags added in v0.18.0

func CopyAWSTags(tags []s3types.Tag) []v1beta1.Tag

CopyAWSTags converts a list of external s3.Tags to local Tags

func CopyTags added in v0.13.0

func CopyTags(tags []v1beta1.Tag) []s3types.Tag

CopyTags converts a list of local v1beta.Tags to S3 Tags

func GenerateBucketObservation added in v0.12.0

func GenerateBucketObservation(name string) v1beta1.BucketExternalStatus

GenerateBucketObservation generates the ARN string for the external status

func GenerateCreateBucketInput added in v0.12.0

func GenerateCreateBucketInput(name string, s v1beta1.BucketParameters) *s3.CreateBucketInput

GenerateCreateBucketInput creates the input for CreateBucket S3 Client request

func IsAlreadyExists added in v0.12.0

func IsAlreadyExists(err error) bool

IsAlreadyExists helper function to test for ErrCodeBucketAlreadyOwnedByYou error

func IsErrorBucketNotFound added in v0.12.0

func IsErrorBucketNotFound(err error) bool

IsErrorBucketNotFound returns true if the error code indicates that the bucket was not found

func IsErrorPolicyNotFound added in v0.12.0

func IsErrorPolicyNotFound(err error) bool

IsErrorPolicyNotFound returns true if the error code indicates that the item was not found

func IsNotFound added in v0.12.0

func IsNotFound(err error) bool

IsNotFound helper function to test for NotFound error

func LifecycleConfigurationNotFound added in v0.12.0

func LifecycleConfigurationNotFound(err error) bool

LifecycleConfigurationNotFound is parses the aws Error and validates if the lifecycle configuration does not exist

func MethodNotSupported added in v0.15.0

func MethodNotSupported(err error) bool

MethodNotSupported is parses the aws Error and validates if the method is allowed for a request

func PublicAccessBlockConfigurationNotFound added in v0.19.0

func PublicAccessBlockConfigurationNotFound(err error) bool

PublicAccessBlockConfigurationNotFound is parses the aws Error and validates if the public access block does not exist

func ReplicationConfigurationNotFound added in v0.12.0

func ReplicationConfigurationNotFound(err error) bool

ReplicationConfigurationNotFound is parses the aws Error and validates if the replication configuration does not exist

func SSEConfigurationNotFound added in v0.12.0

func SSEConfigurationNotFound(err error) bool

SSEConfigurationNotFound is parses the aws Error and validates if the SSE configuration does not exist

func Serialize added in v0.15.0

func Serialize(p *v1alpha3.BucketPolicyBody) (interface{}, error)

Serialize is the custom marshaller for the BucketPolicyParameters

func SerializeAWSPrincipal added in v0.15.0

func SerializeAWSPrincipal(p v1alpha3.AWSPrincipal) *string

SerializeAWSPrincipal converts an AWSPrincipal to a string

func SerializeBucketCondition added in v0.15.0

func SerializeBucketCondition(p []v1alpha3.Condition) (interface{}, error)

SerializeBucketCondition converts the string -> Condition map into a serialized version

func SerializeBucketPolicyStatement added in v0.15.0

func SerializeBucketPolicyStatement(p v1alpha3.BucketPolicyStatement) (interface{}, error)

SerializeBucketPolicyStatement is the custom marshaller for the BucketPolicyStatement

func SerializeBucketPrincipal added in v0.15.0

func SerializeBucketPrincipal(p *v1alpha3.BucketPrincipal) (interface{}, error)

SerializeBucketPrincipal is the custom serializer for the BucketPrincipal

func SortS3TagSet added in v0.13.0

func SortS3TagSet(tags []s3types.Tag) []s3types.Tag

SortS3TagSet stable sorts an external s3 tag list by the key and value.

func TaggingNotFound added in v0.12.0

func TaggingNotFound(err error) bool

TaggingNotFound is parses the aws Error and validates if the tagging configuration does not exist

func UpdateBucketACL added in v0.12.0

func UpdateBucketACL(ctx context.Context, client BucketClient, bucket *v1beta1.Bucket) error

UpdateBucketACL creates the ACLInput, sends the request to put an ACL based on the bucket

func WebsiteConfigurationNotFound added in v0.12.0

func WebsiteConfigurationNotFound(err error) bool

WebsiteConfigurationNotFound is parses the aws Error and validates if the website configuration does not exist

Types

type BucketClient added in v0.12.0

type BucketClient interface {
	HeadBucket(ctx context.Context, input *s3.HeadBucketInput, opts ...func(*s3.Options)) (*s3.HeadBucketOutput, error)
	CreateBucket(ctx context.Context, input *s3.CreateBucketInput, opts ...func(*s3.Options)) (*s3.CreateBucketOutput, error)
	DeleteBucket(ctx context.Context, input *s3.DeleteBucketInput, opts ...func(*s3.Options)) (*s3.DeleteBucketOutput, error)

	PutBucketEncryption(ctx context.Context, input *s3.PutBucketEncryptionInput, opts ...func(*s3.Options)) (*s3.PutBucketEncryptionOutput, error)
	GetBucketEncryption(ctx context.Context, input *s3.GetBucketEncryptionInput, opts ...func(*s3.Options)) (*s3.GetBucketEncryptionOutput, error)
	DeleteBucketEncryption(ctx context.Context, input *s3.DeleteBucketEncryptionInput, opts ...func(*s3.Options)) (*s3.DeleteBucketEncryptionOutput, error)

	PutBucketVersioning(ctx context.Context, input *s3.PutBucketVersioningInput, opts ...func(*s3.Options)) (*s3.PutBucketVersioningOutput, error)
	GetBucketVersioning(ctx context.Context, input *s3.GetBucketVersioningInput, opts ...func(*s3.Options)) (*s3.GetBucketVersioningOutput, error)

	PutBucketAccelerateConfiguration(ctx context.Context, input *s3.PutBucketAccelerateConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketAccelerateConfigurationOutput, error)
	GetBucketAccelerateConfiguration(ctx context.Context, input *s3.GetBucketAccelerateConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketAccelerateConfigurationOutput, error)

	PutBucketCors(ctx context.Context, input *s3.PutBucketCorsInput, opts ...func(*s3.Options)) (*s3.PutBucketCorsOutput, error)
	GetBucketCors(ctx context.Context, input *s3.GetBucketCorsInput, opts ...func(*s3.Options)) (*s3.GetBucketCorsOutput, error)
	DeleteBucketCors(ctx context.Context, input *s3.DeleteBucketCorsInput, opts ...func(*s3.Options)) (*s3.DeleteBucketCorsOutput, error)

	PutBucketWebsite(ctx context.Context, input *s3.PutBucketWebsiteInput, opts ...func(*s3.Options)) (*s3.PutBucketWebsiteOutput, error)
	GetBucketWebsite(ctx context.Context, input *s3.GetBucketWebsiteInput, opts ...func(*s3.Options)) (*s3.GetBucketWebsiteOutput, error)
	DeleteBucketWebsite(ctx context.Context, input *s3.DeleteBucketWebsiteInput, opts ...func(*s3.Options)) (*s3.DeleteBucketWebsiteOutput, error)

	PutBucketLogging(ctx context.Context, input *s3.PutBucketLoggingInput, opts ...func(*s3.Options)) (*s3.PutBucketLoggingOutput, error)
	GetBucketLogging(ctx context.Context, input *s3.GetBucketLoggingInput, opts ...func(*s3.Options)) (*s3.GetBucketLoggingOutput, error)

	PutBucketReplication(ctx context.Context, input *s3.PutBucketReplicationInput, opts ...func(*s3.Options)) (*s3.PutBucketReplicationOutput, error)
	GetBucketReplication(ctx context.Context, input *s3.GetBucketReplicationInput, opts ...func(*s3.Options)) (*s3.GetBucketReplicationOutput, error)
	DeleteBucketReplication(ctx context.Context, input *s3.DeleteBucketReplicationInput, opts ...func(*s3.Options)) (*s3.DeleteBucketReplicationOutput, error)

	PutBucketRequestPayment(ctx context.Context, input *s3.PutBucketRequestPaymentInput, opts ...func(*s3.Options)) (*s3.PutBucketRequestPaymentOutput, error)
	GetBucketRequestPayment(ctx context.Context, input *s3.GetBucketRequestPaymentInput, opts ...func(*s3.Options)) (*s3.GetBucketRequestPaymentOutput, error)

	PutBucketTagging(ctx context.Context, input *s3.PutBucketTaggingInput, opts ...func(*s3.Options)) (*s3.PutBucketTaggingOutput, error)
	GetBucketTagging(ctx context.Context, input *s3.GetBucketTaggingInput, opts ...func(*s3.Options)) (*s3.GetBucketTaggingOutput, error)
	DeleteBucketTagging(ctx context.Context, input *s3.DeleteBucketTaggingInput, opts ...func(*s3.Options)) (*s3.DeleteBucketTaggingOutput, error)

	PutBucketAnalyticsConfiguration(ctx context.Context, input *s3.PutBucketAnalyticsConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketAnalyticsConfigurationOutput, error)
	GetBucketAnalyticsConfiguration(ctx context.Context, input *s3.GetBucketAnalyticsConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketAnalyticsConfigurationOutput, error)

	PutBucketLifecycleConfiguration(ctx context.Context, input *s3.PutBucketLifecycleConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketLifecycleConfigurationOutput, error)
	GetBucketLifecycleConfiguration(ctx context.Context, input *s3.GetBucketLifecycleConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketLifecycleConfigurationOutput, error)
	DeleteBucketLifecycle(ctx context.Context, input *s3.DeleteBucketLifecycleInput, opts ...func(*s3.Options)) (*s3.DeleteBucketLifecycleOutput, error)

	PutBucketNotificationConfiguration(ctx context.Context, input *s3.PutBucketNotificationConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketNotificationConfigurationOutput, error)
	GetBucketNotificationConfiguration(ctx context.Context, input *s3.GetBucketNotificationConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketNotificationConfigurationOutput, error)

	GetBucketAcl(ctx context.Context, input *s3.GetBucketAclInput, opts ...func(*s3.Options)) (*s3.GetBucketAclOutput, error) //nolint
	PutBucketAcl(ctx context.Context, input *s3.PutBucketAclInput, opts ...func(*s3.Options)) (*s3.PutBucketAclOutput, error) //nolint
	GetPublicAccessBlock(ctx context.Context, input *s3.GetPublicAccessBlockInput, opts ...func(*s3.Options)) (*s3.GetPublicAccessBlockOutput, error)
	PutPublicAccessBlock(ctx context.Context, input *s3.PutPublicAccessBlockInput, opts ...func(*s3.Options)) (*s3.PutPublicAccessBlockOutput, error)
	DeletePublicAccessBlock(ctx context.Context, input *s3.DeletePublicAccessBlockInput, opts ...func(*s3.Options)) (*s3.DeletePublicAccessBlockOutput, error)
}

BucketClient is the interface for Client for making S3 Bucket requests.

func NewClient

func NewClient(cfg aws.Config) BucketClient

NewClient returns a new client using AWS credentials as JSON encoded data.

type BucketPolicyClient added in v0.12.0

type BucketPolicyClient interface {
	GetBucketPolicy(ctx context.Context, input *s3.GetBucketPolicyInput, opts ...func(*s3.Options)) (*s3.GetBucketPolicyOutput, error)
	PutBucketPolicy(ctx context.Context, input *s3.PutBucketPolicyInput, opts ...func(*s3.Options)) (*s3.PutBucketPolicyOutput, error)
	DeleteBucketPolicy(ctx context.Context, input *s3.DeleteBucketPolicyInput, opts ...func(*s3.Options)) (*s3.DeleteBucketPolicyOutput, error)
}

BucketPolicyClient is the external client used for S3BucketPolicy Custom Resource

func NewBucketPolicyClient added in v0.12.0

func NewBucketPolicyClient(cfg aws.Config) BucketPolicyClient

NewBucketPolicyClient returns a new client given an aws config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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