Files
floci/docs/services/managed-prometheus.md
T
Matan Baruch 277809fb41 feat(aps): add Amazon Managed Service for Prometheus workspaces (#2604)
* feat(aps): add Amazon Managed Service for Prometheus workspaces

Implements the AMP workspace lifecycle (CreateWorkspace,
DescribeWorkspace, ListWorkspaces, UpdateWorkspaceAlias,
DeleteWorkspace) plus tagging through the shared /tags/{resourceArn}
dispatcher via a TagHandler with service key aps. Previously the aps
service did not exist, so aws_prometheus_workspace could not be created
through Terraform or Pulumi at all.

Workspaces are ACTIVE from birth so the provider's create waiter
(CREATING to ACTIVE) completes on its first DescribeWorkspace poll, and
a deleted workspace answers DescribeWorkspace with the typed
ResourceNotFoundException its delete waiter matches. createdAt is
serialized as restJson1 epoch-seconds; the ListWorkspaces alias
parameter is a prefix filter, matching the provider's alias_prefix.

clientToken is accepted and ignored, kmsKeyArn is stored and echoed,
and no alertmanager/rulegroups/scraper/logging operations are included.

* refactor(aps): build ARNs via RegionResolver and parse tag ARNs with AwsArnUtils

Replaces the inlined AwsArnUtils.Arn.of + config.defaultRegion pair with
regionResolver.getRegion()/buildArn so a request signed for another
region gets an ARN and endpoint in that region, and drops the
EmulatorConfig dependency that existed only for that getter. The tag
dispatcher path now parses ARNs with AwsArnUtils.parse plus an explicit
workspace/ prefix check (the SchedulerTagHandler idiom), so a
non-workspace aps ARN fails with ValidationException instead of a
misleading workspace ResourceNotFoundException. Also makes the delete
and alias mutators void (their returns were unused) and removes a dead
DELETING status mutation.

* docs(aps): map the aps service key to managed-prometheus.md in the service matrix

The docs-check gate matches ResolvedServiceCatalog external keys against
docs/services/index.md rows by filename; aps is documented at
managed-prometheus.md, so it needs the same alias treatment as
kafka -> msk.

* fix(aps): partition workspaces by request region and align minor wire details

Review follow-ups from #2604:

- Key the workspace store by region (region::workspaceId, like
  CloudWatchLogsService's groupKey), and thread the SigV4-resolved request
  region through every lifecycle and TagHandler operation, so workspaces
  created in one region are invisible to describe/list/delete/tag calls
  served in another. Covered by unit and HTTP region-isolation tests.
- Default ListWorkspaces to pages of 100 (AWS's documented default) while
  keeping the 1000 ceiling, via Pagination's seven-argument overload.
- Strip leading/trailing blanks from aliases at create, alias update, and
  the list prefix filter, per the documented normalisation.
- Return DeleteWorkspace's 202 with an empty body instead of {}.
- Reject tag keys beginning with the reserved aws: prefix in TagResource
  with a ValidationException.

* refactor(aps): align the reserved tag-key check with sibling services

- Match the aws: prefix case-insensitively as a plain loop, the same idiom
  as FisService and BatchService, instead of a case-sensitive stream chain.
- Derive key() from keyPrefix() so the :: separator lives in one place, and
  hoist the region prefix out of the scan predicate.
- Replace the two near-identical SigV4 Authorization literals in the
  integration test with an auth(region) helper.
2026-08-28 10:05:42 -04:00

2.2 KiB

Amazon Managed Service for Prometheus (AMP)

Protocol: REST JSON Endpoint: http://localhost:4566

Floci implements the AMP workspace lifecycle — the surface Terraform's and Pulumi's aws_prometheus_workspace resource uses — plus tagging through the shared /tags/{resourceArn} dispatcher. Alert manager definitions, rule groups namespaces, scrapers and logging configurations are not implemented.

Emulation notes

  • A workspace is ACTIVE from birth. Real AMP answers the create 202 with status CREATING; Floci provisions nothing, so DescribeWorkspace reports ACTIVE immediately and the Terraform provider's create waiter (CREATING → ACTIVE) completes on its first poll.
  • DeleteWorkspace removes the workspace immediately; a subsequent DescribeWorkspace returns ResourceNotFoundException (404), which the provider's delete waiter treats as gone.
  • prometheusEndpoint is reported in the real AWS shape (https://aps-workspaces.<region>.amazonaws.com/workspaces/<id>/). It is not a live ingestion/query endpoint.
  • The alias parameter of ListWorkspaces is a prefix filter, matching the provider's alias_prefix data-source argument.
  • clientToken on CreateWorkspace is accepted and ignored: creates are not deduplicated.
  • kmsKeyArn is stored and echoed back but no encryption is performed.

Supported Operations

Operation Method and path Description
CreateWorkspace POST /workspaces Creates a workspace (202); returns workspaceId, arn, status, tags
DescribeWorkspace GET /workspaces/{workspaceId} Returns the workspace description including prometheusEndpoint
ListWorkspaces GET /workspaces Lists workspaces; alias prefix filter, maxResults/nextToken pagination
UpdateWorkspaceAlias POST /workspaces/{workspaceId}/alias Updates the alias (204)
DeleteWorkspace DELETE /workspaces/{workspaceId} Deletes the workspace (202)
ListTagsForResource GET /tags/{resourceArn} Lists workspace tags (shared tags dispatcher)
TagResource POST /tags/{resourceArn} Adds or overwrites workspace tags (200)
UntagResource DELETE /tags/{resourceArn}?tagKeys=... Removes workspace tags (200)