helm_chart.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package k8s
  15. import (
  16. "fmt"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/mcclient/modules"
  19. )
  20. var (
  21. Charts *ChartManager
  22. )
  23. type ChartManager struct {
  24. *ResourceManager
  25. }
  26. func init() {
  27. Charts = &ChartManager{NewResourceManager("chart", "charts",
  28. NewColumns("RepoWithName", "Version", "Description"),
  29. NewColumns())}
  30. modules.Register(Charts)
  31. }
  32. func (m ChartManager) Get_RepoWithName(obj jsonutils.JSONObject) interface{} {
  33. repo, _ := obj.GetString("repo")
  34. name, _ := obj.GetString("chart", "name")
  35. return fmt.Sprintf("%s/%s", repo, name)
  36. }
  37. func (m ChartManager) Get_Version(obj jsonutils.JSONObject) interface{} {
  38. version, _ := obj.GetString("chart", "version")
  39. return version
  40. }
  41. func (m ChartManager) Get_Description(obj jsonutils.JSONObject) interface{} {
  42. desc, _ := obj.GetString("chart", "description")
  43. return desc
  44. }