Update back to put

This commit is contained in:
James Jeffrey
2017-07-19 15:43:44 -07:00
parent cd88c16915
commit 06505cef17
4 changed files with 26 additions and 6 deletions

View File

@@ -156,7 +156,7 @@ func (p *deploycmd) route(c *cli.Context, ff *funcfile) error {
if err := routeWithFuncFile(c, ff, rt); err != nil { if err := routeWithFuncFile(c, ff, rt); err != nil {
return fmt.Errorf("error getting route with funcfile: %s", err) return fmt.Errorf("error getting route with funcfile: %s", err)
} }
return routesCmd.patchRoute(c, p.appName, ff.Path, rt) return routesCmd.putRoute(c, p.appName, ff.Path, rt)
} }
func expandEnvConfig(configs map[string]string) map[string]string { func expandEnvConfig(configs map[string]string) map[string]string {

10
fn/glide.lock generated
View File

@@ -1,10 +1,10 @@
hash: 425a7584264b050b16d42e84e2d9800d88eb706feae4aa97410b9050fec7686c hash: 4cce7a5074b5b856c40bc5a97c7fac81546f835c42fd16aeff728f66ca65dd00
updated: 2017-07-17T12:46:25.326131356-07:00 updated: 2017-07-19T15:40:45.33026105-07:00
imports: imports:
- name: github.com/asaskevich/govalidator - name: github.com/asaskevich/govalidator
version: aa5cce4a76edb1a5acecab1870c17abbffb5419e version: aa5cce4a76edb1a5acecab1870c17abbffb5419e
- name: github.com/aws/aws-sdk-go - name: github.com/aws/aws-sdk-go
version: b73b028e599fa9176687c70b8f9cafbe57c27d20 version: 8da51c33f6001c4dda06a2561c2234be4cece1ed
subpackages: subpackages:
- aws - aws
- aws/awserr - aws/awserr
@@ -50,7 +50,7 @@ imports:
- name: github.com/docker/go-units - name: github.com/docker/go-units
version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 version: 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
- name: github.com/funcy/functions_go - name: github.com/funcy/functions_go
version: 5d9948e8b1292c5421b5dd98bb6a9b5535d5e1ba version: 601696a734d8df755f42bff262e699bb2eeb69b3
subpackages: subpackages:
- client - client
- client/apps - client/apps
@@ -90,7 +90,7 @@ imports:
- name: github.com/go-openapi/validate - name: github.com/go-openapi/validate
version: 035dcd74f1f61e83debe1c22950dc53556e7e4b2 version: 035dcd74f1f61e83debe1c22950dc53556e7e4b2
- name: github.com/go-resty/resty - name: github.com/go-resty/resty
version: f214013978f4ea5632ef88a5371b2028699a9d19 version: 6d8c785a63e4b7505c88451cf9c5b452ccf2454c
- name: github.com/jmespath/go-jmespath - name: github.com/jmespath/go-jmespath
version: bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d version: bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d
- name: github.com/jmoiron/jsonq - name: github.com/jmoiron/jsonq

View File

@@ -18,6 +18,7 @@ import:
subpackages: subpackages:
- semver - semver
- package: github.com/funcy/functions_go - package: github.com/funcy/functions_go
version: ^0.1.34
subpackages: subpackages:
- client - client
- client/apps - client/apps

View File

@@ -336,6 +336,25 @@ func (a *routesCmd) patchRoute(c *cli.Context, appName, routePath string, r *fnm
return nil return nil
} }
func (a *routesCmd) putRoute(c *cli.Context, appName, routePath string, r *fnmodels.Route) error {
_, err := a.client.Routes.PutAppsAppRoutesRoute(&apiroutes.PutAppsAppRoutesRouteParams{
Context: context.Background(),
App: appName,
Route: routePath,
Body: &fnmodels.RouteWrapper{Route: r},
})
if err != nil {
switch err.(type) {
case *apiroutes.PutAppsAppRoutesRouteBadRequest:
return fmt.Errorf("error: %s", err.(*apiroutes.PutAppsAppRoutesRouteBadRequest).Payload.Error.Message)
case *apiroutes.PutAppsAppRoutesRouteDefault:
return fmt.Errorf("unexpected error: %s", err.(*apiroutes.PutAppsAppRoutesRouteDefault).Payload.Error.Message)
}
return fmt.Errorf("unexpected error: %s", err)
}
return nil
}
func (a *routesCmd) update(c *cli.Context) error { func (a *routesCmd) update(c *cli.Context) error {
appName := c.Args().Get(0) appName := c.Args().Get(0)
route := cleanRoutePath(c.Args().Get(1)) route := cleanRoutePath(c.Args().Get(1))