protected override Operation DeserializeResponse(AzureManagementResponse response) { var result = new Operation(); var xml = response.Body; var operationElement = xml.Root; result.RequestId = (string)operationElement.Element(WindowsAzureNamespace + "ID"); var status = (string)operationElement.Element(WindowsAzureNamespace + "Status"); if (string.Equals(status, "Succeeded", StringComparison.OrdinalIgnoreCase)) { result.Status = OperationStatus.Succeeded; } else if (string.Equals(status, "Failed", StringComparison.OrdinalIgnoreCase)) { result.Status = OperationStatus.Failed; } else { result.Status = OperationStatus.InProgress; } var errorElement = operationElement.Element(WindowsAzureNamespace + "Error"); if (errorElement != null) { result.ErrorCode = (string)errorElement.Element(WindowsAzureNamespace + "Code"); result.ErrorMessage = (string)errorElement.Element(WindowsAzureNamespace + "Message"); } return(result); }
protected override HostedServices DeserializeResponse(AzureManagementResponse response) { var result = new HostedServices(); var xml = response.Body; foreach (var hostedServiceElement in xml.Root.Elements(WindowsAzureNamespace + "HostedService")) { var hostedService = new HostedService() { ServiceName = (string)hostedServiceElement.Element(WindowsAzureNamespace + "ServiceName"), Url = (string)hostedServiceElement.Element(WindowsAzureNamespace + "Url"), Status = (string)hostedServiceElement.Element(WindowsAzureNamespace + "HostedServiceProperties") .Element(WindowsAzureNamespace + "Status") }; result.Services.Add(hostedService); } return(result); }
protected override Deployment DeserializeResponse(AzureManagementResponse response) { var xml = response.Body; var result = new Deployment() { Name = (string)xml.Root.Element(WindowsAzureNamespace + "Name"), DeploymentSlot = (string)xml.Root.Element(WindowsAzureNamespace + "DeploymentSlot"), Url = (string)xml.Root.Element(WindowsAzureNamespace + "Url"), Status = (string)xml.Root.Element(WindowsAzureNamespace + "Status"), PrivateId = (string)xml.Root.Element(WindowsAzureNamespace + "PrivateID") }; foreach (var roleElement in xml.Root.Element(WindowsAzureNamespace + "RoleList").Elements(WindowsAzureNamespace + "Role")) { result.RoleList.Add(this.DeserializeRole(roleElement)); } foreach (var roleInstanceElement in xml.Root.Element(WindowsAzureNamespace + "RoleInstanceList").Elements(WindowsAzureNamespace + "RoleInstance")) { result.RoleInstanceList.Add(this.DeserializeRoleInstance(roleInstanceElement)); } return(result); }
protected override string DeserializeResponse(AzureManagementResponse response) { return(response.Headers.GetHeaderValue(AzureManagementHeaders.RequestId)); }
protected abstract TResponse DeserializeResponse(AzureManagementResponse response);