Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 Amazon Technologies, Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at:
   *
   *    http://aws.amazon.com/apache2.0
   *
  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  * OR CONDITIONS OF ANY KIND, either express or implied. See the
  * License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.amazonaws.services.s3.event;
 
 import java.util.List;
 
 
A helper class that represents a strongly typed S3 EventNotification item sent to SQS
 
 public class S3EventNotification {
     private final List<S3EventNotificationRecordrecords;
 
     @JsonCreator
     public S3EventNotification(
             @JsonProperty(value = "Records"List<S3EventNotificationRecordrecords)
     {
         this. = records;
     }

    

Parse the JSON string into a S3EventNotification object.

The function will try its best to parse input JSON string as best as it can. It will not fail even if the JSON string contains unknown properties. The function will throw AmazonClientException if the input JSON string is not valid JSON.

Parameters:
json JSON string to parse. Typically this is the body of your SQS notification message body.
Returns:
The resulting S3EventNotification object.
 
     public static S3EventNotification parseJson(String json) {
         return Jackson.fromJsonString(jsonS3EventNotification.class);
     }
 
         return ;
     }
 
     public static class UserIdentityEntity {
         private final String principalId;
 
         @JsonCreator
         public UserIdentityEntity(
                 @JsonProperty(value = "principalId"String principalId) {
             this. = principalId;
         }
 
         public String getPrincipalId() {
             return ;
         }
     }
 
     public static class S3BucketEntity {
         private final String name;
         private final UserIdentityEntity ownerIdentity;
         private final String arn;
 
         @JsonCreator
         public S3BucketEntity(
                 @JsonProperty(value = "name"String name,
                 @JsonProperty(value = "ownerIdentity"UserIdentityEntity ownerIdentity,
                 @JsonProperty(value = "arn"String arn)
         {
             this. = name;
             this. = ownerIdentity;
             this. = arn;
         }
 
         public String getName() {
             return ;
         }
 
         public UserIdentityEntity getOwnerIdentity() {
             return ;
         }
 
        public String getArn() {
            return ;
        }
    }
    public static class S3ObjectEntity {
        private final String key;
        private final Long size;
        private final String eTag;
        private final String versionId;
        @Deprecated
        public S3ObjectEntity(
                String key,
                Integer size,
                String eTag,
                String versionId)
        {
            this. = key;
            this. = size == null ? null : size.longValue();
            this. = eTag;
            this. = versionId;
        }
        @JsonCreator
        public S3ObjectEntity(
                @JsonProperty(value = "key"String key,
                @JsonProperty(value = "size"Long size,
                @JsonProperty(value = "eTag"String eTag,
                @JsonProperty(value = "versionId"String versionId)
        {
            this. = key;
            this. = size;
            this. = eTag;
            this. = versionId;
        }
        public String getKey() {
            return ;
        }

        

Deprecated:
use getSizeAsLong() instead.
        @Deprecated
        public Integer getSize() {
            return  == null ? null : .intValue();
        }
        @JsonProperty(value = "size")
        public Long getSizeAsLong() {
            return ;
        }
        public String geteTag() {
            return ;
        }
        public String getVersionId() {
            return ;
        }
    }
    public static class S3Entity {
        private final String configurationId;
        private final S3BucketEntity bucket;
        private final S3ObjectEntity object;
        private final String s3SchemaVersion;
        @JsonCreator
        public S3Entity(
                @JsonProperty(value = "configurationId"String configurationId,
                @JsonProperty(value = "bucket"S3BucketEntity bucket,
                @JsonProperty(value = "object"S3ObjectEntity object,
                @JsonProperty(value = "s3SchemaVersion"String s3SchemaVersion)
        {
            this. = configurationId;
            this. = bucket;
            this. = object;
            this. = s3SchemaVersion;
        }
        public String getConfigurationId() {
            return ;
        }
        public S3BucketEntity getBucket() {
            return ;
        }
        public S3ObjectEntity getObject() {
            return ;
        }
        public String getS3SchemaVersion() {
            return ;
        }
    }
    public static class RequestParametersEntity {
        private final String sourceIPAddress;
        @JsonCreator
        public RequestParametersEntity(
                @JsonProperty(value = "sourceIPAddress"String sourceIPAddress)
        {
            this. = sourceIPAddress;
        }
        public String getSourceIPAddress() {
            return ;
        }
    }
    public static class ResponseElementsEntity {
        private final String xAmzId2;
        private final String xAmzRequestId;
        @JsonCreator
        public ResponseElementsEntity(
                @JsonProperty(value = "x-amz-id-2"String xAmzId2,
                @JsonProperty(value = "x-amz-request-id"String xAmzRequestId)
        {
            this. = xAmzId2;
            this. = xAmzRequestId;
        }
        public String getxAmzId2() {
            return ;
        }
        public String getxAmzRequestId() {
            return ;
        }
    }
    public static class S3EventNotificationRecord {
        private final String awsRegion;
        private final String eventName;
        private final String eventSource;
        private DateTime eventTime = null;
        private final String eventVersion;
        private final RequestParametersEntity requestParameters;
        private final ResponseElementsEntity responseElements;
        private final S3Entity s3;
        private final UserIdentityEntity userIdentity;
        @JsonCreator
        public S3EventNotificationRecord(
                @JsonProperty(value = "awsRegion"String awsRegion,
                @JsonProperty(value = "eventName"String eventName,
                @JsonProperty(value = "eventSource"String eventSource,
                @JsonProperty(value = "eventTime"String eventTime,
                @JsonProperty(value = "eventVersion"String eventVersion,
                @JsonProperty(value = "requestParameters"RequestParametersEntity requestParameters,
                @JsonProperty(value = "responseElements"ResponseElementsEntity responseElements,
                @JsonProperty(value = "s3"S3Entity s3,
                @JsonProperty(value = "userIdentity"UserIdentityEntity userIdentity)
        {
            this. = awsRegion;
            this. = eventName;
            this. = eventSource;
            if (eventTime != null)
            {
                this. = DateTime.parse(eventTime);
            }
            this. = eventVersion;
            this. = requestParameters;
            this. = responseElements;
            this. = s3;
            this. = userIdentity;
        }
        public String getAwsRegion() {
            return ;
        }
        public String getEventName() {
            return ;
        }
        public String getEventSource() {
            return ;
        }
        public DateTime getEventTime() {
            return ;
        }
        public String getEventVersion() {
            return ;
        }
        public RequestParametersEntity getRequestParameters() {
            return ;
        }
        public ResponseElementsEntity getResponseElements() {
            return ;
        }
        public S3Entity getS3() {
            return ;
        }
        public UserIdentityEntity getUserIdentity() {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X