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

com.azure.resourcemanager.databoxedge.models.Ipv4Config 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 IPv4 address configuration.
 */
@Immutable
public final class Ipv4Config implements JsonSerializable {
    /*
     * The IPv4 address of the network adapter.
     */
    private String ipAddress;

    /*
     * The IPv4 subnet of the network adapter.
     */
    private String subnet;

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

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

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

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

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

                if ("ipAddress".equals(fieldName)) {
                    deserializedIpv4Config.ipAddress = reader.getString();
                } else if ("subnet".equals(fieldName)) {
                    deserializedIpv4Config.subnet = reader.getString();
                } else if ("gateway".equals(fieldName)) {
                    deserializedIpv4Config.gateway = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIpv4Config;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy