mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
* 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.
sdk-test-awscli
Compatibility tests for Floci using the AWS CLI v2 (2.22.35).
Tests are plain bash scripts that call aws CLI commands with --endpoint-url pointed at the emulator.
Services Covered
| Group | Description |
|---|---|
ssm |
Parameter Store — put, get, path, tags |
sqs |
Queues, send/receive/delete, attributes |
sns |
Topics, publish, attributes |
s3 |
Buckets, objects, tagging, copy, delete |
dynamodb |
Tables, put/get/update/query/delete items |
iam |
Users, roles, create/get/delete |
sts |
GetCallerIdentity |
ses |
Identities, sending, quotas, notification attributes |
secretsmanager |
Create/get/put/list/tag/delete secrets |
kms |
Keys, aliases, encrypt/decrypt |
cognito |
User pools, clients |
s3-notifications |
S3 → SQS event notifications |
Requirements
- AWS CLI v2
- bash
- jq
- bats-core (installed via
just setup-awscli)
Running
# All groups (from compatibility-tests/)
just test-awscli
# Run bats directly
./lib/run-bats-with-junit.sh sdk-test-awscli/test/ sdk-test-awscli/test-results/junit.xml
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_ENDPOINT |
http://localhost:4566 |
Floci emulator endpoint |
AWS credentials are always test / test / us-east-1.
Docker
docker build -t floci-sdk-awscli .
docker run --rm --network host floci-sdk-awscli
# Custom endpoint (macOS/Windows)
docker run --rm -e FLOCI_ENDPOINT=http://host.docker.internal:4566 floci-sdk-awscli