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.

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

Parameter files : The files to stream.

Parameter roleArn : An IAM role that allows the IoT service principal assumes 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 {
  ArgumentError.checkNotNull(files, 'files');
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(streamId, 'streamId');
  _s.validateStringLength(
    'streamId',
    streamId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    2028,
  );
  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);
}