Exemplo n.º 1
0
        public VirtualNetwork(Asm.VirtualNetwork virtualNetwork, List <NetworkSecurityGroup> networkSecurityGroups, List <RouteTable> routeTables, TargetSettings targetSettings) : base(ArmConst.MicrosoftNetwork, ArmConst.VirtualNetworks)
        {
            this.SourceVirtualNetwork = virtualNetwork;
            this.SetTargetName(virtualNetwork.Name, targetSettings);

            if (virtualNetwork.Gateways2 != null)
            {
                foreach (Asm.VirtualNetworkGateway virtualNetworkGateway in virtualNetwork.Gateways2)
                {
                    TargetVirtualNetworkGateways.Add(new VirtualNetworkGateway(virtualNetworkGateway, targetSettings));
                }
            }

            foreach (Asm.Subnet subnet in virtualNetwork.Subnets)
            {
                this.TargetSubnets.Add(new Subnet(this, subnet, networkSecurityGroups, routeTables, targetSettings));
            }

            foreach (String addressPrefix in virtualNetwork.AddressPrefixes)
            {
                this.AddressPrefixes.Add(addressPrefix);
            }

            foreach (String dnsServer in virtualNetwork.DnsServers)
            {
                this.DnsServers.Add(dnsServer);
            }
        }
Exemplo n.º 2
0
        public VirtualNetwork(AzureContext azureContext, Asm.VirtualNetwork virtualNetwork, List <NetworkSecurityGroup> networkSecurityGroups, List <RouteTable> routeTables)
        {
            this._AzureContext        = azureContext;
            this.SourceVirtualNetwork = virtualNetwork;
            this.TargetName           = virtualNetwork.Name;

            if (virtualNetwork.Gateways2 != null)
            {
                foreach (Asm.VirtualNetworkGateway virtualNetworkGateway in virtualNetwork.Gateways2)
                {
                    TargetVirtualNetworkGateways.Add(new VirtualNetworkGateway(_AzureContext, virtualNetworkGateway));
                }
            }

            foreach (Asm.Subnet subnet in virtualNetwork.Subnets)
            {
                this.TargetSubnets.Add(new Subnet(azureContext, this, subnet, networkSecurityGroups, routeTables));
            }

            foreach (String addressPrefix in virtualNetwork.AddressPrefixes)
            {
                this.AddressPrefixes.Add(addressPrefix);
            }

            foreach (String dnsServer in virtualNetwork.DnsServers)
            {
                this.DnsServers.Add(dnsServer);
            }
        }