Search in sources :

Example 1 with SetTopicAttributesRequest

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);
    }
}
Also used : SetTopicAttributesResponse(software.amazon.awssdk.services.sns.model.SetTopicAttributesResponse) SetTopicAttributesRequest(software.amazon.awssdk.services.sns.model.SetTopicAttributesRequest) SnsException(software.amazon.awssdk.services.sns.model.SnsException)

Aggregations

SetTopicAttributesRequest (software.amazon.awssdk.services.sns.model.SetTopicAttributesRequest)1 SetTopicAttributesResponse (software.amazon.awssdk.services.sns.model.SetTopicAttributesResponse)1 SnsException (software.amazon.awssdk.services.sns.model.SnsException)1