s3

package
v0.0.0-...-19bd712 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncryptionNotFoundCode               = "ServerSideEncryptionConfigurationNotFoundError"
	PolicyNotFoundCode                   = "NoSuchBucketPolicy"
	NoEncryptionMessage                  = "NoEncryption"
	NoPublicAccessBlockConfigurationCode = "NoSuchPublicAccessBlockConfiguration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketDescription

type BucketDescription struct {
	Name                                  string                                         `json:"name"`
	SSEAlgorithm                          *string                                        `json:"sse_algorithm,omitempty"`
	BucketPolicy                          BucketPolicy                                   `json:"bucket_policy,omitempty"`
	BucketVersioning                      *BucketVersioning                              `json:"bucket_versioning,omitempty"`
	PublicAccessBlockConfiguration        *types.PublicAccessBlockConfiguration          `json:"public_access_block_configuration"`
	AccountPublicAccessBlockConfiguration *s3ContorlTypes.PublicAccessBlockConfiguration `json:"account_public_access_block_configuration"`
	Region                                string
}

func (BucketDescription) GetRegion

func (b BucketDescription) GetRegion() string

func (BucketDescription) GetResourceArn

func (b BucketDescription) GetResourceArn() string

func (BucketDescription) GetResourceName

func (b BucketDescription) GetResourceName() string

func (BucketDescription) GetResourceType

func (b BucketDescription) GetResourceType() string

type BucketPolicy

type BucketPolicy map[string]any

TODO: This can be better typed, but this is a complex object. See this library for example: https://github.com/liamg/iamgo/

type BucketVersioning

type BucketVersioning struct {
	Enabled   bool
	MfaDelete bool
}

type Client

type Client interface {
	ListBuckets(ctx context.Context, params *s3.ListBucketsInput, optFns ...func(*s3.Options)) (*s3.ListBucketsOutput, error)
	GetBucketEncryption(ctx context.Context, params *s3.GetBucketEncryptionInput, optFns ...func(*s3.Options)) (*s3.GetBucketEncryptionOutput, error)
	GetBucketLocation(ctx context.Context, params *s3.GetBucketLocationInput, optFns ...func(*s3.Options)) (*s3.GetBucketLocationOutput, error)
	GetBucketPolicy(ctx context.Context, params *s3.GetBucketPolicyInput, optFns ...func(*s3.Options)) (*s3.GetBucketPolicyOutput, error)
	GetBucketVersioning(ctx context.Context, params *s3.GetBucketVersioningInput, optFns ...func(*s3.Options)) (*s3.GetBucketVersioningOutput, error)
	GetBucketAcl(ctx context.Context, params *s3.GetBucketAclInput, optFns ...func(*s3.Options)) (*s3.GetBucketAclOutput, error)
	GetBucketLogging(ctx context.Context, params *s3.GetBucketLoggingInput, optFns ...func(*s3.Options)) (*s3.GetBucketLoggingOutput, error)
	GetPublicAccessBlock(ctx context.Context, params *s3.GetPublicAccessBlockInput, optFns ...func(*s3.Options)) (*s3.GetPublicAccessBlockOutput, error)
}

type ControlClient

type ControlClient interface {
	GetPublicAccessBlock(ctx context.Context, params *s3control.GetPublicAccessBlockInput, optFns ...func(*s3control.Options)) (*s3control.GetPublicAccessBlockOutput, error)
}

type Logging

type Logging struct {
	Enabled      bool   `json:"Enabled"`
	TargetBucket string `json:"TargetBucket"`
}

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func NewMockClient

func NewMockClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockClient

NewMockClient creates a new instance of MockClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockClient) EXPECT

func (_m *MockClient) EXPECT() *MockClient_Expecter

func (*MockClient) GetBucketAcl

func (_m *MockClient) GetBucketAcl(ctx context.Context, params *services3.GetBucketAclInput, optFns ...func(*services3.Options)) (*services3.GetBucketAclOutput, error)

GetBucketAcl provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetBucketEncryption

func (_m *MockClient) GetBucketEncryption(ctx context.Context, params *services3.GetBucketEncryptionInput, optFns ...func(*services3.Options)) (*services3.GetBucketEncryptionOutput, error)

GetBucketEncryption provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetBucketLocation

