forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
storage_class.go
35 lines (28 loc) · 1.34 KB
/
storage_class.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package aws
import (
"fmt"
"strings"
"github.com/grafana/loki/pkg/util"
)
const (
// S3 Storage Class options which define the data access, resiliency & cost requirements of objects
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax
StorageClassGlacier = "GLACIER"
StorageClassDeepArchive = "DEEP_ARCHIVE"
StorageClassGlacierInstantRetrieval = "GLACIER_IR"
StorageClassIntelligentTiering = "INTELLIGENT_TIERING"
StorageClassOneZoneInfrequentAccess = "ONEZONE_IA"
StorageClassOutposts = "OUTPOSTS"
StorageClassReducedRedundancy = "REDUCED_REDUNDANCY"
StorageClassStandard = "STANDARD"
StorageClassStandardInfrequentAccess = "STANDARD_IA"
)
var (
SupportedStorageClasses = []string{StorageClassGlacier, StorageClassDeepArchive, StorageClassGlacierInstantRetrieval, StorageClassIntelligentTiering, StorageClassOneZoneInfrequentAccess, StorageClassOutposts, StorageClassReducedRedundancy, StorageClassStandard, StorageClassStandardInfrequentAccess}
)
func ValidateStorageClass(storageClass string) error {
if !util.StringsContain(SupportedStorageClasses, storageClass) {
return fmt.Errorf("unsupported S3 storage class: %s. Supported values: %s", storageClass, strings.Join(SupportedStorageClasses, ", "))
}
return nil
}