Search in sources :

Example 1 with GetSubscriptionAttributesResponse

use of software.amazon.awssdk.services.sns.model.GetSubscriptionAttributesResponse in project aws-doc-sdk-examples by awsdocs.

the class GetSMSAtrributes method getSNSAttrutes.

// snippet-start:[sns.java2.GetSMSAtrributes.main]
public static void getSNSAttrutes(SnsClient snsClient, String topicArn) {
    try {
        GetSubscriptionAttributesRequest request = GetSubscriptionAttributesRequest.builder().subscriptionArn(topicArn).build();
        // Get the Subscription attributes
        GetSubscriptionAttributesResponse res = snsClient.getSubscriptionAttributes(request);
        Map<String, String> map = res.attributes();
        // Iterate through the map
        Iterator iter = map.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            System.out.println("[Key] : " + entry.getKey() + " [Value] : " + entry.getValue());
        }
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    System.out.println("\n\nStatus was good");
}
Also used : GetSubscriptionAttributesResponse(software.amazon.awssdk.services.sns.model.GetSubscriptionAttributesResponse) Iterator(java.util.Iterator) SnsException(software.amazon.awssdk.services.sns.model.SnsException) Map(java.util.Map) GetSubscriptionAttributesRequest(software.amazon.awssdk.services.sns.model.GetSubscriptionAttributesRequest)

Aggregations

Iterator (java.util.Iterator)1 Map (java.util.Map)1 GetSubscriptionAttributesRequest (software.amazon.awssdk.services.sns.model.GetSubscriptionAttributesRequest)1 GetSubscriptionAttributesResponse (software.amazon.awssdk.services.sns.model.GetSubscriptionAttributesResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1