satellite/admin: introduce new placement rule

Change-Id: I582d38febd6187e06a46f14fd0f37531a2139c99
This commit is contained in:
Márton Elek 2023-05-24 16:59:47 +02:00 committed by Storj Robot
parent 11324111e3
commit 52598d1545
4 changed files with 7 additions and 2 deletions

View File

@ -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
}

View File

@ -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 {

View File

@ -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' }
])
]
],

View File

@ -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)
)