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

com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanPatchProperties Maven / Gradle / Ivy

Go to download

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

The 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.desktopvirtualization.fluent.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 com.azure.resourcemanager.desktopvirtualization.models.ScalingHostPoolReference;
import com.azure.resourcemanager.desktopvirtualization.models.ScalingSchedule;
import java.io.IOException;
import java.util.List;

/**
 * Scaling plan properties.
 */
@Fluent
public final class ScalingPlanPatchProperties implements JsonSerializable {
    /*
     * Description of scaling plan.
     */
    private String description;

    /*
     * User friendly name of scaling plan.
     */
    private String friendlyName;

    /*
     * Timezone of the scaling plan.
     */
    private String timeZone;

    /*
     * Exclusion tag for scaling plan.
     */
    private String exclusionTag;

    /*
     * List of ScalingSchedule definitions.
     */
    private List schedules;

    /*
     * List of ScalingHostPoolReference definitions.
     */
    private List hostPoolReferences;

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

    /**
     * Get the description property: Description of scaling plan.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description of scaling plan.
     * 
     * @param description the description value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the friendlyName property: User friendly name of scaling plan.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.friendlyName;
    }

    /**
     * Set the friendlyName property: User friendly name of scaling plan.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withFriendlyName(String friendlyName) {
        this.friendlyName = friendlyName;
        return this;
    }

    /**
     * Get the timeZone property: Timezone of the scaling plan.
     * 
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.timeZone;
    }

    /**
     * Set the timeZone property: Timezone of the scaling plan.
     * 
     * @param timeZone the timeZone value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
    }

    /**
     * Get the exclusionTag property: Exclusion tag for scaling plan.
     * 
     * @return the exclusionTag value.
     */
    public String exclusionTag() {
        return this.exclusionTag;
    }

    /**
     * Set the exclusionTag property: Exclusion tag for scaling plan.
     * 
     * @param exclusionTag the exclusionTag value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withExclusionTag(String exclusionTag) {
        this.exclusionTag = exclusionTag;
        return this;
    }

    /**
     * Get the schedules property: List of ScalingSchedule definitions.
     * 
     * @return the schedules value.
     */
    public List schedules() {
        return this.schedules;
    }

    /**
     * Set the schedules property: List of ScalingSchedule definitions.
     * 
     * @param schedules the schedules value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withSchedules(List schedules) {
        this.schedules = schedules;
        return this;
    }

    /**
     * Get the hostPoolReferences property: List of ScalingHostPoolReference definitions.
     * 
     * @return the hostPoolReferences value.
     */
    public List hostPoolReferences() {
        return this.hostPoolReferences;
    }

    /**
     * Set the hostPoolReferences property: List of ScalingHostPoolReference definitions.
     * 
     * @param hostPoolReferences the hostPoolReferences value to set.
     * @return the ScalingPlanPatchProperties object itself.
     */
    public ScalingPlanPatchProperties withHostPoolReferences(List hostPoolReferences) {
        this.hostPoolReferences = hostPoolReferences;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (schedules() != null) {
            schedules().forEach(e -> e.validate());
        }
        if (hostPoolReferences() != null) {
            hostPoolReferences().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("friendlyName", this.friendlyName);
        jsonWriter.writeStringField("timeZone", this.timeZone);
        jsonWriter.writeStringField("exclusionTag", this.exclusionTag);
        jsonWriter.writeArrayField("schedules", this.schedules, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("hostPoolReferences", this.hostPoolReferences,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("description".equals(fieldName)) {
                    deserializedScalingPlanPatchProperties.description = reader.getString();
                } else if ("friendlyName".equals(fieldName)) {
                    deserializedScalingPlanPatchProperties.friendlyName = reader.getString();
                } else if ("timeZone".equals(fieldName)) {
                    deserializedScalingPlanPatchProperties.timeZone = reader.getString();
                } else if ("exclusionTag".equals(fieldName)) {
                    deserializedScalingPlanPatchProperties.exclusionTag = reader.getString();
                } else if ("schedules".equals(fieldName)) {
                    List schedules = reader.readArray(reader1 -> ScalingSchedule.fromJson(reader1));
                    deserializedScalingPlanPatchProperties.schedules = schedules;
                } else if ("hostPoolReferences".equals(fieldName)) {
                    List hostPoolReferences
                        = reader.readArray(reader1 -> ScalingHostPoolReference.fromJson(reader1));
                    deserializedScalingPlanPatchProperties.hostPoolReferences = hostPoolReferences;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedScalingPlanPatchProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy