github.com/apex/up@v1.7.1/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 Build bool 52 } 53 54 // Platform is the interface for platform integration, 55 // defining the basic set of functionality required for 56 // Up applications. 57 type Platform interface { 58 // Build the project. 59 Build() error 60 61 // Deploy to the given stage, to the 62 // region(s) configured by the user. 63 Deploy(Deploy) error 64 65 // Logs returns an interface for working 66 // with logging data. 67 Logs(LogsConfig) Logs 68 69 // Domains returns an interface for 70 // managing domain names. 71 Domains() Domains 72 73 // URL returns the endpoint for the given 74 // region and stage combination, or an 75 // empty string. 76 URL(region, stage string) (string, error) 77 78 // Exists returns true if the application has been created. 79 Exists(region string) (bool, error) 80 81 CreateStack(region, version string) error 82 DeleteStack(region string, wait bool) error 83 ShowStack(region string) error 84 PlanStack(region string) error 85 ApplyStack(region string) error 86 87 ShowMetrics(region, stage string, start time.Time) error 88 } 89 90 // Pruner is the interface used to prune old versions and 91 // the artifacts associated such as S3 zip files for Lambda. 92 type Pruner interface { 93 Prune(region, stage string, versions int) error 94 } 95 96 // Runtime is the interface used by a platform to support 97 // runtime operations such as initializing environment 98 // variables from remote storage. 99 type Runtime interface { 100 Init(stage string) error 101 } 102 103 // Zipper is the interface used by platforms which 104 // utilize zips for delivery of deployments. 105 type Zipper interface { 106 Zip() io.Reader 107 } 108 109 // Domain is a domain name and its availability. 110 type Domain struct { 111 Name string 112 Available bool 113 Expiry time.Time 114 AutoRenew bool 115 } 116 117 // DomainContact is the domain name contact 118 // information required for registration. 119 type DomainContact struct { 120 Email string 121 FirstName string 122 LastName string 123 CountryCode string 124 City string 125 Address string 126 OrganizationName string 127 PhoneNumber string 128 State string 129 ZipCode string 130 }