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

com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionUpdateProperties 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.resourcemanager.devcenter.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.devcenter.models.HibernateSupport;
import com.azure.resourcemanager.devcenter.models.ImageReference;
import com.azure.resourcemanager.devcenter.models.Sku;
import java.io.IOException;

/**
 * Properties of a Dev Box definition. These properties can be updated after the resource has been created.
 */
@Fluent
public class DevBoxDefinitionUpdateProperties implements JsonSerializable {
    /*
     * Image reference information.
     */
    private ImageReference imageReference;

    /*
     * The SKU for Dev Boxes created using this definition.
     */
    private Sku sku;

    /*
     * The storage type used for the Operating System disk of Dev Boxes created using this definition.
     */
    private String osStorageType;

    /*
     * Indicates whether Dev Boxes created with this definition are capable of hibernation. Not all images are capable
     * of supporting hibernation. To find out more see https://aka.ms/devbox/hibernate
     */
    private HibernateSupport hibernateSupport;

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

    /**
     * Get the imageReference property: Image reference information.
     * 
     * @return the imageReference value.
     */
    public ImageReference imageReference() {
        return this.imageReference;
    }

    /**
     * Set the imageReference property: Image reference information.
     * 
     * @param imageReference the imageReference value to set.
     * @return the DevBoxDefinitionUpdateProperties object itself.
     */
    public DevBoxDefinitionUpdateProperties withImageReference(ImageReference imageReference) {
        this.imageReference = imageReference;
        return this;
    }

    /**
     * Get the sku property: The SKU for Dev Boxes created using this definition.
     * 
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU for Dev Boxes created using this definition.
     * 
     * @param sku the sku value to set.
     * @return the DevBoxDefinitionUpdateProperties object itself.
     */
    public DevBoxDefinitionUpdateProperties withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using
     * this definition.
     * 
     * @return the osStorageType value.
     */
    public String osStorageType() {
        return this.osStorageType;
    }

    /**
     * Set the osStorageType property: The storage type used for the Operating System disk of Dev Boxes created using
     * this definition.
     * 
     * @param osStorageType the osStorageType value to set.
     * @return the DevBoxDefinitionUpdateProperties object itself.
     */
    public DevBoxDefinitionUpdateProperties withOsStorageType(String osStorageType) {
        this.osStorageType = osStorageType;
        return this;
    }

    /**
     * Get the hibernateSupport property: Indicates whether Dev Boxes created with this definition are capable of
     * hibernation. Not all images are capable of supporting hibernation. To find out more see
     * https://aka.ms/devbox/hibernate.
     * 
     * @return the hibernateSupport value.
     */
    public HibernateSupport hibernateSupport() {
        return this.hibernateSupport;
    }

    /**
     * Set the hibernateSupport property: Indicates whether Dev Boxes created with this definition are capable of
     * hibernation. Not all images are capable of supporting hibernation. To find out more see
     * https://aka.ms/devbox/hibernate.
     * 
     * @param hibernateSupport the hibernateSupport value to set.
     * @return the DevBoxDefinitionUpdateProperties object itself.
     */
    public DevBoxDefinitionUpdateProperties withHibernateSupport(HibernateSupport hibernateSupport) {
        this.hibernateSupport = hibernateSupport;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (imageReference() != null) {
            imageReference().validate();
        }
        if (sku() != null) {
            sku().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("imageReference", this.imageReference);
        jsonWriter.writeJsonField("sku", this.sku);
        jsonWriter.writeStringField("osStorageType", this.osStorageType);
        jsonWriter.writeStringField("hibernateSupport",
            this.hibernateSupport == null ? null : this.hibernateSupport.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("imageReference".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdateProperties.imageReference = ImageReference.fromJson(reader);
                } else if ("sku".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdateProperties.sku = Sku.fromJson(reader);
                } else if ("osStorageType".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdateProperties.osStorageType = reader.getString();
                } else if ("hibernateSupport".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdateProperties.hibernateSupport
                        = HibernateSupport.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDevBoxDefinitionUpdateProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy