Skip to content

Commit 471d3aa

Browse files
authored
Merge pull request #3 from jianxiaoguo/master
feat(controller-sdk-go):drycc run cmd add --mount para
2 parents 1d24c6e + 23ac0ff commit 471d3aa

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

api/apps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type AppUpdateRequest struct {
2929
// AppRunRequest is the definition of POST /v2/apps/<app id>/run.
3030
type AppRunRequest struct {
3131
Command string `json:"command"`
32+
Volumes map[string]interface{} `json:"volumes,omitempty"`
3233
}
3334

3435
// AppRunResponse is the definition of /v2/apps/<app id>/run.

apps/apps.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ func Logs(c *drycc.Client, appID string, lines int) (string, error) {
112112

113113
// Run a one-time command in your app. This will start a kubernetes job with the
114114
// same container image and environment as the rest of the app.
115-
func Run(c *drycc.Client, appID string, command string) (api.AppRunResponse, error) {
116-
req := api.AppRunRequest{Command: command}
115+
func Run(c *drycc.Client, appID string, command string, volumes map[string]interface{}) (api.AppRunResponse, error) {
116+
req := api.AppRunRequest{
117+
Command: command,
118+
Volumes: volumes,
119+
}
117120
body, err := json.Marshal(req)
118121

119122
if err != nil {

apps/apps_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func TestAppsRun(t *testing.T) {
252252
t.Fatal(err)
253253
}
254254

255-
actual, err := Run(drycc, "example-go", "echo hi")
255+
actual, err := Run(drycc, "example-go", "echo hi", nil)
256256

257257
if err != nil {
258258
t.Fatal(err)

volumes/volumes_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ func TestVolumesCreate(t *testing.T) {
167167
t.Parallel()
168168

169169
expected := api.Volume{
170-
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
171-
Owner: "test",
172-
App: "example-go",
173-
Name: "myvolume",
174-
Size: "500M",
175-
Path: map[string]interface{}{},
170+
UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75",
171+
Owner: "test",
172+
App: "example-go",
173+
Name: "myvolume",
174+
Size: "500M",
175+
Path: map[string]interface{}{},
176176
Created: "2020-08-26T00:00:00UTC",
177177
Updated: "2020-08-26T00:00:00UTC",
178178
}

0 commit comments

Comments
 (0)