github.com/orangenpresse/up@v0.6.0/platform.go (about) 1 package up 2 3 import ( 4 "io" 5 "time" 6 ) 7 8 // TODO: finalize and finish documentation 9 10 // LogsConfig is configuration for viewing logs. 11 type LogsConfig struct { 12 // Region is the target region. 13 Region string 14 15 // Query is the filter pattern. 16 Query string 17 18 // Since is used as the starting point when filtering 19 // historical logs, no logs before this point are returned. 20 Since time.Time 21 22 // Follow is used to stream new logs. 23 Follow bool 24 25 // Expand is used to expand logs to a verbose format. 26 Expand bool 27 28 // OutputJSON is used to output raw json. 29 OutputJSON bool 30 } 31 32 // Logs is the interface for viewing platform logs. 33 type Logs interface { 34 io.Reader 35 } 36 37 // Domains is the interface for purchasing and 38 // managing domains names. 39 type Domains interface { 40 Availability(domain string) (*Domain, error) 41 Suggestions(domain string) ([]*Domain, error) 42 Purchase(domain string, contact DomainContact) error 43 List() ([]*Domain, error) 44 } 45 46 // Deploy config. 47 type Deploy struct { 48 Stage string 49 Commit string 50 Author string 51 } 52 53 // Platform is the interface for platform integration, 54 // defining the basic set of functionality required for 55 // Up applications. 56 type Platform interface { 57 // Build the project. 58 Build() error 59 60 // Deploy to the given stage, to the 61 // region(s) configured by the user. 62 Deploy(Deploy) error 63 64 // Logs returns an interface for working 65 // with logging data. 66 Logs(LogsConfig) Logs 67 68 // Domains returns an interface for 69 // managing domain names. 70 Domains() Domains 71 72 // URL returns the endpoint for the given 73 // region and stage combination, or an 74 // empty string. 75 URL(region, stage string) (string, error) 76 77 CreateStack(region, version string) error 78 DeleteStack(region string, wait bool) error 79 ShowStack(region string) error 80 PlanStack(region string) error 81 ApplyStack(region string) error 82 83 ShowMetrics(region, stage string, start time.Time) error 84 } 85 86 // Runtime is the interface used by a platform to support 87 // runtime operations such as initializing environment 88 // variables from remote storage. 89 type Runtime interface { 90 Init(stage string) error 91 } 92 93 // Zipper is the interface used by platforms which 94 // utilize zips for delivery of deployments. 95 type Zipper interface { 96 Zip() io.Reader 97 } 98 99 // Domain is a domain name and its availability. 100 type Domain struct { 101 Name string 102 Available bool 103 Expiry time.Time 104 AutoRenew bool 105 } 106 107 // DomainContact is the domain name contact 108 // information required for registration. 109 type DomainContact struct { 110 Email string 111 FirstName string 112 LastName string 113 CountryCode string 114 City string 115 Address string 116 OrganizationName string 117 PhoneNumber string 118 State string 119 ZipCode string 120 }