mirror of https://github.com/apache/jclouds.git
Implements listAll method in NetworkSecurityGroupApi (#31)
* Implements listAll method in NetworkSecurityGroupApi * Adds Mock and Live tests for new method
This commit is contained in:
parent
f2e955dadf
commit
e0be4d7b27
|
@ -172,7 +172,7 @@ public interface AzureComputeApi extends Closeable {
|
||||||
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163615.aspx">docs</a>
|
* @see <a href="https://msdn.microsoft.com/en-us/library/azure/mt163615.aspx">docs</a>
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@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.
|
* The NetworkSecurityRule API includes operations for managing network security rules within a network security group.
|
||||||
|
|
|
@ -109,12 +109,8 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<SecurityGroup> securityGroupsInLocations(final Set<String> locations) {
|
private Set<SecurityGroup> securityGroupsInLocations(final Set<String> locations) {
|
||||||
List<SecurityGroup> securityGroups = new ArrayList<SecurityGroup>();
|
final ImmutableSet<SecurityGroup> allSecurityGroups = ImmutableSet.copyOf(transform(filter(api.getNetworkSecurityGroupApi(null).listAll(), notNull()), securityGroupConverter));
|
||||||
for (ResourceGroup rg : api.getResourceGroupApi().list()) {
|
return ImmutableSet.copyOf(filter(allSecurityGroups, new Predicate<SecurityGroup>() {
|
||||||
securityGroups.addAll(securityGroupsInResourceGroup(rg.name()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ImmutableSet.copyOf(filter(securityGroups, new Predicate<SecurityGroup>() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(SecurityGroup input) {
|
public boolean apply(SecurityGroup input) {
|
||||||
return input.getLocation() != null && locations.contains(input.getLocation().getId());
|
return input.getLocation() != null && locations.contains(input.getLocation().getId());
|
||||||
|
@ -122,11 +118,6 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<SecurityGroup> securityGroupsInResourceGroup(String resourceGroup) {
|
|
||||||
List<NetworkSecurityGroup> networkGroups = api.getNetworkSecurityGroupApi(resourceGroup).list();
|
|
||||||
return ImmutableSet.copyOf(transform(filter(networkGroups, notNull()), securityGroupConverter));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SecurityGroup> listSecurityGroupsForNode(String nodeId) {
|
public Set<SecurityGroup> listSecurityGroupsForNode(String nodeId) {
|
||||||
logger.debug(">> getting security groups for node %s...", nodeId);
|
logger.debug(">> getting security groups for node %s...", nodeId);
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.jclouds.azurecompute.arm.features;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DELETE;
|
import javax.ws.rs.DELETE;
|
||||||
|
@ -29,6 +28,7 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks;
|
||||||
import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
|
import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroup;
|
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.annotations.SelectJson;
|
||||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
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 <a href="https://docs.microsoft.com/en-us/rest/api/virtualnetwork/networksecuritygroups">docs</a>
|
||||||
|
*/
|
||||||
@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
|
@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public interface NetworkSecurityGroupApi {
|
public interface NetworkSecurityGroupApi {
|
||||||
|
|
||||||
@Named("networksecuritygroup:list")
|
@Named("networksecuritygroup:list")
|
||||||
|
@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups")
|
||||||
@GET
|
@GET
|
||||||
@SelectJson("value")
|
@SelectJson("value")
|
||||||
@Fallback(EmptyListOnNotFoundOr404.class)
|
@Fallback(EmptyListOnNotFoundOr404.class)
|
||||||
List<NetworkSecurityGroup> list();
|
List<NetworkSecurityGroup> list();
|
||||||
|
|
||||||
|
@Named("networksecuritygroup:listall")
|
||||||
|
@GET
|
||||||
|
@Path("/providers/Microsoft.Network/networkSecurityGroups")
|
||||||
|
@SelectJson("value")
|
||||||
|
@Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
|
||||||
|
List<NetworkSecurityGroup> listAll();
|
||||||
|
|
||||||
@Named("networksecuritygroup:delete")
|
@Named("networksecuritygroup:delete")
|
||||||
@Path("/{networksecuritygroupname}")
|
@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}")
|
||||||
@DELETE
|
@DELETE
|
||||||
@ResponseParser(URIParser.class)
|
@ResponseParser(URIParser.class)
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
URI delete(@PathParam("networksecuritygroupname") String nsgName);
|
URI delete(@PathParam("networksecuritygroupname") String nsgName);
|
||||||
|
|
||||||
@Named("networksecuritygroup:createOrUpdate")
|
@Named("networksecuritygroup:createOrUpdate")
|
||||||
@Path("/{networksecuritygroupname}")
|
@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}")
|
||||||
@PUT
|
@PUT
|
||||||
@MapBinder(BindToJsonPayload.class)
|
@MapBinder(BindToJsonPayload.class)
|
||||||
NetworkSecurityGroup createOrUpdate(@PathParam("networksecuritygroupname") String nsgName,
|
NetworkSecurityGroup createOrUpdate(@PathParam("networksecuritygroupname") String nsgName,
|
||||||
|
@ -72,8 +84,9 @@ public interface NetworkSecurityGroupApi {
|
||||||
@PayloadParam("properties") NetworkSecurityGroupProperties properties);
|
@PayloadParam("properties") NetworkSecurityGroupProperties properties);
|
||||||
|
|
||||||
@Named("networksecuritygroup:get")
|
@Named("networksecuritygroup:get")
|
||||||
@Path("/{networksecuritygroupname}")
|
@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroupname}")
|
||||||
@GET
|
@GET
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
NetworkSecurityGroup get(@PathParam("networksecuritygroupname") String nsgName);
|
NetworkSecurityGroup get(@PathParam("networksecuritygroupname") String nsgName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class NetworkSecurityGroupApiLiveTest extends BaseAzureComputeApiLiveTest
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(result.size(), 1);
|
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 original = newNetworkSecurityGroup(nsgName, LOCATION);
|
||||||
NetworkSecurityGroup nsg = result.get(0);
|
NetworkSecurityGroup nsg = result.get(0);
|
||||||
assertEquals(original.name(), nsg.name());
|
assertEquals(original.name(), nsg.name());
|
||||||
|
@ -84,7 +84,37 @@ public class NetworkSecurityGroupApiLiveTest extends BaseAzureComputeApiLiveTest
|
||||||
assertTrue(originalRule.properties().equals(nsgRule.properties()));
|
assertTrue(originalRule.properties().equals(nsgRule.properties()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = {"listNetworkSecurityGroups", "getNetworkSecurityGroup"}, alwaysRun = true)
|
@Test(dependsOnMethods = "createNetworkSecurityGroup")
|
||||||
|
public void listAllNetworkSecurityGroups() {
|
||||||
|
List<NetworkSecurityGroup> 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() {
|
public void deleteNetworkSecurityGroup() {
|
||||||
URI uri = api().delete(nsgName);
|
URI uri = api().delete(nsgName);
|
||||||
assertResourceDeleted(uri);
|
assertResourceDeleted(uri);
|
||||||
|
|
|
@ -16,7 +16,16 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.azurecompute.arm.features;
|
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.NetworkSecurityGroup;
|
||||||
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroupProperties;
|
import org.jclouds.azurecompute.arm.domain.NetworkSecurityGroupProperties;
|
||||||
import org.jclouds.azurecompute.arm.domain.NetworkSecurityRule;
|
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.jclouds.azurecompute.arm.internal.BaseAzureComputeApiMockTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.net.URI;
|
import com.google.gson.Gson;
|
||||||
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;
|
|
||||||
|
|
||||||
@Test(groups = "unit", testName = "NetworkSecurityGroupApiMockTest", singleThreaded = true)
|
@Test(groups = "unit", testName = "NetworkSecurityGroupApiMockTest", singleThreaded = true)
|
||||||
public class NetworkSecurityGroupApiMockTest extends BaseAzureComputeApiMockTest {
|
public class NetworkSecurityGroupApiMockTest extends BaseAzureComputeApiMockTest {
|
||||||
|
@ -123,6 +124,19 @@ public class NetworkSecurityGroupApiMockTest extends BaseAzureComputeApiMockTest
|
||||||
assertTrue(result.size() > 0);
|
assertTrue(result.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void listAllNetworkSecurityGroups() throws InterruptedException {
|
||||||
|
server.enqueue(jsonResponse("/networksecuritygrouplistall.json").setResponseCode(200));
|
||||||
|
|
||||||
|
final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup);
|
||||||
|
List<NetworkSecurityGroup> 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 {
|
public void listNetworkSecurityGroupsReturns404() throws InterruptedException {
|
||||||
server.enqueue(response404());
|
server.enqueue(response404());
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
Loading…
Reference in New Issue