Beispiel #1
0
        internal static DedicatedHostInstanceView DeserializeDedicatedHostInstanceView(JsonElement element)
        {
            string assetId = default;
            DedicatedHostAvailableCapacity availableCapacity = default;
            IList <InstanceViewStatus>     statuses          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("assetId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    assetId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("availableCapacity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    availableCapacity = DedicatedHostAvailableCapacity.DeserializeDedicatedHostAvailableCapacity(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new DedicatedHostInstanceView(assetId, availableCapacity, statuses));
        }
        internal static VirtualMachineHealthStatus DeserializeVirtualMachineHealthStatus(JsonElement element)
        {
            Optional <InstanceViewStatus> status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("status"))
                {
                    status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineHealthStatus(status.Value));
        }
        internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExtensionInstanceView(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> type = default;
            Optional <string> typeHandlerVersion = default;
            Optional <IList <InstanceViewStatus> > substatuses = default;
            Optional <IList <InstanceViewStatus> > statuses    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("typeHandlerVersion"))
                {
                    typeHandlerVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("substatuses"))
                {
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    substatuses = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineExtensionInstanceView(name.Value, type.Value, typeHandlerVersion.Value, Optional.ToList(substatuses), Optional.ToList(statuses)));
        }
        internal static DedicatedHostInstanceViewWithName DeserializeDedicatedHostInstanceViewWithName(JsonElement element)
        {
            Optional <string> name    = default;
            Optional <string> assetId = default;
            Optional <DedicatedHostAvailableCapacity>      availableCapacity = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("assetId"))
                {
                    assetId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("availableCapacity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    availableCapacity = DedicatedHostAvailableCapacity.DeserializeDedicatedHostAvailableCapacity(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new DedicatedHostInstanceViewWithName(assetId.Value, availableCapacity.Value, Optional.ToList(statuses), name.Value));
        }
Beispiel #5
0
        internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScaleSetInstanceView(JsonElement element)
        {
            Optional <VirtualMachineScaleSetInstanceViewStatusesSummary>          virtualMachine = default;
            Optional <IReadOnlyList <VirtualMachineScaleSetVMExtensionsSummary> > extensions     = default;
            Optional <IReadOnlyList <InstanceViewStatus> >          statuses = default;
            Optional <IReadOnlyList <OrchestrationServiceSummary> > orchestrationServices = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("virtualMachine"))
                {
                    virtualMachine = VirtualMachineScaleSetInstanceViewStatusesSummary.DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(property.Value);
                    continue;
                }
                if (property.NameEquals("extensions"))
                {
                    List <VirtualMachineScaleSetVMExtensionsSummary> array = new List <VirtualMachineScaleSetVMExtensionsSummary>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualMachineScaleSetVMExtensionsSummary.DeserializeVirtualMachineScaleSetVMExtensionsSummary(item));
                    }
                    extensions = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
                if (property.NameEquals("orchestrationServices"))
                {
                    List <OrchestrationServiceSummary> array = new List <OrchestrationServiceSummary>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OrchestrationServiceSummary.DeserializeOrchestrationServiceSummary(item));
                    }
                    orchestrationServices = array;
                    continue;
                }
            }
            return(new VirtualMachineScaleSetInstanceView(virtualMachine.Value, Optional.ToList(extensions), Optional.ToList(statuses), Optional.ToList(orchestrationServices)));
        }
