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

com.azure.resourcemanager.compute.fluent.models.ProximityPlacementGroupProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.44.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.compute.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.compute.models.InstanceViewStatus;
import com.azure.resourcemanager.compute.models.ProximityPlacementGroupPropertiesIntent;
import com.azure.resourcemanager.compute.models.ProximityPlacementGroupType;
import com.azure.resourcemanager.compute.models.SubResourceWithColocationStatus;
import java.io.IOException;
import java.util.List;

/**
 * Describes the properties of a Proximity Placement Group.
 */
@Fluent
public final class ProximityPlacementGroupProperties implements JsonSerializable {
    /*
     * Specifies the type of the proximity placement group. Possible values are: **Standard** : Co-locate resources
     * within an Azure region or Availability Zone. **Ultra** : For future use.
     */
    private ProximityPlacementGroupType proximityPlacementGroupType;

    /*
     * A list of references to all virtual machines in the proximity placement group.
     */
    private List virtualMachines;

    /*
     * A list of references to all virtual machine scale sets in the proximity placement group.
     */
    private List virtualMachineScaleSets;

    /*
     * A list of references to all availability sets in the proximity placement group.
     */
    private List availabilitySets;

    /*
     * Describes colocation status of the Proximity Placement Group.
     */
    private InstanceViewStatus colocationStatus;

    /*
     * Specifies the user intent of the proximity placement group.
     */
    private ProximityPlacementGroupPropertiesIntent intent;

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

    /**
     * Get the proximityPlacementGroupType property: Specifies the type of the proximity placement group. Possible
     * values are: **Standard** : Co-locate resources within an Azure region or Availability Zone. **Ultra** : For
     * future use.
     * 
     * @return the proximityPlacementGroupType value.
     */
    public ProximityPlacementGroupType proximityPlacementGroupType() {
        return this.proximityPlacementGroupType;
    }

    /**
     * Set the proximityPlacementGroupType property: Specifies the type of the proximity placement group. Possible
     * values are: **Standard** : Co-locate resources within an Azure region or Availability Zone. **Ultra** : For
     * future use.
     * 
     * @param proximityPlacementGroupType the proximityPlacementGroupType value to set.
     * @return the ProximityPlacementGroupProperties object itself.
     */
    public ProximityPlacementGroupProperties
        withProximityPlacementGroupType(ProximityPlacementGroupType proximityPlacementGroupType) {
        this.proximityPlacementGroupType = proximityPlacementGroupType;
        return this;
    }

    /**
     * Get the virtualMachines property: A list of references to all virtual machines in the proximity placement group.
     * 
     * @return the virtualMachines value.
     */
    public List virtualMachines() {
        return this.virtualMachines;
    }

    /**
     * Get the virtualMachineScaleSets property: A list of references to all virtual machine scale sets in the proximity
     * placement group.
     * 
     * @return the virtualMachineScaleSets value.
     */
    public List virtualMachineScaleSets() {
        return this.virtualMachineScaleSets;
    }

    /**
     * Get the availabilitySets property: A list of references to all availability sets in the proximity placement
     * group.
     * 
     * @return the availabilitySets value.
     */
    public List availabilitySets() {
        return this.availabilitySets;
    }

    /**
     * Get the colocationStatus property: Describes colocation status of the Proximity Placement Group.
     * 
     * @return the colocationStatus value.
     */
    public InstanceViewStatus colocationStatus() {
        return this.colocationStatus;
    }

    /**
     * Set the colocationStatus property: Describes colocation status of the Proximity Placement Group.
     * 
     * @param colocationStatus the colocationStatus value to set.
     * @return the ProximityPlacementGroupProperties object itself.
     */
    public ProximityPlacementGroupProperties withColocationStatus(InstanceViewStatus colocationStatus) {
        this.colocationStatus = colocationStatus;
        return this;
    }

    /**
     * Get the intent property: Specifies the user intent of the proximity placement group.
     * 
     * @return the intent value.
     */
    public ProximityPlacementGroupPropertiesIntent intent() {
        return this.intent;
    }

    /**
     * Set the intent property: Specifies the user intent of the proximity placement group.
     * 
     * @param intent the intent value to set.
     * @return the ProximityPlacementGroupProperties object itself.
     */
    public ProximityPlacementGroupProperties withIntent(ProximityPlacementGroupPropertiesIntent intent) {
        this.intent = intent;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("proximityPlacementGroupType",
            this.proximityPlacementGroupType == null ? null : this.proximityPlacementGroupType.toString());
        jsonWriter.writeJsonField("colocationStatus", this.colocationStatus);
        jsonWriter.writeJsonField("intent", this.intent);
        return jsonWriter.writeEndObject();
    }

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

                if ("proximityPlacementGroupType".equals(fieldName)) {
                    deserializedProximityPlacementGroupProperties.proximityPlacementGroupType
                        = ProximityPlacementGroupType.fromString(reader.getString());
                } else if ("virtualMachines".equals(fieldName)) {
                    List virtualMachines
                        = reader.readArray(reader1 -> SubResourceWithColocationStatus.fromJson(reader1));
                    deserializedProximityPlacementGroupProperties.virtualMachines = virtualMachines;
                } else if ("virtualMachineScaleSets".equals(fieldName)) {
                    List virtualMachineScaleSets
                        = reader.readArray(reader1 -> SubResourceWithColocationStatus.fromJson(reader1));
                    deserializedProximityPlacementGroupProperties.virtualMachineScaleSets = virtualMachineScaleSets;
                } else if ("availabilitySets".equals(fieldName)) {
                    List availabilitySets
                        = reader.readArray(reader1 -> SubResourceWithColocationStatus.fromJson(reader1));
                    deserializedProximityPlacementGroupProperties.availabilitySets = availabilitySets;
                } else if ("colocationStatus".equals(fieldName)) {
                    deserializedProximityPlacementGroupProperties.colocationStatus
                        = InstanceViewStatus.fromJson(reader);
                } else if ("intent".equals(fieldName)) {
                    deserializedProximityPlacementGroupProperties.intent
                        = ProximityPlacementGroupPropertiesIntent.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedProximityPlacementGroupProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy