-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple HttpTrigger from discovery logic and ActivityService/History (…
…#317) * Added ActivityHistory refactored some classes into their own files removed old DAL/DALResolver * added collection/queue for activity support * Shell for classifier logic * changes to support ActivityHistory for long running activity (graph queries) * Changes to support redirect on request. * moved interface definitions to Interfaces added some file headers
- Loading branch information
Showing
50 changed files
with
1,456 additions
and
1,143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/Automation/CSE.Automation/DataAccess/ActivityHistoryRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using CSE.Automation.Interfaces; | ||
using CSE.Automation.Model; | ||
using Microsoft.Azure.Cosmos; | ||
using Microsoft.Azure.Cosmos.Table; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Graph; | ||
|
||
namespace CSE.Automation.DataAccess | ||
{ | ||
internal class ActivityHistoryRepository : CosmosDBRepository<ActivityHistory>, IActivityHistoryRepository | ||
{ | ||
private readonly ActivityHistoryRepositorySettings settings; | ||
public ActivityHistoryRepository(ActivityHistoryRepositorySettings settings, ILogger<AuditRepository> logger) | ||
: base(settings, logger) | ||
{ | ||
this.settings = settings; | ||
} | ||
|
||
public override string GenerateId(ActivityHistory entity) | ||
{ | ||
if (string.IsNullOrWhiteSpace(entity.Id)) | ||
{ | ||
entity.Id = Guid.NewGuid().ToString(); | ||
} | ||
|
||
return entity.Id; | ||
} | ||
|
||
public async Task<IEnumerable<ActivityHistory>> GetCorrelated(string correlationId) | ||
{ | ||
return await InternalCosmosDBSqlQuery($"select * from c where c.correlationId = '{correlationId}' order by c.created").ConfigureAwait(false); | ||
} | ||
|
||
public override string CollectionName => settings.CollectionName; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Automation/CSE.Automation/DataAccess/ActivityHistoryRepositorySettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Text; | ||
using CSE.Automation.Interfaces; | ||
using CSE.Automation.Model; | ||
using Microsoft.Azure.Cosmos; | ||
using Microsoft.Azure.Cosmos.Table; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Graph; | ||
|
||
namespace CSE.Automation.DataAccess | ||
{ | ||
internal class ActivityHistoryRepositorySettings : CosmosDBSettings | ||
{ | ||
public ActivityHistoryRepositorySettings(ISecretClient secretClient) | ||
: base(secretClient) | ||
{ | ||
} | ||
|
||
public string CollectionName { get; set; } | ||
public override void Validate() | ||
{ | ||
base.Validate(); | ||
if (string.IsNullOrEmpty(this.CollectionName)) | ||
{ | ||
throw new ConfigurationErrorsException($"{this.GetType().Name}: CollectionName is invalid"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Automation/CSE.Automation/DataAccess/AuditRepositorySettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Text; | ||
using CSE.Automation.Interfaces; | ||
using CSE.Automation.Model; | ||
using Microsoft.Azure.Cosmos; | ||
using Microsoft.Azure.Cosmos.Table; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Graph; | ||
|
||
namespace CSE.Automation.DataAccess | ||
{ | ||
internal class AuditRepositorySettings : CosmosDBSettings | ||
{ | ||
public AuditRepositorySettings(ISecretClient secretClient) | ||
: base(secretClient) | ||
{ | ||
} | ||
|
||
public string CollectionName { get; set; } | ||
public override void Validate() | ||
{ | ||
base.Validate(); | ||
if (string.IsNullOrEmpty(this.CollectionName)) | ||
{ | ||
throw new ConfigurationErrorsException($"{this.GetType().Name}: CollectionName is invalid"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.