diff --git a/code/go/dse/Makefile b/code/go/dse/Makefile index 849c7aa..57355d4 100644 --- a/code/go/dse/Makefile +++ b/code/go/dse/Makefile @@ -8,22 +8,22 @@ KIND_YAML_FILES = $(shell ls $(KIND_YAML_DIR)/*.yaml) .PHONY: generate -generate: kind +generate: clean kind kind: $(KIND_YAML_FILES) + @echo "package kind" > kind/kind.go .PHONY: $(KIND_YAML_FILES) $(KIND_YAML_FILES): @echo $$(basename $@) - @mkdir -p kind - @~/go/bin/oapi-codegen -config config.yaml $@ > kind/$$(basename $@).go - @sed -i '/delete_this_line/d' kind/$$(basename $@).go - @sed -i '/\/\//d' kind/$$(basename $@).go - @sed -i '/./!d' kind/$$(basename $@).go - @sed -i -e 's/externalRef[[:digit:]]*\.//g' kind/$$(basename $@).go - @sed -i -e 's/`json:"/`yaml:"/g' kind/$$(basename $@).go - @go fmt kind/$$(basename $@).go + @~/go/bin/oapi-codegen -config kind/config.yaml $@ > kind/$$(basename $@ .yaml).go + @sed -i '/delete_this_line/d' kind/$$(basename $@ .yaml).go + @sed -i '/\/\//d' kind/$$(basename $@ .yaml).go + @sed -i '/./!d' kind/$$(basename $@ .yaml).go + @sed -i -e 's/externalRef[[:digit:]]*\.//g' kind/$$(basename $@ .yaml).go + @sed -i -e 's/`json:"/`yaml:"/g' kind/$$(basename $@ .yaml).go + @go fmt kind/$$(basename $@ .yaml).go .PHONY: clean clean: - @rm -rf kind + @rm -f kind/*.go diff --git a/code/go/dse/README.md b/code/go/dse/README.md new file mode 100644 index 0000000..a4b8bb0 --- /dev/null +++ b/code/go/dse/README.md @@ -0,0 +1,13 @@ +## Install the Module + +```bash +# Latest version. +$ export GOPRIVATE=github.com/boschglobal +$ go get github.com/boschglobal/dse.schemas/code/go/dse + +# Specific tagged version. +$ go get github.com/boschglobal/dse.schemas/code/go/dse@vX.Y.Z + +# Debug for go get command +$ go get -x github.com/boschglobal/dse.schemas/code/go/dse +``` diff --git a/code/go/dse/kind/Manifest.go b/code/go/dse/kind/Manifest.go new file mode 100644 index 0000000..b50f348 --- /dev/null +++ b/code/go/dse/kind/Manifest.go @@ -0,0 +1,71 @@ +package kind + +import () + +const ( + ManifestKindManifest ManifestKind = "Manifest" +) +const ( + Redispubsub SimulationParametersTransport = "redispubsub" +) + +type File struct { + Generate *string `yaml:"generate,omitempty"` + Modelc *bool `yaml:"modelc,omitempty"` + Name string `yaml:"name"` + Processing *string `yaml:"processing,omitempty"` + Repo *string `yaml:"repo,omitempty"` + Uri *string `yaml:"uri,omitempty"` +} +type Manifest struct { + Kind ManifestKind `yaml:"kind"` + Metadata *ObjectMetadata `yaml:"metadata,omitempty"` + Spec ManifestSpec `yaml:"spec"` +} +type ManifestKind string +type ManifestSpec struct { + Documentation *[]File `yaml:"documentation,omitempty"` + Models []Model `yaml:"models"` + Repos []Repo `yaml:"repos"` + Simulations []Simulation `yaml:"simulations"` + Tools []Tool `yaml:"tools"` +} +type Model struct { + Arch *string `yaml:"arch,omitempty"` + Channels *[]Channel `yaml:"channels,omitempty"` + Name string `yaml:"name"` + Repo string `yaml:"repo"` + Schema *string `yaml:"schema,omitempty"` + Version string `yaml:"version"` +} +type ModelInstanceDefinition struct { + Channels []Channel `yaml:"channels"` + Files *[]File `yaml:"files,omitempty"` + Model string `yaml:"model"` + Name string `yaml:"name"` +} +type Repo struct { + Name string `yaml:"name"` + Path *string `yaml:"path,omitempty"` + Registry *string `yaml:"registry,omitempty"` + Repo *string `yaml:"repo,omitempty"` + Token string `yaml:"token"` + User string `yaml:"user"` +} +type Simulation struct { + Files *[]File `yaml:"files,omitempty"` + Models []ModelInstanceDefinition `yaml:"models"` + Name string `yaml:"name"` + Parameters *struct { + Environment *map[string]string `yaml:"environment,omitempty"` + Transport SimulationParametersTransport `yaml:"transport"` + } `yaml:"parameters,omitempty"` +} +type SimulationParametersTransport string +type Tool struct { + Arch *[]string `yaml:"arch,omitempty"` + Name string `yaml:"name"` + Repo *string `yaml:"repo,omitempty"` + Schema *string `yaml:"schema,omitempty"` + Version string `yaml:"version"` +} diff --git a/code/go/dse/kind/Model.yaml.go b/code/go/dse/kind/Model.go similarity index 100% rename from code/go/dse/kind/Model.yaml.go rename to code/go/dse/kind/Model.go diff --git a/code/go/dse/kind/Network.go b/code/go/dse/kind/Network.go new file mode 100644 index 0000000..9e561c3 --- /dev/null +++ b/code/go/dse/kind/Network.go @@ -0,0 +1,34 @@ +package kind + +import () + +const ( + NetworkKindNetwork NetworkKind = "Network" +) + +type Function struct { + Annotations *Annotations `yaml:"annotations,omitempty"` + Function string `yaml:"function"` +} +type Message struct { + Annotations *Annotations `yaml:"annotations,omitempty"` + Functions *struct { + Decode *[]Function `yaml:"decode,omitempty"` + Encode *[]Function `yaml:"encode,omitempty"` + } `yaml:"functions,omitempty"` + Message string `yaml:"message"` + Signals *[]NetworkSignal `yaml:"signals,omitempty"` +} +type Network struct { + Kind NetworkKind `yaml:"kind"` + Metadata *ObjectMetadata `yaml:"metadata,omitempty"` + Spec NetworkSpec `yaml:"spec"` +} +type NetworkKind string +type NetworkSignal struct { + Annotations *Annotations `yaml:"annotations,omitempty"` + Signal string `yaml:"signal"` +} +type NetworkSpec struct { + Messages []Message `yaml:"messages"` +} diff --git a/code/go/dse/kind/ParameterSet.yaml.go b/code/go/dse/kind/ParameterSet.go similarity index 100% rename from code/go/dse/kind/ParameterSet.yaml.go rename to code/go/dse/kind/ParameterSet.go diff --git a/code/go/dse/kind/Propagator.yaml.go b/code/go/dse/kind/Propagator.go similarity index 100% rename from code/go/dse/kind/Propagator.yaml.go rename to code/go/dse/kind/Propagator.go diff --git a/code/go/dse/kind/Runnable.yaml.go b/code/go/dse/kind/Runnable.go similarity index 100% rename from code/go/dse/kind/Runnable.yaml.go rename to code/go/dse/kind/Runnable.go diff --git a/code/go/dse/kind/SignalGroup.yaml.go b/code/go/dse/kind/SignalGroup.go similarity index 100% rename from code/go/dse/kind/SignalGroup.yaml.go rename to code/go/dse/kind/SignalGroup.go diff --git a/code/go/dse/kind/Stack.yaml.go b/code/go/dse/kind/Stack.go similarity index 100% rename from code/go/dse/kind/Stack.yaml.go rename to code/go/dse/kind/Stack.go diff --git a/code/go/dse/kind/channel.yaml.go b/code/go/dse/kind/channel.go similarity index 100% rename from code/go/dse/kind/channel.yaml.go rename to code/go/dse/kind/channel.go diff --git a/code/go/dse/config.yaml b/code/go/dse/kind/config.yaml similarity index 100% rename from code/go/dse/config.yaml rename to code/go/dse/kind/config.yaml diff --git a/code/go/dse/kind/kind.go b/code/go/dse/kind/kind.go index 08c931c..eb1ae7c 100644 --- a/code/go/dse/kind/kind.go +++ b/code/go/dse/kind/kind.go @@ -1 +1 @@ -package kind +package kind diff --git a/code/go/dse/kind/metadata.yaml.go b/code/go/dse/kind/metadata.go similarity index 100% rename from code/go/dse/kind/metadata.yaml.go rename to code/go/dse/kind/metadata.go