Documentation ¶
Index ¶
- func BuildMeta(meta *ExportMeta) ([]byte, error)
- func BuildReadme(meta *ExportMeta) (string, error)
- func GetObject(c context.Context, api S3GetObjectAPI, input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
- func GetObjects(c context.Context, api S3ListObjectsAPI, input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
- func NewS3Client(cfg econfig.ExportConfig, log *zap.SugaredLogger) *s3.Client
- type Compressor
- func (c *Compressor) Compress(ctx context.Context, m *models.ExportPayload) (time.Time, string, string, error)
- func (c *Compressor) CreateObject(ctx context.Context, db models.DBInterface, body io.Reader, application string, ...) error
- func (c *Compressor) Download(ctx context.Context, w io.WriterAt, bucket, key *string) (n int64, err error)
- func (c *Compressor) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *Compressor) ProcessSources(db models.DBInterface, uid uuid.UUID)
- func (c *Compressor) Upload(ctx context.Context, body io.Reader, bucket, key *string) (*manager.UploadOutput, error)
- type ExportError
- type ExportFileMeta
- type ExportMeta
- type FailedFileMeta
- type MockStorageHandler
- func (mc *MockStorageHandler) Compress(ctx context.Context, m *models.ExportPayload) (time.Time, string, string, error)
- func (mc *MockStorageHandler) CreateObject(ctx context.Context, db models.DBInterface, body io.Reader, application string, ...) error
- func (mc *MockStorageHandler) Download(ctx context.Context, w io.WriterAt, bucket, key *string) (n int64, err error)
- func (mc *MockStorageHandler) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
- func (mc *MockStorageHandler) ProcessSources(db models.DBInterface, uid uuid.UUID)
- func (mc *MockStorageHandler) Upload(ctx context.Context, body io.Reader, bucket, key *string) (*manager.UploadOutput, error)
- type S3GetObjectAPI
- type S3ListObjectsAPI
- type StorageHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMeta ¶
func BuildMeta(meta *ExportMeta) ([]byte, error)
func BuildReadme ¶
func BuildReadme(meta *ExportMeta) (string, error)
func GetObject ¶
func GetObject(c context.Context, api S3GetObjectAPI, input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
GetObject retrieves objects from Amazon S3
func GetObjects ¶
func GetObjects(c context.Context, api S3ListObjectsAPI, input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
func NewS3Client ¶
func NewS3Client(cfg econfig.ExportConfig, log *zap.SugaredLogger) *s3.Client
Types ¶
type Compressor ¶
type Compressor struct { Bucket string Log *zap.SugaredLogger Client s3.Client Cfg econfig.ExportConfig }
func (*Compressor) Compress ¶
func (c *Compressor) Compress(ctx context.Context, m *models.ExportPayload) (time.Time, string, string, error)
func (*Compressor) CreateObject ¶
func (c *Compressor) CreateObject(ctx context.Context, db models.DBInterface, body io.Reader, application string, resourceUUID uuid.UUID, payload *models.ExportPayload) error
func (*Compressor) GetObject ¶
func (c *Compressor) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
func (*Compressor) ProcessSources ¶
func (c *Compressor) ProcessSources(db models.DBInterface, uid uuid.UUID)
type ExportError ¶
type ExportFileMeta ¶
type ExportFileMeta struct { Filename string `json:"filename"` Application string `json:"application"` Resource string `json:"resource"` // Filters are a key-value pair of the filters used to create the export Filters map[string]string `json:"filters"` }
details for each file in the tar
type ExportMeta ¶
type ExportMeta struct { ExportBy string `json:"exported_by"` ExportDate string `json:"export_date"` ExportOrgID string `json:"export_org_id"` FileMeta []ExportFileMeta `json:"file_meta"` HelpString string `json:"help_string"` FailedFiles []FailedFileMeta `json:"failed_files,omitempty"` }
struct used to fill the README.md and meta.json files in the tar
type FailedFileMeta ¶
type FailedFileMeta struct { Filename string `json:"filename"` Application string `json:"application"` Resource string `json:"resource"` Error ExportError `json:"error"` }
type MockStorageHandler ¶
type MockStorageHandler struct { }
func (*MockStorageHandler) Compress ¶
func (mc *MockStorageHandler) Compress(ctx context.Context, m *models.ExportPayload) (time.Time, string, string, error)
func (*MockStorageHandler) CreateObject ¶
func (mc *MockStorageHandler) CreateObject(ctx context.Context, db models.DBInterface, body io.Reader, application string, resourceUUID uuid.UUID, payload *models.ExportPayload) error
func (*MockStorageHandler) GetObject ¶
func (mc *MockStorageHandler) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
func (*MockStorageHandler) ProcessSources ¶
func (mc *MockStorageHandler) ProcessSources(db models.DBInterface, uid uuid.UUID)
type S3GetObjectAPI ¶
type S3GetObjectAPI interface { GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) }
S3GetObjectAPI defines the interface for the GetObject function. We use this interface to test the function using a mocked service.
type S3ListObjectsAPI ¶
type S3ListObjectsAPI interface { ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error) }
S3ListObjectsAPI defines the interface for the ListObjectsV2 function. We use this interface to test the function using a mocked service. https://aws.github.io/aws-sdk-go-v2/docs/code-examples/s3/listobjects/
type StorageHandler ¶
type StorageHandler interface { Compress(ctx context.Context, m *models.ExportPayload) (time.Time, string, string, error) Download(ctx context.Context, w io.WriterAt, bucket, key *string) (n int64, err error) Upload(ctx context.Context, body io.Reader, bucket, key *string) (*manager.UploadOutput, error) CreateObject(ctx context.Context, db models.DBInterface, body io.Reader, application string, resourceUUID uuid.UUID, payload *models.ExportPayload) error GetObject(ctx context.Context, key string) (io.ReadCloser, error) ProcessSources(db models.DBInterface, uid uuid.UUID) }
Click to show internal directories.
Click to hide internal directories.