forwards.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 cloudproxy
  15. import (
  16. "yunion.io/x/jsonutils"
  17. "yunion.io/x/onecloud/pkg/mcclient/options"
  18. )
  19. type ForwardCreateOptions struct {
  20. NAME string
  21. ProxyEndpointId string `required:"true"`
  22. ProxyAgentId string
  23. BindPortReq *int
  24. Type string `choices:"local|remote" required:"true"`
  25. RemoteAddr string `required:"true"`
  26. RemotePort int `required:"true"`
  27. LastSeenTimeout int `json:",omitzero"`
  28. Opaque string
  29. }
  30. func (o *ForwardCreateOptions) Params() (jsonutils.JSONObject, error) {
  31. return options.StructToParams(o)
  32. }
  33. type ForwardCreateFromServerOptions struct {
  34. ServerId string `required:"true"`
  35. Type string `choices:"local|remote" required:"true"`
  36. BindPortReq int `json:",omitzero"`
  37. RemotePort string `required:"true"`
  38. LastSeenTimeout int `json:",omitzero"`
  39. Opaque string
  40. }
  41. func (opts *ForwardCreateFromServerOptions) Params() (jsonutils.JSONObject, error) {
  42. return options.StructToParams(opts)
  43. }
  44. type ForwardHeartbeatOptions struct {
  45. ID string `json:"-"`
  46. }
  47. func (o *ForwardHeartbeatOptions) GetId() string {
  48. return o.ID
  49. }
  50. func (o *ForwardHeartbeatOptions) Params() (jsonutils.JSONObject, error) {
  51. return options.StructToParams(o)
  52. }
  53. type ForwardShowOptions struct {
  54. options.BaseShowOptions
  55. }
  56. type ForwardUpdateOptions struct {
  57. ID string `json:"-"`
  58. Name string
  59. ProxyEndpointId string
  60. ProxyAgentId string
  61. Type string `choices:"local|remote"`
  62. RemoteAddr string
  63. RemotePortReq *int
  64. BindPortReq *int
  65. LastSeenTimeout int `json:",omitzero"`
  66. Opaque string
  67. }
  68. func (o *ForwardUpdateOptions) GetId() string {
  69. return o.ID
  70. }
  71. func (o *ForwardUpdateOptions) Params() (jsonutils.JSONObject, error) {
  72. return options.StructToParams(o)
  73. }
  74. type ForwardDeleteOptions struct {
  75. options.BaseIdOptions
  76. }
  77. type ForwardListOptions struct {
  78. options.BaseListOptions
  79. ProxyEndpointId string
  80. ProxyAgentId string
  81. Type string `choices:"local|remote"`
  82. RemoteAddr string
  83. RemotePort *int
  84. BindPortReq *int
  85. Opaque string
  86. }
  87. func (o *ForwardListOptions) Params() (jsonutils.JSONObject, error) {
  88. return options.ListStructToParams(o)
  89. }