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

com.azure.resourcemanager.databoxedge.fluent.models.ContainerProperties Maven / Gradle / Ivy

Go to download

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

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.databoxedge.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.databoxedge.models.AzureContainerDataFormat;
import com.azure.resourcemanager.databoxedge.models.ContainerStatus;
import com.azure.resourcemanager.databoxedge.models.RefreshDetails;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * The container properties.
 */
@Fluent
public final class ContainerProperties implements JsonSerializable {
    /*
     * Current status of the container.
     */
    private ContainerStatus containerStatus;

    /*
     * DataFormat for Container
     */
    private AzureContainerDataFormat dataFormat;

    /*
     * Details of the refresh job on this container.
     */
    private RefreshDetails refreshDetails;

    /*
     * The UTC time when container got created.
     */
    private OffsetDateTime createdDateTime;

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

    /**
     * Get the containerStatus property: Current status of the container.
     * 
     * @return the containerStatus value.
     */
    public ContainerStatus containerStatus() {
        return this.containerStatus;
    }

    /**
     * Get the dataFormat property: DataFormat for Container.
     * 
     * @return the dataFormat value.
     */
    public AzureContainerDataFormat dataFormat() {
        return this.dataFormat;
    }

    /**
     * Set the dataFormat property: DataFormat for Container.
     * 
     * @param dataFormat the dataFormat value to set.
     * @return the ContainerProperties object itself.
     */
    public ContainerProperties withDataFormat(AzureContainerDataFormat dataFormat) {
        this.dataFormat = dataFormat;
        return this;
    }

    /**
     * Get the refreshDetails property: Details of the refresh job on this container.
     * 
     * @return the refreshDetails value.
     */
    public RefreshDetails refreshDetails() {
        return this.refreshDetails;
    }

    /**
     * Get the createdDateTime property: The UTC time when container got created.
     * 
     * @return the createdDateTime value.
     */
    public OffsetDateTime createdDateTime() {
        return this.createdDateTime;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (dataFormat() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property dataFormat in model ContainerProperties"));
        }
        if (refreshDetails() != null) {
            refreshDetails().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ContainerProperties.class);

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

    /**
     * Reads an instance of ContainerProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ContainerProperties if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the ContainerProperties.
     */
    public static ContainerProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ContainerProperties deserializedContainerProperties = new ContainerProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("dataFormat".equals(fieldName)) {
                    deserializedContainerProperties.dataFormat
                        = AzureContainerDataFormat.fromString(reader.getString());
                } else if ("containerStatus".equals(fieldName)) {
                    deserializedContainerProperties.containerStatus = ContainerStatus.fromString(reader.getString());
                } else if ("refreshDetails".equals(fieldName)) {
                    deserializedContainerProperties.refreshDetails = RefreshDetails.fromJson(reader);
                } else if ("createdDateTime".equals(fieldName)) {
                    deserializedContainerProperties.createdDateTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedContainerProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy