createAddon method

Future<CreateAddonResponse> createAddon({
  1. required String addonName,
  2. required String clusterName,
  3. String? addonVersion,
  4. String? clientRequestToken,
  5. ResolveConflicts? resolveConflicts,
  6. String? serviceAccountRoleArn,
  7. Map<String, String>? tags,
})

Creates an Amazon EKS add-on.

Amazon EKS add-ons help to automate the provisioning and lifecycle management of common operational software for Amazon EKS clusters. Amazon EKS add-ons can only be used with Amazon EKS clusters running version 1.18 with platform version eks.3 or later because add-ons rely on the Server-side Apply Kubernetes feature, which is only available in Kubernetes 1.18 and later.

May throw InvalidParameterException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ResourceInUseException. May throw ClientException. May throw ServerException.

Parameter addonName : The name of the add-on. The name must match one of the names returned by ListAddons .

Parameter clusterName : The name of the cluster to create the add-on for.

Parameter addonVersion : The version of the add-on. The version must match one of the versions returned by DescribeAddonVersions .

Parameter clientRequestToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter resolveConflicts : How to resolve parameter value conflicts when migrating an existing add-on to an Amazon EKS add-on.

Parameter serviceAccountRoleArn : The Amazon Resource Name (ARN) of an existing IAM role to bind to the add-on's service account. The role must be assigned the IAM permissions required by the add-on. If you don't specify an existing IAM role, then the add-on uses the permissions assigned to the node IAM role. For more information, see Amazon EKS node IAM role in the Amazon EKS User Guide.

Parameter tags : The metadata to apply to the cluster to assist with categorization and organization. Each tag consists of a key and an optional value, both of which you define.

Implementation

Future<CreateAddonResponse> createAddon({
  required String addonName,
  required String clusterName,
  String? addonVersion,
  String? clientRequestToken,
  ResolveConflicts? resolveConflicts,
  String? serviceAccountRoleArn,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(addonName, 'addonName');
  ArgumentError.checkNotNull(clusterName, 'clusterName');
  _s.validateStringLength(
    'clusterName',
    clusterName,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'serviceAccountRoleArn',
    serviceAccountRoleArn,
    1,
    255,
  );
  final $payload = <String, dynamic>{
    'addonName': addonName,
    if (addonVersion != null) 'addonVersion': addonVersion,
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (resolveConflicts != null)
      'resolveConflicts': resolveConflicts.toValue(),
    if (serviceAccountRoleArn != null)
      'serviceAccountRoleArn': serviceAccountRoleArn,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/clusters/${Uri.encodeComponent(clusterName)}/addons',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAddonResponse.fromJson(response);
}