diff --git a/components/gitpod-protocol/go/gitpod-config-types.go b/components/gitpod-protocol/go/gitpod-config-types.go index 54cd39c0c1ffb7..61a57f029e69d7 100644 --- a/components/gitpod-protocol/go/gitpod-config-types.go +++ b/components/gitpod-protocol/go/gitpod-config-types.go @@ -23,6 +23,17 @@ type AdditionalRepositoriesItems struct { Url string `yaml:"url"` } +// CoreDump Configure the default action of certain signals is to cause a process to terminate and produce a core dump file, a file containing an image of the process's memory at the time of termination. Disabled by default. +type CoreDump struct { + + // Cur specifies the soft limit + Cur float64 `yaml:"cur,omitempty"` + Enabled bool `yaml:"enabled,omitempty"` + + // Max specifies the hard limit + Max float64 `yaml:"max,omitempty"` +} + // Env Environment variables to set. type Env struct { } @@ -43,6 +54,9 @@ type GitpodConfig struct { // Path to where the repository should be checked out relative to `/workspace`. Defaults to the simple repository name. CheckoutLocation string `yaml:"checkoutLocation,omitempty"` + // Configure the default action of certain signals is to cause a process to terminate and produce a core dump file, a file containing an image of the process's memory at the time of termination. Disabled by default. + CoreDump *CoreDump `yaml:"coreDump,omitempty"` + // Experimental network configuration in workspaces (deprecated). Enabled by default ExperimentalNetwork bool `yaml:"experimentalNetwork,omitempty"` @@ -268,6 +282,76 @@ func (strct *AdditionalRepositoriesItems) UnmarshalJSON(b []byte) error { return nil } +func (strct *CoreDump) MarshalJSON() ([]byte, error) { + buf := bytes.NewBuffer(make([]byte, 0)) + buf.WriteString("{") + comma := false + // Marshal the "cur" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"cur\": ") + if tmp, err := json.Marshal(strct.Cur); err != nil { + return nil, err + } else { + buf.Write(tmp) + } + comma = true + // Marshal the "enabled" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"enabled\": ") + if tmp, err := json.Marshal(strct.Enabled); err != nil { + return nil, err + } else { + buf.Write(tmp) + } + comma = true + // Marshal the "max" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"max\": ") + if tmp, err := json.Marshal(strct.Max); err != nil { + return nil, err + } else { + buf.Write(tmp) + } + comma = true + + buf.WriteString("}") + rv := buf.Bytes() + return rv, nil +} + +func (strct *CoreDump) UnmarshalJSON(b []byte) error { + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "cur": + if err := json.Unmarshal([]byte(v), &strct.Cur); err != nil { + return err + } + case "enabled": + if err := json.Unmarshal([]byte(v), &strct.Enabled); err != nil { + return err + } + case "max": + if err := json.Unmarshal([]byte(v), &strct.Max); err != nil { + return err + } + default: + return fmt.Errorf("additional property not allowed: \"" + k + "\"") + } + } + return nil +} + func (strct *Github) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") @@ -334,6 +418,17 @@ func (strct *GitpodConfig) MarshalJSON() ([]byte, error) { buf.Write(tmp) } comma = true + // Marshal the "coreDump" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"coreDump\": ") + if tmp, err := json.Marshal(strct.CoreDump); err != nil { + return nil, err + } else { + buf.Write(tmp) + } + comma = true // Marshal the "experimentalNetwork" field if comma { buf.WriteString(",") @@ -466,6 +561,10 @@ func (strct *GitpodConfig) UnmarshalJSON(b []byte) error { if err := json.Unmarshal([]byte(v), &strct.CheckoutLocation); err != nil { return err } + case "coreDump": + if err := json.Unmarshal([]byte(v), &strct.CoreDump); err != nil { + return err + } case "experimentalNetwork": if err := json.Unmarshal([]byte(v), &strct.ExperimentalNetwork); err != nil { return err