/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions * The conditions associated with this policy statement. * * @return The updated Statement object so that additional method calls can * be chained together. */ public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
statement.setConditions(conditionsOf(conditionNodes));
.withActions(SQSActions.SendMessage) .withResources(new Resource(queueARN)); statement.setConditions(conditions);
/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions The conditions associated with this policy statement. * @return The updated Statement object so that additional method calls can * be chained together. */ @SuppressWarnings("checkstyle:hiddenfield") public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions * The conditions associated with this policy statement. * * @return The updated Statement object so that additional method calls can * be chained together. */ public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
statement.setConditions(conditionsOf(conditionNodes));
statement.setPrincipals(principalOf(reader)); } else if (JsonDocumentFields.CONDITION.equals(name)) { statement.setConditions(conditionsOf(reader)); } else { reader.skipValue();
/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions The conditions associated with this policy statement. * @return The updated Statement object so that additional method calls can * be chained together. */ @SuppressWarnings("checkstyle:hiddenfield") public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions The conditions associated with this policy statement. * @return The updated Statement object so that additional method calls can * be chained together. */ @SuppressWarnings("checkstyle:hiddenfield") public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
/** * Sets the conditions associated with this policy statement, and returns * this updated Statement object so that additional method calls can be * chained together. * <p> * Conditions allow policy statements to be conditionally evaluated based on * the many available condition types. * <p> * For example, a statement that allows access to an Amazon SQS queue could * use a condition to only apply the effect of that statement for requests * that are made before a certain date, or that originate from a range of IP * addresses. * <p> * Multiple conditions can be included in a single statement, and all * conditions must evaluate to true in order for the statement to take * effect. * * @param conditions * The conditions associated with this policy statement. * * @return The updated Statement object so that additional method calls can * be chained together. */ public Statement withConditions(Condition... conditions) { setConditions(Arrays.asList(conditions)); return this; }
/** * This policy allows operators to choose whether or not to have lifecycle hooks to be sent via SNS for fanout, or * be sent directly to an SQS queue from the autoscaling group. */ private static Policy buildSQSPolicy(ARN queue, ARN topic, Set<String> terminatingRoleArns) { Statement snsStatement = new Statement(Effect.Allow).withActions(SQSActions.SendMessage); snsStatement.setPrincipals(Principal.All); snsStatement.setResources(Collections.singletonList(new Resource(queue.arn))); snsStatement.setConditions(Collections.singletonList( new Condition().withType("ArnEquals").withConditionKey("aws:SourceArn").withValues(topic.arn) )); Statement sqsStatement = new Statement(Effect.Allow).withActions(SQSActions.SendMessage, SQSActions.GetQueueUrl); sqsStatement.setPrincipals(terminatingRoleArns.stream().map(Principal::new).collect(Collectors.toList())); sqsStatement.setResources(Collections.singletonList(new Resource(queue.arn))); return new Policy("allow-sns-or-sqs-send", Arrays.asList(snsStatement, sqsStatement)); }
private static Policy buildSQSPolicy(ARN queue, ARN topic) { Statement statement = new Statement(Statement.Effect.Allow).withActions(SQSActions.SendMessage); statement.setPrincipals(Principal.All); statement.setResources(Collections.singletonList(new Resource(queue.arn))); statement.setConditions(Collections.singletonList( new Condition().withType("ArnEquals").withConditionKey("aws:SourceArn").withValues(topic.arn) )); return new Policy("allow-sns-topic-send", Collections.singletonList(statement)); }
/** * This policy allows messages to be sent from an SNS topic. */ public static Policy buildSQSPolicy(ARN queue, ARN topic) { Statement snsStatement = new Statement(Statement.Effect.Allow).withActions(SQSActions.SendMessage); snsStatement.setPrincipals(Principal.All); snsStatement.setResources(Collections.singletonList(new Resource(queue.getArn()))); snsStatement.setConditions(Collections.singletonList( new Condition().withType("ArnEquals").withConditionKey("aws:SourceArn").withValues(topic.getArn()) )); return new Policy("allow-sns-send", Collections.singletonList(snsStatement)); } }
statement.setConditions(conditionsOf(conditionNodes));
statement.setPrincipals(principalOf(reader)); } else if (JsonDocumentFields.CONDITION.equals(name)) { statement.setConditions(conditionsOf(reader)); } else { reader.skipValue();
statement.setPrincipals(principalOf(reader)); } else if (JsonDocumentFields.CONDITION.equals(name)) { statement.setConditions(conditionsOf(reader)); } else { reader.skipValue();