fed_joint_resource.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/pkg/mcclient/options"
  18. )
  19. type FedJointClusterBaseListOptions struct {
  20. options.BaseListOptions
  21. FederatedResourceId string `help:"ID or Name of federated resource" json:"federatedresource_id"`
  22. ClusterId string `help:"ID or Name of cluster"`
  23. NamespaceId string `help:"ID or Name of namespace"`
  24. ResourceId string `help:"ID or Name of resource"`
  25. }
  26. func (o *FedJointClusterBaseListOptions) GetMasterOpt() string {
  27. return o.FederatedResourceId
  28. }
  29. func (o *FedJointClusterBaseListOptions) GetSlaveOpt() string {
  30. return o.ClusterId
  31. }
  32. func (o *FedJointClusterBaseListOptions) Params() (jsonutils.JSONObject, error) {
  33. return options.ListStructToParams(o)
  34. }
  35. type FedNamespaceJointClusterListOpt struct {
  36. FedJointClusterBaseListOptions
  37. FederatednamespaceId string `help:"ID or Name of federatednamespace"`
  38. }
  39. func (o *FedNamespaceJointClusterListOpt) Params() (jsonutils.JSONObject, error) {
  40. return options.ListStructToParams(o)
  41. }
  42. type FedResourceJointClusterShowOptions struct {
  43. FedResourceIdOptions
  44. FedResourceClusterShowOptions
  45. }
  46. func (o FedResourceJointClusterShowOptions) GetMasterId() string {
  47. return o.FEDRESOURCE
  48. }
  49. func (o FedResourceJointClusterShowOptions) Params() (jsonutils.JSONObject, error) {
  50. return nil, nil
  51. }
  52. type FedResourceIdOptions struct {
  53. FEDRESOURCE string `help:"ID or Name of federated resource"`
  54. }
  55. func (o FedResourceIdOptions) GetId() string {
  56. return o.FEDRESOURCE
  57. }
  58. func (o FedResourceIdOptions) Params() (jsonutils.JSONObject, error) {
  59. return nil, nil
  60. }
  61. type FedResourceUpdateOptions struct {
  62. FedResourceIdOptions
  63. }
  64. func (o FedResourceUpdateOptions) GetUpdateFields() []string {
  65. return []string{"spec"}
  66. }
  67. type FedResourceJointClusterAttachOptions struct {
  68. FedResourceIdOptions
  69. FedResourceClusterJointOptions
  70. }
  71. func (o *FedResourceJointClusterAttachOptions) GetId() string {
  72. return o.FEDRESOURCE
  73. }
  74. func (o *FedResourceJointClusterAttachOptions) Params() (jsonutils.JSONObject, error) {
  75. return o.FedResourceClusterJointOptions.Params()
  76. }
  77. type FedResourceJointClusterDetachOptions struct {
  78. FedResourceIdOptions
  79. FedResourceClusterJointOptions
  80. }
  81. func (o *FedResourceJointClusterDetachOptions) GetId() string {
  82. return o.FEDRESOURCE
  83. }
  84. func (o *FedResourceJointClusterDetachOptions) Params() (jsonutils.JSONObject, error) {
  85. return o.FedResourceClusterJointOptions.Params()
  86. }