Exemplo n.º 1
0
        public ConstructTryStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            // Defines a new lambda resource
            var greeting = new Function(this, "GreetingHandler", new FunctionProps
            {
                Runtime = Runtime.NODEJS_10_X,
                Code    = Code.FromAsset("src/lambda"),
                Handler = "greeting.handler"
            });

            var greetingWithCounter = new HitCounter(this, "GreetingHitCounter", new HitCounterProps
            {
                Downstream = greeting
            });

            new LambdaRestApi(this, "Endpoint", new LambdaRestApiProps
            {
                Handler = greetingWithCounter.Handler
            });
        }
Exemplo n.º 2
0
        public CdkWorkshopStack(App scope, string name, IStackProps props) : base(scope, name, props)
        {
            var hello = new Function(this, "HelloHandler", new FunctionProps
            {
                Runtime = Runtime.DOTNET_CORE_2_1,
                Timeout = Duration.Seconds(5),
                Code    = Code.Asset(
                    "./HelloHandlerFunction/src/HelloHandlerFunction/bin/Debug/netcoreapp2.1"),
                Handler = "HelloHandlerFunction::HelloHandlerFunction.Function::FunctionHandler"
            });

            var helloWithCounter = new HitCounter(this, "HelloHitCounter", new HitCounterProps
            {
                Downstream = hello
            });

            new LambdaRestApi(this, "Endpoint", new LambdaRestApiProps
            {
                Handler = helloWithCounter.Handler
            });
        }