updateAlias method

Future<AliasConfiguration> updateAlias({
  1. required String functionName,
  2. required String name,
  3. String? description,
  4. String? functionVersion,
  5. String? revisionId,
  6. AliasRoutingConfiguration? routingConfig,
})

Updates the configuration of a Lambda function alias.

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

Parameter functionName : The name of the Lambda function.

Name formats

  • Function name - MyFunction.
  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.
  • Partial ARN - 123456789012:function:MyFunction.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Parameter name : The name of the alias.

Parameter description : A description of the alias.

Parameter functionVersion : The function version that the alias invokes.

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

Parameter routingConfig : The routing configuration of the alias.

Implementation

Future<AliasConfiguration> updateAlias({
  required String functionName,
  required String name,
  String? description,
  String? functionVersion,
  String? revisionId,
  AliasRoutingConfiguration? routingConfig,
}) async {
  ArgumentError.checkNotNull(functionName, 'functionName');
  _s.validateStringLength(
    'functionName',
    functionName,
    1,
    140,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    256,
  );
  _s.validateStringLength(
    'functionVersion',
    functionVersion,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    if (description != null) 'Description': description,
    if (functionVersion != null) 'FunctionVersion': functionVersion,
    if (revisionId != null) 'RevisionId': revisionId,
    if (routingConfig != null) 'RoutingConfig': routingConfig,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/2015-03-31/functions/${Uri.encodeComponent(functionName)}/aliases/${Uri.encodeComponent(name)}',
    exceptionFnMap: _exceptionFns,
  );
  return AliasConfiguration.fromJson(response);
}