publishLayerVersion method

Future<PublishLayerVersionResponse> publishLayerVersion({
  1. required LayerVersionContentInput content,
  2. required String layerName,
  3. List<Architecture>? compatibleArchitectures,
  4. List<Runtime>? compatibleRuntimes,
  5. String? description,
  6. String? licenseInfo,
})

Creates an Lambda layer from a ZIP archive. Each time you call PublishLayerVersion with the same layer name, a new version is created.

Add layers to your function with CreateFunction or UpdateFunctionConfiguration.

May throw CodeStorageExceededException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw ServiceException. May throw TooManyRequestsException.

Parameter content : The function layer archive.

Parameter layerName : The name or Amazon Resource Name (ARN) of the layer.

Parameter compatibleArchitectures : A list of compatible instruction set architectures.

Parameter compatibleRuntimes : A list of compatible function runtimes. Used for filtering with ListLayers and ListLayerVersions.

The following list includes deprecated runtimes. For more information, see Runtime deprecation policy.

Parameter description : The description of the version.

Parameter licenseInfo : The layer's software license. It can be any of the following:

  • An SPDX license identifier. For example, MIT.
  • The URL of a license hosted on the internet. For example, https://opensource.org/licenses/MIT.
  • The full text of the license.

Implementation

Future<PublishLayerVersionResponse> publishLayerVersion({
  required LayerVersionContentInput content,
  required String layerName,
  List<Architecture>? compatibleArchitectures,
  List<Runtime>? compatibleRuntimes,
  String? description,
  String? licenseInfo,
}) async {
  final $payload = <String, dynamic>{
    'Content': content,
    if (compatibleArchitectures != null)
      'CompatibleArchitectures':
          compatibleArchitectures.map((e) => e.value).toList(),
    if (compatibleRuntimes != null)
      'CompatibleRuntimes': compatibleRuntimes.map((e) => e.value).toList(),
    if (description != null) 'Description': description,
    if (licenseInfo != null) 'LicenseInfo': licenseInfo,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2018-10-31/layers/${Uri.encodeComponent(layerName)}/versions',
    exceptionFnMap: _exceptionFns,
  );
  return PublishLayerVersionResponse.fromJson(response);
}