Beispiel #6
0
        internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element)
        {
            Optional <string> name = default;
            Optional <IReadOnlyList <DiskEncryptionSettings> > encryptionSettings = default;
            Optional <IReadOnlyList <InstanceViewStatus> >     statuses           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <DiskEncryptionSettings> array = new List <DiskEncryptionSettings>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DiskEncryptionSettings.DeserializeDiskEncryptionSettings(item));
                    }
                    encryptionSettings = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new DiskInstanceView(name.Value, Optional.ToList(encryptionSettings), Optional.ToList(statuses)));
        }
        internal static VirtualMachinePatchStatus DeserializeVirtualMachinePatchStatus(JsonElement element)
        {
            Optional <AvailablePatchSummary>               availablePatchSummary        = default;
            Optional <LastPatchInstallationSummary>        lastPatchInstallationSummary = default;
            Optional <IReadOnlyList <InstanceViewStatus> > configurationStatuses        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("availablePatchSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    availablePatchSummary = AvailablePatchSummary.DeserializeAvailablePatchSummary(property.Value);
                    continue;
                }
                if (property.NameEquals("lastPatchInstallationSummary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastPatchInstallationSummary = LastPatchInstallationSummary.DeserializeLastPatchInstallationSummary(property.Value);
                    continue;
                }
                if (property.NameEquals("configurationStatuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    configurationStatuses = array;
                    continue;
                }
            }
            return(new VirtualMachinePatchStatus(availablePatchSummary.Value, lastPatchInstallationSummary.Value, Optional.ToList(configurationStatuses)));
        }
        internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element)
        {
            Optional <string> vmAgentVersion = default;
            Optional <IReadOnlyList <VirtualMachineExtensionHandlerInstanceView> > extensionHandlers = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("vmAgentVersion"))
                {
                    vmAgentVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extensionHandlers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <VirtualMachineExtensionHandlerInstanceView> array = new List <VirtualMachineExtensionHandlerInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualMachineExtensionHandlerInstanceView.DeserializeVirtualMachineExtensionHandlerInstanceView(item));
                    }
                    extensionHandlers = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineAgentInstanceView(vmAgentVersion.Value, Optional.ToList(extensionHandlers), Optional.ToList(statuses)));
        }
Beispiel #9
0
        internal static RunCommandResult DeserializeRunCommandResult(JsonElement element)
        {
            Optional <IReadOnlyList <InstanceViewStatus> > value = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    value = array;
                    continue;
                }
            }
            return(new RunCommandResult(Optional.ToList(value)));
        }
Beispiel #10
0
        internal static SubResourceWithColocationStatus DeserializeSubResourceWithColocationStatus(JsonElement element)
        {
            Optional <InstanceViewStatus> colocationStatus = default;
            Optional <string>             id = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("colocationStatus"))
                {
                    colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
            }
            return(new SubResourceWithColocationStatus(id.Value, colocationStatus.Value));
        }
Beispiel #11
0
        internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceView(JsonElement element)
        {
            Optional <Uri> consoleScreenshotBlobUri = default;
            Optional <Uri> serialConsoleLogBlobUri  = default;
            Optional <InstanceViewStatus> status    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("consoleScreenshotBlobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        consoleScreenshotBlobUri = null;
                        continue;
                    }
                    consoleScreenshotBlobUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("serialConsoleLogBlobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        serialConsoleLogBlobUri = null;
                        continue;
                    }
                    serialConsoleLogBlobUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value);
                    continue;
                }
            }
            return(new BootDiagnosticsInstanceView(consoleScreenshotBlobUri.Value, serialConsoleLogBlobUri.Value, status.Value));
        }
        internal static CapacityReservationInstanceViewWithName DeserializeCapacityReservationInstanceViewWithName(JsonElement element)
        {
            Optional <string> name = default;
            Optional <CapacityReservationUtilization>      utilizationInfo = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("utilizationInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    utilizationInfo = CapacityReservationUtilization.DeserializeCapacityReservationUtilization(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new CapacityReservationInstanceViewWithName(utilizationInfo.Value, Optional.ToList(statuses), name.Value));
        }
Beispiel #13
0
        internal static RestorePointInstanceView DeserializeRestorePointInstanceView(JsonElement element)
        {
            Optional <IReadOnlyList <DiskRestorePointInstanceView> > diskRestorePoints = default;
            Optional <IReadOnlyList <InstanceViewStatus> >           statuses          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("diskRestorePoints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <DiskRestorePointInstanceView> array = new List <DiskRestorePointInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DiskRestorePointInstanceView.DeserializeDiskRestorePointInstanceView(item));
                    }
                    diskRestorePoints = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new RestorePointInstanceView(Optional.ToList(diskRestorePoints), Optional.ToList(statuses)));
        }
        internal static BootDiagnosticsInstanceView DeserializeBootDiagnosticsInstanceView(JsonElement element)
        {
            string             consoleScreenshotBlobUri = default;
            string             serialConsoleLogBlobUri  = default;
            InstanceViewStatus status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("consoleScreenshotBlobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    consoleScreenshotBlobUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("serialConsoleLogBlobUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    serialConsoleLogBlobUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value);
                    continue;
                }
            }
            return(new BootDiagnosticsInstanceView(consoleScreenshotBlobUri, serialConsoleLogBlobUri, status));
        }
