climc: support create resource from file, raw put body fix

This commit is contained in:
Zexi Li
2018-09-10 16:32:18 +08:00
parent 481a6a1ae6
commit eb3ff786a7
4 changed files with 45 additions and 5 deletions
+14 -1
View File
@@ -4,15 +4,28 @@ import (
"yunion.io/x/onecloud/pkg/mcclient/modules"
)
var Deployments *DeploymentManager
var (
Deployments *DeploymentManager
DeployFromFile *DeployFromFileManager
)
type DeploymentManager struct {
*NamespaceResourceManager
}
type DeployFromFileManager struct {
*NamespaceResourceManager
}
func init() {
Deployments = &DeploymentManager{
NewNamespaceResourceManager("deployment", "deployments",
NewNamespaceCols(), NewColumns())}
DeployFromFile = &DeployFromFileManager{
NewNamespaceResourceManager("deployfromfile", "deployfromfiles",
NewNamespaceCols(), NewColumns())}
modules.Register(Deployments)
modules.Register(DeployFromFile)
}
+1 -3
View File
@@ -68,10 +68,8 @@ func (m *RawResourceManager) Get(s *mcclient.ClientSession, kind string, namespa
}
func (m *RawResourceManager) Put(s *mcclient.ClientSession, kind string, namespace string, name string, body jsonutils.JSONObject, cluster string) error {
newBody := jsonutils.NewDict()
newBody.Add(body, "raw")
ctx := newRawResource(kind, namespace, name, cluster)
_, err := m.request(s, "PUT", ctx.path(), newBody)
_, err := m.request(s, "PUT", ctx.path(), body)
return err
}