Show / Hide Table of Contents

Class InlineCode

Lambda code from an inline string.

Inheritance
object
Code
InlineCode
Inherited Members
Code.FromAsset(string, IAssetOptions)
Code.FromAssetImage(string, IAssetImageCodeProps)
Code.FromBucket(IBucket, string, string)
Code.FromBucketV2(IBucket, string, IBucketOptions)
Code.FromCfnParameters(ICfnParametersCodeProps)
Code.FromCustomCommand(string, string[], ICustomCommandOptions)
Code.FromDockerBuild(string, IDockerBuildAssetOptions)
Code.FromEcrImage(IRepository, IEcrImageCodeProps)
Code.FromInline(string)
Code.BindToResource(CfnResource, IResourceBindOptions)
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class InlineCode : Code
Syntax (vb)
Public Class InlineCode Inherits Code
Remarks

ExampleMetadata: lit=aws-lambda/test/integ.layer-version.lit.ts infused

Examples
var layer = new LayerVersion(stack, "MyLayer", new LayerVersionProps {
                Code = Code.FromAsset(Join(__dirname, "layer-code")),
                CompatibleRuntimes = new [] { Runtime.NODEJS_LATEST },
                License = "Apache-2.0",
                Description = "A layer to test the L2 construct"
            });

            // To grant usage by other AWS accounts
            layer.AddPermission("remote-account-grant", new LayerVersionPermission { AccountId = awsAccountId });

            // To grant usage to all accounts in some AWS Ogranization
            // layer.grantUsage({ accountId: '*', organizationId });

            // To grant usage to all accounts in some AWS Ogranization
            // layer.grantUsage({ accountId: '*', organizationId });
            new Function(stack, "MyLayeredLambda", new FunctionProps {
                Code = new InlineCode("foo"),
                Handler = "index.handler",
                Runtime = Runtime.NODEJS_LATEST,
                Layers = new [] { layer }
            });

Synopsis

Constructors

InlineCode(string)

Lambda code from an inline string.

Properties

IsInline

Determines whether this Code is inline code or not.

Methods

Bind(Construct)

Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.

Constructors

InlineCode(string)

Lambda code from an inline string.

public InlineCode(string code)
Parameters
code string
Remarks

ExampleMetadata: lit=aws-lambda/test/integ.layer-version.lit.ts infused

Examples
var layer = new LayerVersion(stack, "MyLayer", new LayerVersionProps {
                Code = Code.FromAsset(Join(__dirname, "layer-code")),
                CompatibleRuntimes = new [] { Runtime.NODEJS_LATEST },
                License = "Apache-2.0",
                Description = "A layer to test the L2 construct"
            });

            // To grant usage by other AWS accounts
            layer.AddPermission("remote-account-grant", new LayerVersionPermission { AccountId = awsAccountId });

            // To grant usage to all accounts in some AWS Ogranization
            // layer.grantUsage({ accountId: '*', organizationId });

            // To grant usage to all accounts in some AWS Ogranization
            // layer.grantUsage({ accountId: '*', organizationId });
            new Function(stack, "MyLayeredLambda", new FunctionProps {
                Code = new InlineCode("foo"),
                Handler = "index.handler",
                Runtime = Runtime.NODEJS_LATEST,
                Layers = new [] { layer }
            });

Properties

IsInline

Determines whether this Code is inline code or not.

public virtual bool IsInline { get; }
Property Value

bool

Remarks

ExampleMetadata: lit=aws-lambda/test/integ.layer-version.lit.ts infused

Methods

Bind(Construct)

Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.

public override ICodeConfig Bind(Construct scope)
Parameters
scope Construct
Returns

ICodeConfig

Overrides
Code.Bind(Construct)
Remarks

ExampleMetadata: lit=aws-lambda/test/integ.layer-version.lit.ts infused

Back to top Generated by DocFX