SetEndpointAttributes() 공개 메소드

Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM and APNS. For more information, see Using Amazon SNS Mobile Push Notifications.
/// 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 SetEndpointAttributes ( SetEndpointAttributesRequest request ) : SetEndpointAttributesResponse
request SetEndpointAttributesRequest Container for the necessary parameters to execute the SetEndpointAttributes service method.
리턴 SetEndpointAttributesResponse
        public void SetEndpointAttribute(string endpointarn, string key, string value)
        {
            try
            {

                var endpoint = GetEndpoint(string.Empty, endpointarn);

                if (string.IsNullOrEmpty(endpoint)) throw new ArgumentNullException("endpointarn");

                Dictionary<string, string> attributes = (Dictionary<string, string>) GetEndpointAttributes(endpointarn);

                attributes[key] = value;

                using (var snsclient = new AmazonSimpleNotificationServiceClient(_accesskey, _secretkey))
                {
                    var result = snsclient.SetEndpointAttributes(new SetEndpointAttributesRequest()
                    {
                        EndpointArn = endpointarn,
                        Attributes = attributes
                    });

                }
            }
            catch (Exception ex)
            {
                throw new Exception("SetEndpointAttribute " + ex.Message);
            }
        }
예제 #2
0
    public static void SNSMobilePushAPIsSetEndpointAttributes()
    {
      #region SNSMobilePushAPIsSetEndpointAttributes
      var snsClient = new AmazonSimpleNotificationServiceClient();

      var request = new SetEndpointAttributesRequest
      {
        EndpointArn = "arn:aws:sns:us-east-1:80398EXAMPLE:" +
          "endpoint/GCM/TimeCardProcessingApplication/" +
          "d84b5f0d-7136-3bbe-9b42-4e001EXAMPLE",
        Attributes = new Dictionary<string, string>() { { "Enabled", "true" } }
      };

      snsClient.SetEndpointAttributes(request);
      #endregion
    }