-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
74 lines (61 loc) · 1.97 KB
/
build.gradle
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
import com.amazonaws.*;
import com.amazonaws.services.lambda.model.*;
import jp.classmethod.aws.gradle.lambda.AWSLambdaDeleteFunctionTask;
import jp.classmethod.aws.gradle.lambda.AWSLambdaInvokeTask;
import jp.classmethod.aws.gradle.lambda.AWSLambdaMigrateFunctionTask;
buildscript {
ext.kotlin_version = '1.0.5-2'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
classpath "jp.classmethod.aws:gradle-aws-plugin:0.22"
}
}
group 'org.openasr.idear'
version '1.0-SNAPSHOT'
ext.artifactId = 'idear-lambda'
ext.functionName = 'IdearLexFulfillment'
apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'jp.classmethod.aws.lambda'
repositories {
mavenCentral()
}
dependencies {
compile 'com.amazonaws:aws-lambda-java-core:1.1.0'
compile 'com.amazonaws:aws-lambda-java-events:1.3.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
// ======== bundle ========
jar {
into('lib') {
from configurations.compile
}
}
// ======== deploy ========
aws {
profileName "idear"
region "us-east-1"
}
task migrateFunction(type: AWSLambdaMigrateFunctionTask, dependsOn: build) {
functionName = project.functionName
role = "arn:aws:iam::${aws.accountId}:role/service-role/lambda_basic_execution"
runtime = Runtime.Java8
zipFile = jar.archivePath
handler = "org.openasr.idear.lambda.LexFulfillment"
}
task invokeFunction(type: AWSLambdaInvokeTask) {
functionName = project.functionName
invocationType = InvocationType.RequestResponse
payload = file("src/test/resources/postText-add_new_class.json")
doLast {
println "Lambda function result: " + new String(invokeResult.payload.array(), "UTF-8")
}
}
task deleteFunction(type: AWSLambdaDeleteFunctionTask) {
functionName = project.functionName
}