github.com/drycc/workflow-cli@v1.5.3-0.20240322092846-d4ee25983af9/cmd/cmd.go (about) 1 package cmd 2 3 import ( 4 "fmt" 5 "io" 6 7 "github.com/drycc/controller-sdk-go/api" 8 ) 9 10 // Commander is interface definition for running commands 11 type Commander interface { 12 AppCreate(string, string, bool) error 13 AppsList(int) error 14 AppInfo(string) error 15 AppOpen(string) error 16 AppLogs(string, int, bool, int) error 17 AppRun(string, string, []string, uint32, uint32) error 18 AppDestroy(string, string) error 19 AppTransfer(string, string) error 20 AutoscaleList(string) error 21 AutoscaleSet(string, string, int, int, int) error 22 AutoscaleUnset(string, string) error 23 Login(string, bool) error 24 Logout() error 25 Whoami(bool) error 26 BuildsList(string, int) error 27 BuildsCreate(string, string, string, string) error 28 CanaryInfo(string) error 29 CanaryCreate(string, []string) error 30 CanaryRemove(string, []string) error 31 CanaryRelease(string) error 32 CanaryRollback(string) error 33 CertsList(int) error 34 CertAdd(string, string, string) error 35 CertRemove(string) error 36 CertInfo(string) error 37 CertAttach(string, string) error 38 CertDetach(string, string) error 39 ConfigList(string, string) error 40 ConfigSet(string, []string) error 41 ConfigUnset(string, []string) error 42 ConfigPull(string, bool, bool) error 43 ConfigPush(string, string) error 44 DomainsList(string, int) error 45 DomainsAdd(string, string) error 46 DomainsRemove(string, string) error 47 ServicesList(string) error 48 ServicesAdd(string, string, string, string) error 49 ServicesRemove(string, string, string, int) error 50 GatewaysAdd(string, string, int, string) error 51 GatewaysList(string, int) error 52 GatewaysRemove(string, string, int, string) error 53 RoutesCreate(string, string, string, string, int) error 54 RoutesList(string, int) error 55 RoutesGet(string, string) error 56 RoutesSet(string, string, string) error 57 RoutesAttach(string, string, int, string) error 58 RoutesDetach(string, string, int, string) error 59 RoutesRemove(string, string) error 60 GitRemote(string, string, bool) error 61 GitRemove(string) error 62 HealthchecksList(string, string) error 63 HealthchecksSet(string, string, string, *api.Healthcheck) error 64 HealthchecksUnset(string, string, []string) error 65 KeysList(int) error 66 KeyRemove(string) error 67 KeyAdd(string, string) error 68 LabelsList(string) error 69 LabelsSet(string, []string) error 70 LabelsUnset(string, []string) error 71 LimitsList(string) error 72 LimitsSet(string, []string) error 73 LimitsUnset(string, []string) error 74 LimitsSpecs(string, int) error 75 LimitsPlans(string, int, int, int) error 76 TimeoutsList(string) error 77 TimeoutsSet(string, []string) error 78 TimeoutsUnset(string, []string) error 79 PermsList(string, bool, int) error 80 PermCreate(string, string, bool) error 81 PermDelete(string, string, bool) error 82 PsList(string, int) error 83 PsLogs(string, string, int, bool, string) error 84 PsExec(string, string, bool, bool, []string) error 85 PsScale(string, []string) error 86 PsRestart(string, string) error 87 RegistryList(string) error 88 RegistrySet(string, []string) error 89 RegistryUnset(string, []string) error 90 ReleasesList(string, int) error 91 ReleasesInfo(string, int) error 92 ReleasesRollback(string, int) error 93 RoutingInfo(string) error 94 RoutingEnable(string) error 95 RoutingDisable(string) error 96 ShortcutsList() error 97 TagsList(string) error 98 TagsSet(string, []string) error 99 TagsUnset(string, []string) error 100 TLSInfo(string) error 101 TLSForceEnable(string) error 102 TLSForceDisable(string) error 103 TLSAutoEnable(string) error 104 TLSAutoDisable(string) error 105 TLSAutoIssuer(string, string, string, string, string) error 106 UsersList(results int) error 107 UsersEnable(string) error 108 UsersDisable(string) error 109 Println(...interface{}) (int, error) 110 Print(...interface{}) (int, error) 111 Printf(string, ...interface{}) (int, error) 112 PrintErrln(...interface{}) (int, error) 113 PrintErr(...interface{}) (int, error) 114 PrintErrf(string, ...interface{}) (int, error) 115 Version(bool) error 116 VolumesCreate(string, string, string, string, map[string]interface{}) error 117 VolumesExpand(string, string, string) error 118 VolumesDelete(string, string) error 119 VolumesList(string, int) error 120 VolumesInfo(string, string) error 121 VolumesMount(string, string, []string) error 122 VolumesUnmount(string, string, []string) error 123 ResourcesServices(int) error 124 ResourcesPlans(string, int) error 125 ResourcesCreate(string, string, string, []string, string) error 126 ResourcesList(string, int) error 127 ResourceDelete(string, string, string) error 128 ResourceGet(string, string) error 129 ResourcePut(string, string, string, []string, string) error 130 ResourceBind(string, string) error 131 ResourceUnbind(string, string) error 132 } 133 134 // DryccCmd is an implementation of Commander. 135 type DryccCmd struct { 136 ConfigFile string 137 Warned bool 138 WOut io.Writer 139 WErr io.Writer 140 WIn io.Reader 141 } 142 143 // Println prints a line to an output writer. 144 func (d *DryccCmd) Println(a ...interface{}) (n int, err error) { 145 return fmt.Fprintln(d.WOut, a...) 146 } 147 148 // Print prints a line to an output writer. 149 func (d *DryccCmd) Print(a ...interface{}) (n int, err error) { 150 return fmt.Fprint(d.WOut, a...) 151 } 152 153 // Printf prints a line to an error writer. 154 func (d *DryccCmd) Printf(s string, a ...interface{}) (n int, err error) { 155 return fmt.Fprintf(d.WOut, s, a...) 156 } 157 158 // PrintErrln prints a line to an error writer. 159 func (d *DryccCmd) PrintErrln(a ...interface{}) (n int, err error) { 160 return fmt.Fprintln(d.WErr, a...) 161 } 162 163 // PrintErr prints a line to an error writer. 164 func (d *DryccCmd) PrintErr(a ...interface{}) (n int, err error) { 165 return fmt.Fprint(d.WErr, a...) 166 } 167 168 // PrintErrf prints a line to an error writer. 169 func (d *DryccCmd) PrintErrf(s string, a ...interface{}) (n int, err error) { 170 return fmt.Fprintf(d.WErr, s, a...) 171 }