createStream method

Future<CreateStreamResponse> createStream({
  1. required List<StreamFile> files,
  2. required String roleArn,
  3. required String streamId,
  4. String? description,
  5. List<Tag>? tags,
})

Creates a stream for delivering one or more large files in chunks over MQTT. A stream transports data bytes in chunks or blocks packaged as MQTT messages from a source like S3. You can have one or more files associated with a stream.

Requires permission to access the CreateStream action.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter files : The files to stream.

Parameter roleArn : An IAM role that allows the IoT service principal to access your S3 files.

Parameter streamId : The stream ID.

Parameter description : A description of the stream.

Parameter tags : Metadata which can be used to manage streams.

Implementation

Future<CreateStreamResponse> createStream({
  required List<StreamFile> files,
  required String roleArn,
  required String streamId,
  String? description,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'files': files,
    'roleArn': roleArn,
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/streams/${Uri.encodeComponent(streamId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateStreamResponse.fromJson(response);
}