Пример #1
0
        internal void Bind(Subnet targetSubnet, TargetTreeView targetTreeView)
        {
            try
            {
                this.IsBinding  = true;
                _TargetTreeView = targetTreeView;
                _Subnet         = targetSubnet;

                txtTargetName.Text   = targetSubnet.TargetName;
                txtAddressSpace.Text = targetSubnet.AddressPrefix;

                if (targetSubnet.SourceSubnet != null)
                {
                    if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Asm.Subnet))
                    {
                        Asm.Subnet asmSubnet = (Asm.Subnet)targetSubnet.SourceSubnet;

                        lblSourceName.Text   = asmSubnet.Name;
                        lblAddressSpace.Text = asmSubnet.AddressPrefix;
                    }
                    else if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Arm.Subnet))
                    {
                        Arm.Subnet armSubnet = (Arm.Subnet)targetSubnet.SourceSubnet;

                        lblSourceName.Text   = armSubnet.Name;
                        lblAddressSpace.Text = armSubnet.AddressPrefix;
                    }
                }

                if (String.Compare(txtTargetName.Text, Core.ArmTemplate.ArmConst.GatewaySubnetName, true) == 0)
                {
                    // if gateway subnet, the name can't be changed
                    txtTargetName.Enabled = false;
                }

                networkSecurityGroup.Bind(_Subnet.NetworkSecurityGroup, _TargetTreeView);
                routeTable.Bind(_Subnet.RouteTable, _TargetTreeView);
            }
            finally
            {
                this.IsBinding = false;
            }
        }
Пример #2
0
        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;
        }
Пример #3
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);
        }