public void ExecuteCommand() { var prodDeployment = GetDeploymentBySlot(DeploymentSlotType.Production); var stagingDeployment = GetDeploymentBySlot(DeploymentSlotType.Staging); if(stagingDeployment == null && prodDeployment == null) { throw new ArgumentOutOfRangeException(String.Format(Resources.NoDeploymentInStagingOrProduction, ServiceName)); } if(stagingDeployment == null && prodDeployment != null) { throw new ArgumentOutOfRangeException(String.Format(Resources.NoDeploymentInStaging, ServiceName)); } if(prodDeployment == null) { this.WriteVerbose(string.Format(Resources.MovingDeploymentFromStagingToProduction, ServiceName)); } else { this.WriteVerbose(string.Format(Resources.VIPSwapBetweenStagingAndProduction, ServiceName)); } var swapDeploymentParams = new DeploymentSwapParameters { SourceDeployment = stagingDeployment.Name, ProductionDeployment = prodDeployment == null ? null : prodDeployment.Name }; ExecuteClientActionNewSM( swapDeploymentParams, CommandRuntime.ToString(), () => this.ComputeClient.Deployments.Swap(ServiceName, swapDeploymentParams)); }
public void ExecuteCommand() { var prodDeployment = GetDeploymentBySlot(DeploymentSlotType.Production); var stagingDeployment = GetDeploymentBySlot(DeploymentSlotType.Staging); if (stagingDeployment == null && prodDeployment == null) { throw new ArgumentOutOfRangeException(String.Format(Resources.NoDeploymentInStagingOrProduction, ServiceName)); } if (stagingDeployment == null && prodDeployment != null) { throw new ArgumentOutOfRangeException(String.Format(Resources.NoDeploymentInStaging, ServiceName)); } if (prodDeployment == null) { this.WriteVerbose(string.Format(Resources.MovingDeploymentFromStagingToProduction, ServiceName)); } else { this.WriteVerbose(string.Format(Resources.VIPSwapBetweenStagingAndProduction, ServiceName)); } var swapDeploymentParams = new DeploymentSwapParameters { SourceDeployment = stagingDeployment.Name, ProductionDeployment = prodDeployment == null ? null : prodDeployment.Name }; ExecuteClientActionNewSM( swapDeploymentParams, CommandRuntime.ToString(), () => this.ComputeClient.Deployments.Swap(ServiceName, swapDeploymentParams)); }
protected PSArgument[] CreateDeploymentSwapParameters() { string serviceName = string.Empty; DeploymentSwapParameters parameters = new DeploymentSwapParameters(); return(ConvertFromObjectsToArguments(new string[] { "ServiceName", "Parameters" }, new object[] { serviceName, parameters })); }
protected void ExecuteDeploymentSwapMethod(object[] invokeMethodInputParameters) { string serviceName = (string)ParseParameter(invokeMethodInputParameters[0]); DeploymentSwapParameters parameters = (DeploymentSwapParameters)ParseParameter(invokeMethodInputParameters[1]); var result = DeploymentClient.Swap(serviceName, parameters); WriteObject(result); }
/// <summary> /// Swap deployment from/to production or testing /// </summary> /// <param name="hostedServiceName"></param> /// <param name="input"></param> public void SwapDeployment(string hostedServiceName, DeploymentSwapParameters input) { ComputeManagementClient.Deployments.SwapAsync(hostedServiceName, input, new CancellationToken()).Wait(); }