mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 12:48:07 +00:00
* use InterpolatedStringHandler to move values to CustomDimensions Tags instead of keeping them in the error message * log blob save raw response failure * add StringBuilder to CSharpExtensions Co-authored-by: stas <statis@microsoft.com>
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System.Net;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Azure.Functions.Worker;
|
|
using Microsoft.Azure.Functions.Worker.Http;
|
|
|
|
using Microsoft.OneFuzz.Service;
|
|
|
|
#if DEBUG
|
|
namespace ApiService.TestHooks {
|
|
public class ContainerTestHooks {
|
|
|
|
private readonly ILogTracer _log;
|
|
private readonly IConfigOperations _configOps;
|
|
private readonly IContainers _containers;
|
|
|
|
public ContainerTestHooks(ILogTracer log, IConfigOperations configOps, IContainers containers) {
|
|
_log = log.WithTag("TestHooks", nameof(ContainerTestHooks));
|
|
_configOps = configOps;
|
|
_containers = containers;
|
|
}
|
|
|
|
[Function("GetInstanceIdTestHook")]
|
|
public async Task<HttpResponseData> GetInstanceId([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "testhooks/containers/instanceId")] HttpRequestData req) {
|
|
_log.Info($"Get instance ID");
|
|
var instanceId = await _containers.GetInstanceId();
|
|
|
|
var resp = req.CreateResponse(HttpStatusCode.OK);
|
|
await resp.WriteStringAsync(instanceId.ToString());
|
|
return resp;
|
|
}
|
|
}
|
|
}
|
|
#endif
|