Class RetentionPolicy

java.lang.Object
com.azure.resourcemanager.monitor.models.RetentionPolicy
All Implemented Interfaces:
com.azure.json.JsonSerializable<RetentionPolicy>

public final class RetentionPolicy extends Object implements com.azure.json.JsonSerializable<RetentionPolicy>
Specifies the retention policy for the log.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of RetentionPolicy class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the days property: the number of days for the retention in days.
    boolean
    Get the enabled property: a value indicating whether the retention policy is enabled.
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of RetentionPolicy from the JsonReader.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)
    void
    Validates the instance.
    withDays(int days)
    Set the days property: the number of days for the retention in days.
    withEnabled(boolean enabled)
    Set the enabled property: a value indicating whether the retention policy is enabled.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • RetentionPolicy

      public RetentionPolicy()
      Creates an instance of RetentionPolicy class.
  • Method Details

    • enabled

      public boolean enabled()
      Get the enabled property: a value indicating whether the retention policy is enabled.
      Returns:
      the enabled value.
    • withEnabled

      public RetentionPolicy withEnabled(boolean enabled)
      Set the enabled property: a value indicating whether the retention policy is enabled.
      Parameters:
      enabled - the enabled value to set.
      Returns:
      the RetentionPolicy object itself.
    • days

      public int days()
      Get the days property: the number of days for the retention in days. A value of 0 will retain the events indefinitely.
      Returns:
      the days value.
    • withDays

      public RetentionPolicy withDays(int days)
      Set the days property: the number of days for the retention in days. A value of 0 will retain the events indefinitely.
      Parameters:
      days - the days value to set.
      Returns:
      the RetentionPolicy object itself.
    • validate

      public void validate()
      Validates the instance.
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<RetentionPolicy>
      Throws:
      IOException
    • fromJson

      public static RetentionPolicy fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of RetentionPolicy from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of RetentionPolicy if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the RetentionPolicy.