Add support for access control lists

This commit is contained in:
Alexandru Coman 2017-01-30 22:16:14 +02:00
parent 5050fa5e70
commit 095db463a1
No known key found for this signature in database
GPG Key ID: A7B6A9021F704507
6 changed files with 1099 additions and 1 deletions

View File

@ -121,7 +121,7 @@ single-line-if-stmt=no
no-space-check=trailing-comma,dict-separator
# Maximum number of lines in a module
max-module-lines=1000
max-module-lines=2000
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).

View File

@ -870,3 +870,151 @@ class VirtualNetworks(_BaseHNVModel):
properties["configurationState"] = config
return super(VirtualNetworks, cls).from_raw_data(raw_data)
class ACLRules(_BaseHNVModel):
"""ACL Rules Model.
The aclRules resource describes the network traffic that is allowed
or denied for a network interface of a virtual machine. Currently,
only inbound rules are expressed.
"""
_endpoint = ("/networking/v1/accessControlLists/{parent_id}"
"/aclRules/{resource_id}")
parent_id = model.Field(name="parent_id",
key="parentResourceID",
is_property=False, is_required=True,
is_read_only=True)
"""The parent resource ID field contains the resource ID that is
associated with network objects that are ancestors of the necessary
resource.
"""
action = model.Field(name="action", key="action")
"""Indicates the action the ACL Rule will take. Valid values
are: `Allow` and `Deny`."""
destination_prefix = model.Field(name="destination_prefix",
key="destinationAddressPrefix")
"""Indicates the CIDR value of destination IP or a pre-defined tag
to which traffic is destined. You can specify 0.0.0.0/0 for IPv4
all and ::/0 for IPv6 all traffic."""
destination_port_range = model.Field(name="destination_port_range",
key="destinationPortRange")
"""Indicates the destination port(s) that will trigger this ACL
rule. Valid values include a single port, port range (separated by "-"),
or "*" for all ports. All numbers are inclusive."""
source_prefix = model.Field(name="source_prefix",
key="sourceAddressPrefix")
"""Indicates the CIDR value of source IP or a pre-defined TAG from
which traffic is originating. You can specify 0.0.0.0/0 for IPv4 all
and ::/0 forIPv6 all traffic."""
source_port_range = model.Field(name="source_port_range",
key="sourcePortRange")
"""Indicates the source port(s) that will trigger this ACL rule.
Valid values include a single port, port range (separated by "-"),
or "*" for all ports. All numbers are inclusive."""
description = model.Field(name="description", key="description")
"""Indicates a description of the ACL rule."""
logging = model.Field(name="logging", key="logging",
default="Enabled")
"""Indicates whether logging will be turned on for when this
rule gets triggered. Valid values are `Enabled` or `Disabled`."""
priority = model.Field(name="priority", key="priority")
"""Indicates the priority of the rule relative to the priority of
other ACL rules. This is a unique numeric value in the context of
an accessControlLists resource. Value from 101 - 65000 are user
defined. Values 1 - 100 and 65001 - 65535 are reserved."""
protocol = model.Field(name="protocol", key="protocol")
"""Indicates the protocol to which the ACL rule will apply.
Valid values are `TCP` or `UDP`."""
rule_type = model.Field(name="rule_type", key="type")
"""Indicates whether the rule is to be evaluated against ingress
traffic (Inbound) or egress traffic (Outbound). Valid values are
`Inbound` or `Outbound`."""
class AccessControlLists(_BaseHNVModel):
"""Access Constrol List Model.
An accessControlLists resource contains a list of ACL rules.
Access control list resources can be assigned to virtual subnets
or IP configurations.
An ACL can be associated with:
* Subnets of a virtual or logical network. This means that all
network interfaces (NICs) with IP configurations created in the
subnet inherit the ACL rules in the Access Control List. Often,
subnets are used for a specific architectural tier (frontend,
middle tier, backend) in more complex applications. Assigning
an ACL to subnets can thus be used to control the network flow
between the different tiers.
*IP configuration of a NIC. This means that the ACL will be
applied to the parent network interface of the specified IP
configuration.
"""
_endpoint = "/networking/v1/accessControlLists/{resource_id}"
configuration_state = model.Field(name="configuration_state",
key="configurationState",
is_read_only=True)
"""Indicates the last known running state of this resource."""
acl_rules = model.Field(name="acl_rules", key="aclRules")
"""Indicates the rules in an access control list."""
inbound_action = model.Field(name="inbound_action",
key="inboundDefaultAction",
default="Permit")
"""Indicates the default action for Inbound Rules. Valid values are
`Permit` and `Deny`. The default value is `Permit`."""
outbound_action = model.Field(name="outbound_action",
key="outboundDefaultAction",
default="Permit")
"""Indicates the default action for Outbound Rules. Valid values are
`Permit` and `Deny`. The default value is `Permit`."""
ip_configuration = model.Field(name="ip_configuration",
key="ipConfigurations")
"""Indicates references to IP addresses of network interfaces
resources this access control list is associated with."""
subnets = model.Field(name="subnets", key="subnets")
"""Indicates an array of references to subnets resources this access
control list is associated with."""
@classmethod
def from_raw_data(cls, raw_data):
"""Create a new model using raw API response."""
properties = raw_data["properties"]
subnetworks = []
for raw_subnet in properties.get("subnets", []):
subnetworks.append(Resource.from_raw_data(raw_subnet))
properties["subnets"] = subnetworks
acl_rules = []
for raw_rule in properties.get("aclRules", []):
raw_rule["parentResourceID"] = raw_data["resourceId"]
acl_rules.append(ACLRules.from_raw_data(raw_rule))
properties["aclRules"] = acl_rules
raw_state = properties.get("configurationState", {})
configuration = ConfigurationState.from_raw_data(raw_state)
properties["configurationState"] = configuration
return super(AccessControlLists, cls).from_raw_data(raw_data)

View File

@ -61,3 +61,11 @@ class FakeResponse(object):
def virtual_subnetworks(self):
"""Fake GET(all) response for virtual subnetworks."""
return self._load_resource("virtual_subnetworks.json")
def acl_rules(self):
"""Fake GET(all) response for ACL rules."""
return self._load_resource("acl_rules.json")
def acl(self):
"""Fake GET(all) response for ACL."""
return self._load_resource("acl.json")

View File

@ -0,0 +1,864 @@
{
"value": [
{
"resourceRef": "/accessControlLists/049460a0-3d29-48a5-92fe-1b418287f2a1",
"resourceId": "049460a0-3d29-48a5-92fe-1b418287f2a1",
"etag": "W/\"736b0e54-7976-42fd-a89e-c7d00e9fbcf0\"",
"instanceId": "12053554-2e17-4389-8667-c3b9c7eb4d6f",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/049460a0-3d29-48a5-92fe-\n1b418287f2a1/aclRules/1d62b477-9992-400b-bfbb-411c8c91ed9d",
"resourceId": "1d62b477-9992-400b-bfbb-411c8c91ed9d",
"etag": "W/\"736b0e54-7976-42fd-a89e-c7d00e9fbcf0\"",
"instanceId": "985c5ee5-e275-4006-8cba-5fd704ef4c62",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/418eefd9-82b4-46ba-acda-\n354bb4559b23/ipConfigurations/601917dc-cd8c-4561-8de7-4161085bf0ac"
}
],
"subnets": [],
"configurationState": {
"status": "Failure",
"lastUpdatedTime": "2016-06-14T19:11:54.416138-07:00",
"id": "c08b3aec-be27-4be2-ab5e-19e1705ca555",
"virtualNetworkInterfaceErrors": [
{
"status": "Failure",
"detailedInfo": [
{
"source": "Firewall",
"message": "The Firewall Service encountered an error in pushing the rules\nto the Virtual machine host, through Ovsdb protocol. Error Code : 80131500",
"code": "PolicyConfigurationFailure"
}
],
"lastUpdatedTime": "2016-06-14T19:11:54.416138-07:00",
"id": "4058b793-6c28-43d4-a957-937d453075d7"
}
]
}
}
},
{
"resourceRef": "/accessControlLists/0b8d785b-bd56-4cd3-9fda-317ec3211cac",
"resourceId": "0b8d785b-bd56-4cd3-9fda-317ec3211cac",
"etag": "W/\"f4497264-84c9-489e-a37f-5b687b888351\"",
"instanceId": "fff90af7-631a-45d0-a965-0491067f2941",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/0b8d785b-bd56-4cd3-9fda-\n317ec3211cac/aclRules/b7eb9623-4ce3-4687-bf0b-9a9cf3245208",
"resourceId": "b7eb9623-4ce3-4687-bf0b-9a9cf3245208",
"etag": "W/\"f4497264-84c9-489e-a37f-5b687b888351\"",
"instanceId": "b4ab908b-caba-4728-a147-555f15e4a0cb",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.25",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/b33b9c69-32f9-4ef9-83cf-\nd42c3510cea7/ipConfigurations/0115d4cc-e5a9-43fd-a729-41a791e540fb"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/1253aa5c-6de6-41ef-b4cf-a36a2ac8abb1",
"resourceId": "1253aa5c-6de6-41ef-b4cf-a36a2ac8abb1",
"etag": "W/\"6a4601fd-e427-44cc-87b3-403e7d434c65\"",
"instanceId": "f22df31d-822d-479c-9fb6-30f4237b39d4",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/1253aa5c-6de6-41ef-b4cf-\na36a2ac8abb1/aclRules/bd36daaa-e337-4185-838f-dae07e251e8b",
"resourceId": "bd36daaa-e337-4185-838f-dae07e251e8b",
"etag": "W/\"6a4601fd-e427-44cc-87b3-403e7d434c65\"",
"instanceId": "99588a06-08c7-468e-acf7-1c76e62a514a",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.26",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/2325bf87-8f25-4187-9796-\n3a568946cf13/ipConfigurations/14c78c28-7104-417b-b57c-068a431c9649"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/14604ca7-8079-4c0a-a5f7-91a460b7e547",
"resourceId": "14604ca7-8079-4c0a-a5f7-91a460b7e547",
"etag": "W/\"77daffcc-dc38-4fc4-9c08-2d111a40941f\"",
"instanceId": "31c647f3-72ec-4947-8e8d-d4d023f63b5e",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/14604ca7-8079-4c0a-a5f7-\n91a460b7e547/aclRules/df034f28-6492-4577-a80f-0a7009c55c97",
"resourceId": "df034f28-6492-4577-a80f-0a7009c55c97",
"etag": "W/\"77daffcc-dc38-4fc4-9c08-2d111a40941f\"",
"instanceId": "af13fd31-79a0-432c-97cd-339c6be0bfb1",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.21",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/24599f61-01ef-484d-98d3-\ndcbb81d2d076/ipConfigurations/bdc7dbe5-bb40-44c4-ae9e-6d37c2558647"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/162ac5f0-7b18-4aee-a470-1764aa9e068f",
"resourceId": "162ac5f0-7b18-4aee-a470-1764aa9e068f",
"etag": "W/\"3db28c51-0c6d-48f8-bfa1-14263ef3f17b\"",
"instanceId": "a7c0b162-46ef-4c5c-bbc3-266cd7c8d4cb",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/162ac5f0-7b18-4aee-a470-\n1764aa9e068f/aclRules/f15507e8-5d46-45d3-9efb-30c28a78dc9c",
"resourceId": "f15507e8-5d46-45d3-9efb-30c28a78dc9c",
"etag": "W/\"3db28c51-0c6d-48f8-bfa1-14263ef3f17b\"",
"instanceId": "df2d3959-e471-4a14-9f56-071058dbd5ff",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.21",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/c088c35a-cd91-4352-a33a-\ne513bfd6f169/ipConfigurations/4cbf96c7-56d3-4aea-a2b0-617ea3c45d42"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/1e05607b-7524-491f-a703-4399a6799090",
"resourceId": "1e05607b-7524-491f-a703-4399a6799090",
"etag": "W/\"9bad685c-42eb-4497-a0b9-dbca466e0cb9\"",
"instanceId": "483b4be9-f338-4517-81f9-219fb018ef45",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/1e05607b-7524-491f-a703-\n4399a6799090/aclRules/1fe29735-e639-459c-bc53-5dc1a7129039",
"resourceId": "1fe29735-e639-459c-bc53-5dc1a7129039",
"etag": "W/\"9bad685c-42eb-4497-a0b9-dbca466e0cb9\"",
"instanceId": "4ab0800e-e776-46a0-a093-863c4a66940e",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.21",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/6c28c3f6-0a1e-42a6-bec7-\nfdec4885c52f/ipConfigurations/ba2f6b90-c63e-4203-9199-e6cffa41986c"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/28ecc664-74e0-41fc-81f8-b38a4c6975c7",
"resourceId": "28ecc664-74e0-41fc-81f8-b38a4c6975c7",
"etag": "W/\"c3562a19-9845-428d-9609-f9ea0995e72a\"",
"instanceId": "523fc8ce-503f-41c3-9c85-de506192afd2",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/28ecc664-74e0-41fc-81f8-\nb38a4c6975c7/aclRules/d9f12865-ec9a-4b64-9ba1-899bc0c17b72",
"resourceId": "d9f12865-ec9a-4b64-9ba1-899bc0c17b72",
"etag": "W/\"c3562a19-9845-428d-9609-f9ea0995e72a\"",
"instanceId": "2c2137e6-b9f1-4fb8-a96c-d28299a76240",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.27",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/4e435410-a0e6-450a-a582-\n40fa7382d474/ipConfigurations/5c4c0c3c-336b-4a49-8566-8b861f4dcb49"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/2d151145-53f0-49a1-b980-7f68adc79c89",
"resourceId": "2d151145-53f0-49a1-b980-7f68adc79c89",
"etag": "W/\"756ac992-bf88-4329-bf46-676b630400f8\"",
"instanceId": "0018cb4e-596e-4503-8847-5c1c871b4fda",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/2d151145-53f0-49a1-b980-\n7f68adc79c89/aclRules/de76ee71-6749-4c5b-bcf6-651a697f1fa4",
"resourceId": "de76ee71-6749-4c5b-bcf6-651a697f1fa4",
"etag": "W/\"756ac992-bf88-4329-bf46-676b630400f8\"",
"instanceId": "b8bac4d9-6b5e-400b-8a4d-45f0ef83b94f",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "0-65535",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [],
"subnets": [
{
"resourceRef": "/virtualNetworks/b1fdf9f9-a2a9-49e2-a207-\n0e210fac77ba/subnets/2010829e-7c10-4b6a-aab8-0332f9bb6fb7"
}
]
}
},
{
"resourceRef": "/accessControlLists/44870ad0-cf6d-4c0b-9eb2-1de4b0b45342",
"resourceId": "44870ad0-cf6d-4c0b-9eb2-1de4b0b45342",
"etag": "W/\"94dbc080-32a3-40a7-aa51-fe1a8cd026c1\"",
"instanceId": "be445606-97cb-43af-a961-9afed9ecd85a",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/44870ad0-cf6d-4c0b-9eb2-\n1de4b0b45342/aclRules/3ec50e18-a66d-4daf-b70f-2cf1ce997a45",
"resourceId": "3ec50e18-a66d-4daf-b70f-2cf1ce997a45",
"etag": "W/\"94dbc080-32a3-40a7-aa51-fe1a8cd026c1\"",
"instanceId": "09a7e3c7-6f51-43ea-be31-f25174eb4066",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.26",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/3b2f21f0-fd38-40b4-8c53-\ne6f648f1ba25/ipConfigurations/ff715733-de86-4dd1-a3ee-70afedf49b38"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/47ad53ea-cf60-4266-8e89-1e8be8234f61",
"resourceId": "47ad53ea-cf60-4266-8e89-1e8be8234f61",
"etag": "W/\"e92706a1-717a-4c8c-9c04-96ed5ad47b45\"",
"instanceId": "8849536d-5460-419f-a036-370846ef410e",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/47ad53ea-cf60-4266-8e89-\n1e8be8234f61/aclRules/dba8f86e-25ea-4702-9628-962732cb4984",
"resourceId": "dba8f86e-25ea-4702-9628-962732cb4984",
"etag": "W/\"e92706a1-717a-4c8c-9c04-96ed5ad47b45\"",
"instanceId": "585efbff-d269-465e-8a49-85b018f01466",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.24",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/1a5800e4-bd4e-474a-bfe9-\nb154e7174dc9/ipConfigurations/e011114a-b631-4eb3-9422-d4c7e3f1e959"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/4e387fd0-a83d-46f1-af14-257f2676a7b7",
"resourceId": "4e387fd0-a83d-46f1-af14-257f2676a7b7",
"etag": "W/\"bbf3cf36-14c7-42f3-97a6-2437818f48ae\"",
"instanceId": "61e5e84a-e205-43ec-9e92-ebd8571e98d6",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/4e387fd0-a83d-46f1-af14-\n257f2676a7b7/aclRules/f0f5f438-09ac-4acd-958d-586d5fe0230c",
"resourceId": "f0f5f438-09ac-4acd-958d-586d5fe0230c",
"etag": "W/\"bbf3cf36-14c7-42f3-97a6-2437818f48ae\"",
"instanceId": "39e68201-4d43-44ed-befc-f1be6a0e736a",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "0-65535",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [],
"subnets": [
{
"resourceRef": "/virtualNetworks/fccc1c28-6e3a-4d9f-b32a-\n4d460d0bf21f/subnets/227326db-f68e-40c6-8f7b-d2c5a15695f3"
}
]
}
},
{
"resourceRef": "/accessControlLists/507106e7-36cf-42d5-b831-0114de8e6ac2",
"resourceId": "507106e7-36cf-42d5-b831-0114de8e6ac2",
"etag": "W/\"68668a39-27aa-45a3-a578-b6e285529483\"",
"instanceId": "a8842acd-f995-4a54-b659-76dc31d99d44",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/507106e7-36cf-42d5-b831-\n0114de8e6ac2/aclRules/442c895c-8013-4cb2-b96f-4f6b9b90924b",
"resourceId": "442c895c-8013-4cb2-b96f-4f6b9b90924b",
"etag": "W/\"68668a39-27aa-45a3-a578-b6e285529483\"",
"instanceId": "446443c0-9d06-4cf6-8ec4-2efe8a97602a",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "0-65535",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [],
"subnets": [
{
"resourceRef": "/virtualNetworks/1b04d9e5-c435-4aea-8ea3-\n365250e9ff7b/subnets/18cd3cf0-5507-4876-8232-3175f3f020af"
}
]
}
},
{
"resourceRef": "/accessControlLists/5a7e4538-43fd-4519-9305-ed3e51a4449d",
"resourceId": "5a7e4538-43fd-4519-9305-ed3e51a4449d",
"etag": "W/\"6c029bf6-94b3-429c-9714-218aca49b06a\"",
"instanceId": "626a1625-4ae2-42a9-8c4e-5f97d3dcbc3d",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/5a7e4538-43fd-4519-9305-\ned3e51a4449d/aclRules/933b7d87-fde0-413e-b387-2e843a4080ff",
"resourceId": "933b7d87-fde0-413e-b387-2e843a4080ff",
"etag": "W/\"6c029bf6-94b3-429c-9714-218aca49b06a\"",
"instanceId": "9ff29ca5-a86c-4365-a8f5-17ca1072c1b1",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.25",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/57f32f39-07d8-4f6c-9014-\n270d5af96b50/ipConfigurations/eed8e42e-17e7-46b8-80fd-c580f7a37d54"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/5cd7c188-a510-40de-ae59-d8f338f638eb",
"resourceId": "5cd7c188-a510-40de-ae59-d8f338f638eb",
"etag": "W/\"a47e550c-526f-4dba-9b58-a650500f489c\"",
"instanceId": "31305b92-68bc-473f-a91c-cc6efc743b44",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/5cd7c188-a510-40de-ae59-\nd8f338f638eb/aclRules/bab91fb0-ce4a-4fff-a0b7-a545d7ed41cb",
"resourceId": "bab91fb0-ce4a-4fff-a0b7-a545d7ed41cb",
"etag": "W/\"a47e550c-526f-4dba-9b58-a650500f489c\"",
"instanceId": "73f052fc-96e9-4a5d-992b-f16ad5f766c2",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.25",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/1c4f0be6-0ba9-417c-9f66-\nc4a4c1163029/ipConfigurations/28ba9be8-4d21-4829-91dd-dc88f964507c"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/673519cb-f22d-432e-bae0-e8d5f3da5a17",
"resourceId": "673519cb-f22d-432e-bae0-e8d5f3da5a17",
"etag": "W/\"2885d50c-8053-46e1-9350-dfe9241c4f34\"",
"instanceId": "0df2783a-0f30-46dc-a133-faad53335a1c",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/673519cb-f22d-432e-bae0-\ne8d5f3da5a17/aclRules/3d2080b2-2fca-4ccb-8b97-3337e92aeb5e",
"resourceId": "3d2080b2-2fca-4ccb-8b97-3337e92aeb5e",
"etag": "W/\"2885d50c-8053-46e1-9350-dfe9241c4f34\"",
"instanceId": "5a25bbbd-df7a-4cbd-8c2a-55736dbdc4cd",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.23",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/80f93684-4711-4319-beac-\ndfb81c2cef23/ipConfigurations/cdcedf7f-e216-406a-971a-cbd553e3020e"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/782332ab-9736-49c7-a5a2-71e31bd7c898",
"resourceId": "782332ab-9736-49c7-a5a2-71e31bd7c898",
"etag": "W/\"225175df-cddf-4752-88e0-94bf2f302ce2\"",
"instanceId": "9e26e2f7-32c6-4f29-85a8-344660df17b1",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/782332ab-9736-49c7-a5a2-\n71e31bd7c898/aclRules/1eb3767c-40fd-4ef4-bcb5-b6e40e3d4eb9",
"resourceId": "1eb3767c-40fd-4ef4-bcb5-b6e40e3d4eb9",
"etag": "W/\"225175df-cddf-4752-88e0-94bf2f302ce2\"",
"instanceId": "1163eda6-c64a-4f8d-8490-6609bfc3e6fb",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/9aca78f4-ddbd-4201-8199-\n1e530a38b1c2/ipConfigurations/4a1870d8-6c53-4e6c-afdb-9f490e9a8f18"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/942b2145-982f-47d1-b360-e65d589c200c",
"resourceId": "942b2145-982f-47d1-b360-e65d589c200c",
"etag": "W/\"6b22bafe-ac18-4fd9-b468-8efc4c8bc684\"",
"instanceId": "f9bf6580-e1a0-4fd7-a32d-ee55f13e7998",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/942b2145-982f-47d1-b360-\ne65d589c200c/aclRules/8bb9cd37-ed88-4486-bff1-57ff54d86cd0",
"resourceId": "8bb9cd37-ed88-4486-bff1-57ff54d86cd0",
"etag": "W/\"6b22bafe-ac18-4fd9-b468-8efc4c8bc684\"",
"instanceId": "07818909-bba2-4500-8d93-852e33332ea6",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.24",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/bb78e9a2-3949-4d93-81e8-\n8ba5bd01c0d1/ipConfigurations/d8685944-e3f5-45e5-ac4b-162a9431b70f"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/969e7826-44ef-4a11-baa9-98cd6414fb45",
"resourceId": "969e7826-44ef-4a11-baa9-98cd6414fb45",
"etag": "W/\"9a819856-6e87-46d6-92e8-e92e3b114b86\"",
"instanceId": "9a5e1f25-0cbc-43b4-b185-7f84c2291205",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/969e7826-44ef-4a11-baa9-\n98cd6414fb45/aclRules/a5b6bf1d-91ce-4879-ad35-e783a20e88a1",
"resourceId": "a5b6bf1d-91ce-4879-ad35-e783a20e88a1",
"etag": "W/\"9a819856-6e87-46d6-92e8-e92e3b114b86\"",
"instanceId": "764ac2e7-9fa7-4c33-b6cd-d0b84b553476",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.27",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/7d855a76-7be7-4681-8710-\ncff77f67fbcd/ipConfigurations/8f26861a-3a97-4564-8fc0-7b40553c954a"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/994ea3d0-43a5-4bbf-baae-fa72bc87a7b5",
"resourceId": "994ea3d0-43a5-4bbf-baae-fa72bc87a7b5",
"etag": "W/\"ba590e2a-3ba9-4964-b2d4-9bfce3fc1f71\"",
"instanceId": "4dded1f2-af8f-4c2b-9400-357f73fadd96",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/994ea3d0-43a5-4bbf-baae-\nfa72bc87a7b5/aclRules/ef188f68-79d6-4e37-8cbc-2e55e0554167",
"resourceId": "ef188f68-79d6-4e37-8cbc-2e55e0554167",
"etag": "W/\"ba590e2a-3ba9-4964-b2d4-9bfce3fc1f71\"",
"instanceId": "9c4f2ed9-9ec5-4c31-b0b3-12f32474f83b",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.26",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/10ad4e45-26a5-4dc1-85a5-\n618525b940df/ipConfigurations/e016f4e6-766e-4ac7-a9d8-ef1881d4e824"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/b3430b40-f6ab-4bb7-9587-17adfc8d258f",
"resourceId": "b3430b40-f6ab-4bb7-9587-17adfc8d258f",
"etag": "W/\"8804d8e1-b8e2-4581-a132-4e66997a8780\"",
"instanceId": "bda54313-903f-4623-92c7-7923e1984f91",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/b3430b40-f6ab-4bb7-9587-\n17adfc8d258f/aclRules/7cb584e8-a018-4061-a95b-1263fef7c861",
"resourceId": "7cb584e8-a018-4061-a95b-1263fef7c861",
"etag": "W/\"8804d8e1-b8e2-4581-a132-4e66997a8780\"",
"instanceId": "38737310-2a72-454e-a7f3-aedc56bae055",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.23",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/f2a23d03-ea52-43a9-8c1f-\n7921b4621ddf/ipConfigurations/9a9b2039-f578-43bd-b761-2de4f5b10e18"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/bd8ae3b4-5f4b-4a1d-ab58-b30e15932af0",
"resourceId": "bd8ae3b4-5f4b-4a1d-ab58-b30e15932af0",
"etag": "W/\"f841ece6-95de-4390-8c5a-da803c179cb1\"",
"instanceId": "35ff4cd3-f4c2-446b-a8d6-dddd81d37231",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/bd8ae3b4-5f4b-4a1d-ab58-\nb30e15932af0/aclRules/e37cbf9a-83f5-4f2b-831a-c316cf71f3a5",
"resourceId": "e37cbf9a-83f5-4f2b-831a-c316cf71f3a5",
"etag": "W/\"f841ece6-95de-4390-8c5a-da803c179cb1\"",
"instanceId": "1458c402-bb13-4a6a-a551-7bc464db60ba",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.27",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/c996e4c2-d062-4e8f-a9b9-\n30f63cc36ffb/ipConfigurations/6e3bcf32-5af0-4b33-b6f6-1b8f902ea0e3"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/dd2481a6-51b7-42d8-b22d-b87c191c7c70",
"resourceId": "dd2481a6-51b7-42d8-b22d-b87c191c7c70",
"etag": "W/\"cb1703c4-9a53-4989-b843-23f2790db01b\"",
"instanceId": "8ec4262d-62f7-4970-b931-f53acd198678",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/dd2481a6-51b7-42d8-b22d-\nb87c191c7c70/aclRules/35479197-05fb-4292-a88f-e02f74ce5133",
"resourceId": "35479197-05fb-4292-a88f-e02f74ce5133",
"etag": "W/\"cb1703c4-9a53-4989-b843-23f2790db01b\"",
"instanceId": "3bd79d27-8791-4149-b88d-a856e2ddcaa0",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.23",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/ba1b152b-2671-4dd1-9069-\n763eb77ae259/ipConfigurations/3980df14-989b-4f0c-adaa-1be54b78b5e1"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/e8920953-c894-4eac-9cf7-ca79ee8412dc",
"resourceId": "e8920953-c894-4eac-9cf7-ca79ee8412dc",
"etag": "W/\"7fa32fec-62bb-4659-a6b8-48951f615ecc\"",
"instanceId": "6d641dab-a2a4-44fb-871c-e286ebb4ae95",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/e8920953-c894-4eac-9cf7-\nca79ee8412dc/aclRules/e4f6b8a9-a8d8-46a3-b5f6-4c6948edcdd3",
"resourceId": "e4f6b8a9-a8d8-46a3-b5f6-4c6948edcdd3",
"etag": "W/\"7fa32fec-62bb-4659-a6b8-48951f615ecc\"",
"instanceId": "196dc2b8-c44c-4627-acb4-f600e9bbfcaa",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.170.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/fe79110d-7075-478c-975c-\n79f362791a88/ipConfigurations/268203d3-bffc-4d82-a402-6e274d3dce28"
}
],
"subnets": []
}
},
{
"resourceRef": "/accessControlLists/eae828ec-2c50-426f-90db-97449b187d3f",
"resourceId": "eae828ec-2c50-426f-90db-97449b187d3f",
"etag": "W/\"1c2e4e25-7b2c-48f5-b9a2-660351e17097\"",
"instanceId": "3dab675e-62f6-42c9-a929-a31dfe28c3c0",
"properties": {
"provisioningState": "Succeeded",
"aclRules": [
{
"resourceRef": "/accessControlLists/eae828ec-2c50-426f-90db-\n97449b187d3f/aclRules/dafb0eaf-446d-4d22-a05d-b4fc6182a419",
"resourceId": "dafb0eaf-446d-4d22-a05d-b4fc6182a419",
"etag": "W/\"1c2e4e25-7b2c-48f5-b9a2-660351e17097\"",
"instanceId": "530ea20d-95d3-43a4-83f0-053a556ed638",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.168.0.24",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"ipConfigurations": [
{
"resourceRef": "/networkInterfaces/6a5e50b8-9662-4645-b5cc-\nf4bb19e14202/ipConfigurations/5092e884-f118-453a-842b-9c0242e55588"
}
],
"subnets": []
}
}
],
"nextLink": ""
}

