Beispiel #1
0
        internal static VirtualMachineSecrets DeserializeVirtualMachineSecrets(JsonElement element)
        {
            Optional <VirtualMachineSshCredentials> administratorAccount = default;
            ComputeType computeType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("administratorAccount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    administratorAccount = VirtualMachineSshCredentials.DeserializeVirtualMachineSshCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("computeType"))
                {
                    computeType = new ComputeType(property.Value.GetString());
                    continue;
                }
            }
            return(new VirtualMachineSecrets(computeType, administratorAccount.Value));
        }
Beispiel #2
0
        internal static HDInsightProperties DeserializeHDInsightProperties(JsonElement element)
        {
            Optional <int>    sshPort = default;
            Optional <string> address = default;
            Optional <VirtualMachineSshCredentials> administratorAccount = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sshPort"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sshPort = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("address"))
                {
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("administratorAccount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    administratorAccount = VirtualMachineSshCredentials.DeserializeVirtualMachineSshCredentials(property.Value);
                    continue;
                }
            }
            return(new HDInsightProperties(Optional.ToNullable(sshPort), address.Value, administratorAccount.Value));
        }
Beispiel #3
0
        internal static VirtualMachineSchemaProperties DeserializeVirtualMachineSchemaProperties(JsonElement element)
        {
            Optional <string> virtualMachineSize = default;
            Optional <int>    sshPort            = default;
            Optional <int>    notebookServerPort = default;
            Optional <string> address            = default;
            Optional <VirtualMachineSshCredentials> administratorAccount = default;
            Optional <bool> isNotebookInstanceCompute = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("virtualMachineSize"))
                {
                    virtualMachineSize = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sshPort"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sshPort = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("notebookServerPort"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    notebookServerPort = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("address"))
                {
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("administratorAccount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    administratorAccount = VirtualMachineSshCredentials.DeserializeVirtualMachineSshCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("isNotebookInstanceCompute"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isNotebookInstanceCompute = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new VirtualMachineSchemaProperties(virtualMachineSize.Value, Optional.ToNullable(sshPort), Optional.ToNullable(notebookServerPort), address.Value, administratorAccount.Value, Optional.ToNullable(isNotebookInstanceCompute)));
        }