Beispiel #15
0
        internal static VirtualMachineExtensionHandlerInstanceView DeserializeVirtualMachineExtensionHandlerInstanceView(JsonElement element)
        {
            string             type = default;
            string             typeHandlerVersion = default;
            InstanceViewStatus status             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("typeHandlerVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    typeHandlerVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    status = InstanceViewStatus.DeserializeInstanceViewStatus(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineExtensionHandlerInstanceView(type, typeHandlerVersion, status));
        }
Beispiel #16
0
        internal static VirtualMachineExtensionInstanceView DeserializeVirtualMachineExtensionInstanceView(JsonElement element)
        {
            string name = default;
            string type = default;
            string typeHandlerVersion = default;
            IList <InstanceViewStatus> substatuses = default;
            IList <InstanceViewStatus> statuses    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("typeHandlerVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    typeHandlerVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("substatuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    substatuses = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineExtensionInstanceView(name, type, typeHandlerVersion, substatuses, statuses));
        }
Beispiel #17
0
        internal static DiskInstanceView DeserializeDiskInstanceView(JsonElement element)
        {
            string name = default;
            IList <DiskEncryptionSettings> encryptionSettings = default;
            IList <InstanceViewStatus>     statuses           = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("encryptionSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <DiskEncryptionSettings> array = new List <DiskEncryptionSettings>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(DiskEncryptionSettings.DeserializeDiskEncryptionSettings(item));
                        }
                    }
                    encryptionSettings = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new DiskInstanceView(name, encryptionSettings, statuses));
        }
Beispiel #18
0
        internal static AvailabilitySet DeserializeAvailabilitySet(JsonElement element)
        {
            Optional <Sku>    sku      = default;
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            string            location = default;
            Optional <IDictionary <string, string> > tags           = default;
            Optional <int> platformUpdateDomainCount                = default;
            Optional <int> platformFaultDomainCount                 = default;
            Optional <IList <SubResource> > virtualMachines         = default;
            Optional <SubResource>          proximityPlacementGroup = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("platformUpdateDomainCount"))
                        {
                            platformUpdateDomainCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("platformFaultDomainCount"))
                        {
                            platformFaultDomainCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("virtualMachines"))
                        {
                            List <SubResource> array = new List <SubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResource.DeserializeSubResource(item));
                            }
                            virtualMachines = array;
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            proximityPlacementGroup = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("statuses"))
                        {
                            List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                            }
                            statuses = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AvailabilitySet(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup.Value, Optional.ToList(statuses)));
        }
Beispiel #19
0
 internal ComputeSubResourceDataWithColocationStatus(ResourceIdentifier id, InstanceViewStatus colocationStatus) : base(id)
 {
     ColocationStatus = colocationStatus;
 }
Beispiel #20
0
 internal BootDiagnosticsInstanceView(Uri consoleScreenshotBlobUri, Uri serialConsoleLogBlobUri, InstanceViewStatus status)
 {
     ConsoleScreenshotBlobUri = consoleScreenshotBlobUri;
     SerialConsoleLogBlobUri  = serialConsoleLogBlobUri;
     Status = status;
 }
        internal static VirtualMachineAgentInstanceView DeserializeVirtualMachineAgentInstanceView(JsonElement element)
        {
            string vmAgentVersion = default;
            IList <VirtualMachineExtensionHandlerInstanceView> extensionHandlers = default;
            IList <InstanceViewStatus> statuses = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("vmAgentVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vmAgentVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extensionHandlers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <VirtualMachineExtensionHandlerInstanceView> array = new List <VirtualMachineExtensionHandlerInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(VirtualMachineExtensionHandlerInstanceView.DeserializeVirtualMachineExtensionHandlerInstanceView(item));
                        }
                    }
                    extensionHandlers = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineAgentInstanceView(vmAgentVersion, extensionHandlers, statuses));
        }
Beispiel #22
0
        internal static VirtualMachineInstanceView DeserializeVirtualMachineInstanceView(JsonElement element)
        {
            int?   platformUpdateDomain = default;
            int?   platformFaultDomain  = default;
            string computerName         = default;
            string osName    = default;
            string osVersion = default;
            HyperVGenerationType?hyperVGeneration = default;
            string rdpThumbPrint = default;
            VirtualMachineAgentInstanceView             vmAgent = default;
            MaintenanceRedeployStatus                   maintenanceRedeployStatus = default;
            IList <DiskInstanceView>                    disks           = default;
            IList <VirtualMachineExtensionInstanceView> extensions      = default;
            BootDiagnosticsInstanceView                 bootDiagnostics = default;
            IList <InstanceViewStatus>                  statuses        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("platformUpdateDomain"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    platformUpdateDomain = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("platformFaultDomain"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    platformFaultDomain = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("computerName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    computerName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("osName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("osVersion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("hyperVGeneration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    hyperVGeneration = new HyperVGenerationType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("rdpThumbPrint"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    rdpThumbPrint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vmAgent"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vmAgent = VirtualMachineAgentInstanceView.DeserializeVirtualMachineAgentInstanceView(property.Value);
                    continue;
                }
                if (property.NameEquals("maintenanceRedeployStatus"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    maintenanceRedeployStatus = MaintenanceRedeployStatus.DeserializeMaintenanceRedeployStatus(property.Value);
                    continue;
                }
                if (property.NameEquals("disks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <DiskInstanceView> array = new List <DiskInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(DiskInstanceView.DeserializeDiskInstanceView(item));
                        }
                    }
                    disks = array;
                    continue;
                }
                if (property.NameEquals("extensions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <VirtualMachineExtensionInstanceView> array = new List <VirtualMachineExtensionInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanceView(item));
                        }
                    }
                    extensions = array;
                    continue;
                }
                if (property.NameEquals("bootDiagnostics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    bootDiagnostics = BootDiagnosticsInstanceView.DeserializeBootDiagnosticsInstanceView(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineInstanceView(platformUpdateDomain, platformFaultDomain, computerName, osName, osVersion, hyperVGeneration, rdpThumbPrint, vmAgent, maintenanceRedeployStatus, disks, extensions, bootDiagnostics, statuses));
        }
Beispiel #23
0
        internal static ProximityPlacementGroup DeserializeProximityPlacementGroup(JsonElement element)
        {
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string>            tags = default;
            ProximityPlacementGroupType?            proximityPlacementGroupType = default;
            IList <SubResourceWithColocationStatus> virtualMachines             = default;
            IList <SubResourceWithColocationStatus> virtualMachineScaleSets     = default;
            IList <SubResourceWithColocationStatus> availabilitySets            = default;
            InstanceViewStatus colocationStatus = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("proximityPlacementGroupType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            proximityPlacementGroupType = new ProximityPlacementGroupType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualMachines"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                                }
                            }
                            virtualMachines = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineScaleSets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                                }
                            }
                            virtualMachineScaleSets = array;
                            continue;
                        }
                        if (property0.NameEquals("availabilitySets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                                }
                            }
                            availabilitySets = array;
                            continue;
                        }
                        if (property0.NameEquals("colocationStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ProximityPlacementGroup(id, name, type, location, tags, proximityPlacementGroupType, virtualMachines, virtualMachineScaleSets, availabilitySets, colocationStatus));
        }
Beispiel #24
0
        internal static VirtualMachineScaleSetInstanceView DeserializeVirtualMachineScaleSetInstanceView(JsonElement element)
        {
            VirtualMachineScaleSetInstanceViewStatusesSummary         virtualMachine = default;
            IReadOnlyList <VirtualMachineScaleSetVMExtensionsSummary> extensions     = default;
            IReadOnlyList <InstanceViewStatus>          statuses = default;
            IReadOnlyList <OrchestrationServiceSummary> orchestrationServices = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("virtualMachine"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    virtualMachine = VirtualMachineScaleSetInstanceViewStatusesSummary.DeserializeVirtualMachineScaleSetInstanceViewStatusesSummary(property.Value);
                    continue;
                }
                if (property.NameEquals("extensions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <VirtualMachineScaleSetVMExtensionsSummary> array = new List <VirtualMachineScaleSetVMExtensionsSummary>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(VirtualMachineScaleSetVMExtensionsSummary.DeserializeVirtualMachineScaleSetVMExtensionsSummary(item));
                        }
                    }
                    extensions = array;
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                        }
                    }
                    statuses = array;
                    continue;
                }
                if (property.NameEquals("orchestrationServices"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OrchestrationServiceSummary> array = new List <OrchestrationServiceSummary>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(OrchestrationServiceSummary.DeserializeOrchestrationServiceSummary(item));
                        }
                    }
                    orchestrationServices = array;
                    continue;
                }
            }
            return(new VirtualMachineScaleSetInstanceView(virtualMachine, extensions, statuses, orchestrationServices));
        }
