Instantly share code, notes, and snippets.

Embed
What would you like to do?
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