|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +// Code generated by Microsoft (R) TypeSpec Code Generator. |
| 4 | + |
| 5 | +package com.azure.resourcemanager.computefleet.fluent.models; |
| 6 | + |
| 7 | +import com.azure.core.annotation.Immutable; |
| 8 | +import com.azure.json.JsonReader; |
| 9 | +import com.azure.json.JsonSerializable; |
| 10 | +import com.azure.json.JsonToken; |
| 11 | +import com.azure.json.JsonWriter; |
| 12 | +import com.azure.resourcemanager.computefleet.models.ApiError; |
| 13 | +import com.azure.resourcemanager.computefleet.models.ProvisioningState; |
| 14 | +import java.io.IOException; |
| 15 | + |
| 16 | +/** |
| 17 | + * An AzureFleet's virtualMachineScaleSet. |
| 18 | + */ |
| 19 | +@Immutable |
| 20 | +public final class VirtualMachineScaleSetInner implements JsonSerializable<VirtualMachineScaleSetInner> { |
| 21 | + /* |
| 22 | + * The compute RP resource id of the virtualMachineScaleSet |
| 23 | + * "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}" |
| 24 | + */ |
| 25 | + private String id; |
| 26 | + |
| 27 | + /* |
| 28 | + * Type of the virtualMachineScaleSet |
| 29 | + */ |
| 30 | + private String type; |
| 31 | + |
| 32 | + /* |
| 33 | + * This represents the operationStatus of the VMSS in response to the last operation that was performed on it by |
| 34 | + * Azure Fleet resource. |
| 35 | + */ |
| 36 | + private ProvisioningState operationStatus; |
| 37 | + |
| 38 | + /* |
| 39 | + * Error Information when `operationStatus` is `Failed` |
| 40 | + */ |
| 41 | + private ApiError error; |
| 42 | + |
| 43 | + /** |
| 44 | + * Creates an instance of VirtualMachineScaleSetInner class. |
| 45 | + */ |
| 46 | + private VirtualMachineScaleSetInner() { |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Get the id property: The compute RP resource id of the virtualMachineScaleSet |
| 51 | + * "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}". |
| 52 | + * |
| 53 | + * @return the id value. |
| 54 | + */ |
| 55 | + public String id() { |
| 56 | + return this.id; |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Get the type property: Type of the virtualMachineScaleSet. |
| 61 | + * |
| 62 | + * @return the type value. |
| 63 | + */ |
| 64 | + public String type() { |
| 65 | + return this.type; |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * Get the operationStatus property: This represents the operationStatus of the VMSS in response to the last |
| 70 | + * operation that was performed on it by Azure Fleet resource. |
| 71 | + * |
| 72 | + * @return the operationStatus value. |
| 73 | + */ |
| 74 | + public ProvisioningState operationStatus() { |
| 75 | + return this.operationStatus; |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Get the error property: Error Information when `operationStatus` is `Failed`. |
| 80 | + * |
| 81 | + * @return the error value. |
| 82 | + */ |
| 83 | + public ApiError error() { |
| 84 | + return this.error; |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Validates the instance. |
| 89 | + * |
| 90 | + * @throws IllegalArgumentException thrown if the instance is not valid. |
| 91 | + */ |
| 92 | + public void validate() { |
| 93 | + if (error() != null) { |
| 94 | + error().validate(); |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * {@inheritDoc} |
| 100 | + */ |
| 101 | + @Override |
| 102 | + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { |
| 103 | + jsonWriter.writeStartObject(); |
| 104 | + return jsonWriter.writeEndObject(); |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * Reads an instance of VirtualMachineScaleSetInner from the JsonReader. |
| 109 | + * |
| 110 | + * @param jsonReader The JsonReader being read. |
| 111 | + * @return An instance of VirtualMachineScaleSetInner if the JsonReader was pointing to an instance of it, or null |
| 112 | + * if it was pointing to JSON null. |
| 113 | + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. |
| 114 | + * @throws IOException If an error occurs while reading the VirtualMachineScaleSetInner. |
| 115 | + */ |
| 116 | + public static VirtualMachineScaleSetInner fromJson(JsonReader jsonReader) throws IOException { |
| 117 | + return jsonReader.readObject(reader -> { |
| 118 | + VirtualMachineScaleSetInner deserializedVirtualMachineScaleSetInner = new VirtualMachineScaleSetInner(); |
| 119 | + while (reader.nextToken() != JsonToken.END_OBJECT) { |
| 120 | + String fieldName = reader.getFieldName(); |
| 121 | + reader.nextToken(); |
| 122 | + |
| 123 | + if ("id".equals(fieldName)) { |
| 124 | + deserializedVirtualMachineScaleSetInner.id = reader.getString(); |
| 125 | + } else if ("operationStatus".equals(fieldName)) { |
| 126 | + deserializedVirtualMachineScaleSetInner.operationStatus |
| 127 | + = ProvisioningState.fromString(reader.getString()); |
| 128 | + } else if ("type".equals(fieldName)) { |
| 129 | + deserializedVirtualMachineScaleSetInner.type = reader.getString(); |
| 130 | + } else if ("error".equals(fieldName)) { |
| 131 | + deserializedVirtualMachineScaleSetInner.error = ApiError.fromJson(reader); |
| 132 | + } else { |
| 133 | + reader.skipChildren(); |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + return deserializedVirtualMachineScaleSetInner; |
| 138 | + }); |
| 139 | + } |
| 140 | +} |
0 commit comments