Skip to content

Commit df8aa73

Browse files
committed
Hello, world!
1 parent e9aa45b commit df8aa73

File tree

7 files changed

+90
-17
lines changed

7 files changed

+90
-17
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Ignore Gradle project-specific cache directory
21
.gradle
3-
4-
# Ignore Gradle build output directory
52
build
3+
4+
.idea

build.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
/*
2-
* This file was generated by the Gradle 'init' task.
3-
*
4-
* This is a general purpose Gradle build.
5-
* Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.0/samples
6-
*/
1+
plugins {
2+
kotlin("jvm").version("1.4.32").apply(false)
3+
id("com.github.johnrengelman.shadow").version("6.1.0").apply(false)
4+
}
5+
6+
subprojects {
7+
repositories {
8+
mavenCentral()
9+
}
10+
}

gradle/libs.versions.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[versions]
2+
aws-lambda-java-events = "3.8.0"
3+
aws-lambda-java-core = "1.2.1"
4+
aws-lambda-java-log4j2 = "1.2.0"
5+
6+
jackson = "2.12.3"
7+
8+
tgbotapi = "0.33.3"
9+
10+
log4j = "2.14.1"
11+
12+
[libraries]
13+
aws-lambda-java-events = { group = "com.amazonaws", name = "aws-lambda-java-events", version.ref = "aws-lambda-java-events" }
14+
aws-lambda-java-core = { group = "com.amazonaws", name = "aws-lambda-java-core", version.ref = "aws-lambda-java-core" }
15+
aws-lambda-java-log4j2 = { group = "com.amazonaws", name = "aws-lambda-java-log4j2", version.ref = "aws-lambda-java-log4j2" }
16+
17+
jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
18+
19+
tgbotapi-core = { group = "dev.inmo", name = "tgbotapi.core", version.ref = "tgbotapi" }
20+
21+
log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
22+
log4j-slf4j-impl = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j" }
23+
24+
[bundles]
25+
tgbotapi = ["tgbotapi-core"]
26+
log4j = ["log4j-core", "log4j-slf4j-impl"]
27+
aws-lambda = ["aws-lambda-java-events", "aws-lambda-java-core", "aws-lambda-java-log4j2", "jackson-databind"]

runners/lambda/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
plugins {
2+
kotlin("jvm")
3+
id("com.github.johnrengelman.shadow")
4+
}
5+
6+
dependencies {
7+
implementation(libs.bundles.aws.lambda)
8+
implementation(libs.bundles.tgbotapi)
9+
implementation(libs.bundles.log4j)
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package by.jprof.telegram.bot.runners.lambda
2+
3+
import com.amazonaws.services.lambda.runtime.Context
4+
import com.amazonaws.services.lambda.runtime.RequestHandler
5+
import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent
6+
import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse
7+
8+
@Suppress("unused")
9+
class JProf : RequestHandler<APIGatewayV2HTTPEvent, APIGatewayV2HTTPResponse> {
10+
override fun handleRequest(input: APIGatewayV2HTTPEvent, context: Context): APIGatewayV2HTTPResponse {
11+
return APIGatewayV2HTTPResponse
12+
.builder()
13+
.withStatusCode(200)
14+
.withBody("Hello, world!")
15+
.build()
16+
}
17+
}

runners/lambda/template.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Transform: AWS::Serverless-2016-10-31
3+
4+
Globals:
5+
Function:
6+
Timeout: 20
7+
MemorySize: 512
8+
9+
Resources:
10+
Handler:
11+
Type: AWS::Serverless::Function
12+
Properties:
13+
CodeUri: build/libs/lambda-all.jar
14+
Handler: by.jprof.telegram.bot.runners.lambda.JProf
15+
Runtime: java11
16+
Events:
17+
Invoke:
18+
Type: Api
19+
Properties:
20+
Path: /
21+
Method: get

settings.gradle.kts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
/*
2-
* This file was generated by the Gradle 'init' task.
3-
*
4-
* The settings file is used to specify which projects to include in your build.
5-
*
6-
* Detailed information about configuring a multi-project build in Gradle can be found
7-
* in the user manual at https://docs.gradle.org/7.0/userguide/multi_project_builds.html
8-
*/
1+
enableFeaturePreview("VERSION_CATALOGS")
92

103
rootProject.name = "jprof_by_bot"
4+
5+
include(":runners:lambda")

0 commit comments

Comments
 (0)