From 3345ebfe8dabdd706ece510b1da83870fe0c0894 Mon Sep 17 00:00:00 2001 From: Chengming <61542202+dvbb@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:59:22 +0800 Subject: [PATCH] [Network] Fix HopLink format error issue when resourceId return "" (#38876) --- .../CHANGELOG.md | 3 +- .../Azure.ResourceManager.Network/assets.json | 2 +- .../Customization/ArmNetworkModelFactory.cs | 2 +- .../Generated/Models/HopLink.Serialization.cs | 2 +- .../src/autorest.md | 5 +- .../Helpers/NetworkServiceClientTestBase.cs | 8 +- .../tests/Tests/NetworkWatcherTests.cs | 31 ++++++++ .../CHANGELOG.md | 2 +- ...ecoveryServicesSiteRecoveryModelFactory.cs | 71 ----------------- ...ecoveryServicesSiteRecoveryModelFactory.cs | 79 +++++++++++++++++++ 10 files changed, 123 insertions(+), 82 deletions(-) diff --git a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md index 3eccd95cb2b93..6ac8222ae78b6 100644 --- a/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md +++ b/sdk/network/Azure.ResourceManager.Network/CHANGELOG.md @@ -8,12 +8,13 @@ ### Bugs Fixed +- Fix an issue that the `DeserializeHopLink` can't handle empty `resourceId`. + ### Other Changes ## 1.6.0-beta.1 (2023-09-25) ### Features Added - - Add support to VMSS features. ## 1.5.0 (2023-09-16) diff --git a/sdk/network/Azure.ResourceManager.Network/assets.json b/sdk/network/Azure.ResourceManager.Network/assets.json index 0a5f64183aaa4..c7b25cc30191c 100644 --- a/sdk/network/Azure.ResourceManager.Network/assets.json +++ b/sdk/network/Azure.ResourceManager.Network/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/network/Azure.ResourceManager.Network", - "Tag": "net/network/Azure.ResourceManager.Network_e310e8910d" + "Tag": "net/network/Azure.ResourceManager.Network_8a3f0c72db" } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Customization/ArmNetworkModelFactory.cs b/sdk/network/Azure.ResourceManager.Network/src/Customization/ArmNetworkModelFactory.cs index 146c5e0beb773..3e38fae075004 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Customization/ArmNetworkModelFactory.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Customization/ArmNetworkModelFactory.cs @@ -191,4 +191,4 @@ public static SubnetData SubnetData(ResourceIdentifier id, string name, Resource public static VirtualNetworkGatewayData VirtualNetworkGatewayData(ResourceIdentifier id, string name, ResourceType? resourceType, AzureLocation? location, IDictionary tags, ExtendedLocation extendedLocation, ETag? etag, IEnumerable ipConfigurations, VirtualNetworkGatewayType? gatewayType, VpnType? vpnType, VpnGatewayGeneration? vpnGatewayGeneration, bool? enableBgp, bool? enablePrivateIPAddress, bool? active, bool? disableIPSecReplayProtection, ResourceIdentifier gatewayDefaultSiteId, VirtualNetworkGatewaySku sku, VpnClientConfiguration vpnClientConfiguration, IEnumerable virtualNetworkGatewayPolicyGroups, BgpSettings bgpSettings, IEnumerable customRoutesAddressPrefixes, Guid? resourceGuid, NetworkProvisioningState? provisioningState, bool? enableDnsForwarding, string inboundDnsForwardingEndpoint, ResourceIdentifier vNetExtendedLocationResourceId, IEnumerable natRules, bool? enableBgpRouteTranslationForNat, bool? allowVirtualWanTraffic, bool? allowRemoteVnetTraffic, ExpressRouteGatewayAdminState? adminState) => VirtualNetworkGatewayData(id, name, resourceType, location, tags, extendedLocation, etag, null, ipConfigurations, gatewayType, vpnType, vpnGatewayGeneration, enableBgp, enablePrivateIPAddress, active, disableIPSecReplayProtection, gatewayDefaultSiteId, sku, vpnClientConfiguration, virtualNetworkGatewayPolicyGroups, bgpSettings, customRoutesAddressPrefixes, resourceGuid, provisioningState, enableDnsForwarding, inboundDnsForwardingEndpoint, vNetExtendedLocationResourceId, natRules, enableBgpRouteTranslationForNat, allowVirtualWanTraffic, allowRemoteVnetTraffic, adminState); } -} \ No newline at end of file +} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HopLink.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HopLink.Serialization.cs index a866111e69e65..ca25aa40c76c0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HopLink.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HopLink.Serialization.cs @@ -69,7 +69,7 @@ internal static HopLink DeserializeHopLink(JsonElement element) } if (property.NameEquals("resourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (property.Value.ValueKind == JsonValueKind.Null || property.Value.ValueKind == JsonValueKind.String && property.Value.GetString().Length == 0) { continue; } diff --git a/sdk/network/Azure.ResourceManager.Network/src/autorest.md b/sdk/network/Azure.ResourceManager.Network/src/autorest.md index fd9c1919e0f0a..d62901a518030 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/autorest.md +++ b/sdk/network/Azure.ResourceManager.Network/src/autorest.md @@ -31,8 +31,6 @@ public-clients: false head-as-boolean: false resource-model-requires-type: false -# csharpgen: -# attach: true #mgmt-debug: # show-serialized-names: true @@ -197,6 +195,9 @@ rename-mapping: keep-plural-resource-data: - PolicySignaturesOverridesForIdps +models-to-treat-empty-string-as-null: + - HopLink + format-by-name-rules: 'tenantId': 'uuid' 'ETag': 'etag' diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkServiceClientTestBase.cs b/sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkServiceClientTestBase.cs index 7c9836b957232..c624b53cf070e 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkServiceClientTestBase.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkServiceClientTestBase.cs @@ -70,7 +70,7 @@ protected async Task CreateResourceGroup(string name) SubscriptionResource subscription = await ArmClient.GetDefaultSubscriptionAsync(); return (await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, name, new ResourceGroupData(TestEnvironment.Location))).Value; } - protected async Task CreateResourceGroup(string name,string location) + protected async Task CreateResourceGroup(string name, string location) { SubscriptionResource subscription = await ArmClient.GetDefaultSubscriptionAsync(); return (await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, name, new ResourceGroupData(location))).Value; @@ -261,7 +261,7 @@ public async Task CreateWindowsVM(string vmName, string network var vmId = new ResourceIdentifier($"{resourceGroup.Id}/providers/Microsoft.Compute/virtualMachines/{vmName}"); SubscriptionResource subscription = await ArmClient.GetDefaultSubscriptionAsync(); - var genericResouces = subscription.GetGenericResources(); + var genericResouces = subscription.GetGenericResourcesAsync(); GenericResourceData data = new GenericResourceData(location) { Properties = BinaryData.FromObjectAsJson(new Dictionary @@ -299,7 +299,7 @@ public async Task CreateWindowsVM(string vmName, string network { "osProfile", new Dictionary { { "adminUsername", Recording.GenerateAssetName("admin") }, - { "adminPassword", Recording.GenerateAlphaNumericId("adminPass") }, + { "adminPassword", Recording.GenerateAlphaNumericId("adminPass!") }, { "computerName", vmName } } }, @@ -631,7 +631,7 @@ public async Task CreateNetworkInterface(string name, return getNicResponse; } - public async Task CreateNetworkInterface(string name, string publicIpAddressId, string subnetId, + public async Task CreateNetworkInterface(string name, string publicIpAddressId, string subnetId, string location, string ipConfigName, NetworkInterfaceCollection networkInterfaceCollection) { var nicParameters = new NetworkInterfaceData() diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs index 6ee53b7f54832..84e4c6cf62e2e 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs @@ -10,6 +10,7 @@ using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Network.Tests.Helpers; using NUnit.Framework; +using Azure.Core; namespace Azure.ResourceManager.Network.Tests { @@ -111,5 +112,35 @@ public async Task NetworkWatcherApiTest() Assert.AreEqual(countBeforeTest, listAllAfterDeletingResponse.Count); Assert.False(listAllAfterDeletingResponse.Any(w => w.Data.Name == networkWatcherName)); } + + [Test] + [RecordedTest] + public async Task NetworkWatcherCheckConnectivityTest() + { + var location = AzureLocation.EastUS2; + + string rgName = Recording.GenerateAssetName("networkRG"); + var resourceGroup = await CreateResourceGroup(rgName, location); + + // Create Network Watcher in the resource group + string networkWatcherName = Recording.GenerateAssetName("azsmnet"); + var properties = new NetworkWatcherData { Location = location }; + var networkWatcherLro = await resourceGroup.GetNetworkWatchers().CreateOrUpdateAsync(WaitUntil.Completed, networkWatcherName, properties); + NetworkWatcherResource networkWatcher = networkWatcherLro.Value; + + // Create two VMs for test vm connectivity + var vm1 = await CreateWindowsVM(Recording.GenerateAssetName("vm"), Recording.GenerateAssetName("nic"), location, resourceGroup); + var vm2 = await CreateWindowsVM(Recording.GenerateAssetName("vm"), Recording.GenerateAssetName("nic"), location, resourceGroup); + await deployWindowsNetworkAgent(vm1.Data.Name, location, resourceGroup); + await deployWindowsNetworkAgent(vm2.Data.Name, location, resourceGroup); + + // Test connectivity + ConnectivityContent content = new ConnectivityContent( + new ConnectivitySource(vm1.Id), + new ConnectivityDestination() { Port = 22, ResourceId = vm2.Id }); + var connectivityResult = await networkWatcher.CheckConnectivityAsync(WaitUntil.Completed, content); + Assert.IsNotNull(connectivityResult.Value.NetworkConnectionStatus); + Assert.IsNull(connectivityResult.Value.Hops.First().Links.First().ResourceId); + } } } diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/CHANGELOG.md b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/CHANGELOG.md index 63eba4bcd1a76..deacdb641af51 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/CHANGELOG.md +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/CHANGELOG.md @@ -15,7 +15,7 @@ ### Features Added - Upgraded api-version tag from 'package-2023-04' to 'package-2023-06'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/5dd1107d5f2be8d600325d795450e1d854fbe7e8/specification/recoveryservicessiterecovery/resource-manager/readme.md -- Changes Related to Integration of In place OS upgrade. +- Changes Related to Integration of In place OS upgrade [Upgrade Windows Guideline](https://learn.microsoft.com/azure/migrate/how-to-upgrade-windows). - Changes Releated to Implementing Monitoring Flow. ### Other Changes diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Customization/ArmRecoveryServicesSiteRecoveryModelFactory.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Customization/ArmRecoveryServicesSiteRecoveryModelFactory.cs index d69a8adba310e..b3494f92f7446 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Customization/ArmRecoveryServicesSiteRecoveryModelFactory.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Customization/ArmRecoveryServicesSiteRecoveryModelFactory.cs @@ -17,77 +17,6 @@ namespace Azure.ResourceManager.RecoveryServicesSiteRecovery.Models /// Model factory for models. public static partial class ArmRecoveryServicesSiteRecoveryModelFactory { - /// Initializes a new instance of SiteRecoveryMigrationItemProperties. - /// The on-premise virtual machine name. - /// The ARM Id of policy governing this item. - /// The name of policy governing this item. - /// The recovery services provider ARM Id. - /// The replication status. - /// The migration status. - /// The migration state description. - /// The last test migration time. - /// The status of the last test migration. - /// The last migration time. - /// The status of the last migration. - /// The test migrate state. - /// The test migrate state description. - /// The consolidated health. - /// The list of health errors. - /// The allowed operations on the migration item based on the current migration state of the item. - /// The current job details. - /// The critical past job details. - /// The correlation Id for events associated with this migration item. - /// The migration provider custom settings. - /// A new instance for mocking. - public static SiteRecoveryMigrationItemProperties SiteRecoveryMigrationItemProperties(string machineName = null, ResourceIdentifier policyId = null, string policyFriendlyName = null, string recoveryServicesProviderId = null, string replicationStatus = null, SiteRecoveryMigrationState? migrationState = null, string migrationStateDescription = null, DateTimeOffset? lastTestMigrationOn = null, string lastTestMigrationStatus = null, DateTimeOffset? lastMigrationOn = null, string lastMigrationStatus = null, TestMigrationState? testMigrateState = null, string testMigrateStateDescription = null, SiteRecoveryProtectionHealth? health = null, IEnumerable healthErrors = null, IEnumerable allowedOperations = null, CurrentJobDetails currentJob = null, IEnumerable criticalJobHistory = null, string eventCorrelationId = null, MigrationProviderSpecificSettings providerSpecificDetails = null) - { - healthErrors ??= new List(); - allowedOperations ??= new List(); - criticalJobHistory ??= new List(); - - return new SiteRecoveryMigrationItemProperties(machineName, policyId, policyFriendlyName, recoveryServicesProviderId, replicationStatus, migrationState, migrationStateDescription, lastTestMigrationOn, lastTestMigrationStatus, lastMigrationOn, lastMigrationStatus, testMigrateState, testMigrateStateDescription, health, healthErrors?.ToList(), allowedOperations?.ToList(), currentJob, criticalJobHistory?.ToList(), eventCorrelationId, providerSpecificDetails); - } - - /// Initializes a new instance of ReplicationProtectedItemProperties. - /// The name. - /// The type of protected item type. - /// The protected item ARM Id. - /// The recovery provider ARM Id. - /// The friendly name of the primary fabric. - /// The fabric provider of the primary fabric. - /// The friendly name of recovery fabric. - /// The Arm Id of recovery fabric. - /// The name of primary protection container friendly name. - /// The name of recovery container friendly name. - /// The protection status. - /// The protection state description. - /// The Current active location of the PE. - /// The Test failover state. - /// The Test failover state description. - /// The switch provider state. - /// The switch provider state description. - /// The allowed operations on the Replication protected item. - /// The consolidated protection health for the VM taking any issues with SRS as well as all the replication units associated with the VM's replication group into account. This is a string representation of the ProtectionHealth enumeration. - /// The consolidated failover health for the VM. - /// List of health errors. - /// The ID of Policy governing this PE. - /// The name of Policy governing this PE. - /// The Last successful failover time. - /// The Last successful test failover time. - /// The current scenario. - /// The recovery point ARM Id to which the Vm was failed over. - /// The Replication provider custom settings. - /// The recovery container Id. - /// The correlation Id for events associated with this protected item. - /// A new instance for mocking. - public static ReplicationProtectedItemProperties ReplicationProtectedItemProperties(string friendlyName = null, string protectedItemType = null, ResourceIdentifier protectableItemId = null, string recoveryServicesProviderId = null, string primaryFabricFriendlyName = null, string primaryFabricProvider = null, string recoveryFabricFriendlyName = null, ResourceIdentifier recoveryFabricId = null, string primaryProtectionContainerFriendlyName = null, string recoveryProtectionContainerFriendlyName = null, string protectionState = null, string protectionStateDescription = null, string activeLocation = null, string testFailoverState = null, string testFailoverStateDescription = null, string switchProviderState = null, string switchProviderStateDescription = null, IEnumerable allowedOperations = null, string replicationHealth = null, string failoverHealth = null, IEnumerable healthErrors = null, ResourceIdentifier policyId = null, string policyFriendlyName = null, DateTimeOffset? lastSuccessfulFailoverOn = null, DateTimeOffset? lastSuccessfulTestFailoverOn = null, CurrentScenarioDetails currentScenario = null, ResourceIdentifier failoverRecoveryPointId = null, ReplicationProviderSpecificSettings providerSpecificDetails = null, ResourceIdentifier recoveryContainerId = null, Guid? eventCorrelationId = null) - { - allowedOperations ??= new List(); - healthErrors ??= new List(); - - return new ReplicationProtectedItemProperties(friendlyName, protectedItemType, protectableItemId, recoveryServicesProviderId, primaryFabricFriendlyName, primaryFabricProvider, recoveryFabricFriendlyName, recoveryFabricId, primaryProtectionContainerFriendlyName, recoveryProtectionContainerFriendlyName, protectionState, protectionStateDescription, activeLocation, testFailoverState, testFailoverStateDescription, switchProviderState, switchProviderStateDescription, allowedOperations?.ToList(), replicationHealth, failoverHealth, healthErrors?.ToList(), policyId, policyFriendlyName, lastSuccessfulFailoverOn, lastSuccessfulTestFailoverOn, currentScenario, failoverRecoveryPointId, providerSpecificDetails, recoveryContainerId, eventCorrelationId); - } - /// Initializes a new instance of A2AReplicationDetails. /// The fabric specific object Id of the virtual machine. /// The initial primary availability zone. diff --git a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ArmRecoveryServicesSiteRecoveryModelFactory.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ArmRecoveryServicesSiteRecoveryModelFactory.cs index 4628e6baa4ee2..ffa3318979e14 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ArmRecoveryServicesSiteRecoveryModelFactory.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ArmRecoveryServicesSiteRecoveryModelFactory.cs @@ -351,6 +351,41 @@ public static SiteRecoveryMigrationItemData SiteRecoveryMigrationItemData(Resour return new SiteRecoveryMigrationItemData(id, name, resourceType, systemData, properties, location); } + /// Initializes a new instance of SiteRecoveryMigrationItemProperties. + /// The on-premise virtual machine name. + /// The ARM Id of policy governing this item. + /// The name of policy governing this item. + /// The recovery services provider ARM Id. + /// The replication status. + /// The migration status. + /// The migration state description. + /// The last test migration time. + /// The status of the last test migration. + /// The last migration time. + /// The status of the last migration. + /// The test migrate state. + /// The test migrate state description. + /// The consolidated health. + /// The list of health errors. + /// The allowed operations on the migration item based on the current migration state of the item. + /// The current job details. + /// The critical past job details. + /// The correlation Id for events associated with this migration item. + /// + /// The migration provider custom settings. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// A new instance for mocking. + public static SiteRecoveryMigrationItemProperties SiteRecoveryMigrationItemProperties(string machineName = null, ResourceIdentifier policyId = null, string policyFriendlyName = null, string recoveryServicesProviderId = null, string replicationStatus = null, SiteRecoveryMigrationState? migrationState = null, string migrationStateDescription = null, DateTimeOffset? lastTestMigrationOn = null, string lastTestMigrationStatus = null, DateTimeOffset? lastMigrationOn = null, string lastMigrationStatus = null, TestMigrationState? testMigrateState = null, string testMigrateStateDescription = null, SiteRecoveryProtectionHealth? health = null, IEnumerable healthErrors = null, IEnumerable allowedOperations = null, CurrentJobDetails currentJob = null, IEnumerable criticalJobHistory = null, string eventCorrelationId = null, MigrationProviderSpecificSettings providerSpecificDetails = null) + { + healthErrors ??= new List(); + allowedOperations ??= new List(); + criticalJobHistory ??= new List(); + + return new SiteRecoveryMigrationItemProperties(machineName, policyId, policyFriendlyName, recoveryServicesProviderId, replicationStatus, migrationState, migrationStateDescription, lastTestMigrationOn, lastTestMigrationStatus, lastMigrationOn, lastMigrationStatus, testMigrateState, testMigrateStateDescription, health, healthErrors?.ToList(), allowedOperations?.ToList(), currentJob, criticalJobHistory?.ToList(), eventCorrelationId, providerSpecificDetails); + } + /// Initializes a new instance of CurrentJobDetails. /// The job name. /// The ARM Id of the job being executed. @@ -441,6 +476,50 @@ public static ReplicationProtectedItemData ReplicationProtectedItemData(Resource return new ReplicationProtectedItemData(id, name, resourceType, systemData, properties, location); } + /// Initializes a new instance of ReplicationProtectedItemProperties. + /// The name. + /// The type of protected item type. + /// The protected item ARM Id. + /// The recovery provider ARM Id. + /// The friendly name of the primary fabric. + /// The fabric provider of the primary fabric. + /// The friendly name of recovery fabric. + /// The Arm Id of recovery fabric. + /// The name of primary protection container friendly name. + /// The name of recovery container friendly name. + /// The protection status. + /// The protection state description. + /// The Current active location of the PE. + /// The Test failover state. + /// The Test failover state description. + /// The switch provider state. + /// The switch provider state description. + /// The allowed operations on the Replication protected item. + /// The consolidated protection health for the VM taking any issues with SRS as well as all the replication units associated with the VM's replication group into account. This is a string representation of the ProtectionHealth enumeration. + /// The consolidated failover health for the VM. + /// List of health errors. + /// The ID of Policy governing this PE. + /// The name of Policy governing this PE. + /// The Last successful failover time. + /// The Last successful test failover time. + /// The current scenario. + /// The recovery point ARM Id to which the Vm was failed over. + /// + /// The Replication provider custom settings. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , and . + /// + /// The recovery container Id. + /// The correlation Id for events associated with this protected item. + /// A new instance for mocking. + public static ReplicationProtectedItemProperties ReplicationProtectedItemProperties(string friendlyName = null, string protectedItemType = null, ResourceIdentifier protectableItemId = null, string recoveryServicesProviderId = null, string primaryFabricFriendlyName = null, string primaryFabricProvider = null, string recoveryFabricFriendlyName = null, ResourceIdentifier recoveryFabricId = null, string primaryProtectionContainerFriendlyName = null, string recoveryProtectionContainerFriendlyName = null, string protectionState = null, string protectionStateDescription = null, string activeLocation = null, string testFailoverState = null, string testFailoverStateDescription = null, string switchProviderState = null, string switchProviderStateDescription = null, IEnumerable allowedOperations = null, string replicationHealth = null, string failoverHealth = null, IEnumerable healthErrors = null, ResourceIdentifier policyId = null, string policyFriendlyName = null, DateTimeOffset? lastSuccessfulFailoverOn = null, DateTimeOffset? lastSuccessfulTestFailoverOn = null, CurrentScenarioDetails currentScenario = null, ResourceIdentifier failoverRecoveryPointId = null, ReplicationProviderSpecificSettings providerSpecificDetails = null, ResourceIdentifier recoveryContainerId = null, Guid? eventCorrelationId = null) + { + allowedOperations ??= new List(); + healthErrors ??= new List(); + + return new ReplicationProtectedItemProperties(friendlyName, protectedItemType, protectableItemId, recoveryServicesProviderId, primaryFabricFriendlyName, primaryFabricProvider, recoveryFabricFriendlyName, recoveryFabricId, primaryProtectionContainerFriendlyName, recoveryProtectionContainerFriendlyName, protectionState, protectionStateDescription, activeLocation, testFailoverState, testFailoverStateDescription, switchProviderState, switchProviderStateDescription, allowedOperations?.ToList(), replicationHealth, failoverHealth, healthErrors?.ToList(), policyId, policyFriendlyName, lastSuccessfulFailoverOn, lastSuccessfulTestFailoverOn, currentScenario, failoverRecoveryPointId, providerSpecificDetails, recoveryContainerId, eventCorrelationId); + } + /// Initializes a new instance of CurrentScenarioDetails. /// Scenario name. /// ARM Id of the job being executed.