Files
onefuzz/src/ApiService/ApiService/TestHooks/ContainerTestHooks.cs
Stas 476c99a998 use InterpolatedStringHandler to move values to CustomDimensions Tags instead of keeping them in the error message (#2450)
* 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>
2022-09-27 15:22:29 -07:00

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