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

com.azure.resourcemanager.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Service Fabric Managed Clusters Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Managed Clusters Management Client. Package tag package-2024-04.

There is a newer version: 1.0.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.servicefabricmanagedclusters.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;

/**
 * Describes the delta health policies for the cluster upgrade.
 */
@Fluent
public final class ClusterUpgradeDeltaHealthPolicy implements JsonSerializable {
    /*
     * The maximum allowed percentage of nodes health degradation allowed during cluster upgrades.
     * The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at
     * the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits.
     */
    private int maxPercentDeltaUnhealthyNodes;

    /*
     * The maximum allowed percentage of upgrade domain nodes health degradation allowed during cluster upgrades.
     * The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of
     * the upgrade domain nodes at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make
     * sure the state of the upgrade domains is within tolerated limits.
     */
    private Integer maxPercentUpgradeDomainDeltaUnhealthyNodes;

    /*
     * The maximum allowed percentage of applications health degradation allowed during cluster upgrades.
     * The delta is measured between the state of the applications at the beginning of upgrade and the state of the
     * applications at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits. System services are not included in this.
     * NOTE: This value will overwrite the value specified in
     * properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications
     */
    private Integer maxPercentDeltaUnhealthyApplications;

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

    /**
     * Get the maxPercentDeltaUnhealthyNodes property: The maximum allowed percentage of nodes health degradation
     * allowed during cluster upgrades.
     * The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at
     * the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits.
     * 
     * @return the maxPercentDeltaUnhealthyNodes value.
     */
    public int maxPercentDeltaUnhealthyNodes() {
        return this.maxPercentDeltaUnhealthyNodes;
    }

    /**
     * Set the maxPercentDeltaUnhealthyNodes property: The maximum allowed percentage of nodes health degradation
     * allowed during cluster upgrades.
     * The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at
     * the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits.
     * 
     * @param maxPercentDeltaUnhealthyNodes the maxPercentDeltaUnhealthyNodes value to set.
     * @return the ClusterUpgradeDeltaHealthPolicy object itself.
     */
    public ClusterUpgradeDeltaHealthPolicy withMaxPercentDeltaUnhealthyNodes(int maxPercentDeltaUnhealthyNodes) {
        this.maxPercentDeltaUnhealthyNodes = maxPercentDeltaUnhealthyNodes;
        return this;
    }

    /**
     * Get the maxPercentUpgradeDomainDeltaUnhealthyNodes property: The maximum allowed percentage of upgrade domain
     * nodes health degradation allowed during cluster upgrades.
     * The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of
     * the upgrade domain nodes at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make
     * sure the state of the upgrade domains is within tolerated limits.
     * 
     * @return the maxPercentUpgradeDomainDeltaUnhealthyNodes value.
     */
    public Integer maxPercentUpgradeDomainDeltaUnhealthyNodes() {
        return this.maxPercentUpgradeDomainDeltaUnhealthyNodes;
    }

    /**
     * Set the maxPercentUpgradeDomainDeltaUnhealthyNodes property: The maximum allowed percentage of upgrade domain
     * nodes health degradation allowed during cluster upgrades.
     * The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of
     * the upgrade domain nodes at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make
     * sure the state of the upgrade domains is within tolerated limits.
     * 
     * @param maxPercentUpgradeDomainDeltaUnhealthyNodes the maxPercentUpgradeDomainDeltaUnhealthyNodes value to set.
     * @return the ClusterUpgradeDeltaHealthPolicy object itself.
     */
    public ClusterUpgradeDeltaHealthPolicy
        withMaxPercentUpgradeDomainDeltaUnhealthyNodes(Integer maxPercentUpgradeDomainDeltaUnhealthyNodes) {
        this.maxPercentUpgradeDomainDeltaUnhealthyNodes = maxPercentUpgradeDomainDeltaUnhealthyNodes;
        return this;
    }

    /**
     * Get the maxPercentDeltaUnhealthyApplications property: The maximum allowed percentage of applications health
     * degradation allowed during cluster upgrades.
     * The delta is measured between the state of the applications at the beginning of upgrade and the state of the
     * applications at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits. System services are not included in this.
     * NOTE: This value will overwrite the value specified in
     * properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications.
     * 
     * @return the maxPercentDeltaUnhealthyApplications value.
     */
    public Integer maxPercentDeltaUnhealthyApplications() {
        return this.maxPercentDeltaUnhealthyApplications;
    }

    /**
     * Set the maxPercentDeltaUnhealthyApplications property: The maximum allowed percentage of applications health
     * degradation allowed during cluster upgrades.
     * The delta is measured between the state of the applications at the beginning of upgrade and the state of the
     * applications at the time of the health evaluation.
     * The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster
     * is within tolerated limits. System services are not included in this.
     * NOTE: This value will overwrite the value specified in
     * properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications.
     * 
     * @param maxPercentDeltaUnhealthyApplications the maxPercentDeltaUnhealthyApplications value to set.
     * @return the ClusterUpgradeDeltaHealthPolicy object itself.
     */
    public ClusterUpgradeDeltaHealthPolicy
        withMaxPercentDeltaUnhealthyApplications(Integer maxPercentDeltaUnhealthyApplications) {
        this.maxPercentDeltaUnhealthyApplications = maxPercentDeltaUnhealthyApplications;
        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.writeIntField("maxPercentDeltaUnhealthyNodes", this.maxPercentDeltaUnhealthyNodes);
        jsonWriter.writeNumberField("maxPercentUpgradeDomainDeltaUnhealthyNodes",
            this.maxPercentUpgradeDomainDeltaUnhealthyNodes);
        jsonWriter.writeNumberField("maxPercentDeltaUnhealthyApplications", this.maxPercentDeltaUnhealthyApplications);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ClusterUpgradeDeltaHealthPolicy from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ClusterUpgradeDeltaHealthPolicy 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.
     * @throws IOException If an error occurs while reading the ClusterUpgradeDeltaHealthPolicy.
     */
    public static ClusterUpgradeDeltaHealthPolicy fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ClusterUpgradeDeltaHealthPolicy deserializedClusterUpgradeDeltaHealthPolicy
                = new ClusterUpgradeDeltaHealthPolicy();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("maxPercentDeltaUnhealthyNodes".equals(fieldName)) {
                    deserializedClusterUpgradeDeltaHealthPolicy.maxPercentDeltaUnhealthyNodes = reader.getInt();
                } else if ("maxPercentUpgradeDomainDeltaUnhealthyNodes".equals(fieldName)) {
                    deserializedClusterUpgradeDeltaHealthPolicy.maxPercentUpgradeDomainDeltaUnhealthyNodes
                        = reader.getNullable(JsonReader::getInt);
                } else if ("maxPercentDeltaUnhealthyApplications".equals(fieldName)) {
                    deserializedClusterUpgradeDeltaHealthPolicy.maxPercentDeltaUnhealthyApplications
                        = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedClusterUpgradeDeltaHealthPolicy;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy