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

com.azure.resourcemanager.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Service Fabric Managed Clusters Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Managed Clusters Management Client. Package tag package-2024-04.

There is a newer version: 1.0.0
Show 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.servicefabricmanagedclusters.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
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;
import java.util.List;

/**
 * Specifies the settings for a network interface to attach to the node type.
 */
@Fluent
public final class AdditionalNetworkInterfaceConfiguration
    implements JsonSerializable {
    /*
     * Name of the network interface.
     */
    private String name;

    /*
     * Specifies whether the network interface is accelerated networking-enabled.
     */
    private Boolean enableAcceleratedNetworking;

    /*
     * Specifies the DSCP configuration to apply to the network interface.
     */
    private SubResource dscpConfiguration;

    /*
     * Specifies the IP configurations of the network interface.
     */
    private List ipConfigurations;

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

    /**
     * Get the name property: Name of the network interface.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the network interface.
     * 
     * @param name the name value to set.
     * @return the AdditionalNetworkInterfaceConfiguration object itself.
     */
    public AdditionalNetworkInterfaceConfiguration withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated
     * networking-enabled.
     * 
     * @return the enableAcceleratedNetworking value.
     */
    public Boolean enableAcceleratedNetworking() {
        return this.enableAcceleratedNetworking;
    }

    /**
     * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated
     * networking-enabled.
     * 
     * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set.
     * @return the AdditionalNetworkInterfaceConfiguration object itself.
     */
    public AdditionalNetworkInterfaceConfiguration
        withEnableAcceleratedNetworking(Boolean enableAcceleratedNetworking) {
        this.enableAcceleratedNetworking = enableAcceleratedNetworking;
        return this;
    }

    /**
     * Get the dscpConfiguration property: Specifies the DSCP configuration to apply to the network interface.
     * 
     * @return the dscpConfiguration value.
     */
    public SubResource dscpConfiguration() {
        return this.dscpConfiguration;
    }

    /**
     * Set the dscpConfiguration property: Specifies the DSCP configuration to apply to the network interface.
     * 
     * @param dscpConfiguration the dscpConfiguration value to set.
     * @return the AdditionalNetworkInterfaceConfiguration object itself.
     */
    public AdditionalNetworkInterfaceConfiguration withDscpConfiguration(SubResource dscpConfiguration) {
        this.dscpConfiguration = dscpConfiguration;
        return this;
    }

    /**
     * Get the ipConfigurations property: Specifies the IP configurations of the network interface.
     * 
     * @return the ipConfigurations value.
     */
    public List ipConfigurations() {
        return this.ipConfigurations;
    }

    /**
     * Set the ipConfigurations property: Specifies the IP configurations of the network interface.
     * 
     * @param ipConfigurations the ipConfigurations value to set.
     * @return the AdditionalNetworkInterfaceConfiguration object itself.
     */
    public AdditionalNetworkInterfaceConfiguration withIpConfigurations(List ipConfigurations) {
        this.ipConfigurations = ipConfigurations;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (name() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property name in model AdditionalNetworkInterfaceConfiguration"));
        }
        if (ipConfigurations() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property ipConfigurations in model AdditionalNetworkInterfaceConfiguration"));
        } else {
            ipConfigurations().forEach(e -> e.validate());
        }
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeArrayField("ipConfigurations", this.ipConfigurations,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeBooleanField("enableAcceleratedNetworking", this.enableAcceleratedNetworking);
        jsonWriter.writeJsonField("dscpConfiguration", this.dscpConfiguration);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedAdditionalNetworkInterfaceConfiguration.name = reader.getString();
                } else if ("ipConfigurations".equals(fieldName)) {
                    List ipConfigurations
                        = reader.readArray(reader1 -> IpConfiguration.fromJson(reader1));
                    deserializedAdditionalNetworkInterfaceConfiguration.ipConfigurations = ipConfigurations;
                } else if ("enableAcceleratedNetworking".equals(fieldName)) {
                    deserializedAdditionalNetworkInterfaceConfiguration.enableAcceleratedNetworking
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("dscpConfiguration".equals(fieldName)) {
                    deserializedAdditionalNetworkInterfaceConfiguration.dscpConfiguration
                        = SubResource.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAdditionalNetworkInterfaceConfiguration;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy