コード例 #1
0
        public void DeleteDeploymentTest()
        {
            DeploymentHelper target = new DeploymentHelper();

            string subscriptionId = "e57cc5fa-5cf7-41c0-a33c-3adaf2944c4a";

            string filePath = @"C:\Development\Certificates\AzureManagementCertificate.cer";

            List<Byte> certificateBytes = CertificateUtility.GetCertificateBytes(filePath);

            string serviceName = "commandlinetest";

            string deploymentSlot = "staging";

            string expected = string.Empty; 
            string actual;

            actual = target.DeleteDeployment(subscriptionId, certificateBytes, serviceName, deploymentSlot);

            string opsStatus = string.Empty;

            string status = "InProgress";

            while (status == "InProgress")
            {
                opsStatus = target.GetOperationStatus(subscriptionId, certificateBytes, actual, out status);

                Trace.WriteLine("Ops Status = " + status);

                Thread.Sleep(2000);
            }

            
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        // DELETE /api/deployment
        public string Delete(AzureDeployment azureDeployment)
        {
            string requestId = string.Empty;

            try
            {
                DeploymentHelper deploymentHelper = new DeploymentHelper();

                requestId = deploymentHelper.DeleteDeployment(azureDeployment.SubscriptionId, 
                                                              azureDeployment.CertificateBytes, 
                                                              azureDeployment.ServiceName, 
                                                              azureDeployment.DeploymentSlot);
            }
            catch (WebException wex)
            {
                string responseString = string.Empty;

                using (StreamReader responseReader = new StreamReader(wex.Response.GetResponseStream()))
                {
                    responseString = responseReader.ReadToEnd();

                    if (string.IsNullOrWhiteSpace(responseString) != true)
                    {
                        Logger.Write("DeploymentController.Delete() WebException Response: " + responseString);
                    }

                    responseReader.Close();
                }

                Logger.Write(string.Format("Error in DeploymentController.Delete()  Error: {0}\n{1}", wex.Message,
                                            wex.InnerException != null ? wex.InnerException.Message : string.Empty));

                requestId = string.Empty;

                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }
            catch (Exception ex)
            {
                Logger.Write(string.Format("Error in DeploymentController.Post()  Error: {0}\n{1}", ex.Message,
                                            ex.InnerException != null ? ex.InnerException.Message : string.Empty));

                requestId = string.Empty;

                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            return requestId;
        }