mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 03:28:18 -05:00
Under enforcement a REST route no vendored model names runs unchecked, and Amazon Connect was among them: any caller could create, describe, update or delete an instance, its attributes or its storage configs. Connect's model routes are vendored (regen_rest_routes.MODELS, signed connect), so each request is checked as its operation's action, and connect joins the generated tables of request resources and tags on create: an instance by the id its path gives, each of Connect's other resources by the members its request names, and the tags a create carries. ConnectStoredResourceArns answers the tags Connect holds on an instance, read in place in the ARN's account and Region, which an aws:ResourceTag condition reads. The table asks for a traffic distribution group or a data table to be found, which Floci does not serve, so there is nothing to find. The table's integer variables now include Connect's customer-managed-view-version ViewVersion, which test_regen_iam_request_resources pins. A namespace the table reads is served on its tag routes only at the ARN its path encodes, so ConnectIntegrationTest's tag calls send the ARN encoded, as the SDKs do, rather than with its '/' raw. IamRestRouteEnforcementIntegrationTest checks that with no grant an instance's read is refused, that a grant on one instance reads it and refuses another, and that an aws:ResourceTag condition reads its tags. ConnectService named an instance by any ARN, reading the text after its first slash, so an ARN of another shape (arn:aws:connect:us-east-1::other/<id>) reached an instance IAM had not checked the request on, past a deny on it. It now takes an instance's own ARN alone, the one IAM checks, refuses an ARN of any other shape, and looks one of another account or Region up as given, which finds nothing; storedTags answers an instance's own ARN alone, so another partition's gets no tags. ConnectStoredResourceArnsTest covers both, IamRestRouteEnforcementIntegrationTest checks that an instance deny holds for each form the path gives it and that a tagged CreateInstance needs connect:TagResource, and docs/services/connect.md says which ARNs are taken.
90 lines
4.0 KiB
Markdown
90 lines
4.0 KiB
Markdown
# Amazon Connect
|
|
|
|
**Protocol:** REST-JSON
|
|
**Endpoint:** `http://localhost:4566/instance` (SigV4 service `connect`)
|
|
|
|
## Supported Actions
|
|
|
|
<!-- floci:actions:start -->
|
|
| Action | Description |
|
|
| --- | --- |
|
|
| `CreateInstance` | Create an instance; returns `Id` and `Arn`, ACTIVE immediately |
|
|
| `DescribeInstance` | Get the full instance including tags |
|
|
| `DeleteInstance` | Delete an instance and its storage config associations |
|
|
| `ListInstances` | List instance summaries |
|
|
| `UpdateInstanceAttribute` | Set one `InstanceAttributeType` |
|
|
| `DescribeInstanceAttribute` | Read one `InstanceAttributeType` |
|
|
| `ListInstanceAttributes` | List every attribute on an instance |
|
|
| `AssociateInstanceStorageConfig` | Attach a storage config for a resource type |
|
|
| `DescribeInstanceStorageConfig` | Read a storage config by association id |
|
|
| `UpdateInstanceStorageConfig` | Replace a storage config |
|
|
| `DisassociateInstanceStorageConfig` | Remove a storage config |
|
|
| `ListInstanceStorageConfigs` | List storage configs for one resource type |
|
|
| `ListTagsForResource` | List instance tags (`GET /tags/{resourceArn}`) |
|
|
| `TagResource` | Tag an instance (`POST /tags/{resourceArn}`) |
|
|
| `UntagResource` | Remove instance tags (`DELETE /tags/{resourceArn}?tagKeys=`) |
|
|
<!-- floci:actions:end -->
|
|
|
|
`InstanceStatus` is `ACTIVE` from the first read, so `aws_connect_instance`'s status
|
|
poll completes without a transition. `CreateInstance` returns only `Id` and `Arn` —
|
|
the full `Instance` shape, tags included, comes back from `DescribeInstance`.
|
|
`InstanceSummary` has no `Tags` member in the AWS model, so `ListInstances` omits it.
|
|
|
|
Every `InstanceAttributeType` in the AWS model is seeded when an instance is created:
|
|
`INBOUND_CALLS` and `OUTBOUND_CALLS` take their values from the create request, the
|
|
rest default to `false`. This keeps `DescribeInstanceAttribute` from returning a
|
|
404 for a valid attribute type, which `aws_connect_instance` reads on every refresh.
|
|
|
|
Storage configs are keyed by instance, resource type and association id, so the same
|
|
instance can hold separate configurations for `CHAT_TRANSCRIPTS`, `CALL_RECORDINGS`
|
|
and the rest. `ResourceType` is required on every read and write, as AWS requires it.
|
|
|
|
Both a bare instance id and the instance's own ARN are accepted wherever the API
|
|
takes an `InstanceId`. An ARN of any other shape is refused with
|
|
`InvalidParameterException`, and an instance ARN of another account or Region names no
|
|
instance in the request's.
|
|
|
|
## Not implemented
|
|
|
|
These return a clean `UnknownOperationException` rather than a stub success. The
|
|
telephony and contact surfaces of Connect depend on real voice, chat and agent
|
|
traffic, which the emulator has no way to model:
|
|
|
|
- Phone numbers (`ClaimPhoneNumber`, `SearchAvailablePhoneNumbers`, ...) — these
|
|
allocate real numbers from carrier inventory.
|
|
- Contacts (`StartOutboundVoiceContact`, `StopContact`, `GetContactAttributes`, ...)
|
|
— these require a live contact.
|
|
- Agent status, user hierarchy and routing profiles bound to live agents.
|
|
- Real-time and historical metrics (`GetCurrentMetricData`, `GetMetricDataV2`, ...) —
|
|
these aggregate real traffic.
|
|
- Queues, hours of operation, contact flows and quick connects — not yet modelled.
|
|
|
|
## Configuration
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `FLOCI_SERVICES_CONNECT_ENABLED` | `true` | Enable or disable the service |
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
export AWS_ENDPOINT_URL=http://localhost:4566
|
|
|
|
aws connect create-instance \
|
|
--identity-management-type CONNECT_MANAGED \
|
|
--instance-alias my-contact-center \
|
|
--no-inbound-calls-enabled \
|
|
--outbound-calls-enabled
|
|
|
|
aws connect describe-instance --instance-id <id>
|
|
|
|
aws connect update-instance-attribute \
|
|
--instance-id <id> --attribute-type CONTACTFLOW_LOGS --value true
|
|
|
|
aws connect associate-instance-storage-config \
|
|
--instance-id <id> --resource-type CHAT_TRANSCRIPTS \
|
|
--storage-config '{"StorageType":"S3","S3Config":{"BucketName":"b","BucketPrefix":"chat/"}}'
|
|
|
|
aws connect delete-instance --instance-id <id>
|
|
```
|