Skip to content

Commit dba9cfd

Browse files
authored
Re-organize the project layout (#13)
1 parent bea420c commit dba9cfd

16 files changed

+99
-42
lines changed

src/Azure.Functions.PowerShell.Worker.Messaging/Azure.Functions.PowerShell.Worker.Messaging.csproj

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Azure.Functions.PowerShell.Worker/Azure.Functions.PowerShell.Worker.csproj

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp2.1</TargetFramework>
6-
</PropertyGroup>
76

8-
<ItemGroup>
9-
<ProjectReference Include="..\Azure.Functions.PowerShell.Worker.Messaging\Azure.Functions.PowerShell.Worker.Messaging.csproj" />
10-
</ItemGroup>
7+
<Product>Azure Function PowerShell Language Worker</Product>
8+
<Company>Microsoft Corporation</Company>
9+
<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>
10+
11+
<LangVersion>Latest</LangVersion>
12+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
13+
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
14+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
15+
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
16+
<NeutralLanguage>en-US</NeutralLanguage>
17+
</PropertyGroup>
1118

1219
<ItemGroup>
1320
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
1421
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.0-rc.1" />
1522
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
1623
<PackageReference Include="CommandLineParser" Version="2.3.0" />
24+
<PackageReference Include="Grpc" Version="1.14.1" />
25+
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
1726
</ItemGroup>
1827

1928
<ItemGroup>
@@ -22,8 +31,4 @@
2231
</None>
2332
</ItemGroup>
2433

25-
<PropertyGroup>
26-
<LangVersion>latest</LangVersion>
27-
</PropertyGroup>
28-
2934
</Project>

src/Azure.Functions.PowerShell.Worker/Function/FunctionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Microsoft.Azure.Functions.PowerShellWorker
1010
{
11-
public class FunctionInfo
11+
internal class FunctionInfo
1212
{
1313
public string Directory {get; set;}
1414
public string HttpOutputName {get; set;}

src/Azure.Functions.PowerShell.Worker/Function/FunctionLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Microsoft.Azure.Functions.PowerShellWorker
1010
{
11-
public class FunctionLoader
11+
internal class FunctionLoader
1212
{
1313
readonly MapField<string, Function> _LoadedFunctions = new MapField<string, Function>();
1414

@@ -30,7 +30,7 @@ public void Load(string functionId, RpcFunctionMetadata metadata)
3030
}
3131
}
3232

33-
public class Function
33+
internal class Function
3434
{
3535
public string EntryPoint {get; internal set;}
3636
public FunctionInfo Info {get; internal set;}

src/Azure.Functions.PowerShell.Worker/Http/HttpRequestContext.cs

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,49 @@
88

99
namespace Microsoft.Azure.Functions.PowerShellWorker
1010
{
11+
/// <summary>
12+
/// Custom type represent the context of the in-coming Http request.
13+
/// </summary>
1114
public class HttpRequestContext : IEquatable<HttpRequestContext>
1215
{
13-
public object Body {get; set;}
14-
public MapField<string, string> Headers {get; set;}
15-
public string Method {get; set;}
16-
public string Url {get; set;}
17-
public MapField<string, string> Params {get; set;}
18-
public MapField<string, string> Query {get; set;}
19-
public object RawBody {get; set;}
16+
/// <summary>
17+
/// Gets the Body of the Http request.
18+
/// </summary>
19+
public object Body { get; internal set; }
2020

21+
/// <summary>
22+
/// Gets the Headers of the Http request.
23+
/// </summary>
24+
public MapField<string, string> Headers { get; internal set; }
25+
26+
/// <summary>
27+
/// Gets the Method of the Http request.
28+
/// </summary>
29+
public string Method { get; internal set; }
30+
31+
/// <summary>
32+
/// Gets the Url of the Http request.
33+
/// </summary>
34+
public string Url { get; internal set; }
35+
36+
/// <summary>
37+
/// Gets the Params of the Http request.
38+
/// </summary>
39+
public MapField<string, string> Params { get; internal set; }
40+
41+
/// <summary>
42+
/// Gets the Query of the Http request.
43+
/// </summary>
44+
public MapField<string, string> Query { get; internal set; }
45+
46+
/// <summary>
47+
/// Gets the RawBody of the Http request.
48+
/// </summary>
49+
public object RawBody { get; internal set; }
50+
51+
/// <summary>
52+
/// Compare with another HttpRequestContext object.
53+
/// </summary>
2154
public bool Equals(HttpRequestContext other)
2255
{
2356
return Method == other.Method

src/Azure.Functions.PowerShell.Worker/Http/HttpResponseContext.cs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,39 @@
88

99
namespace Microsoft.Azure.Functions.PowerShellWorker
1010
{
11+
/// <summary>
12+
/// Custom type represent the context of the Http response.
13+
/// </summary>
1114
public class HttpResponseContext : IEquatable<HttpResponseContext>
1215
{
13-
public object Body {get; set;}
14-
public string ContentType {get; set;} = "text/plain";
15-
public bool EnableContentNegotiation {get; set;} = false;
16-
public Hashtable Headers {get; set;} = new Hashtable();
17-
public string StatusCode {get; set;} = "200";
16+
/// <summary>
17+
/// Gets or sets the Body of the Http response.
18+
/// </summary>
19+
public object Body { get; set; }
1820

21+
/// <summary>
22+
/// Gets or sets the ContentType of the Http response.
23+
/// </summary>
24+
public string ContentType { get; set; } = "text/plain";
25+
26+
/// <summary>
27+
/// Gets or sets the EnableContentNegotiation of the Http response.
28+
/// </summary>
29+
public bool EnableContentNegotiation { get; set; } = false;
30+
31+
/// <summary>
32+
/// Gets or sets the Headers of the Http response.
33+
/// </summary>
34+
public Hashtable Headers { get; set; } = new Hashtable();
35+
36+
/// <summary>
37+
/// Gets or sets the StatusCode of the Http response.
38+
/// </summary>
39+
public string StatusCode { get; set; } = "200";
40+
41+
/// <summary>
42+
/// Compare with another HttpResponseContext object.
43+
/// </summary>
1944
public bool Equals(HttpResponseContext other)
2045
{
2146
bool sameHeaders = true;

src/Azure.Functions.PowerShell.Worker.Messaging/FunctionMessagingClient.cs renamed to src/Azure.Functions.PowerShell.Worker/Messaging/FunctionMessagingClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace Microsoft.Azure.Functions.PowerShellWorker.Messaging
1414
{
15-
public class FunctionMessagingClient : IDisposable
15+
internal class FunctionMessagingClient : IDisposable
1616
{
1717
SemaphoreSlim _writeStreamHandle = new SemaphoreSlim(1, 1);
1818
AsyncDuplexStreamingCall<StreamingMessage, StreamingMessage> _call;

src/Azure.Functions.PowerShell.Worker/Utility/RpcLogger.cs renamed to src/Azure.Functions.PowerShell.Worker/Messaging/RpcLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Microsoft.Azure.Functions.PowerShellWorker.Utility
1313
{
14-
public class RpcLogger : ILogger
14+
internal class RpcLogger : ILogger
1515
{
1616
FunctionMessagingClient _client;
1717
string _invocationId = "";

src/Azure.Functions.PowerShell.Worker/PowerShell/PowerShellWorkerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.PowerShell
1515
{
1616
using System.Management.Automation;
1717

18-
public static class PowerShellWorkerExtensions
18+
internal static class PowerShellWorkerExtensions
1919
{
2020
// This script handles when the user adds something to the pipeline.
2121
// It logs the item that comes and stores it as the $return out binding.

src/Azure.Functions.PowerShell.Worker/Requests/HandleFunctionLoadRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Requests
1212
{
1313
using System.Management.Automation;
1414

15-
public static class HandleFunctionLoadRequest
15+
internal static class HandleFunctionLoadRequest
1616
{
1717
public static StreamingMessage Invoke(
1818
PowerShell powershell,

src/Azure.Functions.PowerShell.Worker/Requests/HandleInvocationRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Requests
1515
{
1616
using System.Management.Automation;
1717

18-
public static class HandleInvocationRequest
18+
internal static class HandleInvocationRequest
1919
{
2020
public static StreamingMessage Invoke(
2121
PowerShell powershell,

src/Azure.Functions.PowerShell.Worker/Requests/HandleWorkerInitRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Requests
1010
{
1111
using System.Management.Automation;
1212

13-
public static class HandleWorkerInitRequest
13+
internal static class HandleWorkerInitRequest
1414
{
1515
public static StreamingMessage Invoke(
1616
PowerShell powershell,

src/Azure.Functions.PowerShell.Worker/Utility/TypeExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace Microsoft.Azure.Functions.PowerShellWorker.Utility
1515
{
16-
public static class TypeExtensions
16+
internal static class TypeExtensions
1717
{
1818
static HttpRequestContext ToHttpRequestContext (this RpcHttp rpcHttp)
1919
{

src/Azure.Functions.PowerShell.Worker/Worker.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
namespace Microsoft.Azure.Functions.PowerShellWorker
1919
{
20+
/// <summary>
21+
/// The PowerShell language worker for Azure Function
22+
/// </summary>
2023
public static class Worker
2124
{
2225
static readonly FunctionLoader s_functionLoader = new FunctionLoader();
@@ -49,6 +52,9 @@ static void InitPowerShell()
4952
s_ps.Commands.Clear();
5053
}
5154

55+
/// <summary>
56+
/// Entry point of the language worker.
57+
/// </summary>
5258
public async static Task Main(string[] args)
5359
{
5460
WorkerArguments arguments = null;

0 commit comments

Comments
 (0)