Files
floci/src/main/java/io/github/hectorvent
Chiara Forresi 96d16de998 feat(s3): add Intelligent-Tiering configuration CRUD (#2997)
* feat(s3): add Intelligent-Tiering configuration CRUD

Add AWS S3 Intelligent-Tiering configuration management through the
real REST XML subresource (?intelligent-tiering), mirroring the existing
metrics configuration pattern.

Operations:
- PutBucketIntelligentTieringConfiguration (PUT, 204)
- GetBucketIntelligentTieringConfiguration (GET by id)
- ListBucketIntelligentTieringConfigurations (GET without id)
- DeleteBucketIntelligentTieringConfiguration (DELETE, 204)

The parser validates Id, Status (Enabled/Disabled), optional Filter
(Prefix/Tag/And), and one or more Tiering entries (AccessTier + positive
Days), re-serializing through XmlBuilder/XmlParser/AwsNamespaces.S3 so
responses are built by floci rather than echoing the request body.
Malformed bodies return MalformedXML; missing configurations return
NoSuchConfiguration.

Configurations are stored on the Bucket model keyed by id (nullable map
for backward-compatible deserialization of older snapshots), persisted
through StorageFactory, and synchronized on the bucket monitor with the
same requireSameRecord guard as metrics to survive concurrent puts and
bucket delete/recreate races.

Tests:
- S3IntelligentTieringConfigurationTest: parser unit tests
- S3ServiceTest: service lifecycle, isolation, persistence, concurrency
- S3IntelligentTieringConfigurationIntegrationTest: REST integration
- compatibility-tests/sdk-test-awscli: AWS CLI bats coverage

* refactor(s3): rename METRICS_XML_DECLARATION to S3_XML_DECLARATION

The XML declaration constant is shared by both metrics and
intelligent-tiering configuration responses, so the name should reflect
its S3-wide scope rather than implying it is metrics-specific.

* fix(s3): enforce auth and validate Days overflow on intelligent-tiering

Address review feedback on PR #2997:

- PUT and DELETE ?intelligent-tiering now enforce S3 authorization via
  a new authorizeBucketWrite method, closing the bypass where mutations
  skipped the auth applied to reads.
- Days values above Integer.MAX_VALUE no longer throw NumberFormatException
  and return 500 InternalError; they are rejected as 400 MalformedXML.
- A PUT without a request body returns 400 MalformedXML instead of NPE/500.

Tests: unit coverage for Days overflow, integration coverage for empty body.

* fix(s3): enforce tier-specific Days range on intelligent-tiering

AWS enforces a tier-specific Days range for S3 Intelligent-Tiering:
- ARCHIVE_ACCESS: 90 to 730 days
- DEEP_ARCHIVE_ACCESS: 180 to 730 days

Out-of-range values now return InvalidArgument with ArgumentName and
ArgumentValue in the XML error body, matching the real S3 error shape.

Add unit and integration tests covering below-minimum, above-maximum,
boundary acceptance, and the full XML error response.

* refactor(s3): extract Days range constants in intelligent-tiering

Replace repeated magic numbers (90, 180, 730) with named constants
ARCHIVE_ACCESS_MIN_DAYS, DEEP_ARCHIVE_ACCESS_MIN_DAYS, and MAX_DAYS.
Pass min into daysOutOfRange instead of recomputing it, and use an
import for LinkedHashMap.
2026-09-04 09:06:15 -04:00
..