forked from aws/aws-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLambdaFunction.java
More file actions
91 lines (84 loc) · 3.19 KB
/
LambdaFunction.java
File metadata and controls
91 lines (84 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright 2015-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.invoke;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.commons.logging.LogFactory;
import com.amazonaws.services.lambda.model.InvocationType;
import com.amazonaws.services.lambda.model.InvokeRequest;
import com.amazonaws.services.lambda.model.LogType;
/**
* An annotation that marks methods of an interface that are meant to be
* proxied to remote code running on AWS Lambda. Methods may accept zero or
* one arguments, and may return zero or one values. Inputs and outputs will
* be converted to/from JSON using the Jackson {@code ObjectMapper}.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface LambdaFunction {
/**
* The name of the Lambda function to invoke for this annotated method. If
* not explicitly set, the name of the interface method is used.
* <p>
* <code>
* public interface LambdaFunctions {
* @LambdaFunction(functionName="ActualFunctionName")
* void notTheRealFunctionName();
* }
* </code>
*
* @see InvokeRequest#setFunctionName(String)
*/
String functionName() default "";
/**
* The type of invocation to use. If unspecified, defaults to
* {@code RequestResponse}. If a {@code logType} of anything other than
* {@code None} is specified, the invocation type may <b>only</b> be set to
* {@code RequestResponse}.
* <p>
* <code>
* public interface LambdaFunctions {
* @LambdaFunction(functionName="DoIt")
* void doIt();
*
* @LambdaFunction(functionName="DoIt",
* invocationType=InvocationType.Event)
* void doItAsynchronously();
*
* @LambdaFunction(functionName="DoIt",
* invocationType=InvocationType.DryRun)
* void dryRunIt();
* }
* </code>
*
* @see InvokeRequest#setInvocationType(InvocationType)
*/
InvocationType invocationType() default InvocationType.RequestResponse;
/**
* The type of log to request from the service. If unspecified, no logs
* will be requested. If specified, the invocation type may <b>only</b> be
* set to {@code RequestResponse}.
* <p>
* When specified, the log information returned by the Lambda function will
* be emitted to the JCL log for the interface class at the {@code INFO}
* level.
*
* @see InvokeRequest#setLogType(LogType)
* @see LogFactory#getLog(Class)
*/
LogType logType() default LogType.None;
}