-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created data cleanup project (#4548)
* created data cleanup project * set correct project guid * updated timer Co-authored-by: Stephanie Buadu <[email protected]>
- Loading branch information
Showing
9 changed files
with
155 additions
and
0 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
42 changes: 42 additions & 0 deletions
42
...n.Platform/Altinn.Platform.Storage/DataCleanup/Altinn.Platform.Storage.DataCleanup.csproj
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,42 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AzureFunctionsVersion>v3</AzureFunctionsVersion> | ||
<!-- SonarCloud needs this --> | ||
<ProjectGuid>{3F69C9C9-D602-490C-B2BA-A5FB27E363EE}</ProjectGuid> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Azure.Storage.Blobs" Version="12.4.4" /> | ||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.14.0" /> | ||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" /> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> | ||
<CodeAnalysisRuleSet>..\Altinn3.ruleset</CodeAnalysisRuleSet> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(Configuration)'=='Debug'"> | ||
<AdditionalFiles Include="..\stylecop.json"> | ||
<Link>stylecop.json</Link> | ||
</AdditionalFiles> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>$(NoWarn);1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Update="host.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="local.settings.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/NightlyCleanup.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,23 @@ | ||
using System; | ||
|
||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Altinn.Platform.Storage.DataCleanup | ||
{ | ||
/// <summary> | ||
/// Azure Function class for handling tasks related to nightly data cleanup. | ||
/// </summary> | ||
public class NightlyCleanup | ||
{ | ||
/// <summary> | ||
/// Runs nightly cleanup. | ||
/// </summary> | ||
/// <param name="timer">The trigger timer.</param> | ||
/// <param name="log">The log</param> | ||
[FunctionName("NightlyCleanup")] | ||
public static void Run([TimerTrigger("0 0 */1 * * 1-5")]TimerInfo timer, ILogger log) | ||
{ | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/Services/BlobService.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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Altinn.Platform.Storage.DataCleanup.Services | ||
{ | ||
public static class BlobService | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/Services/CosmosService.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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Altinn.Platform.Storage.DataCleanup.Services | ||
{ | ||
public static class CosmosService | ||
{ | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/Startup.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,21 @@ | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Azure.WebJobs.Hosting; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
namespace Altinn.Platform.Storage.DataCleanup | ||
{ | ||
/// <summary> | ||
/// The data cleanup startup | ||
/// </summary> | ||
public class Startup : IWebJobsStartup | ||
{ | ||
/// <summary> | ||
/// Gets data cleanup project configuration | ||
/// </summary> | ||
public void Configure(IWebJobsBuilder builder) | ||
{ | ||
builder.Services.TryAddSingleton<ITelemetryInitializer, TelemetryInitializer>(); | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/TelemetryInitializer.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,21 @@ | ||
using Microsoft.ApplicationInsights.Channel; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
|
||
namespace Altinn.Platform.Storage.DataCleanup | ||
{ | ||
/// <summary> | ||
/// Class that handles initialization of App Insights telemetry | ||
/// </summary> | ||
public class TelemetryInitializer : ITelemetryInitializer | ||
{ | ||
/// <summary> | ||
/// Initializer. | ||
/// </summary> | ||
/// <param name="telemetry">The telemetry</param> | ||
public void Initialize(ITelemetry telemetry) | ||
{ | ||
// set custom role name here | ||
telemetry.Context.Cloud.RoleName = "Storage Data Cleanup"; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/host.json
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,15 @@ | ||
{ | ||
"version": "2.0", | ||
"logging": { | ||
"applicationInsights": { | ||
"samplingExcludedTypes": "Request", | ||
"samplingSettings": { | ||
"isEnabled": true | ||
} | ||
}, | ||
"logLevel": { | ||
"default": "Information", | ||
"Function": "Information" | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Altinn.Platform/Altinn.Platform.Storage/DataCleanup/local.settings.json
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,7 @@ | ||
{ | ||
"IsEncrypted": false, | ||
"Values": { | ||
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | ||
"FUNCTIONS_WORKER_RUNTIME": "dotnet" | ||
} | ||
} |