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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.databoxedge.models.ArmBaseModel;
import com.azure.resourcemanager.databoxedge.models.DataBoxEdgeDeviceStatus;
import com.azure.resourcemanager.databoxedge.models.DeviceType;
import com.azure.resourcemanager.databoxedge.models.RoleTypes;
import com.azure.resourcemanager.databoxedge.models.Sku;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * The Data Box Edge/Gateway device.
 */
@Fluent
public final class DataBoxEdgeDeviceInner extends ArmBaseModel {
    /*
     * The location of the device. This is a supported and registered Azure geographical region (for example, West US,
     * East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an
     * identical geographical region is specified on update, the request will succeed.
     */
    private String location;

    /*
     * The list of tags that describe the device. These tags can be used to view and group this device (across resource
     * groups).
     */
    private Map tags;

    /*
     * The SKU type.
     */
    private Sku sku;

    /*
     * The etag for the devices.
     */
    private String etag;

    /*
     * The properties of the Data Box Edge/Gateway device.
     */
    private DataBoxEdgeDeviceProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the location property: The location of the device. This is a supported and registered Azure geographical
     * region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed
     * once it is created, but if an identical geographical region is specified on update, the request will succeed.
     * 
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The location of the device. This is a supported and registered Azure geographical
     * region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed
     * once it is created, but if an identical geographical region is specified on update, the request will succeed.
     * 
     * @param location the location value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the tags property: The list of tags that describe the device. These tags can be used to view and group this
     * device (across resource groups).
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: The list of tags that describe the device. These tags can be used to view and group this
     * device (across resource groups).
     * 
     * @param tags the tags value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the sku property: The SKU type.
     * 
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU type.
     * 
     * @param sku the sku value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the etag property: The etag for the devices.
     * 
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: The etag for the devices.
     * 
     * @param etag the etag value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the innerProperties property: The properties of the Data Box Edge/Gateway device.
     * 
     * @return the innerProperties value.
     */
    private DataBoxEdgeDeviceProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the dataBoxEdgeDeviceStatus property: The status of the Data Box Edge/Gateway device.
     * 
     * @return the dataBoxEdgeDeviceStatus value.
     */
    public DataBoxEdgeDeviceStatus dataBoxEdgeDeviceStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().dataBoxEdgeDeviceStatus();
    }

    /**
     * Set the dataBoxEdgeDeviceStatus property: The status of the Data Box Edge/Gateway device.
     * 
     * @param dataBoxEdgeDeviceStatus the dataBoxEdgeDeviceStatus value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withDataBoxEdgeDeviceStatus(DataBoxEdgeDeviceStatus dataBoxEdgeDeviceStatus) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataBoxEdgeDeviceProperties();
        }
        this.innerProperties().withDataBoxEdgeDeviceStatus(dataBoxEdgeDeviceStatus);
        return this;
    }

    /**
     * Get the serialNumber property: The Serial Number of Data Box Edge/Gateway device.
     * 
     * @return the serialNumber value.
     */
    public String serialNumber() {
        return this.innerProperties() == null ? null : this.innerProperties().serialNumber();
    }

    /**
     * Get the description property: The Description of the Data Box Edge/Gateway device.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: The Description of the Data Box Edge/Gateway device.
     * 
     * @param description the description value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataBoxEdgeDeviceProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the modelDescription property: The description of the Data Box Edge/Gateway device model.
     * 
     * @return the modelDescription value.
     */
    public String modelDescription() {
        return this.innerProperties() == null ? null : this.innerProperties().modelDescription();
    }

    /**
     * Set the modelDescription property: The description of the Data Box Edge/Gateway device model.
     * 
     * @param modelDescription the modelDescription value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withModelDescription(String modelDescription) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataBoxEdgeDeviceProperties();
        }
        this.innerProperties().withModelDescription(modelDescription);
        return this;
    }

    /**
     * Get the deviceType property: The type of the Data Box Edge/Gateway device.
     * 
     * @return the deviceType value.
     */
    public DeviceType deviceType() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceType();
    }

    /**
     * Get the friendlyName property: The Data Box Edge/Gateway device name.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.innerProperties() == null ? null : this.innerProperties().friendlyName();
    }

    /**
     * Set the friendlyName property: The Data Box Edge/Gateway device name.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the DataBoxEdgeDeviceInner object itself.
     */
    public DataBoxEdgeDeviceInner withFriendlyName(String friendlyName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DataBoxEdgeDeviceProperties();
        }
        this.innerProperties().withFriendlyName(friendlyName);
        return this;
    }

    /**
     * Get the culture property: The Data Box Edge/Gateway device culture.
     * 
     * @return the culture value.
     */
    public String culture() {
        return this.innerProperties() == null ? null : this.innerProperties().culture();
    }

    /**
     * Get the deviceModel property: The Data Box Edge/Gateway device model.
     * 
     * @return the deviceModel value.
     */
    public String deviceModel() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceModel();
    }

    /**
     * Get the deviceSoftwareVersion property: The Data Box Edge/Gateway device software version.
     * 
     * @return the deviceSoftwareVersion value.
     */
    public String deviceSoftwareVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceSoftwareVersion();
    }

    /**
     * Get the deviceLocalCapacity property: The Data Box Edge/Gateway device local capacity in MB.
     * 
     * @return the deviceLocalCapacity value.
     */
    public Long deviceLocalCapacity() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceLocalCapacity();
    }

    /**
     * Get the timeZone property: The Data Box Edge/Gateway device timezone.
     * 
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.innerProperties() == null ? null : this.innerProperties().timeZone();
    }

    /**
     * Get the deviceHcsVersion property: The device software version number of the device (eg: 1.2.18105.6).
     * 
     * @return the deviceHcsVersion value.
     */
    public String deviceHcsVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceHcsVersion();
    }

    /**
     * Get the configuredRoleTypes property: Type of compute roles configured.
     * 
     * @return the configuredRoleTypes value.
     */
    public List configuredRoleTypes() {
        return this.innerProperties() == null ? null : this.innerProperties().configuredRoleTypes();
    }

    /**
     * Get the nodeCount property: The number of nodes in the cluster.
     * 
     * @return the nodeCount value.
     */
    public Integer nodeCount() {
        return this.innerProperties() == null ? null : this.innerProperties().nodeCount();
    }

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

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

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

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

                if ("id".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.location = reader.getString();
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDataBoxEdgeDeviceInner.tags = tags;
                } else if ("sku".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.sku = Sku.fromJson(reader);
                } else if ("etag".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.etag = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedDataBoxEdgeDeviceInner.innerProperties = DataBoxEdgeDeviceProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDataBoxEdgeDeviceInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy