Skip to content

Commit

Permalink
SQL Data Classification - Update id split logic (#13746)
Browse files Browse the repository at this point in the history
* Update DataClassificationAdapter.cs

* Update DataClassificationAdapter.cs

* Update ChangeLog.md

* Update DataClassificationAdapter.cs

Co-authored-by: Yunchi Wang <[email protected]>
  • Loading branch information
bashahee and wyunchi-ms authored Dec 18, 2020
1 parent 851fab3 commit 0a8c538
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Sql/Sql/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->
## Upcoming Release
* Fixed parameter description for `InstanceFailoverGroup` command.
* Updated the logic in which schemaName, tableName and columnName are being extracted from the id of SQL Data Classification commands.
* Fixed Status and StatusMessage fields in `Get-AzSqlDatabaseImportExportStatus` to conform to documentation

## Version 2.13.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,14 @@ private static SensitivityLabel ToSensitivityLabel(SensitivityLabelModel sensiti

private static SensitivityLabelModel ToSensitivityLabelModel(SensitivityLabel sensitivityLabel)
{
string[] idComponents = sensitivityLabel.Id.Split('/');
var match = new global::System.Text.RegularExpressions.Regex("/schemas/(?<schemaName>.*)/tables/(?<tableName>.*)/columns/(?<columnName>.*)/sensitivityLabels/",
global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(sensitivityLabel.Id);

return new SensitivityLabelModel
{
SchemaName = idComponents[12],
TableName = idComponents[14],
ColumnName = idComponents[16],
SchemaName = match.Groups["schemaName"].Value,
TableName = match.Groups["tableName"].Value,
ColumnName = match.Groups["columnName"].Value,
SensitivityLabel = NullifyStringIfEmpty(sensitivityLabel.LabelName),
SensitivityLabelId = NullifyStringIfEmpty(sensitivityLabel.LabelId),
InformationType = NullifyStringIfEmpty(sensitivityLabel.InformationType),
Expand Down

0 comments on commit 0a8c538

Please sign in to comment.