internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement element)
        {
            Optional <bool>             disablePasswordAuthentication = default;
            Optional <SshConfiguration> ssh = default;
            Optional <bool>             provisionVMAgent = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("disablePasswordAuthentication"))
                {
                    disablePasswordAuthentication = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("ssh"))
                {
                    ssh = SshConfiguration.DeserializeSshConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("provisionVMAgent"))
                {
                    provisionVMAgent = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new LinuxConfiguration(Optional.ToNullable(disablePasswordAuthentication), ssh.Value, Optional.ToNullable(provisionVMAgent)));
        }
Пример #2
0
        internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement element)
        {
            bool?            disablePasswordAuthentication = default;
            SshConfiguration ssh = default;
            bool?            provisionVMAgent = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("disablePasswordAuthentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    disablePasswordAuthentication = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("ssh"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    ssh = SshConfiguration.DeserializeSshConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("provisionVMAgent"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    provisionVMAgent = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new LinuxConfiguration(disablePasswordAuthentication, ssh, provisionVMAgent));
        }