use of software.amazon.awssdk.services.sns.model.SetTopicAttributesRequest in project aws-doc-sdk-examples by awsdocs.
the class SetTopicAttributes method setTopAttr.
// snippet-start:[sns.java2.SetTopicAttributes.main]
public static void setTopAttr(SnsClient snsClient, String attribute, String topicArn, String value) {
try {
SetTopicAttributesRequest request = SetTopicAttributesRequest.builder().attributeName(attribute).attributeValue(value).topicArn(topicArn).build();
SetTopicAttributesResponse result = snsClient.setTopicAttributes(request);
System.out.println("\n\nStatus was " + result.sdkHttpResponse().statusCode() + "\n\nTopic " + request.topicArn() + " updated " + request.attributeName() + " to " + request.attributeValue());
} catch (SnsException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
}
Aggregations