feat(climc): add public/private command for k8s-container-registry (#21228)

This commit is contained in:
Zexi Li
2024-09-13 14:34:38 +08:00
committed by GitHub
parent 379a183f88
commit f1e6622d94
2 changed files with 17 additions and 0 deletions
@@ -37,6 +37,8 @@ func initContainerRegistry() {
cmd.Create(new(o.RegistryCreateOptions))
cmd.Get("images", new(o.RegistryGetImagesOptions))
cmd.Get("image-tags", new(o.RegistryGetImageTagsOptions))
cmd.BatchPerform("public", new(o.RegistryPublicOptions))
cmd.Perform("private", new(o.RegistryGetOptions))
type UploadOptions struct {
REGISTRY string `help:"The name or id of registry" json:"-"`
@@ -91,3 +91,18 @@ func (o RegistryGetImageTagsOptions) Params() (jsonutils.JSONObject, error) {
"repository": o.REPOSITORY,
}), nil
}
type RegistryPublicOptions struct {
ID []string `help:"ID or name of image" json:"-"`
Scope string `help:"sharing scope" choices:"system|domain|project" json:"scope"`
SharedProjects []string `help:"Share to projects" json:"shared_projects"`
SharedDomains []string `help:"Share to domains" json:"shared_domains"`
}
func (o RegistryPublicOptions) Params() (jsonutils.JSONObject, error) {
return jsonutils.Marshal(o), nil
}
func (o RegistryPublicOptions) GetIds() []string {
return o.ID
}