Skip to content

Commit 83c3df9

Browse files
kolaamoo25kolaamoo
andauthored
Add Go as a supported language for code generation through the EventBridge Schemas service (#3081)
Co-authored-by: Kolawole Amoo <[email protected]>
1 parent df541b5 commit 83c3df9

File tree

5 files changed

+53
-2
lines changed

5 files changed

+53
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "Adding Go (Golang) as a supported language for code binding generation through the EventBridge Schemas service"
4+
}

jetbrains-core/src/software/aws/toolkits/jetbrains/services/lambda/wizard/SchemaSelectionPanel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class SchemaSelectionPanel : WizardFragment {
105105
BuiltInRuntimeGroups.Java -> SchemaCodeLangs.JAVA8
106106
BuiltInRuntimeGroups.Python -> SchemaCodeLangs.PYTHON3_6
107107
BuiltInRuntimeGroups.NodeJs -> SchemaCodeLangs.TYPESCRIPT
108+
BuiltInRuntimeGroups.Go -> SchemaCodeLangs.GO1
108109
else -> throw IllegalStateException("Schemas is not supported by $this")
109110
}
110111
}

jetbrains-core/src/software/aws/toolkits/jetbrains/services/schemas/Schemas.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ enum class SchemaCodeLangs(
1616
) {
1717
JAVA8("Java8", message("schemas.schema.language.java8"), "java", BuiltInRuntimeGroups.Java),
1818
PYTHON3_6("Python36", message("schemas.schema.language.python3_6"), "py", BuiltInRuntimeGroups.Python),
19-
TYPESCRIPT("TypeScript3", message("schemas.schema.language.typescript"), "ts", BuiltInRuntimeGroups.NodeJs);
19+
TYPESCRIPT("TypeScript3", message("schemas.schema.language.typescript"), "ts", BuiltInRuntimeGroups.NodeJs),
20+
GO1("Go1", message("schemas.schema.language.go1"), "go", BuiltInRuntimeGroups.Go);
2021

2122
override fun toString() = text
2223
}

jetbrains-ultimate/src/software/aws/toolkits/jetbrains/services/lambda/go/GoSamProjectWizard.kt

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class GoSamProjectWizard : SamProjectWizard {
2828
override fun createSdkSelectionPanel(projectLocation: TextFieldWithBrowseButton?): SdkSelector = GoSdkSelectionPanel()
2929

3030
override fun listTemplates(): Collection<SamProjectTemplate> = listOf(
31-
SamHelloWorldGo()
31+
SamHelloWorldGo(),
32+
SamEventBridgeHelloWorldGo(),
33+
SamEventBridgeStarterAppGo()
3234
)
3335
}
3436

@@ -70,3 +72,45 @@ class SamHelloWorldGo : SamAppTemplateBased() {
7072

7173
override val dependencyManager: String = "mod"
7274
}
75+
76+
class SamEventBridgeHelloWorldGo : SamAppTemplateBased() {
77+
override fun postCreationAction(settings: SamNewProjectSettings, contentRoot: VirtualFile, rootModel: ModifiableRootModel, indicator: ProgressIndicator) {
78+
super.postCreationAction(settings, contentRoot, rootModel, indicator)
79+
// Turn off indexing entire gopath for the project since we are using go modules
80+
GoProjectLibrariesService.getInstance(rootModel.project).isIndexEntireGopath = false
81+
// Turn on vgo integration, required for it to resolve dependencies properly
82+
VgoProjectSettings.getInstance(rootModel.project).isIntegrationEnabled = true
83+
}
84+
85+
override fun displayName() = message("sam.init.template.event_bridge_hello_world.name")
86+
override fun description() = message("sam.init.template.event_bridge_hello_world.description")
87+
88+
override fun supportedZipRuntimes(): Set<LambdaRuntime> = setOf(LambdaRuntime.GO1_X)
89+
override fun supportedImageRuntimes() = emptySet<LambdaRuntime>()
90+
91+
override val appTemplateName: String = "eventBridge-hello-world"
92+
93+
override val dependencyManager: String = "mod"
94+
}
95+
96+
class SamEventBridgeStarterAppGo : SamAppTemplateBased() {
97+
override fun postCreationAction(settings: SamNewProjectSettings, contentRoot: VirtualFile, rootModel: ModifiableRootModel, indicator: ProgressIndicator) {
98+
super.postCreationAction(settings, contentRoot, rootModel, indicator)
99+
// Turn off indexing entire gopath for the project since we are using go modules
100+
GoProjectLibrariesService.getInstance(rootModel.project).isIndexEntireGopath = false
101+
// Turn on vgo integration, required for it to resolve dependencies properly
102+
VgoProjectSettings.getInstance(rootModel.project).isIntegrationEnabled = true
103+
}
104+
105+
override fun displayName() = message("sam.init.template.event_bridge_starter_app.name")
106+
override fun description() = message("sam.init.template.event_bridge_starter_app.description")
107+
108+
override fun supportedZipRuntimes(): Set<LambdaRuntime> = setOf(LambdaRuntime.GO1_X)
109+
override fun supportedImageRuntimes() = emptySet<LambdaRuntime>()
110+
111+
override val appTemplateName: String = "eventBridge-schema-app"
112+
113+
override fun supportsDynamicSchemas(): Boolean = true
114+
115+
override val dependencyManager: String = "mod"
116+
}

resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ schemas.schema.download_code_bindings.validation.language_required=Schema code l
972972
schemas.schema.download_code_bindings.validation.version_required=Schema version must be specified
973973
schemas.schema.download_code_bindings.version.label=Version:
974974
schemas.schema.download_code_bindings.version.tooltip=The version of the Schema to download generated code bindings for
975+
schemas.schema.language.go1=Go 1+
975976
schemas.schema.language.java8=Java 8+
976977
schemas.schema.language.python3_6=Python 3.6+
977978
schemas.schema.language.typescript=Typescript 3+

0 commit comments

Comments
 (0)