public void LambdaGetFunction() { #region to-retrieve-a-lambda-functions-event-source-mapping-1481661622799 var response = client.GetFunction(new GetFunctionRequest { FunctionName = "myFunction", Qualifier = "1" }); FunctionCodeLocation code = response.Code; FunctionConfiguration configuration = response.Configuration; #endregion }
public void LambdaGetFunction() { #region to-get-a-lambda-function-1481661622799 var response = client.GetFunction(new GetFunctionRequest { FunctionName = "my-function", Qualifier = "1" }); FunctionCodeLocation code = response.Code; FunctionConfiguration configuration = response.Configuration; Dictionary <string, string> tags = response.Tags; #endregion }
public void SetUp() { AutoResetEvent ars = new AutoResetEvent(false); Exception responseException = new Exception(); string iamRoleArn = UtilityMethods.CreateRoleIfNotExists(iamClient, IAMRoleName, UtilityMethods.LambdaAssumeRolePolicyDocument); Assert.IsNotNull(iamRoleArn); FunctionName = "UnityTestFunction" + DateTime.Now.Ticks; UtilityMethods.CreateFunctionIfNotExists(Client, FunctionName, FunctionHandleName, FunctionScriptBytesBase64, iamRoleArn); // List all the functions and make sure the newly uploaded function is in the collection List <FunctionConfiguration> functions = null; Client.ListFunctionsAsync((response) => { responseException = response.Exception; if (responseException == null) { functions = response.Response.Functions; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); Assert.IsNull(responseException); FunctionConfiguration function = null; foreach (FunctionConfiguration functionConfig in functions) { if (functionConfig.FunctionName == FunctionName) { function = functionConfig; break; } } Assert.IsNotNull(function); Assert.AreEqual(FunctionHandleName + ".handler", function.Handler); Assert.AreEqual(iamRoleArn, function.Role); // Get the function with a presigned URL to the uploaded code FunctionConfiguration configuration = null; FunctionCodeLocation code = null; Client.GetFunctionAsync(FunctionName, (response) => { responseException = response.Exception; if (responseException == null) { configuration = response.Response.Configuration; code = response.Response.Code; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); Assert.IsNull(responseException); Assert.AreEqual(FunctionHandleName + ".handler", configuration.Handler); Assert.IsNotNull(code.Location); // Get the function's configuration only string handler = null; Client.GetFunctionConfigurationAsync(FunctionName, (response) => { responseException = response.Exception; if (responseException == null) { handler = response.Response.Handler; } ars.Set(); }, new AsyncOptions { ExecuteCallbackOnMainThread = false }); ars.WaitOne(); Assert.IsNull(responseException); Assert.AreEqual(FunctionHandleName + ".handler", handler); }