refactor: Add JSON serialization tags to OCI spec fields
- Add `json` tags for `oci_version` and `no_new_privileges` - Add `json` tag for `additional_gids` in `User` struct - Add `json` tags for `typ` in `Rlimit`, `Mount`, `LinuxNamespace` - Add `json` tags for path and ID mapping fields in `Linux` - Add `json` tags for `file_mode`, `container_id`, `host_id`
This commit is contained in:
@@ -3,7 +3,7 @@ module crun
|
||||
// OCI Runtime Spec structures that can be directly encoded to JSON
|
||||
pub struct Spec {
|
||||
pub mut:
|
||||
oci_version string
|
||||
oci_version string @[json: 'ociVersion']
|
||||
platform Platform
|
||||
process Process
|
||||
root Root
|
||||
@@ -21,21 +21,21 @@ pub mut:
|
||||
|
||||
pub struct Process {
|
||||
pub mut:
|
||||
terminal bool = true
|
||||
user User
|
||||
args []string
|
||||
env []string
|
||||
cwd string = '/'
|
||||
capabilities Capabilities
|
||||
rlimits []Rlimit
|
||||
no_new_privileges bool
|
||||
terminal bool = true
|
||||
user User
|
||||
args []string
|
||||
env []string
|
||||
cwd string = '/'
|
||||
capabilities Capabilities
|
||||
rlimits []Rlimit
|
||||
no_new_privileges bool @[json: 'noNewPrivileges']
|
||||
}
|
||||
|
||||
pub struct User {
|
||||
pub mut:
|
||||
uid u32
|
||||
gid u32
|
||||
additional_gids []u32
|
||||
additional_gids []u32 @[json: 'additionalGids']
|
||||
}
|
||||
|
||||
pub struct Capabilities {
|
||||
@@ -49,7 +49,7 @@ pub mut:
|
||||
|
||||
pub struct Rlimit {
|
||||
pub mut:
|
||||
typ string
|
||||
typ string @[json: 'type']
|
||||
hard u64
|
||||
soft u64
|
||||
}
|
||||
@@ -63,25 +63,25 @@ pub mut:
|
||||
pub struct Mount {
|
||||
pub mut:
|
||||
destination string
|
||||
typ string
|
||||
typ string @[json: 'type']
|
||||
source string
|
||||
options []string
|
||||
}
|
||||
|
||||
pub struct Linux {
|
||||
pub mut:
|
||||
namespaces []LinuxNamespace
|
||||
resources LinuxResources
|
||||
devices []LinuxDevice
|
||||
masked_paths []string
|
||||
readonly_paths []string
|
||||
uid_mappings []LinuxIDMapping
|
||||
gid_mappings []LinuxIDMapping
|
||||
namespaces []LinuxNamespace
|
||||
resources LinuxResources
|
||||
devices []LinuxDevice
|
||||
masked_paths []string @[json: 'maskedPaths']
|
||||
readonly_paths []string @[json: 'readonlyPaths']
|
||||
uid_mappings []LinuxIDMapping @[json: 'uidMappings']
|
||||
gid_mappings []LinuxIDMapping @[json: 'gidMappings']
|
||||
}
|
||||
|
||||
pub struct LinuxNamespace {
|
||||
pub mut:
|
||||
typ string
|
||||
typ string @[json: 'type']
|
||||
path string
|
||||
}
|
||||
|
||||
@@ -123,19 +123,19 @@ pub mut:
|
||||
|
||||
pub struct LinuxDevice {
|
||||
pub mut:
|
||||
path string
|
||||
typ string
|
||||
major i64
|
||||
minor i64
|
||||
file_mode u32
|
||||
uid u32
|
||||
gid u32
|
||||
path string
|
||||
typ string @[json: 'type']
|
||||
major i64
|
||||
minor i64
|
||||
file_mode u32 @[json: 'fileMode']
|
||||
uid u32
|
||||
gid u32
|
||||
}
|
||||
|
||||
pub struct LinuxIDMapping {
|
||||
pub mut:
|
||||
container_id u32
|
||||
host_id u32
|
||||
container_id u32 @[json: 'containerID']
|
||||
host_id u32 @[json: 'hostID']
|
||||
size u32
|
||||
}
|
||||
|
||||
@@ -235,4 +235,4 @@ pub enum RlimitType {
|
||||
rlimit_nice
|
||||
rlimit_rtprio
|
||||
rlimit_rttime
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user