Beispiel #1
0
        protected override SqlPoolSensitivityClassificationModel GetEntity()
        {
            if (ClassificationObject != null)
            {
                ResourceGroupName = ClassificationObject.ResourceGroupName;
                WorkspaceName     = ClassificationObject.WorkspaceName;
                SqlPoolName       = ClassificationObject.SqlPoolName;
            }
            else if (SqlPoolObject != null)
            {
                var resourceIdentifier = new ResourceIdentifier(SqlPoolObject.Id);
                this.ResourceGroupName = resourceIdentifier.ResourceGroupName;
                this.WorkspaceName     = resourceIdentifier.ParentResource;
                this.WorkspaceName     = this.WorkspaceName.Substring(this.WorkspaceName.LastIndexOf('/') + 1);
                this.SqlPoolName       = resourceIdentifier.ResourceName;
            }

            List <SensitivityLabelModel> sensitivityLabels = null;

            try
            {
                sensitivityLabels = ParameterSetName == DataClassificationCommon.ColumnParameterSet ||
                                    ParameterSetName == DataClassificationCommon.SqlPoolObjectColumnParameterSet
                    ? ModelAdapter.GetCurrentSensitivityLabel(ResourceGroupName, WorkspaceName, SqlPoolName, SchemaName, TableName, ColumnName)
                    : ModelAdapter.GetCurrentSensitivityLabels(ResourceGroupName, WorkspaceName, SqlPoolName);
            }
            catch (CloudException e)
            {
                if (e.Response.StatusCode != HttpStatusCode.NotFound || e.Message != "The specified sensitivity label could not be found")
                {
                    throw;
                }
            }

            return(new SqlPoolSensitivityClassificationModel
            {
                ResourceGroupName = ResourceGroupName,
                WorkspaceName = WorkspaceName,
                SqlPoolName = SqlPoolName,
                SensitivityLabels = sensitivityLabels ?? new List <SensitivityLabelModel>()
            });
        }
        protected override SqlDatabaseSensitivityClassificationModel GetEntity()
        {
            if (DatabaseObject != null)
            {
                ResourceGroupName = DatabaseObject.ResourceGroupName;
                ServerName        = DatabaseObject.ServerName;
                DatabaseName      = DatabaseObject.DatabaseName;
            }

            return(new SqlDatabaseSensitivityClassificationModel()
            {
                ResourceGroupName = ResourceGroupName,
                ServerName = ServerName,
                DatabaseName = DatabaseName,
                SensitivityLabels = ParameterSetName == DataClassificationCommon.ColumnParameterSet ||
                                    ParameterSetName == DataClassificationCommon.DatabaseObjectColumnParameterSet
                    ? ModelAdapter.GetCurrentSensitivityLabel(
                    ResourceGroupName, ServerName, DatabaseName, SchemaName, TableName, ColumnName)
                    : ModelAdapter.GetCurrentSensitivityLabels(ResourceGroupName, ServerName, DatabaseName)
            });
        }
Beispiel #3
0
        protected override SqlDatabaseSensitivityClassificationModel GetEntity()
        {
            if (ClassificationObject != null)
            {
                ResourceGroupName = ClassificationObject.ResourceGroupName;
                ServerName        = ClassificationObject.ServerName;
                DatabaseName      = ClassificationObject.DatabaseName;
            }
            else if (DatabaseObject != null)
            {
                ResourceGroupName = DatabaseObject.ResourceGroupName;
                ServerName        = DatabaseObject.ServerName;
                DatabaseName      = DatabaseObject.DatabaseName;
            }

            List <SensitivityLabelModel> sensitivityLabels = null;

            try
            {
                sensitivityLabels = ParameterSetName == DataClassificationCommon.ColumnParameterSet ||
                                    ParameterSetName == DataClassificationCommon.DatabaseObjectColumnParameterSet
                    ? ModelAdapter.GetCurrentSensitivityLabel(ResourceGroupName, ServerName, DatabaseName, SchemaName, TableName, ColumnName)
                    : ModelAdapter.GetCurrentSensitivityLabels(ResourceGroupName, ServerName, DatabaseName);
            }
            catch (CloudException e)
            {
                if (e.Response.StatusCode != HttpStatusCode.NotFound || e.Message != "The specified sensitivity label could not be found")
                {
                    throw;
                }
            }

            return(new SqlDatabaseSensitivityClassificationModel
            {
                ResourceGroupName = ResourceGroupName,
                ServerName = ServerName,
                DatabaseName = DatabaseName,
                SensitivityLabels = sensitivityLabels ?? new List <SensitivityLabelModel>()
            });
        }
        protected override SqlPoolSensitivityClassificationModel GetEntity()
        {
            if (SqlPoolObject != null)
            {
                var resourceIdentifier = new ResourceIdentifier(SqlPoolObject.Id);
                this.ResourceGroupName = resourceIdentifier.ResourceGroupName;
                this.WorkspaceName     = resourceIdentifier.ParentResource;
                this.WorkspaceName     = this.WorkspaceName.Substring(this.WorkspaceName.LastIndexOf('/') + 1);
                this.SqlPoolName       = resourceIdentifier.ResourceName;
            }

            return(new SqlPoolSensitivityClassificationModel()
            {
                ResourceGroupName = ResourceGroupName,
                WorkspaceName = WorkspaceName,
                SqlPoolName = SqlPoolName,
                SensitivityLabels = ParameterSetName == DataClassificationCommon.ColumnParameterSet ||
                                    ParameterSetName == DataClassificationCommon.SqlPoolObjectColumnParameterSet
                    ? ModelAdapter.GetCurrentSensitivityLabel(
                    ResourceGroupName, WorkspaceName, SqlPoolName, SchemaName, TableName, ColumnName)
                    : ModelAdapter.GetCurrentSensitivityLabels(ResourceGroupName, WorkspaceName, SqlPoolName)
            });
        }