Skip to content

Commit

Permalink
change type structs encoding tag to json
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrwolf committed Apr 28, 2023
1 parent 4082ea6 commit 1c7de3b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
16 changes: 8 additions & 8 deletions pkg/build/types/build_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ package types
// ListOption describes an optional deviation to a list, for example, a
// list of packages.
type ListOption struct {
Add []string `yaml:"add,omitempty"`
Remove []string `yaml:"remove,omitempty"`
Add []string `json:"add,omitempty"`
Remove []string `json:"remove,omitempty"`
}

// ContentsOption describes an optional deviation to an apko environment's
// contents block.
type ContentsOption struct {
Packages ListOption `yaml:"packages,omitempty"`
Packages ListOption `json:"packages,omitempty"`
}

// AccountsOption describes an optional deviation to an apko environment's
// run-as setting.
type AccountsOption struct {
RunAs string `yaml:"run-as,omitempty"`
RunAs string `json:"run-as,omitempty"`
}

// BuildOption describes an optional deviation to an apko environment.
type BuildOption struct {
Contents ContentsOption `yaml:"contents,omitempty"`
Accounts AccountsOption `yaml:"accounts,omitempty"`
Contents ContentsOption `json:"contents,omitempty"`
Accounts AccountsOption `json:"accounts,omitempty"`

Environment map[string]string `yaml:"environment,omitempty"`
Environment map[string]string `json:"environment,omitempty"`

Entrypoint ImageEntrypoint `yaml:"entrypoint,omitempty"`
Entrypoint ImageEntrypoint `json:"entrypoint,omitempty"`
}

// Apply applies a patch described by a BuildOption to an apko environment.
Expand Down
86 changes: 43 additions & 43 deletions pkg/build/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,73 +23,73 @@ import (
)

type User struct {
UserName string
UID uint32
GID uint32
UserName string `json:"user_name"`
UID uint32 `json:"uid,omitempty"`
GID uint32 `json:"gid,omitempty"`
}

type Group struct {
GroupName string
GID uint32
Members []string
GroupName string `json:"group_name"`
GID uint32 `json:"gid,omitempty"`
Members []string `json:"members,omitempty"`
}

type PathMutation struct {
Path string
Type string
UID uint32
GID uint32
Permissions uint32
Source string
Recursive bool
Path string `json:"path,omitempty"`
Type string `json:"type,omitempty"`
UID uint32 `json:"uid,omitempty"`
GID uint32 `json:"gid,omitempty"`
Permissions uint32 `json:"permissions,omitempty"`
Source string `json:"source,omitempty"`
Recursive bool `json:"recursive,omitempty"`
}

type OSRelease struct {
Name string
ID string
VersionID string `yaml:"version-id"`
PrettyName string `yaml:"pretty-name"`
HomeURL string `yaml:"home-url"`
BugReportURL string `yaml:"bug-report-url"`
Name string `json:"name,omitempty"`
ID string `json:"id,omitempty"`
VersionID string `json:"version-id,omitempty"`
PrettyName string `json:"pretty-name,omitempty"`
HomeURL string `json:"home-url,omitempty"`
BugReportURL string `json:"bug-report-url,omitempty"`
}

type ImageContents struct {
Repositories []string `yaml:"repositories,omitempty"`
Keyring []string `yaml:"keyring,omitempty"`
Packages []string `yaml:"packages,omitempty"`
Repositories []string `json:"repositories,omitempty"`
Keyring []string `json:"keyring,omitempty"`
Packages []string `json:"packages,omitempty"`
}

type ImageEntrypoint struct {
Type string
Command string
ShellFragment string `yaml:"shell-fragment"`
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
ShellFragment string `json:"shell-fragment,omitempty"`

// TBD: presently a map of service names and the command to run
Services map[interface{}]interface{}
Services map[interface{}]interface{} `json:"services,omitempty"`
}

type ImageAccounts struct {
RunAs string `yaml:"run-as"`
Users []User
Groups []Group
RunAs string `json:"run-as,omitempty"`
Users []User `json:"users,omitempty"`
Groups []Group `json:"groups,omitempty"`
}

type ImageConfiguration struct {
Contents ImageContents `yaml:"contents,omitempty"`
Entrypoint ImageEntrypoint `yaml:"entrypoint,omitempty"`
Cmd string `yaml:"cmd,omitempty"`
StopSignal string `yaml:"stop-signal,omitempty"`
WorkDir string `yaml:"work-dir,omitempty"`
Accounts ImageAccounts `yaml:"accounts,omitempty"`
Archs []Architecture `yaml:"archs,omitempty"`
Environment map[string]string `yaml:"environment,omitempty"`
Paths []PathMutation `yaml:"paths,omitempty"`
OSRelease OSRelease `yaml:"os-release,omitempty"`
VCSUrl string `yaml:"vcs-url,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
Include string `yaml:"include,omitempty"`
Contents ImageContents `json:"contents,omitempty"`
Entrypoint ImageEntrypoint `json:"entrypoint,omitempty"`
Cmd string `json:"cmd,omitempty"`
StopSignal string `json:"stop-signal,omitempty"`
WorkDir string `json:"work-dir,omitempty"`
Accounts ImageAccounts `json:"accounts,omitempty"`
Archs []Architecture `json:"archs,omitempty"`
Environment map[string]string `json:"environment,omitempty"`
Paths []PathMutation `json:"paths,omitempty"`
OSRelease OSRelease `json:"os-release,omitempty"`
VCSUrl string `json:"vcs-url,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Include string `json:"include,omitempty"`

Options map[string]BuildOption `yaml:"options,omitempty"`
Options map[string]BuildOption `json:"options,omitempty"`
}

// Architecture represents a CPU architecture for the container image.
Expand Down

0 comments on commit 1c7de3b

Please sign in to comment.