Skip to content

Commit 8281ff0

Browse files
committed
Updating terminology used in the host
1 parent 95dc10e commit 8281ff0

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

src/WebJobs.Script.WebHost/Management/WebFunctionsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ internal IEnumerable<FunctionMetadata> GetFunctionsMetadata(bool includeProxies,
7272
filterPredicate = m => m.IsProxy() || !m.IsCodeless();
7373
}
7474

75-
return _functionMetadataManager.GetFunctionMetadata(forceRefresh, applyWhitelist: false).Where(filterPredicate);
75+
return _functionMetadataManager.GetFunctionMetadata(forceRefresh, applyAllowlist: false).Where(filterPredicate);
7676
}
7777

7878
/// <summary>

src/WebJobs.Script/Host/FunctionMetadataManager.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,30 +75,30 @@ public bool TryGetFunctionMetadata(string functionName, out FunctionMetadata fun
7575
/// Gets the function metadata array from all providers.
7676
/// </summary>
7777
/// <param name="forceRefresh">Forces reload from all providers.</param>
78-
/// <param name="applyWhitelist">Apply functions whitelist filter.</param>
78+
/// <param name="applyAllowList">Apply functions allow list filter.</param>
7979
/// <returns> An Immmutable array of FunctionMetadata.</returns>
80-
public ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh, bool applyWhitelist = true)
80+
public ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh, bool applyAllowList = true)
8181
{
8282
if (forceRefresh || _servicesReset || _functionMetadataArray.IsDefaultOrEmpty)
8383
{
8484
_functionMetadataArray = LoadFunctionMetadata(forceRefresh);
85-
_logger.FunctionMetadataManagerFunctionsLoaded(ApplyWhitelist(_functionMetadataArray).Count());
85+
_logger.FunctionMetadataManagerFunctionsLoaded(ApplyAllowList(_functionMetadataArray).Count());
8686
_servicesReset = false;
8787
}
8888

89-
return applyWhitelist ? ApplyWhitelist(_functionMetadataArray) : _functionMetadataArray;
89+
return applyAllowList ? ApplyAllowList(_functionMetadataArray) : _functionMetadataArray;
9090
}
9191

92-
private ImmutableArray<FunctionMetadata> ApplyWhitelist(ImmutableArray<FunctionMetadata> metadataList)
92+
private ImmutableArray<FunctionMetadata> ApplyAllowList(ImmutableArray<FunctionMetadata> metadataList)
9393
{
94-
var whitelist = _scriptOptions.Value?.Functions;
94+
var allowList = _scriptOptions.Value?.Functions;
9595

96-
if (whitelist == null || metadataList.IsDefaultOrEmpty)
96+
if (allowList == null || metadataList.IsDefaultOrEmpty)
9797
{
9898
return metadataList;
9999
}
100100

101-
return metadataList.Where(metadata => whitelist.Any(functionName => functionName.Equals(metadata.Name, StringComparison.CurrentCultureIgnoreCase))).ToImmutableArray();
101+
return metadataList.Where(metadata => allowList.Any(functionName => functionName.Equals(metadata.Name, StringComparison.CurrentCultureIgnoreCase))).ToImmutableArray();
102102
}
103103

104104
private void InitializeServices()
@@ -123,7 +123,7 @@ internal ImmutableArray<FunctionMetadata> LoadFunctionMetadata(bool forceRefresh
123123
{
124124
_functionMetadataMap.Clear();
125125

126-
ICollection<string> functionsWhiteList = _scriptOptions?.Value?.Functions;
126+
ICollection<string> functionsAllowList = _scriptOptions?.Value?.Functions;
127127
_logger.FunctionMetadataManagerLoadingFunctionsMetadata();
128128

129129
var immutableFunctionMetadata = _functionMetadataProvider.GetFunctionMetadata(_languageWorkerOptions.Value.WorkerConfigs, forceRefresh);
@@ -154,10 +154,10 @@ internal ImmutableArray<FunctionMetadata> LoadFunctionMetadata(bool forceRefresh
154154
}
155155
Errors = _functionErrors.ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.ToImmutableArray());
156156

157-
if (functionsWhiteList != null)
157+
if (functionsAllowList != null)
158158
{
159-
_logger.LogInformation($"A function whitelist has been specified, excluding all but the following functions: [{string.Join(", ", functionsWhiteList)}]");
160-
Errors = _functionErrors.Where(kvp => functionsWhiteList.Any(functionName => functionName.Equals(kvp.Key, StringComparison.CurrentCultureIgnoreCase))).ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.ToImmutableArray());
159+
_logger.LogInformation($"A function allow list has been specified, excluding all but the following functions: [{string.Join(", ", functionsAllowList)}]");
160+
Errors = _functionErrors.Where(kvp => functionsAllowList.Any(functionName => functionName.Equals(kvp.Key, StringComparison.CurrentCultureIgnoreCase))).ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.ToImmutableArray());
161161
}
162162

163163
return functionMetadataList.ToImmutableArray();

src/WebJobs.Script/Host/IFunctionMetadataManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public interface IFunctionMetadataManager
1010
{
1111
ImmutableDictionary<string, ImmutableArray<string>> Errors { get; }
1212

13-
ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh = false, bool applyWhitelist = true);
13+
ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh = false, bool applyAllowlist = true);
1414

1515
bool TryGetFunctionMetadata(string functionName, out FunctionMetadata functionMetadata, bool forceRefresh = false);
1616
}

