private static async Task <QueueProperties> ParseFromEntryElementAsync(XElement xEntry, Response response, ClientDiagnostics diagnostics) { var name = xEntry.Element(XName.Get("title", AdministrationClientConstants.AtomNamespace)).Value; var properties = new QueueProperties(name); var qdXml = xEntry.Element(XName.Get("content", AdministrationClientConstants.AtomNamespace))? .Element(XName.Get("QueueDescription", AdministrationClientConstants.ServiceBusNamespace)); if (qdXml == null) { throw new ServiceBusException( "Queue was not found", ServiceBusFailureReason.MessagingEntityNotFound, innerException: await diagnostics.CreateRequestFailedExceptionAsync(response).ConfigureAwait(false)); } foreach (var element in qdXml.Elements()) { switch (element.Name.LocalName) { case "MaxSizeInMegabytes": properties.MaxSizeInMegabytes = int.Parse(element.Value, CultureInfo.InvariantCulture); break; case "RequiresDuplicateDetection": properties.RequiresDuplicateDetection = bool.Parse(element.Value); break; case "RequiresSession": properties.RequiresSession = bool.Parse(element.Value); break; case "DeadLetteringOnMessageExpiration": properties.DeadLetteringOnMessageExpiration = bool.Parse(element.Value); break; case "DuplicateDetectionHistoryTimeWindow": properties.DuplicateDetectionHistoryTimeWindow = XmlConvert.ToTimeSpan(element.Value); break; case "LockDuration": properties.LockDuration = XmlConvert.ToTimeSpan(element.Value); break; case "DefaultMessageTimeToLive": properties.DefaultMessageTimeToLive = XmlConvert.ToTimeSpan(element.Value); break; case "MaxDeliveryCount": properties.MaxDeliveryCount = int.Parse(element.Value, CultureInfo.InvariantCulture); break; case "EnableBatchedOperations": properties.EnableBatchedOperations = bool.Parse(element.Value); break; case "Status": properties.Status = element.Value; break; case "AutoDeleteOnIdle": properties.AutoDeleteOnIdle = XmlConvert.ToTimeSpan(element.Value); break; case "EnablePartitioning": properties.EnablePartitioning = bool.Parse(element.Value); break; case "UserMetadata": properties.UserMetadata = element.Value; break; case "ForwardTo": if (!string.IsNullOrWhiteSpace(element.Value)) { properties.ForwardTo = element.Value; } break; case "ForwardDeadLetteredMessagesTo": if (!string.IsNullOrWhiteSpace(element.Value)) { properties.ForwardDeadLetteredMessagesTo = element.Value; } break; case "AuthorizationRules": properties.AuthorizationRules = AuthorizationRules.ParseFromXElement(element); break; case "AccessedAt": case "CreatedAt": case "MessageCount": case "SizeInBytes": case "UpdatedAt": case "CountDetails": // Ignore known properties // Do nothing break; default: // For unknown properties, keep them as-is for forward proof. if (properties.UnknownProperties == null) { properties.UnknownProperties = new List <object>(); } properties.UnknownProperties.Add(element); break; } } return(properties); }