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

com.azure.resourcemanager.databoxedge.models.AzureContainerInfo 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.models;

import com.azure.core.annotation.Fluent;
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 java.io.IOException;

/**
 * Azure container mapping of the endpoint.
 */
@Fluent
public final class AzureContainerInfo implements JsonSerializable {
    /*
     * ID of the storage account credential used to access storage.
     */
    private String storageAccountCredentialId;

    /*
     * Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block
     * blob).
     */
    private String containerName;

    /*
     * Storage format used for the file represented by the share.
     */
    private AzureContainerDataFormat dataFormat;

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

    /**
     * Get the storageAccountCredentialId property: ID of the storage account credential used to access storage.
     * 
     * @return the storageAccountCredentialId value.
     */
    public String storageAccountCredentialId() {
        return this.storageAccountCredentialId;
    }

    /**
     * Set the storageAccountCredentialId property: ID of the storage account credential used to access storage.
     * 
     * @param storageAccountCredentialId the storageAccountCredentialId value to set.
     * @return the AzureContainerInfo object itself.
     */
    public AzureContainerInfo withStorageAccountCredentialId(String storageAccountCredentialId) {
        this.storageAccountCredentialId = storageAccountCredentialId;
        return this;
    }

    /**
     * Get the containerName property: Container name (Based on the data format specified, this represents the name of
     * Azure Files/Page blob/Block blob).
     * 
     * @return the containerName value.
     */
    public String containerName() {
        return this.containerName;
    }

    /**
     * Set the containerName property: Container name (Based on the data format specified, this represents the name of
     * Azure Files/Page blob/Block blob).
     * 
     * @param containerName the containerName value to set.
     * @return the AzureContainerInfo object itself.
     */
    public AzureContainerInfo withContainerName(String containerName) {
        this.containerName = containerName;
        return this;
    }

    /**
     * Get the dataFormat property: Storage format used for the file represented by the share.
     * 
     * @return the dataFormat value.
     */
    public AzureContainerDataFormat dataFormat() {
        return this.dataFormat;
    }

    /**
     * Set the dataFormat property: Storage format used for the file represented by the share.
     * 
     * @param dataFormat the dataFormat value to set.
     * @return the AzureContainerInfo object itself.
     */
    public AzureContainerInfo withDataFormat(AzureContainerDataFormat dataFormat) {
        this.dataFormat = dataFormat;
        return this;
    }

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

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

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

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

                if ("storageAccountCredentialId".equals(fieldName)) {
                    deserializedAzureContainerInfo.storageAccountCredentialId = reader.getString();
                } else if ("containerName".equals(fieldName)) {
                    deserializedAzureContainerInfo.containerName = reader.getString();
                } else if ("dataFormat".equals(fieldName)) {
                    deserializedAzureContainerInfo.dataFormat = AzureContainerDataFormat.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAzureContainerInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy