public MmAuthenticationHandler(
     IHttpClientFactory httpClientFactory,
     AuthenticationConfig authenticationConfig,
     IBigBrother bigBrother)
     : base(httpClientFactory, authenticationConfig, bigBrother)
 {
 }
示例#2
0
 public ResourceGroupActor(ActorService actorService, ActorId actorId,
                           IIndex <DeploymentEnvironment, IAzure> azureFactory, IBigBrother bigBrother)
     : base(actorService, actorId)
 {
     _azureFactory = azureFactory;
     _bigBrother   = bigBrother;
 }
示例#3
0
        public void EntryPoint_PushTimed()
        {
            IBigBrother bb = BigBrother.CreateDefault(DevKey, DevKey).DeveloperMode();

            bb.Publish(new TestTimedEvent());
            bb.Flush();
        }
示例#4
0
 public ManagedIdentityActor(ActorService actorService, ActorId actorId,
                             IIndex <DeploymentEnvironment, IAzure> azureFactory, IBigBrother bigBrother)
     : base(actorService, actorId)
 {
     _azureFactory = azureFactory;
     _bigBrother   = bigBrother;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of <see cref="RepositoryActor"/>.
 /// </summary>
 /// <param name="actorService">The ActorService context.</param>
 /// <param name="actorId">The Actor ID.</param>
 /// <param name="gitClient">The <see cref="GitHttpClient"/> to use on repo operations.</param>
 /// <param name="vstsConfiguration">The VSTS configuration payload.</param>
 /// <param name="bb">big brother instance</param>
 public RepositoryActor(ActorService actorService, ActorId actorId, GitHttpClient gitClient, VstsConfiguration vstsConfiguration, IBigBrother bb)
     : base(actorService, actorId)
 {
     _gitClient         = gitClient;
     _vstsConfiguration = vstsConfiguration;
     _bigBrother        = bb;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of BuildDefinitionActor
 /// </summary>
 /// <param name="actorService">instance of <see cref="ActorService"/> that will host this actor instance.</param>
 /// <param name="actorId">instance of <see cref="ActorId"/> for this actor instance.</param>
 /// <param name="buildHttpClient">http build client</param>
 /// <param name="vstsConfig">vsts configuration</param>
 /// <param name="bb">big brother instance</param>
 public BuildDefinitionActor(ActorService actorService, ActorId actorId, BuildHttpClient buildHttpClient, VstsConfiguration vstsConfig, IBigBrother bb)
     : base(actorService, actorId)
 {
     _buildHttpClient   = buildHttpClient;
     _vstsConfiguration = vstsConfig;
     _bigBrother        = bb;
 }
 /// <summary>
 /// Constructs the instance of <see cref="ActorDirectCallMiddleware"/>.
 /// </summary>
 /// <param name="next">The next request middleware handler.</param>
 /// <param name="options">The middleware parameters.</param>
 /// <param name="bigBrother">The telemetry sink.</param>
 public ActorDirectCallMiddleware(RequestDelegate next, ActorDirectCallOptions options, IBigBrother bigBrother)
 {
     _next         = next;
     _options      = options;
     _bigBrother   = bigBrother;
     _actorMethods = new Lazy <Dictionary <string, ActorMethod> >(
         () => CreateActorMethodsDictionary(GetAssemblies(_options.InterfaceAssemblies)));
 }
        public OidcAuthenticationHandler(IHttpClientFactory httpClientFactory, AuthenticationConfig authenticationConfig, IBigBrother bigBrother)
        {
            var oAuthAuthenticationToken = authenticationConfig as OidcAuthenticationConfig;

            OidcAuthenticationConfig = oAuthAuthenticationToken ?? throw new ArgumentException($"configuration for basic authentication is not of type {typeof(OidcAuthenticationConfig)}", nameof(authenticationConfig));
            HttpClientFactory        = httpClientFactory;
            BigBrother = bigBrother;
        }
        /// <summary>
        /// Initializes a new instance of <see cref="BigBrotherExceptionMiddleware"/>.
        /// </summary>
        /// <param name="next">The next <see cref="RequestDelegate"/> in the pipeline.</param>
        /// <param name="bigBrother">The <see cref="IBigBrother"/> that we want to stream exception telemetry to.</param>
        public BigBrotherExceptionMiddleware(RequestDelegate next, IBigBrother bigBrother)
        {
            Next = next;
#if DEBUG
            Bb = bigBrother ?? throw new ArgumentNullException(nameof(bigBrother), $"{nameof(IBigBrother)} isn't registred as a service.");
#else
            Bb = bigBrother;
#endif
        }
        public AuthenticationHandlerFactory(
            IHttpClientFactory httpClientFactory,
            IBigBrother bigBrother)
        {
            _bigBrother        = bigBrother;
            _httpClientFactory = httpClientFactory;

            _handlers = new ConcurrentDictionary <string, IAuthenticationHandler>();
        }
示例#11
0
 /// <summary>
 /// Initializes a new instance of ReleaseDefinitionActor
 /// </summary>
 /// <param name="actorService">The Microsoft.ServiceFabric.Actors.Runtime.ActorService that will host this actor instance.</param>
 /// <param name="actorId">The Microsoft.ServiceFabric.Actors.ActorId for this actor instance.</param>
 /// <param name="releaseHttpClient">release client</param>
 /// <param name="vstsConfiguration">vsts configuration</param>
 /// <param name="bigBrother">BB instance</param>
 /// <param name="taskAgentHttpClient">task agent client instance</param>
 public ReleaseDefinitionActor(ActorService actorService, ActorId actorId, ReleaseHttpClient2 releaseHttpClient,
                               VstsConfiguration vstsConfiguration, IBigBrother bigBrother, TaskAgentHttpClient taskAgentHttpClient) :
     base(actorService, actorId)
 {
     _releaseHttpClient   = releaseHttpClient;
     _vstsConfiguration   = vstsConfiguration;
     _bigBrother          = bigBrother;
     _taskAgentHttpClient = taskAgentHttpClient;
 }
示例#12
0
 public CosmosDistributedLockStore(IDocumentClient documentClient, IOptions <CosmosDataStoreOptions> options, IBigBrother telemetry)
 {
     _options        = options;
     _telemetry      = telemetry;
     _retryPolicy    = CreateRetryPolicy();
     _documentClient = new Lazy <IDocumentClient>(() =>
                                                  InitialiseAsync(documentClient, _options.Value)
                                                  .ConfigureAwait(false).GetAwaiter().GetResult());
 }
示例#13
0
        /// <summary>
        /// Initializes a new instance of <see cref="BigBrotherExceptionMiddleware"/>.
        /// </summary>
        /// <param name="next">The next <see cref="RequestDelegate"/> in the pipeline.</param>
        /// <param name="bigBrother">The <see cref="IBigBrother"/> that we want to stream exception telemetry to.</param>
        /// <param name="responseHttpStatusCodeOnException">The <see cref="HttpStatusCode"/> we want to return in the response when handling an exception.</param>
        public BigBrotherExceptionMiddleware(RequestDelegate next, IBigBrother bigBrother, HttpStatusCode responseHttpStatusCodeOnException = HttpStatusCode.InternalServerError)
        {
            Next = next;
#if DEBUG
            Bb = bigBrother ?? throw new ArgumentNullException(nameof(bigBrother), $"{nameof(IBigBrother)} isn't registred as a service.");
#else
            Bb = bigBrother;
#endif
            _responseHttpStatusCodeOnException = responseHttpStatusCodeOnException;
        }
示例#14
0
 /// <summary>
 /// Initializes a new instance of EventHandlerActor
 /// </summary>
 /// <param name="actorService">The Microsoft.ServiceFabric.Actors.Runtime.ActorService that will host this actor instance.</param>
 /// <param name="actorId">The Microsoft.ServiceFabric.Actors.ActorId for this actor instance.</param>
 /// <param name="eventHandlerFactory"></param>
 /// <param name="bigBrother"></param>
 public EventHandlerActor(
     ActorService actorService,
     ActorId actorId,
     IEventHandlerFactory eventHandlerFactory,
     IBigBrother bigBrother)
     : base(actorService, actorId)
 {
     _eventHandlerFactory = eventHandlerFactory;
     _bigBrother          = bigBrother;
 }
示例#15
0
        /// <summary>
        /// Constructs the instance of <see cref="ActorLayerTestMiddleware"/>.
        /// </summary>
        /// <param name="next">The next request middleware handler.</param>
        /// <param name="options">The middleware parameters.</param>
        /// <param name="bigBrother">The telemetry sink.</param>
        public ActorLayerTestMiddleware(RequestDelegate next, ActorLayerTestMiddlewareOptions options, IBigBrother bigBrother)
        {
            _next       = next;
            _options    = options;
            _bigBrother = bigBrother;

            _actorMethods = new Lazy <Dictionary <string, ActorMethod> >(
                () => CreateActorMethodsDictionary(GetAssemblies(_options.InterfaceAssemblies)));

            _activeUntil = DateTime.UtcNow + _options.KillWindow;
        }
示例#16
0
 public LeaseAllocator(
     IBigBrother telemetry,
     ILeaseStore leaseStore,
     ISlottedInterval slottedInterval,
     IOptions <WorkerLeaseOptions> options)
 {
     _telemetry       = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
     _leaseStore      = leaseStore ?? throw new ArgumentNullException(nameof(leaseStore));
     _slottedInterval = slottedInterval ?? throw new ArgumentNullException(nameof(slottedInterval));
     _options         = options ?? throw new ArgumentNullException(nameof(options));
 }
        public CosmosDbLeaseStore(IDocumentClient documentClient, IBigBrother telemetry,
                                  IOptions <CosmosDataStoreOptions> options)
        {
            _documentClient = documentClient ?? throw new ArgumentNullException(nameof(documentClient));
            _telemetry      = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
            _options        = options ?? throw new ArgumentNullException(nameof(options));

            _retryPolicy = CreateRetryPolicy();

            ResourceMappingFunc = MapResource;
        }
示例#18
0
 public EventReaderTests()
 {
     _context = CustomMockStatefulServiceContextFactory.Create(
         ServiceNaming.EventReaderServiceType,
         ServiceNaming.EventReaderServiceFullUri("test.type", "subA"),
         Encoding.UTF8.GetBytes(EventReaderInitData.GetReaderInitDataAsString("test.type", "subA")), replicaId: (new Random(int.MaxValue)).Next());
     _mockActorProxyFactory = new MockActorProxyFactory();
     _stateManager          = new MockReliableStateManager();
     _config              = new ConfigurationSettings();
     _mockedBigBrother    = new Mock <IBigBrother>().Object;
     _mockMessageProvider = new Mock <IMessageReceiver>();
 }
示例#19
0
 public WebhookResponseHandler(
     IEventHandlerFactory eventHandlerFactory,
     IHttpClientFactory httpClientFactory,
     IRequestBuilder requestBuilder,
     IAuthenticationHandlerFactory authenticationHandlerFactory,
     IRequestLogger requestLogger,
     IBigBrother bigBrother,
     SubscriberConfiguration subscriberConfiguration)
     : base(httpClientFactory, authenticationHandlerFactory, requestBuilder, requestLogger, bigBrother, subscriberConfiguration)
 {
     _eventHandlerFactory     = eventHandlerFactory;
     _subscriberConfiguration = subscriberConfiguration;
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of <see cref="DirectorService"/>.
 /// </summary>
 /// <param name="context">The injected <see cref="StatefulServiceContext"/>.</param>
 /// <param name="bigBrother">The injected <see cref="IBigBrother"/> telemetry interface.</param>
 /// <param name="fabricClient">The injected <see cref="FabricClient"/>.</param>
 /// <param name="defaultServiceSettings"></param>
 public DirectorService(
     StatefulServiceContext context,
     IBigBrother bigBrother,
     FabricClient fabricClient,
     DefaultServiceSettings defaultServiceSettings,
     IEnumerable <EventHandlerConfig> eventHandlersConfig)
     : base(context)
 {
     _bigBrother             = bigBrother;
     _fabricClient           = fabricClient;
     _defaultServiceSettings = defaultServiceSettings;
     _eventHandlersConfig    = eventHandlersConfig;
 }
示例#21
0
 public EventHandlerFactory(
     IIndex <string, HttpClient> httpClients,
     IBigBrother bigBrother,
     IIndex <string, EventHandlerConfig> eventHandlerConfig,
     IIndex <string, WebhookConfig> webHookConfig,
     IAuthHandlerFactory authHandlerFactory)
 {
     _httpClients        = httpClients;
     _bigBrother         = bigBrother;
     _eventHandlerConfig = eventHandlerConfig;
     _authHandlerFactory = authHandlerFactory;
     _webHookConfig      = webHookConfig;
 }
 public WebhookResponseHandler(
     IEventHandlerFactory eventHandlerFactory,
     IAcquireTokenHandler acquireTokenHandler,
     IRequestBuilder requestBuilder,
     IBigBrother bigBrother,
     HttpClient client,
     EventHandlerConfig eventHandlerConfig)
     : base(acquireTokenHandler, requestBuilder, bigBrother, client, eventHandlerConfig.WebHookConfig)
 {
     _eventHandlerFactory = eventHandlerFactory;
     _client             = client;
     _eventHandlerConfig = eventHandlerConfig;
 }
 public GenericWebhookHandler(
     IAcquireTokenHandler acquireTokenHandler,
     IRequestBuilder requestBuilder,
     IBigBrother bigBrother,
     HttpClient client,
     WebhookConfig webhookConfig)
 {
     _client             = client;
     AcquireTokenHandler = acquireTokenHandler;
     BigBrother          = bigBrother;
     RequestBuilder      = requestBuilder;
     WebhookConfig       = webhookConfig;
 }
示例#24
0
        public void EntryPoint_PushAnonymous()
        {
            IBigBrother bb = BigBrother.CreateDefault(DevKey, DevKey).DeveloperMode();

            bb.Publish(new
            {
                SomeStuff        = Lorem.GetSentence(),
                SomeMoreStuff    = Lorem.GetSentence(),
                AndEvenMoreStuff = Lorem.GetSentence()
            });

            bb.Flush();
        }
示例#25
0
 /// <summary>
 /// Default ctor used at runtime
 /// </summary>
 /// <param name="context"></param>
 /// <param name="bigBrother"></param>
 /// <param name="serviceBusManager"></param>
 /// <param name="proxyFactory"></param>
 /// <param name="settings"></param>
 public EventReaderService(
     StatefulServiceContext context,
     IBigBrother bigBrother,
     IServiceBusManager serviceBusManager,
     IActorProxyFactory proxyFactory,
     ConfigurationSettings settings)
     : base(context)
 {
     _bigBrother        = bigBrother;
     _serviceBusManager = serviceBusManager;
     _proxyFactory      = proxyFactory;
     _settings          = settings;
     ParseOutInitData(context.InitializationData);
 }
示例#26
0
        public void EntryPoint_PushException()
        {
            const string message = "KABOOM!!!";
            IBigBrother  bb      = BigBrother.CreateDefault(DevKey, DevKey).DeveloperMode();

            try
            {
                BlowUp(message);
            }
            catch (Exception ex)
            {
                bb.Publish(ex.ToExceptionEvent());
                bb.Flush();
            }
        }
 public GenericWebhookHandler(
     IHttpClientFactory httpClientFactory,
     IAuthenticationHandlerFactory authenticationHandlerFactory,
     IRequestBuilder requestBuilder,
     IRequestLogger requestLogger,
     IBigBrother bigBrother,
     WebhookConfig webhookConfig)
 {
     BigBrother     = bigBrother;
     RequestBuilder = requestBuilder;
     _requestLogger = requestLogger;
     WebhookConfig  = webhookConfig;
     _authenticationHandlerFactory = authenticationHandlerFactory;
     HttpClientFactory             = httpClientFactory;
 }
示例#28
0
        /// <summary>
        /// </summary>
        /// <param name="basicDependency"></param>
        /// <param name="bb"></param>
        public ValuesController(BasicDependency basicDependency, IBigBrother bb)
        {
            _basicDependency = basicDependency;
            _bb = bb;
#if DEBUG
            // Don't perform these checks on Release code, as these are only development time errors
            if (basicDependency == null)
            {
                throw new ArgumentNullException(nameof(basicDependency));
            }
            if (bb == null)
            {
                throw new ArgumentNullException(nameof(bb));
            }
#endif
        }
示例#29
0
 public EventHandlerFactory(
     IBigBrother bigBrother,
     IIndex <string, SubscriberConfiguration> subscriberConfigurations,
     IIndex <string, WebhookConfig> webHookConfig,
     IHttpClientFactory httpClientFactory,
     IAuthenticationHandlerFactory authenticationHandlerFactory,
     IRequestLogger requestLogger,
     IRequestBuilder requestBuilder)
 {
     _bigBrother = bigBrother;
     _subscriberConfigurations     = subscriberConfigurations;
     _httpClientFactory            = httpClientFactory;
     _requestLogger                = requestLogger;
     _requestBuilder               = requestBuilder;
     _authenticationHandlerFactory = authenticationHandlerFactory;
     _webHookConfig                = webHookConfig;
 }
示例#30
0
        public WorkerLease(
            IBigBrother telemetry,
            ILeaseAllocator leaseAllocator,
            ITimer timer,
            ISlottedInterval slottedInterval,
            IOptions <WorkerLeaseOptions> options)
        {
            _telemetry       = telemetry ?? throw new ArgumentNullException(nameof(telemetry));
            _leaseAllocator  = leaseAllocator ?? throw new ArgumentNullException(nameof(leaseAllocator));
            _options         = options ?? throw new ArgumentNullException(nameof(options));
            _timer           = timer ?? throw new ArgumentNullException(nameof(timer));
            _slottedInterval = slottedInterval ?? throw new ArgumentNullException(nameof(slottedInterval));

            InstanceId = _options.Value.InstanceId ?? Guid.NewGuid();

            if (string.IsNullOrWhiteSpace(_options.Value.WorkerType))
            {
                throw new ArgumentOutOfRangeException($"{nameof(options.Value.WorkerType)} cannot be null or empty");
            }
        }