-
-
Notifications
You must be signed in to change notification settings - Fork 380
/
platform.go
130 lines (106 loc) · 2.97 KB
/
platform.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package up
import (
"io"
"time"
)
// TODO: finalize and finish documentation
// LogsConfig is configuration for viewing logs.
type LogsConfig struct {
// Region is the target region.
Region string
// Query is the filter pattern.
Query string
// Since is used as the starting point when filtering
// historical logs, no logs before this point are returned.
Since time.Time
// Follow is used to stream new logs.
Follow bool
// Expand is used to expand logs to a verbose format.
Expand bool
// OutputJSON is used to output raw json.
OutputJSON bool
}
// Logs is the interface for viewing platform logs.
type Logs interface {
io.Reader
}
// Domains is the interface for purchasing and
// managing domains names.
type Domains interface {
Availability(domain string) (*Domain, error)
Suggestions(domain string) ([]*Domain, error)
Purchase(domain string, contact DomainContact) error
List() ([]*Domain, error)
}
// Deploy config.
type Deploy struct {
Stage string
Commit string
Author string
Build bool
}
// Platform is the interface for platform integration,
// defining the basic set of functionality required for
// Up applications.
type Platform interface {
// Build the project.
Build() error
// Deploy to the given stage, to the
// region(s) configured by the user.
Deploy(Deploy) error
// Logs returns an interface for working
// with logging data.
Logs(LogsConfig) Logs
// Domains returns an interface for
// managing domain names.
Domains() Domains
// URL returns the endpoint for the given
// region and stage combination, or an
// empty string.
URL(region, stage string) (string, error)
// Exists returns true if the application has been created.
Exists(region string) (bool, error)
CreateStack(region, version string) error
DeleteStack(region string, wait bool) error
ShowStack(region string) error
PlanStack(region string) error
ApplyStack(region string) error
ShowMetrics(region, stage string, start time.Time) error
}
// Pruner is the interface used to prune old versions and
// the artifacts associated such as S3 zip files for Lambda.
type Pruner interface {
Prune(region, stage string, versions int) error
}
// Runtime is the interface used by a platform to support
// runtime operations such as initializing environment
// variables from remote storage.
type Runtime interface {
Init(stage string) error
}
// Zipper is the interface used by platforms which
// utilize zips for delivery of deployments.
type Zipper interface {
Zip() io.Reader
}
// Domain is a domain name and its availability.
type Domain struct {
Name string
Available bool
Expiry time.Time
AutoRenew bool
}
// DomainContact is the domain name contact
// information required for registration.
type DomainContact struct {
Email string
FirstName string
LastName string
CountryCode string
City string
Address string
OrganizationName string
PhoneNumber string
State string
ZipCode string
}