removeLayerVersionPermission method

Future<void> removeLayerVersionPermission({
  1. required String layerName,
  2. required String statementId,
  3. required int versionNumber,
  4. String? revisionId,
})

Removes a statement from the permissions policy for a version of an AWS Lambda layer. For more information, see AddLayerVersionPermission.

May throw ServiceException. May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw TooManyRequestsException. May throw PreconditionFailedException.

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

Parameter statementId : The identifier that was specified when the statement was added.

Parameter versionNumber : The version number.

Parameter revisionId : Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.

Implementation

Future<void> removeLayerVersionPermission({
  required String layerName,
  required String statementId,
  required int versionNumber,
  String? revisionId,
}) async {
  ArgumentError.checkNotNull(layerName, 'layerName');
  _s.validateStringLength(
    'layerName',
    layerName,
    1,
    140,
    isRequired: true,
  );
  ArgumentError.checkNotNull(statementId, 'statementId');
  _s.validateStringLength(
    'statementId',
    statementId,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(versionNumber, 'versionNumber');
  final $query = <String, List<String>>{
    if (revisionId != null) 'RevisionId': [revisionId],
  };
  await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/2018-10-31/layers/${Uri.encodeComponent(layerName)}/versions/${Uri.encodeComponent(versionNumber.toString())}/policy/${Uri.encodeComponent(statementId)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}