esg_model.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
  2. # Copyright 2010 United States Government as represented by the
  3. # Administrator of the National Aeronautics and Space Administration.
  4. # Copyright 2011 Piston Cloud Computing, Inc.
  5. # All Rights Reserved.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  8. # not use this file except in compliance with the License. You may obtain
  9. # a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. # License for the specific language governing permissions and limitations
  17. # under the License.
  18. """
  19. This module provides models for ESG-SDK.
  20. """
  21. class TagModel(object):
  22. """
  23. TAGModel
  24. """
  25. def __init__(self, tagKey=None, tagValue=None):
  26. self.tagKey = tagKey
  27. self.tagValue = tagValue
  28. class EnterpriseSecurityGroupRuleModel(object):
  29. """
  30. This class define the rule of the securitygroup.
  31. param: remark:
  32. The remark for the rule.
  33. param: direction:
  34. The parameter to define the rule direction,available value are "ingress/egress".
  35. param: ethertype:
  36. The ethernet protocol.
  37. param: portRange:
  38. The port range to specify the port which the rule will work on.
  39. Available range is rang [0, 65535], the fault value is "" for all port.
  40. param: sourceportRange:
  41. The source port range to specify the port which the rule will work on.
  42. Available range is rang [0, 65535], the fault value is "" for all port.
  43. param: protocol:
  44. The parameter specify which protocol will the rule work on, the fault value is "" for all protocol.
  45. Available protocol are tcp, udp and icmp.
  46. param: sourceIp:
  47. The source ip range with CIDR formats. The default value 0.0.0.0/0 (allow all ip address),
  48. other supported formats such as {ip_addr}/12 or {ip_addr}. Only supports IPV4.
  49. Only works for direction = "ingress".
  50. param: destIp:
  51. The destination ip range with CIDR formats. The default value 0.0.0.0/0 (allow all ip address),
  52. other supported formats such as {ip_addr}/12 or {ip_addr}. Only supports IPV4.
  53. Only works for direction = "egress".
  54. param: EnterprisesecurityGroupId:
  55. The id of the Enterprisesecuritygroup for the rule.
  56. param: localIp:
  57. The parameter specify the localIP (allow all ip address: all).
  58. param: priority:
  59. The parameter specify the priority of the rule(range 1-1000).
  60. param: action:
  61. The parameter specify the action of the rule, available value are "allow/deny".
  62. """
  63. def __init__(self, remark=None, direction=None, ethertype=None, portRange=None, sourcePortRange=None,
  64. protocol=None, sourceIp=None, destIp=None,
  65. enterpriseSecurityGroupId=None, action=None, localIp=None, priority=None):
  66. self.remark = remark
  67. self.direction = direction
  68. self.ethertype = ethertype
  69. self.portRange = portRange
  70. self.sourcePortRange = sourcePortRange
  71. self.protocol = protocol
  72. self.sourceIp = sourceIp
  73. self.destIp = destIp
  74. self.enterpriseSecurityGroupId = enterpriseSecurityGroupId
  75. self.action = action
  76. self.localIp = localIp
  77. self.priority = priority