diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73236af..d1a4aa0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,11 +26,10 @@ jobs: with: fetch-depth: 0 - - name: Install .NET SDK 7.0.x - 8.0.x + - name: Install .NET SDK 8.0.x uses: actions/setup-dotnet@v3 with: dotnet-version: | - 7.0.x 8.0.x - name: Install .NET SDK diff --git a/global.json b/global.json index e66cdc8..96cd223 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,5 @@ { "sdk": { - "version": "8.0.203", - "rollForward": "latestMinor", - "allowPrerelease": false + "version": "9.0.100-rc.1.24452.12" } } \ No newline at end of file diff --git a/src/ARI.TestWeb/ARI.TestWeb.csproj b/src/ARI.TestWeb/ARI.TestWeb.csproj index 41508b3..dc9a9b1 100644 --- a/src/ARI.TestWeb/ARI.TestWeb.csproj +++ b/src/ARI.TestWeb/ARI.TestWeb.csproj @@ -11,6 +11,18 @@ + + + + + + + + + + + + diff --git a/src/ARI.Tests/ARI.Tests.csproj b/src/ARI.Tests/ARI.Tests.csproj index 35e8de1..8c55601 100644 --- a/src/ARI.Tests/ARI.Tests.csproj +++ b/src/ARI.Tests/ARI.Tests.csproj @@ -1,7 +1,7 @@  - net7.0;net8.0 + net9.0;net8.0 enable enable false diff --git a/src/ARI.Tests/Fixture/MocksFixture.cs b/src/ARI.Tests/Fixture/MocksFixture.cs index 1aa383d..ab8008a 100644 --- a/src/ARI.Tests/Fixture/MocksFixture.cs +++ b/src/ARI.Tests/Fixture/MocksFixture.cs @@ -89,7 +89,7 @@ public static class MocksFixture ) ); #pragma warning disable CS8601 // Possible null reference assignment. - public static IDictionary Properties { get; } = JsonSerializer.Deserialize>( + public static IDictionary Properties { get; } = JsonSerializer.Deserialize>( """ { "alwaysOn": false, diff --git a/src/ARI.Tests/TestCaseGenericAttribute.cs b/src/ARI.Tests/TestCaseGenericAttribute.cs index 92dabd4..1ab2b18 100644 --- a/src/ARI.Tests/TestCaseGenericAttribute.cs +++ b/src/ARI.Tests/TestCaseGenericAttribute.cs @@ -9,7 +9,7 @@ using NUnit.Framework.Internal.Builders; using NUnit.Framework.Internal; -namespace NUnit.Framework; +namespace NUnit.Framework.Extensions; [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public class TestCaseGenericAttribute : TestCaseAttribute, ITestBuilder diff --git a/src/ARI.Tests/Unit/Services/ARM/TokenServiceTests.cs b/src/ARI.Tests/Unit/Services/ARM/TokenServiceTests.cs index ff92c2c..4897e50 100644 --- a/src/ARI.Tests/Unit/Services/ARM/TokenServiceTests.cs +++ b/src/ARI.Tests/Unit/Services/ARM/TokenServiceTests.cs @@ -8,8 +8,8 @@ namespace ARI.Tests.Unit.Services.ARM; [TestFixture] public class TokenServiceTests { - [TestCase>(Constants.Request.Uri.Tenants)] - [TestCase>(Constants.Request.Uri.Subscriptions)] + [NUnit.Framework.Extensions.TestCase>(Constants.Request.Uri.Tenants)] + [NUnit.Framework.Extensions.TestCase>(Constants.Request.Uri.Subscriptions)] public async Task ARMHttpClientGetAsync(string url) { // Given @@ -26,7 +26,7 @@ public async Task ARMHttpClientGetAsync(string url) await Verify(result); } - [TestCase(Constants.Request.Uri.GraphOrg)] + [NUnit.Framework.Extensions.TestCase(Constants.Request.Uri.GraphOrg)] public async Task GraphHttpClientGetAsync(string url) { // Given diff --git a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-dev_siteName=lab-web-web-dev.verified.txt b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-dev_siteName=lab-web-web-dev.verified.txt index 8ac0746..304ca3d 100644 --- a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-dev_siteName=lab-web-web-dev.verified.txt +++ b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-dev_siteName=lab-web-web-dev.verified.txt @@ -5,319 +5,275 @@ Location: West Europe, Properties: { acrUseManagedIdentityCreds: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + acrUserManagedIdentityID: { + ValueKind: Null }, - acrUserManagedIdentityID: null, alwaysOn: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, antivirusScanEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + apiDefinition: { + ValueKind: Null + }, + apiManagementConfig: { + ValueKind: Null }, - apiDefinition: null, - apiManagementConfig: null, appCommandLine: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + appSettings: { + ValueKind: Null }, - appSettings: null, autoHealEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + autoHealRules: { + ValueKind: Null + }, + autoSwapSlotName: { + ValueKind: Null + }, + azureMonitorLogCategories: { + ValueKind: Null }, - autoHealRules: null, - autoSwapSlotName: null, - azureMonitorLogCategories: null, azureStorageAccounts: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + connectionStrings: { + ValueKind: Null + }, + cors: { + ValueKind: Null }, - connectionStrings: null, - cors: null, customAppPoolIdentityAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, customAppPoolIdentityTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, defaultDocuments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, detailedErrorLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + documentRoot: { + ValueKind: Null }, - documentRoot: null, elasticWebAppScaleLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, experiments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object }, fileChangeAuditEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ftpsState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + functionAppScaleLimit: { + ValueKind: Null }, - functionAppScaleLimit: null, functionsRuntimeScaleMonitoringEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + handlerMappings: { + ValueKind: Null + }, + healthCheckPath: { + ValueKind: Null }, - handlerMappings: null, - healthCheckPath: null, http20Enabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, http20ProxyFlag: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, httpLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ipSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } - }, - ipSecurityRestrictionsDefaultAction: null, - javaContainer: null, - javaContainerVersion: null, - javaVersion: null, - keyVaultReferenceIdentity: null, - limits: null, + ValueKind: Array + }, + ipSecurityRestrictionsDefaultAction: { + ValueKind: Null + }, + javaContainer: { + ValueKind: Null + }, + javaContainerVersion: { + ValueKind: Null + }, + javaVersion: { + ValueKind: Null + }, + keyVaultReferenceIdentity: { + ValueKind: Null + }, + limits: { + ValueKind: Null + }, linuxFxVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, loadBalancing: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, localMySqlEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, logsDirectorySizeLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + machineKey: { + ValueKind: Null }, - machineKey: null, managedPipelineMode: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, managedServiceIdentityId: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + metadata: { + ValueKind: Null }, - metadata: null, minimumElasticInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + minTlsCipherSuite: { + ValueKind: Null }, - minTlsCipherSuite: null, minTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, netFrameworkVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, nodeVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, numberOfWorkers: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, phpVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, powerShellVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, preWarmedInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + publicNetworkAccess: { + ValueKind: Null + }, + publishingPassword: { + ValueKind: Null }, - publicNetworkAccess: null, - publishingPassword: null, publishingUsername: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + push: { + ValueKind: Null }, - push: null, pythonVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, remoteDebuggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, remoteDebuggingVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, requestTracingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, routingRules: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + runtimeADUser: { + ValueKind: Null + }, + runtimeADUserPassword: { + ValueKind: Null }, - runtimeADUser: null, - runtimeADUserPassword: null, scmIpSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + scmIpSecurityRestrictionsDefaultAction: { + ValueKind: Null }, - scmIpSecurityRestrictionsDefaultAction: null, scmIpSecurityRestrictionsUseMain: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, scmMinTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, scmType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, siteAuthEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, siteAuthSettings: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + sitePort: { + ValueKind: Null }, - sitePort: null, sitePrivateLinkHostEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, storageType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + supportedTlsCipherSuites: { + ValueKind: Null + }, + tracingOptions: { + ValueKind: Null }, - supportedTlsCipherSuites: null, - tracingOptions: null, use32BitWorkerProcess: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: True }, virtualApplications: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, vnetName: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, vnetPrivatePortsCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, vnetRouteAllEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + websiteTimeZone: { + ValueKind: Null }, - websiteTimeZone: null, webSocketsEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, winAuthAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, winAuthTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, windowsConfiguredStacks: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + windowsFxVersion: { + ValueKind: Null }, - windowsFxVersion: null, - xManagedServiceIdentityId: null + xManagedServiceIdentityId: { + ValueKind: Null + } }, PublicId: /subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05/resourceGroups/lab-dev/providers/Microsoft.Web/sites/lab-web-web-dev/config/web, Description: lab-web-web-dev, diff --git a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-prd_siteName=lab-web-web-prd.verified.txt b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-prd_siteName=lab-web-web-prd.verified.txt index 84a32a7..0226b88 100644 --- a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-prd_siteName=lab-web-web-prd.verified.txt +++ b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-prd_siteName=lab-web-web-prd.verified.txt @@ -5,319 +5,275 @@ Location: West Europe, Properties: { acrUseManagedIdentityCreds: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + acrUserManagedIdentityID: { + ValueKind: Null }, - acrUserManagedIdentityID: null, alwaysOn: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, antivirusScanEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + apiDefinition: { + ValueKind: Null + }, + apiManagementConfig: { + ValueKind: Null }, - apiDefinition: null, - apiManagementConfig: null, appCommandLine: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + appSettings: { + ValueKind: Null }, - appSettings: null, autoHealEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + autoHealRules: { + ValueKind: Null + }, + autoSwapSlotName: { + ValueKind: Null + }, + azureMonitorLogCategories: { + ValueKind: Null }, - autoHealRules: null, - autoSwapSlotName: null, - azureMonitorLogCategories: null, azureStorageAccounts: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + connectionStrings: { + ValueKind: Null + }, + cors: { + ValueKind: Null }, - connectionStrings: null, - cors: null, customAppPoolIdentityAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, customAppPoolIdentityTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, defaultDocuments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, detailedErrorLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + documentRoot: { + ValueKind: Null }, - documentRoot: null, elasticWebAppScaleLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, experiments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object }, fileChangeAuditEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ftpsState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + functionAppScaleLimit: { + ValueKind: Null }, - functionAppScaleLimit: null, functionsRuntimeScaleMonitoringEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + handlerMappings: { + ValueKind: Null + }, + healthCheckPath: { + ValueKind: Null }, - handlerMappings: null, - healthCheckPath: null, http20Enabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, http20ProxyFlag: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, httpLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ipSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } - }, - ipSecurityRestrictionsDefaultAction: null, - javaContainer: null, - javaContainerVersion: null, - javaVersion: null, - keyVaultReferenceIdentity: null, - limits: null, + ValueKind: Array + }, + ipSecurityRestrictionsDefaultAction: { + ValueKind: Null + }, + javaContainer: { + ValueKind: Null + }, + javaContainerVersion: { + ValueKind: Null + }, + javaVersion: { + ValueKind: Null + }, + keyVaultReferenceIdentity: { + ValueKind: Null + }, + limits: { + ValueKind: Null + }, linuxFxVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, loadBalancing: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, localMySqlEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, logsDirectorySizeLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + machineKey: { + ValueKind: Null }, - machineKey: null, managedPipelineMode: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, managedServiceIdentityId: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + metadata: { + ValueKind: Null }, - metadata: null, minimumElasticInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + minTlsCipherSuite: { + ValueKind: Null }, - minTlsCipherSuite: null, minTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, netFrameworkVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, nodeVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, numberOfWorkers: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, phpVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, powerShellVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, preWarmedInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + publicNetworkAccess: { + ValueKind: Null + }, + publishingPassword: { + ValueKind: Null }, - publicNetworkAccess: null, - publishingPassword: null, publishingUsername: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + push: { + ValueKind: Null }, - push: null, pythonVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, remoteDebuggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, remoteDebuggingVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, requestTracingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, routingRules: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + runtimeADUser: { + ValueKind: Null + }, + runtimeADUserPassword: { + ValueKind: Null }, - runtimeADUser: null, - runtimeADUserPassword: null, scmIpSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + scmIpSecurityRestrictionsDefaultAction: { + ValueKind: Null }, - scmIpSecurityRestrictionsDefaultAction: null, scmIpSecurityRestrictionsUseMain: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, scmMinTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, scmType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, siteAuthEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, siteAuthSettings: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + sitePort: { + ValueKind: Null }, - sitePort: null, sitePrivateLinkHostEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, storageType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + supportedTlsCipherSuites: { + ValueKind: Null + }, + tracingOptions: { + ValueKind: Null }, - supportedTlsCipherSuites: null, - tracingOptions: null, use32BitWorkerProcess: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: True }, virtualApplications: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, vnetName: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, vnetPrivatePortsCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, vnetRouteAllEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + websiteTimeZone: { + ValueKind: Null }, - websiteTimeZone: null, webSocketsEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, winAuthAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, winAuthTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, windowsConfiguredStacks: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + windowsFxVersion: { + ValueKind: Null }, - windowsFxVersion: null, - xManagedServiceIdentityId: null + xManagedServiceIdentityId: { + ValueKind: Null + } }, PublicId: /subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05/resourceGroups/lab-prd/providers/Microsoft.Web/sites/lab-web-web-prd/config/web, Description: lab-web-web-prd, diff --git a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-stg_siteName=lab-web-web-stg.verified.txt b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-stg_siteName=lab-web-web-stg.verified.txt index e97e548..e7b49a0 100644 --- a/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-stg_siteName=lab-web-web-stg.verified.txt +++ b/src/ARI.Tests/Unit/Services/ARM/WebAppConfigServiceTests.GetWebAppConfig_subscriptionId=291bba3f-e0a5-47bc-a099-3bdcb2a50a05_resourceGroupName=lab-stg_siteName=lab-web-web-stg.verified.txt @@ -5,319 +5,275 @@ Location: West Europe, Properties: { acrUseManagedIdentityCreds: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + acrUserManagedIdentityID: { + ValueKind: Null }, - acrUserManagedIdentityID: null, alwaysOn: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, antivirusScanEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + apiDefinition: { + ValueKind: Null + }, + apiManagementConfig: { + ValueKind: Null }, - apiDefinition: null, - apiManagementConfig: null, appCommandLine: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + appSettings: { + ValueKind: Null }, - appSettings: null, autoHealEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + autoHealRules: { + ValueKind: Null + }, + autoSwapSlotName: { + ValueKind: Null + }, + azureMonitorLogCategories: { + ValueKind: Null }, - autoHealRules: null, - autoSwapSlotName: null, - azureMonitorLogCategories: null, azureStorageAccounts: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + connectionStrings: { + ValueKind: Null + }, + cors: { + ValueKind: Null }, - connectionStrings: null, - cors: null, customAppPoolIdentityAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, customAppPoolIdentityTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, defaultDocuments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, detailedErrorLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + documentRoot: { + ValueKind: Null }, - documentRoot: null, elasticWebAppScaleLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, experiments: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object }, fileChangeAuditEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ftpsState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + functionAppScaleLimit: { + ValueKind: Null }, - functionAppScaleLimit: null, functionsRuntimeScaleMonitoringEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + handlerMappings: { + ValueKind: Null + }, + healthCheckPath: { + ValueKind: Null }, - handlerMappings: null, - healthCheckPath: null, http20Enabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, http20ProxyFlag: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, httpLoggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, ipSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } - }, - ipSecurityRestrictionsDefaultAction: null, - javaContainer: null, - javaContainerVersion: null, - javaVersion: null, - keyVaultReferenceIdentity: null, - limits: null, + ValueKind: Array + }, + ipSecurityRestrictionsDefaultAction: { + ValueKind: Null + }, + javaContainer: { + ValueKind: Null + }, + javaContainerVersion: { + ValueKind: Null + }, + javaVersion: { + ValueKind: Null + }, + keyVaultReferenceIdentity: { + ValueKind: Null + }, + limits: { + ValueKind: Null + }, linuxFxVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, loadBalancing: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, localMySqlEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, logsDirectorySizeLimit: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + machineKey: { + ValueKind: Null }, - machineKey: null, managedPipelineMode: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, managedServiceIdentityId: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + metadata: { + ValueKind: Null }, - metadata: null, minimumElasticInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + minTlsCipherSuite: { + ValueKind: Null }, - minTlsCipherSuite: null, minTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, netFrameworkVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, nodeVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, numberOfWorkers: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, phpVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, powerShellVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, preWarmedInstanceCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number + }, + publicNetworkAccess: { + ValueKind: Null + }, + publishingPassword: { + ValueKind: Null }, - publicNetworkAccess: null, - publishingPassword: null, publishingUsername: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + push: { + ValueKind: Null }, - push: null, pythonVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, remoteDebuggingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, remoteDebuggingVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, requestTracingEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, routingRules: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + runtimeADUser: { + ValueKind: Null + }, + runtimeADUserPassword: { + ValueKind: Null }, - runtimeADUser: null, - runtimeADUserPassword: null, scmIpSecurityRestrictions: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + scmIpSecurityRestrictionsDefaultAction: { + ValueKind: Null }, - scmIpSecurityRestrictionsDefaultAction: null, scmIpSecurityRestrictionsUseMain: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, scmMinTlsVersion: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, scmType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, siteAuthEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, siteAuthSettings: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Object + }, + sitePort: { + ValueKind: Null }, - sitePort: null, sitePrivateLinkHostEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, storageType: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String + }, + supportedTlsCipherSuites: { + ValueKind: Null + }, + tracingOptions: { + ValueKind: Null }, - supportedTlsCipherSuites: null, - tracingOptions: null, use32BitWorkerProcess: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: True }, virtualApplications: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array }, vnetName: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: String }, vnetPrivatePortsCount: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, vnetRouteAllEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False + }, + websiteTimeZone: { + ValueKind: Null }, - websiteTimeZone: null, webSocketsEnabled: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: False }, winAuthAdminState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, winAuthTenantState: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Number }, windowsConfiguredStacks: { - Options: { - PropertyNameCaseInsensitive: true - } + ValueKind: Array + }, + windowsFxVersion: { + ValueKind: Null }, - windowsFxVersion: null, - xManagedServiceIdentityId: null + xManagedServiceIdentityId: { + ValueKind: Null + } }, PublicId: /subscriptions/291bba3f-e0a5-47bc-a099-3bdcb2a50a05/resourceGroups/lab-stg/providers/Microsoft.Web/sites/lab-web-web-stg/config/web, Description: lab-web-web-stg, diff --git a/src/ARI/ARI.csproj b/src/ARI/ARI.csproj index 6ff54d5..8a697d1 100644 --- a/src/ARI/ARI.csproj +++ b/src/ARI/ARI.csproj @@ -2,7 +2,7 @@ Exe - net7.0;net8.0 + net9.0;net8.0 enable true enable @@ -51,6 +51,7 @@ + diff --git a/src/ARI/Commands/InventoryCommand.cs b/src/ARI/Commands/InventoryCommand.cs index af80ee1..8bf48af 100644 --- a/src/ARI/Commands/InventoryCommand.cs +++ b/src/ARI/Commands/InventoryCommand.cs @@ -192,7 +192,7 @@ from tag in resource.Resource.Tags.Concat(resource.Resource.Tags.Count == 0 ? No ) ) ) - .Index( + .IndexResources( tenantIdFunc => tenant.TenantId ) .ToArray(); diff --git a/src/ARI/Extensions/AzureResourceExtensions.cs b/src/ARI/Extensions/AzureResourceExtensions.cs index f78b276..9b7ea2c 100644 --- a/src/ARI/Extensions/AzureResourceExtensions.cs +++ b/src/ARI/Extensions/AzureResourceExtensions.cs @@ -2,7 +2,7 @@ public static class AzureResourceExtensions { - public static ICollection Index( + public static ICollection IndexResources( this IEnumerable values, Func? tenantIdFunc = default, Func? subscriptionIdFunc = default, @@ -15,7 +15,7 @@ public static ICollection Index( return values .Where(value => predicate?.Invoke(value) ?? true) .OrderBy(resource => resource.Description, StringComparer.OrdinalIgnoreCase) - .Select(resource => resource.Index( + .Select(resource => resource.IndexResource( tenantIdFunc, subscriptionIdFunc, resourceGroupNameFunc, @@ -24,7 +24,7 @@ public static ICollection Index( .ToArray(); } - public static TSource Index( + public static TSource IndexResource( this TSource resource, Func? tenantIdFunc = default, Func? subscriptionIdFunc = default, diff --git a/src/ARI/Extensions/TextWriterMarkdownExtensions.cs b/src/ARI/Extensions/TextWriterMarkdownExtensions.cs index 9459bc3..49ea46f 100644 --- a/src/ARI/Extensions/TextWriterMarkdownExtensions.cs +++ b/src/ARI/Extensions/TextWriterMarkdownExtensions.cs @@ -1,4 +1,5 @@ -using System.Runtime.CompilerServices; +using System.Linq; +using System.Runtime.CompilerServices; using System.Text.Json.Nodes; namespace ARI.Extensions; @@ -256,7 +257,7 @@ public static Task AddNameDescriptionRow( private static readonly JsonSerializerOptions PropertiesValueOptions = new() { WriteIndented = true }; public static async Task AddProperties( this TextWriter writer, - IDictionary properties, + IDictionary properties, InventorySettings settings ) { @@ -287,12 +288,20 @@ await writer.WriteLineAsync( await writer.WriteLineAsync( FormattableString.Invariant( - $"| {key.SeparateByCase().Bold(),-NameColumnWidth} | {value?.ToJsonString(PropertiesValueOptions).PreLine(),-DescriptionColumnWidth} |" + $"| {key.SeparateByCase().Bold(),-NameColumnWidth} | {value.ToJsonString().PreLine(),-DescriptionColumnWidth} |" ) ); } } + private static string ToJsonString(this JsonElement jsonElement) + => jsonElement.ValueKind switch + { + JsonValueKind.Array => $"[{Environment.NewLine}{string.Join($",{Environment.NewLine}", jsonElement.EnumerateArray().Select(element => $" {element.ToJsonString()}"))}{Environment.NewLine}]", + JsonValueKind.Object => string.Join(Environment.NewLine, jsonElement.EnumerateObject().Select(property => $"{property.Name}: {property.Value.ToJsonString()}")), + _ => jsonElement.Deserialize()?.ToJsonString(PropertiesValueOptions) ?? "" + }; + public static async Task AddSettings( this TextWriter writer, IDictionary properties, diff --git a/src/ARI/Models/Tenant/Subscription/ResourceGroup/Resource/Web/Site/WebConfig.cs b/src/ARI/Models/Tenant/Subscription/ResourceGroup/Resource/Web/Site/WebConfig.cs index ad36f94..c6216a9 100644 --- a/src/ARI/Models/Tenant/Subscription/ResourceGroup/Resource/Web/Site/WebConfig.cs +++ b/src/ARI/Models/Tenant/Subscription/ResourceGroup/Resource/Web/Site/WebConfig.cs @@ -12,7 +12,7 @@ public record WebConfig( [property: JsonPropertyName("location")] string Location, [property: JsonPropertyName("properties")] - SortedDictionary Properties + SortedDictionary Properties ) : AzureResourceBase { public override string PublicId => Id; diff --git a/src/ARI/Services/ARM/ResourceGroupService.cs b/src/ARI/Services/ARM/ResourceGroupService.cs index 7b96d96..26743ff 100644 --- a/src/ARI/Services/ARM/ResourceGroupService.cs +++ b/src/ARI/Services/ARM/ResourceGroupService.cs @@ -16,7 +16,7 @@ public async Task> GetResourceGroups(string tenantId, return resourceGroups .Value - .Index( + .IndexResources( _ => tenantId, _ => tenantId, resourceGroup => resourceGroup.Name diff --git a/src/ARI/Services/ARM/ResourceService.cs b/src/ARI/Services/ARM/ResourceService.cs index 5aba58e..a8cf87c 100644 --- a/src/ARI/Services/ARM/ResourceService.cs +++ b/src/ARI/Services/ARM/ResourceService.cs @@ -22,7 +22,7 @@ string resourceGroupName return resources .Value - .Index( + .IndexResources( _ => tenantId, _ => subscriptionId, _ => resourceGroupName diff --git a/src/ARI/Services/ARM/SubscriptionService.cs b/src/ARI/Services/ARM/SubscriptionService.cs index 485e357..5f27ff8 100644 --- a/src/ARI/Services/ARM/SubscriptionService.cs +++ b/src/ARI/Services/ARM/SubscriptionService.cs @@ -14,9 +14,8 @@ public async Task> GetSubscriptions(string tenantId) ArgumentNullException.ThrowIfNull(subscriptions.Value); - return subscriptions + return [.. subscriptions .Value - .Index() - .ToArray(); + .IndexResources()]; } } diff --git a/src/ARI/Services/ARM/WebAppConfigService.cs b/src/ARI/Services/ARM/WebAppConfigService.cs index 23f331f..e314a17 100644 --- a/src/ARI/Services/ARM/WebAppConfigService.cs +++ b/src/ARI/Services/ARM/WebAppConfigService.cs @@ -21,7 +21,7 @@ string webAppName return config .Value - .Index( + .IndexResources( _ => tenantId, _ => subscriptionId, _ => resourceGroupName diff --git a/src/ARI/Services/ARM/WebAppSettingsService.cs b/src/ARI/Services/ARM/WebAppSettingsService.cs index 308c47f..7515523 100644 --- a/src/ARI/Services/ARM/WebAppSettingsService.cs +++ b/src/ARI/Services/ARM/WebAppSettingsService.cs @@ -20,7 +20,7 @@ string webAppName ArgumentNullException.ThrowIfNull(settings.Properties); return settings - .Index( + .IndexResource( _ => tenantId, _ => subscriptionId, _ => resourceGroupName