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

com.azure.resourcemanager.devcenter.fluent.models.ImageProperties 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.Immutable;
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.ProvisioningState;
import com.azure.resourcemanager.devcenter.models.RecommendedMachineConfiguration;
import java.io.IOException;

/**
 * Properties of an image.
 */
@Immutable
public final class ImageProperties implements JsonSerializable {
    /*
     * The description of the image.
     */
    private String description;

    /*
     * The publisher of the image.
     */
    private String publisher;

    /*
     * The name of the image offer.
     */
    private String offer;

    /*
     * The SKU name for the image.
     */
    private String sku;

    /*
     * The recommended machine configuration to use with the image.
     */
    private RecommendedMachineConfiguration recommendedMachineConfiguration;

    /*
     * The provisioning state of the resource.
     */
    private ProvisioningState provisioningState;

    /*
     * Indicates whether this image has hibernate enabled. 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 ImageProperties class.
     */
    public ImageProperties() {
    }

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

    /**
     * Get the publisher property: The publisher of the image.
     * 
     * @return the publisher value.
     */
    public String publisher() {
        return this.publisher;
    }

    /**
     * Get the offer property: The name of the image offer.
     * 
     * @return the offer value.
     */
    public String offer() {
        return this.offer;
    }

    /**
     * Get the sku property: The SKU name for the image.
     * 
     * @return the sku value.
     */
    public String sku() {
        return this.sku;
    }

    /**
     * Get the recommendedMachineConfiguration property: The recommended machine configuration to use with the image.
     * 
     * @return the recommendedMachineConfiguration value.
     */
    public RecommendedMachineConfiguration recommendedMachineConfiguration() {
        return this.recommendedMachineConfiguration;
    }

    /**
     * Get the provisioningState property: The provisioning state of the resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the hibernateSupport property: Indicates whether this image has hibernate enabled. 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;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("description".equals(fieldName)) {
                    deserializedImageProperties.description = reader.getString();
                } else if ("publisher".equals(fieldName)) {
                    deserializedImageProperties.publisher = reader.getString();
                } else if ("offer".equals(fieldName)) {
                    deserializedImageProperties.offer = reader.getString();
                } else if ("sku".equals(fieldName)) {
                    deserializedImageProperties.sku = reader.getString();
                } else if ("recommendedMachineConfiguration".equals(fieldName)) {
                    deserializedImageProperties.recommendedMachineConfiguration
                        = RecommendedMachineConfiguration.fromJson(reader);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedImageProperties.provisioningState = ProvisioningState.fromString(reader.getString());
                } else if ("hibernateSupport".equals(fieldName)) {
                    deserializedImageProperties.hibernateSupport = HibernateSupport.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedImageProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy