예제 #1
0
파일: Subnet.cs 프로젝트: jasond2014/migAz
        public Subnet(AzureContext azureContext, MigrationTarget.VirtualNetwork parentVirtualNetwork, ISubnet source, List <NetworkSecurityGroup> networkSecurityGroups)
        {
            _AzureContext         = azureContext;
            _ParentVirtualNetwork = parentVirtualNetwork;
            _SourceSubnet         = source;

            if (source.GetType() == typeof(Asm.Subnet))
            {
                Asm.Subnet asmSubnet = (Asm.Subnet)source;

                if (asmSubnet.NetworkSecurityGroup != null)
                {
                    this.NetworkSecurityGroup = SeekNetworkSecurityGroup(networkSecurityGroups, asmSubnet.NetworkSecurityGroup.ToString());
                }

                if (asmSubnet.RouteTable != null)
                {
                    this.RouteTable = new RouteTable(azureContext, asmSubnet.RouteTable);
                }

                this.AddressPrefix = asmSubnet.AddressPrefix;
            }
            else if (source.GetType() == typeof(Arm.Subnet))
            {
                Arm.Subnet armSubnet = (Arm.Subnet)source;

                if (armSubnet.NetworkSecurityGroup != null)
                {
                    this.NetworkSecurityGroup = SeekNetworkSecurityGroup(networkSecurityGroups, armSubnet.NetworkSecurityGroup.ToString());
                }

                if (armSubnet.RouteTable != null)
                {
                    this.RouteTable = new RouteTable(azureContext, armSubnet.RouteTable);
                }

                this.AddressPrefix = armSubnet.AddressPrefix;
            }

            this.TargetName = source.Name;
        }
예제 #2
0
        public Subnet(MigrationTarget.VirtualNetwork parentVirtualNetwork, ISubnet source, List <NetworkSecurityGroup> networkSecurityGroups, List <RouteTable> routeTables, TargetSettings targetSettings, ILogProvider logProvider) : base(String.Empty, String.Empty, logProvider)
        {
            _ParentVirtualNetwork = parentVirtualNetwork;
            _SourceSubnet         = source;

            if (source.GetType() == typeof(Asm.Subnet))
            {
                Asm.Subnet asmSubnet = (Asm.Subnet)source;

                if (asmSubnet.NetworkSecurityGroup != null)
                {
                    this.NetworkSecurityGroup = SeekNetworkSecurityGroup(networkSecurityGroups, asmSubnet.NetworkSecurityGroup.ToString());
                }

                if (asmSubnet.RouteTable != null)
                {
                    this.RouteTable = SeekRouteTable(routeTables, asmSubnet.RouteTable.ToString());
                }
            }
            else if (source.GetType() == typeof(Arm.Subnet))
            {
                Arm.Subnet armSubnet = (Arm.Subnet)source;

                if (armSubnet.NetworkSecurityGroup != null)
                {
                    this.NetworkSecurityGroup = SeekNetworkSecurityGroup(networkSecurityGroups, armSubnet.NetworkSecurityGroup.ToString());
                }

                if (armSubnet.RouteTable != null)
                {
                    this.RouteTable = SeekRouteTable(routeTables, armSubnet.RouteTable.ToString());
                }
            }

            this.AddressPrefix = source.AddressPrefix;
            this.SetTargetName(source.Name, targetSettings);
        }