createExtension method

Future<Extension> createExtension({
  1. required Map<ActionPoint, List<Action>> actions,
  2. required String name,
  3. String? description,
  4. int? latestVersionNumber,
  5. Map<String, Parameter>? parameters,
  6. Map<String, String>? tags,
})

Creates an AppConfig extension. An extension augments your ability to inject logic or behavior at different points during the AppConfig workflow of creating or deploying a configuration.

You can create your own extensions or use the Amazon Web Services authored extensions provided by AppConfig. For an AppConfig extension that uses Lambda, you must create a Lambda function to perform any computation and processing defined in the extension. If you plan to create custom versions of the Amazon Web Services authored notification extensions, you only need to specify an Amazon Resource Name (ARN) in the Uri field for the new extension version.

  • For a custom EventBridge notification extension, enter the ARN of the EventBridge default events in the Uri field.
  • For a custom Amazon SNS notification extension, enter the ARN of an Amazon SNS topic in the Uri field.
  • For a custom Amazon SQS notification extension, enter the ARN of an Amazon SQS message queue in the Uri field.
For more information about extensions, see Extending workflows in the AppConfig User Guide.

May throw BadRequestException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException.

Parameter actions : The actions defined in the extension.

Parameter name : A name for the extension. Each extension name in your account must be unique. Extension versions use the same name.

Parameter description : Information about the extension.

Parameter latestVersionNumber : You can omit this field when you create an extension. When you create a new version, specify the most recent current version number. For example, you create version 3, enter 2 for this field.

Parameter parameters : The parameters accepted by the extension. You specify parameter values when you associate the extension to an AppConfig resource by using the CreateExtensionAssociation API action. For Lambda extension actions, these parameters are included in the Lambda request object.

Parameter tags : Adds one or more tags for the specified extension. Tags are metadata that help you categorize resources in different ways, for example, by purpose, owner, or environment. Each tag consists of a key and an optional value, both of which you define.

Implementation

Future<Extension> createExtension({
  required Map<ActionPoint, List<Action>> actions,
  required String name,
  String? description,
  int? latestVersionNumber,
  Map<String, Parameter>? parameters,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    if (latestVersionNumber != null)
      'Latest-Version-Number': latestVersionNumber.toString(),
  };
  final $payload = <String, dynamic>{
    'Actions': actions.map((k, e) => MapEntry(k.value, e)),
    'Name': name,
    if (description != null) 'Description': description,
    if (parameters != null) 'Parameters': parameters,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/extensions',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return Extension.fromJson(response);
}