Skip to content

Instantly share code, notes, and snippets.

@bytekast
Created March 25, 2017 23:35
Show Gist options
  • Save bytekast/343c022fb38d854faafb67da217c02a7 to your computer and use it in GitHub Desktop.
Save bytekast/343c022fb38d854faafb67da217c02a7 to your computer and use it in GitHub Desktop.
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