public LoggingOptions( INaosServicesContext context, LoggerConfiguration loggerConfiguration) { this.Context = context; this.LoggerConfiguration = loggerConfiguration; }
public static INaosServicesContext AddAzureLogAnalytics(this INaosServicesContext context, string logName) { EnsureArg.IsNotNull(context, nameof(context)); EnsureArg.IsNotNull(context.Services, nameof(context.Services)); var configuration = context.Configuration?.GetSection("naos:operations:logging:azureLogAnalytics").Get <LogAnalyticsConfiguration>(); // TODO: move to operations:logevents:azureLogAnalytics if (configuration != null) { context.Services.AddScoped <ILogEventRepository>(sp => { // authenticate api https://dev.int.loganalytics.io/documentation/1-Tutorials/ARM-API var token = new AuthenticationContext( $"https://login.microsoftonline.com/{configuration.ApiAuthentication?.TenantId}", false) .AcquireTokenAsync( configuration.ApiAuthentication?.Resource ?? "https://management.azure.com", new ClientCredential( configuration.ApiAuthentication?.ClientId, configuration.ApiAuthentication?.ClientSecret)).Result; return(new LogAnalyticsRepository( sp.GetRequiredService <ILoggerFactory>(), new System.Net.Http.HttpClient(), // TODO: resolve from container! token?.AccessToken, configuration.SubscriptionId, configuration.ResourceGroupName, configuration.WorkspaceName, $"{logName.Replace("_CL", string.Empty)}_CL")); }); context.Messages.Add($"{LogEventKeys.Startup} naos services builder: logging azure loganalytics repository added (name={logName}_CL, workspace={configuration.WorkspaceId})"); } return(context); }
public static INaosServicesContext AddServiceClient(this INaosServicesContext context, string name, Action <IHttpClientBuilder> setupAction = null) { EnsureArg.IsNotNull(context, nameof(context)); EnsureArg.IsNotNullOrEmpty(name, nameof(name)); context.Messages.Add($"{LogKeys.Startup} naos services builder: named service client added (name={name})"); if (setupAction != null) { var builder = context.Services .AddHttpClient(name); setupAction.Invoke(builder); } else { // default setup context.Services .AddHttpClient(name) .AddNaosMessageHandlers() .AddNaosPolicyHandlers(); } return(context); }
public static INaosServicesContext AddServiceClient <TClient>(this INaosServicesContext context, Action <IHttpClientBuilder> setupAction = null) where TClient : ServiceDiscoveryClient { EnsureArg.IsNotNull(context, nameof(context)); context.Messages.Add($"{LogKeys.Startup} naos services builder: typed service client added (type={typeof(TClient).Name})"); if (setupAction != null) { var builder = context.Services .AddHttpClient <TClient>(); setupAction.Invoke(builder); } else { // default setup context.Services .AddHttpClient <TClient>() .AddNaosMessageHandlers() .AddNaosPolicyHandlers(); } return(context); }
public JobSchedulingOptions(INaosServicesContext context) { this.Context = context; }
public CommandsOptions(INaosServicesContext context) { this.Context = context; }
public ServiceDiscoveryOptions(INaosServicesContext context) { this.Context = context; }
public NaosServicesContextOptions(INaosServicesContext context) { this.Context = context; }
public QueueingOptions(INaosServicesContext context) { this.Context = context; }
public MessagingOptions(INaosServicesContext context) { this.Context = context; }
public RequestStorageOptions(INaosServicesContext context) { this.Context = context; }
public OperationsOptions(INaosServicesContext context) { this.Context = context; }