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

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

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Details related to the IPv6 address configuration.
 */
@Immutable
public final class Ipv6Config implements JsonSerializable {
    /*
     * The IPv6 address of the network adapter.
     */
    private String ipAddress;

    /*
     * The IPv6 prefix of the network adapter.
     */
    private Integer prefixLength;

    /*
     * The IPv6 gateway of the network adapter.
     */
    private String gateway;

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

    /**
     * Get the ipAddress property: The IPv6 address of the network adapter.
     * 
     * @return the ipAddress value.
     */
    public String ipAddress() {
        return this.ipAddress;
    }

    /**
     * Get the prefixLength property: The IPv6 prefix of the network adapter.
     * 
     * @return the prefixLength value.
     */
    public Integer prefixLength() {
        return this.prefixLength;
    }

    /**
     * Get the gateway property: The IPv6 gateway of the network adapter.
     * 
     * @return the gateway value.
     */
    public String gateway() {
        return this.gateway;
    }

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

                if ("ipAddress".equals(fieldName)) {
                    deserializedIpv6Config.ipAddress = reader.getString();
                } else if ("prefixLength".equals(fieldName)) {
                    deserializedIpv6Config.prefixLength = reader.getNullable(JsonReader::getInt);
                } else if ("gateway".equals(fieldName)) {
                    deserializedIpv6Config.gateway = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIpv6Config;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy