From 1c7de3b97f909aaac7265211c04c330f77f90d88 Mon Sep 17 00:00:00 2001 From: Josh Wolf Date: Fri, 28 Apr 2023 14:09:41 -0400 Subject: [PATCH] change type structs encoding tag to json --- pkg/build/types/build_option.go | 16 +++--- pkg/build/types/types.go | 86 ++++++++++++++++----------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/pkg/build/types/build_option.go b/pkg/build/types/build_option.go index 62c536b85..76c234a55 100644 --- a/pkg/build/types/build_option.go +++ b/pkg/build/types/build_option.go @@ -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. diff --git a/pkg/build/types/types.go b/pkg/build/types/types.go index b39cd60dd..fbe9206c5 100644 --- a/pkg/build/types/types.go +++ b/pkg/build/types/types.go @@ -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.