Show / Hide Table of Contents

Class ALambdaCustomResourceFunction<TProperties, TAttributes>

The ALambdaCustomResourceFunction<TProperties, TAttributes> is the abstract base class for handling custom resources in AWS CloudFormation. This class takes care of handling the communication protocol with the AWS CloudFormation service. Depending on the requested operation, the base class invokes either ProcessCreateResourceAsync(Request<TProperties>, CancellationToken), ProcessUpdateResourceAsync(Request<TProperties>, CancellationToken), or ProcessDeleteResourceAsync(Request<TProperties>, CancellationToken). In case of failure, the AWS CloudFormation service is automatically notified to avoid prolonged timeout errors during a CloudFormation stack operation.

Inheritance
System.Object
ALambdaFunction
ALambdaCustomResourceFunction<TProperties, TAttributes>
Implements
ILambdaSharpLogger
Inherited Members
ALambdaFunction.Provider
ALambdaFunction.UtcNow
ALambdaFunction.Info
ALambdaFunction.ErrorReportGenerator
ALambdaFunction.Logger
ALambdaFunction.CurrentContext
ALambdaFunction.HttpClient
ALambdaFunction.DebugLoggingEnabled
ALambdaFunction.InitializeAsync(LambdaConfig)
ALambdaFunction.FunctionHandlerAsync(Stream, ILambdaContext)
ALambdaFunction.InitializePrologueAsync(ILambdaConfigSource)
ALambdaFunction.InitializeEpilogueAsync()
ALambdaFunction.RecordFailedMessageAsync(LambdaLogLevel, ALambdaFunction.FailedMessageOrigin, String, Exception)
ALambdaFunction.DecryptSecretAsync(String, Dictionary<String, String>, CancellationToken)
ALambdaFunction.EncryptSecretAsync(String, String, Dictionary<String, String>, CancellationToken)
ALambdaFunction.AddPendingTask(Task)
ALambdaFunction.RunTask(Action, CancellationToken)
ALambdaFunction.RunTask(Func<Task>, CancellationToken)
ALambdaFunction.ForceLambdaColdStart(String)
ALambdaFunction.TerminateLambdaInstance(String)
ALambdaFunction.RecordErrorReport(LambdaErrorReport)
ALambdaFunction.RecordException(Exception)
ALambdaFunction.LogDebug(String, Object[])
ALambdaFunction.LogInfo(String, Object[])
ALambdaFunction.LogWarn(String, Object[])
ALambdaFunction.LogError(Exception)
ALambdaFunction.LogError(Exception, String, Object[])
ALambdaFunction.LogErrorAsInfo(Exception)
ALambdaFunction.LogErrorAsInfo(Exception, String, Object[])
ALambdaFunction.LogErrorAsWarning(Exception)
ALambdaFunction.LogErrorAsWarning(Exception, String, Object[])
ALambdaFunction.LogFatal(Exception, String, Object[])
ALambdaFunction.LogMetric(String, Double, LambdaMetricUnit)
ALambdaFunction.LogMetric(String, Double, LambdaMetricUnit, IEnumerable<String>, Dictionary<String, String>)
ALambdaFunction.LogMetric(IEnumerable<LambdaMetric>)
ALambdaFunction.LogMetric(IEnumerable<LambdaMetric>, IEnumerable<String>, Dictionary<String, String>)
ALambdaFunction.LogEvent<T>(T, IEnumerable<String>)
ALambdaFunction.LogEvent<T>(String, T, IEnumerable<String>)
ALambdaFunction.LogEvent<T>(String, String, T, IEnumerable<String>)
ALambdaFunction.ILambdaSharpLogger.DebugLoggingEnabled
ALambdaFunction.ILambdaSharpLogger.Info
ALambdaFunction.ILambdaSharpLogger.Log(LambdaLogLevel, Exception, String, Object[])
ALambdaFunction.ILambdaSharpLogger.LogRecord(ALambdaLogRecord)
Namespace: LambdaSharp.CustomResource
Assembly: LambdaSharp.CustomResource.dll
Syntax
public abstract class ALambdaCustomResourceFunction<TProperties, TAttributes> : ALambdaFunction, ILambdaSharpLogger where TProperties : class where TAttributes : class
Type Parameters
Name Description
TProperties

The request properties for the custom resource.

TAttributes

The response attributes for the custom resource.

Constructors

ALambdaCustomResourceFunction(ILambdaJsonSerializer)

Initializes a new ALambdaCustomResourceFunction<TProperties, TAttributes> instance using the default implementation of ILambdaFunctionDependencyProvider.