Beispiel #25
0
        internal static VirtualMachineRunCommandInstanceView DeserializeVirtualMachineRunCommandInstanceView(JsonElement element)
        {
            Optional <ExecutionState> executionState   = default;
            Optional <string>         executionMessage = default;
            Optional <int>            exitCode         = default;
            Optional <string>         output           = default;
            Optional <string>         error            = default;
            Optional <DateTimeOffset> startTime        = default;
            Optional <DateTimeOffset> endTime          = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("executionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    executionState = new ExecutionState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("executionMessage"))
                {
                    executionMessage = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("exitCode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    exitCode = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("output"))
                {
                    output = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    error = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("startTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    startTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    endTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new VirtualMachineRunCommandInstanceView(Optional.ToNullable(executionState), executionMessage.Value, Optional.ToNullable(exitCode), output.Value, error.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime), Optional.ToList(statuses)));
        }
 internal SubResourceWithColocationStatus(string id, InstanceViewStatus colocationStatus) : base(id)
 {
     ColocationStatus = colocationStatus;
 }
        internal static VirtualMachineScaleSetVMInstanceView DeserializeVirtualMachineScaleSetVMInstanceView(JsonElement element)
        {
            Optional <int>    platformUpdateDomain = default;
            Optional <int>    platformFaultDomain  = default;
            Optional <string> rdpThumbPrint        = default;
            Optional <VirtualMachineAgentInstanceView>   vmAgent = default;
            Optional <MaintenanceRedeployStatus>         maintenanceRedeployStatus = default;
            Optional <IReadOnlyList <DiskInstanceView> > disks = default;
            Optional <IReadOnlyList <VirtualMachineExtensionInstanceView> > extensions = default;
            Optional <VirtualMachineHealthStatus>          vmHealth        = default;
            Optional <BootDiagnosticsInstanceView>         bootDiagnostics = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses        = default;
            Optional <string> placementGroupId = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("platformUpdateDomain"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    platformUpdateDomain = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("platformFaultDomain"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    platformFaultDomain = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("rdpThumbPrint"))
                {
                    rdpThumbPrint = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vmAgent"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    vmAgent = VirtualMachineAgentInstanceView.DeserializeVirtualMachineAgentInstanceView(property.Value);
                    continue;
                }
                if (property.NameEquals("maintenanceRedeployStatus"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    maintenanceRedeployStatus = MaintenanceRedeployStatus.DeserializeMaintenanceRedeployStatus(property.Value);
                    continue;
                }
                if (property.NameEquals("disks"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <DiskInstanceView> array = new List <DiskInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(DiskInstanceView.DeserializeDiskInstanceView(item));
                    }
                    disks = array;
                    continue;
                }
                if (property.NameEquals("extensions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <VirtualMachineExtensionInstanceView> array = new List <VirtualMachineExtensionInstanceView>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanceView(item));
                    }
                    extensions = array;
                    continue;
                }
                if (property.NameEquals("vmHealth"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    vmHealth = VirtualMachineHealthStatus.DeserializeVirtualMachineHealthStatus(property.Value);
                    continue;
                }
                if (property.NameEquals("bootDiagnostics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    bootDiagnostics = BootDiagnosticsInstanceView.DeserializeBootDiagnosticsInstanceView(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
                if (property.NameEquals("placementGroupId"))
                {
                    placementGroupId = property.Value.GetString();
                    continue;
                }
            }
            return(new VirtualMachineScaleSetVMInstanceView(Optional.ToNullable(platformUpdateDomain), Optional.ToNullable(platformFaultDomain), rdpThumbPrint.Value, vmAgent.Value, maintenanceRedeployStatus.Value, Optional.ToList(disks), Optional.ToList(extensions), vmHealth.Value, bootDiagnostics.Value, Optional.ToList(statuses), placementGroupId.Value));
        }
        internal static ProximityPlacementGroup DeserializeProximityPlacementGroup(JsonElement element)
        {
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            string            location = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <ProximityPlacementGroupType>   proximityPlacementGroupType                = default;
            Optional <IReadOnlyList <SubResourceWithColocationStatus> > virtualMachines         = default;
            Optional <IReadOnlyList <SubResourceWithColocationStatus> > virtualMachineScaleSets = default;
            Optional <IReadOnlyList <SubResourceWithColocationStatus> > availabilitySets        = default;
            Optional <InstanceViewStatus> colocationStatus = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("proximityPlacementGroupType"))
                        {
                            proximityPlacementGroupType = new ProximityPlacementGroupType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("virtualMachines"))
                        {
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                            }
                            virtualMachines = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineScaleSets"))
                        {
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                            }
                            virtualMachineScaleSets = array;
                            continue;
                        }
                        if (property0.NameEquals("availabilitySets"))
                        {
                            List <SubResourceWithColocationStatus> array = new List <SubResourceWithColocationStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SubResourceWithColocationStatus.DeserializeSubResourceWithColocationStatus(item));
                            }
                            availabilitySets = array;
                            continue;
                        }
                        if (property0.NameEquals("colocationStatus"))
                        {
                            colocationStatus = InstanceViewStatus.DeserializeInstanceViewStatus(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ProximityPlacementGroup(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), Optional.ToNullable(proximityPlacementGroupType), Optional.ToList(virtualMachines), Optional.ToList(virtualMachineScaleSets), Optional.ToList(availabilitySets), colocationStatus.Value));
        }
Beispiel #29
0
 internal ProximityPlacementGroup(string id, string name, string type, string location, IDictionary <string, string> tags, ProximityPlacementGroupType?proximityPlacementGroupType, IReadOnlyList <SubResourceWithColocationStatus> virtualMachines, IReadOnlyList <SubResourceWithColocationStatus> virtualMachineScaleSets, IReadOnlyList <SubResourceWithColocationStatus> availabilitySets, InstanceViewStatus colocationStatus) : base(id, name, type, location, tags)
 {
     ProximityPlacementGroupType = proximityPlacementGroupType;
     VirtualMachines             = virtualMachines;
     VirtualMachineScaleSets     = virtualMachineScaleSets;
     AvailabilitySets            = availabilitySets;
     ColocationStatus            = colocationStatus;
 }
        internal static AvailabilitySet DeserializeAvailabilitySet(JsonElement element)
        {
            Sku    sku      = default;
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string> tags                  = default;
            int?platformUpdateDomainCount                      = default;
            int?platformFaultDomainCount                       = default;
            IList <SubResource>        virtualMachines         = default;
            SubResource                proximityPlacementGroup = default;
            IList <InstanceViewStatus> statuses                = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("platformUpdateDomainCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            platformUpdateDomainCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("platformFaultDomainCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            platformFaultDomainCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("virtualMachines"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <SubResource> array = new List <SubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(SubResource.DeserializeSubResource(item));
                                }
                            }
                            virtualMachines = array;
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            proximityPlacementGroup = SubResource.DeserializeSubResource(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("statuses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                if (item.ValueKind == JsonValueKind.Null)
                                {
                                    array.Add(null);
                                }
                                else
                                {
                                    array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                                }
                            }
                            statuses = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AvailabilitySet(id, name, type, location, tags, sku, platformUpdateDomainCount, platformFaultDomainCount, virtualMachines, proximityPlacementGroup, statuses));
        }