Skip to content

Commit

Permalink
feat: add flink jar handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov committed Dec 18, 2024
1 parent be24a2c commit 5e6dc75
Show file tree
Hide file tree
Showing 6 changed files with 781 additions and 38 deletions.
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
Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 5e6dc75

Please sign in to comment.