Documentation
¶
Index ¶
- Variables
- type Archive
- type ExportedVault
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) AbortMultipartUpload(accountID, region, vaultName, uploadID string) error
- func (b *InMemoryBackend) AbortVaultLock(accountID, region, vaultName string) error
- func (b *InMemoryBackend) AddArchiveInternal(accountID, region, vaultName string, a *Archive)
- func (b *InMemoryBackend) AddJobInternal(accountID, region, vaultName string, j *Job)
- func (b *InMemoryBackend) AddMultipartUploadInternal(accountID, region, vaultName string, up *MultipartUpload)
- func (b *InMemoryBackend) AddTagsToVault(accountID, region, vaultName string, tags map[string]string) error
- func (b *InMemoryBackend) AddVaultInternal(accountID, region string, v *Vault)
- func (b *InMemoryBackend) CompleteMultipartUpload(accountID, region, vaultName, uploadID, checksum string, archiveSize int64) (*Archive, error)
- func (b *InMemoryBackend) CompleteVaultLock(accountID, region, vaultName, lockID string) error
- func (b *InMemoryBackend) CreateVault(accountID, region, vaultName string) (*Vault, error)
- func (b *InMemoryBackend) DeleteArchive(accountID, region, vaultName, archiveID string) error
- func (b *InMemoryBackend) DeleteVault(accountID, region, vaultName string) error
- func (b *InMemoryBackend) DeleteVaultAccessPolicy(accountID, region, vaultName string) error
- func (b *InMemoryBackend) DeleteVaultNotifications(accountID, region, vaultName string) error
- func (b *InMemoryBackend) DescribeJob(accountID, region, vaultName, jobID string) (*Job, error)
- func (b *InMemoryBackend) DescribeVault(accountID, region, vaultName string) (*Vault, error)
- func (b *InMemoryBackend) GetArchiveData(archiveID string) ([]byte, bool)
- func (b *InMemoryBackend) GetDataRetrievalPolicy(accountID string) string
- func (b *InMemoryBackend) GetVaultAccessPolicy(accountID, region, vaultName string) (string, error)
- func (b *InMemoryBackend) GetVaultLock(accountID, region, vaultName string) (*VaultLock, error)
- func (b *InMemoryBackend) GetVaultNotifications(accountID, region, vaultName string) (string, []string, error)
- func (b *InMemoryBackend) InitiateJob(accountID, region, vaultName string, req *initiateJobRequest) (*Job, error)
- func (b *InMemoryBackend) InitiateMultipartUpload(accountID, region, vaultName, description string, partSize int64) (*MultipartUpload, error)
- func (b *InMemoryBackend) ListArchives(accountID, region, vaultName string) ([]*Archive, error)
- func (b *InMemoryBackend) ListJobs(accountID, region, vaultName string) ([]*Job, error)
- func (b *InMemoryBackend) ListMultipartUploads(accountID, region, vaultName string) []*MultipartUpload
- func (b *InMemoryBackend) ListParts(accountID, region, vaultName, uploadID string) (*ListPartsOutput, error)
- func (b *InMemoryBackend) ListProvisionedCapacity(accountID string) []*ProvisionedCapacity
- func (b *InMemoryBackend) ListTagsForVault(accountID, region, vaultName string) (map[string]string, error)
- func (b *InMemoryBackend) ListVaults(accountID, region string) []*Vault
- func (b *InMemoryBackend) PurchaseProvisionedCapacity(accountID string) (*ProvisionedCapacity, error)
- func (b *InMemoryBackend) RemoveTagsFromVault(accountID, region, vaultName string, tagKeys []string) error
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetDataRetrievalPolicy(accountID string, policy []byte)
- func (b *InMemoryBackend) SetJobInventorySize(accountID, region, vaultName, jobID string, size int64)
- func (b *InMemoryBackend) SetVaultAccessPolicy(accountID, region, vaultName, policy string) error
- func (b *InMemoryBackend) SetVaultLock(accountID, region, vaultName, policy, lockID string) error
- func (b *InMemoryBackend) SetVaultNotifications(accountID, region, vaultName, snsTopic string, events []string) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) UploadArchive(accountID, region, vaultName, description, checksum string, size int64, ...) (*Archive, error)
- func (b *InMemoryBackend) UploadMultipartPart(accountID, region, vaultName, uploadID, rangeHeader, checksum string) error
- type Job
- type ListPartsOutput
- type MultipartPart
- type MultipartUpload
- type Provider
- type ProvisionedCapacity
- type StorageBackend
- type Vault
- type VaultLock
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVaultNotFound is returned when a vault does not exist. ErrVaultNotFound = errors.New("ResourceNotFoundException: Vault not found") // ErrArchiveNotFound is returned when an archive does not exist. ErrArchiveNotFound = errors.New("ResourceNotFoundException: Archive not found") // ErrJobNotFound is returned when a job does not exist. ErrJobNotFound = errors.New("ResourceNotFoundException: Job not found") // ErrUploadNotFound is returned when a multipart upload does not exist. ErrUploadNotFound = errors.New("ResourceNotFoundException: Multipart upload not found") // ErrResourceInUse is returned when creating a vault that already exists. ErrResourceInUse = errors.New("ResourceInUseException: vault already exists") // ErrValidation is returned when an invalid parameter is supplied. ErrValidation = errors.New("InvalidParameterValueException: invalid parameter") // ErrVaultNotEmpty is returned when deleting a vault that still has archives. ErrVaultNotEmpty = errors.New("ConflictException: Vault not empty") // ErrLockConflict is returned when a vault lock is already in progress. ErrLockConflict = errors.New("InvalidParameterValueException: Vault lock already in progress") // ErrLockAlreadyLocked is returned when attempting to initiate a lock on an already-locked vault. ErrLockAlreadyLocked = errors.New("InvalidParameterValueException: Vault is already locked") // ErrTooManyTags is returned when adding tags would exceed the per-vault limit. ErrTooManyTags = errors.New("InvalidParameterValueException: too many tags on vault") // ErrProvisionedCapacityLimit is returned when trying to purchase more than 2 capacity units. ErrProvisionedCapacityLimit = errors.New("LimitExceededException: maximum 2 provisioned capacity units per account") // ErrInvalidTag is returned when a tag key or value fails validation. ErrInvalidTag = errors.New("InvalidParameterValueException: invalid tag key or value") )
Sentinel errors for Glacier backend operations.
var ( // ErrDescriptionTooLong is returned when an archive description exceeds maxDescriptionLen. ErrDescriptionTooLong = errors.New("description too long") // ErrDescriptionChar is returned when an archive description contains a non-printable character. ErrDescriptionChar = errors.New("description contains invalid character") // ErrLimitOutOfRange is returned when a ?limit query param is out of the allowed range. ErrLimitOutOfRange = errors.New("limit out of range") // ErrInvalidStrategy is returned when a DataRetrievalPolicy strategy is not recognised. ErrInvalidStrategy = errors.New("invalid data retrieval strategy") // ErrBytesPerHourRequired is returned when BytesPerHour strategy omits the BytesPerHour value. ErrBytesPerHourRequired = errors.New( "BytesPerHour strategy requires a positive BytesPerHour value", ) // ErrInvalidVaultName is returned when a vault name contains invalid characters. ErrInvalidVaultName = errors.New("invalid vault name") // ErrJobNotComplete is returned when GetJobOutput is called on an incomplete job. ErrJobNotComplete = errors.New("job output is not yet available") )
Handler-level sentinel errors used as wrapping targets to satisfy err113.
var ErrNilAppContext = errors.New("glacier: nil AppContext")
ErrNilAppContext is returned when Init is called with a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct {
ArchiveID string `json:"archiveID"`
Description string `json:"description,omitempty"`
CreationDate string `json:"creationDate"`
SHA256TreeHash string `json:"sha256TreeHash,omitempty"`
Size int64 `json:"size"`
}
Archive stores metadata for a single archive uploaded to a vault.
type ExportedVault ¶
type ExportedVault = Vault
ExportedVault is a compatibility alias used by the dashboard package.
type Handler ¶
type Handler struct {
Backend StorageBackend
AccountID string
DefaultRegion string
}
Handler is the HTTP handler for the Glacier REST API.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new Glacier handler.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this Glacier instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the Glacier operation name from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the vault name or resource ID from the URL path.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported Glacier operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for Glacier requests.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset clears all backend state and the handler-level archive data store.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches Glacier REST API requests. Glacier uses paths like /{accountId}/vaults/... where accountId is "-" or a real account ID.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory backend for Glacier.
vaults, jobs, multipartUploads, and vaultLocks are *store.Table[T], registered once on registry -- see store_setup.go for the Phase 3.3 pkgs/store conversion this follows. Archives stay nested inline on Vault rather than their own table (see the Vault doc comment in models.go). multipartParts, provisionedCapacity, dataRetrievalPolicies, and archiveData remain plain maps because their values are slice/string-typed (not *T) with no identity field of their own to key a Table by.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new in-memory Glacier backend.
func (*InMemoryBackend) AbortMultipartUpload ¶
func (b *InMemoryBackend) AbortMultipartUpload(accountID, region, vaultName, uploadID string) error
AbortMultipartUpload cancels an in-progress multipart upload.
func (*InMemoryBackend) AbortVaultLock ¶
func (b *InMemoryBackend) AbortVaultLock(accountID, region, vaultName string) error
AbortVaultLock removes an in-progress vault lock.
func (*InMemoryBackend) AddArchiveInternal ¶
func (b *InMemoryBackend) AddArchiveInternal(accountID, region, vaultName string, a *Archive)
AddArchiveInternal adds an archive directly to the backend for testing. It does not update the vault's NumberOfArchives or SizeInBytes counters; callers that need accounting to be correct should update the vault via AddVaultInternal.
It is a no-op if the vault does not already exist: Archives is stored inline on Vault (see models.go), so there is no vault-less orphan slot to write into -- and, just as before this conversion, every other archive- reading path (ListArchives, DeleteArchive, InitiateJob, ...) already requires the vault to exist first, so a pre-conversion "orphan" archive entry was equally unreachable.
func (*InMemoryBackend) AddJobInternal ¶
func (b *InMemoryBackend) AddJobInternal(accountID, region, vaultName string, j *Job)
AddJobInternal adds a job directly to the backend for testing. VaultARN is always recomputed from the accountID/region/vaultName parameters -- see the AddVaultInternal doc comment for why.
func (*InMemoryBackend) AddMultipartUploadInternal ¶
func (b *InMemoryBackend) AddMultipartUploadInternal(accountID, region, vaultName string, up *MultipartUpload)
AddMultipartUploadInternal adds an in-progress multipart upload directly to the backend for testing. VaultARN is always recomputed from the accountID/region/vaultName parameters -- see the AddVaultInternal doc comment for why.
func (*InMemoryBackend) AddTagsToVault ¶
func (b *InMemoryBackend) AddTagsToVault(accountID, region, vaultName string, tags map[string]string) error
AddTagsToVault adds or updates tags on a vault.
func (*InMemoryBackend) AddVaultInternal ¶
func (b *InMemoryBackend) AddVaultInternal(accountID, region string, v *Vault)
AddVaultInternal adds a vault directly to the backend for testing.
VaultARN, AccountID, and Region are always (re)computed from the accountID and region parameters rather than trusted from v, mirroring how CreateVault derives them: they are what key and index the vault in the vaults *store.Table, so an untrusted/stale value here would silently misfile (or collide with) the entry -- see the "Watch mutating-key" note in store_setup.go's package doc.
func (*InMemoryBackend) CompleteMultipartUpload ¶
func (b *InMemoryBackend) CompleteMultipartUpload( accountID, region, vaultName, uploadID, checksum string, archiveSize int64, ) (*Archive, error)
CompleteMultipartUpload finalises a multipart upload and creates an archive.
func (*InMemoryBackend) CompleteVaultLock ¶
func (b *InMemoryBackend) CompleteVaultLock(accountID, region, vaultName, lockID string) error
CompleteVaultLock completes and seals a vault lock.
func (*InMemoryBackend) CreateVault ¶
func (b *InMemoryBackend) CreateVault(accountID, region, vaultName string) (*Vault, error)
CreateVault creates a new Glacier vault.
func (*InMemoryBackend) DeleteArchive ¶
func (b *InMemoryBackend) DeleteArchive(accountID, region, vaultName, archiveID string) error
DeleteArchive deletes an archive from a vault.
func (*InMemoryBackend) DeleteVault ¶
func (b *InMemoryBackend) DeleteVault(accountID, region, vaultName string) error
DeleteVault deletes a vault.
func (*InMemoryBackend) DeleteVaultAccessPolicy ¶
func (b *InMemoryBackend) DeleteVaultAccessPolicy(accountID, region, vaultName string) error
DeleteVaultAccessPolicy deletes the access policy for a vault.
func (*InMemoryBackend) DeleteVaultNotifications ¶
func (b *InMemoryBackend) DeleteVaultNotifications(accountID, region, vaultName string) error
DeleteVaultNotifications deletes the notification configuration for a vault.
func (*InMemoryBackend) DescribeJob ¶
func (b *InMemoryBackend) DescribeJob(accountID, region, vaultName, jobID string) (*Job, error)
DescribeJob returns metadata for a job.
func (*InMemoryBackend) DescribeVault ¶
func (b *InMemoryBackend) DescribeVault(accountID, region, vaultName string) (*Vault, error)
DescribeVault returns vault metadata.
func (*InMemoryBackend) GetArchiveData ¶
func (b *InMemoryBackend) GetArchiveData(archiveID string) ([]byte, bool)
GetArchiveData returns the data for an archive.
func (*InMemoryBackend) GetDataRetrievalPolicy ¶
func (b *InMemoryBackend) GetDataRetrievalPolicy(accountID string) string
GetDataRetrievalPolicy returns the data retrieval policy for the account.
func (*InMemoryBackend) GetVaultAccessPolicy ¶
func (b *InMemoryBackend) GetVaultAccessPolicy(accountID, region, vaultName string) (string, error)
GetVaultAccessPolicy returns the access policy for a vault.
func (*InMemoryBackend) GetVaultLock ¶
func (b *InMemoryBackend) GetVaultLock(accountID, region, vaultName string) (*VaultLock, error)
GetVaultLock returns the vault lock state. If no lock has been initiated, the returned VaultLock has State "Unlocked".
func (*InMemoryBackend) GetVaultNotifications ¶
func (b *InMemoryBackend) GetVaultNotifications(accountID, region, vaultName string) (string, []string, error)
GetVaultNotifications returns the notification configuration for a vault.
func (*InMemoryBackend) InitiateJob ¶
func (b *InMemoryBackend) InitiateJob(accountID, region, vaultName string, req *initiateJobRequest) (*Job, error)
InitiateJob creates a new retrieval or inventory job.
func (*InMemoryBackend) InitiateMultipartUpload ¶
func (b *InMemoryBackend) InitiateMultipartUpload( accountID, region, vaultName, description string, partSize int64, ) (*MultipartUpload, error)
InitiateMultipartUpload begins a multipart upload for a vault.
func (*InMemoryBackend) ListArchives ¶
func (b *InMemoryBackend) ListArchives(accountID, region, vaultName string) ([]*Archive, error)
ListArchives returns all archives for the given vault.
func (*InMemoryBackend) ListJobs ¶
func (b *InMemoryBackend) ListJobs(accountID, region, vaultName string) ([]*Job, error)
ListJobs returns all jobs for the given vault. Returns ErrVaultNotFound if the vault does not exist.
func (*InMemoryBackend) ListMultipartUploads ¶
func (b *InMemoryBackend) ListMultipartUploads(accountID, region, vaultName string) []*MultipartUpload
ListMultipartUploads returns all in-progress multipart uploads for a vault.
func (*InMemoryBackend) ListParts ¶
func (b *InMemoryBackend) ListParts( accountID, region, vaultName, uploadID string, ) (*ListPartsOutput, error)
ListParts returns the parts for an in-progress multipart upload.
func (*InMemoryBackend) ListProvisionedCapacity ¶
func (b *InMemoryBackend) ListProvisionedCapacity(accountID string) []*ProvisionedCapacity
ListProvisionedCapacity returns all non-expired provisioned capacity units for an account.
func (*InMemoryBackend) ListTagsForVault ¶
func (b *InMemoryBackend) ListTagsForVault(accountID, region, vaultName string) (map[string]string, error)
ListTagsForVault returns all tags for a vault.
func (*InMemoryBackend) ListVaults ¶
func (b *InMemoryBackend) ListVaults(accountID, region string) []*Vault
ListVaults returns all vaults for the given account and region.
func (*InMemoryBackend) PurchaseProvisionedCapacity ¶
func (b *InMemoryBackend) PurchaseProvisionedCapacity(accountID string) (*ProvisionedCapacity, error)
PurchaseProvisionedCapacity adds a provisioned capacity unit for an account. Returns ErrProvisionedCapacityLimit if the account already has 2 active units.
func (*InMemoryBackend) RemoveTagsFromVault ¶
func (b *InMemoryBackend) RemoveTagsFromVault(accountID, region, vaultName string, tagKeys []string) error
RemoveTagsFromVault removes tags from a vault.
func (*InMemoryBackend) Reset ¶
func (b *InMemoryBackend) Reset()
Reset clears all backend state, resetting to an empty store.
archiveData is deliberately NOT cleared here, matching the pre-conversion behaviour: raw archive bytes have always leaked across Reset() calls (they were never part of any of the maps this method used to reinitialise).
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a JSON snapshot.
func (*InMemoryBackend) SetDataRetrievalPolicy ¶
func (b *InMemoryBackend) SetDataRetrievalPolicy(accountID string, policy []byte)
SetDataRetrievalPolicy stores the data retrieval policy for the account.
func (*InMemoryBackend) SetJobInventorySize ¶
func (b *InMemoryBackend) SetJobInventorySize(accountID, region, vaultName, jobID string, size int64)
SetJobInventorySize stores the computed inventory size on the job. No-op if the job does not exist.
func (*InMemoryBackend) SetVaultAccessPolicy ¶
func (b *InMemoryBackend) SetVaultAccessPolicy(accountID, region, vaultName, policy string) error
SetVaultAccessPolicy sets the access policy for a vault.
func (*InMemoryBackend) SetVaultLock ¶
func (b *InMemoryBackend) SetVaultLock(accountID, region, vaultName, policy, lockID string) error
SetVaultLock stores a vault lock policy (used by InitiateVaultLock).
func (*InMemoryBackend) SetVaultNotifications ¶
func (b *InMemoryBackend) SetVaultNotifications(accountID, region, vaultName, snsTopic string, events []string) error
SetVaultNotifications sets the notification configuration for a vault.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state to JSON.
func (*InMemoryBackend) UploadArchive ¶
func (b *InMemoryBackend) UploadArchive( accountID, region, vaultName, description, checksum string, size int64, data []byte, ) (*Archive, error)
UploadArchive uploads an archive to a vault.
func (*InMemoryBackend) UploadMultipartPart ¶
func (b *InMemoryBackend) UploadMultipartPart( accountID, region, vaultName, uploadID, rangeHeader, checksum string, ) error
UploadMultipartPart records a part for an in-progress multipart upload.
type Job ¶
type Job struct {
VaultARN string `json:"vaultARN"`
VaultName string `json:"vaultName"`
JobID string `json:"jobID"`
JobDescription string `json:"jobDescription,omitempty"`
Action string `json:"action"`
ArchiveID string `json:"archiveID,omitempty"`
// ArchiveDescription is the description of the archive being retrieved, copied
// from the Archive at InitiateJob time. It is not part of the DescribeJob wire
// response (AWS has no such field there); it exists solely so GetJobOutput can
// echo it back via the X-Amz-Archive-Description response header, matching
// real Glacier's GetJobOutputOutput.ArchiveDescription.
ArchiveDescription string `json:"archiveDescription,omitempty"`
InventoryFormat string `json:"inventoryFormat,omitempty"`
StatusCode string `json:"statusCode"`
StatusMessage string `json:"statusMessage,omitempty"`
CreationDate string `json:"creationDate"`
CompletionDate string `json:"completionDate,omitempty"`
Tier string `json:"tier,omitempty"`
// SHA256TreeHash is the tree hash of the *retrieved range*; per AWS it is only
// populated once the job has Completed (null while InProgress). For whole-archive
// retrievals it equals ArchiveSHA256TreeHash.
SHA256TreeHash string `json:"sha256TreeHash,omitempty"`
// ArchiveSHA256TreeHash is the tree hash of the entire archive, present as soon
// as the archive-retrieval job is created (it is archive metadata, not
// job-completion-dependent) -- distinct from SHA256TreeHash on the real wire.
ArchiveSHA256TreeHash string `json:"archiveSHA256TreeHash,omitempty"`
SNSTopic string `json:"snsTopic,omitempty"`
RetrievalByteRange string `json:"retrievalByteRange,omitempty"`
ArchiveSizeInBytes int64 `json:"archiveSizeInBytes,omitempty"`
InventorySizeInBytes int64 `json:"inventorySizeInBytes,omitempty"`
Completed bool `json:"completed"`
// contains filtered or unexported fields
}
Job stores state for a single Glacier retrieval or inventory job.
type ListPartsOutput ¶
type ListPartsOutput struct {
Marker *string `json:"Marker,omitempty"`
MultipartUploadID string `json:"MultipartUploadId"`
VaultARN string `json:"VaultARN"`
ArchiveDescription string `json:"ArchiveDescription,omitempty"`
CreationDate string `json:"CreationDate"`
Parts []MultipartPart `json:"Parts"`
PartSizeInBytes int64 `json:"PartSizeInBytes"`
}
ListPartsOutput is the response for ListParts.
type MultipartPart ¶
type MultipartPart struct {
RangeInBytes string `json:"RangeInBytes"`
SHA256TreeHash string `json:"SHA256TreeHash,omitempty"`
}
MultipartPart holds metadata for a single uploaded part.
type MultipartUpload ¶
type MultipartUpload struct {
MultipartUploadID string `json:"MultipartUploadId"`
VaultARN string `json:"VaultARN"`
ArchiveDescription string `json:"ArchiveDescription,omitempty"`
CreationDate string `json:"CreationDate"`
PartSizeInBytes int64 `json:"PartSizeInBytes"`
}
MultipartUpload holds metadata for an in-progress multipart upload.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for the Glacier service.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the Glacier service backend and handler.
type ProvisionedCapacity ¶
type ProvisionedCapacity struct {
CapacityID string `json:"CapacityId"`
StartDate string `json:"StartDate"`
ExpirationDate string `json:"ExpirationDate"`
}
ProvisionedCapacity holds a single provisioned capacity unit.
type StorageBackend ¶
type StorageBackend interface {
CreateVault(accountID, region, vaultName string) (*Vault, error)
DescribeVault(accountID, region, vaultName string) (*Vault, error)
DeleteVault(accountID, region, vaultName string) error
ListVaults(accountID, region string) []*Vault
UploadArchive(accountID, region, vaultName, description, checksum string, size int64, data []byte) (*Archive, error)
DeleteArchive(accountID, region, vaultName, archiveID string) error
ListArchives(accountID, region, vaultName string) ([]*Archive, error)
GetArchiveData(archiveID string) ([]byte, bool)
InitiateJob(accountID, region, vaultName string, req *initiateJobRequest) (*Job, error)
DescribeJob(accountID, region, vaultName, jobID string) (*Job, error)
ListJobs(accountID, region, vaultName string) ([]*Job, error)
SetVaultNotifications(accountID, region, vaultName, snsTopic string, events []string) error
GetVaultNotifications(accountID, region, vaultName string) (string, []string, error)
DeleteVaultNotifications(accountID, region, vaultName string) error
SetVaultAccessPolicy(accountID, region, vaultName, policy string) error
GetVaultAccessPolicy(accountID, region, vaultName string) (string, error)
DeleteVaultAccessPolicy(accountID, region, vaultName string) error
AddTagsToVault(accountID, region, vaultName string, tags map[string]string) error
ListTagsForVault(accountID, region, vaultName string) (map[string]string, error)
RemoveTagsFromVault(accountID, region, vaultName string, tagKeys []string) error
// Multipart upload operations.
InitiateMultipartUpload(accountID, region, vaultName, description string, partSize int64) (*MultipartUpload, error)
UploadMultipartPart(accountID, region, vaultName, uploadID, rangeHeader, checksum string) error
CompleteMultipartUpload(
accountID, region, vaultName, uploadID, checksum string,
archiveSize int64,
) (*Archive, error)
AbortMultipartUpload(accountID, region, vaultName, uploadID string) error
ListMultipartUploads(accountID, region, vaultName string) []*MultipartUpload
ListParts(accountID, region, vaultName, uploadID string) (*ListPartsOutput, error)
// Vault lock operations.
GetVaultLock(accountID, region, vaultName string) (*VaultLock, error)
SetVaultLock(accountID, region, vaultName, policy, lockID string) error
AbortVaultLock(accountID, region, vaultName string) error
CompleteVaultLock(accountID, region, vaultName, lockID string) error
// Data retrieval policy operations.
GetDataRetrievalPolicy(accountID string) string
SetDataRetrievalPolicy(accountID string, policy []byte)
// Provisioned capacity operations.
ListProvisionedCapacity(accountID string) []*ProvisionedCapacity
PurchaseProvisionedCapacity(accountID string) (*ProvisionedCapacity, error)
// SetJobInventorySize persists the computed InventorySizeInBytes on a completed
// inventory-retrieval job so that subsequent DescribeJob calls return it.
SetJobInventorySize(accountID, region, vaultName, jobID string, size int64)
Reset()
}
StorageBackend is the interface for the Glacier backend.
type Vault ¶
type Vault struct {
Tags map[string]string `json:"tags,omitempty"`
Archives map[string]*Archive `json:"archives,omitempty"`
AccessPolicy string `json:"accessPolicy,omitempty"`
NotificationSNSTopic string `json:"notificationSNSTopic,omitempty"`
VaultARN string `json:"vaultARN"`
VaultName string `json:"vaultName"`
AccountID string `json:"accountID"`
Region string `json:"region"`
CreationDate string `json:"creationDate"`
LastInventoryDate string `json:"lastInventoryDate,omitempty"`
NotificationEvents []string `json:"notificationEvents,omitempty"`
NumberOfArchives int64 `json:"numberOfArchives"`
SizeInBytes int64 `json:"sizeInBytes"`
}
Vault stores all metadata and state for a single Glacier vault.
AccountID and Region are not part of any AWS wire response (those are built from explicit response DTOs in handler.go) but are needed, alongside VaultARN, to key and index Vault in the *store.Table[Vault]/store.Index pkgs/store conversion -- see store_setup.go. Archives is nested state kept INLINE on Vault (rather than its own store.Table) because every access site scopes archives by vault and Archive itself carries no natural cross-vault identity field to key a flat table by.
type VaultLock ¶
type VaultLock struct {
VaultARN string `json:"vaultARN"`
Policy string `json:"Policy"`
LockID string `json:"LockId,omitempty"`
State string `json:"State"`
CreationDate string `json:"CreationDate,omitempty"`
ExpirationDate string `json:"ExpirationDate,omitempty"`
}
VaultLock holds the state of a vault lock policy.
VaultARN is not part of any AWS wire response (getVaultLockResponse is a separate, explicit DTO in handler.go) but is needed to key VaultLock in the *store.Table[VaultLock] pkgs/store conversion -- see store_setup.go.
Source Files
¶
- archives.go
- data_retrieval_policy.go
- errors.go
- exports.go
- handler.go
- handler_archives.go
- handler_data_retrieval_policy.go
- handler_jobs.go
- handler_multipart_uploads.go
- handler_provisioned_capacity.go
- handler_tags.go
- handler_vault_access_policy.go
- handler_vault_lock.go
- handler_vault_notifications.go
- handler_vaults.go
- interfaces.go
- jobs.go
- models.go
- multipart_uploads.go
- persistence.go
- provider.go
- provisioned_capacity.go
- store.go
- store_setup.go
- tags.go
- vault_access_policy.go
- vault_lock.go
- vault_notifications.go
- vaults.go