public bool InstanceExists(Guid instanceKey)
{
try
{
using (var client = new AmazonS3Client(Context.AwsAccessKeyId, Context.AwsSecretAccessKey))
{
using (var res = client.GetObjectMetadata(new GetObjectMetadataRequest()
{
BucketName = Context.BucketName,
Key = string.Format("{0}/{1}/{2}", STR_INSTANCES_CONTAINER_PATH, instanceKey.ToString("N"), STR_INFO_FILE_NAME),
})) { return true; }
}
}
catch (AmazonS3Exception awsEx)
{
if (awsEx.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return false;
}
else
{
throw new DeploymentException(string.Format("Failed getting instance with key \"{0}\"", instanceKey), awsEx);
}
}
}