-
Notifications
You must be signed in to change notification settings - Fork 232
/
context.go
33 lines (29 loc) · 978 Bytes
/
context.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
package api
import (
"time"
)
// An EnvironmentVariable has a Variable, a ContextID (its owner), and a
// CreatedAt date.
type EnvironmentVariable struct {
Variable string
ContextID string
CreatedAt time.Time
}
// A Context is the owner of EnvironmentVariables.
type Context struct {
CreatedAt time.Time `json:"created_at"`
ID string `json:"id"`
Name string `json:"name"`
}
// ContextInterface is the interface to interact with contexts and environment
// variables.
type ContextInterface interface {
Contexts(vcs, org string) (*[]Context, error)
ContextByName(vcs, org, name string) (*Context, error)
DeleteContext(contextID string) error
CreateContext(vcs, org, name string) error
CreateContextWithOrgID(orgID *string, name string) error
EnvironmentVariables(contextID string) (*[]EnvironmentVariable, error)
CreateEnvironmentVariable(contextID, variable, value string) error
DeleteEnvironmentVariable(contextID, variable string) error
}