Skip to content

Commit 6c253d3

Browse files
committed
#if the breaking change for DataLakeAnalytics. Fix build error with Sql.
# Conflicts: # src/ResourceManager/Sql/Commands.Sql.Test/UnitTests/AzureSqlServerUpgradeAttributeTests.cs
1 parent 75049cd commit 6c253d3

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Models/DataLakeAnalyticsClient.cs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,18 @@ public void DeleteSecret(string accountName, string databaseName, string secretN
529529
}
530530
}
531531

532+
533+
#if NETSTANDARD
532534
public USqlCredential GetSecret(string accountName, string databaseName, string secretName)
533535
{
534536
return _catalogClient.Catalog.GetCredential(accountName, databaseName, secretName);
535537
}
538+
#else
539+
public USqlSecret GetSecret(string accountName, string databaseName, string secretName)
540+
{
541+
return _catalogClient.Catalog.GetSecret(accountName, databaseName, secretName);
542+
}
543+
#endif
536544

537545
public bool TestCatalogItem(string accountName, CatalogPathInstance path,
538546
DataLakeAnalyticsEnums.CatalogItemType itemType)
@@ -847,12 +855,23 @@ private IList<USqlExternalDataSource> GetExternalDataSources(string accountName,
847855
return toReturn;
848856
}
849857

858+
#if NETSTANDARD
850859
private USqlCredential GetCredential(string accountName, string databaseName, string credName)
851860
{
852861
return _catalogClient.Catalog.GetCredential(accountName, databaseName, credName);
853862
}
863+
#else
864+
private ObsoleteUSqlCredential GetCredential(string accountName, string databaseName, string credName)
865+
{
866+
return new ObsoleteUSqlCredential(_catalogClient.Catalog.GetCredential(accountName, databaseName, credName), databaseName, computeAccountName: accountName);
867+
}
868+
#endif
854869

870+
#if NETSTANDARD
855871
private IList<USqlCredential> GetCredentials(string accountName, string databaseName)
872+
#else
873+
private IList<ObsoleteUSqlCredential> GetCredentials(string accountName, string databaseName)
874+
#endif
856875
{
857876
List<USqlCredential> toReturn = new List<USqlCredential>();
858877
var response = _catalogClient.Catalog.ListCredentials(accountName, databaseName);
@@ -863,7 +882,11 @@ private IList<USqlCredential> GetCredentials(string accountName, string database
863882
toReturn.AddRange(response);
864883
}
865884

885+
#if NETSTANDARD
866886
return toReturn;
887+
#else
888+
return toReturn.Select(element => new ObsoleteUSqlCredential(element, databaseName, computeAccountName: accountName)).ToList();
889+
#endif
867890
}
868891

869892
private USqlSchema GetSchema(string accountName, string databaseName,
@@ -1116,8 +1139,8 @@ private IList<USqlType> GetTypes(string accountName, string databaseName,
11161139
return toReturn;
11171140
}
11181141

1119-
#endregion
1120-
#region Compute Policy Operations
1142+
#endregion
1143+
#region Compute Policy Operations
11211144
public ComputePolicy CreateComputePolicy(string resourceGroupName, string accountName, string policyName, Guid objectId, string objectType, int? maxAnalyticsUnitsPerJob = null, int? minPriorityPerJob = null)
11221145
{
11231146
if (string.IsNullOrEmpty(resourceGroupName))
@@ -1189,8 +1212,8 @@ public void DeleteComputePolicy(string resourceGroupName, string accountName, st
11891212
_accountClient.ComputePolicies.Delete(resourceGroupName, accountName, policyName);
11901213
}
11911214

1192-
#endregion
1193-
#region Job Related Operations
1215+
#endregion
1216+
#region Job Related Operations
11941217

11951218
public JobRecurrenceInformation GetJobReccurence(string accountName, Guid recurrenceId, DateTimeOffset? start = null, DateTimeOffset? end = null)
11961219
{
@@ -1302,9 +1325,9 @@ public List<JobInformationBasic> ListJobs(string accountName, string filter, int
13021325
return jobList.GetRange(0, Math.Min(curCount, top.Value));
13031326
}
13041327

1305-
#endregion
1328+
#endregion
13061329

1307-
#region internal helpers
1330+
#region internal helpers
13081331
internal string GetResourceGroupByAccountName(string accountName)
13091332
{
13101333
try
@@ -1355,9 +1378,9 @@ internal string GetWildcardFilterString(string propertyName, string value)
13551378
// default case requires both
13561379
return string.Format("startswith({0},'{1}') and endswith({0},'{2}')", propertyName, subStrings[0], subStrings[1]);
13571380
}
1358-
#endregion
1381+
#endregion
13591382

1360-
#region private helpers
1383+
#region private helpers
13611384

13621385
private IPage<JobInformationBasic> ListJobsWithNextLink(string nextLink)
13631386
{
@@ -1470,6 +1493,6 @@ private bool IsCatalogItemOrList(CatalogPathInstance path, DataLakeAnalyticsEnum
14701493

14711494
return isList;
14721495
}
1473-
#endregion
1496+
#endregion
14741497
}
14751498
}

src/ResourceManager/Sql/Commands.Sql.Test/UnitTests/AzureSqlServerUpgradeAttributeTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public AzureSqlServerUpgradeAttributeTests(ITestOutputHelper output)
3333
[Trait(Category.AcceptanceType, Category.CheckIn)]
3434
public void StartAzureSqlServerUpgradeAttributes()
3535
{
36+
#pragma warning disable 618
3637
Type type = typeof(StartAzureSqlServerUpgrade);
38+
#pragma warning restore 618
3739
UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);
3840
UnitTestHelper.CheckConfirmImpact(type, System.Management.Automation.ConfirmImpact.Low);
3941

@@ -45,7 +47,9 @@ public void StartAzureSqlServerUpgradeAttributes()
4547
[Trait(Category.AcceptanceType, Category.CheckIn)]
4648
public void StopAzureSqlServerUpgradeAttributes()
4749
{
50+
#pragma warning disable 618
4851
Type type = typeof(StopAzureSqlServerUpgrade);
52+
#pragma warning restore 618
4953
UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: true);
5054

5155
UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerName", isMandatory: true, valueFromPipelineByName: true);
@@ -55,7 +59,9 @@ public void StopAzureSqlServerUpgradeAttributes()
5559
[Trait(Category.AcceptanceType, Category.CheckIn)]
5660
public void GetAzureSqlServerUpgradeAttributes()
5761
{
62+
#pragma warning disable 618
5863
Type type = typeof(GetAzureSqlServerUpgrade);
64+
#pragma warning restore 618
5965
UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);
6066
UnitTestHelper.CheckConfirmImpact(type, System.Management.Automation.ConfirmImpact.None);
6167

0 commit comments

Comments
 (0)