Created
March 25, 2017 23:35
-
-
Save bytekast/343c022fb38d854faafb67da217c02a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.services.lambda.runtime.Context | |
import groovy.transform.ToString | |
@ToString(includePackage = false) | |
class Request { | |
private final Map input | |
private final Context context | |
Request(final Map input, final Context context) { | |
this.input = input | |
this.context = context | |
} | |
String requestId() { | |
context?.awsRequestId | |
} | |
String resourcePath() { | |
input?.resource ?: 'unknown' | |
} | |
String httpMethod() { | |
input?.httpMethod ?: 'unknown' | |
} | |
String queryString(String name) { | |
input?.queryStringParameters?."${name}"?.trim() | |
} | |
String pathParameter(String name) { | |
input?.pathParameters?."${name}"?.trim() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment