nat.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 cloudprovider
  15. import "yunion.io/x/pkg/util/billing"
  16. // These two structures are designed for modifying snat table and dnat table.
  17. // There is a so strange point that they have both field of ExternalIP and ExternalIPID.
  18. // The reason is that you must pass ExternalIPID to modify in Huawei Cloud for now.
  19. // So please construct a valid parameter ExternalIPID instead of ExternalIP in Huawei Cloud.
  20. // A more general approach is to pass both valid parameters.
  21. type SNatSRule struct {
  22. SourceCIDR string
  23. NetworkID string
  24. ExternalIP string
  25. ExternalIPID string
  26. }
  27. type SNatDRule struct {
  28. Protocol string
  29. InternalIP string
  30. InternalPort int
  31. ExternalIP string
  32. ExternalIPID string
  33. ExternalPort int
  34. }
  35. type NatGatewayCreateOptions struct {
  36. Name string
  37. VpcId string
  38. NetworkId string
  39. Desc string
  40. NatSpec string
  41. BillingCycle *billing.SBillingCycle
  42. }