Adds Amazon Kinesis Video Streams (kinesisvideo, REST JSON, 2017-09-30) with the stream lifecycle control plane: CreateStream, DescribeStream, ListStreams and DeleteStream, stored per account and Region. A stream's ARN ends with its creation time in milliseconds and is distinct for every stream, even one recreated within the same millisecond, and its KmsKeyId defaults to alias/aws/kinesisvideo. ListStreams pages by the last returned name, so deleting between pages skips nothing. Requests are checked against the constraints of the botocore model, vendored by tools/aws/regen_kinesisvideo_shapes.py, and refusals carry the codes and wording AWS sends. Under IAM enforcement every request is checked as its kinesisvideo: action on the stream it names, read through the stream's stored ARN and tags, and a tagged CreateStream also needs kinesisvideo:TagStream. The IAM data comes from the generators. A stream is ACTIVE as soon as CreateStream returns, and DeleteStream removes it at once, where AWS passes through CREATING and DELETING.
4.2 KiB
Kinesis Video Streams
Floci implements the REST JSON control plane of Amazon Kinesis Video Streams for the stream lifecycle: creating, describing, listing and deleting video streams. Requests are signed for kinesisvideo and served at the same endpoint as every other service.
Supported Actions
| Action | Description |
|---|---|
CreateStream |
Creates a video stream and returns its ARN. |
DeleteStream |
Deletes a stream by ARN, checking CurrentVersion when it is given. |
DescribeStream |
Returns a stream's StreamInfo, by StreamName or StreamARN. |
ListStreams |
Lists the streams of the Region, filtered by StreamNameCondition and paginated. |
Behavior
- A stream is
ACTIVEas soon asCreateStreamreturns. AWS passes throughCREATINGfirst. DeleteStreamremoves the stream at once, soDescribeStreamreturnsResourceNotFoundExceptionright after it. AWS passes throughDELETINGfirst.- The stream ARN has the AWS shape
arn:<partition>:kinesisvideo:<region>:<account>:stream/<name>/<creation time in milliseconds>. An ARN of a deleted stream does not match a stream later created with the same name. - Without
KmsKeyId,StreamInfo.KmsKeyIdis the ARN of the AWS managed key aliasalias/aws/kinesisvideo. DataRetentionInHoursdefaults to0, which AWS reads as no retention.Versionis generated at creation.DeleteStreamreturnsVersionMismatchExceptionwhenCurrentVersiondiffers from it.- Creating a stream whose name exists in the account and Region returns
ResourceInUseException. - Requests are checked by
RequestConstraintCheckagainst the member types, required members, lengths, patterns and enum values generated from botocore's Kinesis Video model, such as theStreamNameandDeviceNamepattern ([a-zA-Z0-9_.-]+), theMediaTypepattern, theVersionpattern ofCurrentVersion, theResourceARNpattern ofStreamARN, the 1 to 10000 range ofMaxResultsand theBEGINS_WITHvalue ofComparisonOperator.tools/aws/regen_kinesisvideo_shapes.pyvendors them;make aws-data-syncregenerates them andmake aws-data-checkchecks for drift. A member of the wrong JSON type fails withSerializationException, more than the 50 tags the model allows withTagsPerResourceExceededLimitException, and any other violation withInvalidArgumentException. ADescribeStreamnaming neitherStreamNamenorStreamARN, or both even when they agree, and aNextTokenthatListStreamsdid not return, also fail withInvalidArgumentException, in the wording AWS uses.
IAM
Under IAM enforcement (floci.services.iam.enforcement-enabled), each request is checked as its kinesisvideo: action, from the routes and request resources generated from botocore and the AWS Service Reference. DescribeStream and DeleteStream are checked on the stream they name, a DescribeStream by StreamName on the ARN the stream is stored under, creation time included, and aws:ResourceTag/<key> reads the tags the stream was created with; ListStreams acts on no resource type and is checked on *, and a CreateStream with Tags also needs kinesisvideo:TagStream, with its tags as aws:RequestTag/<key> and aws:TagKeys. A refusal is AccessDeniedException with the 401 status the model declares for the service.
Not implemented
Media ingestion and playback (GetDataEndpoint and the kinesis-video-media and kinesis-video-archived-media data planes), signaling channels, stream updates, tagging actions, and the image generation, notification, edge and storage configuration actions are not emulated yet.
Example
export AWS_ENDPOINT_URL=http://localhost:4566
aws kinesisvideo create-stream --stream-name camera-1 --media-type video/h264 --data-retention-in-hours 24
aws kinesisvideo describe-stream --stream-name camera-1
aws kinesisvideo list-streams
aws kinesisvideo delete-stream --stream-arn "$(aws kinesisvideo describe-stream --stream-name camera-1 \
--query StreamInfo.StreamARN --output text)"
See the Kinesis Video Streams API Reference.