private static void GetNewPolicyAndStatement(GetQueueAttributesResponse response, string bucket, out Policy policy, out Statement statement)
{
if (!string.IsNullOrEmpty(response.Policy))
{
policy = Policy.FromJson(response.Policy);
}
else
{
policy = new Policy();
}
var sourceArn = string.Format(CultureInfo.InvariantCulture, "arn:aws:s3:*:*:{0}", bucket);
statement = new Statement(Statement.StatementEffect.Allow);
statement.Actions.Add(SQSActionIdentifiers.SendMessage);
statement.Resources.Add(new Resource(response.QueueARN));
statement.Conditions.Add(ConditionFactory.NewSourceArnCondition(sourceArn));
statement.Principals.Add(new Principal("*"));
}
}