createCluster method
- required BrokerNodeGroupInfo brokerNodeGroupInfo,
- required String clusterName,
- required String kafkaVersion,
- required int numberOfBrokerNodes,
- ClientAuthentication? clientAuthentication,
- ConfigurationInfo? configurationInfo,
- EncryptionInfo? encryptionInfo,
- EnhancedMonitoring? enhancedMonitoring,
- LoggingInfo? loggingInfo,
- OpenMonitoringInfo? openMonitoring,
- Map<
String, String> ? tags,
Creates a new MSK cluster.
May throw BadRequestException. May throw InternalServerErrorException. May throw UnauthorizedException. May throw ForbiddenException. May throw ServiceUnavailableException. May throw TooManyRequestsException. May throw ConflictException.
Parameter brokerNodeGroupInfo
:
Information about the broker nodes in the cluster.
Parameter clusterName
:
The name of the cluster.
Parameter kafkaVersion
:
The version of Apache Kafka.
Parameter numberOfBrokerNodes
:
The number of broker nodes in the cluster.
Parameter clientAuthentication
:
Includes all client authentication related information.
Parameter configurationInfo
:
Represents the configuration that you want MSK to use for the brokers in a cluster.
Parameter encryptionInfo
:
Includes all encryption-related information.
Parameter enhancedMonitoring
:
Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, PER_TOPIC_PER_BROKER, and PER_TOPIC_PER_PARTITION.
Parameter openMonitoring
:
The settings for open monitoring.
Parameter tags
:
Create tags when creating the cluster.
Implementation
Future<CreateClusterResponse> createCluster({
required BrokerNodeGroupInfo brokerNodeGroupInfo,
required String clusterName,
required String kafkaVersion,
required int numberOfBrokerNodes,
ClientAuthentication? clientAuthentication,
ConfigurationInfo? configurationInfo,
EncryptionInfo? encryptionInfo,
EnhancedMonitoring? enhancedMonitoring,
LoggingInfo? loggingInfo,
OpenMonitoringInfo? openMonitoring,
Map<String, String>? tags,
}) async {
ArgumentError.checkNotNull(brokerNodeGroupInfo, 'brokerNodeGroupInfo');
ArgumentError.checkNotNull(clusterName, 'clusterName');
_s.validateStringLength(
'clusterName',
clusterName,
1,
64,
isRequired: true,
);
ArgumentError.checkNotNull(kafkaVersion, 'kafkaVersion');
_s.validateStringLength(
'kafkaVersion',
kafkaVersion,
1,
128,
isRequired: true,
);
ArgumentError.checkNotNull(numberOfBrokerNodes, 'numberOfBrokerNodes');
_s.validateNumRange(
'numberOfBrokerNodes',
numberOfBrokerNodes,
1,
15,
isRequired: true,
);
final $payload = <String, dynamic>{
'brokerNodeGroupInfo': brokerNodeGroupInfo,
'clusterName': clusterName,
'kafkaVersion': kafkaVersion,
'numberOfBrokerNodes': numberOfBrokerNodes,
if (clientAuthentication != null)
'clientAuthentication': clientAuthentication,
if (configurationInfo != null) 'configurationInfo': configurationInfo,
if (encryptionInfo != null) 'encryptionInfo': encryptionInfo,
if (enhancedMonitoring != null)
'enhancedMonitoring': enhancedMonitoring.toValue(),
if (loggingInfo != null) 'loggingInfo': loggingInfo,
if (openMonitoring != null) 'openMonitoring': openMonitoring,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/clusters',
exceptionFnMap: _exceptionFns,
);
return CreateClusterResponse.fromJson(response);
}