BlobStaticWebsite
The properties that enable an account to host a static website.
using Azure.Core;
using Azure.Storage.Common;
using System.Xml;
using System.Xml.Linq;
namespace Azure.Storage.Blobs.Models
{
[CodeGenModel("StaticWebsite")]
public class BlobStaticWebsite : IXmlSerializable
{
public bool Enabled { get; set; }
public string IndexDocument { get; set; }
public string ErrorDocument404Path { get; set; }
public string DefaultIndexDocumentPath { get; set; }
internal BlobStaticWebsite(bool enabled, string indexDocument, string errorDocument404Path, string defaultIndexDocumentPath)
{
Enabled = enabled;
IndexDocument = indexDocument;
ErrorDocument404Path = errorDocument404Path;
DefaultIndexDocumentPath = defaultIndexDocumentPath;
}
void IXmlSerializable.Write(XmlWriter writer, string nameHint)
{
writer.WriteStartElement(nameHint ?? "StaticWebsite");
writer.WriteStartElement("Enabled");
writer.WriteValue(Enabled);
writer.WriteEndElement();
if (Optional.IsDefined(IndexDocument)) {
writer.WriteStartElement("IndexDocument");
writer.WriteValue(IndexDocument);
writer.WriteEndElement();
}
if (Optional.IsDefined(ErrorDocument404Path)) {
writer.WriteStartElement("ErrorDocument404Path");
writer.WriteValue(ErrorDocument404Path);
writer.WriteEndElement();
}
if (Optional.IsDefined(DefaultIndexDocumentPath)) {
writer.WriteStartElement("DefaultIndexDocumentPath");
writer.WriteValue(DefaultIndexDocumentPath);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
internal static BlobStaticWebsite DeserializeBlobStaticWebsite(XElement element)
{
bool enabled = false;
string indexDocument = null;
string errorDocument404Path = null;
string defaultIndexDocumentPath = null;
XElement xElement = element.Element("Enabled");
if (xElement != null)
enabled = (bool)xElement;
XElement xElement2 = element.Element("IndexDocument");
if (xElement2 != null)
indexDocument = (string)xElement2;
XElement xElement3 = element.Element("ErrorDocument404Path");
if (xElement3 != null)
errorDocument404Path = (string)xElement3;
XElement xElement4 = element.Element("DefaultIndexDocumentPath");
if (xElement4 != null)
defaultIndexDocumentPath = (string)xElement4;
return new BlobStaticWebsite(enabled, indexDocument, errorDocument404Path, defaultIndexDocumentPath);
}
public BlobStaticWebsite()
{
}
internal BlobStaticWebsite(bool enabled)
{
Enabled = enabled;
}
}
}