Documentation
¶
Index ¶
- func NewPythonFunction_Override(p PythonFunction, scope awscdk.Construct, id *string, ...)
- func NewPythonLayerVersion_Override(p PythonLayerVersion, scope awscdk.Construct, id *string, ...)
- func PythonFunction_ClassifyVersionProperty(propertyName *string, locked *bool)
- func PythonFunction_FromFunctionArn(scope constructs.Construct, id *string, functionArn *string) awslambda.IFunction
- func PythonFunction_FromFunctionAttributes(scope constructs.Construct, id *string, attrs *awslambda.FunctionAttributes) awslambda.IFunction
- func PythonFunction_FromFunctionName(scope constructs.Construct, id *string, functionName *string) awslambda.IFunction
- func PythonFunction_IsConstruct(x interface{}) *bool
- func PythonFunction_IsResource(construct awscdk.IConstruct) *bool
- func PythonFunction_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllConcurrentExecutions(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllDuration(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonFunction_MetricAllUnreservedConcurrentExecutions(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
- func PythonLayerVersion_FromLayerVersionArn(scope constructs.Construct, id *string, layerVersionArn *string) awslambda.ILayerVersion
- func PythonLayerVersion_FromLayerVersionAttributes(scope constructs.Construct, id *string, ...) awslambda.ILayerVersion
- func PythonLayerVersion_IsConstruct(x interface{}) *bool
- func PythonLayerVersion_IsResource(construct awscdk.IConstruct) *bool
- type BundlingOptions
- type PythonFunction
- type PythonFunctionProps
- type PythonLayerVersion
- type PythonLayerVersionProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPythonFunction_Override ¶
func NewPythonFunction_Override(p PythonFunction, scope awscdk.Construct, id *string, props *PythonFunctionProps)
Experimental.
func NewPythonLayerVersion_Override ¶
func NewPythonLayerVersion_Override(p PythonLayerVersion, scope awscdk.Construct, id *string, props *PythonLayerVersionProps)
Experimental.
func PythonFunction_ClassifyVersionProperty ¶
Record whether specific properties in the `AWS::Lambda::Function` resource should also be associated to the Version resource.
See 'currentVersion' section in the module README for more details. Experimental.
func PythonFunction_FromFunctionArn ¶
func PythonFunction_FromFunctionArn(scope constructs.Construct, id *string, functionArn *string) awslambda.IFunction
Import a lambda function into the CDK using its ARN. Experimental.
func PythonFunction_FromFunctionAttributes ¶
func PythonFunction_FromFunctionAttributes(scope constructs.Construct, id *string, attrs *awslambda.FunctionAttributes) awslambda.IFunction
Creates a Lambda function object which represents a function not defined within this stack. Experimental.
func PythonFunction_FromFunctionName ¶
func PythonFunction_FromFunctionName(scope constructs.Construct, id *string, functionName *string) awslambda.IFunction
Import a lambda function into the CDK using its name. Experimental.
func PythonFunction_IsConstruct ¶
func PythonFunction_IsConstruct(x interface{}) *bool
Return whether the given object is a Construct. Experimental.
func PythonFunction_IsResource ¶
func PythonFunction_IsResource(construct awscdk.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
func PythonFunction_MetricAll ¶
func PythonFunction_MetricAll(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Return the given named metric for this Lambda. Experimental.
func PythonFunction_MetricAllConcurrentExecutions ¶
func PythonFunction_MetricAllConcurrentExecutions(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the number of concurrent executions across all Lambdas. Experimental.
func PythonFunction_MetricAllDuration ¶
func PythonFunction_MetricAllDuration(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the Duration executing all Lambdas. Experimental.
func PythonFunction_MetricAllErrors ¶
func PythonFunction_MetricAllErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the number of Errors executing all Lambdas. Experimental.
func PythonFunction_MetricAllInvocations ¶
func PythonFunction_MetricAllInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the number of invocations of all Lambdas. Experimental.
func PythonFunction_MetricAllThrottles ¶
func PythonFunction_MetricAllThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the number of throttled invocations of all Lambdas. Experimental.
func PythonFunction_MetricAllUnreservedConcurrentExecutions ¶
func PythonFunction_MetricAllUnreservedConcurrentExecutions(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
Metric for the number of unreserved concurrent executions across all Lambdas. Experimental.
func PythonLayerVersion_FromLayerVersionArn ¶
func PythonLayerVersion_FromLayerVersionArn(scope constructs.Construct, id *string, layerVersionArn *string) awslambda.ILayerVersion
Imports a layer version by ARN.
Assumes it is compatible with all Lambda runtimes. Experimental.
func PythonLayerVersion_FromLayerVersionAttributes ¶
func PythonLayerVersion_FromLayerVersionAttributes(scope constructs.Construct, id *string, attrs *awslambda.LayerVersionAttributes) awslambda.ILayerVersion
Imports a Layer that has been defined externally. Experimental.
func PythonLayerVersion_IsConstruct ¶
func PythonLayerVersion_IsConstruct(x interface{}) *bool
Return whether the given object is a Construct. Experimental.
func PythonLayerVersion_IsResource ¶
func PythonLayerVersion_IsResource(construct awscdk.IConstruct) *bool
Check whether the given construct is a Resource. Experimental.
Types ¶
type BundlingOptions ¶
type BundlingOptions struct {
// Specify a custom hash for this asset.
//
// If `assetHashType` is set it must
// be set to `AssetHashType.CUSTOM`. For consistency, this custom hash will
// be SHA256 hashed and encoded as hex. The resulting hash will be the asset
// hash.
//
// NOTE: the hash is used in order to identify a specific revision of the asset, and
// used for optimizing and caching deployment activities related to this asset such as
// packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
// need to make sure it is updated every time the asset changes, or otherwise it is
// possible that some deployments will not be invalidated.
// Experimental.
AssetHash *string `field:"optional" json:"assetHash" yaml:"assetHash"`
// Determines how asset hash is calculated. Assets will get rebuild and uploaded only if their hash has changed.
//
// If asset hash is set to `SOURCE` (default), then only changes to the source
// directory will cause the asset to rebuild. This means, for example, that in
// order to pick up a new dependency version, a change must be made to the
// source tree. Ideally, this can be implemented by including a dependency
// lockfile in your source tree or using fixed dependencies.
//
// If the asset hash is set to `OUTPUT`, the hash is calculated after
// bundling. This means that any change in the output will cause the asset to
// be invalidated and uploaded. Bear in mind that `pip` adds timestamps to
// dependencies it installs, which implies that in this mode Python bundles
// will _always_ get rebuild and uploaded. Normally this is an anti-pattern
// since build.
// Experimental.
AssetHashType awscdk.AssetHashType `field:"optional" json:"assetHashType" yaml:"assetHashType"`
// Optional build arguments to pass to the default container.
//
// This can be used to customize
// the index URLs used for installing dependencies.
// This is not used if a custom image is provided.
// Experimental.
BuildArgs *map[string]*string `field:"optional" json:"buildArgs" yaml:"buildArgs"`
// Environment variables defined when bundling runs.
// Experimental.
Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
// Docker image to use for bundling.
//
// If no options are provided, the default bundling image
// will be used. Dependencies will be installed using the default packaging commands
// and copied over from into the Lambda asset.
// Experimental.
Image awscdk.DockerImage `field:"optional" json:"image" yaml:"image"`
// Output path suffix: the suffix for the directory into which the bundled output is written.
// Experimental.
OutputPathSuffix *string `field:"optional" json:"outputPathSuffix" yaml:"outputPathSuffix"`
}
Options for bundling.
Example:
entry := "/path/to/function"
image := awscdk.DockerImage.fromBuild(entry)
lambda.NewPythonFunction(this, jsii.String("function"), &pythonFunctionProps{
entry: jsii.String(entry),
runtime: awscdk.Runtime_PYTHON_3_8(),
bundling: &bundlingOptions{
buildArgs: map[string]*string{
"PIP_INDEX_URL": jsii.String("https://your.index.url/simple/"),
"PIP_EXTRA_INDEX_URL": jsii.String("https://your.extra-index.url/simple/"),
},
},
})
Experimental.
type PythonFunction ¶
type PythonFunction interface {
awslambda.Function
// The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
// Experimental.
Architecture() awslambda.Architecture
// Whether the addPermission() call adds any permissions.
//
// True for new Lambdas, false for version $LATEST and imported Lambdas
// from different accounts.
// Experimental.
CanCreatePermissions() *bool
// Access the Connections object.
//
// Will fail if not a VPC-enabled Lambda Function.
// Experimental.
Connections() awsec2.Connections
// Returns a `lambda.Version` which represents the current version of this Lambda function. A new version will be created every time the function's configuration changes.
//
// You can specify options for this version using the `currentVersionOptions`
// prop when initializing the `lambda.Function`.
// Experimental.
CurrentVersion() awslambda.Version
// The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).
// Experimental.
DeadLetterQueue() awssqs.IQueue
// The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).
// Experimental.
DeadLetterTopic() awssns.ITopic
// The environment this resource belongs to.
//
// For resources that are created and managed by the CDK
// (generally, those created by creating new class instances like Role, Bucket, etc.),
// this is always the same as the environment of the stack they belong to;
// however, for imported resources
// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
// that might be different than the stack they were imported into.
// Experimental.
Env() *awscdk.ResourceEnvironment
// ARN of this function.
// Experimental.
FunctionArn() *string
// Name of this function.
// Experimental.
FunctionName() *string
// The principal this Lambda Function is running as.
// Experimental.
GrantPrincipal() awsiam.IPrincipal
// Whether or not this Lambda function was bound to a VPC.
//
// If this is is `false`, trying to access the `connections` object will fail.
// Experimental.
IsBoundToVpc() *bool
// The `$LATEST` version of this function.
//
// Note that this is reference to a non-specific AWS Lambda version, which
// means the function this version refers to can return different results in
// different invocations.
//
// To obtain a reference to an explicit version which references the current
// function configuration, use `lambdaFunction.currentVersion` instead.
// Experimental.
LatestVersion() awslambda.IVersion
// The LogGroup where the Lambda function's logs are made available.
//
// 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.
// Experimental.
LogGroup() awslogs.ILogGroup
// The construct tree node associated with this construct.
// Experimental.
Node() awscdk.ConstructNode
// The construct node where permissions are attached.
// Experimental.
PermissionsNode() awscdk.ConstructNode
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
// Experimental.
ResourceArnsForGrantInvoke() *[]*string
// Execution role associated with this function.
// Experimental.
Role() awsiam.IRole
// The runtime configured for this lambda.
// Experimental.
Runtime() awslambda.Runtime
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// The timeout configured for this lambda.
// Experimental.
Timeout() awscdk.Duration
// Defines an alias for this function.
//
// The alias will automatically be updated to point to the latest version of
// the function as it is being updated during a deployment.
//
// “`ts
// declare const fn: lambda.Function;
//
// fn.addAlias('Live');
//
// // Is equivalent to
//
// new lambda.Alias(this, 'AliasLive', {
// aliasName: 'Live',
// version: fn.currentVersion,
// });.
// Experimental.
AddAlias(aliasName *string, options *awslambda.AliasOptions) awslambda.Alias
// Adds an environment variable to this Lambda function.
//
// If this is a ref to a Lambda function, this operation results in a no-op.
// Experimental.
AddEnvironment(key *string, value *string, options *awslambda.EnvironmentOptions) awslambda.Function
// Adds an event source to this function.
//
// Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.
//
// The following example adds an SQS Queue as an event source:
// “`
// import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
// myFunction.addEventSource(new SqsEventSource(myQueue));
// “`.
// Experimental.
AddEventSource(source awslambda.IEventSource)
// Adds an event source that maps to this AWS Lambda function.
// Experimental.
AddEventSourceMapping(id *string, options *awslambda.EventSourceMappingOptions) awslambda.EventSourceMapping
// Adds a url to this lambda function.
// Experimental.
AddFunctionUrl(options *awslambda.FunctionUrlOptions) awslambda.FunctionUrl
// Adds one or more Lambda Layers to this Lambda function.
// Experimental.
AddLayers(layers ...awslambda.ILayerVersion)
// Adds a permission to the Lambda resource policy.
// See: Permission for details.
//
// Experimental.
AddPermission(id *string, permission *awslambda.Permission)
// Adds a statement to the IAM role assumed by the instance.
// Experimental.
AddToRolePolicy(statement awsiam.PolicyStatement)
// Add a new version for this Lambda.
//
// 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.
//
// Returns: A new Version object.
// 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.
AddVersion(name *string, codeSha256 *string, description *string, provisionedExecutions *float64, asyncInvokeConfig *awslambda.EventInvokeConfigOptions) awslambda.Version
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Configures options for asynchronous invocation.
// Experimental.
ConfigureAsyncInvoke(options *awslambda.EventInvokeConfigOptions)
// A warning will be added to functions under the following conditions: - permissions that include `lambda:InvokeFunction` are added to the unqualified function.
//
// - function.currentVersion is invoked before or after the permission is created.
//
// This applies only to permissions on Lambda functions, not versions or aliases.
// This function is overridden as a noOp for QualifiedFunctionBase.
// Experimental.
ConsiderWarningOnInvokeFunctionPermissions(scope awscdk.Construct, action *string)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Grant the given identity permissions to invoke this Lambda.
// Experimental.
GrantInvoke(grantee awsiam.IGrantable) awsiam.Grant
// Grant the given identity permissions to invoke this Lambda Function URL.
// Experimental.
GrantInvokeUrl(grantee awsiam.IGrantable) awsiam.Grant
// Return the given named metric for this Function.
// Experimental.
Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// How long execution of this Lambda takes.
//
// Average over 5 minutes.
// Experimental.
MetricDuration(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// How many invocations of this Lambda fail.
//
// Sum over 5 minutes.
// Experimental.
MetricErrors(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// How often this Lambda is invoked.
//
// Sum over 5 minutes.
// Experimental.
MetricInvocations(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// How often this Lambda is throttled.
//
// Sum over 5 minutes.
// Experimental.
MetricThrottles(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
// Perform final modifications before synthesis.
//
// This method can be implemented by derived constructs in order to perform
// final changes before synthesis. prepare() will be called after child
// constructs have been prepared.
//
// This is an advanced framework feature. Only use this if you
// understand the implications.
// Experimental.
OnPrepare()
// Allows this construct to emit artifacts into the cloud assembly during synthesis.
//
// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
// as they participate in synthesizing the cloud assembly.
// Experimental.
OnSynthesize(session constructs.ISynthesisSession)
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if the construct is valid.
// Experimental.
OnValidate() *[]*string
// Perform final modifications before synthesis.
//
// This method can be implemented by derived constructs in order to perform
// final changes before synthesis. prepare() will be called after child
// constructs have been prepared.
//
// This is an advanced framework feature. Only use this if you
// understand the implications.
// Experimental.
Prepare()
// Allows this construct to emit artifacts into the cloud assembly during synthesis.
//
// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
// as they participate in synthesizing the cloud assembly.
// Experimental.
Synthesize(session awscdk.ISynthesisSession)
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if the construct is valid.
// Experimental.
Validate() *[]*string
// Experimental.
WarnInvokeFunctionPermissions(scope awscdk.Construct)
}
A Python Lambda function.
Example:
entry := "/path/to/function"
image := awscdk.DockerImage.fromBuild(entry)
lambda.NewPythonFunction(this, jsii.String("function"), &pythonFunctionProps{
entry: jsii.String(entry),
runtime: awscdk.Runtime_PYTHON_3_8(),
bundling: &bundlingOptions{
buildArgs: map[string]*string{
"PIP_INDEX_URL": jsii.String("https://your.index.url/simple/"),
"PIP_EXTRA_INDEX_URL": jsii.String("https://your.extra-index.url/simple/"),
},
},
})
Experimental.
func NewPythonFunction ¶
func NewPythonFunction(scope awscdk.Construct, id *string, props *PythonFunctionProps) PythonFunction
Experimental.
type PythonFunctionProps ¶
type PythonFunctionProps struct {
// The maximum age of a request that Lambda sends to a function for processing.
//
// Minimum: 60 seconds
// Maximum: 6 hours.
// Experimental.
MaxEventAge awscdk.Duration `field:"optional" json:"maxEventAge" yaml:"maxEventAge"`
// The destination for failed invocations.
// Experimental.
OnFailure awslambda.IDestination `field:"optional" json:"onFailure" yaml:"onFailure"`
// The destination for successful invocations.
// Experimental.
OnSuccess awslambda.IDestination `field:"optional" json:"onSuccess" yaml:"onSuccess"`
// The maximum number of times to retry when the function returns an error.
//
// Minimum: 0
// Maximum: 2.
// Experimental.
RetryAttempts *float64 `field:"optional" json:"retryAttempts" yaml:"retryAttempts"`
// Whether to allow the Lambda to send all network traffic.
//
// If set to false, you must individually add traffic rules to allow the
// Lambda to connect to network targets.
// Experimental.
AllowAllOutbound *bool `field:"optional" json:"allowAllOutbound" yaml:"allowAllOutbound"`
// Lambda Functions in a public subnet can NOT access the internet.
//
// Use this property to acknowledge this limitation and still place the function in a public subnet.
// See: https://stackoverflow.com/questions/52992085/why-cant-an-aws-lambda-function-inside-a-public-subnet-in-a-vpc-connect-to-the/52994841#52994841
//
// Experimental.
AllowPublicSubnet *bool `field:"optional" json:"allowPublicSubnet" yaml:"allowPublicSubnet"`
// The system architectures compatible with this lambda function.
// Experimental.
Architecture awslambda.Architecture `field:"optional" json:"architecture" yaml:"architecture"`
// DEPRECATED.
// Deprecated: use `architecture`.
Architectures *[]awslambda.Architecture `field:"optional" json:"architectures" yaml:"architectures"`
// Code signing config associated with this function.
// Experimental.
CodeSigningConfig awslambda.ICodeSigningConfig `field:"optional" json:"codeSigningConfig" yaml:"codeSigningConfig"`
// Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.
// Experimental.
CurrentVersionOptions *awslambda.VersionOptions `field:"optional" json:"currentVersionOptions" yaml:"currentVersionOptions"`
// The SQS queue to use if DLQ is enabled.
//
// If SNS topic is desired, specify `deadLetterTopic` property instead.
// Experimental.
DeadLetterQueue awssqs.IQueue `field:"optional" json:"deadLetterQueue" yaml:"deadLetterQueue"`
// Enabled DLQ.
//
// If `deadLetterQueue` is undefined,
// an SQS queue with default options will be defined for your Function.
// Experimental.
DeadLetterQueueEnabled *bool `field:"optional" json:"deadLetterQueueEnabled" yaml:"deadLetterQueueEnabled"`
// The SNS topic to use as a DLQ.
//
// Note that if `deadLetterQueueEnabled` is set to `true`, an SQS queue will be created
// rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.
// Experimental.
DeadLetterTopic awssns.ITopic `field:"optional" json:"deadLetterTopic" yaml:"deadLetterTopic"`
// A description of the function.
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// Key-value pairs that Lambda caches and makes available for your Lambda functions.
//
// Use environment variables to apply configuration changes, such
// as test and production environment configurations, without changing your
// Lambda function source code.
// Experimental.
Environment *map[string]*string `field:"optional" json:"environment" yaml:"environment"`
// The AWS KMS key that's used to encrypt your function's environment variables.
// Experimental.
EnvironmentEncryption awskms.IKey `field:"optional" json:"environmentEncryption" yaml:"environmentEncryption"`
// The size of the function’s /tmp directory in MiB.
// Experimental.
EphemeralStorageSize awscdk.Size `field:"optional" json:"ephemeralStorageSize" yaml:"ephemeralStorageSize"`
// Event sources for this function.
//
// You can also add event sources using `addEventSource`.
// Experimental.
Events *[]awslambda.IEventSource `field:"optional" json:"events" yaml:"events"`
// The filesystem configuration for the lambda function.
// Experimental.
Filesystem awslambda.FileSystem `field:"optional" json:"filesystem" yaml:"filesystem"`
// A name for the function.
// Experimental.
FunctionName *string `field:"optional" json:"functionName" yaml:"functionName"`
// Initial policy statements to add to the created Lambda Role.
//
// You can call `addToRolePolicy` to the created lambda to add statements post creation.
// Experimental.
InitialPolicy *[]awsiam.PolicyStatement `field:"optional" json:"initialPolicy" yaml:"initialPolicy"`
// Specify the version of CloudWatch Lambda insights to use for monitoring.
// See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started-docker.html
//
// Experimental.
InsightsVersion awslambda.LambdaInsightsVersion `field:"optional" json:"insightsVersion" yaml:"insightsVersion"`
// A list of layers to add to the function's execution environment.
//
// You can configure your Lambda function to pull in
// additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies
// that can be used by multiple functions.
// Experimental.
Layers *[]awslambda.ILayerVersion `field:"optional" json:"layers" yaml:"layers"`
// The number of days log events are kept in CloudWatch Logs.
//
// When updating
// this property, unsetting it doesn't remove the log retention policy. To
// remove the retention policy, set the value to `INFINITE`.
// Experimental.
LogRetention awslogs.RetentionDays `field:"optional" json:"logRetention" yaml:"logRetention"`
// When log retention is specified, a custom resource attempts to create the CloudWatch log group.
//
// These options control the retry policy when interacting with CloudWatch APIs.
// Experimental.
LogRetentionRetryOptions *awslambda.LogRetentionRetryOptions `field:"optional" json:"logRetentionRetryOptions" yaml:"logRetentionRetryOptions"`
// The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
// Experimental.
LogRetentionRole awsiam.IRole `field:"optional" json:"logRetentionRole" yaml:"logRetentionRole"`
// The amount of memory, in MB, that is allocated to your Lambda function.
//
// Lambda uses this value to proportionally allocate the amount of CPU
// power. For more information, see Resource Model in the AWS Lambda
// Developer Guide.
// Experimental.
MemorySize *float64 `field:"optional" json:"memorySize" yaml:"memorySize"`
// Enable profiling.
// See: https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
//
// Experimental.
Profiling *bool `field:"optional" json:"profiling" yaml:"profiling"`
// Profiling Group.
// See: https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
//
// Experimental.
ProfilingGroup awscodeguruprofiler.IProfilingGroup `field:"optional" json:"profilingGroup" yaml:"profilingGroup"`
// The maximum of concurrent executions you want to reserve for the function.
// See: https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html
//
// Experimental.
ReservedConcurrentExecutions *float64 `field:"optional" json:"reservedConcurrentExecutions" yaml:"reservedConcurrentExecutions"`
// Lambda execution role.
//
// This is the role that will be assumed by the function upon execution.
// It controls the permissions that the function will have. The Role must
// be assumable by the 'lambda.amazonaws.com' service principal.
//
// The default Role automatically has permissions granted for Lambda execution. If you
// provide a Role, you must add the relevant AWS managed policies yourself.
//
// The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and
// "service-role/AWSLambdaVPCAccessExecutionRole".
// Experimental.
Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
// What security group to associate with the Lambda's network interfaces. This property is being deprecated, consider using securityGroups instead.
//
// Only used if 'vpc' is supplied.
//
// Use securityGroups property instead.
// Function constructor will throw an error if both are specified.
// Deprecated: - This property is deprecated, use securityGroups instead.
SecurityGroup awsec2.ISecurityGroup `field:"optional" json:"securityGroup" yaml:"securityGroup"`
// The list of security groups to associate with the Lambda's network interfaces.
//
// Only used if 'vpc' is supplied.
// Experimental.
SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
// The function execution time (in seconds) after which Lambda terminates the function.
//
// Because the execution time affects cost, set this value
// based on the function's expected execution time.
// Experimental.
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// Enable AWS X-Ray Tracing for Lambda Function.
// Experimental.
Tracing awslambda.Tracing `field:"optional" json:"tracing" yaml:"tracing"`
// VPC network to place Lambda network interfaces.
//
// Specify this if the Lambda function needs to access resources in a VPC.
// Experimental.
Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
// Where to place the network interfaces within the VPC.
//
// Only used if 'vpc' is supplied. Note: internet access for Lambdas
// requires a NAT gateway, so picking Public subnets is not allowed.
// Experimental.
VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
// Path to the source of the function or the location for dependencies.
// Experimental.
Entry *string `field:"required" json:"entry" yaml:"entry"`
// The runtime environment.
//
// Only runtimes of the Python family are
// supported.
// Experimental.
Runtime awslambda.Runtime `field:"required" json:"runtime" yaml:"runtime"`
// Bundling options to use for this function.
//
// Use this to specify custom bundling options like
// the bundling Docker image, asset hash type, custom hash, architecture, etc.
// Experimental.
Bundling *BundlingOptions `field:"optional" json:"bundling" yaml:"bundling"`
// The name of the exported handler in the index file.
// Experimental.
Handler *string `field:"optional" json:"handler" yaml:"handler"`
// The path (relative to entry) to the index file containing the exported handler.
// Experimental.
Index *string `field:"optional" json:"index" yaml:"index"`
}
Properties for a PythonFunction.
Example:
entry := "/path/to/function"
image := awscdk.DockerImage.fromBuild(entry)
lambda.NewPythonFunction(this, jsii.String("function"), &pythonFunctionProps{
entry: jsii.String(entry),
runtime: awscdk.Runtime_PYTHON_3_8(),
bundling: &bundlingOptions{
buildArgs: map[string]*string{
"PIP_INDEX_URL": jsii.String("https://your.index.url/simple/"),
"PIP_EXTRA_INDEX_URL": jsii.String("https://your.extra-index.url/simple/"),
},
},
})
Experimental.
type PythonLayerVersion ¶
type PythonLayerVersion interface {
awslambda.LayerVersion
// The runtimes compatible with this Layer.
// Experimental.
CompatibleRuntimes() *[]awslambda.Runtime
// The environment this resource belongs to.
//
// For resources that are created and managed by the CDK
// (generally, those created by creating new class instances like Role, Bucket, etc.),
// this is always the same as the environment of the stack they belong to;
// however, for imported resources
// (those obtained from static methods like fromRoleArn, fromBucketName, etc.),
// that might be different than the stack they were imported into.
// Experimental.
Env() *awscdk.ResourceEnvironment
// The ARN of the Lambda Layer version that this Layer defines.
// Experimental.
LayerVersionArn() *string
// The construct tree node associated with this construct.
// Experimental.
Node() awscdk.ConstructNode
// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
//
// This value will resolve to one of the following:
// - a concrete value (e.g. `"my-awesome-bucket"`)
// - `undefined`, when a name should be generated by CloudFormation
// - a concrete name generated automatically during synthesis, in
// cross-environment scenarios.
// Experimental.
PhysicalName() *string
// The stack in which this resource is defined.
// Experimental.
Stack() awscdk.Stack
// Add permission for this layer version to specific entities.
//
// Usage within
// the same account where the layer is defined is always allowed and does not
// require calling this method. Note that the principal that creates the
// Lambda function using the layer (for example, a CloudFormation changeset
// execution role) also needs to have the “lambda:GetLayerVersion“
// permission on the layer version.
// Experimental.
AddPermission(id *string, permission *awslambda.LayerVersionPermission)
// Apply the given removal policy to this resource.
//
// The Removal Policy controls what happens to this resource when it stops
// being managed by CloudFormation, either because you've removed it from the
// CDK application or because you've made a change that requires the resource
// to be replaced.
//
// The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
// account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
// Experimental.
ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
// Experimental.
GeneratePhysicalName() *string
// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
//
// Normally, this token will resolve to `arnAttr`, but if the resource is
// referenced across environments, `arnComponents` will be used to synthesize
// a concrete ARN with the resource's physical name. Make sure to reference
// `this.physicalName` in `arnComponents`.
// Experimental.
GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
//
// Normally, this token will resolve to `nameAttr`, but if the resource is
// referenced across environments, it will be resolved to `this.physicalName`,
// which will be a concrete name.
// Experimental.
GetResourceNameAttribute(nameAttr *string) *string
// Perform final modifications before synthesis.
//
// This method can be implemented by derived constructs in order to perform
// final changes before synthesis. prepare() will be called after child
// constructs have been prepared.
//
// This is an advanced framework feature. Only use this if you
// understand the implications.
// Experimental.
OnPrepare()
// Allows this construct to emit artifacts into the cloud assembly during synthesis.
//
// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
// as they participate in synthesizing the cloud assembly.
// Experimental.
OnSynthesize(session constructs.ISynthesisSession)
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if the construct is valid.
// Experimental.
OnValidate() *[]*string
// Perform final modifications before synthesis.
//
// This method can be implemented by derived constructs in order to perform
// final changes before synthesis. prepare() will be called after child
// constructs have been prepared.
//
// This is an advanced framework feature. Only use this if you
// understand the implications.
// Experimental.
Prepare()
// Allows this construct to emit artifacts into the cloud assembly during synthesis.
//
// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
// as they participate in synthesizing the cloud assembly.
// Experimental.
Synthesize(session awscdk.ISynthesisSession)
// Returns a string representation of this construct.
// Experimental.
ToString() *string
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if the construct is valid.
// Experimental.
Validate() *[]*string
}
A lambda layer version.
Example:
lambda.NewPythonLayerVersion(this, jsii.String("MyLayer"), &pythonLayerVersionProps{
entry: jsii.String("/path/to/my/layer"),
})
Experimental.
func NewPythonLayerVersion ¶
func NewPythonLayerVersion(scope awscdk.Construct, id *string, props *PythonLayerVersionProps) PythonLayerVersion
Experimental.
type PythonLayerVersionProps ¶
type PythonLayerVersionProps struct {
// The description the this Lambda Layer.
// Experimental.
Description *string `field:"optional" json:"description" yaml:"description"`
// The name of the layer.
// Experimental.
LayerVersionName *string `field:"optional" json:"layerVersionName" yaml:"layerVersionName"`
// The SPDX licence identifier or URL to the license file for this layer.
// Experimental.
License *string `field:"optional" json:"license" yaml:"license"`
// Whether to retain this version of the layer when a new version is added or when the stack is deleted.
// Experimental.
RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
// The path to the root directory of the lambda layer.
// Experimental.
Entry *string `field:"required" json:"entry" yaml:"entry"`
// Bundling options to use for this function.
//
// Use this to specify custom bundling options like
// the bundling Docker image, asset hash type, custom hash, architecture, etc.
// Experimental.
Bundling *BundlingOptions `field:"optional" json:"bundling" yaml:"bundling"`
// The system architectures compatible with this layer.
// Experimental.
CompatibleArchitectures *[]awslambda.Architecture `field:"optional" json:"compatibleArchitectures" yaml:"compatibleArchitectures"`
// The runtimes compatible with the python layer.
// Experimental.
CompatibleRuntimes *[]awslambda.Runtime `field:"optional" json:"compatibleRuntimes" yaml:"compatibleRuntimes"`
}
Properties for PythonLayerVersion.
Example:
lambda.NewPythonLayerVersion(this, jsii.String("MyLayer"), &pythonLayerVersionProps{
entry: jsii.String("/path/to/my/layer"),
})
Experimental.
Source Files
¶
- awslambdapython.go
- awslambdapython_BundlingOptions.go
- awslambdapython_PythonFunction.go
- awslambdapython_PythonFunctionProps.go
- awslambdapython_PythonFunction__runtime_type_checks.go
- awslambdapython_PythonLayerVersion.go
- awslambdapython_PythonLayerVersionProps.go
- awslambdapython_PythonLayerVersion__runtime_type_checks.go