internal static VaultAccessPolicyProperties DeserializeVaultAccessPolicyProperties(JsonElement element) { IList <VaultAccessPolicy> accessPolicies = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accessPolicies")) { List <VaultAccessPolicy> array = new List <VaultAccessPolicy>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VaultAccessPolicy.DeserializeVaultAccessPolicy(item)); } accessPolicies = array; continue; } } return(new VaultAccessPolicyProperties(accessPolicies)); }
internal static VaultProperties DeserializeVaultProperties(JsonElement element) { Guid tenantId = default; KeyVaultSku sku = default; Optional <IList <VaultAccessPolicy> > accessPolicies = default; Optional <Uri> vaultUri = default; Optional <string> hsmPoolResourceId = default; Optional <bool> enabledForDeployment = default; Optional <bool> enabledForDiskEncryption = default; Optional <bool> enabledForTemplateDeployment = default; Optional <bool> enableSoftDelete = default; Optional <int> softDeleteRetentionInDays = default; Optional <bool> enableRbacAuthorization = default; Optional <VaultCreateMode> createMode = default; Optional <bool> enablePurgeProtection = default; Optional <VaultNetworkRuleSet> networkAcls = default; Optional <VaultProvisioningState> provisioningState = default; Optional <IReadOnlyList <PrivateEndpointConnectionItemData> > privateEndpointConnections = default; Optional <string> publicNetworkAccess = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId")) { tenantId = property.Value.GetGuid(); continue; } if (property.NameEquals("sku")) { sku = KeyVaultSku.DeserializeKeyVaultSku(property.Value); continue; } if (property.NameEquals("accessPolicies")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <VaultAccessPolicy> array = new List <VaultAccessPolicy>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(VaultAccessPolicy.DeserializeVaultAccessPolicy(item)); } accessPolicies = array; continue; } if (property.NameEquals("vaultUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { vaultUri = null; continue; } vaultUri = new Uri(property.Value.GetString()); continue; } if (property.NameEquals("hsmPoolResourceId")) { hsmPoolResourceId = property.Value.GetString(); continue; } if (property.NameEquals("enabledForDeployment")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enabledForDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForDiskEncryption")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enabledForDiskEncryption = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForTemplateDeployment")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enabledForTemplateDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enableSoftDelete")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableSoftDelete = property.Value.GetBoolean(); continue; } if (property.NameEquals("softDeleteRetentionInDays")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } softDeleteRetentionInDays = property.Value.GetInt32(); continue; } if (property.NameEquals("enableRbacAuthorization")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enableRbacAuthorization = property.Value.GetBoolean(); continue; } if (property.NameEquals("createMode")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } createMode = property.Value.GetString().ToVaultCreateMode(); continue; } if (property.NameEquals("enablePurgeProtection")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } enablePurgeProtection = property.Value.GetBoolean(); continue; } if (property.NameEquals("networkAcls")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } networkAcls = VaultNetworkRuleSet.DeserializeVaultNetworkRuleSet(property.Value); continue; } if (property.NameEquals("provisioningState")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } provisioningState = new VaultProvisioningState(property.Value.GetString()); continue; } if (property.NameEquals("privateEndpointConnections")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <PrivateEndpointConnectionItemData> array = new List <PrivateEndpointConnectionItemData>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(PrivateEndpointConnectionItemData.DeserializePrivateEndpointConnectionItemData(item)); } privateEndpointConnections = array; continue; } if (property.NameEquals("publicNetworkAccess")) { publicNetworkAccess = property.Value.GetString(); continue; } } return(new VaultProperties(tenantId, sku, Optional.ToList(accessPolicies), vaultUri.Value, hsmPoolResourceId.Value, Optional.ToNullable(enabledForDeployment), Optional.ToNullable(enabledForDiskEncryption), Optional.ToNullable(enabledForTemplateDeployment), Optional.ToNullable(enableSoftDelete), Optional.ToNullable(softDeleteRetentionInDays), Optional.ToNullable(enableRbacAuthorization), Optional.ToNullable(createMode), Optional.ToNullable(enablePurgeProtection), networkAcls.Value, Optional.ToNullable(provisioningState), Optional.ToList(privateEndpointConnections), publicNetworkAccess.Value)); }