mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
Create Firewall Rule support with a simple Resource Provider implementation
Implementation of the resource provider APIs in order to support Create Firewall Rule. Provides definition for a ResourceProvider and Authentication service. The ResourceProvider supports firewall rules for now, and since authentication is routed through that method it will call into the auth service to set up the current account to be used. Additional notes: - Fixed deserialization by adding an Accept header. This shouldn't be necessary, but for some reason the firewall rule defaults to XML without this - Use generic server list and parse the ID to get the resource group, avoiding a large number of extra calls for each RG - Errors now include error message from the API
This commit is contained in:
@@ -38,9 +38,19 @@ namespace Microsoft.SqlTools.Extensibility
|
||||
"microsoftsqltoolsservicelayer.dll"
|
||||
};
|
||||
|
||||
return CreateFromAssembliesInDirectory(inclusionList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a service provider by loading a set of named assemblies, expected to be in the current working directory
|
||||
/// </summary>
|
||||
/// <param name="inclusionList">full DLL names, as a string enumerable</param>
|
||||
/// <returns><see cref="ExtensionServiceProvider"/> instance</returns>
|
||||
public static ExtensionServiceProvider CreateFromAssembliesInDirectory(IEnumerable<string> inclusionList)
|
||||
{
|
||||
string assemblyPath = typeof(ExtensionStore).GetTypeInfo().Assembly.Location;
|
||||
string directory = Path.GetDirectoryName(assemblyPath);
|
||||
|
||||
|
||||
AssemblyLoadContext context = new AssemblyLoader(directory);
|
||||
var assemblyPaths = Directory.GetFiles(directory, "*.dll", SearchOption.TopDirectoryOnly);
|
||||
|
||||
@@ -49,20 +59,20 @@ namespace Microsoft.SqlTools.Extensibility
|
||||
{
|
||||
// skip DLL files not in inclusion list
|
||||
bool isInList = false;
|
||||
foreach (var item in inclusionList)
|
||||
foreach (var item in inclusionList)
|
||||
{
|
||||
if (path.EndsWith(item, StringComparison.OrdinalIgnoreCase))
|
||||
if (path.EndsWith(item, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
isInList = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isInList)
|
||||
if (!isInList)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
assemblies.Add(
|
||||
|
||||
Reference in New Issue
Block a user