Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient.AuthorizeS3ToPublishAsync C# (CSharp) Метод

AuthorizeS3ToPublishAsync() публичный Метод

This is a utility method which updates the policy of a topic to allow the S3 bucket to publish events to it.
public AuthorizeS3ToPublishAsync ( string topicArn, string bucket ) : System.Threading.Tasks.Task
topicArn string The topic that will have its policy updated.
bucket string The bucket that will be given access to publish from.
Результат System.Threading.Tasks.Task
        public async Task AuthorizeS3ToPublishAsync(string topicArn, string bucket)
        {
            var attributes = (await this.GetTopicAttributesAsync(new GetTopicAttributesRequest
                {
                    TopicArn = topicArn
                }).ConfigureAwait(false)).Attributes;

            Policy policy;
            Statement newStatement;
            GetNewPolicyAndStatementForTopicAttributes(attributes, topicArn, bucket, out policy, out newStatement);

            if (!policy.CheckIfStatementExists(newStatement))
            {
                policy.Statements.Add(newStatement);

                var policyString = policy.ToJson();
                await this.SetTopicAttributesAsync(new SetTopicAttributesRequest
                {
                    TopicArn = topicArn,
                    AttributeName = "Policy",
                    AttributeValue = policyString
                }).ConfigureAwait(false);
            }
        }
    }
AmazonSimpleNotificationServiceClient