/
interface.go
36 lines (26 loc) · 989 Bytes
/
interface.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
package stacks
import "golang.org/x/net/context"
// Error type
type Error string
func (e Error) Error() string { return string(e) }
// Errors
const (
InvalidName = Error("name is invalid")
AlreadyExists = Error("stack already exists")
NotFound = Error("stack not found")
)
// Interface defines the stack data access layer
type Interface interface {
// Create creates a new stack
Create(ctx context.Context, name string) (stack *Stack, err error)
// Get fetches a stack by id
Get(ctx context.Context, id string) (stack *Stack, err error)
// GetByName fetches a stack by name
GetByName(ctx context.Context, name string) (stack *Stack, err error)
// GetByFragmentOrName fetches a stack by fragment ID or name
GetByFragmentOrName(ctx context.Context, fragmentOrName string) (stack *Stack, err error)
// List lists stacks
List(ctx context.Context) (stacks []*Stack, err error)
// Delete deletes a stack by id
Delete(ctx context.Context, id string) (err error)
}