mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
climc: make k8s repo sharable
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user