internal static ServicePrincipalCredential DeserializeServicePrincipalCredential(JsonElement element) { ServicePrincipalParam parameters = default; DataSourceCredentialType dataSourceCredentialType = default; Optional <Guid> dataSourceCredentialId = default; string dataSourceCredentialName = default; Optional <string> dataSourceCredentialDescription = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters")) { parameters = ServicePrincipalParam.DeserializeServicePrincipalParam(property.Value); continue; } if (property.NameEquals("dataSourceCredentialType")) { dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString()); continue; } if (property.NameEquals("dataSourceCredentialId")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } dataSourceCredentialId = property.Value.GetGuid(); continue; } if (property.NameEquals("dataSourceCredentialName")) { dataSourceCredentialName = property.Value.GetString(); continue; } if (property.NameEquals("dataSourceCredentialDescription")) { dataSourceCredentialDescription = property.Value.GetString(); continue; } } return(new ServicePrincipalCredential(dataSourceCredentialType, Optional.ToNullable(dataSourceCredentialId), dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters)); }
internal static ServicePrincipalDatasourceCredential DeserializeServicePrincipalDatasourceCredential(JsonElement element) { ServicePrincipalParam parameters = default; DataSourceCredentialType dataSourceCredentialType = default; Optional <string> dataSourceCredentialId = default; string dataSourceCredentialName = default; Optional <string> dataSourceCredentialDescription = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("parameters")) { parameters = ServicePrincipalParam.DeserializeServicePrincipalParam(property.Value); continue; } if (property.NameEquals("dataSourceCredentialType")) { dataSourceCredentialType = new DataSourceCredentialType(property.Value.GetString()); continue; } if (property.NameEquals("dataSourceCredentialId")) { dataSourceCredentialId = property.Value.GetString(); continue; } if (property.NameEquals("dataSourceCredentialName")) { dataSourceCredentialName = property.Value.GetString(); continue; } if (property.NameEquals("dataSourceCredentialDescription")) { dataSourceCredentialDescription = property.Value.GetString(); continue; } } return(new ServicePrincipalDatasourceCredential(dataSourceCredentialType, dataSourceCredentialId.Value, dataSourceCredentialName, dataSourceCredentialDescription.Value, parameters)); }