All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.storage.blob.models.BlobAnalyticsLogging Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.blob.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.xml.XmlReader;
import com.azure.xml.XmlSerializable;
import com.azure.xml.XmlToken;
import com.azure.xml.XmlWriter;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;

/**
 * Azure Analytics Logging settings.
 */
@Fluent
public final class BlobAnalyticsLogging implements XmlSerializable {
    /*
     * The version of Storage Analytics to configure.
     */
    private String version;

    /*
     * Indicates whether all delete requests should be logged.
     */
    private boolean delete;

    /*
     * Indicates whether all read requests should be logged.
     */
    private boolean read;

    /*
     * Indicates whether all write requests should be logged.
     */
    private boolean write;

    /*
     * the retention policy which determines how long the associated data should persist
     */
    private BlobRetentionPolicy retentionPolicy;

    /**
     * Creates an instance of BlobAnalyticsLogging class.
     */
    public BlobAnalyticsLogging() {
    }

    /**
     * Get the version property: The version of Storage Analytics to configure.
     * 
     * @return the version value.
     */
    public String getVersion() {
        return this.version;
    }

    /**
     * Set the version property: The version of Storage Analytics to configure.
     * 
     * @param version the version value to set.
     * @return the BlobAnalyticsLogging object itself.
     */
    public BlobAnalyticsLogging setVersion(String version) {
        this.version = version;
        return this;
    }

    /**
     * Get the delete property: Indicates whether all delete requests should be logged.
     * 
     * @return the delete value.
     */
    public boolean isDelete() {
        return this.delete;
    }

    /**
     * Set the delete property: Indicates whether all delete requests should be logged.
     * 
     * @param delete the delete value to set.
     * @return the BlobAnalyticsLogging object itself.
     */
    public BlobAnalyticsLogging setDelete(boolean delete) {
        this.delete = delete;
        return this;
    }

    /**
     * Get the read property: Indicates whether all read requests should be logged.
     * 
     * @return the read value.
     */
    public boolean isRead() {
        return this.read;
    }

    /**
     * Set the read property: Indicates whether all read requests should be logged.
     * 
     * @param read the read value to set.
     * @return the BlobAnalyticsLogging object itself.
     */
    public BlobAnalyticsLogging setRead(boolean read) {
        this.read = read;
        return this;
    }

    /**
     * Get the write property: Indicates whether all write requests should be logged.
     * 
     * @return the write value.
     */
    public boolean isWrite() {
        return this.write;
    }

    /**
     * Set the write property: Indicates whether all write requests should be logged.
     * 
     * @param write the write value to set.
     * @return the BlobAnalyticsLogging object itself.
     */
    public BlobAnalyticsLogging setWrite(boolean write) {
        this.write = write;
        return this;
    }

    /**
     * Get the retentionPolicy property: the retention policy which determines how long the associated data should
     * persist.
     * 
     * @return the retentionPolicy value.
     */
    public BlobRetentionPolicy getRetentionPolicy() {
        return this.retentionPolicy;
    }

    /**
     * Set the retentionPolicy property: the retention policy which determines how long the associated data should
     * persist.
     * 
     * @param retentionPolicy the retentionPolicy value to set.
     * @return the BlobAnalyticsLogging object itself.
     */
    public BlobAnalyticsLogging setRetentionPolicy(BlobRetentionPolicy retentionPolicy) {
        this.retentionPolicy = retentionPolicy;
        return this;
    }

    @Override
    public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException {
        return toXml(xmlWriter, null);
    }

    @Override
    public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException {
        rootElementName = CoreUtils.isNullOrEmpty(rootElementName) ? "BlobAnalyticsLogging" : rootElementName;
        xmlWriter.writeStartElement(rootElementName);
        xmlWriter.writeStringElement("Version", this.version);
        xmlWriter.writeBooleanElement("Delete", this.delete);
        xmlWriter.writeBooleanElement("Read", this.read);
        xmlWriter.writeBooleanElement("Write", this.write);
        xmlWriter.writeXml(this.retentionPolicy, "RetentionPolicy");
        return xmlWriter.writeEndElement();
    }

    /**
     * Reads an instance of BlobAnalyticsLogging from the XmlReader.
     * 
     * @param xmlReader The XmlReader being read.
     * @return An instance of BlobAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it was
     * pointing to XML null.
     * @throws IllegalStateException If the deserialized XML object was missing any required properties.
     * @throws XMLStreamException If an error occurs while reading the BlobAnalyticsLogging.
     */
    public static BlobAnalyticsLogging fromXml(XmlReader xmlReader) throws XMLStreamException {
        return fromXml(xmlReader, null);
    }

    /**
     * Reads an instance of BlobAnalyticsLogging from the XmlReader.
     * 
     * @param xmlReader The XmlReader being read.
     * @param rootElementName Optional root element name to override the default defined by the model. Used to support
     * cases where the model can deserialize from different root element names.
     * @return An instance of BlobAnalyticsLogging if the XmlReader was pointing to an instance of it, or null if it was
     * pointing to XML null.
     * @throws IllegalStateException If the deserialized XML object was missing any required properties.
     * @throws XMLStreamException If an error occurs while reading the BlobAnalyticsLogging.
     */
    public static BlobAnalyticsLogging fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException {
        String finalRootElementName
            = CoreUtils.isNullOrEmpty(rootElementName) ? "BlobAnalyticsLogging" : rootElementName;
        return xmlReader.readObject(finalRootElementName, reader -> {
            BlobAnalyticsLogging deserializedBlobAnalyticsLogging = new BlobAnalyticsLogging();
            while (reader.nextElement() != XmlToken.END_ELEMENT) {
                QName elementName = reader.getElementName();

                if ("Version".equals(elementName.getLocalPart())) {
                    deserializedBlobAnalyticsLogging.version = reader.getStringElement();
                } else if ("Delete".equals(elementName.getLocalPart())) {
                    deserializedBlobAnalyticsLogging.delete = reader.getBooleanElement();
                } else if ("Read".equals(elementName.getLocalPart())) {
                    deserializedBlobAnalyticsLogging.read = reader.getBooleanElement();
                } else if ("Write".equals(elementName.getLocalPart())) {
                    deserializedBlobAnalyticsLogging.write = reader.getBooleanElement();
                } else if ("RetentionPolicy".equals(elementName.getLocalPart())) {
                    deserializedBlobAnalyticsLogging.retentionPolicy
                        = BlobRetentionPolicy.fromXml(reader, "RetentionPolicy");
                } else {
                    reader.skipElement();
                }
            }

            return deserializedBlobAnalyticsLogging;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy