[#274] Refactor system cache and cors

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2021-10-13 21:50:02 +03:00 committed by Alex Vanin
parent 5b4b9df031
commit 91bed76010
7 changed files with 192 additions and 159 deletions

View file

@ -1,6 +1,7 @@
package data
import (
"encoding/xml"
"time"
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
@ -39,6 +40,22 @@ type (
Owner *owner.ID
Headers map[string]string
}
// CORSConfiguration stores CORS configuration of a request.
CORSConfiguration struct {
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CORSConfiguration" json:"-"`
CORSRules []CORSRule `xml:"CORSRule" json:"CORSRules"`
}
// CORSRule stores rules for CORS in a bucket.
CORSRule struct {
ID string `xml:"ID,omitempty" json:"ID,omitempty"`
AllowedHeaders []string `xml:"AllowedHeader" json:"AllowedHeaders"`
AllowedMethods []string `xml:"AllowedMethod" json:"AllowedMethods"`
AllowedOrigins []string `xml:"AllowedOrigin" json:"AllowedOrigins"`
ExposeHeaders []string `xml:"ExposeHeader" json:"ExposeHeaders"`
MaxAgeSeconds int `xml:"MaxAgeSeconds,omitempty" json:"MaxAgeSeconds,omitempty"`
}
)
// SettingsObjectName is system name for bucket settings file.