This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
/
json.go
104 lines (96 loc) · 3.59 KB
/
json.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright 2016 The rkt Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import "github.com/rkt/rkt/networking/netinfo"
// AppState defines the state of the app.
type AppState string
const (
AppStateUnknown AppState = "unknown"
AppStateCreated AppState = "created"
AppStateRunning AppState = "running"
AppStateExited AppState = "exited"
)
type (
// Mount defines the mount point.
Mount struct {
// Name of the mount.
Name string `json:"name"`
// Container path of the mount.
ContainerPath string `json:"container_path"`
// Host path of the mount.
HostPath string `json:"host_path"`
// Whether the mount is read-only.
ReadOnly bool `json:"read_only"`
// TODO(yifan): What about 'SelinuxRelabel bool'?
}
// App defines the app object.
App struct {
// Name of the app.
Name string `json:"name"`
// State of the app, can be created, running, exited, or unknown.
State AppState `json:"state"`
// Creation time of the container, nanoseconds since epoch.
CreatedAt *int64 `json:"created_at,omitempty"`
// Start time of the container, nanoseconds since epoch.
StartedAt *int64 `json:"started_at,omitempty"`
// Finish time of the container, nanoseconds since epoch.
FinishedAt *int64 `json:"finished_at,omitempty"`
// Exit code of the container.
ExitCode *int32 `json:"exit_code,omitempty"`
// Image ID of the container.
ImageID string `json:"image_id"`
// Mount points of the container.
Mounts []*Mount `json:"mounts,omitempty"`
// User annotations of the container.
UserAnnotations map[string]string `json:"user_annotations,omitempty"`
// User labels of the container.
UserLabels map[string]string `json:"user_labels,omitempty"`
}
// Pod defines the pod object.
Pod struct {
// UUID of the pod.
UUID string `json:"name"`
// State of the pod, all valid values are defined in pkg/pod/pods.go.
State string `json:"state"`
// Networks are the information of the networks.
Networks []netinfo.NetInfo `json:"networks,omitempty"`
// AppNames are the names of the apps.
// Deprecated: use Apps instead.
AppNames []string `json:"app_names,omitempty"`
// Apps holds current information about each app.
Apps []*App `json:"apps,omitempty"`
// The creation time of the pod.
CreatedAt *int64 `json:"created_at,omitempty"`
// The start time of the pod.
StartedAt *int64 `json:"started_at,omitempty"`
// UserAnnotations are the pod user annotations.
UserAnnotations map[string]string `json:"user_annotations,omitempty"`
// UserLabels are the pod user labels.
UserLabels map[string]string `json:"user_labels,omitempty"`
}
ImageListEntry struct {
// ID is the Image ID for this image
ID string `json:"id"`
// Name is the name of this image, such as example.com/some/image
Name string `json:"name"`
// ImportTime indicates when this image was imported in nanoseconds
// since the unix epoch
ImportTime int64 `json:"import_time"`
// LastUsedTime indicates when was last used in nanoseconds since the
// unix epoch
LastUsedTime int64 `json:"last_used_time"`
// Size is the size of this image in bytes
Size int64 `json:"size"`
}
)