Skip to content

Commit

Permalink
Update to Corvus.Tenancy v3 and current Azure SDK (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
idg10 authored Dec 1, 2022
1 parent a1714a2 commit 6f6fbf3
Show file tree
Hide file tree
Showing 145 changed files with 5,617 additions and 7,101 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ appsettings.json

**/MsDeploy

*.feature.cs
*.ncrunchsolution

# Scripted build migration
_codeCoverage/
_packages/
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ branches:
- feature
- support
- hotfix
next-version: "2.3"
next-version: "3.0"

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[
{
"key": "operationsStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.azureblobstorage",
"configuration": {
"accountName": "",
"container": "operations",
"disableTenantIdPrefix": false
{
"serviceName": "Operations v1",
"configurationItems": {
"Marain:Operations:BlobContainerConfiguration:Operations": {
"contentType": "application/vnd.marain.tenancy.configurationitem.azureblobstorage.v3",
"configuration": {
"connectionStringPlainText": "UseDevelopmentStorage=true",
"container": "operations"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"key": "operationsStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.azureblobstorage",
"configuration": {
"accountName": "",
"container": "operations",
"disableTenantIdPrefix": false
}
}
]
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
[
{
"key": "workflowStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.cosmosdb",
"configuration": {
"accountUri": null,
"databaseName": null,
"containerName": null,
"disableTenantIdPrefix": false
{
"serviceName": "Workflow v1",
"configurationItems": {
"Marain:Workflow:BlobContainerConfiguration:Definitions": {
"contentType": "application/vnd.marain.tenancy.configurationitem.azureblobstorage.v3",
"configuration": {
"connectionStringPlainText": "UseDevelopmentStorage=true",
"container": "workflow-definitions"
}
},
"Marain:Workflow:CosmosContainerConfiguration:Instances": {
"contentType": "application/vnd.marain.tenancy.configurationitem.cosmosdb.v3",
"configuration": {
"accountUri": null,
"database": "workflow-instances",
"container": "test"
}
}
},
{
"key": "workflowInstanceStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.cosmosdb",
"configuration": {
"accountUri": null,
"databaseName": null,
"containerName": null,
"disableTenantIdPrefix": false
}
},
{
"key": "operationsStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.azureblobstorage",
"configuration": {
"accountName": null,
"container": "operations",
"disableTenantIdPrefix": false
"dependencies": {
"3633754ac4c9be44b55bfe791b1780f12429524fe7b6cc48a265a307407ec858": {
"serviceName": "Operations v1",
"configurationItems": {
"Marain:Operations:BlobContainerConfiguration:Operations": {
"contentType": "application/vnd.marain.tenancy.configurationitem.azureblobstorage.v3",
"configuration": {
"accountName": "",
"container": "workflow-operations"
}
}
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"key": "workflowStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.cosmosdb",
"configuration": {
"accountUri": null,
"databaseName": null,
"containerName": null,
"disableTenantIdPrefix": false
}
},
{
"key": "workflowInstanceStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.cosmosdb",
"configuration": {
"accountUri": null,
"databaseName": null,
"containerName": null,
"disableTenantIdPrefix": false
}
},
{
"key": "operationsStore",
"contentType": "application/vnd.marain.tenancy.enrollment.configurationitem.azureblobstorage",
"configuration": {
"accountName": null,
"container": "operations",
"disableTenantIdPrefix": false
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>true</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -15,12 +15,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Corvus.Testing.SpecFlow" Version="1.4.10" />
<PackageReference Include="Corvus.Testing.SpecFlow" Version="1.6.0" />
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[3.1.*,)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[6.0.*,)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
namespace Marain.TenantManagement.Testing
{
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Corvus.Extensions.Json;
using Corvus.Json;
using Corvus.Tenancy;
using Corvus.Tenancy.Exceptions;

using Newtonsoft.Json;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,17 @@ public async Task<ITenant> CreateTransientServiceTenantAsync(ServiceManifest man
/// </summary>
/// <param name="enrollingTenantId">The Id of the tenant to enroll.</param>
/// <param name="serviceTenantId">The Id of the service to enroll in.</param>
/// <param name="configurationItems">Configuration for the enrollment.</param>
/// <param name="configuration">Configuration for the enrollment.</param>
/// <returns>A task which completes when the enrollment has finished.</returns>
public async Task AddEnrollmentAsync(
string enrollingTenantId,
string serviceTenantId,
EnrollmentConfigurationItem[] configurationItems)
EnrollmentConfigurationEntry configuration)
{
await this.tenantStore.EnrollInServiceAsync(
enrollingTenantId,
serviceTenantId,
configurationItems).ConfigureAwait(false);
configuration).ConfigureAwait(false);

this.enrollments.Add((enrollingTenantId, serviceTenantId));
}
Expand All @@ -193,10 +193,7 @@ await this.tenantStore.CreateClientTenantAsync(

this.tenants.Add(tenant);

if (this.primaryTransientClient == null)
{
this.primaryTransientClient = tenant;
}
this.primaryTransientClient ??= tenant;

return tenant;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<Nullable>enable</Nullable>
<!--
Expand All @@ -23,8 +23,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Menes.Abstractions" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[3.1.*,)" />
<PackageReference Include="Menes.Abstractions" Version="4.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Marain.Services
{
using System;

/// <summary>
/// Standard configuration that all Marain services will have.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$(EndjinProjectPropsPath)" Condition="$(EndjinProjectPropsPath) != ''" />

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand All @@ -15,13 +15,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Corvus.Azure.Storage.Tenancy" Version="2.0.13" />
<PackageReference Include="Corvus.Azure.Cosmos.Tenancy" Version="2.0.13" />
<PackageReference Include="Corvus.Tenancy.Abstractions" Version="2.0.13" />
<PackageReference Include="Corvus.Tenancy.Abstractions" Version="3.4.0" />
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,37 @@
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Marain.TenantManagement.Configuration
{
using System.Collections.Generic;
namespace Marain.TenantManagement.Configuration;

using System.Collections.Generic;

using Marain.TenantManagement.EnrollmentConfiguration;

/// <summary>
/// Base class for the different types of configuration item that can be provided with a service enrollment.
/// </summary>
/// <remarks>
/// <para>
/// In practice, configuration types derive from <see cref="ConfigurationItem{TConfiguration}"/>,
/// but there are places where we need to be able to hold any configuration entry without knowing
/// its type at compile time (e.g. <see cref="EnrollmentConfigurationEntry.ConfigurationItems"/>).
/// </para>
/// </remarks>
public abstract class ConfigurationItem
{
/// <summary>
/// Base class for the different types of configuration item that can be provided with a service enrollment.
/// Base content type for configuration items.
/// </summary>
public abstract class ConfigurationItem
{
/// <summary>
/// Base content type for configuration items.
/// </summary>
public const string BaseContentType = "application/vnd.marain.tenancy.configurationitem.";

/// <summary>
/// Gets the content type for the configuration entry.
/// </summary>
public abstract string ContentType { get; }
public const string BaseContentType = "application/vnd.marain.tenancy.configurationitem.";

/// <summary>
/// Validates the configuration item.
/// </summary>
/// <returns>A list of validation errors. An empty list means that the item is valid.</returns>
public abstract IList<string> Validate();
/// <summary>
/// Gets the content type for the configuration entry.
/// </summary>
public abstract string ContentType { get; }

/// <summary>
/// Adds the configuration to a property set.
/// </summary>
/// <remarks>
/// This is called by the tenant store when adding configuration to the tenant.
/// The implementations of this method are expected to update <paramref name="values"/> with the
/// required key/value pair for this configuration item, then return the updated <paramref name="values"/>
/// object.
/// </remarks>
/// <param name="values">The property set.</param>
/// <returns>The updated property set.</returns>
public abstract IEnumerable<KeyValuePair<string, object>> AddConfiguration(IEnumerable<KeyValuePair<string, object>> values);
}
/// <summary>
/// Validates the configuration item.
/// </summary>
/// <returns>A list of validation errors. An empty list means that the item is valid.</returns>
public abstract IList<string> Validate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
namespace Marain.TenantManagement.Configuration
{
using System.Collections.Generic;
using System.Linq;

using Marain.TenantManagement.Exceptions;
using Marain.TenantManagement.ServiceManifests;

/// <summary>
/// Extension methods for the <see cref="ConfigurationItem"/> class.
Expand Down
Loading

0 comments on commit 6f6fbf3

Please sign in to comment.