/// <summary>
        /// Initiates the asynchronous execution of the GetTopicAttributes operation.
        /// <seealso cref="Amazon.SimpleNotificationService.IAmazonSimpleNotificationService"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetTopicAttributes operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <GetTopicAttributesResponse> GetTopicAttributesAsync(GetTopicAttributesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetTopicAttributesRequestMarshaller();
            var unmarshaller = GetTopicAttributesResponseUnmarshaller.Instance;

            return(Invoke <IRequest, GetTopicAttributesRequest, GetTopicAttributesResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
Пример #2
0
 /// <inheritdoc/>
 public GetTopicAttributesResponse GetAttributes(GetTopicAttributesRequest request)
 {
     return(AggregateExceptionExtract.Extract(() =>
     {
         return GetAttributesAsync(request).Result;
     }));
 }
Пример #3
0
        internal GetTopicAttributesResponse GetTopicAttributes(GetTopicAttributesRequest request)
        {
            var marshaller   = new GetTopicAttributesRequestMarshaller();
            var unmarshaller = GetTopicAttributesResponseUnmarshaller.Instance;

            return(Invoke <GetTopicAttributesRequest, GetTopicAttributesResponse>(request, marshaller, unmarshaller));
        }
Пример #4
0
        /// <inheritdoc/>
        public GetTopicAttributesResponse GetAttributes(GetTopicAttributesRequest request)
        {
            request.TopicName = this.TopicName;

            var marshaller   = new GetTopicAttributesRequestMarshaller();
            var unmarshaller = GetTopicAttributesResponseUnmarshaller.Instance;

            return(_serviceClient.Invoke <GetTopicAttributesRequest, GetTopicAttributesResponse>(request, marshaller, unmarshaller));
        }
Пример #5
0
        public async Task <GetTopicAttributesResponse> GetAttributesAsync(GetTopicAttributesRequest request)
        {
            request.TopicName = this.TopicName;

            var marshaller   = new GetTopicAttributesRequestMarshaller();
            var unmarshaller = GetTopicAttributesResponseUnmarshaller.Instance;

            return(await _serviceClient.InvokeAsync <GetTopicAttributesRequest, GetTopicAttributesResponse>(request, marshaller, unmarshaller).ConfigureAwait(false));
        }
Пример #6
0
        /// <inheritdoc/>
        public IAsyncResult BeginGetAttributes(GetTopicAttributesRequest request, AsyncCallback callback, object state)
        {
            request.TopicName = this.TopicName;

            var marshaller   = new GetTopicAttributesRequestMarshaller();
            var unmarshaller = GetTopicAttributesResponseUnmarshaller.Instance;

            return(_serviceClient.BeginInvoke <GetTopicAttributesRequest>(request, marshaller, unmarshaller,
                                                                          callback, state));
        }
Пример #7
0
        /**
         * Convert GetTopicAttributesRequest to name value pairs
         */
        private static IDictionary<string, string> ConvertGetTopicAttributes(GetTopicAttributesRequest request)
        {
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            parameters["Action"] = "GetTopicAttributes";
            if (request.IsSetTopicArn())
            {
                parameters["TopicArn"] = request.TopicArn;
            }

            return parameters;
        }
Пример #8
0
        private static IDictionary <string, string> ConvertGetTopicAttributes(GetTopicAttributesRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "GetTopicAttributes";
            if (request.IsSetTopicArn())
            {
                dictionary["TopicArn"] = request.TopicArn;
            }
            return(dictionary);
        }
Пример #9
0
        public void CRUDTopics()
        {
            // list all topics
            var allTopics         = GetAllTopics();
            var currentTopicCount = allTopics.Count;

            // create new topic
            var name = "dotnetsdk" + DateTime.Now.Ticks;
            var createTopicRequest = new CreateTopicRequest
            {
                Name = name
            };
            var createTopicResult = Client.CreateTopic(createTopicRequest);
            var topicArn          = createTopicResult.TopicArn;

            try
            {
                // verify there is a new topic
                allTopics = GetAllTopics();
                Assert.AreNotEqual(currentTopicCount, allTopics.Count);

                // set topic attribute
                var setTopicAttributesRequest = new SetTopicAttributesRequest
                {
                    TopicArn       = topicArn,
                    AttributeName  = "DisplayName",
                    AttributeValue = "Test topic"
                };
                Client.SetTopicAttributes(setTopicAttributesRequest);

                // verify topic attributes
                var getTopicAttributesRequest = new GetTopicAttributesRequest
                {
                    TopicArn = topicArn
                };
                var topicAttributes =
                    Client.GetTopicAttributes(getTopicAttributesRequest).Attributes;
                Assert.AreEqual(setTopicAttributesRequest.AttributeValue,
                                topicAttributes[setTopicAttributesRequest.AttributeName]);
            }
            finally
            {
                // delete new topic
                var deleteTopicRequest = new DeleteTopicRequest
                {
                    TopicArn = topicArn
                };
                Client.DeleteTopic(deleteTopicRequest);

                // verify the topic was deleted
                allTopics = GetAllTopics();
                Assert.AreEqual(currentTopicCount, allTopics.Count);
            }
        }
        internal GetTopicAttributesResponse GetTopicAttributes(GetTopicAttributesRequest request)
        {
            var task = GetTopicAttributesAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Пример #11
0
        public async Task CRUDTopics()
        {
            // list all topics
            var allTopics = await GetAllTopics();

            // create new topic
            var name = UtilityMethods.GenerateName("CrudTopics");
            var createTopicRequest = new CreateTopicRequest
            {
                Name = name
            };
            var createTopicResult = await Client.CreateTopicAsync(createTopicRequest);

            var topicArn = createTopicResult.TopicArn;

            _topicArns.Add(topicArn);

            // verify there is a new topic
            allTopics = await GetAllTopics();

            Assert.True(allTopics.Exists(t => t.TopicArn.Contains(name)));

            // set topic attribute
            var setTopicAttributesRequest = new SetTopicAttributesRequest
            {
                TopicArn       = topicArn,
                AttributeName  = "DisplayName",
                AttributeValue = "Test topic"
            };
            await Client.SetTopicAttributesAsync(setTopicAttributesRequest);

            // verify topic attributes
            var getTopicAttributesRequest = new GetTopicAttributesRequest
            {
                TopicArn = topicArn
            };
            var topicAttributes =
                (await Client.GetTopicAttributesAsync(getTopicAttributesRequest)).Attributes;

            Assert.Equal(setTopicAttributesRequest.AttributeValue,
                         topicAttributes[setTopicAttributesRequest.AttributeName]);
        }
Пример #12
0
        private async Task <Dictionary <string, string> > GetTopicAttributesAsync(string topicArn)
        {
            var request = new GetTopicAttributesRequest
            {
                TopicArn = topicArn
            };

            var response = await _sns.GetTopicAttributesAsync(request);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new InvalidOperationException($"Unable to retrieve attributes for topic Arn '{topicArn}'");
            }

            // The policy attributes are very verbose and I've chosen to
            // exclude them here
            return(response
                   .Attributes
                   .Where(attribute => !attribute.Key.ToLower().Contains("policy"))
                   .ToDictionary(x => x.Key, y => y.Value));
        }
 /// <summary>
 /// Get Topic Attributes
 /// </summary>
 /// <param name="request">Get Topic Attributes  request</param>
 /// <returns>Get Topic Attributes  Response from the service</returns>
 /// <remarks>
 /// The GetTopicAttribtues action returns all of the properties of a topic customers have created. Topic
 /// properties returned might differ based on the authorization of the user.
 /// </remarks>
 public GetTopicAttributesResponse GetTopicAttributes(GetTopicAttributesRequest request)
 {
     return(Invoke <GetTopicAttributesResponse>(ConvertGetTopicAttributes(request)));
 }
Пример #14
0
 public Task <GetTopicAttributesResponse> GetTopicAttributesAsync(GetTopicAttributesRequest request, CancellationToken cancellationToken = new CancellationToken())
 {
     throw new NotImplementedException();
 }
Пример #15
0
 public void GetTopicAttributesAsync(GetTopicAttributesRequest request, AmazonServiceCallback <GetTopicAttributesRequest, GetTopicAttributesResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }
Пример #16
0
        /// <inheritdoc/>
        public GetTopicAttributesResponse GetAttributes()
        {
            var request = new GetTopicAttributesRequest();

            return(GetAttributes(request));
        }
Пример #17
0
        public async Task <GetTopicAttributesResponse> GetAttributesAsync()
        {
            var request = new GetTopicAttributesRequest();

            return(await GetAttributesAsync(request).ConfigureAwait(false));
        }
Пример #18
0
 public GetTopicAttributesResponse GetTopicAttributes(GetTopicAttributesRequest request)
 {
     throw new System.NotImplementedException();
 }
Пример #19
0
 public Task <GetTopicAttributesResponse> GetTopicAttributesAsync(GetTopicAttributesRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new System.NotImplementedException();
 }