public static void EnableBucketVersioning(string bucketName, RegionEndpoint region)
{
AutoResetEvent ars = new AutoResetEvent(false);
string functionError = null;
Exception responseException = new Exception();
string payload = string.Format(@"{{""BucketName"":""{0}"",""Region"":""{1}""}}", bucketName, region.SystemName);
LambdaClient.InvokeAsync(new InvokeRequest()
{
FunctionName = EnableBucketVersioningFunctionName,
InvocationType = InvocationType.RequestResponse,
Payload = payload
}, (response) =>
{
responseException = response.Exception;
if (responseException == null)
{
functionError = response.Response.FunctionError;
}
ars.Set();
}, new AsyncOptions { ExecuteCallbackOnMainThread = false });
ars.WaitOne();
if (responseException != null)
{
throw responseException;
}
Utils.AssertStringIsNullOrEmpty(functionError);
}