public string UpdateDeploymentStatus(string serviceName, string deploymentSlot, DeploymentStatus status) { var deploymentStatus = new UpdateDeploymentStatusInput { Status = status.ToString() }; var formatter = new XmlMediaTypeFormatter(); formatter.SetSerializer <UpdateDeploymentStatusInput>(new DataContractSerializer(typeof(UpdateDeploymentStatusInput))); using (var content = new ObjectContent <UpdateDeploymentStatusInput>(deploymentStatus, "application/xml", new[] { formatter })) { var requestUri = string.Format("services/hostedservices/{0}/deploymentslots/{1}/?comp=status", serviceName, deploymentSlot); var response = this.client.Post(requestUri, content); if (!response.IsSuccessStatusCode) { var errorDetails = GetErrorDetails(response); throw new InvalidOperationException(errorDetails.Message); } return(response.Headers.GetValues(Constants.OperationTrackingIdHeader).FirstOrDefault()); } }
public static string ToDisplayString(this DeploymentStatus status) { switch (status) { case DeploymentStatus.Success: case DeploymentStatus.Fixed: return("Successful"); case DeploymentStatus.TimedOut: case DeploymentStatus.TimedOutNew: return("Timed Out"); case DeploymentStatus.FailedNew: return("Failed"); case DeploymentStatus.ManualStep: return("at a Manual Step"); case DeploymentStatus.GuidedFailure: return("in Guided Failure Mode"); default: return(status.ToString()); } }
public DeviceDeploymentStatusServiceModel(string deviceId, DeploymentStatus deploymentStatus, Dictionary <string, JValue> reportedProperties) { this.Name = deviceId; this.DeploymentStatus = deploymentStatus.ToString(); this.Firmware = reportedProperties.ContainsKey("firmware.currentFwVersion") ? reportedProperties["firmware.currentFwVersion"].Value <string>() : string.Empty; this.Start = reportedProperties.ContainsKey("firmware.lastFwUpdateStartTime") ? DateTimeHelper.FormatDate(reportedProperties["firmware.lastFwUpdateStartTime"], DateFormat) : string.Empty; this.End = reportedProperties.ContainsKey("firmware.lastFwUpdateEndTime") ? DateTimeHelper.FormatDate(reportedProperties["firmware.lastFwUpdateEndTime"], DateFormat) : string.Empty; }