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

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

Allows a topic owner to set an attribute of the topic to a new value.
/// Indicates that the user has been denied access to the requested resource. /// /// Indicates an internal service error. /// /// Indicates that a request parameter does not comply with the associated constraints. /// /// Indicates that the requested resource does not exist. ///
public SetTopicAttributes ( SetTopicAttributesRequest request ) : SetTopicAttributesResponse
request SetTopicAttributesRequest Container for the necessary parameters to execute the SetTopicAttributes service method.
Результат SetTopicAttributesResponse
        public SetTopicAttributesResponse SetTopicAttributes(SetTopicAttributesRequest request)
        {
            var marshaller = new SetTopicAttributesRequestMarshaller();
            var unmarshaller = SetTopicAttributesResponseUnmarshaller.Instance;

            return Invoke<SetTopicAttributesRequest,SetTopicAttributesResponse>(request, marshaller, unmarshaller);
        }

Same methods

AmazonSimpleNotificationServiceClient::SetTopicAttributes ( string topicArn, string attributeName, string attributeValue ) : SetTopicAttributesResponse

Usage Example

Пример #1
0
        /// <summary>
        /// Creates a user account for SNS
        /// </summary>
        /// <param name="userName">The user to create a SNS account for</param>
        /// <param name="number">The user's phone number</param>
        private void CreateSNSAccount(String userName, String number)
        {
            AmazonSimpleNotificationServiceClient client = new AmazonSimpleNotificationServiceClient();

            //Create topic first.
            CreateTopicRequest request = new CreateTopicRequest
            {
                Name = userName
            };

            try
            {
                CreateTopicResponse response = client.CreateTopic(request);
                CreateTopicResult result = response.CreateTopicResult;
                String[] strings = new String[1];
                strings[0] = "Success! Assigned ARN is: " + result.TopicArn + "\n";
                TempData["result"] = strings;
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }

            String arn = "arn:aws:sns:us-east-1:727060774285:" + userName;

            SetTopicAttributesRequest request2 = new SetTopicAttributesRequest
            {
                AttributeName = "DisplayName",
                AttributeValue = "Cookbook",
                TopicArn = arn
            };

            try
            {
                SetTopicAttributesResponse response = client.SetTopicAttributes(request2);
                ResponseMetadata result = response.ResponseMetadata;
                Console.WriteLine(result.RequestId);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            //Add SMS number to topic.
            SubscribeRequest request3 = new SubscribeRequest
            {
                TopicArn = arn,
                Endpoint = number,
                Protocol = "sms"
            };

            try
            {
                SubscribeResponse response = client.Subscribe(request3);
                SubscribeResult result = response.SubscribeResult;

                string resultSubscribe = "Success! Subscription Arn is: " + result.SubscriptionArn + "\n";
                Console.WriteLine(resultSubscribe);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
All Usage Examples Of Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient::SetTopicAttributes
AmazonSimpleNotificationServiceClient