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

com.azure.resourcemanager.devcenter.fluent.models.ImageVersionProperties 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.core.util.CoreUtils;
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.ProvisioningState;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Properties of an image version.
 */
@Immutable
public final class ImageVersionProperties implements JsonSerializable {
    /*
     * The semantic version string.
     */
    private String name;

    /*
     * The datetime that the backing image version was published.
     */
    private OffsetDateTime publishedDate;

    /*
     * If the version should be excluded from being treated as the latest version.
     */
    private Boolean excludeFromLatest;

    /*
     * The size of the OS disk image, in GB.
     */
    private Integer osDiskImageSizeInGb;

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

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

    /**
     * Get the name property: The semantic version string.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the publishedDate property: The datetime that the backing image version was published.
     * 
     * @return the publishedDate value.
     */
    public OffsetDateTime publishedDate() {
        return this.publishedDate;
    }

    /**
     * Get the excludeFromLatest property: If the version should be excluded from being treated as the latest version.
     * 
     * @return the excludeFromLatest value.
     */
    public Boolean excludeFromLatest() {
        return this.excludeFromLatest;
    }

    /**
     * Get the osDiskImageSizeInGb property: The size of the OS disk image, in GB.
     * 
     * @return the osDiskImageSizeInGb value.
     */
    public Integer osDiskImageSizeInGb() {
        return this.osDiskImageSizeInGb;
    }

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

    /**
     * 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();
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedImageVersionProperties.name = reader.getString();
                } else if ("publishedDate".equals(fieldName)) {
                    deserializedImageVersionProperties.publishedDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("excludeFromLatest".equals(fieldName)) {
                    deserializedImageVersionProperties.excludeFromLatest = reader.getNullable(JsonReader::getBoolean);
                } else if ("osDiskImageSizeInGb".equals(fieldName)) {
                    deserializedImageVersionProperties.osDiskImageSizeInGb = reader.getNullable(JsonReader::getInt);
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedImageVersionProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedImageVersionProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy