Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add flink jar handlers #204

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 46 additions & 34 deletions client_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -104,6 +104,23 @@ FlinkApplicationVersion:
- ServiceFlinkDeleteApplicationVersion
- ServiceFlinkGetApplicationVersion
- ServiceFlinkValidateApplicationVersion
FlinkJarApplication:
- ServiceFlinkCreateJarApplication
- ServiceFlinkDeleteJarApplication
- ServiceFlinkGetJarApplication
- ServiceFlinkListJarApplications
- ServiceFlinkUpdateJarApplication
FlinkJarApplicationDeployment:
- ServiceFlinkCancelJarApplicationDeployment
- ServiceFlinkCreateJarApplicationDeployment
- ServiceFlinkDeleteJarApplicationDeployment
- ServiceFlinkGetJarApplicationDeployment
- ServiceFlinkListJarApplicationDeployments
- ServiceFlinkStopJarApplicationDeployment
FlinkJarApplicationVersion:
- ServiceFlinkCreateJarApplicationVersion
- ServiceFlinkDeleteJarApplicationVersion
- ServiceFlinkGetJarApplicationVersion
FlinkJob:
- ServiceFlinkJobDetails
- ServiceFlinkJobsList
18 changes: 14 additions & 4 deletions generator/main.go
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import (
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"

@@ -464,7 +465,7 @@ func exec() error {
// reMakesSense sometimes there are invalid enums, for instance, just a comma ","
var reMakesSense = regexp.MustCompile(`\w`)

//nolint:funlen // It's a generator, it's supposed to be long, and we won't expand it.
//nolint:funlen,nestif // It's a generator, it's supposed to be long, and we won't expand it.
func writeStruct(f *jen.File, s *Schema) error {
if s.isAnonymous() {
return nil
@@ -477,7 +478,6 @@ func writeStruct(f *jen.File, s *Schema) error {

enums := make([]jen.Code, 0)
values := make([]jen.Code, 0)

for _, e := range s.Enum {
literal := fmt.Sprint(e)
if !reMakesSense.MatchString(literal) {
@@ -496,8 +496,18 @@ func writeStruct(f *jen.File, s *Schema) error {
constant += "Asterisk"
}

enums = append(enums, jen.Id(constant).Op(s.CamelName).Op("=").Lit(literal))
values = append(values, jen.Lit(literal))
// Turns integer literals into integers
var v any = literal
if s.Type == SchemaTypeInteger {
i, err := strconv.Atoi(literal)
if err != nil {
return err
}
v = i
}

enums = append(enums, jen.Id(constant).Op(s.CamelName).Op("=").Lit(v))
values = append(values, jen.Lit(v))
}

if len(enums) == 0 {
Loading
Loading