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