Exemplo n.º 1
0
    public static async Async.Task <Network> Create(string region, IOnefuzzContext context)
    {
        var group          = context.Creds.GetBaseResourceGroup();
        var instanceConfig = await context.ConfigOperations.Fetch();

        var networkConfig = instanceConfig.NetworkConfig;

        // Network names will be calculated from the address_space/subnet
        // *except* if they are the original values.  This allows backwards
        // compatibility to existing configs if you don't change the network
        // configs.

        string name;

        if (networkConfig.AddressSpace == NetworkConfig.Default.AddressSpace && networkConfig.Subnet == NetworkConfig.Default.Subnet)
        {
            name = region;
        }
        else
        {
            //TODO: Remove dependency on "Faithlife"
            var networkId = Faithlife.Utility.GuidUtility.Create(NETWORK_GUID_NAMESPACE, string.Join("|", networkConfig.AddressSpace, networkConfig.Subnet), 5);
            name = $"{region}-{networkId}";
        }


        return(new Network(region, group, name, context, networkConfig));
    }
Exemplo n.º 2
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);
Exemplo n.º 3
0
 public TimerWorkers(ILogTracer log, IOnefuzzContext context)
 {
     _log         = log;
     _scaleSetOps = context.ScalesetOperations;
     _poolOps     = context.PoolOperations;
     _nodeOps     = context.NodeOperations;
 }
Exemplo n.º 4
0
 public NodeOperations(
     ILogTracer log,
     IOnefuzzContext context
     )
     : base(log, context)
 {
 }
Exemplo n.º 5
0
 public Network(string region, string group, string name, IOnefuzzContext context, NetworkConfig networkConfig)
 {
     _region        = region;
     _group         = group;
     _name          = name;
     _context       = context;
     _networkConfig = networkConfig;
 }
Exemplo n.º 6
0
 public VmssOperations(ILogTracer log, IOnefuzzContext context, IMemoryCache cache)
 {
     _log           = log;
     _creds         = context.Creds;
     _imageOps      = context.ImageOperations;
     _serviceConfig = context.ServiceConfiguration;
     _cache         = cache;
 }
Exemplo n.º 7
0
 public Config(ILogTracer logTracer, IOnefuzzContext context)
 {
     _context       = context;
     _logTracer     = logTracer;
     _containers    = _context.Containers;
     _serviceConfig = _context.ServiceConfiguration;
     _queue         = _context.Queue;
 }
Exemplo n.º 8
0
 public ProxyForwardOperations(ILogTracer log, IOnefuzzContext context)
     : base(log, context)
 {
 }
Exemplo n.º 9
0
 public WebhookOperations(IHttpClientFactory httpFactory, ILogTracer log, IOnefuzzContext context)
     : base(log, context)
 {
     _httpFactory = httpFactory;
 }
Exemplo n.º 10
0
 public NodeMessageOperations(ILogTracer log, IOnefuzzContext context) : base(log, context)
 {
     _log = log;
 }
Exemplo n.º 11
0
 public ContainersFunction(ILogTracer logger, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _logger  = logger;
     _auth    = auth;
     _context = context;
 }
Exemplo n.º 12
0
 public Jobs(IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _context = context;
     _auth    = auth;
 }
Exemplo n.º 13
0
 public TestEndpointAuthorization(RequestType type, ILogTracer log, IOnefuzzContext context) : base(context, log)
 {
     _type    = type;
     _context = context;
 }
Exemplo n.º 14
0
 public NetworkInterfaceQuery(IOnefuzzContext context)
 {
     _context = context;
 }
Exemplo n.º 15
0
 public ImageOperations(ILogTracer logTracer, IOnefuzzContext context)
 {
     _logTracer = logTracer;
     _context   = context;
 }
Exemplo n.º 16
0
 public ProxyOperations(ILogTracer log, IOnefuzzContext context)
     : base(log.WithTag("Component", "scaleset-proxy"), context)
 {
 }
Exemplo n.º 17
0
 public Proxy(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _log     = log;
     _auth    = auth;
     _context = context;
 }
Exemplo n.º 18
0
 public IpOperations(ILogTracer log, IOnefuzzContext context)
 {
     _logTracer             = log;
     _context               = context;
     _networkInterfaceQuery = new NetworkInterfaceQuery(context);
 }
Exemplo n.º 19
0
 public TimerProxy(ILogTracer logTracer, IOnefuzzContext context)
 {
     _logger  = logTracer;
     _context = context;
 }
Exemplo n.º 20
0
 public JobOperations(ILogTracer logTracer, IOnefuzzContext context) : base(logTracer, context)
 {
 }
Exemplo n.º 21
0
 public AutoScaleOperations(ILogTracer log, IOnefuzzContext context)
     : base(log, context)
 {
 }
Exemplo n.º 22
0
 public QueueNodeHearbeat(ILogTracer log, IOnefuzzContext context)
 {
     _log     = log;
     _context = context;
 }
Exemplo n.º 23
0
 public Extensions(IOnefuzzContext context)
 {
     _context = context;
 }
Exemplo n.º 24
0
 public ScalesetOperations(ILogTracer log, IOnefuzzContext context)
     : base(log, context)
 {
     _log = log;
 }
Exemplo n.º 25
0
 public AgentRegistration(ILogTracer log, IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _log     = log;
     _auth    = auth;
     _context = context;
 }
Exemplo n.º 26
0
 public TaskEventOperations(ILogTracer logTracer, IOnefuzzContext context)
     : base(logTracer, context)
 {
 }
Exemplo n.º 27
0
 public Subnet(ICreds creds, ILogTracer logTracer, IOnefuzzContext context)
 {
     _creds     = creds;
     _logTracer = logTracer;
     _context   = context;
 }
Exemplo n.º 28
0
 public TimerRepro(ILogTracer log, IOnefuzzContext onefuzzContext)
 {
     _log            = log;
     _onefuzzContext = onefuzzContext;
 }
Exemplo n.º 29
0
 public ConfigOperations(ILogTracer log, IOnefuzzContext context) : base(log, context)
 {
     _log = log;
 }
Exemplo n.º 30
0
 public Download(IEndpointAuthorization auth, IOnefuzzContext context)
 {
     _auth    = auth;
     _context = context;
 }