public static string GetFunctionArnIfExists(IAmazonLambda lambdaClient, string functionName) { AutoResetEvent ars = new AutoResetEvent(false); Exception responseException = new Exception(); string functionArn = null; lambdaClient.GetFunctionAsync(new GetFunctionRequest() { FunctionName = functionName }, (response) => { responseException = response.Exception; if (responseException == null) { functionArn = response.Response.Configuration.FunctionArn; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); if (responseException == null) { Assert.IsNotNull(functionArn); } else { Assert.IsInstanceOf(typeof(ResourceNotFoundException), responseException); } return(functionArn); }
private Amazon.Lambda.Model.GetFunctionResponse CallAWSServiceOperation(IAmazonLambda client, Amazon.Lambda.Model.GetFunctionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Lambda", "GetFunction"); try { #if DESKTOP return(client.GetFunction(request)); #elif CORECLR return(client.GetFunctionAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public static string GetFunctionArnIfExists(IAmazonLambda lambdaClient, string functionName) { AutoResetEvent ars = new AutoResetEvent(false); Exception responseException = new Exception(); string functionArn = null; lambdaClient.GetFunctionAsync(new GetFunctionRequest() { FunctionName = functionName }, (response) => { responseException = response.Exception; if (responseException == null) { functionArn = response.Response.Configuration.FunctionArn; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); if (responseException == null) { Assert.IsNotNull(functionArn); } else { Assert.IsInstanceOf(typeof(ResourceNotFoundException), responseException); } return functionArn; }