@Generated(value="jsii-pacmak/1.24.0 (build b722f66)", date="2021-03-11T13:46:44.562Z") @Stability(value=Stable) public class Function extends FunctionBase
The supplied file is subject to the 4096 bytes limit of being embedded in a CloudFormation template.
The construct includes an associated role with the lambda.
This construct does not yet reproduce all features from the underlying resource library.
| Modifier and Type | Class and Description |
|---|---|
static class |
Function.Builder
A fluent builder for
Function. |
software.amazon.jsii.JsiiObject.InitializationModeIFunction.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
Function(software.constructs.Construct scope,
String id,
FunctionProps props) |
protected |
Function(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Function(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Function |
addEnvironment(String key,
String value)
Adds an environment variable to this Lambda function.
|
Function |
addEnvironment(String key,
String value,
EnvironmentOptions options)
Adds an environment variable to this Lambda function.
|
void |
addLayers(ILayerVersion... layers)
Adds one or more Lambda Layers to this Lambda function.
|
Version |
addVersion(String name)
Deprecated.
This method will create an AWS::Lambda::Version resource which
snapshots the AWS Lambda function *at the time of its creation* and it
won't get updated when the function changes. Instead, use
`this.currentVersion` to obtain a reference to a version resource that gets
automatically recreated when the function configuration (or code) changes.
|
Version |
addVersion(String name,
String codeSha256)
Deprecated.
This method will create an AWS::Lambda::Version resource which
snapshots the AWS Lambda function *at the time of its creation* and it
won't get updated when the function changes. Instead, use
`this.currentVersion` to obtain a reference to a version resource that gets
automatically recreated when the function configuration (or code) changes.
|
Version |
addVersion(String name,
String codeSha256,
String description)
Deprecated.
This method will create an AWS::Lambda::Version resource which
snapshots the AWS Lambda function *at the time of its creation* and it
won't get updated when the function changes. Instead, use
`this.currentVersion` to obtain a reference to a version resource that gets
automatically recreated when the function configuration (or code) changes.
|
Version |
addVersion(String name,
String codeSha256,
String description,
Number provisionedExecutions)
Deprecated.
This method will create an AWS::Lambda::Version resource which
snapshots the AWS Lambda function *at the time of its creation* and it
won't get updated when the function changes. Instead, use
`this.currentVersion` to obtain a reference to a version resource that gets
automatically recreated when the function configuration (or code) changes.
|
Version |
addVersion(String name,
String codeSha256,
String description,
Number provisionedExecutions,
EventInvokeConfigOptions asyncInvokeConfig)
Deprecated.
This method will create an AWS::Lambda::Version resource which
snapshots the AWS Lambda function *at the time of its creation* and it
won't get updated when the function changes. Instead, use
`this.currentVersion` to obtain a reference to a version resource that gets
automatically recreated when the function configuration (or code) changes.
|
static IFunction |
fromFunctionArn(software.constructs.Construct scope,
String id,
String functionArn) |
static IFunction |
fromFunctionAttributes(software.constructs.Construct scope,
String id,
FunctionAttributes attrs)
Creates a Lambda function object which represents a function not defined within this stack.
|
protected Boolean |
getCanCreatePermissions()
Whether the addPermission() call adds any permissions.
|
Version |
getCurrentVersion()
Returns a `lambda.Version` which represents the current version of this Lambda function.
|
IQueue |
getDeadLetterQueue()
The DLQ associated with this Lambda Function (this is an optional attribute).
|
String |
getFunctionArn()
ARN of this function.
|
String |
getFunctionName()
Name of this function.
|
IPrincipal |
getGrantPrincipal()
The principal this Lambda Function is running as.
|
ILogGroup |
getLogGroup()
The LogGroup where the Lambda function's logs are made available.
|
ConstructNode |
getPermissionsNode()
The construct node where permissions are attached.
|
IRole |
getRole()
Execution role associated with this function.
|
Runtime |
getRuntime()
The runtime configured for this lambda.
|
static Metric |
metricAll(String metricName)
Return the given named metric for this Lambda.
|
static Metric |
metricAll(String metricName,
MetricOptions props)
Return the given named metric for this Lambda.
|
static Metric |
metricAllConcurrentExecutions()
Metric for the number of concurrent executions across all Lambdas.
|
static Metric |
metricAllConcurrentExecutions(MetricOptions props)
Metric for the number of concurrent executions across all Lambdas.
|
static Metric |
metricAllDuration()
Metric for the Duration executing all Lambdas.
|
static Metric |
metricAllDuration(MetricOptions props)
Metric for the Duration executing all Lambdas.
|
static Metric |
metricAllErrors()
Metric for the number of Errors executing all Lambdas.
|
static Metric |
metricAllErrors(MetricOptions props)
Metric for the number of Errors executing all Lambdas.
|
static Metric |
metricAllInvocations()
Metric for the number of invocations of all Lambdas.
|
static Metric |
metricAllInvocations(MetricOptions props)
Metric for the number of invocations of all Lambdas.
|
static Metric |
metricAllThrottles()
Metric for the number of throttled invocations of all Lambdas.
|
static Metric |
metricAllThrottles(MetricOptions props)
Metric for the number of throttled invocations of all Lambdas.
|
static Metric |
metricAllUnreservedConcurrentExecutions()
Metric for the number of unreserved concurrent executions across all Lambdas.
|
static Metric |
metricAllUnreservedConcurrentExecutions(MetricOptions props)
Metric for the number of unreserved concurrent executions across all Lambdas.
|
addEventSource, addEventSourceMapping, addPermission, addToRolePolicy, configureAsyncInvoke, getConnections, getIsBoundToVpc, getLatestVersion, grantInvoke, metric, metric, metricDuration, metricDuration, metricErrors, metricErrors, metricInvocations, metricInvocations, metricThrottles, metricThrottlesapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetNodeprotected Function(software.amazon.jsii.JsiiObjectRef objRef)
protected Function(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Function(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
FunctionProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IFunction fromFunctionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String functionArn)
scope - This parameter is required.id - This parameter is required.functionArn - This parameter is required.@Stability(value=Stable) @NotNull public static IFunction fromFunctionAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FunctionAttributes attrs)
scope - The parent construct. This parameter is required.id - The name of the lambda construct. This parameter is required.attrs - the attributes of the function to import. This parameter is required.@Stability(value=Stable) @NotNull public static Metric metricAll(@NotNull String metricName, @Nullable MetricOptions props)
metricName - This parameter is required.props - @Stability(value=Stable) @NotNull public static Metric metricAll(@NotNull String metricName)
metricName - This parameter is required.@Stability(value=Stable) @NotNull public static Metric metricAllConcurrentExecutions(@Nullable MetricOptions props)
Default: max over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllConcurrentExecutions()
Default: max over 5 minutes
@Stability(value=Stable) @NotNull public static Metric metricAllDuration(@Nullable MetricOptions props)
Default: average over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllDuration()
Default: average over 5 minutes
@Stability(value=Stable) @NotNull public static Metric metricAllErrors(@Nullable MetricOptions props)
Default: sum over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllErrors()
Default: sum over 5 minutes
@Stability(value=Stable) @NotNull public static Metric metricAllInvocations(@Nullable MetricOptions props)
Default: sum over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllInvocations()
Default: sum over 5 minutes
@Stability(value=Stable) @NotNull public static Metric metricAllThrottles(@Nullable MetricOptions props)
Default: sum over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllThrottles()
Default: sum over 5 minutes
@Stability(value=Stable) @NotNull public static Metric metricAllUnreservedConcurrentExecutions(@Nullable MetricOptions props)
Default: max over 5 minutes
props - @Stability(value=Stable) @NotNull public static Metric metricAllUnreservedConcurrentExecutions()
Default: max over 5 minutes
@Stability(value=Stable) @NotNull public Function addEnvironment(@NotNull String key, @NotNull String value, @Nullable EnvironmentOptions options)
If this is a ref to a Lambda function, this operation results in a no-op.
key - The environment variable key. This parameter is required.value - The environment variable's value. This parameter is required.options - Environment variable options.@Stability(value=Stable) @NotNull public Function addEnvironment(@NotNull String key, @NotNull String value)
If this is a ref to a Lambda function, this operation results in a no-op.
key - The environment variable key. This parameter is required.value - The environment variable's value. This parameter is required.@Stability(value=Stable)
public void addLayers(@NotNull
ILayerVersion... layers)
layers - the layers to be added. This parameter is required.@Stability(value=Deprecated) @Deprecated @NotNull public Version addVersion(@NotNull String name, @Nullable String codeSha256, @Nullable String description, @Nullable Number provisionedExecutions, @Nullable EventInvokeConfigOptions asyncInvokeConfig)
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
name - A unique name for this version. This parameter is required.codeSha256 - The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.description - A description for this version.provisionedExecutions - A provisioned concurrency configuration for a function's version.asyncInvokeConfig - configuration for this version when it is invoked asynchronously.@Stability(value=Deprecated) @Deprecated @NotNull public Version addVersion(@NotNull String name, @Nullable String codeSha256, @Nullable String description, @Nullable Number provisionedExecutions)
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
name - A unique name for this version. This parameter is required.codeSha256 - The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.description - A description for this version.provisionedExecutions - A provisioned concurrency configuration for a function's version.@Stability(value=Deprecated) @Deprecated @NotNull public Version addVersion(@NotNull String name, @Nullable String codeSha256, @Nullable String description)
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
name - A unique name for this version. This parameter is required.codeSha256 - The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.description - A description for this version.@Stability(value=Deprecated) @Deprecated @NotNull public Version addVersion(@NotNull String name, @Nullable String codeSha256)
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
name - A unique name for this version. This parameter is required.codeSha256 - The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.@Stability(value=Deprecated) @Deprecated @NotNull public Version addVersion(@NotNull String name)
If you want to deploy through CloudFormation and use aliases, you need to add a new version (with a new name) to your Lambda every time you want to deploy an update. An alias can then refer to the newly created Version.
All versions should have distinct names, and you should not delete versions as long as your Alias needs to refer to them.
name - A unique name for this version. This parameter is required.@Stability(value=Stable) @NotNull protected Boolean getCanCreatePermissions()
True for new Lambdas, false for version $LATEST and imported Lambdas from different accounts.
getCanCreatePermissions in class FunctionBase@Stability(value=Stable) @NotNull public Version getCurrentVersion()
You can specify options for this version using the currentVersionOptions
prop when initializing the lambda.Function.
@Stability(value=Stable) @NotNull public String getFunctionArn()
getFunctionArn in interface IFunctiongetFunctionArn in class FunctionBase@Stability(value=Stable) @NotNull public String getFunctionName()
getFunctionName in interface IFunctiongetFunctionName in class FunctionBase@Stability(value=Stable) @NotNull public IPrincipal getGrantPrincipal()
getGrantPrincipal in interface IGrantablegetGrantPrincipal in class FunctionBase@Stability(value=Stable) @NotNull public ILogGroup getLogGroup()
If either logRetention is set or this property is called, a CloudFormation custom resource is added to the stack that
pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention
period (never expire, by default).
Further, if the log group already exists and the logRetention is not set, the custom resource will reset the log retention
to never expire even if it was configured with a different value.
@Stability(value=Stable) @NotNull public ConstructNode getPermissionsNode()
getPermissionsNode in interface IFunctiongetPermissionsNode in class FunctionBase@Stability(value=Stable) @NotNull public Runtime getRuntime()
@Stability(value=Stable) @Nullable public IQueue getDeadLetterQueue()
@Stability(value=Stable) @Nullable public IRole getRole()
getRole in interface IFunctiongetRole in class FunctionBaseCopyright © 2021. All rights reserved.