File tree Expand file tree Collapse file tree 2 files changed +30
-20
lines changed
javav2/usecases/topics_and_queues
src/main/java/com/example/sns Expand file tree Collapse file tree 2 files changed +30
-20
lines changed Original file line number Diff line number Diff line change 2828 <artifactId >maven-compiler-plugin</artifactId >
2929 <version >3.1</version >
3030 <configuration >
31- <source >8 </source >
32- <target >8 </target >
31+ <source >15 </source >
32+ <target >15 </target >
3333 </configuration >
3434 </plugin >
3535 </plugins >
3939 <dependency >
4040 <groupId >software.amazon.awssdk</groupId >
4141 <artifactId >bom</artifactId >
42- <version >2.21.20 </version >
42+ <version >2.29.45 </version >
4343 <type >pom</type >
4444 <scope >import</scope >
4545 </dependency >
8787 <artifactId >gson</artifactId >
8888 <version >2.10.1</version >
8989 </dependency >
90+ <dependency >
91+ <groupId >software.amazon.awssdk</groupId >
92+ <artifactId >sso</artifactId >
93+ </dependency >
94+ <dependency >
95+ <groupId >software.amazon.awssdk</groupId >
96+ <artifactId >ssooidc</artifactId >
97+ </dependency >
9098 </dependencies >
9199</project >
Original file line number Diff line number Diff line change @@ -193,23 +193,25 @@ public static void main(String[] args) {
193193 // Define the policy to use. Make sure that you change the REGION if you are
194194 // running this code
195195 // in a different region.
196- String policy = "{\n " +
197- " \" Statement\" : [\n " +
198- " {\n " +
199- " \" Effect\" : \" Allow\" ,\n " +
200- " \" Principal\" : {\n " +
201- " \" Service\" : \" sns.amazonaws.com\" \n " +
202- " },\n " +
203- " \" Action\" : \" sqs:SendMessage\" ,\n " +
204- " \" Resource\" : \" arn:aws:sqs:us-east-1:" + accountId + ":" + sqsQueueName + "\" ,\n " +
205- " \" Condition\" : {\n " +
206- " \" ArnEquals\" : {\n " +
207- " \" aws:SourceArn\" : \" arn:aws:sns:us-east-1:" + accountId + ":" + topicName + "\" \n " +
208- " }\n " +
209- " }\n " +
210- " }\n " +
211- " ]\n " +
212- " }" ;
196+ String policy = """
197+ {
198+ "Statement": [
199+ {
200+ "Effect": "Allow",
201+ "Principal": {
202+ "Service": "sns.amazonaws.com"
203+ },
204+ "Action": "sqs:SendMessage",
205+ "Resource": "arn:aws:sqs:us-east-1:%s:%s",
206+ "Condition": {
207+ "ArnEquals": {
208+ "aws:SourceArn": "arn:aws:sns:us-east-1:%s:%s"
209+ }
210+ }
211+ }
212+ ]
213+ }
214+ """ .formatted (accountId , sqsQueueName , accountId , topicName );
213215
214216 setQueueAttr (sqsClient , sqsQueueUrl , policy );
215217 System .out .println (DASHES );
You can’t perform that action at this time.
0 commit comments