protected void SetupDataClient(RestTestFramework.MockContext context) { var credentials = new ApiKeyClientCredentials("DEMO_KEY"); var operationalInsightsDataClient = new OperationalInsightsDataClient(credentials, HttpMockServer.CreateInstance()); _helper.SetupManagementClients(operationalInsightsDataClient); }
private static ApplicationInsightsDataClient CreateApplicationInsightsClient(string apiKey) { var clientCredentials = new ApiKeyClientCredentials(apiKey); var client = new ApplicationInsightsDataClient(clientCredentials); return(client); }
private ApplicationInsightsDataClient CreateApplicationInsightsClient() { var clientCredentials = new ApiKeyClientCredentials(ApplicationInsightsConfig.ApiKey); var client = new ApplicationInsightsDataClient(clientCredentials); return(client); }
protected ApplicationInsightsDataClient CreateApplicationInsightsClient() { var clientCredentials = new ApiKeyClientCredentials(Configuration.GetValue <string>("ApplicationInsights:ApiKey")); var client = new ApplicationInsightsDataClient(clientCredentials); return(client); }
public static Task <IHttpResponse> WebhookAsync( [Resource] object appInsightsCallback, ContentTypeResponse <EventsExceptionResult[]> onResults) { return(AppSettings.ApplicationInsights.ApplicationId.ConfigurationString( applicationId => { return AppSettings.ApplicationInsights.ClientSecret.ConfigurationString( async token => { // Authenticate with client secret (app key) var clientCred = new ApiKeyClientCredentials(token); // New up a client with credentials and AI application Id var client = new ApplicationInsightsDataClient(clientCred); client.AppId = applicationId; var exceptionEvents = await client.GetExceptionEventsAsync( timespan: TimeSpan.FromMinutes(240.0), top: 10, format: "application/json;odata.metadata=full"); var requestEvents = await client.GetRequestEventsAsync( timespan: TimeSpan.FromMinutes(30.0)); return onResults(exceptionEvents.Value.ToArray()); }); })); }
private OperationalInsightsDataClient GetClient(MockContext ctx, string workspaceId = DefaultWorkspaceId, string apiKey = DefaultApiKey) { var credentials = new ApiKeyClientCredentials(apiKey); var client = new OperationalInsightsDataClient(credentials, HttpMockServer.CreateInstance()); client.WorkspaceId = workspaceId; return(client); }
protected ApplicationInsightsDataClient GetClient(MockContext ctx, string appId = DefaultAppId, string apiKey = DefaultApiKey) { var credentials = new ApiKeyClientCredentials(apiKey); var client = new ApplicationInsightsDataClient(credentials, HttpMockServer.CreateInstance()); client.BaseUri = new Uri("https://api.applicationinsights.io/v1"); return(client); }
public static Task <HttpResponseMessage> GetAsync( [QueryParameter] string eventId) { return(AppSettings.ApplicationInsights.ApplicationId.ConfigurationString( applicationId => { return AppSettings.ApplicationInsights.ClientSecret.ConfigurationString( async token => { // Authenticate with client secret (app key) var clientCred = new ApiKeyClientCredentials(token); // New up a client with credentials and AI application Id var client = new ApplicationInsightsDataClient(clientCred); client.AppId = applicationId; var asdf = await client.GetRequestEventAsync(eventId); //timespan: TimeSpan.FromMinutes(30.0),); // asdf.Body.Value[0].Request. return new HttpResponseMessage(); }); })); }