Exemple #1
0
        internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element)
        {
            Optional <SubResource> sourceVault = default;
            Optional <IList <VaultCertificate> > vaultCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sourceVault"))
                {
                    sourceVault = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("vaultCertificates"))
                {
                    List <VaultCertificate> array = new List <VaultCertificate>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VaultCertificate.DeserializeVaultCertificate(item));
                    }
                    vaultCertificates = array;
                    continue;
                }
            }
            return(new VaultSecretGroup(sourceVault.Value, Optional.ToList(vaultCertificates)));
        }
        internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element)
        {
            SubResource sourceVault = default;
            IList <VaultCertificate> vaultCertificates = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sourceVault"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceVault = SubResource.DeserializeSubResource(property.Value);
                    continue;
                }
                if (property.NameEquals("vaultCertificates"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <VaultCertificate> array = new List <VaultCertificate>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(VaultCertificate.DeserializeVaultCertificate(item));
                        }
                    }
                    vaultCertificates = array;
                    continue;
                }
            }
            return(new VaultSecretGroup(sourceVault, vaultCertificates));
        }