internal static VaultAccessPolicyProperties DeserializeVaultAccessPolicyProperties(JsonElement element) { IList <AccessPolicyEntry> accessPolicies = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("accessPolicies")) { List <AccessPolicyEntry> array = new List <AccessPolicyEntry>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item)); } } accessPolicies = array; continue; } } return(new VaultAccessPolicyProperties(accessPolicies)); }
internal static VaultProperties DeserializeVaultProperties(JsonElement element) { Guid tenantId = default; Sku sku = default; IList <AccessPolicyEntry> accessPolicies = default; string vaultUri = default; bool? enabledForDeployment = default; bool? enabledForDiskEncryption = default; bool? enabledForTemplateDeployment = default; bool? enableSoftDelete = default; CreateMode? createMode = default; bool? enablePurgeProtection = default; NetworkRuleSet networkAcls = default; IList <PrivateEndpointConnectionItem> privateEndpointConnections = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId")) { tenantId = property.Value.GetGuid(); continue; } if (property.NameEquals("sku")) { sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("accessPolicies")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <AccessPolicyEntry> array = new List <AccessPolicyEntry>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item)); } } accessPolicies = array; continue; } if (property.NameEquals("vaultUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } vaultUri = property.Value.GetString(); continue; } if (property.NameEquals("enabledForDeployment")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } enabledForDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForDiskEncryption")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } enabledForDiskEncryption = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForTemplateDeployment")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } enabledForTemplateDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enableSoftDelete")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } enableSoftDelete = property.Value.GetBoolean(); continue; } if (property.NameEquals("createMode")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } createMode = property.Value.GetString().ToCreateMode(); continue; } if (property.NameEquals("enablePurgeProtection")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } enablePurgeProtection = property.Value.GetBoolean(); continue; } if (property.NameEquals("networkAcls")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property.Value); continue; } if (property.NameEquals("privateEndpointConnections")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <PrivateEndpointConnectionItem> array = new List <PrivateEndpointConnectionItem>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(PrivateEndpointConnectionItem.DeserializePrivateEndpointConnectionItem(item)); } } privateEndpointConnections = array; continue; } } return(new VaultProperties(tenantId, sku, accessPolicies, vaultUri, enabledForDeployment, enabledForDiskEncryption, enabledForTemplateDeployment, enableSoftDelete, createMode, enablePurgeProtection, networkAcls, privateEndpointConnections)); }
internal static VaultProperties DeserializeVaultProperties(JsonElement element) { Guid tenantId = default; KeyVaultSku sku = default; Optional <IList <AccessPolicyEntry> > 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 <CreateMode> createMode = default; Optional <bool> enablePurgeProtection = default; Optional <NetworkRuleSet> networkAcls = default; Optional <VaultProvisioningState> provisioningState = default; Optional <IReadOnlyList <PrivateEndpointConnectionItem> > 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 <AccessPolicyEntry> array = new List <AccessPolicyEntry>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item)); } accessPolicies = array; continue; } if (property.NameEquals("vaultUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); 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().ToCreateMode(); 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 = NetworkRuleSet.DeserializeNetworkRuleSet(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 <PrivateEndpointConnectionItem> array = new List <PrivateEndpointConnectionItem>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(PrivateEndpointConnectionItem.DeserializePrivateEndpointConnectionItem(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)); }
internal static VaultProperties DeserializeVaultProperties(JsonElement element) { Guid tenantId = default; Sku sku = default; Optional <IList <AccessPolicyEntry> > accessPolicies = default; Optional <string> vaultUri = default; Optional <bool> enabledForDeployment = default; Optional <bool> enabledForDiskEncryption = default; Optional <bool> enabledForTemplateDeployment = default; Optional <bool> enableSoftDelete = default; Optional <CreateMode> createMode = default; Optional <bool> enablePurgeProtection = default; Optional <NetworkRuleSet> networkAcls = default; Optional <IList <PrivateEndpointConnectionItem> > privateEndpointConnections = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tenantId")) { tenantId = property.Value.GetGuid(); continue; } if (property.NameEquals("sku")) { sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("accessPolicies")) { List <AccessPolicyEntry> array = new List <AccessPolicyEntry>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item)); } accessPolicies = array; continue; } if (property.NameEquals("vaultUri")) { vaultUri = property.Value.GetString(); continue; } if (property.NameEquals("enabledForDeployment")) { enabledForDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForDiskEncryption")) { enabledForDiskEncryption = property.Value.GetBoolean(); continue; } if (property.NameEquals("enabledForTemplateDeployment")) { enabledForTemplateDeployment = property.Value.GetBoolean(); continue; } if (property.NameEquals("enableSoftDelete")) { enableSoftDelete = property.Value.GetBoolean(); continue; } if (property.NameEquals("createMode")) { createMode = property.Value.GetString().ToCreateMode(); continue; } if (property.NameEquals("enablePurgeProtection")) { enablePurgeProtection = property.Value.GetBoolean(); continue; } if (property.NameEquals("networkAcls")) { networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property.Value); continue; } if (property.NameEquals("privateEndpointConnections")) { List <PrivateEndpointConnectionItem> array = new List <PrivateEndpointConnectionItem>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(PrivateEndpointConnectionItem.DeserializePrivateEndpointConnectionItem(item)); } privateEndpointConnections = array; continue; } } return(new VaultProperties(tenantId, sku, Optional.ToList(accessPolicies), vaultUri.Value, Optional.ToNullable(enabledForDeployment), Optional.ToNullable(enabledForDiskEncryption), Optional.ToNullable(enabledForTemplateDeployment), Optional.ToNullable(enableSoftDelete), Optional.ToNullable(createMode), Optional.ToNullable(enablePurgeProtection), networkAcls.Value, Optional.ToList(privateEndpointConnections))); }