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

com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkSegmentProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Avs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure VMware Solution API. Package tag package-2023-09-01.

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.avs.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.avs.models.SegmentStatusEnum;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentPortVif;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentProvisioningState;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentSubnet;
import java.io.IOException;
import java.util.List;

/**
 * NSX Segment Properties.
 */
@Fluent
public final class WorkloadNetworkSegmentProperties implements JsonSerializable {
    /*
     * Display name of the segment.
     */
    private String displayName;

    /*
     * Gateway which to connect segment to.
     */
    private String connectedGateway;

    /*
     * Subnet which to connect segment to.
     */
    private WorkloadNetworkSegmentSubnet subnet;

    /*
     * Port Vif which segment is associated with.
     */
    private List portVif;

    /*
     * Segment status.
     */
    private SegmentStatusEnum status;

    /*
     * The provisioning state
     */
    private WorkloadNetworkSegmentProvisioningState provisioningState;

    /*
     * NSX revision number.
     */
    private Long revision;

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

    /**
     * Get the displayName property: Display name of the segment.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: Display name of the segment.
     * 
     * @param displayName the displayName value to set.
     * @return the WorkloadNetworkSegmentProperties object itself.
     */
    public WorkloadNetworkSegmentProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the connectedGateway property: Gateway which to connect segment to.
     * 
     * @return the connectedGateway value.
     */
    public String connectedGateway() {
        return this.connectedGateway;
    }

    /**
     * Set the connectedGateway property: Gateway which to connect segment to.
     * 
     * @param connectedGateway the connectedGateway value to set.
     * @return the WorkloadNetworkSegmentProperties object itself.
     */
    public WorkloadNetworkSegmentProperties withConnectedGateway(String connectedGateway) {
        this.connectedGateway = connectedGateway;
        return this;
    }

    /**
     * Get the subnet property: Subnet which to connect segment to.
     * 
     * @return the subnet value.
     */
    public WorkloadNetworkSegmentSubnet subnet() {
        return this.subnet;
    }

    /**
     * Set the subnet property: Subnet which to connect segment to.
     * 
     * @param subnet the subnet value to set.
     * @return the WorkloadNetworkSegmentProperties object itself.
     */
    public WorkloadNetworkSegmentProperties withSubnet(WorkloadNetworkSegmentSubnet subnet) {
        this.subnet = subnet;
        return this;
    }

    /**
     * Get the portVif property: Port Vif which segment is associated with.
     * 
     * @return the portVif value.
     */
    public List portVif() {
        return this.portVif;
    }

    /**
     * Get the status property: Segment status.
     * 
     * @return the status value.
     */
    public SegmentStatusEnum status() {
        return this.status;
    }

    /**
     * Get the provisioningState property: The provisioning state.
     * 
     * @return the provisioningState value.
     */
    public WorkloadNetworkSegmentProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the revision property: NSX revision number.
     * 
     * @return the revision value.
     */
    public Long revision() {
        return this.revision;
    }

    /**
     * Set the revision property: NSX revision number.
     * 
     * @param revision the revision value to set.
     * @return the WorkloadNetworkSegmentProperties object itself.
     */
    public WorkloadNetworkSegmentProperties withRevision(Long revision) {
        this.revision = revision;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (subnet() != null) {
            subnet().validate();
        }
        if (portVif() != null) {
            portVif().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("displayName", this.displayName);
        jsonWriter.writeStringField("connectedGateway", this.connectedGateway);
        jsonWriter.writeJsonField("subnet", this.subnet);
        jsonWriter.writeNumberField("revision", this.revision);
        return jsonWriter.writeEndObject();
    }

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

                if ("displayName".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.displayName = reader.getString();
                } else if ("connectedGateway".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.connectedGateway = reader.getString();
                } else if ("subnet".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.subnet = WorkloadNetworkSegmentSubnet.fromJson(reader);
                } else if ("portVif".equals(fieldName)) {
                    List portVif
                        = reader.readArray(reader1 -> WorkloadNetworkSegmentPortVif.fromJson(reader1));
                    deserializedWorkloadNetworkSegmentProperties.portVif = portVif;
                } else if ("status".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.status
                        = SegmentStatusEnum.fromString(reader.getString());
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.provisioningState
                        = WorkloadNetworkSegmentProvisioningState.fromString(reader.getString());
                } else if ("revision".equals(fieldName)) {
                    deserializedWorkloadNetworkSegmentProperties.revision = reader.getNullable(JsonReader::getLong);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWorkloadNetworkSegmentProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy