Compare commits
6 commits
master
...
support/v0
Author | SHA1 | Date | |
---|---|---|---|
e721ac82f7 | |||
fbdd83e574 | |||
a990fb13d1 | |||
c1f3110dcc | |||
3f599f6bc2 | |||
ca5536d6d5 |
27 changed files with 209 additions and 70 deletions
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -4,6 +4,18 @@ This document outlines major changes between releases.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.31.3] - 2024-12-17
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Return BucketAlreadyExists when global domain taken (#584)
|
||||||
|
- Fix list-buckets vhs routing (#583)
|
||||||
|
- Skip port when matching listen domains (#586)
|
||||||
|
|
||||||
|
## [0.31.2] - 2024-12-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Unable to remove EC object (#576)
|
||||||
|
|
||||||
## [0.31.1] - 2024-11-28
|
## [0.31.1] - 2024-11-28
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -62,6 +74,11 @@ This document outlines major changes between releases.
|
||||||
### Removed
|
### Removed
|
||||||
- Reduce using mutex when update app settings (#329)
|
- Reduce using mutex when update app settings (#329)
|
||||||
|
|
||||||
|
## [0.30.9] - 2024-12-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Unable to remove EC object (#576)
|
||||||
|
|
||||||
## [0.30.8] - 2024-10-18
|
## [0.30.8] - 2024-10-18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -347,6 +364,9 @@ To see CHANGELOG for older versions, refer to https://github.com/nspcc-dev/neofs
|
||||||
[0.30.6]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.5...v0.30.6
|
[0.30.6]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.5...v0.30.6
|
||||||
[0.30.7]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.6...v0.30.7
|
[0.30.7]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.6...v0.30.7
|
||||||
[0.30.8]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.7...v0.30.8
|
[0.30.8]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.7...v0.30.8
|
||||||
[0.31.0]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.8...v0.31.0
|
[0.30.9]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.8...v0.30.9
|
||||||
|
[0.31.0]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.30.9...v0.31.0
|
||||||
[0.31.1]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.0...v0.31.1
|
[0.31.1]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.0...v0.31.1
|
||||||
[Unreleased]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.1...master
|
[0.31.2]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.1...v0.31.2
|
||||||
|
[0.31.3]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.2...v0.31.3
|
||||||
|
[Unreleased]: https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/compare/v0.31.3...master
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
v0.31.1
|
v0.31.3
|
||||||
|
|
|
@ -1822,6 +1822,10 @@ func TransformToS3Error(err error) error {
|
||||||
return GetAPIError(ErrGatewayTimeout)
|
return GetAPIError(ErrGatewayTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, frostfs.ErrGlobalDomainIsAlreadyTaken) {
|
||||||
|
return GetAPIError(ErrBucketAlreadyExists)
|
||||||
|
}
|
||||||
|
|
||||||
return GetAPIError(ErrInternalError)
|
return GetAPIError(ErrInternalError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,9 @@ var (
|
||||||
|
|
||||||
// ErrGatewayTimeout is returned from FrostFS in case of timeout, deadline exceeded etc.
|
// ErrGatewayTimeout is returned from FrostFS in case of timeout, deadline exceeded etc.
|
||||||
ErrGatewayTimeout = errors.New("gateway timeout")
|
ErrGatewayTimeout = errors.New("gateway timeout")
|
||||||
|
|
||||||
|
// ErrGlobalDomainIsAlreadyTaken is returned from FrostFS in case of global domain is already taken.
|
||||||
|
ErrGlobalDomainIsAlreadyTaken = errors.New("global domain is already taken")
|
||||||
)
|
)
|
||||||
|
|
||||||
// FrostFS represents virtual connection to FrostFS network.
|
// FrostFS represents virtual connection to FrostFS network.
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
|
||||||
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
||||||
|
v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
|
||||||
|
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
||||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
|
||||||
apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors"
|
apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/tree"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/tree"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
|
@ -122,6 +122,10 @@ func preparePathStyleAddress(reqInfo *ReqInfo, r *http.Request, reqLogger *zap.L
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDomain(host string, domains []string) (bktName string, match bool) {
|
func checkDomain(host string, domains []string) (bktName string, match bool) {
|
||||||
|
if pos := strings.Index(host, ":"); pos != -1 {
|
||||||
|
host = host[:pos]
|
||||||
|
}
|
||||||
|
|
||||||
partsHost := strings.Split(host, ".")
|
partsHost := strings.Split(host, ".")
|
||||||
for _, pattern := range domains {
|
for _, pattern := range domains {
|
||||||
partsPattern := strings.Split(pattern, ".")
|
partsPattern := strings.Split(pattern, ".")
|
||||||
|
|
|
@ -409,6 +409,13 @@ func TestCheckDomains(t *testing.T) {
|
||||||
requestURL: "bktA.bktB.s3.kapusta.domain.com",
|
requestURL: "bktA.bktB.s3.kapusta.domain.com",
|
||||||
expectedMatch: false,
|
expectedMatch: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "valid url with bktName and namespace (wildcard after protocol infix) with port",
|
||||||
|
domains: []string{"s3.<wildcard>.domain.com"},
|
||||||
|
requestURL: "bktA.s3.kapusta.domain.com:8884",
|
||||||
|
expectedBktName: "bktA",
|
||||||
|
expectedMatch: true,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
bktName, match := checkDomain(tc.requestURL, tc.domains)
|
bktName, match := checkDomain(tc.requestURL, tc.domains)
|
||||||
|
|
|
@ -7,10 +7,10 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
|
|
||||||
apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors"
|
apierr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/accessbox"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/accessbox"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
|
|
|
@ -24,13 +24,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
QueryVersionID = "versionId"
|
QueryVersionID = "versionId"
|
||||||
QueryPrefix = "prefix"
|
QueryPrefix = "prefix"
|
||||||
QueryDelimiter = "delimiter"
|
QueryDelimiter = "delimiter"
|
||||||
QueryMaxKeys = "max-keys"
|
QueryMaxKeys = "max-keys"
|
||||||
QueryMarker = "marker"
|
QueryMarker = "marker"
|
||||||
QueryEncodingType = "encoding-type"
|
QueryEncodingType = "encoding-type"
|
||||||
amzTagging = "x-amz-tagging"
|
QueryMaxBuckets = "max-buckets"
|
||||||
|
QueryContinuationToken = "continuation-token"
|
||||||
|
QueryBucketRegion = "bucket-region"
|
||||||
|
amzTagging = "x-amz-tagging"
|
||||||
|
|
||||||
unmatchedBucketOperation = "UnmatchedBucketOperation"
|
unmatchedBucketOperation = "UnmatchedBucketOperation"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ns"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ns"
|
||||||
|
|
|
@ -159,7 +159,7 @@ func NewRouter(cfg Config) *chi.Mux {
|
||||||
defaultRouter.Get("/", named(s3middleware.ListBucketsOperation, cfg.Handler.ListBucketsHandler))
|
defaultRouter.Get("/", named(s3middleware.ListBucketsOperation, cfg.Handler.ListBucketsHandler))
|
||||||
attachErrorHandler(defaultRouter)
|
attachErrorHandler(defaultRouter)
|
||||||
|
|
||||||
vhsRouter := bucketRouter(cfg.Handler)
|
vhsRouter := newDomainRouter(cfg.Handler)
|
||||||
router := newGlobalRouter(defaultRouter, vhsRouter)
|
router := newGlobalRouter(defaultRouter, vhsRouter)
|
||||||
|
|
||||||
api.Mount("/", router)
|
api.Mount("/", router)
|
||||||
|
@ -169,12 +169,43 @@ func NewRouter(cfg Config) *chi.Mux {
|
||||||
return api
|
return api
|
||||||
}
|
}
|
||||||
|
|
||||||
type globalRouter struct {
|
type domainRouter struct {
|
||||||
pathStyleRouter chi.Router
|
bucketRouter chi.Router
|
||||||
vhsRouter chi.Router
|
defaultRouter chi.Router
|
||||||
}
|
}
|
||||||
|
|
||||||
func newGlobalRouter(pathStyleRouter, vhsRouter chi.Router) *globalRouter {
|
func newDomainRouter(handler Handler) *domainRouter {
|
||||||
|
defaultRouter := chi.NewRouter()
|
||||||
|
defaultRouter.Group(func(r chi.Router) {
|
||||||
|
r.Method(http.MethodGet, "/", NewHandlerFilter().
|
||||||
|
Add(NewFilter().
|
||||||
|
AllowedQueries(s3middleware.QueryMaxBuckets, s3middleware.QueryPrefix,
|
||||||
|
s3middleware.QueryContinuationToken, s3middleware.QueryBucketRegion).
|
||||||
|
Handler(named(s3middleware.ListBucketsOperation, handler.ListBucketsHandler))).
|
||||||
|
DefaultHandler(notSupportedHandler()))
|
||||||
|
})
|
||||||
|
attachErrorHandler(defaultRouter)
|
||||||
|
|
||||||
|
return &domainRouter{
|
||||||
|
bucketRouter: bucketRouter(handler),
|
||||||
|
defaultRouter: defaultRouter,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *domainRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if reqInfo := s3middleware.GetReqInfo(r.Context()); reqInfo.BucketName != "" {
|
||||||
|
g.bucketRouter.ServeHTTP(w, r)
|
||||||
|
} else {
|
||||||
|
g.defaultRouter.ServeHTTP(w, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type globalRouter struct {
|
||||||
|
pathStyleRouter chi.Router
|
||||||
|
vhsRouter *domainRouter
|
||||||
|
}
|
||||||
|
|
||||||
|
func newGlobalRouter(pathStyleRouter chi.Router, vhsRouter *domainRouter) *globalRouter {
|
||||||
return &globalRouter{
|
return &globalRouter{
|
||||||
pathStyleRouter: pathStyleRouter,
|
pathStyleRouter: pathStyleRouter,
|
||||||
vhsRouter: vhsRouter,
|
vhsRouter: vhsRouter,
|
||||||
|
@ -182,12 +213,11 @@ func newGlobalRouter(pathStyleRouter, vhsRouter chi.Router) *globalRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *globalRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (g *globalRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
router := g.pathStyleRouter
|
|
||||||
if reqInfo := s3middleware.GetReqInfo(r.Context()); reqInfo.RequestVHSEnabled {
|
if reqInfo := s3middleware.GetReqInfo(r.Context()); reqInfo.RequestVHSEnabled {
|
||||||
router = g.vhsRouter
|
g.vhsRouter.ServeHTTP(w, r)
|
||||||
|
} else {
|
||||||
|
g.pathStyleRouter.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
router.ServeHTTP(w, r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func named(name string, handlerFunc http.HandlerFunc) http.HandlerFunc {
|
func named(name string, handlerFunc http.HandlerFunc) http.HandlerFunc {
|
||||||
|
@ -338,9 +368,6 @@ func bucketRouter(h Handler) chi.Router {
|
||||||
AllowedQueries(s3middleware.QueryDelimiter, s3middleware.QueryMaxKeys, s3middleware.QueryPrefix,
|
AllowedQueries(s3middleware.QueryDelimiter, s3middleware.QueryMaxKeys, s3middleware.QueryPrefix,
|
||||||
s3middleware.QueryMarker, s3middleware.QueryEncodingType).
|
s3middleware.QueryMarker, s3middleware.QueryEncodingType).
|
||||||
Handler(named(s3middleware.ListObjectsV1Operation, h.ListObjectsV1Handler))).
|
Handler(named(s3middleware.ListObjectsV1Operation, h.ListObjectsV1Handler))).
|
||||||
Add(NewFilter().
|
|
||||||
NoQueries().
|
|
||||||
Handler(listWrapper(h))).
|
|
||||||
DefaultHandler(notSupportedHandler()))
|
DefaultHandler(notSupportedHandler()))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -422,18 +449,6 @@ func bucketRouter(h Handler) chi.Router {
|
||||||
return bktRouter
|
return bktRouter
|
||||||
}
|
}
|
||||||
|
|
||||||
func listWrapper(h Handler) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
if reqInfo := s3middleware.GetReqInfo(r.Context()); reqInfo.BucketName == "" {
|
|
||||||
reqInfo.API = s3middleware.ListBucketsOperation
|
|
||||||
h.ListBucketsHandler(w, r)
|
|
||||||
} else {
|
|
||||||
reqInfo.API = s3middleware.ListObjectsV1Operation
|
|
||||||
h.ListObjectsV1Handler(w, r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func objectRouter(h Handler) chi.Router {
|
func objectRouter(h Handler) chi.Router {
|
||||||
objRouter := chi.NewRouter()
|
objRouter := chi.NewRouter()
|
||||||
|
|
||||||
|
|
|
@ -138,13 +138,14 @@ func (hf *HandlerFilters) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hf *HandlerFilters) match(r *http.Request) http.Handler {
|
func (hf *HandlerFilters) match(r *http.Request) http.Handler {
|
||||||
|
queries := r.URL.Query()
|
||||||
|
|
||||||
LOOP:
|
LOOP:
|
||||||
for _, filter := range hf.filters {
|
for _, filter := range hf.filters {
|
||||||
if filter.noQueries && len(r.URL.Query()) > 0 {
|
if filter.noQueries && len(queries) > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(filter.allowedQueries) > 0 {
|
if len(filter.allowedQueries) > 0 {
|
||||||
queries := r.URL.Query()
|
|
||||||
for key := range queries {
|
for key := range queries {
|
||||||
if _, ok := filter.allowedQueries[key]; !ok {
|
if _, ok := filter.allowedQueries[key]; !ok {
|
||||||
continue LOOP
|
continue LOOP
|
||||||
|
@ -158,8 +159,8 @@ LOOP:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, query := range filter.queries {
|
for _, query := range filter.queries {
|
||||||
queryVal := r.URL.Query().Get(query.Key)
|
queryVal := queries.Get(query.Key)
|
||||||
if !r.URL.Query().Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
if !queries.Has(query.Key) || query.Value != "" && query.Value != queryVal {
|
||||||
continue LOOP
|
continue LOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,6 +903,78 @@ func TestRouterListObjectsV2Domains(t *testing.T) {
|
||||||
require.Equal(t, s3middleware.ListObjectsV2Operation, resp.Method)
|
require.Equal(t, s3middleware.ListObjectsV2Operation, resp.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRouterListingVHS(t *testing.T) {
|
||||||
|
baseDomain := "domain.com"
|
||||||
|
baseDomainWithBkt := "bucket.domain.com"
|
||||||
|
chiRouter := prepareRouter(t, enableVHSDomains(baseDomain))
|
||||||
|
chiRouter.handler.buckets["bucket"] = &data.BucketInfo{}
|
||||||
|
|
||||||
|
for _, tc := range []struct {
|
||||||
|
name string
|
||||||
|
host string
|
||||||
|
queries string
|
||||||
|
expectedOperation string
|
||||||
|
notSupported bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "list-object-v1 without query params",
|
||||||
|
host: baseDomainWithBkt,
|
||||||
|
expectedOperation: s3middleware.ListObjectsV1Operation,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list-buckets without query params",
|
||||||
|
host: baseDomain,
|
||||||
|
expectedOperation: s3middleware.ListBucketsOperation,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list-objects-v1 with prefix param",
|
||||||
|
host: baseDomainWithBkt,
|
||||||
|
queries: func() string {
|
||||||
|
query := make(url.Values)
|
||||||
|
query.Set(s3middleware.QueryPrefix, "prefix")
|
||||||
|
return query.Encode()
|
||||||
|
}(),
|
||||||
|
expectedOperation: s3middleware.ListObjectsV1Operation,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "list-buckets with prefix param",
|
||||||
|
host: baseDomain,
|
||||||
|
queries: func() string {
|
||||||
|
query := make(url.Values)
|
||||||
|
query.Set(s3middleware.QueryPrefix, "prefix")
|
||||||
|
return query.Encode()
|
||||||
|
}(),
|
||||||
|
expectedOperation: s3middleware.ListBucketsOperation,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "not supported operation",
|
||||||
|
host: baseDomain,
|
||||||
|
queries: func() string {
|
||||||
|
query := make(url.Values)
|
||||||
|
query.Set("invalid", "invalid")
|
||||||
|
return query.Encode()
|
||||||
|
}(),
|
||||||
|
notSupported: true,
|
||||||
|
},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
r := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||||
|
r.URL.RawQuery = tc.queries
|
||||||
|
r.Host = tc.host
|
||||||
|
chiRouter.ServeHTTP(w, r)
|
||||||
|
|
||||||
|
if tc.notSupported {
|
||||||
|
assertAPIError(t, w, apierr.ErrNotSupported)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := readResponse(t, w)
|
||||||
|
require.Equal(t, tc.expectedOperation, resp.Method)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func enableVHSDomains(domains ...string) option {
|
func enableVHSDomains(domains ...string) option {
|
||||||
return func(cfg *Config) {
|
return func(cfg *Config) {
|
||||||
setting := cfg.MiddlewareSettings.(*middlewareSettingsMock)
|
setting := cfg.MiddlewareSettings.(*middlewareSettingsMock)
|
||||||
|
|
|
@ -11,8 +11,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
|
|
||||||
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/cache"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/cache"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/handler"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/handler"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
||||||
|
@ -20,6 +18,8 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/retryer"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/retryer"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/acl"
|
||||||
|
sessionv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
apisession "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
apisession "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
v2container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/commonclient"
|
"git.frostfs.info/TrueCloudLab/frostfs-contract/commonclient"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
||||||
grpctracing "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc"
|
grpctracing "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc"
|
||||||
|
@ -42,6 +41,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/wallet"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/wallet"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/metrics"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/metrics"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
||||||
|
v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
|
|
|
@ -1210,6 +1210,11 @@ func validateDomains(domains []string, log *zap.Logger) []string {
|
||||||
validDomains := make([]string, 0, len(domains))
|
validDomains := make([]string, 0, len(domains))
|
||||||
LOOP:
|
LOOP:
|
||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
|
if strings.Contains(domain, ":") {
|
||||||
|
log.Warn(logs.WarnDomainContainsPort, zap.String("domain", domain))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
domainParts := strings.Split(domain, ".")
|
domainParts := strings.Split(domain, ".")
|
||||||
for _, part := range domainParts {
|
for _, part := range domainParts {
|
||||||
if strings.ContainsAny(part, "<>") && part != wildcardPlaceholder {
|
if strings.ContainsAny(part, "<>") && part != wildcardPlaceholder {
|
||||||
|
|
|
@ -21,6 +21,8 @@ func TestValidateDomains(t *testing.T) {
|
||||||
"s3dev.fro<stfs.devenv",
|
"s3dev.fro<stfs.devenv",
|
||||||
"<wildcard>.dev.<wildcard>.frostfs.devenv",
|
"<wildcard>.dev.<wildcard>.frostfs.devenv",
|
||||||
"<wildcard>.dev.<wildc>ard>.frostfs.devenv",
|
"<wildcard>.dev.<wildc>ard>.frostfs.devenv",
|
||||||
|
"s3dev.frostfs.devenv:8888",
|
||||||
|
"<wildcard>.frostfs.devenv:443",
|
||||||
}
|
}
|
||||||
expectedDomains := []string{
|
expectedDomains := []string{
|
||||||
"s3dev.frostfs.devenv",
|
"s3dev.frostfs.devenv",
|
||||||
|
|
3
go.mod
3
go.mod
|
@ -3,10 +3,9 @@ module git.frostfs.info/TrueCloudLab/frostfs-s3-gw
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241212101224-902f32eeabcf
|
||||||
git.frostfs.info/TrueCloudLab/multinet v0.0.0-20241015075604-6cb0d80e0972
|
git.frostfs.info/TrueCloudLab/multinet v0.0.0-20241015075604-6cb0d80e0972
|
||||||
git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240822104152-a3bc3099bd5b
|
git.frostfs.info/TrueCloudLab/policy-engine v0.0.0-20240822104152-a3bc3099bd5b
|
||||||
git.frostfs.info/TrueCloudLab/zapjournald v0.0.0-20240124114243-cb2e66427d02
|
git.frostfs.info/TrueCloudLab/zapjournald v0.0.0-20240124114243-cb2e66427d02
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -36,16 +36,14 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1 h1:ivcdxQeQDnx4srF2ezoaeVlF0FAycSAztwfIUJnUI4s=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20241011114054-f0fc40e116d1/go.mod h1:F5GS7hRb62PUy5sTYDC4ajVdeffoAfjHSSHTKUJEaYU=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b h1:WZkY4KUr90WOxxqf+PtXYGINr9xXkh19Mz+wnmgg/Do=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b h1:WZkY4KUr90WOxxqf+PtXYGINr9xXkh19Mz+wnmgg/Do=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b/go.mod h1:5fSm/l5xSjGWqsPUffSdboiGFUHa7y/1S0fvxzQowN8=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.1-0.20241022094040-5f956751d48b/go.mod h1:5fSm/l5xSjGWqsPUffSdboiGFUHa7y/1S0fvxzQowN8=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88 h1:9bvBDLApbbO5sXBKdODpE9tzy3HV99nXxkDWNn22rdI=
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88 h1:9bvBDLApbbO5sXBKdODpE9tzy3HV99nXxkDWNn22rdI=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g=
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88/go.mod h1:kbwB4v2o6RyOfCo9kEFeUDZIX3LKhmS0yXPrtvzkQ1g=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3 h1:f7jan6eBDN88DKnKj8GKyWpfjBbSzjDALcDejYKRgCs=
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241212101224-902f32eeabcf h1:PqRKQX+Xlqq4qsAlr7Jcx2kapLdPGZZQ09MEW+ui2c4=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241022124111-5361f0ecebd3/go.mod h1:3txOjFJ8M/JFs01h7xOrnQHVn6hZgDNA16ivyUlu1iU=
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20241212101224-902f32eeabcf/go.mod h1:eoK7+KZQ9GJxbzIs6vTnoUJqFDppavInLRHaN4MYgZg=
|
||||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
||||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM=
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM=
|
||||||
git.frostfs.info/TrueCloudLab/multinet v0.0.0-20241015075604-6cb0d80e0972 h1:/960fWeyn2AFHwQUwDsWB3sbP6lTEnFnMzLMM6tx6N8=
|
git.frostfs.info/TrueCloudLab/multinet v0.0.0-20241015075604-6cb0d80e0972 h1:/960fWeyn2AFHwQUwDsWB3sbP6lTEnFnMzLMM6tx6N8=
|
||||||
|
|
|
@ -10,13 +10,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/authmate"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/authmate"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/crdt"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/crdt"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/logs"
|
||||||
|
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
|
|
|
@ -7,12 +7,12 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/authmate"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/authmate"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/accessbox"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/accessbox"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/creds/tokens"
|
||||||
|
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
|
|
|
@ -6,13 +6,14 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer/frostfs"
|
||||||
frosterr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/errors"
|
frosterr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/errors"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/util"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/util"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/ape"
|
||||||
|
objectv2 "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
|
@ -477,6 +478,10 @@ func handleObjectError(msg string, err error) error {
|
||||||
return fmt.Errorf("%s: %w: %s", msg, frostfs.ErrGatewayTimeout, err.Error())
|
return fmt.Errorf("%s: %w: %s", msg, frostfs.ErrGatewayTimeout, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(err.Error(), "global domain is already taken") {
|
||||||
|
return fmt.Errorf("%s: %w: %s", msg, frostfs.ErrGlobalDomainIsAlreadyTaken, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Errorf("%s: %w", msg, err)
|
return fmt.Errorf("%s: %w", msg, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,21 +10,21 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
|
||||||
frosterr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/errors"
|
frosterr "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/internal/frostfs/errors"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/tree"
|
||||||
|
apitree "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/tree"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer"
|
||||||
treepool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree"
|
treepool "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree"
|
||||||
grpcservice "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool/tree/service"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetNodeByPathResponseInfoWrapper struct {
|
type GetNodeByPathResponseInfoWrapper struct {
|
||||||
response *grpcservice.GetNodeByPathResponse_Info
|
response *apitree.GetNodeByPathResponseInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetNodeByPathResponseInfoWrapper) GetNodeID() []uint64 {
|
func (n GetNodeByPathResponseInfoWrapper) GetNodeID() []uint64 {
|
||||||
return []uint64{n.response.GetNodeId()}
|
return []uint64{n.response.GetNodeID()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetNodeByPathResponseInfoWrapper) GetParentID() []uint64 {
|
func (n GetNodeByPathResponseInfoWrapper) GetParentID() []uint64 {
|
||||||
return []uint64{n.response.GetParentId()}
|
return []uint64{n.response.GetParentID()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetNodeByPathResponseInfoWrapper) GetTimestamp() []uint64 {
|
func (n GetNodeByPathResponseInfoWrapper) GetTimestamp() []uint64 {
|
||||||
|
@ -32,23 +32,23 @@ func (n GetNodeByPathResponseInfoWrapper) GetTimestamp() []uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetNodeByPathResponseInfoWrapper) GetMeta() []tree.Meta {
|
func (n GetNodeByPathResponseInfoWrapper) GetMeta() []tree.Meta {
|
||||||
res := make([]tree.Meta, len(n.response.Meta))
|
res := make([]tree.Meta, len(n.response.GetMeta()))
|
||||||
for i, value := range n.response.Meta {
|
for i, value := range n.response.GetMeta() {
|
||||||
res[i] = value
|
res[i] = value
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetSubTreeResponseBodyWrapper struct {
|
type GetSubTreeResponseBodyWrapper struct {
|
||||||
response *grpcservice.GetSubTreeResponse_Body
|
response *apitree.GetSubTreeResponseBody
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetSubTreeResponseBodyWrapper) GetNodeID() []uint64 {
|
func (n GetSubTreeResponseBodyWrapper) GetNodeID() []uint64 {
|
||||||
return n.response.GetNodeId()
|
return n.response.GetNodeID()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetSubTreeResponseBodyWrapper) GetParentID() []uint64 {
|
func (n GetSubTreeResponseBodyWrapper) GetParentID() []uint64 {
|
||||||
resp := n.response.GetParentId()
|
resp := n.response.GetParentID()
|
||||||
if resp == nil {
|
if resp == nil {
|
||||||
// storage sends nil that should be interpreted as []uint64{0}
|
// storage sends nil that should be interpreted as []uint64{0}
|
||||||
// due to protobuf compatibility, see 'GetSubTree' function
|
// due to protobuf compatibility, see 'GetSubTree' function
|
||||||
|
@ -62,8 +62,8 @@ func (n GetSubTreeResponseBodyWrapper) GetTimestamp() []uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n GetSubTreeResponseBodyWrapper) GetMeta() []tree.Meta {
|
func (n GetSubTreeResponseBodyWrapper) GetMeta() []tree.Meta {
|
||||||
res := make([]tree.Meta, len(n.response.Meta))
|
res := make([]tree.Meta, len(n.response.GetMeta()))
|
||||||
for i, value := range n.response.Meta {
|
for i, value := range n.response.GetMeta() {
|
||||||
res[i] = value
|
res[i] = value
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
@ -144,7 +144,7 @@ func (w *PoolWrapper) GetSubTree(ctx context.Context, bktInfo *data.BucketInfo,
|
||||||
|
|
||||||
type SubTreeStreamImpl struct {
|
type SubTreeStreamImpl struct {
|
||||||
r *treepool.SubTreeReader
|
r *treepool.SubTreeReader
|
||||||
buffer []*grpcservice.GetSubTreeResponse_Body
|
buffer []*apitree.GetSubTreeResponseBody
|
||||||
eof bool
|
eof bool
|
||||||
index int
|
index int
|
||||||
ln int
|
ln int
|
||||||
|
@ -204,7 +204,7 @@ func (w *PoolWrapper) GetSubTreeStream(ctx context.Context, bktInfo *data.Bucket
|
||||||
|
|
||||||
return &SubTreeStreamImpl{
|
return &SubTreeStreamImpl{
|
||||||
r: subTreeReader,
|
r: subTreeReader,
|
||||||
buffer: make([]*grpcservice.GetSubTreeResponse_Body, bufSize),
|
buffer: make([]*apitree.GetSubTreeResponseBody, bufSize),
|
||||||
index: -1,
|
index: -1,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,4 +178,5 @@ const (
|
||||||
MultinetDialSuccess = "multinet dial successful"
|
MultinetDialSuccess = "multinet dial successful"
|
||||||
MultinetDialFail = "multinet dial failed"
|
MultinetDialFail = "multinet dial failed"
|
||||||
FailedToParseHTTPTime = "failed to parse http time, header is ignored"
|
FailedToParseHTTPTime = "failed to parse http time, header is ignored"
|
||||||
|
WarnDomainContainsPort = "the domain contains a port, domain skipped"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue