|
@@ -16,6 +16,47 @@ class Node
|
|
|
has_one :out, :az, rel_class: :NodeAz
|
|
|
has_one :out, :sshkey, rel_class: :NodeSshKey
|
|
|
has_one :out, :account, rel_class: :NodeAccount
|
|
|
+ has_many :out, :node_sg, rel_class: :NodeSecurityGroup
|
|
|
+end
|
|
|
+
|
|
|
+class SecurityGroup
|
|
|
+ include Neo4j::ActiveNode
|
|
|
+ property :sg_id, constraint: :unique
|
|
|
+ property :name
|
|
|
+ property :description
|
|
|
+ has_one :out, :sg_owner, rel_class: :SecurityGroupOwner
|
|
|
+ has_one :out, :sg_vpc, rel_class: :SecurityGroupVpc
|
|
|
+# has_many :out, :ip_rules, rel_class: :SecurityGroupsIpRules
|
|
|
+# has_many :out, :sg_rules, rel_class: :SecurityGroupsSgRules
|
|
|
+end
|
|
|
+
|
|
|
+class NodeSecurityGroup
|
|
|
+ include Neo4j::ActiveRel
|
|
|
+ from_class :Node
|
|
|
+ to_class :SecurityGroup
|
|
|
+ type :node_sg
|
|
|
+end
|
|
|
+
|
|
|
+class SecurityGroupOwner
|
|
|
+ include Neo4j::ActiveRel
|
|
|
+ from_class :SecurityGroup
|
|
|
+ to_class :AwsAccount
|
|
|
+ type :sg_owner
|
|
|
+end
|
|
|
+
|
|
|
+class SecurityGroupVpc
|
|
|
+ include Neo4j::ActiveRel
|
|
|
+ from_class :SecurityGroup
|
|
|
+ to_class :Vpc
|
|
|
+ type :sg_vpc
|
|
|
+end
|
|
|
+
|
|
|
+class IpRules
|
|
|
+ include Neo4j::ActiveNode
|
|
|
+ property :cidr_block
|
|
|
+ property :direction
|
|
|
+ property :proto
|
|
|
+ property :start_port
|
|
|
end
|
|
|
|
|
|
# SSH key class
|