Amazon AWS SDK Guida Utente Pagina 26

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 76
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 25
AmazonSQS sqs = new AmazonSQSClient(myAwsCredentials);
sqs.setQueueAttributes(new SetQueueAttributesRequest(myQueueUrl, queueAttrib
utes));
Amazon SNS Example
Some services offer additional conditions that can be used in policies. Amazon SNS provides conditions
for allowing or denying subscriptions to SNS topics based on the protocol (e.g., email, HTTP, HTTPS,
SQS) and endpoint (e.g., email address, URL, SQS ARN) of the request to subscribe to a topic.
/*
* This SNS condition allows you to restrict subscriptions to an Amazon SNS
topic
* based on the requested endpoint (email address, SQS queue ARN, etc.) used
when
* someone tries to subscribe to your SNS topic.
*/
Condition endpointCondition =
SNSConditionFactory.newEndpointCondition("*@mycompany.com");
Policy policy = new Policy().withStatements(
new Statement(Effect.Allow)
.withPrincipals(Principal.AllUsers)
.withActions(SNSActions.Subscribe)
.withConditions(endpointCondition));
AmazonSNS sns = new AmazonSNSClient(myAwsCredentials);
sns.setTopicAttributes(
new SetTopicAttributesRequest(myTopicArn, "Policy", policy.toJson()));
Version v1.0.0
22
AWS SDK for Java Developer Guide
Access Control Policies
Vedere la pagina 25
1 2 ... 21 22 23 24 25 26 27 28 29 30 31 ... 75 76

Commenti su questo manuale

Nessun commento