BucketNotificationConfiguration config = new BucketNotificationConfiguration(); Entry<String, NotificationConfiguration> entry = TopicConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("QueueConfiguration", targetDepth)) { Entry<String, NotificationConfiguration> entry = QueueConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("CloudFunctionConfiguration", targetDepth)) { Entry<String, NotificationConfiguration> entry = LambdaConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue());
@Override public String toString() { return Jackson.toJsonString(this.getConfigurations()); }
/** * <p> * Sets the {@link BucketNotificationConfiguration.TopicConfiguration} * <code>TopicConfigurations</code> and returns this object, * enabling additional method calls to be chained together. * </p> * <p> * Calling this method will overwrite any * previously set <code>TopicConfigurations</code> for this object. * </p> * * @param topicConfigurations * A set of topic configurations. * * @return The updated {@link BucketNotificationConfiguration} object, * enabling additional method calls to be chained together. * * @deprecated * @see BucketNotificationConfiguration#withNotificationConfiguration(Map) */ public BucketNotificationConfiguration withTopicConfigurations( TopicConfiguration... topicConfigurations ) { setTopicConfigurations(Arrays.asList(topicConfigurations)); return this; }
/** * <p> * Creates a new bucket notification configuration with the given configuration. * </p> * * @param name the name for the configuration * @param notificationConfiguration the notification configuration for the Amazon S3 bucket. */ public BucketNotificationConfiguration(String name, NotificationConfiguration notificationConfiguration) { this.configurations = new HashMap<String, NotificationConfiguration>(); addConfiguration(name, notificationConfiguration); }
@Test public void unmarshall_ValidTopicConfiguration() throws Exception { final BucketNotificationConfiguration config = unmarshaller.unmarshall(getResource(TOPIC_INPUT)); final TopicConfiguration topicConfig = (TopicConfiguration) config.getConfigurationByName("TopicConfigId"); assertEquals("some-topic-arn", topicConfig.getTopicARN()); assertEventsUnmarshalledCorrectly(topicConfig.getEvents()); assertFilterRulesUnmarshalledCorrectly(topicConfig.getFilter().getS3KeyFilter().getFilterRules()); }
/** * <p> * Creates a new bucket notification configuration containing the specified * <code>TopicConfigurations</code>. * </p> * <p> * Passing the new configuration directly to * {@link AmazonS3#setBucketNotificationConfiguration(String,BucketNotificationConfiguration)} * will set the bucket's notification configuration and overwrite any existing configuration. * </p> * @deprecated * @see BucketNotificationConfiguration#BucketNotificationConfiguration(String, NotificationConfiguration) */ public BucketNotificationConfiguration( Collection<TopicConfiguration> topicConfigurations ) { this.configurations = new HashMap<String, NotificationConfiguration>(); if (topicConfigurations != null){ for(TopicConfiguration config : topicConfigurations) { addConfiguration(UUID.randomUUID().toString(), config); } } }
@Test public void unmarshall_ValidQueueConfiguration() throws Exception { final BucketNotificationConfiguration config = unmarshaller.unmarshall(getResource(QUEUE_INPUT)); final QueueConfiguration queueConfig = (QueueConfiguration) config.getConfigurationByName("QueueConfigId"); assertEquals("some-queue-arn", queueConfig.getQueueARN()); assertEventsUnmarshalledCorrectly(queueConfig.getEvents()); assertFilterRulesUnmarshalledCorrectly(queueConfig.getFilter().getS3KeyFilter().getFilterRules()); }
final BucketNotificationConfiguration config = new BucketNotificationConfiguration(); final Entry<String, NotificationConfiguration> entry = TopicConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("QueueConfiguration", targetDepth)) { final Entry<String, NotificationConfiguration> entry = QueueConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("CloudFunctionConfiguration", targetDepth)) { final Entry<String, NotificationConfiguration> entry = LambdaConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue());
/** * <p> * Sets the {@link BucketNotificationConfiguration.TopicConfiguration}. * </p> * <p> * Calling this method will overwrite any * previously set <code>TopicConfigurations</code> for this object. * </p> * * @param topicConfigurations * A collection of topic configurations. * * @deprecated * @see BucketNotificationConfiguration#setConfigurations(Map) */ public void setTopicConfigurations( Collection<TopicConfiguration> topicConfigurations ) { this.configurations.clear(); if (topicConfigurations != null) { for (TopicConfiguration topicConfiguration : topicConfigurations) { addConfiguration(UUID.randomUUID().toString(), topicConfiguration); } } }
@Override public String toString() { return new Gson().toJson(this.getConfigurations()); }
/** * <p> * Sets the {@link BucketNotificationConfiguration.TopicConfiguration} * <code>TopicConfigurations</code> and returns this object, enabling * additional method calls to be chained together. * </p> * <p> * Calling this method will overwrite any previously set * <code>TopicConfigurations</code> for this object. * </p> * * @param topicConfigurations A set of topic configurations. * @return The updated {@link BucketNotificationConfiguration} object, * enabling additional method calls to be chained together. * @deprecated * @see BucketNotificationConfiguration#withNotificationConfiguration(Map) */ @Deprecated public BucketNotificationConfiguration withTopicConfigurations( TopicConfiguration... topicConfigurations) { setTopicConfigurations(Arrays.asList(topicConfigurations)); return this; }
@Test public void unmarshall_ValidLambdaConfiguration() throws Exception { final BucketNotificationConfiguration config = unmarshaller.unmarshall(getResource(LAMBDA_INPUT)); final LambdaConfiguration lambdaConfig = (LambdaConfiguration) config.getConfigurationByName("LambdaConfigId"); assertEquals("some-lambda-function-arn", lambdaConfig.getFunctionARN()); assertEventsUnmarshalledCorrectly(lambdaConfig.getEvents()); assertFilterRulesUnmarshalledCorrectly(lambdaConfig.getFilter().getS3KeyFilter().getFilterRules()); }
BucketNotificationConfiguration config = new BucketNotificationConfiguration(); Entry<String, NotificationConfiguration> entry = TopicConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("QueueConfiguration", targetDepth)) { Entry<String, NotificationConfiguration> entry = QueueConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("CloudFunctionConfiguration", targetDepth)) { Entry<String, NotificationConfiguration> entry = LambdaConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue());
/** * <p> * Creates a new bucket notification configuration with the given * configuration. * </p> * * @param name the name for the configuration * @param notificationConfiguration the notification configuration for the * Amazon S3 bucket. */ public BucketNotificationConfiguration(String name, NotificationConfiguration notificationConfiguration) { this.configurations = new HashMap<String, NotificationConfiguration>(); addConfiguration(name, notificationConfiguration); }
xml.start("NotificationConfiguration", "xmlns", Constants.XML_NAMESPACE); Map<String, NotificationConfiguration> configurations = notificationConfiguration .getConfigurations();
/** * <p> * Sets the {@link BucketNotificationConfiguration.TopicConfiguration} * <code>TopicConfigurations</code> and returns this object, * enabling additional method calls to be chained together. * </p> * <p> * Calling this method will overwrite any * previously set <code>TopicConfigurations</code> for this object. * </p> * * @param topicConfigurations * A set of topic configurations. * * @return The updated {@link BucketNotificationConfiguration} object, * enabling additional method calls to be chained together. * * @deprecated * @see BucketNotificationConfiguration#withNotificationConfiguration(Map) */ public BucketNotificationConfiguration withTopicConfigurations( TopicConfiguration... topicConfigurations ) { setTopicConfigurations(Arrays.asList(topicConfigurations)); return this; }
/** * If CloudFunctionConfiguration has the InvocationRole attribute it should be unmarshalled into * a {@link CloudFunctionConfiguration} */ @Test public void unmarshall_ValidCloudFunctionConfiguration() throws Exception { final BucketNotificationConfiguration config = unmarshaller.unmarshall(getResource(CLOUD_FUNCTION_INPUT)); final CloudFunctionConfiguration cloudFunctionConfig = (CloudFunctionConfiguration) config .getConfigurationByName("CloudFunctionConfigId"); assertEquals("some-cloud-function-arn", cloudFunctionConfig.getCloudFunctionARN()); assertEquals("some-cloud-invoc-role", cloudFunctionConfig.getInvocationRoleARN()); assertEventsUnmarshalledCorrectly(cloudFunctionConfig.getEvents()); assertFilterRulesUnmarshalledCorrectly(cloudFunctionConfig.getFilter().getS3KeyFilter().getFilterRules()); }
final BucketNotificationConfiguration config = new BucketNotificationConfiguration(); final Entry<String, NotificationConfiguration> entry = TopicConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("QueueConfiguration", targetDepth)) { final Entry<String, NotificationConfiguration> entry = QueueConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue()); } else if (context.testExpression("CloudFunctionConfiguration", targetDepth)) { final Entry<String, NotificationConfiguration> entry = LambdaConfigurationStaxUnmarshaller.getInstance() .unmarshall(context); config.addConfiguration(entry.getKey(), entry.getValue());
/** * <p> * Sets the {@link BucketNotificationConfiguration.TopicConfiguration}. * </p> * <p> * Calling this method will overwrite any previously set * <code>TopicConfigurations</code> for this object. * </p> * * @param topicConfigurations A collection of topic configurations. * @deprecated * @see BucketNotificationConfiguration#setConfigurations(Map) */ @Deprecated public void setTopicConfigurations(Collection<TopicConfiguration> topicConfigurations) { this.configurations.clear(); if (topicConfigurations != null) { for (final TopicConfiguration topicConfiguration : topicConfigurations) { addConfiguration(UUID.randomUUID().toString(), topicConfiguration); } } }
@Override public String toString() { return new Gson().toJson(this.getConfigurations()); }