Merge pull request #552 in YUNIONIO/onecloud from ~LIZEXI/onecloud:feature/lzx-repo-sharable to release/2.3.0

* commit '4098440c8f9c7319af2eebbdfa00bd03bcb6abf7':
  climc: make k8s repo sharable
This commit is contained in:
邱剑
2018-11-22 01:18:34 +08:00
2 changed files with 23 additions and 1 deletions
+18
View File
@@ -67,4 +67,22 @@ func initRepo() {
printObject(repo)
return nil
})
R(&o.RepoGetOptions{}, cmdN("public"), "Make repository public", func(s *mcclient.ClientSession, args *o.RepoGetOptions) error {
repo, err := k8s.Repos.PerformAction(s, args.NAME, "public", nil)
if err != nil {
return err
}
printObject(repo)
return nil
})
R(&o.RepoGetOptions{}, cmdN("private"), "Make repository private", func(s *mcclient.ClientSession, args *o.RepoGetOptions) error {
repo, err := k8s.Repos.PerformAction(s, args.NAME, "private", nil)
if err != nil {
return err
}
printObject(repo)
return nil
})
}
+5 -1
View File
@@ -16,13 +16,17 @@ type RepoGetOptions struct {
type RepoCreateOptions struct {
RepoGetOptions
URL string `help:"Repository url"`
URL string `help:"Repository url"`
Public bool `help:"Make repostitory public"`
}
func (o RepoCreateOptions) Params() *jsonutils.JSONDict {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(o.NAME), "name")
params.Add(jsonutils.NewString(o.URL), "url")
if o.Public {
params.Add(jsonutils.JSONTrue, "is_public")
}
return params
}