func (_m *MockClient) GetBucketLocation(ctx context.Context, params *services3.GetBucketLocationInput, optFns ...func(*services3.Options)) (*services3.GetBucketLocationOutput, error)

GetBucketLocation provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetBucketLogging

func (_m *MockClient) GetBucketLogging(ctx context.Context, params *services3.GetBucketLoggingInput, optFns ...func(*services3.Options)) (*services3.GetBucketLoggingOutput, error)

GetBucketLogging provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetBucketPolicy

func (_m *MockClient) GetBucketPolicy(ctx context.Context, params *services3.GetBucketPolicyInput, optFns ...func(*services3.Options)) (*services3.GetBucketPolicyOutput, error)

GetBucketPolicy provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetBucketVersioning

func (_m *MockClient) GetBucketVersioning(ctx context.Context, params *services3.GetBucketVersioningInput, optFns ...func(*services3.Options)) (*services3.GetBucketVersioningOutput, error)

GetBucketVersioning provides a mock function with given fields: ctx, params, optFns

func (*MockClient) GetPublicAccessBlock

func (_m *MockClient) GetPublicAccessBlock(ctx context.Context, params *services3.GetPublicAccessBlockInput, optFns ...func(*services3.Options)) (*services3.GetPublicAccessBlockOutput, error)

GetPublicAccessBlock provides a mock function with given fields: ctx, params, optFns

func (*MockClient) ListBuckets

func (_m *MockClient) ListBuckets(ctx context.Context, params *services3.ListBucketsInput, optFns ...func(*services3.Options)) (*services3.ListBucketsOutput, error)

ListBuckets provides a mock function with given fields: ctx, params, optFns

type MockClient_Expecter

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

func (*MockClient_Expecter) GetBucketAcl

