createChannel method
- required String channelName,
- ChannelStorage? channelStorage,
- RetentionPeriod? retentionPeriod,
- List<
Tag> ? tags,
Creates a channel. A channel collects data from an MQTT topic and archives the raw, unprocessed messages before publishing the data to a pipeline.
May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw InternalFailureException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw LimitExceededException.
Parameter channelName :
The name of the channel.
Parameter channelStorage :
Where channel data is stored. You can choose one of
serviceManagedS3 or customerManagedS3 storage.
If not specified, the default is serviceManagedS3. You cannot
change this storage option after the channel is created.
Parameter retentionPeriod :
How long, in days, message data is kept for the channel. When
customerManagedS3 storage is selected, this parameter is
ignored.
Parameter tags :
Metadata which can be used to manage the channel.
Implementation
Future<CreateChannelResponse> createChannel({
required String channelName,
ChannelStorage? channelStorage,
RetentionPeriod? retentionPeriod,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(channelName, 'channelName');
_s.validateStringLength(
'channelName',
channelName,
1,
128,
isRequired: true,
);
final $payload = <String, dynamic>{
'channelName': channelName,
if (channelStorage != null) 'channelStorage': channelStorage,
if (retentionPeriod != null) 'retentionPeriod': retentionPeriod,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/channels',
exceptionFnMap: _exceptionFns,
);
return CreateChannelResponse.fromJson(response);
}