コード例 #1
0
        private void cboTargetLocation_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cmbSender = (ComboBox)sender;

            ArmResourceGroup armResourceGroup = (ArmResourceGroup)_ResourceGroupNode.Tag;

            armResourceGroup.Location = (ILocation)cmbSender.SelectedItem;
        }
コード例 #2
0
ファイル: TestHelper.cs プロジェクト: ChinnasamyM/migAz
        internal static async Task <ArmResourceGroup> GetTargetResourceGroup(AzureContext azureContext)
        {
            List <AsmLocation> azureLocations = await azureContext.AzureRetriever.GetAzureASMLocations();

            ArmResourceGroup targetResourceGroup = new ArmResourceGroup(azureContext, "Target Resource Group");

            targetResourceGroup.Location = azureLocations[0];
            return(targetResourceGroup);
        }
コード例 #3
0
        private void txtName_TextChanged(object sender, EventArgs e)
        {
            TextBox txtSender = (TextBox)sender;

            ArmResourceGroup armResourceGroup = (ArmResourceGroup)_ResourceGroupNode.Tag;

            armResourceGroup.Name   = txtSender.Text;
            _ResourceGroupNode.Text = armResourceGroup.GetFinalTargetName();
            _ResourceGroupNode.Name = armResourceGroup.Name;
        }
コード例 #4
0
        internal async Task Bind(AsmToArmForm parentForm, TreeNode resourceGroupNode)
        {
            _ParentForm        = parentForm;
            _ResourceGroupNode = resourceGroupNode;

            ArmResourceGroup armResourceGroup = (ArmResourceGroup)_ResourceGroupNode.Tag;

            txtName.Text = armResourceGroup.Name;

            try
            {
                cboTargetLocation.Items.Clear();
                foreach (ArmLocation armLocation in await _ParentForm.AzureContextTargetARM.AzureRetriever.GetAzureARMLocations())
                {
                    cboTargetLocation.Items.Add(armLocation);
                }
            }
            catch (WebException)
            {
                // We are trying to load the ARM defined subscription locations above first; however, this as of Feb 24 2017, this ARM query
                // does not succeed (503 Forbidden) across all Azure Environments.  For example, it works in Azure Commercial, but Azure US Gov
                // is not yet update to support this call.  In the event the ARM location query fails, we will default to using ASM Location query.

                cboTargetLocation.Items.Clear();
                foreach (AsmLocation asmLocation in await _ParentForm.AzureContextTargetARM.AzureRetriever.GetAzureASMLocations())
                {
                    cboTargetLocation.Items.Add(asmLocation);
                }
            }

            if (armResourceGroup.Location != null)
            {
                foreach (ArmLocation armLocation in cboTargetLocation.Items)
                {
                    if (armLocation.Name == armResourceGroup.Location.Name)
                    {
                        cboTargetLocation.SelectedItem = armLocation;
                    }
                }
            }
        }
コード例 #5
0
 public TemplateResult(ISubscription sourceSubscription, ISubscription targetSubscription, ArmResourceGroup targetResourceGroup, ILogProvider logProvider, string outputPath)
 {
     _SourceSubscription  = sourceSubscription;
     _TargetSubscription  = targetSubscription;
     _TargetResourceGroup = targetResourceGroup;
     _OutputPath          = outputPath;
     _logProvider         = logProvider;
 }
