eip.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 remotefile
  15. import (
  16. "yunion.io/x/pkg/utils"
  17. api "yunion.io/x/cloudmux/pkg/apis/compute"
  18. "yunion.io/x/cloudmux/pkg/cloudprovider"
  19. )
  20. type SEip struct {
  21. SResourceBase
  22. IpAddr string
  23. RegionId string
  24. AssociateId string
  25. Mode string
  26. Bandwidth int
  27. }
  28. func (self *SEip) GetIpAddr() string {
  29. return self.IpAddr
  30. }
  31. func (self *SEip) GetMode() string {
  32. if utils.IsInStringArray(self.Mode, []string{api.EIP_MODE_STANDALONE_EIP, api.EIP_MODE_INSTANCE_PUBLICIP}) {
  33. return self.Mode
  34. }
  35. return api.EIP_MODE_STANDALONE_EIP
  36. }
  37. func (self *SEip) GetINetworkId() string {
  38. return ""
  39. }
  40. func (self *SEip) GetAssociationType() string {
  41. return api.EIP_ASSOCIATE_TYPE_SERVER
  42. }
  43. func (self *SEip) GetAssociationExternalId() string {
  44. return self.AssociateId
  45. }
  46. func (self *SEip) GetBandwidth() int {
  47. return self.Bandwidth
  48. }
  49. func (self *SEip) GetInternetChargeType() string {
  50. return api.EIP_CHARGE_TYPE_BY_TRAFFIC
  51. }
  52. func (self *SEip) Delete() error {
  53. return cloudprovider.ErrNotSupported
  54. }
  55. func (self *SEip) Associate(conf *cloudprovider.AssociateConfig) error {
  56. return cloudprovider.ErrNotSupported
  57. }
  58. func (self *SEip) Dissociate() error {
  59. return cloudprovider.ErrNotSupported
  60. }
  61. func (self *SEip) ChangeBandwidth(bw int) error {
  62. return cloudprovider.ErrNotSupported
  63. }