diff options
Diffstat (limited to 'pkg/domain/entities/types.go')
-rw-r--r-- | pkg/domain/entities/types.go | 32 |
1 files changed, 32 insertions, 0 deletions
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 +} |