This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing some bugs
- Loading branch information
stas
committed
May 10, 2022
1 parent
779a67e
commit 6949cd6
Showing
13 changed files
with
101 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/ApiService/ApiService/TestHooks/ProxyForwardTestHooks.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Net; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Azure.Functions.Worker.Http; | ||
using Microsoft.OneFuzz.Service; | ||
using Microsoft.OneFuzz.Service.OneFuzzLib.Orm; | ||
|
||
|
||
#if DEBUG | ||
namespace ApiService.TestHooks { | ||
public class ProxyForwardTestHooks { | ||
private readonly ILogTracer _log; | ||
private readonly IConfigOperations _configOps; | ||
private readonly IProxyForwardOperations _proxyForward; | ||
|
||
public ProxyForwardTestHooks(ILogTracer log, IConfigOperations configOps, IProxyForwardOperations proxyForward) { | ||
_log = log.WithTag("TestHooks", nameof(ProxyForwardTestHooks)); | ||
_configOps = configOps; ; | ||
_proxyForward = proxyForward; ; | ||
} | ||
|
||
[Function("SearchForwardTestHook")] | ||
public async Task<HttpResponseData> SearchForward([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "testhooks/proxyForwardOperations/search")] HttpRequestData req) { | ||
_log.Info("search proxy forward"); | ||
|
||
var query = UriExtension.GetQueryComponents(req.Url); | ||
|
||
var poolRes = _proxyForward.SearchForward( | ||
UriExtension.GetGuid("scaleSetId", query), | ||
UriExtension.GetString("region", query), | ||
UriExtension.GetGuid("machineId", query), | ||
UriExtension.GetGuid("proxyId", query), | ||
UriExtension.GetInt("dstPort", query)); | ||
|
||
var json = JsonSerializer.Serialize(await poolRes.ToListAsync(), EntityConverter.GetJsonSerializerOptions()); | ||
var resp = req.CreateResponse(HttpStatusCode.OK); | ||
await resp.WriteStringAsync(json); | ||
return resp; | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters