Untangle merge and fix json field name

pull/393/head
Dave Cunningham 10 years ago
parent a1d4808ecb
commit 51df379c66

@ -193,38 +193,3 @@ func (e *HTTPError) String() string {
return e.Error() return e.Error()
} }
// GetDeployment retrieves the supplied deployment
func (c *Client) GetDeployment(name string) (*common.Deployment, error) {
var deployment *common.Deployment
if err := c.CallService(fancypath.Join("deployments", name), "GET", "get deployment", &deployment, nil); err != nil {
return nil, err
}
return deployment, nil
}
// DeleteDeployment deletes the supplied deployment
func (c *Client) DeleteDeployment(name string) (*common.Deployment, error) {
var deployment *common.Deployment
if err := c.CallService(filepath.Join("deployments", name), "DELETE", "delete deployment", &deployment, nil); err != nil {
return nil, err
}
return deployment, nil
}
// PostDeployment posts a deployment object to the manager service.
func (c *Client) PostDeployment(res *common.Resource) error {
// This is a stop-gap until we get this API cleaned up.
t := common.Template{
ChartInvocation: res,
}
data, err := json.Marshal(t)
if err != nil {
return err
}
var out struct{}
b := bytes.NewBuffer(data)
return c.CallService("/deployments", "POST", "post deployment", &out, b)
}

@ -25,7 +25,6 @@ import (
fancypath "path" fancypath "path"
"path/filepath" "path/filepath"
"github.com/ghodss/yaml"
"github.com/kubernetes/helm/pkg/common" "github.com/kubernetes/helm/pkg/common"
) )
@ -110,15 +109,10 @@ func (c *Client) DeleteDeployment(name string) (*common.Deployment, error) {
} }
// PostDeployment posts a deployment object to the manager service. // PostDeployment posts a deployment object to the manager service.
func (c *Client) PostDeployment(name string, cfg *common.Configuration) error { func (c *Client) PostDeployment(res *common.Resource) error {
d, err := yaml.Marshal(cfg)
if err != nil {
return err
}
// This is a stop-gap until we get this API cleaned up. // This is a stop-gap until we get this API cleaned up.
t := common.Template{ t := common.Template{
Name: name, ChartInvocation: res,
Content: string(d),
} }
data, err := json.Marshal(t) data, err := json.Marshal(t)

@ -118,7 +118,7 @@ type Chart struct {
// Manager expands a Template into a Configuration, which // Manager expands a Template into a Configuration, which
// describes the set in a form that can be instantiated. // describes the set in a form that can be instantiated.
type Template struct { type Template struct {
ChartInvocation *Resource `json:"content"` ChartInvocation *Resource `json:"chart_invocation"`
Chart Chart `json:"chart"` Chart Chart `json:"chart"`
} }

Loading…
Cancel
Save