func (_e *MockClient_Expecter) GetBucketAcl(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketAcl_Call

GetBucketAcl is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketAclInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetBucketEncryption

func (_e *MockClient_Expecter) GetBucketEncryption(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketEncryption_Call

GetBucketEncryption is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketEncryptionInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetBucketLocation

func (_e *MockClient_Expecter) GetBucketLocation(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketLocation_Call

GetBucketLocation is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketLocationInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetBucketLogging

func (_e *MockClient_Expecter) GetBucketLogging(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketLogging_Call

GetBucketLogging is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketLoggingInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetBucketPolicy

func (_e *MockClient_Expecter) GetBucketPolicy(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketPolicy_Call

GetBucketPolicy is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketPolicyInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetBucketVersioning

func (_e *MockClient_Expecter) GetBucketVersioning(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetBucketVersioning_Call

GetBucketVersioning is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetBucketVersioningInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) GetPublicAccessBlock

func (_e *MockClient_Expecter) GetPublicAccessBlock(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_GetPublicAccessBlock_Call

GetPublicAccessBlock is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.GetPublicAccessBlockInput
  • optFns ...func(*services3.Options)

func (*MockClient_Expecter) ListBuckets

func (_e *MockClient_Expecter) ListBuckets(ctx interface{}, params interface{}, optFns ...interface{}) *MockClient_ListBuckets_Call

ListBuckets is a helper method to define mock.On call

  • ctx context.Context
  • params *services3.ListBucketsInput
  • optFns ...func(*services3.Options)

type MockClient_GetBucketAcl_Call

type MockClient_GetBucketAcl_Call struct {
	*mock.Call
}

MockClient_GetBucketAcl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketAcl'

func (*MockClient_GetBucketAcl_Call) Return

func (*MockClient_GetBucketAcl_Call) Run

type MockClient_GetBucketEncryption_Call

type MockClient_GetBucketEncryption_Call struct {
	*mock.Call
}

MockClient_GetBucketEncryption_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketEncryption'

func (*MockClient_GetBucketEncryption_Call) Return

func (*MockClient_GetBucketEncryption_Call) Run

type MockClient_GetBucketLocation_Call

type MockClient_GetBucketLocation_Call struct {
	*mock.Call
}

MockClient_GetBucketLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketLocation'

func (*MockClient_GetBucketLocation_Call) Return

func (*MockClient_GetBucketLocation_Call) Run

type MockClient_GetBucketLogging_Call

type MockClient_GetBucketLogging_Call struct {
	*mock.Call
}

MockClient_GetBucketLogging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketLogging'

func (*MockClient_GetBucketLogging_Call) Return

func (*MockClient_GetBucketLogging_Call) Run

type MockClient_GetBucketPolicy_Call

type MockClient_GetBucketPolicy_Call struct {
	*mock.Call
}

MockClient_GetBucketPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketPolicy'

func (*MockClient_GetBucketPolicy_Call) Return

func (*MockClient_GetBucketPolicy_Call) Run

type MockClient_GetBucketVersioning_Call

type MockClient_GetBucketVersioning_Call struct {
	*mock.Call
}

MockClient_GetBucketVersioning_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketVersioning'

func (*MockClient_GetBucketVersioning_Call) Return

func (*MockClient_GetBucketVersioning_Call) Run

type MockClient_GetPublicAccessBlock_Call

type MockClient_GetPublicAccessBlock_Call struct {
	*mock.Call
}

MockClient_GetPublicAccessBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicAccessBlock'

func (*MockClient_GetPublicAccessBlock_Call) Return

func (*MockClient_GetPublicAccessBlock_Call) Run

type MockClient_ListBuckets_Call

type MockClient_ListBuckets_Call struct {
	*mock.Call
}

MockClient_ListBuckets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBuckets'

func (*MockClient_ListBuckets_Call) Return

func (*MockClient_ListBuckets_Call) Run

func (*MockClient_ListBuckets_Call) RunAndReturn

type MockControlClient

type MockControlClient struct {
	mock.Mock
}

MockControlClient is an autogenerated mock type for the ControlClient type

func NewMockControlClient

func NewMockControlClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockControlClient

NewMockControlClient creates a new instance of MockControlClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockControlClient) EXPECT

func (*MockControlClient) GetPublicAccessBlock

GetPublicAccessBlock provides a mock function with given fields: ctx, params, optFns

type MockControlClient_Expecter

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

func (*MockControlClient_Expecter) GetPublicAccessBlock

func (_e *MockControlClient_Expecter) GetPublicAccessBlock(ctx interface{}, params interface{}, optFns ...interface{}) *MockControlClient_GetPublicAccessBlock_Call

GetPublicAccessBlock is a helper method to define mock.On call

  • ctx context.Context
  • params *s3control.GetPublicAccessBlockInput
  • optFns ...func(*s3control.Options)

type MockControlClient_GetPublicAccessBlock_Call

type MockControlClient_GetPublicAccessBlock_Call struct {
	*mock.Call
}

MockControlClient_GetPublicAccessBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPublicAccessBlock'

func (*MockControlClient_GetPublicAccessBlock_Call) Return

func (*MockControlClient_GetPublicAccessBlock_Call) Run

type MockS3

type MockS3 struct {
	mock.Mock
}

MockS3 is an autogenerated mock type for the S3 type

func NewMockS3

func NewMockS3(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockS3

NewMockS3 creates a new instance of MockS3. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockS3) DescribeBuckets

func (_m *MockS3) DescribeBuckets(ctx context.Context) ([]awslib.AwsResource, error)

DescribeBuckets provides a mock function with given fields: ctx

func (*MockS3) EXPECT

func (_m *MockS3) EXPECT() *MockS3_Expecter

func (*MockS3) GetBucketACL

func (_m *MockS3) GetBucketACL(ctx context.Context, bucketName *string, region string) (*services3.GetBucketAclOutput, error)

GetBucketACL provides a mock function with given fields: ctx, bucketName, region

func (*MockS3) GetBucketLogging

func (_m *MockS3) GetBucketLogging(ctx context.Context, bucketName *string, region string) (Logging, error)

GetBucketLogging provides a mock function with given fields: ctx, bucketName, region

func (*MockS3) GetBucketPolicy

func (_m *MockS3) GetBucketPolicy(ctx context.Context, bucketName *string, region string) (BucketPolicy, error)

GetBucketPolicy provides a mock function with given fields: ctx, bucketName, region

type MockS3_DescribeBuckets_Call

type MockS3_DescribeBuckets_Call struct {
	*mock.Call
}

MockS3_DescribeBuckets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeBuckets'

func (*MockS3_DescribeBuckets_Call) Return

func (*MockS3_DescribeBuckets_Call) Run

func (*MockS3_DescribeBuckets_Call) RunAndReturn

type MockS3_Expecter

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

func (*MockS3_Expecter) DescribeBuckets

func (_e *MockS3_Expecter) DescribeBuckets(ctx interface{}) *MockS3_DescribeBuckets_Call

DescribeBuckets is a helper method to define mock.On call

  • ctx context.Context

func (*MockS3_Expecter) GetBucketACL

func (_e *MockS3_Expecter) GetBucketACL(ctx interface{}, bucketName interface{}, region interface{}) *MockS3_GetBucketACL_Call

GetBucketACL is a helper method to define mock.On call

  • ctx context.Context
  • bucketName *string
  • region string

func (*MockS3_Expecter) GetBucketLogging

func (_e *MockS3_Expecter) GetBucketLogging(ctx interface{}, bucketName interface{}, region interface{}) *MockS3_GetBucketLogging_Call

GetBucketLogging is a helper method to define mock.On call

  • ctx context.Context
  • bucketName *string
  • region string

func (*MockS3_Expecter) GetBucketPolicy

func (_e *MockS3_Expecter) GetBucketPolicy(ctx interface{}, bucketName interface{}, region interface{}) *MockS3_GetBucketPolicy_Call

GetBucketPolicy is a helper method to define mock.On call

  • ctx context.Context
  • bucketName *string
  • region string

type MockS3_GetBucketACL_Call

type MockS3_GetBucketACL_Call struct {
	*mock.Call
}

MockS3_GetBucketACL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketACL'

func (*MockS3_GetBucketACL_Call) Return

func (*MockS3_GetBucketACL_Call) Run

func (_c *MockS3_GetBucketACL_Call) Run(run func(ctx context.Context, bucketName *string, region string)) *MockS3_GetBucketACL_Call

func (*MockS3_GetBucketACL_Call) RunAndReturn

type MockS3_GetBucketLogging_Call

type MockS3_GetBucketLogging_Call struct {
	*mock.Call
}

MockS3_GetBucketLogging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketLogging'

func (*MockS3_GetBucketLogging_Call) Return

func (*MockS3_GetBucketLogging_Call) Run

func (_c *MockS3_GetBucketLogging_Call) Run(run func(ctx context.Context, bucketName *string, region string)) *MockS3_GetBucketLogging_Call

func (*MockS3_GetBucketLogging_Call) RunAndReturn

type MockS3_GetBucketPolicy_Call

type MockS3_GetBucketPolicy_Call struct {
	*mock.Call
}

MockS3_GetBucketPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketPolicy'

func (*MockS3_GetBucketPolicy_Call) Return

func (*MockS3_GetBucketPolicy_Call) Run

func (_c *MockS3_GetBucketPolicy_Call) Run(run func(ctx context.Context, bucketName *string, region string)) *MockS3_GetBucketPolicy_Call

func (*MockS3_GetBucketPolicy_Call) RunAndReturn

type Provider

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

func NewProvider

func NewProvider(log *logp.Logger, cfg aws.Config, factory awslib.CrossRegionFactory[Client], accountId string) *Provider

func (Provider) DescribeBuckets

func (p Provider) DescribeBuckets(ctx context.Context) ([]awslib.AwsResource, error)

func (Provider) GetBucketACL

func (p Provider) GetBucketACL(ctx context.Context, bucketName *string, region string) (*s3Client.GetBucketAclOutput, error)

func (Provider) GetBucketLogging

func (p Provider) GetBucketLogging(ctx context.Context, bucketName *string, region string) (Logging, error)

func (Provider) GetBucketPolicy

func (p Provider) GetBucketPolicy(ctx context.Context, bucketName *string, region string) (BucketPolicy, error)

type S3

type S3 interface {
	DescribeBuckets(ctx context.Context) ([]awslib.AwsResource, error)
	GetBucketACL(ctx context.Context, bucketName *string, region string) (*s3.GetBucketAclOutput, error)
	GetBucketPolicy(ctx context.Context, bucketName *string, region string) (BucketPolicy, error)
	GetBucketLogging(ctx context.Context, bucketName *string, region string) (Logging, error)
}

Jump to

Keyboard shortcuts

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