Ejemplo n.º 1
0
    public Info(IEndpointAuthorization auth, IOnefuzzContext context)
    {
        _context = context;
        _auth    = auth;

        // TODO: this isn’t actually shared between calls at the moment,
        // this needs to be placed into a class that can be registered into the
        // DI container and shared amongst instances.
        //
        // However, we need to be careful about auth and caching between different
        // credentials.
        _response = new Lazy <Async.Task <InfoResponse> >(async() => {
            var config = _context.ServiceConfiguration;

            var resourceGroup = _context.Creds.GetBaseResourceGroup();
            var subscription  = _context.Creds.GetSubscription();
            var region        = await _context.Creds.GetBaseRegion();

            var asm           = Assembly.GetExecutingAssembly();
            var gitVersion    = ReadResource(asm, "ApiService.onefuzzlib.git.version");
            var buildId       = ReadResource(asm, "ApiService.onefuzzlib.build.id");
            var versionString = asm.GetCustomAttribute <AssemblyInformationalVersionAttribute>()?.InformationalVersion;

            return(new InfoResponse(
                       ResourceGroup: resourceGroup,
                       Subscription: subscription,
                       Region: region,
                       Versions: new Dictionary <string, InfoVersion> {
                { "onefuzz", new(gitVersion, buildId, versionString ?? "") }
            },
                       InstanceId: await _context.Containers.GetInstanceId(),
                       InsightsAppid: config.ApplicationInsightsAppId,
                       InsightsInstrumentationKey: config.ApplicationInsightsInstrumentationKey));
        }, LazyThreadSafetyMode.PublicationOnly);
Ejemplo n.º 2
0
 public AgentRegistration(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _log     = log;
     _auth    = auth;
     _context = context;
 }
Ejemplo n.º 3
0
 public Proxy(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _log     = log;
     _auth    = auth;
     _context = context;
 }
Ejemplo n.º 4
0
 public Jobs(IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _context = context;
     _auth    = auth;
 }
Ejemplo n.º 5
0
 public ContainersFunction(ILogTracer logger, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _logger  = logger;
     _auth    = auth;
     _context = context;
 }
Ejemplo n.º 6
0
 public Download(IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _auth    = auth;
     _context = context;
 }
Ejemplo n.º 7
0
 public AgentCanSchedule(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _log     = log;
     _auth    = auth;
     _context = context;
 }