You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// getRegionFromKey returns the region from the key. If the key is requests, it will return an empty string because there is no region associated with it.
98
+
// getRegionFromKey returns the region from the key. Keys without a recognisable
99
+
// region prefix are returned as "unknown".
98
100
funcgetRegionFromKey(keystring) string {
101
+
region:=utils.RegionUnknown
99
102
ifkey=="Requests-Tier1"||key=="Requests-Tier2" {
100
-
return""
103
+
returnregion
101
104
}
102
105
103
106
split:=strings.Split(key, "-")
104
107
iflen(split) <2 {
105
-
slog.Warn("Could not find region in key", "key", key)
106
-
return""
108
+
returnregion
107
109
}
108
110
109
111
billingRegion:=split[0]
110
112
ifregion, ok:=BillingToRegionMap[billingRegion]; ok {
111
113
returnregion
112
114
}
113
-
slog.Warn("Could not find mapped region", "key", key, "billingRegion", billingRegion)
114
-
return""
115
+
116
+
// Per AWS S3 documentation, usage types for us-east-1 may appear without a
117
+
// region prefix (e.g. "TimedStorage-ByteHrs" instead of "USE1-TimedStorage-ByteHrs").
118
+
ifbillingRegion=="TimedStorage" {
119
+
returnBillingToRegionMap["USE1"]
120
+
}
121
+
returnregion
115
122
}
116
123
117
124
// getComponentFromKey returns the component from the key. If the component does not contain a region, it will return
0 commit comments