Example #1
0
 internal LinuxConfiguration(OSType osType, bool?disablePasswordAuthentication, SshConfiguration ssh, SshKeyPair sshKeyPair) : base(osType)
 {
     DisablePasswordAuthentication = disablePasswordAuthentication;
     Ssh        = ssh;
     SshKeyPair = sshKeyPair;
     OSType     = osType;
 }
Example #2
0
        internal static LinuxConfiguration DeserializeLinuxConfiguration(JsonElement element)
        {
            Optional <bool>             disablePasswordAuthentication = default;
            Optional <SshConfiguration> ssh        = default;
            Optional <SshKeyPair>       sshKeyPair = default;
            OSType osType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("disablePasswordAuthentication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    disablePasswordAuthentication = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("ssh"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    ssh = SshConfiguration.DeserializeSshConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("sshKeyPair"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sshKeyPair = SshKeyPair.DeserializeSshKeyPair(property.Value);
                    continue;
                }
                if (property.NameEquals("osType"))
                {
                    osType = new OSType(property.Value.GetString());
                    continue;
                }
            }
            return(new LinuxConfiguration(osType, Optional.ToNullable(disablePasswordAuthentication), ssh.Value, sshKeyPair.Value));
        }