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

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

Prepares to subscribe an endpoint by sending the endpoint a confirmation message. To actually create a subscription, the endpoint owner must call the ConfirmSubscription action with the token from the confirmation message. Confirmation tokens are valid for three days.
/// 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. /// /// Indicates that the customer already owns the maximum allowed number of subscriptions. ///
public Subscribe ( string topicArn, string protocol, string endpoint ) : SubscribeResponse
topicArn string The ARN of the topic you want to subscribe to.
protocol string The protocol you want to use. Supported protocols include:
  • http -- delivery of JSON-encoded message via HTTP POST
  • https -- delivery of JSON-encoded message via HTTPS POST
  • email -- delivery of message via SMTP
  • email-json -- delivery of JSON-encoded message via SMTP
  • sms -- delivery of message via SMS
  • sqs -- delivery of JSON-encoded message to an Amazon SQS queue
  • application -- delivery of JSON-encoded message to an EndpointArn for a mobile app and device.
  • lambda -- delivery of JSON-encoded message to an AWS Lambda function.
endpoint string The endpoint that you want to receive notifications. Endpoints vary by protocol:
  • For the http protocol, the endpoint is an URL beginning with "http://"
  • For the https protocol, the endpoint is a URL beginning with "https://"
  • For the email protocol, the endpoint is an email address
  • For the email-json protocol, the endpoint is an email address
  • For the sms protocol, the endpoint is a phone number of an SMS-enabled device
  • For the sqs protocol, the endpoint is the ARN of an Amazon SQS queue
  • For the application protocol, the endpoint is the EndpointArn of a mobile app and device.
  • For the lambda protocol, the endpoint is the ARN of an AWS Lambda function.
Результат SubscribeResponse
        public SubscribeResponse Subscribe(string topicArn, string protocol, string endpoint)
        {
            var request = new SubscribeRequest();
            request.TopicArn = topicArn;
            request.Protocol = protocol;
            request.Endpoint = endpoint;
            return Subscribe(request);
        }

Same methods

AmazonSimpleNotificationServiceClient::Subscribe ( SubscribeRequest request ) : SubscribeResponse

Usage Example

Пример #1
0
        public static void CreateEmailSubscription(string topicArn, string emailAddress)
        {
            using (var client = new AmazonSimpleNotificationServiceClient(Settings.AccessKey, Settings.Secret))
            {
                var request = new SubscribeRequest(topicArn, "email", emailAddress);

                client.Subscribe(request);
            }
        }
All Usage Examples Of Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient::Subscribe
AmazonSimpleNotificationServiceClient