Amazon.SQS.AmazonSQSClient.GetNewPolicyAndStatement C# (CSharp) Method

GetNewPolicyAndStatement() private static method

Helper method for AuthorizeS3ToSendMessage()
private static GetNewPolicyAndStatement ( GetQueueAttributesResponse response, string bucket, Amazon.Auth.AccessControlPolicy.Policy &policy, Amazon.Auth.AccessControlPolicy.Statement &statement ) : void
response Amazon.SQS.Model.GetQueueAttributesResponse
bucket string
policy Amazon.Auth.AccessControlPolicy.Policy
statement Amazon.Auth.AccessControlPolicy.Statement
return void
        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("*"));
        }
    }
AmazonSQSClient