internal static Encryption DeserializeEncryption(JsonElement element)
        {
            EncryptionServices services           = default;
            KeySource          keySource          = default;
            KeyVaultProperties keyvaultproperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("services"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    services = EncryptionServices.DeserializeEncryptionServices(property.Value);
                    continue;
                }
                if (property.NameEquals("keySource"))
                {
                    keySource = new KeySource(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("keyvaultproperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    keyvaultproperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value);
                    continue;
                }
            }
            return(new Encryption(services, keySource, keyvaultproperties));
        }
Example #2
0
        internal static Encryption DeserializeEncryption(JsonElement element)
        {
            Optional <EncryptionServices> services = default;
            KeySource       keySource = default;
            Optional <bool> requireInfrastructureEncryption  = default;
            Optional <KeyVaultProperties> keyvaultproperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("services"))
                {
                    services = EncryptionServices.DeserializeEncryptionServices(property.Value);
                    continue;
                }
                if (property.NameEquals("keySource"))
                {
                    keySource = new KeySource(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("requireInfrastructureEncryption"))
                {
                    requireInfrastructureEncryption = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("keyvaultproperties"))
                {
                    keyvaultproperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value);
                    continue;
                }
            }
            return(new Encryption(services.Value, keySource, Optional.ToNullable(requireInfrastructureEncryption), keyvaultproperties.Value));
        }