Declaration
protected ALambdaCustomResourceFunction(ILambdaJsonSerializer serializer)
Parameters
Type Name Description
ILambdaJsonSerializer serializer

Custom implementation of ILambdaJsonSerializer.

ALambdaCustomResourceFunction(ILambdaJsonSerializer, ILambdaFunctionDependencyProvider)

Initializes a new ALambdaCustomResourceFunction<TProperties, TAttributes> instance using a custom implementation of ILambdaFunctionDependencyProvider.

Declaration
protected ALambdaCustomResourceFunction(ILambdaJsonSerializer serializer, ILambdaFunctionDependencyProvider provider)
Parameters
Type Name Description
ILambdaJsonSerializer serializer

Custom implementation of ILambdaJsonSerializer.

ILambdaFunctionDependencyProvider provider

Custom implementation of ILambdaFunctionDependencyProvider.

Properties

LambdaSerializer

An instance of ILambdaJsonSerializer used for serializing/deserializing JSON data.

Declaration
protected ILambdaJsonSerializer LambdaSerializer { get; }
Property Value
Type Description
ILambdaJsonSerializer

The ILambdaJsonSerializer instance.

Methods

Abort(String)

The Abort(String) stops the request processing with an error message.

Declaration
protected Exception Abort(string message)
Parameters
Type Name Description
System.String message

The response message.

Returns
Type Description
System.Exception

Nothing. See remarks.

Remarks

This method never returns as the abort exception is thrown immediately. The System.Exception instance is shown as returned to make it easier to tell the compiler the control flow.

Examples
throw Abort("value for property X is invalid");

HandleFailedInitializationAsync(Stream)

The HandleFailedInitializationAsync(Stream) method is only invoked when an error occurs during the Lambda function initialization. This method can be overridden to provide custom behavior for how to handle such failures more gracefully.

Declaration
protected override async Task HandleFailedInitializationAsync(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

The stream with the request payload.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Overrides
ALambdaFunction.HandleFailedInitializationAsync(Stream)
Remarks

Regardless of what this method does. Once completed, the Lambda function exits by rethrowing the original exception that occurred during initialization.

ProcessCreateResourceAsync(Request<TProperties>, CancellationToken)

The ProcessCreateResourceAsync(Request<TProperties>, CancellationToken) method is invoked when AWS CloudFormation attempts to create a custom resource.

Declaration
public abstract Task<Response<TAttributes>> ProcessCreateResourceAsync(Request<TProperties> request, CancellationToken cancellationToken)
Parameters
Type Name Description
Request<TProperties> request

The CloudFormation request instance.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<Response<TAttributes>>

The task object representing the asynchronous operation.

ProcessDeleteResourceAsync(Request<TProperties>, CancellationToken)

The ProcessDeleteResourceAsync(Request<TProperties>, CancellationToken) method is invoked when AWS CloudFormation attempts to delete a custom resource.

Declaration
public abstract Task<Response<TAttributes>> ProcessDeleteResourceAsync(Request<TProperties> request, CancellationToken cancellationToken)
Parameters
Type Name Description
Request<TProperties> request

The CloudFormation request instance.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<Response<TAttributes>>

The task object representing the asynchronous operation.

ProcessMessageStreamAsync(Stream)

The ProcessMessageStreamAsync(Stream) method handles the communication protocol with the AWS CloudFormation service.

Declaration
public sealed override async Task<Stream> ProcessMessageStreamAsync(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

The stream with the request payload.

Returns
Type Description
System.Threading.Tasks.Task<System.IO.Stream>

The task object representing the asynchronous operation.

Overrides
ALambdaFunction.ProcessMessageStreamAsync(Stream)
Remarks

This method cannot be overridden.

ProcessUpdateResourceAsync(Request<TProperties>, CancellationToken)

The ProcessUpdateResourceAsync(Request<TProperties>, CancellationToken) method is invoked when AWS CloudFormation attempts to update a custom resource.

Declaration
public abstract Task<Response<TAttributes>> ProcessUpdateResourceAsync(Request<TProperties> request, CancellationToken cancellationToken)
Parameters
Type Name Description
Request<TProperties> request

The CloudFormation request instance.

System.Threading.CancellationToken cancellationToken

The token to monitor for cancellation requests.

Returns
Type Description
System.Threading.Tasks.Task<Response<TAttributes>>

The task object representing the asynchronous operation.

Implements

ILambdaSharpLogger
In This Article
Back to top Generated by DocFX