updateChannel method

Future<UpdateChannelResponse> updateChannel({
  1. required String channelArn,
  2. required ChannelMode mode,
  3. required String name,
  4. String? metadata,
})

Update a channel's attributes.

Restriction: You can't change a channel's privacy.

May throw BadRequestException. May throw ForbiddenException. May throw ConflictException. May throw UnauthorizedClientException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter channelArn : The ARN of the channel.

Parameter mode : The mode of the update request.

Parameter name : The name of the channel.

Parameter metadata : The metadata of the channel.

Implementation

Future<UpdateChannelResponse> updateChannel({
  required String channelArn,
  required ChannelMode mode,
  required String name,
  String? metadata,
}) async {
  ArgumentError.checkNotNull(channelArn, 'channelArn');
  _s.validateStringLength(
    'channelArn',
    channelArn,
    5,
    1600,
    isRequired: true,
  );
  ArgumentError.checkNotNull(mode, 'mode');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'metadata',
    metadata,
    0,
    1024,
  );
  final $payload = <String, dynamic>{
    'Mode': mode.toValue(),
    'Name': name,
    if (metadata != null) 'Metadata': metadata,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/channels/${Uri.encodeComponent(channelArn)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateChannelResponse.fromJson(response);
}