satellite/admin: introduce new placement rule
Change-Id: I582d38febd6187e06a46f14fd0f37531a2139c99
This commit is contained in:
parent
11324111e3
commit
52598d1545
@ -46,6 +46,8 @@ func parsePlacementConstraint(regionCode string) (storj.PlacementConstraint, err
|
||||
return storj.US, nil
|
||||
case "DE":
|
||||
return storj.DE, nil
|
||||
case "NR":
|
||||
return storj.NR, nil
|
||||
case "":
|
||||
return storj.EveryCountry, fmt.Errorf("missing region parameter")
|
||||
default:
|
||||
@ -93,7 +95,7 @@ func (server *Server) updateBucket(w http.ResponseWriter, r *http.Request, place
|
||||
func (server *Server) createGeofenceForBucket(w http.ResponseWriter, r *http.Request) {
|
||||
placement, err := parsePlacementConstraint(r.URL.Query().Get("region"))
|
||||
if err != nil {
|
||||
sendJSONError(w, err.Error(), "available: EU, EEA, US, DE", http.StatusBadRequest)
|
||||
sendJSONError(w, err.Error(), "available: EU, EEA, US, DE, NR", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ func TestParsePlacementConstraint(t *testing.T) {
|
||||
{"EU", "EU", storj.EU, ""},
|
||||
{"EEA", "EEA", storj.EEA, ""},
|
||||
{"DE", "DE", storj.DE, ""},
|
||||
{"NR", "NR", storj.NR, ""},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
@ -76,7 +76,8 @@ export class Admin {
|
||||
{ text: 'European Union', value: 'EU' },
|
||||
{ text: 'European Economic Area', value: 'EEA' },
|
||||
{ text: 'United States', value: 'US' },
|
||||
{ text: 'Germany', value: 'DE' }
|
||||
{ text: 'Germany', value: 'DE' },
|
||||
{ text: 'No Russia and/or other sanctioned country', value: 'NR' }
|
||||
])
|
||||
]
|
||||
],
|
||||
|
@ -61,6 +61,7 @@ model bucket_metainfo (
|
||||
// 3 - US
|
||||
// 4 - DE
|
||||
// 5 - Invalid, when there's no information about the placement.
|
||||
// 6 - NR (no Russia, Belarus or other sanctioned country)
|
||||
field placement int (nullable, updatable)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user