Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. 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.lambda.model;
 
 
Container for the parameters to the CreateEventSourceMapping operation.

Identifies a stream as an event source for a Lambda function. It can be either an Amazon Kinesis stream or an Amazon DynamoDB stream. AWS Lambda invokes the specified function when records are posted to the stream.

This is the pull model, where AWS Lambda invokes the function. For more information, go to AWS Lambda: How it Works in the AWS Lambda Developer Guide .

This association between an Amazon Kinesis stream and a Lambda function is called the event source mapping. You provide the configuration information (for example, which stream to read from and which Lambda function to invoke) for the event source mapping in the request body.

Each event source, such as an Amazon Kinesis or a DynamoDB stream, can be associated with multiple AWS Lambda function. A given Lambda function can be associated with multiple AWS event sources.

This operation requires permission for the lambda:CreateEventSourceMapping action.

 
 public class CreateEventSourceMappingRequest extends AmazonWebServiceRequest implements SerializableCloneable {

    
The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.

Constraints:
Pattern: arn:aws:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)

 
     private String eventSourceArn;

    
The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

Constraints:
Length: 1 - 111
Pattern: (arn:aws:lambda:)?([a-z]{2}-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)

 
     private String functionName;

    
Indicates whether AWS Lambda should begin polling the event source.
 
     private Boolean enabled;

    
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.

Constraints:
Range: 1 - 10000

 
     private Integer batchSize;

    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

    private String startingPosition;

    
The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.

Constraints:
Pattern: arn:aws:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)

Returns:
The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.
    public String getEventSourceArn() {
        return ;
    }
    
    
The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.

Constraints:
Pattern: arn:aws:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)

Parameters:
eventSourceArn The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.
    public void setEventSourceArn(String eventSourceArn) {
        this. = eventSourceArn;
    }
    
    
The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Pattern: arn:aws:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)

Parameters:
eventSourceArn The Amazon Resource Name (ARN) of the Amazon Kinesis stream that is the event source. Any record added to this stream could cause AWS Lambda to invoke your Lambda function, it depends on the BatchSize. AWS Lambda POSTs the Amazon Kinesis event, containing records, to your Lambda function as JSON.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CreateEventSourceMappingRequest withEventSourceArn(String eventSourceArn) {
        this. = eventSourceArn;
        return this;
    }

    
The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

Constraints:
Length: 1 - 111
Pattern: (arn:aws:lambda:)?([a-z]{2}-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)

Returns:
The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

    public String getFunctionName() {
        return ;
    }
    
    
The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

Constraints:
Length: 1 - 111
Pattern: (arn:aws:lambda:)?([a-z]{2}-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)

Parameters:
functionName The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

    public void setFunctionName(String functionName) {
        this. = functionName;
    }
    
    
The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 111
Pattern: (arn:aws:lambda:)?([a-z]{2}-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)

Parameters:
functionName The Lambda function to invoke when AWS Lambda detects an event on the stream.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

Returns:
A reference to this updated object so that method calls can be chained together.
        this. = functionName;
        return this;
    }

    
Indicates whether AWS Lambda should begin polling the event source.

Returns:
Indicates whether AWS Lambda should begin polling the event source.
    public Boolean isEnabled() {
        return ;
    }
    
    
Indicates whether AWS Lambda should begin polling the event source.

Parameters:
enabled Indicates whether AWS Lambda should begin polling the event source.
    public void setEnabled(Boolean enabled) {
        this. = enabled;
    }
    
    
Indicates whether AWS Lambda should begin polling the event source.

Returns a reference to this object so that method calls can be chained together.

Parameters:
enabled Indicates whether AWS Lambda should begin polling the event source.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = enabled;
        return this;
    }

    
Indicates whether AWS Lambda should begin polling the event source.

Returns:
Indicates whether AWS Lambda should begin polling the event source.
    public Boolean getEnabled() {
        return ;
    }

    
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.

Constraints:
Range: 1 - 10000

Returns:
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.
    public Integer getBatchSize() {
        return ;
    }
    
    
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.

Constraints:
Range: 1 - 10000

Parameters:
batchSize The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.
    public void setBatchSize(Integer batchSize) {
        this. = batchSize;
    }
    
    
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 1 - 10000

Parameters:
batchSize The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. Your function receives an event with all the retrieved records. The default is 100 records.
Returns:
A reference to this updated object so that method calls can be chained together.
        this. = batchSize;
        return this;
    }

    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

Returns:
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.
See also:
EventSourcePosition
    public String getStartingPosition() {
        return ;
    }
    
    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

Parameters:
startingPosition The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.
See also:
EventSourcePosition
    public void setStartingPosition(String startingPosition) {
        this. = startingPosition;
    }
    
    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

Parameters:
startingPosition The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
EventSourcePosition
    public CreateEventSourceMappingRequest withStartingPosition(String startingPosition) {
        this. = startingPosition;
        return this;
    }

    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

Parameters:
startingPosition The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.
See also:
EventSourcePosition
    public void setStartingPosition(EventSourcePosition startingPosition) {
        this. = startingPosition.toString();
    }
    
    
The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: TRIM_HORIZON, LATEST

Parameters:
startingPosition The position in the stream where AWS Lambda should start reading. For more information, go to ShardIteratorType in the Amazon Kinesis API Reference.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
EventSourcePosition
        this. = startingPosition.toString();
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getEventSourceArn() != nullsb.append("EventSourceArn: " + getEventSourceArn() + ",");
        if (getFunctionName() != nullsb.append("FunctionName: " + getFunctionName() + ",");
        if (isEnabled() != nullsb.append("Enabled: " + isEnabled() + ",");
        if (getBatchSize() != nullsb.append("BatchSize: " + getBatchSize() + ",");
        if (getStartingPosition() != nullsb.append("StartingPosition: " + getStartingPosition() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getEventSourceArn() == null) ? 0 : getEventSourceArn().hashCode()); 
        hashCode = prime * hashCode + ((getFunctionName() == null) ? 0 : getFunctionName().hashCode()); 
        hashCode = prime * hashCode + ((isEnabled() == null) ? 0 : isEnabled().hashCode()); 
        hashCode = prime * hashCode + ((getBatchSize() == null) ? 0 : getBatchSize().hashCode()); 
        hashCode = prime * hashCode + ((getStartingPosition() == null) ? 0 : getStartingPosition().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CreateEventSourceMappingRequest == falsereturn false;
        
        if (other.getEventSourceArn() == null ^ this.getEventSourceArn() == nullreturn false;
        if (other.getEventSourceArn() != null && other.getEventSourceArn().equals(this.getEventSourceArn()) == falsereturn false
        if (other.getFunctionName() == null ^ this.getFunctionName() == nullreturn false;
        if (other.getFunctionName() != null && other.getFunctionName().equals(this.getFunctionName()) == falsereturn false
        if (other.isEnabled() == null ^ this.isEnabled() == nullreturn false;
        if (other.isEnabled() != null && other.isEnabled().equals(this.isEnabled()) == falsereturn false
        if (other.getBatchSize() == null ^ this.getBatchSize() == nullreturn false;
        if (other.getBatchSize() != null && other.getBatchSize().equals(this.getBatchSize()) == falsereturn false
        if (other.getStartingPosition() == null ^ this.getStartingPosition() == nullreturn false;
        if (other.getStartingPosition() != null && other.getStartingPosition().equals(this.getStartingPosition()) == falsereturn false
        return true;
    }
    
    @Override
        
            return (CreateEventSourceMappingRequestsuper.clone();
    }
}
    
New to GrepCode? Check out our FAQ X