示例#1
0
 public SA_Lambda GetFromFunctionName(string functionName)
 {
     try
     {
         var response = client.GetFunction(functionName);
         var result   = new SA_Lambda()
         {
             FunctionArn  = response.Configuration.FunctionArn,
             FunctionName = response.Configuration.FunctionName,
             LastModified = DateTime.Parse(response.Configuration.LastModified),
             Tags         = response.Tags
         };
         return(result);
     }
     catch (ResourceNotFoundException)
     {
         return(null);
     }
 }
示例#2
0
        private async Task <string> UpdateLambdaFunctionVersion(SA_Lambda lambda)
        {
            var result   = "";
            var tagName  = "Version";
            var tagValue = await ReadAppVersion(appsDestinationFolder);

            await Task.Run(() =>
            {
                lambdaHelper.SetTag(lambda.FunctionArn, tagName, tagValue);
                lambdaHelper.UpdateFunctionDescription(lambda.FunctionName, tagValue);
                Thread.Sleep(1000);
                var updatedVersion = lambdaHelper.ReadTag(lambda.FunctionArn, tagName);
                if (tagValue != updatedVersion)
                {
                    result = $"Warn: Updating function {lambda.FunctionName} failed. Current version is {updatedVersion}. Desired version is {tagValue}.";
                }
                else
                {
                    result = $"Updated function {lambda.FunctionName} to version {updatedVersion}";
                }
            });

            return(result);
        }