com.azure.resourcemanager.databoxedge.models.IoTDeviceInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-databoxedge Show documentation
Show all versions of azure-resourcemanager-databoxedge Show documentation
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;
/**
* Metadata of IoT device/IoT Edge device to be configured.
*/
@Fluent
public final class IoTDeviceInfo implements JsonSerializable {
/*
* ID of the IoT device/edge device.
*/
private String deviceId;
/*
* Host name for the IoT hub associated to the device.
*/
private String ioTHostHub;
/*
* Id for the IoT hub associated to the device.
*/
private String ioTHostHubId;
/*
* IoT device authentication info.
*/
private Authentication authentication;
/**
* Creates an instance of IoTDeviceInfo class.
*/
public IoTDeviceInfo() {
}
/**
* Get the deviceId property: ID of the IoT device/edge device.
*
* @return the deviceId value.
*/
public String deviceId() {
return this.deviceId;
}
/**
* Set the deviceId property: ID of the IoT device/edge device.
*
* @param deviceId the deviceId value to set.
* @return the IoTDeviceInfo object itself.
*/
public IoTDeviceInfo withDeviceId(String deviceId) {
this.deviceId = deviceId;
return this;
}
/**
* Get the ioTHostHub property: Host name for the IoT hub associated to the device.
*
* @return the ioTHostHub value.
*/
public String ioTHostHub() {
return this.ioTHostHub;
}
/**
* Set the ioTHostHub property: Host name for the IoT hub associated to the device.
*
* @param ioTHostHub the ioTHostHub value to set.
* @return the IoTDeviceInfo object itself.
*/
public IoTDeviceInfo withIoTHostHub(String ioTHostHub) {
this.ioTHostHub = ioTHostHub;
return this;
}
/**
* Get the ioTHostHubId property: Id for the IoT hub associated to the device.
*
* @return the ioTHostHubId value.
*/
public String ioTHostHubId() {
return this.ioTHostHubId;
}
/**
* Set the ioTHostHubId property: Id for the IoT hub associated to the device.
*
* @param ioTHostHubId the ioTHostHubId value to set.
* @return the IoTDeviceInfo object itself.
*/
public IoTDeviceInfo withIoTHostHubId(String ioTHostHubId) {
this.ioTHostHubId = ioTHostHubId;
return this;
}
/**
* Get the authentication property: IoT device authentication info.
*
* @return the authentication value.
*/
public Authentication authentication() {
return this.authentication;
}
/**
* Set the authentication property: IoT device authentication info.
*
* @param authentication the authentication value to set.
* @return the IoTDeviceInfo object itself.
*/
public IoTDeviceInfo withAuthentication(Authentication authentication) {
this.authentication = authentication;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (deviceId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property deviceId in model IoTDeviceInfo"));
}
if (ioTHostHub() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property ioTHostHub in model IoTDeviceInfo"));
}
if (authentication() != null) {
authentication().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(IoTDeviceInfo.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("deviceId", this.deviceId);
jsonWriter.writeStringField("ioTHostHub", this.ioTHostHub);
jsonWriter.writeStringField("ioTHostHubId", this.ioTHostHubId);
jsonWriter.writeJsonField("authentication", this.authentication);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of IoTDeviceInfo from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of IoTDeviceInfo 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 IoTDeviceInfo.
*/
public static IoTDeviceInfo fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
IoTDeviceInfo deserializedIoTDeviceInfo = new IoTDeviceInfo();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("deviceId".equals(fieldName)) {
deserializedIoTDeviceInfo.deviceId = reader.getString();
} else if ("ioTHostHub".equals(fieldName)) {
deserializedIoTDeviceInfo.ioTHostHub = reader.getString();
} else if ("ioTHostHubId".equals(fieldName)) {
deserializedIoTDeviceInfo.ioTHostHubId = reader.getString();
} else if ("authentication".equals(fieldName)) {
deserializedIoTDeviceInfo.authentication = Authentication.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedIoTDeviceInfo;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy