mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
climc: support create resource from file, raw put body fix
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user