Add fission.Error type; add JSON annotations
This commit is contained in:
@@ -18,22 +18,19 @@ package fission
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
// Metadata is used as the general identifier for all kinds of
|
// Metadata is used as the general identifier for all kinds of
|
||||||
// resources managed by the controller. In general, when a
|
// resources managed by the controller.
|
||||||
// resource is updated, the Name remains the same, but the UID
|
|
||||||
// changes. In other words, the UID identifies a particular
|
|
||||||
// value of a resource.
|
|
||||||
Metadata struct {
|
Metadata struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Uid string
|
Uid string `json:"uid,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function is a unit of executable code. Though it's called
|
// Function is a unit of executable code. Though it's called
|
||||||
// a function, the code may have more than one function; it's
|
// a function, the code may have more than one function; it's
|
||||||
// usually some sort of module or package.
|
// usually some sort of module or package.
|
||||||
Function struct {
|
Function struct {
|
||||||
Metadata
|
Metadata `json:"metadata"`
|
||||||
Environment Metadata
|
Environment Metadata `json:"environment"`
|
||||||
Code string
|
Code string `json:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Environment identifies the language and OS specific
|
// Environment identifies the language and OS specific
|
||||||
@@ -42,16 +39,33 @@ type (
|
|||||||
// this will also include build containers, as well as support
|
// this will also include build containers, as well as support
|
||||||
// tools like debuggers, profilers, etc.
|
// tools like debuggers, profilers, etc.
|
||||||
Environment struct {
|
Environment struct {
|
||||||
Metadata
|
Metadata `json:"metadata"`
|
||||||
RunContainerImageUrl string
|
RunContainerImageUrl string `json:"runContainerImageUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTTPTrigger maps URL patterns to functions. Function.UID
|
// HTTPTrigger maps URL patterns to functions. Function.UID
|
||||||
// is optional; if absent, the latest version of the function
|
// is optional; if absent, the latest version of the function
|
||||||
// will automatically be selected.
|
// will automatically be selected.
|
||||||
HTTPTrigger struct {
|
HTTPTrigger struct {
|
||||||
Metadata
|
Metadata `json:"metadata"`
|
||||||
UrlPattern string
|
UrlPattern string `json:"urlpattern"`
|
||||||
Function Metadata
|
Function Metadata `json:"function"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errors returned by the Fission API.
|
||||||
|
Error struct {
|
||||||
|
Code errorCode `json:"code"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
errorCode int
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ErrorInternal = iota
|
||||||
|
|
||||||
|
ErrorNotAuthorized
|
||||||
|
ErrorNotFound
|
||||||
|
ErrorNameExists
|
||||||
|
ErrorInvalidArgument
|
||||||
|
ErrorNoSpace
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user