summaryrefslogtreecommitdiff
path: root/pkg/domain/entities
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/domain/entities')
-rw-r--r--pkg/domain/entities/container_ps.go13
-rw-r--r--pkg/domain/entities/pods.go4
-rw-r--r--pkg/domain/entities/types.go32
3 files changed, 34 insertions, 15 deletions
diff --git a/pkg/domain/entities/container_ps.go b/pkg/domain/entities/container_ps.go
index 33f5d0500..709bb58d6 100644
--- a/pkg/domain/entities/container_ps.go
+++ b/pkg/domain/entities/container_ps.go
@@ -4,7 +4,6 @@ import (
"sort"
"strings"
- "github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/ps/define"
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/pkg/errors"
@@ -73,18 +72,6 @@ type ListContainerNamespaces struct {
User string `json:"User,omitempty"`
}
-// SortContainers helps us set-up ability to sort by createTime
-type SortContainers []*libpod.Container
-
-func (a SortContainers) Len() int { return len(a) }
-func (a SortContainers) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type SortCreateTime struct{ SortContainers }
-
-func (a SortCreateTime) Less(i, j int) bool {
- return a.SortContainers[i].CreatedTime().Before(a.SortContainers[j].CreatedTime())
-}
-
type SortListContainers []ListContainer
func (a SortListContainers) Len() int { return len(a) }
diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go
index 9ca8ff43c..b280203de 100644
--- a/pkg/domain/entities/pods.go
+++ b/pkg/domain/entities/pods.go
@@ -4,7 +4,7 @@ import (
"strings"
"time"
- "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/specgen"
)
@@ -177,5 +177,5 @@ type PodInspectOptions struct {
}
type PodInspectReport struct {
- *libpod.PodInspect
+ *define.InspectPodData
}
diff --git a/pkg/domain/entities/types.go b/pkg/domain/entities/types.go
index 91ae00764..31a05f5d3 100644
--- a/pkg/domain/entities/types.go
+++ b/pkg/domain/entities/types.go
@@ -1,6 +1,7 @@
package entities
import (
+ "errors"
"net"
"github.com/containers/libpod/libpod/events"
@@ -72,3 +73,34 @@ type EventsOptions struct {
Since string
Until string
}
+
+// ContainerCreateResponse is the response struct for creating a container
+type ContainerCreateResponse struct {
+ // ID of the container created
+ ID string `json:"Id"`
+ // Warnings during container creation
+ Warnings []string `json:"Warnings"`
+}
+
+type ErrorModel struct {
+ // API root cause formatted for automated parsing
+ // example: API root cause
+ Because string `json:"cause"`
+ // human error message, formatted for a human to read
+ // example: human error message
+ Message string `json:"message"`
+ // http response code
+ ResponseCode int `json:"response"`
+}
+
+func (e ErrorModel) Error() string {
+ return e.Message
+}
+
+func (e ErrorModel) Cause() error {
+ return errors.New(e.Because)
+}
+
+func (e ErrorModel) Code() int {
+ return e.ResponseCode
+}