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

com.azure.resourcemanager.storage.models.DateAfterModification Maven / Gradle / Ivy

There is a newer version: 2.44.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storage.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Object to define the base blob action conditions. Properties daysAfterModificationGreaterThan,
 * daysAfterLastAccessTimeGreaterThan and daysAfterCreationGreaterThan are mutually exclusive. The
 * daysAfterLastTierChangeGreaterThan property is only applicable for tierToArchive actions which requires
 * daysAfterModificationGreaterThan to be set, also it cannot be used in conjunction with
 * daysAfterLastAccessTimeGreaterThan or daysAfterCreationGreaterThan.
 */
@Fluent
public final class DateAfterModification implements JsonSerializable {
    /*
     * Value indicating the age in days after last modification
     */
    private Float daysAfterModificationGreaterThan;

    /*
     * Value indicating the age in days after last blob access. This property can only be used in conjunction with last
     * access time tracking policy
     */
    private Float daysAfterLastAccessTimeGreaterThan;

    /*
     * Value indicating the age in days after last blob tier change time. This property is only applicable for
     * tierToArchive actions and requires daysAfterModificationGreaterThan to be set for baseBlobs based actions. The
     * blob will be archived if both the conditions are satisfied.
     */
    private Float daysAfterLastTierChangeGreaterThan;

    /*
     * Value indicating the age in days after blob creation.
     */
    private Float daysAfterCreationGreaterThan;

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

    /**
     * Get the daysAfterModificationGreaterThan property: Value indicating the age in days after last modification.
     * 
     * @return the daysAfterModificationGreaterThan value.
     */
    public Float daysAfterModificationGreaterThan() {
        return this.daysAfterModificationGreaterThan;
    }

    /**
     * Set the daysAfterModificationGreaterThan property: Value indicating the age in days after last modification.
     * 
     * @param daysAfterModificationGreaterThan the daysAfterModificationGreaterThan value to set.
     * @return the DateAfterModification object itself.
     */
    public DateAfterModification withDaysAfterModificationGreaterThan(Float daysAfterModificationGreaterThan) {
        this.daysAfterModificationGreaterThan = daysAfterModificationGreaterThan;
        return this;
    }

    /**
     * Get the daysAfterLastAccessTimeGreaterThan property: Value indicating the age in days after last blob access.
     * This property can only be used in conjunction with last access time tracking policy.
     * 
     * @return the daysAfterLastAccessTimeGreaterThan value.
     */
    public Float daysAfterLastAccessTimeGreaterThan() {
        return this.daysAfterLastAccessTimeGreaterThan;
    }

    /**
     * Set the daysAfterLastAccessTimeGreaterThan property: Value indicating the age in days after last blob access.
     * This property can only be used in conjunction with last access time tracking policy.
     * 
     * @param daysAfterLastAccessTimeGreaterThan the daysAfterLastAccessTimeGreaterThan value to set.
     * @return the DateAfterModification object itself.
     */
    public DateAfterModification withDaysAfterLastAccessTimeGreaterThan(Float daysAfterLastAccessTimeGreaterThan) {
        this.daysAfterLastAccessTimeGreaterThan = daysAfterLastAccessTimeGreaterThan;
        return this;
    }

    /**
     * Get the daysAfterLastTierChangeGreaterThan property: Value indicating the age in days after last blob tier change
     * time. This property is only applicable for tierToArchive actions and requires daysAfterModificationGreaterThan to
     * be set for baseBlobs based actions. The blob will be archived if both the conditions are satisfied.
     * 
     * @return the daysAfterLastTierChangeGreaterThan value.
     */
    public Float daysAfterLastTierChangeGreaterThan() {
        return this.daysAfterLastTierChangeGreaterThan;
    }

    /**
     * Set the daysAfterLastTierChangeGreaterThan property: Value indicating the age in days after last blob tier change
     * time. This property is only applicable for tierToArchive actions and requires daysAfterModificationGreaterThan to
     * be set for baseBlobs based actions. The blob will be archived if both the conditions are satisfied.
     * 
     * @param daysAfterLastTierChangeGreaterThan the daysAfterLastTierChangeGreaterThan value to set.
     * @return the DateAfterModification object itself.
     */
    public DateAfterModification withDaysAfterLastTierChangeGreaterThan(Float daysAfterLastTierChangeGreaterThan) {
        this.daysAfterLastTierChangeGreaterThan = daysAfterLastTierChangeGreaterThan;
        return this;
    }

    /**
     * Get the daysAfterCreationGreaterThan property: Value indicating the age in days after blob creation.
     * 
     * @return the daysAfterCreationGreaterThan value.
     */
    public Float daysAfterCreationGreaterThan() {
        return this.daysAfterCreationGreaterThan;
    }

    /**
     * Set the daysAfterCreationGreaterThan property: Value indicating the age in days after blob creation.
     * 
     * @param daysAfterCreationGreaterThan the daysAfterCreationGreaterThan value to set.
     * @return the DateAfterModification object itself.
     */
    public DateAfterModification withDaysAfterCreationGreaterThan(Float daysAfterCreationGreaterThan) {
        this.daysAfterCreationGreaterThan = daysAfterCreationGreaterThan;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("daysAfterModificationGreaterThan", this.daysAfterModificationGreaterThan);
        jsonWriter.writeNumberField("daysAfterLastAccessTimeGreaterThan", this.daysAfterLastAccessTimeGreaterThan);
        jsonWriter.writeNumberField("daysAfterLastTierChangeGreaterThan", this.daysAfterLastTierChangeGreaterThan);
        jsonWriter.writeNumberField("daysAfterCreationGreaterThan", this.daysAfterCreationGreaterThan);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DateAfterModification from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DateAfterModification if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IOException If an error occurs while reading the DateAfterModification.
     */
    public static DateAfterModification fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DateAfterModification deserializedDateAfterModification = new DateAfterModification();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("daysAfterModificationGreaterThan".equals(fieldName)) {
                    deserializedDateAfterModification.daysAfterModificationGreaterThan
                        = reader.getNullable(JsonReader::getFloat);
                } else if ("daysAfterLastAccessTimeGreaterThan".equals(fieldName)) {
                    deserializedDateAfterModification.daysAfterLastAccessTimeGreaterThan
                        = reader.getNullable(JsonReader::getFloat);
                } else if ("daysAfterLastTierChangeGreaterThan".equals(fieldName)) {
                    deserializedDateAfterModification.daysAfterLastTierChangeGreaterThan
                        = reader.getNullable(JsonReader::getFloat);
                } else if ("daysAfterCreationGreaterThan".equals(fieldName)) {
                    deserializedDateAfterModification.daysAfterCreationGreaterThan
                        = reader.getNullable(JsonReader::getFloat);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDateAfterModification;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy