Documentation ¶
Index ¶
- Variables
- func ArgumentNotSupported(err error) bool
- func BucketHasACLsDisabled(bucket *v1beta1.Bucket) bool
- func CORSConfigurationNotFound(err error) bool
- func CopyAWSTags(tags []s3types.Tag) []v1beta1.Tag
- func CopyTags(tags []v1beta1.Tag) []s3types.Tag
- func DiffParsedPolicies(spec *common.BucketPolicyBody, external *string) (string, error)
- func FormatPolicy(policy *common.BucketPolicyBody) (*string, error)
- func GenerateBucketObservation(name string, partition string) v1beta1.BucketExternalStatus
- func GenerateCreateBucketInput(name string, s v1beta1.BucketParameters) *s3.CreateBucketInput
- func IsAlreadyExists(err error) bool
- func IsErrorBucketNotFound(err error) bool
- func IsErrorPolicyNotFound(err error) bool
- func IsNotFound(err error) bool
- func LifecycleConfigurationNotFound(err error) bool
- func MethodNotSupported(err error) bool
- func PublicAccessBlockConfigurationNotFound(err error) bool
- func ReplicationConfigurationNotFound(err error) bool
- func SSEConfigurationNotFound(err error) bool
- func Serialize(p *common.BucketPolicyBody) (interface{}, error)
- func SerializeAWSPrincipal(p common.AWSPrincipal) *string
- func SerializeBucketCondition(p []common.Condition) (interface{}, error)
- func SerializeBucketPolicyStatement(p common.BucketPolicyStatement) (interface{}, error)
- func SerializeBucketPrincipal(p *common.BucketPrincipal) (interface{}, error)
- func SortS3TagSet(tags []s3types.Tag) []s3types.Tag
- func TaggingNotFound(err error) bool
- func UpdateBucketACL(ctx context.Context, client BucketClient, bucket *v1beta1.Bucket) error
- func UpdateBucketOwnershipControls(ctx context.Context, client BucketClient, bucket *v1beta1.Bucket) error
- func WebsiteConfigurationNotFound(err error) bool
- type BucketClient
- type BucketPolicyClient
Constants ¶
This section is empty.
Variables ¶
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 ¶
ArgumentNotSupported is parses the aws Error and validates if parameters are now allowed for a request
func BucketHasACLsDisabled ¶ added in v0.29.0
BucketHasACLsDisabled returns true if ACLs are disabled for the bucket, i.e., if ObjectOwnership is set to BucketOwnerEnforced
func CORSConfigurationNotFound ¶
CORSConfigurationNotFound is parses the aws Error and validates if the cors configuration does not exist
func CopyAWSTags ¶
CopyAWSTags converts a list of external s3.Tags to local Tags
func DiffParsedPolicies ¶ added in v0.43.0
func DiffParsedPolicies(spec *common.BucketPolicyBody, external *string) (string, error)
DiffParsedPolicies compares two parsed policy strings, `spec` and `external`, and returns the differences as a string. It formats and parses the policies, handling any errors
func FormatPolicy ¶ added in v0.43.0
func FormatPolicy(policy *common.BucketPolicyBody) (*string, error)
FormatPolicy parses and formats the BucketPolicyBody struct
func GenerateBucketObservation ¶
func GenerateBucketObservation(name string, partition string) v1beta1.BucketExternalStatus
GenerateBucketObservation generates the ARN string for the external status
func GenerateCreateBucketInput ¶
func GenerateCreateBucketInput(name string, s v1beta1.BucketParameters) *s3.CreateBucketInput
GenerateCreateBucketInput creates the input for CreateBucket S3 Client request
func IsAlreadyExists ¶
IsAlreadyExists helper function to test for ErrCodeBucketAlreadyOwnedByYou error
func IsErrorBucketNotFound ¶
IsErrorBucketNotFound returns true if the error code indicates that the bucket was not found
func IsErrorPolicyNotFound ¶
IsErrorPolicyNotFound returns true if the error code indicates that the item was not found
func IsNotFound ¶
IsNotFound helper function to test for NotFound error
func LifecycleConfigurationNotFound ¶
LifecycleConfigurationNotFound is parses the aws Error and validates if the lifecycle configuration does not exist
func MethodNotSupported ¶
MethodNotSupported is parses the aws Error and validates if the method is allowed for a request
func PublicAccessBlockConfigurationNotFound ¶
PublicAccessBlockConfigurationNotFound is parses the aws Error and validates if the public access block does not exist
func ReplicationConfigurationNotFound ¶
ReplicationConfigurationNotFound is parses the aws Error and validates if the replication configuration does not exist
func SSEConfigurationNotFound ¶
SSEConfigurationNotFound is parses the aws Error and validates if the SSE configuration does not exist
func Serialize ¶
func Serialize(p *common.BucketPolicyBody) (interface{}, error)
Serialize is the custom marshaller for the BucketPolicyParameters
func SerializeAWSPrincipal ¶
func SerializeAWSPrincipal(p common.AWSPrincipal) *string
SerializeAWSPrincipal converts an AWSPrincipal to a string
func SerializeBucketCondition ¶
SerializeBucketCondition converts the string -> Condition map into a serialized version
func SerializeBucketPolicyStatement ¶
func SerializeBucketPolicyStatement(p common.BucketPolicyStatement) (interface{}, error)
SerializeBucketPolicyStatement is the custom marshaller for the BucketPolicyStatement
func SerializeBucketPrincipal ¶
func SerializeBucketPrincipal(p *common.BucketPrincipal) (interface{}, error)
SerializeBucketPrincipal is the custom serializer for the BucketPrincipal
func SortS3TagSet ¶
SortS3TagSet stable sorts an external s3 tag list by the key and value.
func TaggingNotFound ¶
TaggingNotFound is parses the aws Error and validates if the tagging configuration does not exist
func UpdateBucketACL ¶
UpdateBucketACL creates the ACLInput, sends the request to put an ACL based on the bucket
func UpdateBucketOwnershipControls ¶ added in v0.29.0
func UpdateBucketOwnershipControls(ctx context.Context, client BucketClient, bucket *v1beta1.Bucket) error
UpdateBucketOwnershipControls creates the OwnershipContolsInput, sends the request to put an ObjectOwnership based on the bucket
func WebsiteConfigurationNotFound ¶
WebsiteConfigurationNotFound is parses the aws Error and validates if the website configuration does not exist
Types ¶
type BucketClient ¶
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) PutBucketAcl(ctx context.Context, input *s3.PutBucketAclInput, opts ...func(*s3.Options)) (*s3.PutBucketAclOutput, error) 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) GetBucketOwnershipControls(ctx context.Context, input *s3.GetBucketOwnershipControlsInput, opts ...func(*s3.Options)) (*s3.GetBucketOwnershipControlsOutput, error) PutBucketOwnershipControls(ctx context.Context, input *s3.PutBucketOwnershipControlsInput, opts ...func(*s3.Options)) (*s3.PutBucketOwnershipControlsOutput, error) DeleteBucketOwnershipControls(ctx context.Context, input *s3.DeleteBucketOwnershipControlsInput, opts ...func(*s3.Options)) (*s3.DeleteBucketOwnershipControlsOutput, error) BucketPolicyClient }
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 ¶
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 ¶
func NewBucketPolicyClient(cfg aws.Config) BucketPolicyClient
NewBucketPolicyClient returns a new client given an aws config