internal async Task setupTopicAndQueueAsync()
{
var guidStr = Guid.NewGuid().ToString("N");
this.topicArn = (await this.snsClient.CreateTopicAsync(new CreateTopicRequest() { Name = "GlacierDownload-" + guidStr }).ConfigureAwait(false)).TopicArn;
this.queueUrl = (await this.sqsClient.CreateQueueAsync(new CreateQueueRequest() { QueueName = "GlacierDownload-" + guidStr }).ConfigureAwait(false)).QueueUrl;
this.queueArn = (await this.sqsClient.GetQueueAttributesAsync(new GetQueueAttributesRequest() { QueueUrl = this.queueUrl, AttributeNames = new List<string> { SQSConstants.ATTRIBUTE_QUEUE_ARN } }).ConfigureAwait(false)).Attributes[SQSConstants.ATTRIBUTE_QUEUE_ARN];
await this.snsClient.SubscribeAsync(new SubscribeRequest()
{
Endpoint = this.queueArn,
Protocol = "sqs",
TopicArn = this.topicArn
}).ConfigureAwait(false);
var policy = SQS_POLICY.Replace("{QuereArn}", this.queueArn).Replace("{TopicArn}", this.topicArn);
var setQueueAttributesRequest = new SetQueueAttributesRequest()
{
QueueUrl = this.queueUrl
};
setQueueAttributesRequest.Attributes.Add("Policy", policy);
await this.sqsClient.SetQueueAttributesAsync(setQueueAttributesRequest).ConfigureAwait(false);
}