Esempio n. 1
0
 private static async Task UpdateHandlerAsync(AmazonLambdaClient lambdaClient, string handler)
 {
     var updateFunctionConfigurationRequest = new UpdateFunctionConfigurationRequest
     {
         FunctionName = FunctionName,
         Handler      = handler
     };
     await lambdaClient.UpdateFunctionConfigurationAsync(updateFunctionConfigurationRequest);
 }
Esempio n. 2
0
 private async Task UpdateHandlerAsync(string handler)
 {
     var request = new UpdateFunctionConfigurationRequest
     {
         FunctionName = _functionName,
         ImageConfig  = new ImageConfig()
         {
             Command = { handler },
         }
     };
     await _lambdaClient.UpdateFunctionConfigurationAsync(request);
 }
Esempio n. 3
0
        private async Task UpdateHandlerAsync(string handler)
        {
            var updateFunctionConfigurationRequest = new UpdateFunctionConfigurationRequest
            {
                FunctionName = _functionName,
                ImageConfig  = new ImageConfig()
                {
                    Command = { handler },
                }
            };
            await _lambdaClient.UpdateFunctionConfigurationAsync(updateFunctionConfigurationRequest);

            await WaitUntilHelper.WaitUntil(async() =>
            {
                var getFunctionRequest = new GetFunctionRequest()
                {
                    FunctionName = _functionName
                };
                var getFunctionResponse = await _lambdaClient.GetFunctionAsync(getFunctionRequest);
                return(getFunctionResponse.Configuration.LastUpdateStatus != LastUpdateStatus.Successful);
            }, TimeSpan.Zero, TimeSpan.FromMinutes(5), CancellationToken.None);
        }
Esempio n. 4
0
        public async Task <State> TouchLambda(State state, ILambdaContext context)
        {
            var client    = new AmazonLambdaClient(RegionEndpoint.APSoutheast2);
            var variables = new Dictionary <string, string>();

            variables["LastTouched"] = DateTime.UtcNow.ToString();

            var updatedEnvironment = new Amazon.Lambda.Model.Environment
            {
                Variables      = variables,
                IsVariablesSet = true
            };

            var updateFunctionConfigurationRequest = new UpdateFunctionConfigurationRequest
            {
                FunctionName = state.FunctionName,
                Environment  = updatedEnvironment
            };

            var response = await client.UpdateFunctionConfigurationAsync(updateFunctionConfigurationRequest);

            return(state);
        }