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

com.azure.resourcemanager.devcenter.models.DevBoxDefinitionUpdate 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.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.fluent.models.DevBoxDefinitionUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Partial update of a Dev Box definition resource.
 */
@Fluent
public final class DevBoxDefinitionUpdate extends TrackedResourceUpdate {
    /*
     * Properties of a Dev Box definition to be updated.
     */
    private DevBoxDefinitionUpdateProperties innerProperties;

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

    /**
     * Get the innerProperties property: Properties of a Dev Box definition to be updated.
     * 
     * @return the innerProperties value.
     */
    private DevBoxDefinitionUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DevBoxDefinitionUpdate withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DevBoxDefinitionUpdate withLocation(String location) {
        super.withLocation(location);
        return this;
    }

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

    /**
     * Set the imageReference property: Image reference information.
     * 
     * @param imageReference the imageReference value to set.
     * @return the DevBoxDefinitionUpdate object itself.
     */
    public DevBoxDefinitionUpdate withImageReference(ImageReference imageReference) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevBoxDefinitionUpdateProperties();
        }
        this.innerProperties().withImageReference(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.innerProperties() == null ? null : this.innerProperties().sku();
    }

    /**
     * Set the sku property: The SKU for Dev Boxes created using this definition.
     * 
     * @param sku the sku value to set.
     * @return the DevBoxDefinitionUpdate object itself.
     */
    public DevBoxDefinitionUpdate withSku(Sku sku) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevBoxDefinitionUpdateProperties();
        }
        this.innerProperties().withSku(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.innerProperties() == null ? null : this.innerProperties().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 DevBoxDefinitionUpdate object itself.
     */
    public DevBoxDefinitionUpdate withOsStorageType(String osStorageType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevBoxDefinitionUpdateProperties();
        }
        this.innerProperties().withOsStorageType(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.innerProperties() == null ? null : this.innerProperties().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 DevBoxDefinitionUpdate object itself.
     */
    public DevBoxDefinitionUpdate withHibernateSupport(HibernateSupport hibernateSupport) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DevBoxDefinitionUpdateProperties();
        }
        this.innerProperties().withHibernateSupport(hibernateSupport);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDevBoxDefinitionUpdate.withTags(tags);
                } else if ("location".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdate.withLocation(reader.getString());
                } else if ("properties".equals(fieldName)) {
                    deserializedDevBoxDefinitionUpdate.innerProperties
                        = DevBoxDefinitionUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDevBoxDefinitionUpdate;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy