From e0be4d7b27071a651c471680591e63ed96339cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= Date: Tue, 21 May 2019 05:48:07 -0400 Subject: [PATCH] Implements listAll method in NetworkSecurityGroupApi (#31) * Implements listAll method in NetworkSecurityGroupApi * Adds Mock and Live tests for new method --- .../azurecompute/arm/AzureComputeApi.java | 2 +- .../AzureComputeSecurityGroupExtension.java | 13 +- .../arm/features/NetworkSecurityGroupApi.java | 23 +- .../NetworkSecurityGroupApiLiveTest.java | 34 ++- .../NetworkSecurityGroupApiMockTest.java | 34 ++- .../networksecuritygrouplistall.json | 252 ++++++++++++++++++ 6 files changed, 329 insertions(+), 29 deletions(-) create mode 100644 providers/azurecompute-arm/src/test/resources/networksecuritygrouplistall.json diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java index f6debefa3e..f62daa5c98 100644 --- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java +++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java @@ -172,7 +172,7 @@ public interface AzureComputeApi extends Closeable { * @see docs */ @Delegate - NetworkSecurityGroupApi getNetworkSecurityGroupApi(@PathParam("resourcegroup") String resourcegroup); + NetworkSecurityGroupApi getNetworkSecurityGroupApi(@Nullable @PathParam("resourcegroup") String resourcegroup); /** * The NetworkSecurityRule API includes operations for managing network security rules within a network security group. diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeSecurityGroupExtension.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeSecurityGroupExtension.java index bfbd595b9a..59fec2b3d2 100644 --- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeSecurityGroupExtension.java +++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeSecurityGroupExtension.java @@ -109,12 +109,8 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio } private Set securityGroupsInLocations(final Set locations) { - List securityGroups = new ArrayList(); - for (ResourceGroup rg : api.getResourceGroupApi().list()) { - securityGroups.addAll(securityGroupsInResourceGroup(rg.name())); - } - - return ImmutableSet.copyOf(filter(securityGroups, new Predicate() { + final ImmutableSet allSecurityGroups = ImmutableSet.copyOf(transform(filter(api.getNetworkSecurityGroupApi(null).listAll(), notNull()), securityGroupConverter)); + return ImmutableSet.copyOf(filter(allSecurityGroups, new Predicate() { @Override public boolean apply(SecurityGroup input) { return input.getLocation() != null && locations.contains(input.getLocation().getId()); @@ -122,11 +118,6 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio })); } - private Set securityGroupsInResourceGroup(String resourceGroup) { - List networkGroups = api.getNetworkSecurityGroupApi(resourceGroup).list(); - return ImmutableSet.copyOf(transform(filter(networkGroups, notNull()), securityGroupConverter)); - } - @Override public Set listSecurityGroupsForNode(String nodeId) { logger.debug(">> getting security groups for node %s...", nodeId); diff --git a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java index 41c0c856df..7d2ad6a06f 100644 --- a/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java +++ b/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java @@ -19,7 +19,6 @@ package org.jclouds.azurecompute.arm.features; import java.net.URI; import java.util.List; import java.util.Map; - import javax.inject.Named; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -29,6 +28,7 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.MediaType; +import org.jclouds.Fallbacks; import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup; @@ -45,26 +45,38 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.binders.BindToJsonPayload; -@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups") +/** + * The Network Security Group API includes operations for managing the network security groups in your subscription. + * + * @see docs + */ @RequestFilters({ OAuthFilter.class, ApiVersionFilter.class }) @Consumes(MediaType.APPLICATION_JSON) public interface NetworkSecurityGroupApi { @Named("networksecuritygroup:list") + @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups") @GET @SelectJson("value") @Fallback(EmptyListOnNotFoundOr404.class) List list(); + @Named("networksecuritygroup:listall") + @GET + @Path("/providers/Microsoft.Network/networkSecurityGroups") + @SelectJson("value") + @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class) + List listAll(); + @Named("networksecuritygroup:delete") - @Path("/{networksecuritygroupname}") + @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}") @DELETE @ResponseParser(URIParser.class) @Fallback(NullOnNotFoundOr404.class) URI delete(@PathParam("networksecuritygroupname") String nsgName); @Named("networksecuritygroup:createOrUpdate") - @Path("/{networksecuritygroupname}") + @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}") @PUT @MapBinder(BindToJsonPayload.class) NetworkSecurityGroup createOrUpdate(@PathParam("networksecuritygroupname") String nsgName, @@ -72,8 +84,9 @@ public interface NetworkSecurityGroupApi { @PayloadParam("properties") NetworkSecurityGroupProperties properties); @Named("networksecuritygroup:get") - @Path("/{networksecuritygroupname}") + @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}") @GET @Fallback(NullOnNotFoundOr404.class) NetworkSecurityGroup get(@PathParam("networksecuritygroupname") String nsgName); + } diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiLiveTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiLiveTest.java index 3a2f4ebaa9..09cb2d6121 100644 --- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiLiveTest.java +++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiLiveTest.java @@ -69,7 +69,7 @@ public class NetworkSecurityGroupApiLiveTest extends BaseAzureComputeApiLiveTest assertNotNull(result); assertEquals(result.size(), 1); - // check that the nework security group matches the one we originally passed in + // check that the network security group matches the one we originally passed in NetworkSecurityGroup original = newNetworkSecurityGroup(nsgName, LOCATION); NetworkSecurityGroup nsg = result.get(0); assertEquals(original.name(), nsg.name()); @@ -84,7 +84,37 @@ public class NetworkSecurityGroupApiLiveTest extends BaseAzureComputeApiLiveTest assertTrue(originalRule.properties().equals(nsgRule.properties())); } - @Test(dependsOnMethods = {"listNetworkSecurityGroups", "getNetworkSecurityGroup"}, alwaysRun = true) + @Test(dependsOnMethods = "createNetworkSecurityGroup") + public void listAllNetworkSecurityGroups() { + List result = api().listAll(); + + // verify we have at least the original created SG. We could retrieve here any other SGs in different RGs + assertNotNull(result); + assertTrue(result.size() > 1); + + NetworkSecurityGroup original = newNetworkSecurityGroup(nsgName, LOCATION); + boolean found = false; + for (NetworkSecurityGroup networkSecurityGroup : result) { + if (networkSecurityGroup.name().equalsIgnoreCase(original.name())) { + assertEquals(original.name(), networkSecurityGroup.name()); + assertEquals(original.location(), networkSecurityGroup.location()); + assertEquals(original.tags(), networkSecurityGroup.tags()); + + // check the network security rule in the group + assertEquals(networkSecurityGroup.properties().securityRules().size(), 1); + NetworkSecurityRule originalRule = original.properties().securityRules().get(0); + NetworkSecurityRule nsgRule = networkSecurityGroup.properties().securityRules().get(0); + assertEquals(originalRule.name(), nsgRule.name()); + assertTrue(originalRule.properties().equals(nsgRule.properties())); + found = true; + break; + } + } + + assertTrue(found, "NSG created in test was not found in subscription"); + } + + @Test(dependsOnMethods = { "listNetworkSecurityGroups", "listAllNetworkSecurityGroups", "getNetworkSecurityGroup" }, alwaysRun = true) public void deleteNetworkSecurityGroup() { URI uri = api().delete(nsgName); assertResourceDeleted(uri); diff --git a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiMockTest.java b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiMockTest.java index 4f51954415..4b06de603a 100644 --- a/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiMockTest.java +++ b/providers/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiMockTest.java @@ -16,7 +16,16 @@ */ package org.jclouds.azurecompute.arm.features; -import com.google.gson.Gson; +import static com.google.common.collect.Iterables.isEmpty; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup; import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroupProperties; import org.jclouds.azurecompute.arm.domain.NetworkSecurityRule; @@ -25,15 +34,7 @@ import org.jclouds.azurecompute.arm.domain.NetworkSecurityRuleProperties.Protoco import org.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest; import org.testng.annotations.Test; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import static com.google.common.collect.Iterables.isEmpty; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; +import com.google.gson.Gson; @Test(groups = "unit", testName = "NetworkSecurityGroupApiMockTest", singleThreaded = true) public class NetworkSecurityGroupApiMockTest extends BaseAzureComputeApiMockTest { @@ -123,6 +124,19 @@ public class NetworkSecurityGroupApiMockTest extends BaseAzureComputeApiMockTest assertTrue(result.size() > 0); } + public void listAllNetworkSecurityGroups() throws InterruptedException { + server.enqueue(jsonResponse("/networksecuritygrouplistall.json").setResponseCode(200)); + + final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); + List result = nsgApi.listAll(); + + String path = String.format("/subscriptions/%s/providers/Microsoft.Network/networkSecurityGroups?%s", subscriptionid, apiVersion); + assertSent(server, "GET", path); + + assertNotNull(result); + assertEquals(result.size(), 2); + } + public void listNetworkSecurityGroupsReturns404() throws InterruptedException { server.enqueue(response404()); diff --git a/providers/azurecompute-arm/src/test/resources/networksecuritygrouplistall.json b/providers/azurecompute-arm/src/test/resources/networksecuritygrouplistall.json new file mode 100644 index 0000000000..33c001bbba --- /dev/null +++ b/providers/azurecompute-arm/src/test/resources/networksecuritygrouplistall.json @@ -0,0 +1,252 @@ +{ + "value": [{ + "name": "testNetworkSecurityGroup", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "type": "Microsoft.Network/networkSecurityGroups", + "location": "westus", + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "028cb30d-f97f-4dbe-9fea-705da1f383ca", + "securityRules": [{ + "name": "denyallout", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/securityRules/denyallout", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "deny all out", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 4095, + "direction": "Outbound" + } + }], + "defaultSecurityRules": [{ + "name": "AllowVnetInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowVnetInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Inbound" + } + }, { + "name": "AllowAzureLoadBalancerInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowAzureLoadBalancerInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from azure load balancer", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "AzureLoadBalancer", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 65001, + "direction": "Inbound" + } + }, { + "name": "DenyAllInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/DenyAllInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all inbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Inbound" + } + }, { + "name": "AllowVnetOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowVnetOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Outbound" + } + }, { + "name": "AllowInternetOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowInternetOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to Internet", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "Internet", + "access": "Allow", + "priority": 65001, + "direction": "Outbound" + } + }, { + "name": "DenyAllOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/otherRG/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/DenyAllOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all outbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Outbound" + } + }] + } + }, + { + "name": "testNetworkSecurityGroup", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "type": "Microsoft.Network/networkSecurityGroups", + "location": "westus", + "properties": { + "provisioningState": "Succeeded", + "resourceGuid": "028cb30d-f97f-4dbe-9fea-705da1f383ca", + "securityRules": [{ + "name": "denyallout", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/securityRules/denyallout", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "deny all out", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 4095, + "direction": "Outbound" + } + }], + "defaultSecurityRules": [{ + "name": "AllowVnetInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowVnetInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Inbound" + } + }, { + "name": "AllowAzureLoadBalancerInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowAzureLoadBalancerInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow inbound traffic from azure load balancer", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "AzureLoadBalancer", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 65001, + "direction": "Inbound" + } + }, { + "name": "DenyAllInBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/DenyAllInBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all inbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Inbound" + } + }, { + "name": "AllowVnetOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowVnetOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to all VMs in VNET", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "VirtualNetwork", + "destinationAddressPrefix": "VirtualNetwork", + "access": "Allow", + "priority": 65000, + "direction": "Outbound" + } + }, { + "name": "AllowInternetOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/AllowInternetOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Allow outbound traffic from all VMs to Internet", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "Internet", + "access": "Allow", + "priority": 65001, + "direction": "Outbound" + } + }, { + "name": "DenyAllOutBound", + "id": "/subscriptions/e43b3d9c-f839-48a8-b0fb-691aee6f1e4d/resourceGroups/jims947groupjclouds/providers/Microsoft.Network/networkSecurityGroups/testNetworkSecurityGroup/defaultSecurityRules/DenyAllOutBound", + "etag": "W/\"14e288e4-5d9b-48cf-89c4-b532b59d71de\"", + "properties": { + "provisioningState": "Succeeded", + "description": "Deny all outbound traffic", + "protocol": "*", + "sourcePortRange": "*", + "destinationPortRange": "*", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Deny", + "priority": 65500, + "direction": "Outbound" + } + }] + } + }] +}