View File

@ -0,0 +1,59 @@
{
"value": [
{
"resourceRef": "/accessControlLists/049460a0-3d29-48a5-92fe-1b418287f2a1/aclRules/1d62b477-9992-400b-bfbb-411c8c91ed9d",
"resourceId": "1d62b477-9992-400b-bfbb-411c8c91ed9d",
"etag": "W/\"736b0e54-7976-42fd-a89e-c7d00e9fbcf0\"",
"instanceId": "985c5ee5-e275-4006-8cba-5fd704ef4c62",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
},
{
"resourceRef": "/accessControlLists/049460a0-3d29-48a5-92fe-1b418287f2a1/aclRules/1d62b477-9992-400b-bfbb-411c8c91ed9",
"resourceId": "1d62b477-9992-400b-bfbb-411c8c91ed9",
"etag": "W/\"736b0e54-7976-42fd-a89e-c7d00e9fbcf0\"",
"instanceId": "985c5ee5-e275-4006-8cba-5fd704ef4c62",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
},
{
"resourceRef": "/accessControlLists/049460a0-3d29-48a5-92fe-1b418287f2a1/aclRules/1d62b477-9992-400b-bfbb-411c8c91ed9d",
"resourceId": "1d62b477-9992-400b-bfbb-411c8c91ed9d",
"etag": "W/\"736b0e54-7976-42fd-a89e-c7d00e9fbcf0\"",
"instanceId": "985c5ee5-e275-4006-8cba-5fd704ef4c62",
"properties": {
"provisioningState": "Succeeded",
"protocol": "All",
"sourcePortRange": "0-65535",
"destinationPortRange": "31267",
"action": "Allow",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "20.169.0.22",
"priority": "200",
"type": "Inbound",
"logging": "Enabled"
}
}
],
"nextLink": ""
}

View File

@ -251,3 +251,22 @@ class TestClient(unittest.TestCase):
for raw_data in resources.get("value", []):
self._test_get_resource(model=client.SubNetworks,
raw_data=raw_data)
def test_acl_rules(self):
resources = self._response.acl_rules()
for raw_data in resources.get("value", []):
self._test_get_resource(model=client.ACLRules,
raw_data=raw_data)
def test_acl(self):
resources = self._response.acl()
for raw_data in resources.get("value", []):
self._test_get_resource(model=client.AccessControlLists,
raw_data=raw_data)
def test_acl_structure(self):
raw_data = self._response.acl()["value"][0]
acl = client.AccessControlLists.from_raw_data(raw_data)
for acl_rule in acl.acl_rules:
self.assertIsInstance(acl_rule, client.ACLRules)