* fix(cloudformation): relocate SAM schemes without auth defaults
Follow the separate postprocessing request in upstream #6638. Relocate declared OpenAPI security schemes independently of Auth defaults, preserving Swagger and operation requirements.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(sam): centralize OpenAPI security scheme relocation
Keep the defaults helper responsible only for generating AWS_IAM and api_key definitions. Relocate the security scheme map exclusively in the shared final OpenAPI phase, including documents without Auth defaults.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(bedrock): list guardrails in the tagging api and route its writes
guardrails were not a ResourceProvider, so GetResources with bedrock:guardrail came back empty, and TagResources had no bedrock handler to forward to. list the draft of each guardrail with its own tags and add a tagging-api-only handler that calls the existing tag methods.
* test(bedrock): cover guardrail discovery and tagging writes with the sdk
* fix(redshift): stay queued for backend ownership until the deadline
runWithBackendOwned waited for the fair backend lock 200 ms at a time,
the length of the pump's idle read. A wait that ran out while a read
was in progress left the queue, and the pump takes the lock back as
soon as it releases it, so the request could miss every handoff until
the 2 s deadline.
Every Simple Query waits for ownership while the Spectrum interceptor
inspects it. When the handoffs were missed, the query stalled for the
full 2 s, and one over an external table then failed. External-table
preparation on Parse and Bind failed with "Unable to prepare external
query", a Simple Query S3 COPY or UNLOAD went to PostgreSQL
unintercepted and failed there, and closing an abandoned Spectrum
cursor kept its temp table until the session ended.
The wait now spans the rest of the deadline in one attempt, as the
Extended Query Execute paths already do, so the request keeps its
place and takes the lock at the pump's next release. The idle check,
the mid-frame backoff and the deadline itself are unchanged.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(redshift): drop the unreachable retry after a timed-out lock wait
runWithBackendOwned now waits for the backend lock once, for the rest
of the deadline. A timed tryLock returns false only after that whole
budget has elapsed, so the deadline check that followed always held
and its continue could not run. Return false straight away, with the
same warning; behaviour is unchanged.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(redshift): hand the backend lock to the bridge through a constructor
RedshiftBackendOwnershipTest replaced the bridge's private final
backendLock by reflection, which later JDKs warn about. The public
constructors now pass a new fair lock to a private constructor, and a
package-private one for tests takes the lock with no services, so the
test builds its bridge directly. Production bridges get the same fair
lock as before.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(redshift): run the ownership control test on a short budget
The control case in RedshiftBackendOwnershipTest, where the pump never
releases the lock, sat out the real 2 s ownership deadline on every
run. The test constructor now also takes the runWithBackendOwned
budget: the control case uses 100 ms, and the handoff case keeps the
production 2 s. Production bridges still get PUMP_PARK_WAIT_MS, now
package-private so the test can name it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(iot): deliver data-plane publishes to MQTT subscribers
A message sent with the IoT Data Publish API stored its retained copy
and ran the topic rules, but never reached a connected MQTT client. The
data-plane publish now goes through the broker fan-out after the rules,
as an MQTT publish does.
The fan-out delivers at the lower of the message and subscription QoS,
with RETAIN 0, and a retained message sent on subscribe carries RETAIN 1
at the lower of its stored and the subscription QoS, as measured on AWS
IoT Core. Publish refuses a qos other than 0 or 1 with AWS's
InvalidRequestException messages.
Closesfloci-io/floci#6627
* fix(iot): allocate packet identifiers for broker publishes
Vert.x draws the packet identifier of an outbound publish from an
unsynchronized per-endpoint counter. With QoS 1 delivery, two threads
fanning out to one client could send two unacknowledged copies under the
same identifier. The broker now allocates them from one atomic counter.
A retained message stored with a negative qos, which Publish accepted
before it validated qos, is sent on subscribe at QoS 0 instead of
aborting the replay.
* fix(iot): keep MQTT packet identifiers per session
One broker-wide counter let copies sent to other clients, QoS 0 included,
wrap a client's identifiers while its QoS 1 copy was unacknowledged. Each
session now draws QoS 1 identifiers from its own counter, and a QoS 0
copy carries none.
* test(iot): share the IoT Data client builder
Both IoT Data integration tests now build their IotDataPlaneClient
through IotDataRequests.iotDataClient(accessKey), as review asked. The
IoT limitations also list that a QoS 1 copy is never retried and has no
in-flight limit, where AWS holds further copies at 100 unacknowledged.
* test(iot): drive the packet identifier isolation test at QoS 1
QoS 0 copies carry no packet identifier, so the other client's 65,534
copies must be QoS 1 for the test to catch a counter shared by every
client. The IoT limitations also say that a data-plane Publish reaches
subscribers in every account and region, as the broker has none.
* feat(redshift): execute automated snapshot schedules
* fix(redshift): address automated snapshot review findings
Flush snapshot metadata before deleting an expired dump, pause the
snapshot scheduler across emulator reset, run retention even when the
next dump fails, and remove checkpoints of deleted clusters.
* fix(redshift): retake an automated snapshot whose metadata was lost
The checkpoint is a separate store, so it can persist while the snapshot
metadata never reached disk. Skip a completed occurrence only when its
snapshot still exists.
* test(redshift): restore the automated snapshot on the shared interceptor cluster
Run the Docker restore scenario in RedshiftInterceptorIntegrationTest
against the cluster it already starts, so only the restore pays for a
container, and drop the hand-rolled Docker probe.
* fix(ec2): keep key pair names unique under concurrent requests
CreateKeyPair and ImportKeyPair checked that a name was free and stored
the new key pair as two separate steps, so two requests for one name at
the same moment could both pass the check and both store a key pair.
Both got a key pair back, DescribeKeyPairs listed the name twice, and
RunInstances injected whichever record it found first, so the other
caller's private key did not open the instance. CreateKeyPair generates
its key between the two steps, which keeps that window open for as long
as key generation takes.
Both actions now store through one method that checks the name again
and writes under the EC2 service's striped lock for the region and
name, so the second request is refused with InvalidKeyPair.Duplicate
and the same message as before. The first check stays where it was, so
a single request is answered as before, and a taken name is still
refused before a key is generated for it.
Follow-up to the review of #6112.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(ec2): keep a tag write from restoring a deleted key pair
A CreateTags on a key pair reads the record and writes it back with its
new tags while holding the key pair's lock, but DeleteKeyPair deleted
without that lock. A delete landing between the read and the write was
undone: the key pair came back, and if a CreateKeyPair had taken the
freed name in between, the name then had two key pairs.
DeleteKeyPair now deletes each matching key pair under the lock tag
writes take on it, as DeleteEgressOnlyInternetGateway does, so a tag
write either finishes before the delete or finds the key pair gone.
The EC2 docs now say what CreateKeyPair and ImportKeyPair do with a
taken name rather than promising one key pair per name outright.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(ec2): pin where the key pair race tests wait, and clean up the SDK test
The race tests now let the held write go early only when the waiting
request is blocked in storeNewKeyPair or deleteKeyPair on a monitor the
held request owns, and otherwise wait for that request to finish, so a
change that made it wait anywhere else fails the test instead of
quietly skipping the check under the lock.
The SDK test waits up to 60 s for its requests to finish before it
deletes the name, so a slow request is not left to store a key pair
after the cleanup, and it checks the refused requests' error code and
status but not their message, which AWS words differently from Floci.
The storeNewKeyPair Javadoc also says that the store's own locks, taken
inside the name lock, never lead back to an EC2 lock.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(ec2): name what the key pair race tests wait for
A race test whose request comes to wait anywhere other than the named
Ec2Service method now fails with a timeout that says what it waited
for, and the helper says why the method is named. The DeleteKeyPair
comment says that scan returns a new list rather than copies, and the
SDK test's cleanup comment says it waits up to 60 s.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(ec2): say what pinning the waiting method guards against
The race tests' helper Javadoc no longer says that a wait elsewhere
always skips the code under the lock: such a wait may not be at the
lock under test, so the tests time out rather than pass without
exercising it, and moving that lock into another method means updating
the name the tests give.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(ec2): park the key pair race tests' writes with ParkingStore
Both race tests held a write on a latch in an anonymous store of their
own. They now wrap the shared testing ParkingStore in
AccountAwareStorageBackend, as the Config tagging tests do, and arm its
next write: before the first request in the name race test, and after
the key pair is created in the delete test, so the write it parks is
the tag write's. The name race test creates ED25519 keys so that key
generation stays well inside ParkingStore's two-second wait. Main code
is unchanged.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* feat(dynamodb): read PartiQL's FROM-first form of UPDATE
DynamoDB accepts FROM "T" WHERE key SET ... REMOVE ..., the clauses in
PartiQL's order, and runs it as the same update as UPDATE "T" SET ...
WHERE key, under the same dynamodb:PartiQLUpdate action. Without a SET
or REMOVE the statement is not well formed, and a WHERE after them is a
token left over. Floci refused the form as not well formed.
* fix(dynamodb): refuse an UPDATE whose SET or REMOVE does not follow the table
DynamoDB answers UPDATE "T" WHERE pk = 'x' and UPDATE "T" WHERE pk = 'x'
SET c = 1 with "Statement wasn't well formed, can't be processed:
Expected data manipulation", the same as the FROM-first form with no SET
or REMOVE. The shared clause parser now makes that check for both forms.
Follow the separate whole-map replacement requested in upstream #6632. Preserve Swagger, no-default behavior, operation requirements and unrelated OpenAPI components.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* feat(rds): DescribeCertificates, ModifyCertificates and an instance's CA certificate
DescribeCertificates lists the Region's RDS certificate authorities with the
thumbprint and validity AWS reports, vendored from the certificate bundles AWS
publishes by tools/aws/regen_rds_ca_certificates.py, and pages them.
ModifyCertificates sets or removes the account's default for new instances.
CreateDBInstance, ModifyDBInstance, the two instance restores and
CreateDBInstanceReadReplica take CACertificateIdentifier, and instances report
it with CertificateDetails. AWS::RDS::DBInstance takes the property and
resolves the two CertificateDetails attributes. The identifier is metadata:
the auth proxy keeps presenting Floci's own CA.
Closes#5806
* fix(rds): follow the user guide on CAs and leave a blank CA alone
- An instance stored without a CA reports rds-ca-rsa2048-g1, since an
override applies only to instances created after it.
- ap-south-1, ap-southeast-4, ca-west-1, eu-central-2, eu-south-2 and
il-central-1 offer only rds-ca-rsa2048-g1, as the user guide says.
- A blank CACertificateIdentifier on modify leaves the instance's CA.
- --download skips a Region only on 403 or 404 and exits 1 on other
failures.
- Reuse regionFromArn, add a createDbInstance stub helper and import
Executable in the tests.
* feat(lambdamicrovms): version network connectors as AWS does
* fix(lambda): lock connector versions and refresh them after a CFN rollback
Updates, deletes and version reads hold one lock, so two updates cannot
take the same version number.
A CloudFormation rollback restores the connector through an update. On
AWS that makes the next version, and a later Fn::GetAtt returns it. The
resource now keeps that version in LatestVersion and LatestVersionArn.
Read the connector ARN through AwsArnUtils.parse.
AWS refuses LatestVersion, an integer, as a string Output, so the stack
test reads LatestVersionArn only.
* fix(lambda): type the connector LatestVersion attribute as an integer
AWS::Lambda::NetworkConnector declares LatestVersion as an integer. On AWS
a stack whose string Output reads it fails with "Template format error:
Every Value member must be a string.", and Fn::Sub refuses it with
"variable Connector.LatestVersion in Fn::Sub expression does not resolve
to a string".
* chore(lambda): share the connector version ARN and integer attribute helpers
AssociateAccessPolicy, ListAssociatedAccessPolicies and
DisassociateAccessPolicy had no route, so their requests fell through to
S3's path-style catch-all and came back as an S3 XML error. Terraform's
aws_eks_access_policy_association could not be created.
The three operations follow access entries: they are management
metadata, stored and returned but not enforced in Kubernetes. Each
association is kept on its access entry, so deleting the entry or the
cluster removes it, and entries persisted before this change load with
no policies. ListAccessEntries now honours associatedPolicyArn.
Validation follows the EKS user guide: only STANDARD entries take access
policies, the scope is cluster (no namespaces) or namespace (one or more
names, wildcards kept, a repeated name stored once), and associating a
policy again replaces its scope and keeps its associatedAt. policyArn
must be an EKS cluster access policy ARN in the cluster's partition; the
name is not checked against AWS's list. Listing pages from 1 to 100,
with tokens bound to the entry they came from. Disassociating a policy
the entry does not hold succeeds, since EKS documents no error for it;
a missing entry is still ResourceNotFoundException, and an ARN that
associate would refuse is InvalidParameterException. ListAccessEntries
now pages through the shared Pagination helper too, so a token issued
before this change is refused.
Under IAM enforcement the list and disassociate routes were checked as
DescribeAccessEntry and DeleteAccessEntry, and all three against a
principal ending in /access-policies, so a grant scoped to the entry
never matched. They are now checked as their own actions, against the
entry's ARN.
A DELETE is a disassociate only when a cluster access policy ARN
follows access-policies, in the route, the IAM rule and the resource,
so an entry whose IAM path holds an access-policies segment can still
be deleted. The router matches the encoded path, so a principal sent
URL-encoded, as the SDKs send it, is never split.
Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
* fix(cloudwatch): accept the CloudWatchVersion20130116 JSON target
The CloudWatch console's API sends JSON 1.0 requests to the monitoring
endpoint with X-Amz-Target CloudWatchVersion20130116.<Operation>, signed
for the monitoring service. Floci knew only the GraniteServiceVersion20100801
prefix the SDKs send, so every such request got HTTP 404
UnknownOperationException.
Register the prefix on the monitoring descriptor as a JSON-only target,
the mechanism the DynamoDB_20111205 prefix already uses. A request naming
it now reaches the CloudWatch JSON handler and the same metrics and alarms,
after the same signature validation, unsigned-call refusal and
cloudwatch:<Operation> IAM check as the current prefix. CBOR and Smithy
RPC v2 requests that name it stay unknown, as do other CloudWatchVersion
dates.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): serve only shared operations on the console JSON target
The CloudWatch console's API names its operations with the
CloudWatchVersion20130116 target, and several of them take shapes the
current API does not: its GetMetricData takes Defaults and Metrics
instead of MetricDataQueries, and its PutMetricAlarm and DescribeAlarms
describe metric queries with Alias, Namespace and MetricName items
instead of Id and MetricStat. The CloudWatch JSON handler ignores members
it does not know, so through that target a console GetMetricData answered
HTTP 200 with no results, and a console PutMetricAlarm stored an alarm
without its metric.
Route the target through a handleLegacy entry, as DynamoDB_20111205 is
routed, and serve there only the operations whose shapes the two APIs
share: ListMetrics, DescribeAlarms, GetMetricStatistics and DeleteAlarms.
Every other operation, and a request that sets a member only the
console's API defines (CountOnlyRequest, SegmentId, TotalSegments,
ExcludeAutoscalingAlarms, ExcludeManagedAlarms), gets HTTP 400
UnsupportedOperation, the error Floci gives an operation it does not
implement.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): refuse unshared members and math alarms on the console target
Two gaps were left on the CloudWatchVersion20130116 target. Its
DescribeAlarms listed a metric math alarm's Metrics as the current API's
Id and MetricStat items, which the console's API does not define, so a
client parsing the answer with that API's model sees metrics with no
namespace, name or statistic. And only the five console-only members
known today were refused, so a member the console's API adds later would
again be ignored.
Refuse a DescribeAlarms answer that would list a metric math alarm, and
check request members against the ones the current API defines for each
served operation, as botocore's cloudwatch 2010-08-01 model lists them,
instead of against a list of console-only names. A null or false value
still counts as unset.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudwatch): serve only honoured members on the console target
The console target accepted every request member botocore's model
defines for its four operations, but the CloudWatch JSON handler ignores
several of them: StateValue, AlarmTypes, ActionPrefix, ChildrenOfAlarmName
and ParentsOfAlarmName on DescribeAlarms, ExtendedStatistics on
GetMetricStatistics, and RecentlyActive, OwningAccount and
IncludeLinkedAccounts on ListMetrics. A request using one got HTTP 200 as
if the member were unset. A null member also reached the handler, which
read it as the string "null".
Accept on the console target only the members the handler honours, plus
NextToken and MaxRecords, which change nothing because every result comes
back at once. Refuse any other member that is set with HTTP 400
UnsupportedOperation, and drop null members before handling. The four
operations are served under these member checks and the DescribeAlarms
check, which now names an alarm defined with Metrics rather than a metric
math alarm, since it also covers a single metric query.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudwatch): cover presigned console-target calls and align naming
Call the CloudWatchVersion20130116 target the console target in the
tests, as the docs and comments do, and say why handleLegacy keeps the
name of DynamoDB's JSON-only entry point. Cover presigned requests on
both prefixes, and keep the DescribeAlarms rows within what AWS accepts
by sending AlarmNames and AlarmNamePrefix apart. State in the docs that
only the bare prefix over application/x-amz-json-1.0 is accepted, and in
the comments that only top-level null members count as unset.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudwatch): pin the console target's other wire forms as unknown
The docs say only the bare CloudWatchVersion20130116 prefix over
application/x-amz-json-1.0 reaches CloudWatch. Pin that: the bare
prefix over application/json or JSON 1.1, and the fully qualified
com.amazonaws.cloudwatch.v2013_01_16 form, answer HTTP 404
UnknownOperationException. Name the presigned test for what it checks,
a wrong secret, and wrap the new comments at 100 columns.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(cloudwatch): share the signed IAM user setup between signature tests
CloudWatchJsonTargetSignatureIntegrationTest and
CloudWatchQueryGetSignatureIntegrationTest each carried their own copy
of a helper that signs IAM Query calls with the root test key, and of the
setup that creates a user with an access key and an inline policy and
then removes them. Move both into SignedIamUsers under the testing
package and call it from the two classes. It uses real SigV4 signatures,
which the classes need because signature validation is on;
EnforcementFixtures' placeholder signatures would be refused.
The returned user is AutoCloseable, so each test holds it in a
try-with-resources block; if creating the key or the policy fails, the
parts already made are removed. Test behaviour is unchanged: both classes
run the same 13 tests and pass before and after.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(dynamodb): lift the PartiQL overlap refusal when a branch tests a key outside a range
DynamoDB refuses a SELECT whose OR branches overlap on the sort key, but
not once a branch tests a key in a way no key condition can hold, such as
sk <> 'a', attribute_exists(sk) or NOT sk = 'a'. Every branch then runs
and the statement returns the union, each item once. A NOT lifts the
refusal only when it sits right on the test, and a NOT over size() never
does. Floci refused all of these as overlapping.
* chore(dynamodb): walk PartiQL condition leaves through one helper
The key plan had two walks over And, Or and Not that differed only in
the test on each leaf.
CreateNodegroup on a cluster whose node runs a different instance type
replaces the k3s node while holding the cluster's capacity lock.
DeleteCluster did not take that lock. A delete during the swap found no
container to stop, so the replacement node kept running, and the swap
then wrote the deleted cluster back to storage, stuck in DELETING.
DeleteCluster now takes the capacity lock before it reads the cluster
and marks it DELETING, so it waits for the swap and then stops the node
the swap started. A second delete that waited behind the first finds the
cluster gone and answers ResourceNotFoundException. The lock is taken
before the clustersBeingDeleted monitor, the order the swap already uses.
Co-authored-by: Robin Baeckman <27041454+RobinBaeckman@users.noreply.github.com>
* fix(cloudformation): pass IntegrationMethod and RequestParameters for AWS::ApiGatewayV2::Integration
AWS::ApiGatewayV2::Integration dropped IntegrationMethod and RequestParameters on create
and update, so GetIntegration returned null for both. Also pass RequestTemplates,
TemplateSelectionExpression and TimeoutInMillis, which the integration model already stores,
and count them as changes when deciding whether a connection rollback is complete.
Closes#6135
* fix(cloudformation): replace ApiGatewayV2 integration fields on stack update
UpdateIntegration keeps a field the request leaves out, so removing IntegrationMethod,
TemplateSelectionExpression, TimeoutInMillis, RequestParameters or RequestTemplates from a
template left the old value stored and still reaching the backend. Set them as the template says,
null included, the way replaceIntegrationConnection does, and restore them on a stack rollback.
A selected AWS::NoValue, as a mapping entry or as a whole property, now leaves the entry or the
field out instead of storing an empty string or failing the TimeoutInMillis parse.
* test(cloudformation): share ApiGatewayV2 stack test helpers
* fix(cloudformation): provision a usage plan's throttle, quota and stage throttles
* fix(cloudformation): roll back a usage plan when its stack update fails
* fix(cloudformation): keep a failed usage plan update for its rollback retry
* fix(cloudformation): snapshot a usage plan under its patch lock
* fix(cloudformation): restore a usage plan without a lock-free comparison
* refactor(cloudformation): share the API key and usage plan update rollback through CfnRollback
Preserve standalone ENI validation before address allocation and the existing ECS network error translation. Keep RunInstances and cross-VPC errors unchanged.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* perf(core): keep long polls off the shared request workers
SQS ReceiveMessage and Step Functions GetActivityTask hold their request
for up to 20 and 60 seconds while they wait for work, and Step Functions
StartSyncExecution holds it until its express execution ends. The AWS
JSON 1.0, CBOR and Query entry points ran them on the shared Quarkus
worker pool (by default the larger of 200 threads and eight per CPU), so
once that many polls were waiting, every other blocking request queued
behind them, /health included. On a JVM build limited to two CPUs, 220
idle ReceiveMessage polls kept DynamoDB, SQS, EC2, SSM, S3 and health
requests waiting about 17 seconds, until the first polls returned.
Run those entry points on virtual threads. Quarkus REST builds the same
handler chain for a @RunOnVirtualThread method as for any blocking one,
request filters and request scope included; only the executor that runs
it changes. Routing, signature and IAM checks, the account and Region a
request runs in, and the responses stay as they were.
The regression test shrinks the pool to four workers and holds four
ReceiveMessage polls, one per account and Region, on each of the five
entry points SQS is served through. While they wait, ListQueues in each
account and Region must list only that scope's queue, and an invalid
receive, EC2 DescribeRegions, SSM DescribeParameters and /health must be
answered. Each poll must still return the message later sent to it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* perf(lambda): keep Invoke and function URL calls off the shared workers
A RequestResponse Invoke and every function URL request wait for the
function to finish, up to its timeout. Both ran on the shared Quarkus
worker pool, so as many slow invocations as the pool has threads left
every other blocking request, /health included, queued until one of
them returned.
Run the Invoke entry point and the five function URL methods on virtual
threads, as the AWS JSON 1.0, CBOR and Query entry points now do. The
request filters, the account and Region the invocation runs in, and the
responses are unchanged. Lambda calls that other services make, such as
API Gateway integrations, ALB targets and AppSync resolvers, still wait
on a worker.
The regression test shrinks the pool to four workers and holds four
invocations, one per account and Region, at the LambdaService boundary,
for Invoke and for each function URL method. While they wait, /health
and SSM DescribeParameters, which still use the worker pool, and
DynamoDB ListTables and EC2 DescribeRegions must be answered, and each
invocation must then return its own function's result.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(core): bound the wait for virtual threads at shutdown to 10 seconds
Quarkus interrupts worker threads still running 10 seconds into its
final shutdown tasks, but by default waits up to a minute for virtual
threads. With every AWS JSON 1.0, CBOR, Query, Invoke and function URL
request now on a virtual thread, a SIGTERM with long polls parked kept
the process alive until they ended: 16 seconds for 20 second
ReceiveMessage polls and 56 seconds for GetActivityTask polls, against
10 seconds before.
Set quarkus.virtual-threads.shutdown-timeout to 10s, the interval
Quarkus uses for worker threads. With 50 parked ReceiveMessage or
GetActivityTask polls the process now stops in 10.2 seconds, as on
main. The key is fixed at build time, so it lives in application.yml.
Storage is still flushed and the HTTP server closed before this wait,
and dev mode, which stops virtual threads at once, is unaffected.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test: share the held-worker probes and send them together
AwsProtocolLongPollIntegrationTest and
LambdaSynchronousInvokeDispatchIntegrationTest each held one request per
worker and then copied the same harness: the four account and Region
scopes, the request signing, a five second wait per request, and the
health, SSM and EC2 DescribeRegions probes. Move that into
HeldWorkerProbes, next to FourWorkerThreadsProfile, so each class keeps
only its own held requests and its own probes: ListQueues and an
invalid receive for SQS, DynamoDB ListTables for Lambda.
The probes used to run one after another, five seconds each, while the
held requests wait 20 seconds. On a slow enough runner the probes could
outlast the holds and fail a test whose dispatch was correct. They are
now sent together and share one five second deadline. With the ten
seconds allowed for the held requests to arrive, the probes end at most
15 seconds after those requests were sent, inside their 20 seconds. Under 32 busy loops on two CPUs the sequential
probes took up to 2.1 seconds and the concurrent ones up to 0.6.
The assertions are unchanged, and a probe that is not answered is
named in the failure. Both classes still fail on main, and the Lambda
class still fails with only the protocol commit applied.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test: tie the held-worker probe deadline to the hold time
HeldWorkerProbes promised that its probes finish before a held request
is released, but the 20 second hold and the 10 second wait for the
held requests to arrive were literals repeated in each test. Move both
into the helper as HOLD_SECONDS and ARRIVAL_SECONDS, use them in both
tests, and check when the class loads that the arrival wait plus the
probe deadline stays under the hold.
A probe check that throws something other than an assertion now fails
with the probe's name, and the worker-count check reports both counts.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Seven tests read Floci's own sources through paths written out as
src/main/java/io/github/hectorvent/floci/..., and
PersistedModelReflectionTest named the root package as a string. A new
MainSources helper derives them from classes instead (the root package
from its own package), so they keep pointing at the right files when
the package moves to io.floci.aws. PersistedModelReflectionTest also
imports File instead of qualifying it inline.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
The declared constraints on IAM's managed-policy operations are read from the
pinned model rather than from a hand-written check, through the vendored data
tools/aws/regen_iam_shapes.py generates and a Query walk of it. Twelve
operations go first: GetPolicy, DeletePolicy, the four policy-version
operations, and the six attach and detach pairs. The vendored file carries that
wave rather than all 180 operations, as the ECR and Resource Groups files carry
theirs, and grows a wave at a time.
The machinery was already here for the JSON protocols. request_shapes
build_constraints vendors required members, lengths, patterns and enums;
RequestConstraintCheck walks a JSON body against them; SmithyValidationErrors
already writes the awsQuery wording. What was missing is the walk a Query
request needs, which is why QueryConstraintCheck sits beside
RequestConstraintCheck rather than inside it: a JSON body arrives as a tree,
where a Query request arrives as flat parameters named after the members that
carry them, and the violations are collected into one "N validation errors
detected" message in the model's member order instead of the first one being
thrown. A test sends two broken members in the opposite order to the model's
and gets the model's order back, so the ordering is the model's rather than the
wire's.
What changes for a caller is the status, in the direction #6402 settled for this
package: a PolicyArn under arnType's 20 characters, a VersionId outside
policyVersionIdType's pattern or an absent required member used to reach the
store and answer NoSuchEntity 404, where AWS's validation layer runs ahead of
the operation and answers ValidationError 400. AttachRolePolicy's RoleName is
the parity case for every value but one: IamService.validateRoleName already
answered it from the same bounds and the same pattern, and for a name outside
its pattern the message is unchanged by the model taking it over, which a test
pins.
An empty name is that one value, and the one place the wording moves rather
than the status. validateRoleName stops at the first constraint an empty name
breaks and reports the minimum alone, where the model also reports the pattern
it breaks, so these twelve operations answer two violations where they answered
one. That is the reading #6402 merged for a value breaking two of its
constraints, and it makes validateRoleName the drift rather than the
reference. The operations still on the hand-written check keep the single
violation until a later wave takes them over, which a test holds still on
CreateRole so that the wave which does has to settle the wording first.
Two answers are the package's own rather than new. A member breaking two
constraints is reported twice, which is what #6402 merged for a
ServiceSpecificCredentialId that breaks both its length and its pattern, so an
empty PolicyDocument reports its minimum and its pattern. The offending value
stays quoted, as SmithyValidationErrors and validateRoleName already quote it;
whether current IAM quotes it at all is an open question, and reading the
constraints in one place is what would make that one helper to change rather
than every message in the package.
Scalars only so far. An operation whose input shape carries a list or a map is
refused when the vendored file loads rather than passed over with its
constraints unread, since reading one means reading Name.member.N and
Name.entry.N.key and naming each index as the request spelled it. A boolean is
declared and holds no constraint to be read against, so a SetAsDefault that is
neither true nor false still reaches the operation, which reads anything but
true as false. A test pins that rather than changing it, since what AWS answers
for a malformed boolean is unrecorded here.
Classic EMR steps never ran: each one completed after
step-duration-seconds, so a step could not fail, a failed step's
ActionOnFailure never applied, and no cluster ever ended
TERMINATED_WITH_ERRORS. A new floci.services.emr.runner-mode, immediate
by default (today's timed lifecycle), runs each step in docker mode:
- One container per step, from when the step goes RUNNING until its
Spark driver exits, through the runner EMR Serverless's docker mode
uses: spark-submit in local mode in the release's EMR Serverless image,
with S3A and Glue pointed at Floci. The cluster gets no container.
- command-runner.jar running spark-submit gets the arguments after it,
without --master and --deploy-mode; a custom JAR runs its MainClass,
or its manifest's, with the JAR and its Args. Other steps (Hive, Pig,
script-runner.jar, other commands) fail without running.
- The step is COMPLETED on exit code 0 and FAILED otherwise, with
FailureDetails: Reason "Unknown Error", which the API reference says
EMR gives when it cannot find the root cause, and Floci's message.
- ActionOnFailure as the API reference and the Management Guide give
it: TERMINATE_CLUSTER ends the cluster unless it waits after its steps
and is protected; CANCEL_AND_WAIT cancels the pending steps and waits,
or ends a cluster set to end after its steps; CONTINUE goes on; none
applies above concurrency level 1, nor CANCEL_AND_WAIT with other
steps running. A cluster a failure ends is TERMINATED_WITH_ERRORS with
STEP_FAILURE and "Shut down as step failed".
- Step FAILED (ERROR) and cluster TERMINATED_WITH_ERRORS (CRITICAL)
events, with the messages of the guide's event tables.
- CancelSteps and TerminateJobFlows stop a running step's driver. A
driver Floci's shutdown or a reset stops leaves its step as it is, so
no other step starts once the teardown has passed: a step Floci was
running is FAILED once Floci is back, and a reset's threads write
nothing after it. Leftover drivers are removed when the service
starts, before any step can, unless reconcile-containers-on-startup is
off.
- The driver runs as the step's ExecutionRoleArn, or else the role of
the cluster's JobFlowRole instance profile, and gets the spark-defaults
of the cluster's Configurations.
New settings: runner-mode, docker-network, image-template and
reconcile-containers-on-startup, as EMR Serverless has.
The shared runner now reads Progress.cancelled() at every look at a
running driver, so a driver whose run a reset removed is stopped, and
removeLeftoverDrivers is on SparkJobRunner. EMR Serverless's job run
service counts a RUNNING run as not cancelled accordingly.
Permanently removes one or more versions of a package, real assets included.
Confirmed against the wire model: the request shape has no versionRevisions
field at all (unlike UpdatePackageVersionsStatus/DisposePackageVersions), only
a single expectedStatus applied to the whole batch, and expectedStatus itself
accepts the full, unrestricted PackageVersionStatus enum. Deleting is allowed
from every status, Disposed included: the User Guide is explicit that "the
only action that can be taken on a package version that has been disposed is
for it to be deleted."
Unlike DisposePackageVersions, which keeps a tombstone record so
DescribePackageVersion keeps answering Disposed, a deleted version is "no
longer in the repository" at all: the generic record is removed outright and
a container-backed version's status override is cleared rather than
replaced, so DescribePackageVersion/GetPackageVersionAsset 404 on it
afterward and the freed coordinate can be freely republished. Reuses
deleteContainerBackedVersionAssets as-is for the real sidecar deletion, byte
accounting, and Maven metadata.xml cleanup, since those are identical
regardless of which action triggered them.
Preserve capacity, version and entries after a rejected shrink, and clear omitted declared entries while retaining identity and capacity. Extend the accepted lifecycle fixture without changing production behavior.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* fix(cloudformation): preserve nested dynamic reference opt-out
Keep nested intrinsics on the RDS credential path outside the general dynamic-reference stage. Reuse the existing suspension counter and restore it after every exit.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
* test(cloudformation): preserve joined-reference test documentation
Move the nested opt-out test above the joined-string Javadoc so the comment documents its original test. Preserve both test bodies unchanged.
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
---------
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
socat relayed a client's second small write only after the first was
acknowledged, so delayed ACKs stretched every PostgreSQL statement close
to ~44 ms. Add nodelay (TCP_NODELAY) to both addresses: the listener's
option reaches the accepted socket in the fork child, and the connect
side covers the instance-facing one.
Closes#6176
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(stepfunctions): page GetExecutionHistory and honor reverseOrder
GetExecutionHistory read only executionArn and includeExecutionData.
Every call returned the whole history, oldest event first: maxResults
and nextToken were ignored, and reverseOrder=true still listed
ExecutionStarted first, so a caller asking for the newest event with
reverseOrder and maxResults=1 got the oldest one instead. The API
reference pages the history by 100 events unless maxResults says
otherwise, allows at most 1,000, returns a nextToken while events
remain, and lists the newest event first under reverseOrder.
Page the history by event id. Ids rise in the order events are
recorded, so a page starts after the last event the previous page
returned, even while the execution is still recording events. An
omitted or zero maxResults uses 100; a maxResults outside 0 to 1,000
or a nextToken outside 1 to 1,024 characters is a ValidationException,
as for ListActivities. A token names its execution and its
reverseOrder, so it is refused with InvalidToken for any other, while
maxResults and includeExecutionData may change from one page to the
next.
Tokens are signed with SignedMarkers and carry their issue time. An
edited token, one issued before a restart, or one issued more than 24
hours earlier is refused with InvalidToken; the 24-hour expiry is the
one the API reference documents. The execution is named in the token
by the SHA-256 of its ARN, so a token stays under 200 characters
however long the state machine and execution names are.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): page execution history with the SDK paginator
Run a 60-state execution, whose history of 122 events is longer than
one default page, and read it with the AWS SDK for Java: a plain call
returns 100 events and a nextToken, the paginator at 25 events a page
returns every event once, oldest first or with reverseOrder newest
first, and reverseOrder with maxResults=1 returns ExecutionSucceeded
with a token for the rest.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): give the ListExecutions filter test a clock
StepFunctionsListExecutionsFilterTest, merged from upstream main, built
the handler with the two-argument constructor. On this branch the
handler takes the application Clock for the lifetime of execution
history tokens, so the merged tree did not compile. Pass the system
clock, which ListExecutions does not read.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): pin the page-size checks of ListActivities and history
ListActivities and GetExecutionHistory each check maxResults and
nextToken on their own, with the same bounds and messages, and page by
100 when maxResults is omitted or 0. Pin the messages of both and the
ListActivities default before the two move onto one helper.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(stepfunctions): share the page-size checks of ListActivities and history
ListActivities and GetExecutionHistory each checked that maxResults is
0 to 1,000 and nextToken 1 to 1,024 characters, with the same messages,
and turned an omitted or zero maxResults into 100. Move that into
StepFunctionsPaging.pageSize, which validates the pair and returns the
page size, so the other Step Functions list operations can use it
later. Behaviour, messages and the order of the checks are unchanged.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): say why the paginator test ignores cleanup failures
The SDK paginator test deleted its state machine in a catch-all that
neither logged nor explained the failure it ignored. Say why it is
safe: the state machine has a unique name, and a cleanup failure must
not hide the test's own result.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): pin the page-size bounds and the order of the checks
Pin that ListActivities and GetExecutionHistory accept the bounds
themselves (a 1- or 1,024-character nextToken reaches the token
lookup, and ListActivities takes maxResults=1000), and that both read
maxResults and nextToken before bounding either. The test's cleanup
deletes its activities without asserting, so a failed delete can no
longer hide the test's own failure.
The last check is the one place where the shared helper changed
behaviour, which the commit that added it wrongly said it did not. A
history request with maxResults=1001 and a non-string nextToken used
to report the maxResults bound; it now reports "nextToken must be a
string.", as ListActivities always has. The new test fails that way
on the commit before the helper and passes after it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(stepfunctions): describe StepFunctionsPaging by its two callers
The class comment said every Step Functions list operation shares this
page request. Only ListActivities and GetExecutionHistory do;
ListStateMachineAliases still checks its own bounds. Name the two
callers and say that both fields are read before either is bounded.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): share one request helper between the paging tests
StepFunctionsPageSizeIntegrationTest and
StepFunctionsExecutionHistoryPaginationIntegrationTest each carried
the same private call() and content type. Add StepFunctionsRequests in
the testing package, as CfnRequests and EmrRequests serve their
services, and move both tests onto its sfn(action, body). The requests
they send are unchanged.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* test(stepfunctions): take the request body of sfn() as a map
sfn() took any Object and said it serializes the body as JSON, which
holds for a map but not for a string, which RestAssured sends as is.
Both callers pass maps, as the private helpers it replaced took, so
type the parameter as Map<String, ?>.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
---------
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
The table of request resources read only top-level members, so an
operation naming its resource inside a structure was checked on *:
SetRulePriorities' RulePriorities[].RuleArn and a state machine alias's
routingConfiguration[].stateMachineVersionArn. A member ending in Arn or
Arns one level inside a structure, or inside each of a list's
structures, now names a resource as a top-level one does, the value's
format deciding which of the action's types it is. Such a member never
fills a variable, holds a type or names a create's parent. A form's list
is read to the first element without the field, as the ELB handler
loops.
EventBridge joins the table (71 operations). Its rules are named by the
rule's name on the event bus EventBusName names, by name or by ARN, and
on the default bus when it names none ("If you omit this, the default
event bus is used"), whose rules are rule/<name>, with no bus.
Corrections give the eight rule operations the default bus's rule when
EventBusName is default or absent, and the custom bus's otherwise, with
two new keys: unless, the complement of when, and absent, the value a
missing member is read as. DescribeEventBus naming no bus is checked on
event-bus/default ("If you omit this, the default event bus is
displayed"). A member whose botocore pattern takes an ARN before a name,
(arn:...:event-bus/)?<name>, is recorded as arnOf: an ARN given for it
is read as that type's one variable, and the resource is in the ARN's
account and Region, so a bus of another account, its default bus
included, names that account's rule, as DescribeRule's CreatedBy says,
checked as given and as the caller's own, which Floci acts on. An ARN
leaving its account and Region empty, which EventBridge's handler takes
as the caller's bus of that name, names the caller's, and a JSON null
for a member read as a value when absent is absent too, as the handler's
asText(null) reads it, so a null EventBusName is the default bus.
EventBridge V2's client, AWSEventsV2 over Smithy RPC v2 CBOR, which
Floci does not serve, shares the operations' names and is left out
(clientsNotRead), and verify ignores it.
EventBridge mints a connection's ARN as connection/<name>/<id> and an
API destination's as api-destination/<name>/<id>, as botocore's ARN
patterns give them, and checks a connection on it (the user guide grants
events:RetrieveConnectionCredentials on connection/<name>/*), while the
Service Reference's formats stop at the name. MINTED_IDS records those
types (mintedIds), and a request naming one by its name is checked on
the ARN its service stores it under, which a StoredResourceArns the
service registers finds for the caller in the request's Region
(EventBridgeService does), or on <name>/* when there is none yet, a
create's included.
Not in this change: PutEvents, whose entries each name their bus, stays
on *, and UpdateEventBus with no Name, which no document says is the
default bus, stays on * too.
REAL-2's runner ran EMR Serverless job runs only: it read its image and
network from the EMR Serverless settings, named and labelled every driver
emr-serverless, and built spark-submit's command line from a job run's
JobDriver. Classic EMR steps are to run in the same containers, in the
same EMR Serverless images, so the runner stays in the emrserverless
package for the emr package to use, and takes what is service-specific
from the job:
- the service, which names the driver's container, labels it and prefixes
its log, and whose leftover drivers removeLeftoverDrivers(service) sweeps;
- the release, the image template and the Docker network, which the
service takes from its own image-template and docker-network. The runner
still works out the image inside its run, the release's public EMR
Serverless image unless the template names another (spark4/ for an
emr-spark-* release), so a template that names no image still fails the
run with its reason;
- the application: what follows Floci's own settings on spark-submit's
command line. The job run service builds it from sparkSubmitParameters,
split as before, the entry point and its arguments.
SparkJobRunner, its Outcome factories and splitParameters become public,
for the emr package.
No behaviour changes: EMR Serverless job runs get the same image, network,
container name, labels, credentials and spark-submit arguments as before.