Ejemplo n.º 1
0
        internal static VirtualMachineScaleSetVMProfile DeserializeVirtualMachineScaleSetVMProfile(JsonElement element)
        {
            Optional <VirtualMachineScaleSetOSProfile>      osProfile      = default;
            Optional <VirtualMachineScaleSetStorageProfile> storageProfile = default;
            Optional <VirtualMachineScaleSetNetworkProfile> networkProfile = default;
            Optional <DiagnosticsProfile> diagnosticsProfile = default;
            Optional <VirtualMachineScaleSetExtensionProfile> extensionProfile = default;
            Optional <string> licenseType = default;
            Optional <VirtualMachinePriorityTypes>       priority       = default;
            Optional <VirtualMachineEvictionPolicyTypes> evictionPolicy = default;
            Optional <BillingProfile>         billingProfile            = default;
            Optional <ScheduledEventsProfile> scheduledEventsProfile    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osProfile"))
                {
                    osProfile = VirtualMachineScaleSetOSProfile.DeserializeVirtualMachineScaleSetOSProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("storageProfile"))
                {
                    storageProfile = VirtualMachineScaleSetStorageProfile.DeserializeVirtualMachineScaleSetStorageProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("networkProfile"))
                {
                    networkProfile = VirtualMachineScaleSetNetworkProfile.DeserializeVirtualMachineScaleSetNetworkProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("diagnosticsProfile"))
                {
                    diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("extensionProfile"))
                {
                    extensionProfile = VirtualMachineScaleSetExtensionProfile.DeserializeVirtualMachineScaleSetExtensionProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("licenseType"))
                {
                    licenseType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("priority"))
                {
                    priority = new VirtualMachinePriorityTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("evictionPolicy"))
                {
                    evictionPolicy = new VirtualMachineEvictionPolicyTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("billingProfile"))
                {
                    billingProfile = BillingProfile.DeserializeBillingProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("scheduledEventsProfile"))
                {
                    scheduledEventsProfile = ScheduledEventsProfile.DeserializeScheduledEventsProfile(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineScaleSetVMProfile(osProfile.Value, storageProfile.Value, networkProfile.Value, diagnosticsProfile.Value, extensionProfile.Value, licenseType.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, scheduledEventsProfile.Value));
        }
Ejemplo n.º 2
0
        internal static VirtualMachineScaleSetVMProfile DeserializeVirtualMachineScaleSetVMProfile(JsonElement element)
        {
            VirtualMachineScaleSetOSProfile      osProfile      = default;
            VirtualMachineScaleSetStorageProfile storageProfile = default;
            VirtualMachineScaleSetNetworkProfile networkProfile = default;
            DiagnosticsProfile diagnosticsProfile = default;
            VirtualMachineScaleSetExtensionProfile extensionProfile = default;
            string licenseType = default;
            VirtualMachinePriorityTypes?      priority       = default;
            VirtualMachineEvictionPolicyTypes?evictionPolicy = default;
            BillingProfile         billingProfile            = default;
            ScheduledEventsProfile scheduledEventsProfile    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("osProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    osProfile = VirtualMachineScaleSetOSProfile.DeserializeVirtualMachineScaleSetOSProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("storageProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    storageProfile = VirtualMachineScaleSetStorageProfile.DeserializeVirtualMachineScaleSetStorageProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("networkProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkProfile = VirtualMachineScaleSetNetworkProfile.DeserializeVirtualMachineScaleSetNetworkProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("diagnosticsProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("extensionProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    extensionProfile = VirtualMachineScaleSetExtensionProfile.DeserializeVirtualMachineScaleSetExtensionProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("licenseType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    licenseType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("priority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    priority = new VirtualMachinePriorityTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("evictionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    evictionPolicy = new VirtualMachineEvictionPolicyTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("billingProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    billingProfile = BillingProfile.DeserializeBillingProfile(property.Value);
                    continue;
                }
                if (property.NameEquals("scheduledEventsProfile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    scheduledEventsProfile = ScheduledEventsProfile.DeserializeScheduledEventsProfile(property.Value);
                    continue;
                }
            }
            return(new VirtualMachineScaleSetVMProfile(osProfile, storageProfile, networkProfile, diagnosticsProfile, extensionProfile, licenseType, priority, evictionPolicy, billingProfile, scheduledEventsProfile));
        }