コード例 #1
0
        private void button_FetchResourceGroupList_Click(object sender, EventArgs e)
        {
            Cursor.Current            = Cursors.WaitCursor;
            Application.UseWaitCursor = true;

            var conn = GetConnection();

            if (null == conn)
            {
                Application.UseWaitCursor = false;
                return;
            }

            var hso = new HostedServiceOps(conn);
            var res = hso.GetResourceGroupList();

            if (res.HadError)
            {
                Application.UseWaitCursor = false;
                MessageBox.Show("Exception while fetching resource group list : " + res.Body,
                                "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            var pp = new JsonPrettyPrinter(new JsonPPStrategyContext());

            Output_rtb.Text = pp.PrettyPrint(res.Body);

            Application.UseWaitCursor = false;
            MessageBox.Show("Successfully connected to ARM",
                            "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
コード例 #2
0
        //*********************************************************************
        ///
        ///  <summary>
        ///
        ///  </summary>
        /// <param name="spa"></param>
        /// <param name="vmDepReqs"></param>
        ///
        //*********************************************************************

        //*** NOTE * Network

        private void ProcessSub(Models.ServiceProviderAccount spa,
                                List <Models.VmDeploymentRequest> vmDepReqs, IEnumerable <AzureResourceGroup> aRGs)
        {
            try
            {
                var servOps = new HostedServiceOps(new Connection(
                                                       spa.AccountID, spa.CertificateThumbprint,
                                                       spa.AzureADTenantId, spa.AzureADClientId, spa.AzureADClientKey));

                var rgList = servOps.FetchResourceGroupList();

                foreach (var rg in rgList)
                {
                    ProcessFoundRg(rg, spa, aRGs, servOps);
                }

                var vmOps = new VmOps(new Connection(
                                          spa.AccountID, spa.CertificateThumbprint,
                                          spa.AzureADTenantId, spa.AzureADClientId, spa.AzureADClientKey));

                var vmList = vmOps.FetchVmList();

                foreach (var vm in vmList)
                {
                    ProcessFoundVm(vm, spa, vmDepReqs);
                }

                //LogThis(EventLogEntryType.Information, "VmOp Request Submitted OK", 2, 2);
            }
            catch (Exception ex)
            {
                LogThis(ex, EventLogEntryType.Error, "CmpWapExtension.ProcessorSyncSubs.ProcessSub()", 100, 1);
            }
        }
コード例 #3
0
        //*********************************************************************
        ///
        ///  <summary>
        ///
        ///  </summary>
        ///  <param name="arg"></param>
        ///  <param name="spa"></param>
        ///  <param name="aRGs"></param>
        /// <param name="hso"></param>
        ///
        //*********************************************************************
        private void ProcessFoundRg(AzureResourceGroup arg, Models.ServiceProviderAccount spa,
                                    IEnumerable <AzureResourceGroup> aRGs, HostedServiceOps hso)
        {
            //*** Look for RG in list of aRGs, leave if found
            if (aRGs.Any(vdr => vdr.Name.Equals(arg.Name,
                                                StringComparison.InvariantCultureIgnoreCase)))
            {
                return;
            }

            //var rg = hso.GetResourceGroup(arg.Name);

            //*** RG not found, so add to RG DB table
            var utcNow = DateTime.UtcNow;

            var vdb = new Models.Container()
            {
                //ID = 0,
                Name           = arg.Name,
                Region         = arg.Location,
                SubscriptionId = spa.AccountID,
                CIOwner        = "",
                Code           = "",
                Config         = "",
                CreatedBy      = "",
                CreatedOn      = utcNow,
                HasService     = false,
                IsActive       = true,
                LastUpdatedBy  = "",
                LastUpdatedOn  =
                    utcNow,
                Path = arg.Id,
                Type = CmpInterfaceModel.Constants.ContainerTypeEnum.ResourceGroup.ToString()
            };

            _cdb.InsertAzureContainer(vdb);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: vrosnet/Phoenix
 private void CheckResourceGroupAvailability()
 {
     string agName;
     var    hso = new HostedServiceOps(GetTestConnection());
     var    res = hso.CheckResourceGroupAvailability("", 1, out agName);
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: vrosnet/Phoenix
 private void CreateArmResourceGroup()
 {
     var hso = new HostedServiceOps(GetTestConnection());
     var res = hso.CreateResourceGroup("", "westus", false);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: vrosnet/Phoenix
 private void FetchArmResourceGroup()
 {
     var hso = new HostedServiceOps(GetTestConnection());
     var res = hso.GetResourceGroup("");
 }