docs: public static String subscribeQueue(AmazonSNS sns, AmazonSQS sqs, String snsTopicArn, String sqsQueueUrl,
                                          boolean extendPolicy)
              throws AmazonClientException, AmazonServiceException {
          List<String> sqsAttrNames = Arrays.asList(QueueAttributeName.QueueArn.toString(),
                  QueueAttributeName.Policy.toString());
          Map<String, String> sqsAttrs = sqs.getQueueAttributes(sqsQueueUrl, sqsAttrNames).getAttributes();
          String sqsQueueArn = sqsAttrs.get(QueueAttributeName.QueueArn.toString());
  
          String policyJson = sqsAttrs.get(QueueAttributeName.Policy.toString());
          Policy policy = extendPolicy && policyJson != null && policyJson.length() > 0
                          ? Policy.fromJson(policyJson) : new Policy();
          policy.getStatements().add(new Statement(Effect.Allow)
                  .withId("topic-subscription-" + snsTopicArn)
                  .withPrincipals(Principal.AllUsers)
                  .withActions(SQSActions.SendMessage)
                  .withResources(new Resource(sqsQueueArn))
                  .withConditions(ConditionFactory.newSourceArnCondition(snsTopicArn)));
  
          Map<String, String> newAttrs = new HashMap<String, String>();
          newAttrs.put(QueueAttributeName.Policy.toString(), policy.toJson());
          sqs.setQueueAttributes(new SetQueueAttributesRequest(sqsQueueUrl, newAttrs));
  
          SubscribeResult subscribeResult = sns.subscribe(snsTopicArn, "sqs", sqsQueueArn);
          return subscribeResult.getSubscriptionArn();
      }