src/WebJobs.Script/Workers/Rpc/RpcInitializationService.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class RpcInitializationService : IManagedHostedService
2424
private readonly string _workerRuntime;
2525
private readonly int _rpcServerShutdownTimeoutInMilliseconds;
2626

27-
private Dictionary<OSPlatform, List<string>> _hostingOSToWhitelistedRuntimes = new Dictionary<OSPlatform, List<string>>()
27+
private Dictionary<OSPlatform, List<string>> _hostingOSToRuntimesAllowList = new Dictionary<OSPlatform, List<string>>()
2828
{
2929
{
3030
OSPlatform.Windows,
@@ -41,12 +41,12 @@ public class RpcInitializationService : IManagedHostedService
4141
};
4242

4343
// _webHostLevelWhitelistedRuntimes are started at webhost level when running in Azure and locally
44-
private List<string> _webHostLevelWhitelistedRuntimes = new List<string>()
44+
private List<string> _webHostLeveldRuntimesAllowList = new List<string>()
4545
{
4646
RpcWorkerConstants.JavaLanguageWorkerName
4747
};
4848

49-
private List<string> _placeholderPoolWhitelistedRuntimes = new List<string>()
49+
private List<string> _placeholderPoolRuntimesAllowList = new List<string>()
5050
{
5151
RpcWorkerConstants.JavaLanguageWorkerName,
5252
RpcWorkerConstants.NodeLanguageWorkerName,
@@ -158,13 +158,13 @@ private Task InitializePlaceholderChannelsAsync()
158158

159159
private Task InitializePlaceholderChannelsAsync(OSPlatform os)
160160
{
161-
return Task.WhenAll(_hostingOSToWhitelistedRuntimes[os].Select(runtime =>
161+
return Task.WhenAll(_hostingOSToRuntimesAllowList[os].Select(runtime =>
162162
_webHostRpcWorkerChannelManager.InitializeChannelAsync(runtime)));
163163
}
164164

165165
private Task InitializeWebHostRuntimeChannelsAsync()
166166
{
167-
if (_webHostLevelWhitelistedRuntimes.Contains(_workerRuntime, StringComparer.OrdinalIgnoreCase))
167+
if (_webHostLeveldRuntimesAllowList.Contains(_workerRuntime, StringComparer.OrdinalIgnoreCase))
168168
{
169169
return _webHostRpcWorkerChannelManager.InitializeChannelAsync(_workerRuntime);
170170
}
@@ -191,10 +191,10 @@ internal bool ShouldStartAsPlaceholderPool()
191191
// We are in placeholder mode but a worker runtime IS set
192192
return _environment.IsPlaceholderModeEnabled()
193193
&& !string.IsNullOrEmpty(_workerRuntime)
194-
&& _placeholderPoolWhitelistedRuntimes.Contains(_workerRuntime, StringComparer.OrdinalIgnoreCase);
194+
&& _placeholderPoolRuntimesAllowList.Contains(_workerRuntime, StringComparer.OrdinalIgnoreCase);
195195
}
196196

197197
// To help with unit tests
198-
internal void AddSupportedWebHostLevelRuntime(string language) => _webHostLevelWhitelistedRuntimes.Add(language);
198+
internal void AddSupportedWebHostLevelRuntime(string language) => _webHostLeveldRuntimesAllowList.Add(language);
199199
}
200200
}

test/WebJobs.Script.Tests.Integration/ApplicationInsights/ApplicationInsightsEndToEndTestsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ await TestHelpers.Await(() =>
274274

275275
int idx = 0;
276276
ValidateTrace(traces[idx++], "2 functions loaded", LogCategories.Startup);
277-
ValidateTrace(traces[idx++], "A function whitelist has been specified", LogCategories.Startup);
277+
ValidateTrace(traces[idx++], "A function allow list has been specified", LogCategories.Startup);
278278
ValidateTrace(traces[idx++], "Found the following functions:\r\n", LogCategories.Startup);
279279
ValidateTrace(traces[idx++], "Generating 2 job function(s)", LogCategories.Startup);
280280
ValidateTrace(traces[idx++], "Host initialization: ConsecutiveErrors=0, StartupCount=1", LogCategories.Startup);

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/CodelessEndToEndTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public async Task CodelessFunction_CanUse_MultipleProviders(string path, string
164164
[InlineData("NoFunction", "node", null, 0)]
165165
public async Task CodelessFunction_DoesNot_ListFunctions(string path, string workerRuntime, string allowedList, int listCount)
166166
{
167-
// Note: admin/functions call includes all functions, regardless of the allowed list (whitelist)
167+
// Note: admin/functions call includes all functions, regardless of the allowed list
168168
var sourceFunctionApp = Path.Combine(Environment.CurrentDirectory, "TestScripts", path);
169169
var settings = new Dictionary<string, string>()
170170
{

test/WebJobs.Script.Tests/Description/FunctionInvokerBaseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public MockMetadataManager(ICollection<FunctionMetadata> functions)
279279
public ImmutableDictionary<string, ImmutableArray<string>> Errors =>
280280
ImmutableDictionary<string, ImmutableArray<string>>.Empty;
281281

282-
public ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh = false, bool applyWhitelist = true)
282+
public ImmutableArray<FunctionMetadata> GetFunctionMetadata(bool forceRefresh = false, bool applyAllowlist = true)
283283
{
284284
return _functions.ToImmutableArray();
285285
}

0 commit comments

Comments
 (0)