using Amazon.Lambda;
using Amazon.Lambda.Model;
using Amazon;
using Newtonsoft.Json;
//The access and secret keys are optional, will use your credentials if not provided
AmazonLambdaClient client = new AmazonLambdaClient(
//"Access Key",
//"Secret Key",
RegionEndpoint.USEast1);
var input = new Dictionary<string, string>
{
{ "Input1", "Sample" },
{ "Input2", "Sample" }
};
InvokeRequest ir = new InvokeRequest
{
FunctionName = "FunctionName",
InvocationType = InvocationType.RequestResponse,
Payload = JsonConvert.SerializeObject(input)
};
InvokeResponse awsResponse = client.Invoke(ir);
if (awsResponse.HttpStatusCode != System.Net.HttpStatusCode.OK)
{
throw new Exception(awsResponse.FunctionError);
}
var sr = new StreamReader(awsResponse.Payload);
response.Value = JsonConvert.DeserializeObject<FacilityInfo>(sr.ReadToEnd());