コード例 #6
0
ファイル: AsmToArmForm.cs プロジェクト: ChinnasamyM/migAz
        private bool RecursiveHealthCheckNode(TreeNode treeNode)
        {
            if (treeNode.Tag != null)
            {
                if (treeNode.Tag.GetType() == typeof(ArmResourceGroup))
                {
                    ArmResourceGroup armResourceGroup = (ArmResourceGroup)treeNode.Tag;

                    if (armResourceGroup.Location == null)
                    {
                        treeARM.SelectedNode = treeNode;
                        this.Refresh();
                        MessageBox.Show("Target Location must be selected before exporting.");
                        return(false);
                    }
                }
                else if (treeNode.Tag.GetType() == typeof(TreeNode)) // Tag is the sourced ASM TreeNode
                {
                    TreeNode asmTreeNode = (TreeNode)treeNode.Tag;

                    if (asmTreeNode.Tag != null)
                    {
                        if (asmTreeNode.Tag.GetType() == typeof(AsmNetworkSecurityGroup))
                        {
                            AsmNetworkSecurityGroup asmNetworkSecurityGroup = (AsmNetworkSecurityGroup)asmTreeNode.Tag;

                            // Validate the Target Name is not blank
                            if (asmNetworkSecurityGroup.TargetName == String.Empty)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Name must be selected before exporting.");
                                return(false);
                            }
                        }
                        else if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualNetwork))
                        {
                            AsmVirtualNetwork asmVirtualNetwork = (AsmVirtualNetwork)asmTreeNode.Tag;

                            // Validate the Target Name is not blank
                            if (asmVirtualNetwork.TargetName == String.Empty)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Name must be selected before exporting.");
                                return(false);
                            }

                            foreach (TreeNode virtualNetworkNode in treeNode.Parent.Nodes)
                            {
                                TreeNode          asmVirtualNetworkNode    = (TreeNode)virtualNetworkNode.Tag;
                                AsmVirtualNetwork asmVirtualNetworkCompare = (AsmVirtualNetwork)asmVirtualNetworkNode.Tag;

                                if (asmVirtualNetworkCompare.Name != asmVirtualNetwork.Name && asmVirtualNetworkCompare.TargetName == asmVirtualNetwork.TargetName)
                                {
                                    treeARM.SelectedNode = treeNode;
                                    this.Refresh();
                                    MessageBox.Show("Target Names must be unique to migrate Virtual Networks.");
                                    return(false);
                                }
                            }
                        }
                        else if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualMachine))
                        {
                            AsmVirtualMachine asmVirtualMachine = (AsmVirtualMachine)asmTreeNode.Tag;

                            if (asmVirtualMachine.TargetName == String.Empty)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Name for Virtual Machine must be specified.");
                                return(false);
                            }

                            if (asmVirtualMachine.TargetAvailabilitySet == null)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Availability Set for Virtual Machine must be specified.");
                                return(false);
                            }

                            if (asmVirtualMachine.TargetVirtualNetwork == null)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Virtual Network for Virtual Machine must be specified.");
                                return(false);
                            }

                            if (asmVirtualMachine.TargetSubnet == null)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Subnet for Virtual Machine must be specified.");
                                return(false);
                            }

                            if (asmVirtualMachine.OSVirtualHardDisk.TargetStorageAccount == null)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target VM OS Disk Storage Account must be specified.");
                                return(false);
                            }
                        }
                        else if (asmTreeNode.Tag.GetType() == typeof(AsmStorageAccount))
                        {
                            AsmStorageAccount asmStorageAccount = (AsmStorageAccount)asmTreeNode.Tag;
                            if (asmStorageAccount.TargetName == String.Empty)
                            {
                                treeARM.SelectedNode = treeNode;
                                this.Refresh();
                                MessageBox.Show("Target Storage Account Name must be specified.");
                                return(false);
                            }
                        }
                    }
                }
                else if (treeNode.Tag.GetType() == typeof(AsmSubnet))
                {
                    AsmSubnet asmSubnet = (AsmSubnet)treeNode.Tag;
                    if (asmSubnet.TargetName == String.Empty)
                    {
                        treeARM.SelectedNode = treeNode;
                        this.Refresh();
                        MessageBox.Show("Target Subnet Name must be specified.");
                        return(false);
                    }
                }
                else if (treeNode.Tag.GetType() == typeof(ArmAvailabilitySet))
                {
                    ArmAvailabilitySet armAvailabilitySet = (ArmAvailabilitySet)treeNode.Tag;
                    if (armAvailabilitySet.TargetName == String.Empty)
                    {
                        treeARM.SelectedNode = treeNode;
                        this.Refresh();
                        MessageBox.Show("Target Availability Set Name must be specified.");
                        return(false);
                    }
                }
                else if (treeNode.Tag.GetType() == typeof(AsmDisk))
                {
                    AsmDisk asmDisk = (AsmDisk)treeNode.Tag;

                    if (asmDisk.TargetStorageAccount == null)
                    {
                        treeARM.SelectedNode = treeNode;
                        this.Refresh();
                        MessageBox.Show("Target VM Data Disk Storage Account must be specified.");
                        return(false);
                    }
                }
            }

            foreach (TreeNode childNode in treeNode.Nodes)
            {
                bool nodeResult = RecursiveHealthCheckNode(childNode);
                if (nodeResult == false)
                {
                    return(false);
                }
            }

            return(true);
        }