diff --git a/sdk/resourcemanager/Azure.ResourceManager/README.md b/sdk/resourcemanager/Azure.ResourceManager/README.md index 9d870f45aebd..3f777b01577a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/README.md +++ b/sdk/resourcemanager/Azure.ResourceManager/README.md @@ -86,7 +86,7 @@ You can usually tell by the id string itself which type it is, but if you are un ```C# Snippet:Readme_CastToSpecificType string resourceId = "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/workshop2021-rg/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"; // We know the subnet is a resource group level identifier since it has a resource group name in its string -ResourceGroupResourceIdentifier id = resourceId; +ResourceIdentifier id = resourceId; Console.WriteLine($"Subscription: {id.SubscriptionId}"); Console.WriteLine($"ResourceGroup: {id.ResourceGroupName}"); Console.WriteLine($"Vnet: {id.Parent.Name}"); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs index b475a34aa03a..8b86462c1c72 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ArmClient.cs @@ -158,9 +158,9 @@ public virtual TenantContainer GetTenants() /// /// The id of the resourcegroup /// Resource operations of the resource. - public virtual ResourceGroupOperations GetResourceGroupOperations(ResourceGroupResourceIdentifier id) + public virtual ResourceGroupOperations GetResourceGroupOperations(string id) { - return new ResourceGroupOperations(new SubscriptionOperations(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), id.SubscriptionId), id.ResourceGroupName); + return new ResourceGroupOperations(new ClientContext(ClientOptions, Credential, BaseUri, Pipeline), id); } private Subscription GetDefaultSubscription() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagCreateOrUpdateOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/LongRunningOperation/PredefinedTagCreateOrUpdateOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagCreateOrUpdateOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/LongRunningOperation/PredefinedTagCreateOrUpdateOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagDeleteOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/LongRunningOperation/PredefinedTagDeleteOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagDeleteOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/LongRunningOperation/PredefinedTagDeleteOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/Resource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/Resource.cs index ffca9a02c215..5196698223aa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/Resource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/Resource.cs @@ -8,24 +8,23 @@ namespace Azure.ResourceManager.Resources.Models /// /// A class representing the base resource used by all azure resources. /// - [ReferenceType(typeof(TenantResourceIdentifier))] - public abstract class Resource - where TIdentifier : TenantResourceIdentifier + [ReferenceType] + public abstract class Resource { /// - /// Initializes an empty instance of . + /// Initializes an empty instance of . /// [InitializationConstructor] protected Resource() { } /// - /// Initializes a new instance of for deserialization. + /// Initializes a new instance of for deserialization. /// /// The id of the resource. /// The name of the resource. /// The of the resource. [SerializationConstructor] - protected internal Resource(TIdentifier id, string name, ResourceType type) + protected internal Resource(ResourceIdentifier id, string name, ResourceType type) { Id = id; Name = name; @@ -35,7 +34,7 @@ protected internal Resource(TIdentifier id, string name, ResourceType type) /// /// Gets or sets the resource identifier. /// - public virtual TIdentifier Id { get; } + public virtual ResourceIdentifier Id { get; } /// /// Gets the name. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.Serialization.cs index 77084749718a..bb5c5b43ecd5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.Serialization.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.Serialization.cs @@ -91,7 +91,7 @@ internal static ResourceIdentity DeserializeResourceIdentity(JsonElement element } Optional systemAssignedIdentity = default; - IDictionary userAssignedIdentities = new Dictionary(); + IDictionary userAssignedIdentities = new Dictionary(); string type = string.Empty; foreach (var property in element.EnumerateObject()) { @@ -108,7 +108,7 @@ internal static ResourceIdentity DeserializeResourceIdentity(JsonElement element { resourceId = keyValuePair.Name; var userAssignedIdentity = UserAssignedIdentity.DeserializeUserAssignedIdentity(keyValuePair.Value); - userAssignedIdentities.Add(new ResourceGroupResourceIdentifier(resourceId), userAssignedIdentity); + userAssignedIdentities.Add(new ResourceIdentifier(resourceId), userAssignedIdentity); } continue; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.cs index 5c6d67704819..43eafddb8a17 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/ResourceIdentity.cs @@ -28,14 +28,14 @@ public ResourceIdentity() /// /// Dictionary with a key and a object value. /// Flag for using or not. - public ResourceIdentity(Dictionary user, bool useSystemAssigned) + public ResourceIdentity(Dictionary user, bool useSystemAssigned) { // check for combination of user and system on the impact to type value SystemAssignedIdentity = useSystemAssigned ? new SystemAssignedIdentity() : null; - UserAssignedIdentities = new Dictionary(); + UserAssignedIdentities = new Dictionary(); if (user != null) { - foreach (KeyValuePair id in user) + foreach (KeyValuePair id in user) { UserAssignedIdentities.Add(id.Key, id.Value); } @@ -48,13 +48,13 @@ public ResourceIdentity(Dictionary The to use. /// Dictionary with a key and a object value. [SerializationConstructor] - internal ResourceIdentity(SystemAssignedIdentity systemAssigned, IDictionary user) + internal ResourceIdentity(SystemAssignedIdentity systemAssigned, IDictionary user) { // TODO: remove this constructor later SystemAssignedIdentity = systemAssigned; if (user == null) { - UserAssignedIdentities = new Dictionary(); + UserAssignedIdentities = new Dictionary(); } else { @@ -70,7 +70,7 @@ internal ResourceIdentity(SystemAssignedIdentity systemAssigned, IDictionary /// Gets a dictionary of the User Assigned Identities. /// - public IDictionary UserAssignedIdentities { get; private set; } + public IDictionary UserAssignedIdentities { get; private set; } /// /// Detects if this Identity is equals to another Identity instance. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.Serialization.cs index c9bd9a69ff31..04c98c79c07e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.Serialization.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources.Models /// /// A class representing a sub-resource that contains only the ID. /// - public partial class SubResource : IUtf8JsonSerializable + public partial class SubResource : IUtf8JsonSerializable { /// /// Serialize the input SubResource object. @@ -37,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) /// /// The JSON element to be deserialized. /// Deserialized SubResource object. - internal static SubResource DeserializeSubResource(JsonElement element) + internal static SubResource DeserializeSubResource(JsonElement element) { string id = default; foreach (var property in element.EnumerateObject()) @@ -48,7 +48,7 @@ internal static SubResource DeserializeSubResource(JsonElement elem continue; } } - return new SubResource(id); + return new SubResource(id); } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.cs index 689682ad6a10..aca3014d6d4f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/SubResource.cs @@ -6,10 +6,10 @@ namespace Azure.ResourceManager.Resources.Models { /// - /// A class representing the sub resource of a ResourceIdentifier. + /// A class representing a sub-resource that contains only the read-only ID. /// [ReferenceType] - public class SubResource : SubResource + public partial class SubResource { /// /// Initializes an empty instance of for mocking. @@ -22,37 +22,15 @@ protected SubResource() /// Initializes a new instance of . /// ARM resource Id. [SerializationConstructor] - protected internal SubResource(string id) : base(id) { } - } - - /// - /// A class representing a sub-resource that contains only the read-only ID. - /// - [ReferenceType(typeof(ResourceIdentifier))] - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Types differ by type argument only")] - public partial class SubResource - where TIdentifier : ResourceIdentifier - { - /// - /// Initializes an empty instance of for mocking. - /// - [InitializationConstructor] - protected SubResource() - { - } - - /// Initializes a new instance of . - /// ARM resource Id. - [SerializationConstructor] protected internal SubResource(string id) { - Id = (TIdentifier)id; + Id = id; } /// /// Gets the ARM resource identifier. /// /// - public virtual TIdentifier Id { get; } + public virtual ResourceIdentifier Id { get; } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.Serialization.cs index 4fa5a19d031a..7a195b57a8e0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.Serialization.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.Serialization.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Resources.Models /// /// Generic representation of a tracked resource. All tracked resources should extend this class /// - public abstract partial class TrackedResource : IUtf8JsonSerializable + public abstract partial class TrackedResource : IUtf8JsonSerializable { /// /// Serialize the input TrackedResource object. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.cs index 6708722b1331..f93906745ff9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/TrackedResource.cs @@ -10,12 +10,11 @@ namespace Azure.ResourceManager.Resources.Models /// /// Generic representation of a tracked resource. All tracked resources should extend this class /// - [ReferenceType(typeof(TenantResourceIdentifier))] - public abstract partial class TrackedResource : Resource - where TIdentifier : TenantResourceIdentifier + [ReferenceType] + public abstract partial class TrackedResource : Resource { /// - /// Initializes an empty instance of for mocking. + /// Initializes an empty instance of for mocking. /// protected TrackedResource() { @@ -23,7 +22,7 @@ protected TrackedResource() } /// - /// Initializes an empty instance of . + /// Initializes an empty instance of . /// [InitializationConstructor] protected TrackedResource(Location location) @@ -33,7 +32,7 @@ protected TrackedResource(Location location) } /// - /// Initializes a new instance of the class for deserialization. + /// Initializes a new instance of the class for deserialization. /// /// The id of the resource. /// The name of the resource. @@ -41,7 +40,7 @@ protected TrackedResource(Location location) /// The tags for the resource. /// The location of the resource. [SerializationConstructor] - protected internal TrackedResource(TIdentifier id, string name, ResourceType type, Location location, IDictionary tags) + protected internal TrackedResource(ResourceIdentifier id, string name, ResourceType type, Location location, IDictionary tags) : base(id, name, type) { Tags = tags ?? new Dictionary(StringComparer.InvariantCultureIgnoreCase); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.Serialization.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.Serialization.cs index c2535ee46e5e..78b276b92c16 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.Serialization.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources.Models /// /// A class representing a sub-resource that contains only the ID. /// - public partial class WritableSubResource : IUtf8JsonSerializable + public partial class WritableSubResource : IUtf8JsonSerializable { /// /// Serialize the input WritableSubResource object. @@ -37,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) /// /// The JSON element to be deserialized. /// Deserialized WritableSubResource object. - internal static WritableSubResource DeserializeWritableSubResource(JsonElement element) + internal static WritableSubResource DeserializeWritableSubResource(JsonElement element) { string id = default; foreach (var property in element.EnumerateObject()) @@ -48,7 +48,7 @@ internal static WritableSubResource DeserializeWritableSubResource( continue; } } - return new WritableSubResource(id); + return new WritableSubResource(id); } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.cs index d30a2de6ad13..6efded969d5e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/WritableSubResource.cs @@ -6,10 +6,10 @@ namespace Azure.ResourceManager.Resources.Models { /// - /// A class representing the writable sub resource of a ResourceIdentifier. + /// A class representing a sub-resource that contains only the ID. /// [ReferenceType] - public class WritableSubResource : WritableSubResource + public partial class WritableSubResource { /// /// Initializes an empty instance of for mocking. @@ -22,37 +22,15 @@ public WritableSubResource() /// Initializes a new instance of . /// ARM resource Id. [SerializationConstructor] - protected internal WritableSubResource(string id) : base(id) { } - } - - /// - /// A class representing a sub-resource that contains only the ID. - /// - [ReferenceType(typeof(ResourceIdentifier))] - [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Types differ by type argument only")] - public partial class WritableSubResource - where TIdentifier : ResourceIdentifier - { - /// - /// Initializes an empty instance of for mocking. - /// - [InitializationConstructor] - public WritableSubResource() - { - } - - /// Initializes a new instance of . - /// ARM resource Id. - [SerializationConstructor] protected internal WritableSubResource(string id) { - Id = (TIdentifier)id; + Id = id; } /// /// Gets or sets the ARM resource identifier. /// /// - public virtual TIdentifier Id { get; set; } + public virtual ResourceIdentifier Id { get; set; } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagContainer.cs index 32846b9707ad..105e2dded86a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagContainer.cs @@ -27,11 +27,11 @@ protected PredefinedTagContainer() /// Initializes a new instance of the class. /// /// Current client context. - /// The parent subscription. - internal PredefinedTagContainer(ClientContext clientContext, SubscriptionResourceIdentifier subscription) - : base(clientContext, new SubscriptionResourceIdentifier(subscription)) + /// The parent subscription id. + internal PredefinedTagContainer(ClientContext clientContext, ResourceIdentifier parentId) + : base(clientContext, parentId) { - RestClient = new TagRestOperations(Diagnostics, Pipeline, subscription.SubscriptionId, BaseUri); + RestClient = new TagRestOperations(Diagnostics, Pipeline, parentId.SubscriptionId, BaseUri); } /// diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/PredefinedTagData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagData.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/Models/PredefinedTagData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagData.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagOperations.cs index 633389968de4..d4cba902e3eb 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/PredefinedTagOperations.cs @@ -29,9 +29,9 @@ protected PredefinedTagOperations() /// Initializes a new instance of the class. /// /// - /// The Guid of the subscription. - internal PredefinedTagOperations(ClientContext clientContext, string subscriptionGuid) - : base(clientContext, new SubscriptionResourceIdentifier(subscriptionGuid)) + /// The id of the subscription. + internal PredefinedTagOperations(ClientContext clientContext, ResourceIdentifier id) + : base(clientContext, id) { } @@ -40,7 +40,7 @@ internal PredefinedTagOperations(ClientContext clientContext, string subscriptio /// protected override ResourceType ValidResourceType => ResourceType; - private TagRestOperations RestClient => new TagRestOperations(Diagnostics, Pipeline, ((SubscriptionResourceIdentifier)Id).SubscriptionId, BaseUri); + private TagRestOperations RestClient => new TagRestOperations(Diagnostics, Pipeline, Id.SubscriptionId, BaseUri); /// This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. /// The name of the tag. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/ProviderRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/RestOperations/ProviderRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/ProviderRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Custom/Resources/RestOperations/ProviderRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsCreateOrUpdateOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/LongRunningOperation/ManagementGroupsCreateOrUpdateOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsCreateOrUpdateOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/LongRunningOperation/ManagementGroupsCreateOrUpdateOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsDeleteOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/LongRunningOperation/ManagementGroupsDeleteOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsDeleteOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/LongRunningOperation/ManagementGroupsDeleteOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupContainer.cs index b2712c981275..f946b4390203 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupContainer.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Management /// /// A class representing collection of ManagementGroupContainer and their operations over a ManagementGroup. /// - public class ManagementGroupContainer : ResourceContainerBase + public class ManagementGroupContainer : ResourceContainerBase { private readonly ClientDiagnostics _clientDiagnostics; private ManagementGroupsRestOperations _restClient; diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupData.cs similarity index 96% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupData.cs index 9d8829f3b712..5f43573e0b04 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Management { /// The management group details. - public partial class ManagementGroupData : Resource + public partial class ManagementGroupData : Resource { /// Initializes a new instance of ManagementGroup. internal ManagementGroupData() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupInfoData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupInfoData.cs similarity index 95% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupInfoData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupInfoData.cs index 85b049a3b4d4..d364b70e28b5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/Models/ManagementGroupInfoData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupInfoData.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Management { /// The management group resource. - public partial class ManagementGroupInfoData : Resource + public partial class ManagementGroupInfoData : Resource { /// Initializes a new instance of ManagementGroupInfo. internal ManagementGroupInfoData() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupOperations.cs index cb0f1e370798..1beec5b58e4e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupOperations.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Management /// /// A class representing the operations that can be performed over a specific ManagementGroup. /// - public class ManagementGroupOperations : ResourceOperationsBase + public class ManagementGroupOperations : ResourceOperationsBase { private readonly ClientDiagnostics _clientDiagnostics; private ManagementGroupsRestOperations _restClient; @@ -32,7 +32,7 @@ protected ManagementGroupOperations() /// /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - protected internal ManagementGroupOperations(OperationsBase options, TenantResourceIdentifier id) + protected internal ManagementGroupOperations(OperationsBase options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/RestOperations/ManagementGroupsRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/ManagementGroupsRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/ManagementGroup/RestOperations/ManagementGroupsRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureContainer.cs index ab94f6cbf4d7..000b556bf273 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureContainer.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing collection of FeatureContainer and their operations over a Feature. /// - public class FeatureContainer : ResourceContainerBase + public class FeatureContainer : ResourceContainerBase { private readonly ClientDiagnostics _clientDiagnostics; private FeaturesRestOperations _restClient { get; } @@ -46,11 +46,6 @@ internal FeatureContainer(ProviderOperations parent) /// protected override ResourceType ValidResourceType => ProviderOperations.ResourceType; - /// - /// Gets the resource identifier. - /// - public new SubscriptionProviderIdentifier Id => base.Id as SubscriptionProviderIdentifier; - /// Gets all the preview features in a provider namespace that are available through AFEC for the subscription. /// The cancellation token to use. public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/FeatureData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureData.cs similarity index 93% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/FeatureData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureData.cs index 0e13e65d6ca5..6bd99943eab8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/FeatureData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureData.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources { /// Previewed feature information. - public partial class FeatureData : Resource + public partial class FeatureData : Resource { /// Initializes a new instance of FeatureResult. internal FeatureData() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureOperations.cs index 833a949379f3..8dc4152e258f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeatureOperations.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing the operations that can be performed over a specific Feature. /// - public class FeatureOperations : ResourceOperationsBase + public class FeatureOperations : ResourceOperationsBase { private readonly ClientDiagnostics _clientDiagnostics; private FeaturesRestOperations _restClient { get; } @@ -29,7 +29,7 @@ protected FeatureOperations() /// /// The client parameters to use in these operations. /// The id of the feature to use. - protected FeatureOperations(ResourceOperationsBase options, SubscriptionProviderIdentifier id) + protected FeatureOperations(ResourceOperationsBase options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); @@ -42,7 +42,7 @@ protected FeatureOperations(ResourceOperationsBase options, SubscriptionProvider /// The name of the feature to use. /// The client parameters to use in these operations. internal FeatureOperations(string featureName, ProviderOperations options) - : base(options, new SubscriptionProviderIdentifier(options.Id.Parent as SubscriptionResourceIdentifier, "Microsoft.Features").AppendProviderResource(options.Id.Provider, ResourceType.Type, featureName)) + : base(options, options.Id.Parent.AppendProviderResource(options.Id.Provider, ResourceType.Type, featureName)) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new FeaturesRestOperations(_clientDiagnostics, Pipeline, Id.SubscriptionId, BaseUri); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceContainer.cs index aa8f4fc37282..b393ae73e4d0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceContainer.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing collection of resources and their operations over their parent. /// - public class GenericResourceContainer : ResourceContainerBase + public class GenericResourceContainer : ResourceContainerBase { /// /// Initializes a new instance of the class for mocking. @@ -28,7 +28,7 @@ protected GenericResourceContainer() /// /// The client context to use. /// The id for the subscription that owns this container. - internal GenericResourceContainer(ClientContext clientContext, SubscriptionResourceIdentifier id) + internal GenericResourceContainer(ClientContext clientContext, ResourceIdentifier id) : base(clientContext, id) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/GenericResourceData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceData.cs similarity index 96% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/GenericResourceData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceData.cs index d0172578c3db..c70a53632e5d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/GenericResourceData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceData.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Resources { /// Resource information. - public partial class GenericResourceData : TrackedResource + public partial class GenericResourceData : TrackedResource { /// Initializes a new instance of GenericResource. public GenericResourceData() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/GenericResourceExpandedData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceExpandedData.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/GenericResourceExpandedData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceExpandedData.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceOperations.cs index c732e5929ab9..8e53d5f4d875 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResourceOperations.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing the operations that can be performed over a specific ArmResource. /// - public class GenericResourceOperations : ResourceOperationsBase + public class GenericResourceOperations : ResourceOperationsBase { /// /// Initializes a new instance of the class for mocking. @@ -28,7 +28,7 @@ protected GenericResourceOperations() /// /// The operation to get the client properties from. /// The id of the resource. - internal GenericResourceOperations(OperationsBase operations, TenantResourceIdentifier id) + internal GenericResourceOperations(OperationsBase operations, ResourceIdentifier id) : base(operations, id) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupCreateOrUpdateOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupCreateOrUpdateOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupCreateOrUpdateOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupCreateOrUpdateOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupDeleteOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupDeleteOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupDeleteOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupDeleteOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupsExportTemplateOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupsExportTemplateOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupsExportTemplateOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourceGroupsExportTemplateOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesCreateOrUpdateByIdOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesCreateOrUpdateByIdOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesCreateOrUpdateByIdOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesCreateOrUpdateByIdOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesDeleteByIdOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesDeleteByIdOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesDeleteByIdOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesDeleteByIdOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesDeleteOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesDeleteOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesDeleteOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesDeleteOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesMoveResourcesOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesMoveResourcesOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesMoveResourcesOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesMoveResourcesOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesUpdateByIdOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesUpdateByIdOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesUpdateByIdOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesUpdateByIdOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesValidateMoveResourcesOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesValidateMoveResourcesOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesValidateMoveResourcesOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/ResourcesValidateMoveResourcesOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagCreateOrUpdateOperation.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/TagCreateOrUpdateOperation.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagCreateOrUpdateOperation.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/LongRunningOperation/TagCreateOrUpdateOperation.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/LocationExpanded.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/LocationExpanded.cs index 860624d5cb55..e7048de50219 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/LocationExpanded.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/LocationExpanded.cs @@ -33,7 +33,7 @@ internal LocationExpanded(string id, string subscriptionId, string name, string { Metadata = metadata; Id = id; - SubscriptionResourceIdentifier subId = id; + ResourceIdentifier subId = id; SubscriptionId = subscriptionId ?? subId.SubscriptionId; } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/Tag.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/Tag.cs index 9187677ecd92..e976f03eeec5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/Tag.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/Tag.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Resources.Models { /// A dictionary of name and value pairs. - public partial class Tag : Resource + public partial class Tag : Resource { /// Initializes a new instance of TagsData. public Tag() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderContainer.cs index 19c322d0d5fb..b990a4f6a9f7 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderContainer.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing collection of resources and their operations over their parent. /// - public class ProviderContainer : ResourceContainerBase + public class ProviderContainer : ResourceContainerBase { /// /// Initializes a new instance of the class for mocking. @@ -35,11 +35,6 @@ internal ProviderContainer(SubscriptionOperations parent) /// protected override ResourceType ValidResourceType => SubscriptionOperations.ResourceType; - /// - /// Gets the resource identifier. - /// - public new SubscriptionResourceIdentifier Id => base.Id as SubscriptionResourceIdentifier; - private ProviderRestOperations RestClient { get diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ProviderData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderData.cs similarity index 95% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ProviderData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderData.cs index 4dfcbdc50c91..3016a3800335 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ProviderData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderData.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Resources { /// Resource provider information. - public partial class ProviderData : SubResource + public partial class ProviderData : SubResource { /// Initializes a new instance of Provider. internal ProviderData() diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderOperations.cs index 194a4844321e..5af52c8e8296 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderOperations.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Resources { /// The Providers service client. - public partial class ProviderOperations : ResourceOperationsBase + public partial class ProviderOperations : ResourceOperationsBase { /// /// Initializes a new instance of the class for mocking. @@ -26,7 +26,7 @@ protected ProviderOperations() /// /// /// - internal ProviderOperations(ClientContext clientContext, SubscriptionProviderIdentifier id) + internal ProviderOperations(ClientContext clientContext, ResourceIdentifier id) : base(clientContext, id) { } @@ -36,7 +36,7 @@ internal ProviderOperations(ClientContext clientContext, SubscriptionProviderIde /// /// The resource operations to copy the options from. /// The identifier of the resource that is the target of operations. - internal ProviderOperations(OperationsBase operations, SubscriptionProviderIdentifier id) + protected ProviderOperations(OperationsBase operations, ResourceIdentifier id) : base(operations, id) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupContainer.cs index 614b8e39a623..8a6110744185 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupContainer.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing collection of ResourceGroupContainer and their operations over a ResourceGroup. /// - public class ResourceGroupContainer : ResourceContainerBase + public class ResourceGroupContainer : ResourceContainerBase { /// /// Initializes a new instance of the class for mocking. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ResourceGroupData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupData.cs similarity index 96% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ResourceGroupData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupData.cs index 084f1a7a0f95..c5d6bf07374d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/ResourceGroupData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupData.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Resources { /// A class representing the ResourceGroup data model. - public partial class ResourceGroupData : TrackedResource + public partial class ResourceGroupData : TrackedResource { /// Initializes a new instance of ResourceGroupData. /// The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupOperations.cs index 1cd8b9d60041..f27c3ebafa6c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupOperations.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing the operations that can be performed over a specific ResourceGroup. /// - public class ResourceGroupOperations : ResourceOperationsBase + public class ResourceGroupOperations : ResourceOperationsBase { /// /// Name of the CreateOrUpdate() method in [Resource]Container classes. @@ -45,25 +45,18 @@ protected ResourceGroupOperations() /// Initializes a new instance of the class. /// /// The client parameters to use in these operations. - /// The name of the resource group to use. - internal ResourceGroupOperations(SubscriptionOperations options, string rgName) - : base(options, new ResourceGroupResourceIdentifier(options.Id, rgName)) + /// The id of the resource group to use. + internal ResourceGroupOperations(ClientContext options, ResourceIdentifier id) + : base(options, id) { - if (rgName.Length > 90) - throw new ArgumentOutOfRangeException(nameof(rgName), "ResourceGroupName cannot be longer than 90 characters."); - - if (!ValidationPattern.IsMatch(rgName)) - throw new ArgumentException("The name of the resource group can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters.", nameof(rgName)); } - private static readonly Regex ValidationPattern = new Regex(@"^[-\w\._\(\)]+$"); - /// /// Initializes a new instance of the class. /// /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - protected ResourceGroupOperations(ResourceOperationsBase options, ResourceGroupResourceIdentifier id) + protected ResourceGroupOperations(ResourceOperationsBase options, ResourceIdentifier id) : base(options, id) { } @@ -362,23 +355,21 @@ public virtual async Task> AddTagAsync(string key, strin /// The model representing the object to create. />. /// The type of the class containing the container for the specific resource. /// The type of the operations class for a specific resource. - /// The type of the resource identifier. /// The type of the class containing properties for the underlying resource. /// Returns a response with the operation for this resource. /// Name cannot be null or a whitespace. /// Model cannot be null. - public virtual Response CreateResource(string name, TResource model) - where TResource : TrackedResource - where TOperations : ResourceOperationsBase - where TContainer : ResourceContainerBase - where TIdentifier : SubscriptionResourceIdentifier + public virtual Response CreateResource(string name, TResource model) + where TResource : TrackedResource + where TOperations : ResourceOperationsBase + where TContainer : ResourceContainerBase { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException($"{nameof(name)} provided cannot be null or a whitespace.", nameof(name)); if (model is null) throw new ArgumentNullException(nameof(model)); - var myResource = model as TrackedResource; + var myResource = model as TrackedResource; TContainer container = Activator.CreateInstance(typeof(TContainer), ClientOptions, myResource) as TContainer; var createOrUpdateMethod = typeof(TContainer).GetMethod(CreateOrUpdateMethodName); return createOrUpdateMethod.Invoke(container, new object[] { name, model }) as Response; @@ -391,24 +382,22 @@ public virtual Response CreateResource The model representing the object to create. />. /// A token to allow the caller to cancel the call to the service. The default value is . /// The type of the class containing the container for the specific resource. - /// The type of the operations class for a specific resource. /// The type of the resource identifier. /// The type of the class containing properties for the underlying resource. /// A that on completion returns a response with the operation for this resource. /// Name cannot be null or a whitespace. /// Model cannot be null. - public virtual Task> CreateResourceAsync(string name, TResource model, CancellationToken cancellationToken = default) - where TResource : TrackedResource - where TOperations : ResourceOperationsBase - where TContainer : ResourceContainerBase - where TIdentifier : SubscriptionResourceIdentifier + public virtual Task> CreateResourceAsync(string name, TResource model, CancellationToken cancellationToken = default) + where TResource : TrackedResource + where TOperations : ResourceOperationsBase + where TContainer : ResourceContainerBase { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException($"{nameof(name)} provided cannot be null or a whitespace.", nameof(name)); if (model is null) throw new ArgumentNullException(nameof(model)); - var myResource = model as TrackedResource; + var myResource = model as TrackedResource; TContainer container = Activator.CreateInstance(typeof(TContainer), ClientOptions, myResource) as TContainer; var createOrUpdateAsyncMethod = typeof(TContainer).GetMethod(CreateOrUpdateAsyncMethodName); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeaturesRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/FeaturesRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/FeaturesRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/FeaturesRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ProviderRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ProviderRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ProviderRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupsRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ResourceGroupsRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroupsRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ResourceGroupsRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ResourcesRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourcesRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/ResourcesRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionsRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/SubscriptionsRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionsRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/SubscriptionsRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/TagRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/TagRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantsRestOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/TenantsRestOperations.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantsRestOperations.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/RestOperations/TenantsRestOperations.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionContainer.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionContainer.cs index 75042cb9e17d..365b69207e08 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionContainer.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionContainer.cs @@ -14,7 +14,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing collection of Subscription and their operations /// - public class SubscriptionContainer : ResourceContainerBase + public class SubscriptionContainer : ResourceContainerBase { /// /// Initializes a new instance of the class for mocking. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/SubscriptionData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionData.cs similarity index 97% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/SubscriptionData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionData.cs index b0be8cfdf1bb..234c4e95d8cd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/SubscriptionData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionData.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing the subscription data model. /// - public partial class SubscriptionData : TrackedResource + public partial class SubscriptionData : TrackedResource { /// Initializes a new instance of class. /// The subscription id. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionOperations.cs index 1a33003f98e5..6b48fb265bf6 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/SubscriptionOperations.cs @@ -16,7 +16,7 @@ namespace Azure.ResourceManager.Resources /// /// A class representing the operations that can be performed over a specific subscription. /// - public class SubscriptionOperations : ResourceOperationsBase + public class SubscriptionOperations : ResourceOperationsBase { /// /// The resource type for subscription @@ -36,7 +36,7 @@ protected SubscriptionOperations() /// /// The Guid of the subscription. internal SubscriptionOperations(ClientContext clientContext, string subscriptionGuid) - : base(clientContext, new SubscriptionResourceIdentifier(subscriptionGuid)) + : base(clientContext, new ResourceIdentifier(ResourceIdentifier.RootResourceIdentifier, ResourceType, subscriptionGuid)) { } @@ -45,7 +45,7 @@ internal SubscriptionOperations(ClientContext clientContext, string subscription /// /// The resource operations to copy the options from. /// The identifier of the resource that is the target of operations. - internal SubscriptionOperations(OperationsBase operations, TenantResourceIdentifier id) + protected SubscriptionOperations(OperationsBase operations, ResourceIdentifier id) : base(operations, id) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/TagResourceData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagResourceData.cs similarity index 94% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/TagResourceData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagResourceData.cs index bbb498dfd50a..b0ac446f97d3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/TagResourceData.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TagResourceData.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.Resources { /// Wrapper resource for tags API requests and responses. - public partial class TagResourceData : Resource + public partial class TagResourceData : Resource { /// Initializes a new instance of TagsResourceData. /// The set of tags. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/TenantData.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantData.cs similarity index 100% rename from sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/Models/TenantData.cs rename to sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantData.cs diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantOperations.cs index 2a06a988649a..d5ec679797b8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/TenantOperations.cs @@ -30,7 +30,7 @@ protected TenantOperations() /// /// The resource type for subscription /// - public static readonly ResourceType ResourceType = ResourceType.RootResourceType; + public static readonly ResourceType ResourceType = "Microsoft.Resources/tenants"; /// /// Initializes a new instance of the class. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceContainerBase.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceContainerBase.cs index 97e37b457d65..f1e61c753f49 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceContainerBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceContainerBase.cs @@ -9,36 +9,34 @@ namespace Azure.ResourceManager.Core /// /// A class representing collection of resources and their operations over their parent. /// - /// The type of the resource identifier. /// The type of the class containing operations for the underlying resource. /// The type of the class containing properties for the underlying resource. - public abstract class ResourceContainerBase : ContainerBase - where TIdentifier : ResourceIdentifier - where TOperations : ResourceOperationsBase + public abstract class ResourceContainerBase : ContainerBase + where TOperations : ResourceOperationsBase where TResource : class { private readonly object _parentLock = new object(); private object _parentResource; /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// protected ResourceContainerBase() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The client context to use. /// The identifier of the resource that is the target of operations. - internal ResourceContainerBase(ClientContext clientContext, TIdentifier parentId) + internal ResourceContainerBase(ClientContext clientContext, ResourceIdentifier parentId) : base(clientContext, parentId) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The resource representing the parent resource. protected ResourceContainerBase(OperationsBase parent) @@ -61,13 +59,11 @@ protected override void ValidateResourceType(ResourceIdentifier identifier) /// Gets the location of the parent object. /// /// The type of the parents full resource object. - /// The type of the parents resource id. /// The type of the parents operations object. /// The associated with the parent object. - protected TParent GetParentResource() + protected TParent GetParentResource() where TParent : TParentOperations - where TParentOperations : ResourceOperationsBase - where TParentId : ResourceIdentifier + where TParentOperations : ResourceOperationsBase { if (_parentResource is null) { diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/LocationResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/LocationResourceIdentifier.cs deleted file mode 100644 index e62bd94b1505..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/LocationResourceIdentifier.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager -{ - /// - /// The identifier for a resource that is contained in a location. - /// - public sealed class LocationResourceIdentifier : SubscriptionResourceIdentifier - { - /// - /// Initializes a new instance of the class. - /// - /// The identifier of the subscription that is the parent of this resource. - /// The name of the location. - internal LocationResourceIdentifier(SubscriptionResourceIdentifier parent, Location location) - : base(parent, ResourceIdentifier.LocationsKey, location.Name) - { - Location = location; - } - - /// - /// Initializes a new instance of the class. - /// - /// A string representation of a location resource identifier. - public LocationResourceIdentifier(string resourceId) - { - var id = ResourceIdentifier.Create(resourceId) as LocationResourceIdentifier; - if (id is null) - throw new ArgumentException("Not a valid location level resource", nameof(resourceId)); - Name = id.Name; - ResourceType = id.ResourceType; - Parent = id.Parent; - IsChild = id.IsChild; - Location = id.Location; - SubscriptionId = id.SubscriptionId; - } - - /// - /// Initializes a new instance of the class. - /// Used to initialize resources in the same namespace as the parent resource. - /// - /// - /// - /// - internal LocationResourceIdentifier(LocationResourceIdentifier parent, string resourceType, string resourceName) - : base(parent, resourceType, resourceName) - { - Location = parent.Location; - } - - /// - /// Initializes a new instance of the class. - /// Used to initialize resource in a different namespace than the parent resource. - /// - /// The identifier of the parent resource. - /// The namespace of the resource, for example 'Microsoft.Compute'. - /// The simple type name of the resource, for example 'virtualMachines'. - /// The name of this resource. - internal LocationResourceIdentifier(LocationResourceIdentifier target, string providerNamespace, string resourceType, string resourceName) - : base(target, providerNamespace, resourceType, resourceName) - { - Location = target.Location; - } - - /// - /// The location of the resource. - /// - public Location Location { get; } - - /// - public override bool TryGetLocation(out Location location) - { - location = Location; - return true; - } - - /// - public override bool TryGetSubscriptionId(out string subscriptionId) - { - subscriptionId = SubscriptionId; - return true; - } - - /// - /// Convert resourceId string to LocationResourceIdentifier. - /// - /// A string representation of a resource id. - public static implicit operator LocationResourceIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as LocationResourceIdentifier; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceGroupResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceGroupResourceIdentifier.cs deleted file mode 100644 index a5911bf6d030..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceGroupResourceIdentifier.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.ResourceManager -{ - /// - /// The identifier for a resource contained in a resource group. - /// - public sealed class ResourceGroupResourceIdentifier : SubscriptionResourceIdentifier - { - /// - /// Initializes a new instance of the class for a resource group. - /// - /// The of the parent of this child resource. - /// The name of the resourceGroup. - internal ResourceGroupResourceIdentifier(SubscriptionResourceIdentifier parent, string resourceGroupName) - : base(parent, ResourceIdentifier.ResourceGroupsType, resourceGroupName) - { - if (string.IsNullOrWhiteSpace(resourceGroupName)) - throw new ArgumentOutOfRangeException(nameof(resourceGroupName), "Invalid resource group name."); - IsChild = true; - ResourceGroupName = resourceGroupName; - } - - /// - /// Initializes a new instance of the class - /// for a resource in a different namespace than its parent. - /// - /// he of the target of this extension resource. - /// The provider namespace of the extension. - /// The full ARM resource type of the extension. - /// The name of the extension resource. - internal ResourceGroupResourceIdentifier(ResourceGroupResourceIdentifier target, string providerNamespace, string resourceType, string resourceName) - : base(target, providerNamespace, resourceType, resourceName) - { - ResourceGroupName = target.ResourceGroupName; - } - - /// - /// Initializes a new instance of the class - /// for a resource in the same namespace as its parent. - /// - /// he of the target of this extension resource. - /// The full ARM resource type of the extension. - /// The name of the extension resource. - internal ResourceGroupResourceIdentifier(ResourceGroupResourceIdentifier target, string childResourceType, string childResourceName) - : base(target, childResourceType, childResourceName) - { - ResourceGroupName = target.ResourceGroupName; - } - - /// - /// Initializes a new instance of the class - /// - /// The string representation of a resource id. - public ResourceGroupResourceIdentifier(string resourceId) - { - var id = ResourceIdentifier.Create(resourceId) as ResourceGroupResourceIdentifier; - if (id is null) - throw new ArgumentException("Not a valid tenant level resource", nameof(resourceId)); - Name = id.Name; - ResourceType = id.ResourceType; - Parent = id.Parent; - IsChild = id.IsChild; - ResourceGroupName = id.ResourceGroupName; - SubscriptionId = id.SubscriptionId; - } - - /// - /// The name of the resource group for this resource. - /// - public string ResourceGroupName { get; } - - /// - public override bool TryGetResourceGroupName(out string resourceGroupName) - { - resourceGroupName = ResourceGroupName; - return true; - } - - /// - /// Convert a string into a resource group resource identifier. - /// - /// The string representation of a resource Id. - public static implicit operator ResourceGroupResourceIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as ResourceGroupResourceIdentifier; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifier.cs index a4a7525ad540..48961034dcba 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifier.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifier.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager @@ -13,49 +14,100 @@ namespace Azure.ResourceManager /// /// An Azure Resource Manager resource identifier. /// - public abstract class ResourceIdentifier : IEquatable, IComparable + public class ResourceIdentifier : IEquatable, IComparable { - internal const string ProvidersKey = "providers", SubscriptionsKey = "subscriptions", - ResourceGroupsKey = "resourceGroups", LocationsKey = "locations"; + private const string RootStringValue = "/"; + internal const string ProvidersKey = "providers"; + internal const string SubscriptionsKey = "subscriptions"; + internal const string LocationsKey = "locations"; internal const string ResourceGroupsLowerKey = "resourcegroups"; - internal const string BuiltInResourceNamespace = "Microsoft.Resources"; - internal static readonly IDictionary SubscriptionResourceWithImplicitProviderList = - new Dictionary() { { "tagnames", "Microsoft.Resources" } }; - - internal static ResourceType SubscriptionType => new ResourceType(BuiltInResourceNamespace, SubscriptionsKey); - internal static ResourceType LocationsType => - new ResourceType(BuiltInResourceNamespace, $"{SubscriptionsKey}/{LocationsKey}"); - internal static ResourceType ResourceGroupsType => - new ResourceType(BuiltInResourceNamespace, $"{ResourceGroupsKey}"); - /// - /// The root of the resource hierarchy + /// The root of the resource hierarchy. /// - public static ResourceIdentifier RootResourceIdentifier => new RootResourceIdentifier(); + public static readonly ResourceIdentifier RootResourceIdentifier = new ResourceIdentifier(null, TenantOperations.ResourceType, string.Empty); /// /// For internal use only. /// - internal ResourceIdentifier() + /// The parent resource for this resource. + /// The type of the resource. + /// The name of the resource. + internal ResourceIdentifier(ResourceIdentifier parent, ResourceType resourceType, string name) { - _stringValue = null; + Init(parent, resourceType, name, true); } /// - /// For internal use only. + /// Initializes a new instance of the class. /// - /// The type of the resource. - /// The name of the resource. - internal ResourceIdentifier(ResourceType resourceType, string name) + /// The id string to create the ResourceIdentifier from. + public ResourceIdentifier(string resourceId) { + var id = Create(resourceId); + Init(id.Parent, id.ResourceType, id.Name, id.IsChild); + } + + private ResourceIdentifier(ResourceIdentifier parent, string resourceTypeName, string resourceName) + { + Init(parent, ChooseResourceType(resourceTypeName, parent), resourceName, true); + } + + /// + /// Initializes a new instance of the class for a resource in a different namespace than its parent. + /// + /// The of the target of this extension resource. + /// The provider namespace of the extension. + /// The full ARM resource type of the extension. + /// The name of the extension resource. + internal ResourceIdentifier(ResourceIdentifier parent, string providerNamespace, string resourceTypeName, string resourceName) + { + Init(parent, new ResourceType(providerNamespace, resourceTypeName), resourceName, false); + } + + private void Init(ResourceIdentifier parent, ResourceType resourceType, string name, bool isChild) + { + if (parent != null) + { + Provider = parent.Provider; + SubscriptionId = parent.SubscriptionId; + Location = parent.Location; + ResourceGroupName = parent.ResourceGroupName; + } + + if (resourceType == SubscriptionOperations.ResourceType) + { + Guid output; + if (!Guid.TryParse(name, out output)) + throw new ArgumentOutOfRangeException("resourceId", "Invalid resource id."); + SubscriptionId = name; + } + + if (resourceType.LastType == LocationsKey) + Location = name; + + if (resourceType == ResourceGroupOperations.ResourceType) + ResourceGroupName = name; + + if (resourceType == ProviderOperations.ResourceType) + Provider = name; + + Parent = parent ?? RootResourceIdentifier; + IsChild = isChild; ResourceType = resourceType; Name = name; - _stringValue = null; + _stringValue = parent == null ? RootStringValue : null; } + private static ResourceType ChooseResourceType(string resourceTypeName, ResourceIdentifier parent) => resourceTypeName.ToLowerInvariant() switch + { + ResourceGroupsLowerKey => ResourceGroupOperations.ResourceType, + SubscriptionsKey => SubscriptionOperations.ResourceType, + _ => new ResourceType(parent.ResourceType, resourceTypeName) + }; + /// /// Initializes a new instance of the class. /// @@ -65,263 +117,57 @@ public static ResourceIdentifier Create(string resourceId) { if (resourceId is null) throw new ArgumentNullException(nameof(resourceId)); + if (!resourceId.StartsWith("/", StringComparison.InvariantCultureIgnoreCase)) throw new ArgumentOutOfRangeException(nameof(resourceId), "Invalid resource id."); + var parts = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).ToList(); if (parts.Count < 2) throw new ArgumentOutOfRangeException(nameof(resourceId), "Invalid resource id."); - switch (parts[0].ToLowerInvariant()) - { - case SubscriptionsKey: - { - ResourceIdentifier id = CreateBaseSubscriptionIdentifier(parts[1], parts.Trim(2)); - id.StringValue = resourceId; - return id; - } - case ProvidersKey: - { - if (parts.Count == 2 || parts[2] == ProvidersKey) - { - ResourceIdentifier id = CreateTenantProviderIdentifier(new TenantProviderIdentifier(new TenantResourceIdentifier(), parts[1]), parts.Trim(2)); - id.StringValue = resourceId; - return id; - } - else if (parts.Count > 3) - { - ResourceIdentifier id = CreateTenantIdentifier(new TenantResourceIdentifier(new ResourceType(parts[1], parts[2]), parts[3]), parts.Trim(4)); - id.StringValue = resourceId; - return id; - } - throw new ArgumentOutOfRangeException(nameof(resourceId), "Invalid resource id."); - } - default: - throw new ArgumentOutOfRangeException(nameof(resourceId), "Invalid resource id."); - } - } - /// - /// Create a new instance of the class for resource identifiers - /// that are contained in a subscription. - /// - /// The GUID string representing the resource. - /// The path segments in the resource id following the subscription Guid. - /// The resource identifier for the given resource path. - internal static ResourceIdentifier CreateBaseSubscriptionIdentifier(string subscriptionId, List parts) - { - Guid subscriptionGuid; - if (!Guid.TryParse(subscriptionId, out subscriptionGuid)) - throw new ArgumentOutOfRangeException(nameof(subscriptionId), "Invalid subscription id."); - var subscription = new SubscriptionResourceIdentifier(subscriptionGuid); - if (parts.Count == 0) - return subscription; - if (parts.Count > 1) - { - switch (parts[0].ToLowerInvariant()) - { - case LocationsKey: - return CreateBaseLocationIdentifier(subscription, parts[1], parts.Trim(2)); - case ResourceGroupsLowerKey: - return CreateBaseResourceGroupIdentifier(subscription, parts[1], parts.Trim(2)); - case ProvidersKey: - { - if (parts.Count == 2 || parts[2] == ProvidersKey) - { - return CreateSubscriptionProviderIdentifier(new SubscriptionProviderIdentifier(new SubscriptionResourceIdentifier(subscription), parts[1]), parts.Trim(2)); - } - else if (parts.Count > 3) - return CreateSubscriptionIdentifier(new SubscriptionResourceIdentifier(subscription, - parts[1], parts[2], parts[3]), parts.Skip(4).ToList()); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource string"); - } - default: - { - // Check for resources that has implicit(omitted) provider - if (SubscriptionResourceWithImplicitProviderList.Keys.Contains(parts[0].ToLowerInvariant())) - { - var resourceTypeName = parts[0].ToLowerInvariant(); - var providerName = SubscriptionResourceWithImplicitProviderList[parts[0].ToLowerInvariant()]; - var providerIdentifier = new SubscriptionProviderIdentifier(subscription, providerName); - if (parts.Count == 1 || parts[1] == ProvidersKey) - { - return CreateSubscriptionProviderIdentifier(providerIdentifier, parts.Trim(1)); - } - - if (parts.Count > 1) - { - return CreateSubscriptionIdentifier( - new SubscriptionResourceIdentifier(providerIdentifier, providerName, resourceTypeName, parts[1]), - parts.Skip(2).ToList()); - } - } - - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } - } - } + var firstToLower = parts[0].ToLowerInvariant(); + if (firstToLower != SubscriptionsKey && firstToLower != ProvidersKey) + throw new ArgumentOutOfRangeException(nameof(resourceId), "Invalid resource id."); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); + return AppendNext(RootResourceIdentifier, parts); } - /// - /// Create a new instance of the class for resource identifiers - /// that are contained in a location. - /// - /// The resource id of the subscription for this resource. - /// The location of the resource. - /// The path segments in the resource id following the location. - /// The resource identifier for the given resource path. - internal static ResourceIdentifier CreateBaseLocationIdentifier(SubscriptionResourceIdentifier subscription, Location location, List parts) + private static ResourceIdentifier AppendNext(ResourceIdentifier parent, List parts) { - var parent = new LocationResourceIdentifier(subscription, location); if (parts.Count == 0) return parent; - if (parts.Count == 1) - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - switch (parts[0].ToLowerInvariant()) - { - case ProvidersKey: - { - if (parts.Count > 3) - return CreateLocationIdentifier(new LocationResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } - default: - return CreateLocationIdentifier(new LocationResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - } - } - /// - /// Create a new instance of the class for resource identifiers - /// that are contained in a resource group. - /// - /// The resource id of the subscription for this resource. - /// The resource group containing the resource. - /// The path segments in the resource id following the resource group name. - /// The resource identifier for the given resource path. - internal static ResourceIdentifier CreateBaseResourceGroupIdentifier(SubscriptionResourceIdentifier subscription, string resourceGroupName, List parts) - { - var parent = new ResourceGroupResourceIdentifier(subscription, resourceGroupName); - if (parts.Count == 0) - return parent; + var lowerFirstPart = parts[0].ToLowerInvariant(); + if (parts.Count == 1) - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - switch (parts[0].ToLowerInvariant()) { - case ProvidersKey: - { - if (parts.Count > 3) - return CreateResourceGroupIdentifier(new ResourceGroupResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } - default: - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } - } + //subscriptions and resourceGroups aren't valid ids without their name + if (lowerFirstPart == SubscriptionsKey || lowerFirstPart == ResourceGroupsLowerKey) + throw new ArgumentOutOfRangeException("resourceId", "Invalid resource id."); - /// - /// Create a new instance of the class for resource identifiers - /// that are based in the tenant. - /// - /// The resource id of the parent resource. - /// The path segments in the resource path after the parent. - /// A resource identifier for a resource contained in the tenant. - internal static ResourceIdentifier CreateTenantIdentifier(TenantResourceIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new TenantResourceIdentifier(parent, parts[0], string.Empty); - if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateTenantIdentifier(new TenantResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateTenantIdentifier(new TenantResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } + //resourceGroup must contain either child or provider resource type + if (parent.ResourceType == ResourceGroupOperations.ResourceType) + throw new ArgumentOutOfRangeException("resourceId", "Invalid resource id."); - /// - /// Create a new instance of the class for resource identifiers - /// that are based in a subscription. - /// - /// The resource id of the parent resource. - /// The path segments in the resource path after the parent. - /// A resource identifier for a resource contained in the subscription. - internal static ResourceIdentifier CreateSubscriptionIdentifier(SubscriptionResourceIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new SubscriptionResourceIdentifier(parent, parts[0], string.Empty); - if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateSubscriptionIdentifier(new SubscriptionResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateSubscriptionIdentifier(new SubscriptionResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } + return new ResourceIdentifier(parent, parts[0], string.Empty); + } - /// - /// Create a new instance of the class for resource identifiers - /// that are contained in a location. - /// - /// The resource id of the parent resource. - /// The path segments in the resource path after the parent. - /// A resource identifier for a resource contained in a location. - internal static ResourceIdentifier CreateLocationIdentifier(LocationResourceIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new LocationResourceIdentifier(parent, parts[0], string.Empty); - if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateLocationIdentifier(new LocationResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateLocationIdentifier(new LocationResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } + if (lowerFirstPart == ProvidersKey && (parts.Count == 2 || parts[2].ToLowerInvariant() == ProvidersKey)) + { + //provider resource can only be on a tenant or a subscription parent + if (parent.ResourceType != SubscriptionOperations.ResourceType && parent.ResourceType != TenantOperations.ResourceType) + throw new ArgumentOutOfRangeException("resourceId", "Invalid resource id."); - /// - /// Create a new instance of the class for resource identifiers - /// that are contained in a resource group. - /// - /// The resource id of the parent resource. - /// The path segments in the resource path after the parent. - /// A resource identifier for a resource contained in a resource group. - internal static ResourceIdentifier CreateResourceGroupIdentifier(ResourceGroupResourceIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new ResourceGroupResourceIdentifier(parent, parts[0], string.Empty); - if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateResourceGroupIdentifier(new ResourceGroupResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateResourceGroupIdentifier(new ResourceGroupResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } + return AppendNext(new ResourceIdentifier(parent, ProviderOperations.ResourceType, parts[1]), parts.Trim(2)); + } - private static ResourceIdentifier CreateTenantProviderIdentifier(TenantProviderIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new TenantProviderIdentifier(parent, parts[0], string.Empty); if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateTenantProviderIdentifier(new TenantProviderIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateTenantProviderIdentifier(new TenantProviderIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); - } + return AppendNext(new ResourceIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); - private static ResourceIdentifier CreateSubscriptionProviderIdentifier(SubscriptionProviderIdentifier parent, List parts) - { - if (parts.Count == 0) - return parent; - if (parts.Count == 1) - return new SubscriptionProviderIdentifier(parent, parts[0], string.Empty); - if (parts.Count > 3 && string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateSubscriptionProviderIdentifier(new SubscriptionProviderIdentifier(parent, parts[1], parts[2], parts[3]), parts.Trim(4)); if (parts.Count > 1 && !string.Equals(parts[0], ProvidersKey, StringComparison.InvariantCultureIgnoreCase)) - return CreateSubscriptionProviderIdentifier(new SubscriptionProviderIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); - throw new ArgumentOutOfRangeException(nameof(parts), "Invalid resource id."); + return AppendNext(new ResourceIdentifier(parent, parts[0], parts[1]), parts.Trim(2)); + + throw new ArgumentOutOfRangeException("resourceId", "Invalid resource id."); } private object lockObject = new object(); @@ -374,18 +220,35 @@ internal string StringValue /// internal virtual bool IsChild { get; set; } + /// + /// Gets the subscription id if it exists otherwise null. + /// + public string SubscriptionId { get; protected set; } + + /// + /// Gets the provider namespace if it exists otherwise null. + /// + public string Provider { get; protected set; } + + /// + /// Gets the location if it exists otherwise null. + /// + public string Location { get; protected set; } + + /// + /// The name of the resource group if it exists otherwise null. + /// + public string ResourceGroupName { get; protected set; } + /// /// Tries to get the resource identifier of the parent of this resource. /// - /// The resource id of the parent resource. + /// The resource id of the parent resource. /// True if the resource has a parent, otherwise false. - public virtual bool TryGetParent(out ResourceIdentifier containerId) + public virtual bool TryGetParent(out ResourceIdentifier resourceId) { - containerId = default(ResourceIdentifier); - if (this.Parent is RootResourceIdentifier) - return false; - containerId = this.Parent; - return true; + resourceId = Parent; + return resourceId != null; } /// @@ -395,8 +258,8 @@ public virtual bool TryGetParent(out ResourceIdentifier containerId) /// True if the resource is contained in a subscription, otherwise false. public virtual bool TryGetSubscriptionId(out string subscriptionId) { - subscriptionId = default(string); - return false; + subscriptionId = SubscriptionId; + return subscriptionId != null; } /// @@ -406,8 +269,8 @@ public virtual bool TryGetSubscriptionId(out string subscriptionId) /// True if the resource is contained in a resource group, otherwise false. public virtual bool TryGetResourceGroupName(out string resourceGroupName) { - resourceGroupName = default(string); - return false; + resourceGroupName = ResourceGroupName; + return resourceGroupName != null; } /// @@ -417,8 +280,8 @@ public virtual bool TryGetResourceGroupName(out string resourceGroupName) /// True if the resource is contained in a location, otherwise false. public virtual bool TryGetLocation(out Location location) { - location = default(Location); - return false; + location = Location; + return location != null; } /// @@ -427,10 +290,13 @@ public virtual bool TryGetLocation(out Location location) /// The string representation of this resource id. internal virtual string ToResourceString() { + if (Parent == null) + return string.Empty; + StringBuilder builder = new StringBuilder(Parent.ToResourceString()); if (IsChild) { - builder.Append($"/{ResourceType.Types[ResourceType.Types.Count - 1]}"); + builder.Append($"/{ResourceType.LastType}"); if (!string.IsNullOrWhiteSpace(Name)) builder.Append($"/{Name}"); } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifierExtensions.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifierExtensions.cs index ae64be932963..241929c2b141 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifierExtensions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceIdentifierExtensions.cs @@ -22,134 +22,10 @@ public static class ResourceIdentifierExtensions /// The name of the resource. /// The combined resource id. [EditorBrowsable(EditorBrowsableState.Never)] - public static TenantResourceIdentifier AppendProviderResource(this TenantResourceIdentifier identifier, string providerNamespace, string resourceType, string resourceName) + public static ResourceIdentifier AppendProviderResource(this ResourceIdentifier identifier, string providerNamespace, string resourceType, string resourceName) { ValidateProviderResourceParameters(providerNamespace, resourceType, resourceName); - return new TenantResourceIdentifier(identifier, providerNamespace, resourceType, resourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The provider namespace of the added resource. - /// The simple type of the added resource, without slashes (/), - /// for example, 'virtualMachines'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static SubscriptionResourceIdentifier AppendProviderResource(this SubscriptionResourceIdentifier identifier, string providerNamespace, string resourceType, string resourceName) - { - ValidateProviderResourceParameters(providerNamespace, resourceType, resourceName); - return new SubscriptionResourceIdentifier(identifier, providerNamespace, resourceType, resourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The provider namespace of the added resource. - /// The simple type of the added resource, without slashes (/), - /// for example, 'virtualMachines'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static SubscriptionProviderIdentifier AppendProviderResource(this SubscriptionProviderIdentifier identifier, string providerNamespace, string resourceType, string resourceName) - { - ValidateProviderResourceParameters(providerNamespace, resourceType, resourceName); - return new SubscriptionProviderIdentifier(identifier, providerNamespace, resourceType, resourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The provider namespace of the added resource. - /// The simple type of the added resource, without slashes (/), - /// for example, 'virtualMachines'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ResourceGroupResourceIdentifier AppendProviderResource(this ResourceGroupResourceIdentifier identifier, string providerNamespace, string resourceType, string resourceName) - { - ValidateProviderResourceParameters(providerNamespace, resourceType, resourceName); - return new ResourceGroupResourceIdentifier(identifier, providerNamespace, resourceType, resourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The provider namespace of the added resource. - /// The simple type of the added resource, without slashes (/), - /// for example, 'virtualMachines'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static LocationResourceIdentifier AppendProviderResource(this LocationResourceIdentifier identifier, string providerNamespace, string resourceType, string resourceName) - { - ValidateProviderResourceParameters(providerNamespace, resourceType, resourceName); - return new LocationResourceIdentifier(identifier, providerNamespace, resourceType, resourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The simple type of the child resource, without slashes (/), - /// for example, 'subnets'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static TenantResourceIdentifier AppendChildResource(this TenantResourceIdentifier identifier, string childResourceType, string childResourceName) - { - ValidateChildResourceParameters( childResourceType, childResourceName); - return new TenantResourceIdentifier(identifier, childResourceType, childResourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The simple type of the child resource, without slashes (/), - /// for example, 'subnets'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static SubscriptionResourceIdentifier AppendChildResource(this SubscriptionResourceIdentifier identifier, string childResourceType, string childResourceName) - { - ValidateChildResourceParameters(childResourceType, childResourceName); - return new SubscriptionResourceIdentifier(identifier, childResourceType, childResourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The simple type of the child resource, without slashes (/), - /// for example, 'subnets'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static SubscriptionProviderIdentifier AppendChildResource(this SubscriptionProviderIdentifier identifier, string childResourceType, string childResourceName) - { - ValidateChildResourceParameters(childResourceType, childResourceName); - return new SubscriptionProviderIdentifier(identifier, childResourceType, childResourceName); - } - - /// - /// Add a provider resource to an existing resource id. - /// - /// The id to append to. - /// The simple type of the child resource, without slashes (/), - /// for example, 'subnets'. - /// The name of the resource. - /// The combined resource id. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ResourceGroupResourceIdentifier AppendChildResource(this ResourceGroupResourceIdentifier identifier, string childResourceType, string childResourceName) - { - ValidateChildResourceParameters(childResourceType, childResourceName); - return new ResourceGroupResourceIdentifier(identifier, childResourceType, childResourceName); + return new ResourceIdentifier(identifier, providerNamespace, resourceType, resourceName); } /// @@ -161,10 +37,10 @@ public static ResourceGroupResourceIdentifier AppendChildResource(this ResourceG /// The name of the resource. /// The combined resource id. [EditorBrowsable(EditorBrowsableState.Never)] - public static LocationResourceIdentifier AppendChildResource(this LocationResourceIdentifier identifier, string childResourceType, string childResourceName) + internal static ResourceIdentifier AppendChildResource(this ResourceIdentifier identifier, string childResourceType, string childResourceName) { ValidateChildResourceParameters(childResourceType, childResourceName); - return new LocationResourceIdentifier(identifier, childResourceType, childResourceName); + return new ResourceIdentifier(identifier, childResourceType, childResourceName); } internal static void ValidateProviderResourceParameters(string providerNamespace, string resourceType, string resourceName) diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceType.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceType.cs index 64de83a78f7e..0e880bc61200 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceType.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/ResourceType.cs @@ -53,6 +53,8 @@ internal ResourceType(ResourceType parent, string childType) { } + internal string LastType => Types[Types.Count - 1]; + /// /// Gets the resource type Namespace. /// diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/RootResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/RootResourceIdentifier.cs deleted file mode 100644 index 506dd6122f1e..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/RootResourceIdentifier.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.ResourceManager -{ - /// - /// A resource Id representing the root of the resource hierarchy. - /// - public sealed class RootResourceIdentifier : ResourceIdentifier - { - internal RootResourceIdentifier() - : base(ResourceType.RootResourceType, string.Empty) - { - } - - internal override string ToResourceString() - { - return string.Empty; - } - - /// - public override bool TryGetParent(out ResourceIdentifier containerId) - { - containerId = default(ResourceIdentifier); - return false; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionProviderIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionProviderIdentifier.cs deleted file mode 100644 index e4f7923d2b83..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionProviderIdentifier.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager -{ - /// - /// The identifier of a Provider from Subscription. - /// - public class SubscriptionProviderIdentifier : SubscriptionResourceIdentifier - { - internal SubscriptionProviderIdentifier(SubscriptionResourceIdentifier parent, string providerNamespace) - { - Parent = parent; - Provider = providerNamespace; - IsChild = true; - ResourceType = ProviderOperations.ResourceType; - SubscriptionId = parent.SubscriptionId; - } - - internal SubscriptionProviderIdentifier(SubscriptionProviderIdentifier parent, string providerNamespace, string typeName, string resourceName) - : base(parent, providerNamespace, typeName, resourceName) - { - Parent = parent; - Provider = parent.Provider; - IsChild = true; - SubscriptionId = parent.SubscriptionId; - } - - /// - /// Initializes a new instance of the class - /// for resources in the sanem namespace as their parent resource. - /// - /// The resource id of the parent resource. - /// The simple type of this resource, for example 'subnets'. - /// The name of this resource. - /// The resource identifier for the given child resource. - internal SubscriptionProviderIdentifier(SubscriptionProviderIdentifier parent, string typeName, string resourceName) - : base(parent, typeName, resourceName) - { - Parent = parent; - Provider = parent.Provider; - IsChild = true; - SubscriptionId = parent.SubscriptionId; - } - - /// - /// Gets the Provider for the current ProviderIdentifier. - /// - public string Provider { get; } - - /// - /// Convert a string resource identifier into a TenantResourceIdentifier. - /// - /// The string representation of a subscription resource identifier. - public static implicit operator SubscriptionProviderIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as SubscriptionProviderIdentifier; - } - - /// - public override bool TryGetProvider(out string providerId) - { - providerId = Provider; - return true; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionResourceIdentifier.cs deleted file mode 100644 index 607a02dd9814..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/SubscriptionResourceIdentifier.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.ResourceManager -{ - /// - /// The identifier of a resource that is contained in a subscription. - /// - public class SubscriptionResourceIdentifier : TenantResourceIdentifier - { - /// - /// Internal use only. - /// - internal SubscriptionResourceIdentifier() - { - } - - /// - /// Internal use only. - /// - /// The subscription GUID. - internal SubscriptionResourceIdentifier(Guid id) - { - Name = id.ToString(); - ResourceType = ResourceIdentifier.SubscriptionType; - Parent = ResourceIdentifier.RootResourceIdentifier; - IsChild = false; - SubscriptionId = Name; - } - - /// - /// Initializes a new instance of the class - /// for resources in the sanem namespace as their parent resource. - /// - /// The resource id of the parent resource. - /// The simple type of this resource, for example 'subnets'. - /// The name of this resource. - /// The resource identifier for the given child resource. - internal SubscriptionResourceIdentifier(SubscriptionResourceIdentifier parent, ResourceType resourceType, string resourceName) - : base(parent, resourceType, resourceName) - { - SubscriptionId = parent.SubscriptionId; - } - - /// - /// Initializes a new instance of the class - /// for resources in the sanem namespace as their parent resource. - /// - /// The resource id of the parent resource. - /// The simple type of this resource, for example 'subnets'. - /// The name of this resource. - /// The resource identifier for the given child resource. - internal SubscriptionResourceIdentifier(SubscriptionResourceIdentifier parent, string childResourceType, string childResourceName) - : base(parent, childResourceType, childResourceName) - { - SubscriptionId = parent.SubscriptionId; - } - - /// - /// Initializes a new instance of the class - /// for resources in a different namespace than their parent resource. - /// - /// The resource id of the parent resource. - /// The namespace of this resource, for example 'Microsoft.Compute'. - /// The simple tyoe of this resource, with no slashes. For example, 'virtualMachines'. - /// Thge name of this resource. - /// The resource identifier for the given resource. - internal SubscriptionResourceIdentifier(SubscriptionResourceIdentifier parent, string providerNamespace, string resourceType, string resourceName) - : base(parent, providerNamespace, resourceType, resourceName) - { - SubscriptionId = parent.SubscriptionId; - } - - /// - /// Initializes a new instance of the class. - /// - /// The string representation of the subscription id. This can be in the form of a GUID, - /// or a full resource id like '/subscriptions/xxxxx-yyyy-zzzz-wwwwww'. - public SubscriptionResourceIdentifier(string resourceIdOrSubscriptionId) - { - Guid subscriptionGuid; - if (Guid.TryParse(resourceIdOrSubscriptionId, out subscriptionGuid)) - { - Name = resourceIdOrSubscriptionId; - ResourceType = ResourceIdentifier.SubscriptionType; - Parent = ResourceIdentifier.RootResourceIdentifier; - IsChild = false; - SubscriptionId = resourceIdOrSubscriptionId; - } - else - { - ResourceIdentifier rawId = ResourceIdentifier.Create(resourceIdOrSubscriptionId); - SubscriptionResourceIdentifier id = rawId as SubscriptionResourceIdentifier; - if (id is null || rawId.TryGetLocation(out _) || rawId.TryGetResourceGroupName(out _)) - throw new ArgumentException("Not a valid subscription level resource", nameof(resourceIdOrSubscriptionId)); - Name = id.Name; - ResourceType = id.ResourceType; - Parent = id.Parent; - IsChild = id.IsChild; - SubscriptionId = id.SubscriptionId; - } - } - - /// - /// The subscription id (Guid) for this resource. - /// - public string SubscriptionId { get; internal set; } - - /// - public override bool TryGetSubscriptionId(out string subscriptionId) - { - subscriptionId = SubscriptionId; - return true; - } - - /// - /// Convert a string resource id into a subscription resource identifier. - /// - /// The string representation of a resource identifier. - public static implicit operator SubscriptionResourceIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as SubscriptionResourceIdentifier; - } - - internal override string ToResourceString() - { - if (Parent is RootResourceIdentifier) - return $"/subscriptions/{SubscriptionId}"; - return base.ToResourceString(); - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantProviderIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantProviderIdentifier.cs deleted file mode 100644 index a22cc5603e3b..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantProviderIdentifier.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager -{ - /// - /// The identifier of a Provider from Tenant. - /// - public class TenantProviderIdentifier : TenantResourceIdentifier - { - internal TenantProviderIdentifier(TenantResourceIdentifier parent, string providerNamespace) - { - Parent = parent; - Provider = providerNamespace; - IsChild = true; - ResourceType = ProviderOperations.ResourceType; - } - - internal TenantProviderIdentifier(TenantProviderIdentifier parent, string providerNamespace, string typeName, string resourceName) - : base(new ResourceType(providerNamespace, typeName), resourceName) - { - Parent = parent; - Provider = parent.Provider; - IsChild = true; - } - - /// - /// Initializes a new instance of the class - /// for resources in the sanem namespace as their parent resource. - /// - /// The resource id of the parent resource. - /// The simple type of this resource, for example 'subnets'. - /// The name of this resource. - /// The resource identifier for the given child resource. - internal TenantProviderIdentifier(TenantProviderIdentifier parent, string typeName, string resourceName) - : base(new ResourceType(parent.ResourceType, typeName), resourceName) - { - Parent = parent; - Provider = parent.Provider; - IsChild = true; - } - - /// - /// Gets the Provider for the current ProviderIdentifier. - /// - public string Provider { get; } - - /// - /// Convert a string resource identifier into a TenantResourceIdentifier. - /// - /// The string representation of a subscription resource identifier. - public static implicit operator TenantProviderIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as TenantProviderIdentifier; - } - - /// - public override bool TryGetProvider(out string providerId) - { - providerId = Provider; - return true; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantResourceIdentifier.cs deleted file mode 100644 index 024a67f1f176..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceIdentifier/TenantResourceIdentifier.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Linq; - -namespace Azure.ResourceManager -{ - /// - /// The identifier of any resource - /// - public class TenantResourceIdentifier : ResourceIdentifier - { - internal TenantResourceIdentifier() - { - } - - /// - /// Initializes a new instance of the class - /// - /// The resource type (including namespace and type). - /// The name of the resource. - internal TenantResourceIdentifier(ResourceType resourceType, string name) : base(resourceType, name) - { - Parent = ResourceIdentifier.RootResourceIdentifier; - } - - /// - /// Initializes a new instance of the class - /// for resources in the same namespace as their parent. - /// - /// The parent resource id. - /// The simple type name of the resource without slashes (/), for example 'virtualMachines'. - /// The name of the resource. - internal TenantResourceIdentifier(TenantResourceIdentifier parent, ResourceType resourceType, string resourceName) - : base(resourceType, resourceName) - { - Parent = parent; - } - - /// - /// Initializes a new instance of the class - /// for resources in the same namespace as their parent. - /// - /// The parent resource id. - /// The simple type name of the resource without slashes (/), for example 'virtualMachines'. - /// The name of the resource. - internal TenantResourceIdentifier(TenantResourceIdentifier parent, string typeName, string resourceName) - : base(new ResourceType(parent.ResourceType, typeName), resourceName) - { - Parent = parent; - IsChild = true; - } - - /// - /// Initializes a new instance of the class - /// for resources in a different namespace than their parent. - /// - /// The parent resource id. - /// The namespace of the resource type, for example, 'Microsoft.Compute'. - /// The simple type name of the resource, without slashes (/). For example, 'virtualMachines'. - /// The name of the resource. - internal TenantResourceIdentifier(TenantResourceIdentifier parent, string providerNamespace, string typeName, string resourceName) - : base(new ResourceType(providerNamespace, typeName), resourceName) - { - Parent = parent; - } - - /// - /// Initializes a new instance of the class. - /// - /// The string representation of a resource identifier. - public TenantResourceIdentifier(string resourceId) - { - var rawId = ResourceIdentifier.Create(resourceId); - TenantResourceIdentifier id = rawId as TenantResourceIdentifier; - if (id is null || rawId.TryGetSubscriptionId(out _)) - throw new ArgumentException("Not a valid tenant level resource", nameof(resourceId)); - Name = id.Name; - ResourceType = id.ResourceType; - Parent = id.Parent; - IsChild = id.IsChild; - } - - /// - /// Convert a string resource identifier into a TenantResourceIdentifier. - /// - /// The string representation of a subscription resource identifier. - public static implicit operator TenantResourceIdentifier(string other) - { - if (other is null) - return null; - - return ResourceIdentifier.Create(other) as TenantResourceIdentifier; - } - - /// - /// Tries to get the provider from the resource Id. - /// - /// The id to parse for a provider. - /// True if a provider exists. - public virtual bool TryGetProvider(out string providerId) - { - providerId = default(string); - return false; - } - } -} diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceListOperations.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceListOperations.cs index d1f38e69f9fa..fb13147ae10e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceListOperations.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceListOperations.cs @@ -113,8 +113,7 @@ public static AsyncPageable ListAtContextAsync( private static GenericResourceContainer GetGenericResourceContainer(ResourceOperationsBase resourceOperations) { - var subscription = resourceOperations.Id as SubscriptionResourceIdentifier; - return new GenericResourceContainer(new ClientContext(resourceOperations.ClientOptions, resourceOperations.Credential, resourceOperations.BaseUri, resourceOperations.Pipeline), subscription); + return new GenericResourceContainer(new ClientContext(resourceOperations.ClientOptions, resourceOperations.Credential, resourceOperations.BaseUri, resourceOperations.Pipeline), resourceOperations.Id); } private static AsyncPageable ListAtContextInternalAsync( diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceOperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceOperationsBase.cs index c4a71ca89ec1..17ac7a0f6435 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ResourceOperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ResourceOperationsBase.cs @@ -37,20 +37,19 @@ internal ResourceOperationsBase(ClientContext clientContext, ResourceIdentifier /// Base class for all operations over a resource. /// /// The type implementing operations over the resource. - /// The The identifier type for the resource. [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Types differ by type argument only")] - public abstract class ResourceOperationsBase : ResourceOperationsBase - where TOperations : ResourceOperationsBase where TIdentifier : ResourceIdentifier + public abstract class ResourceOperationsBase : ResourceOperationsBase + where TOperations : ResourceOperationsBase { /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// protected ResourceOperationsBase() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Initializes a new instance of the class. /// The resource representing the parent resource. @@ -70,14 +69,6 @@ internal ResourceOperationsBase(ClientContext clientContext, ResourceIdentifier { } - /// - /// The typed resource identifier for the underlying resource. - /// - public virtual new TIdentifier Id - { - get { return base.Id as TIdentifier; } - } - /// /// Gets details for this resource from the service. /// diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/SingletonOperationsBase.cs b/sdk/resourcemanager/Azure.ResourceManager/src/SingletonOperationsBase.cs index 83e920b1cc28..80314d54877f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/SingletonOperationsBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/SingletonOperationsBase.cs @@ -46,27 +46,25 @@ public ResourceIdentifier ParentId /// Base class representing a singleton operation /// /// The type of the class containing operations for the underlying resource. - /// The type of the resource identifier. [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "")] - public abstract class SingletonOperationsBase : SingletonOperationsBase - where TOperations : SingletonOperationsBase - where TIdentifier : ResourceIdentifier + public abstract class SingletonOperationsBase : SingletonOperationsBase + where TOperations : SingletonOperationsBase { /// - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of the class for mocking. /// protected SingletonOperationsBase() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The resource representing the parent resource. protected SingletonOperationsBase(OperationsBase parent) : base(parent) { - ParentId = parent.Id as TIdentifier; + ParentId = parent.Id; if (string.IsNullOrWhiteSpace(ParentId)) { throw new InvalidOperationException(); @@ -76,7 +74,7 @@ protected SingletonOperationsBase(OperationsBase parent) /// /// The typed resource identifier for the underlying resource /// - protected new TIdentifier ParentId + protected new ResourceIdentifier ParentId { get; } diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Readme.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Readme.cs index a73a31e33940..53e48bf1ad75 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Readme.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Readme.cs @@ -7,7 +7,7 @@ #if !SNIPPET using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests.Samples +namespace Azure.ResourceManager.Tests.Samples { class Readme { @@ -30,7 +30,7 @@ public void CastingToSpecificType() #region Snippet:Readme_CastToSpecificType string resourceId = "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/workshop2021-rg/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"; // We know the subnet is a resource group level identifier since it has a resource group name in its string - ResourceGroupResourceIdentifier id = resourceId; + ResourceIdentifier id = resourceId; Console.WriteLine($"Subscription: {id.SubscriptionId}"); Console.WriteLine($"ResourceGroup: {id.ResourceGroupName}"); Console.WriteLine($"Vnet: {id.Parent.Name}"); diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorld.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorld.cs index 63e178a3015e..e21a71a2a829 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorld.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorld.cs @@ -5,7 +5,7 @@ #endregion using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests.Samples +namespace Azure.ResourceManager.Tests.Samples { class Sample1_HelloWorld { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorldAsync.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorldAsync.cs index 9cd7d0ab678e..a012fc1332a1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorldAsync.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample1_HelloWorldAsync.cs @@ -6,7 +6,7 @@ #endregion using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests.Samples +namespace Azure.ResourceManager.Tests.Samples { class Sample1_HelloWorldAsync { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample2_ManagingResourceGroups.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample2_ManagingResourceGroups.cs index ebb071ad465a..db5c7646c358 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample2_ManagingResourceGroups.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample2_ManagingResourceGroups.cs @@ -7,7 +7,7 @@ #endregion using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests.Samples +namespace Azure.ResourceManager.Tests.Samples { class Sample2_ManagingResourceGroups { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample3_CreatingAVirtualNetwork.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample3_CreatingAVirtualNetwork.cs index 6e4ce991b899..93c363e8f08d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample3_CreatingAVirtualNetwork.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/Sample3_CreatingAVirtualNetwork.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests.Samples +namespace Azure.ResourceManager.Tests.Samples { class Sample3_CreatingAVirtualNetwork { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmBuilderTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmBuilderTests.cs index 4ea97cfbe4b8..e64193d13784 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmBuilderTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmBuilderTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ArmBuilderTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmClientTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmClientTests.cs index 25294d24dac3..1a70af56f0c3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmClientTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ArmClientTests.cs @@ -5,7 +5,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { class ArmClientTests : ResourceManagerTestBase { @@ -47,10 +47,10 @@ public void GetGenericOperationsTests() { var ids = new List() { - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1/", - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-2/", - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-3/", - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-4/" + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1", + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-2", + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-3", + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-4" }; var genericResourceOperationsList = Client.GetGenericResourceOperations(ids); @@ -76,13 +76,13 @@ public void GetGenericOperationsTests() public void GetGenericResourcesOperationsTests() { string id = $"/providers/Microsoft.Compute/virtualMachines/myVm"; - Assert.AreEqual(id, Client.GetGenericResourceOperations(new TenantResourceIdentifier(id)).Id.StringValue); + Assert.AreEqual(id, Client.GetGenericResourceOperations(new ResourceIdentifier(id)).Id.StringValue); } [TestCase] public void GetGenericResourceOperationsSingleIDTests() { - string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1/"; + string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1"; Assert.AreEqual(id, Client.GetGenericResourceOperations(id).Id.StringValue); } @@ -90,7 +90,7 @@ public void GetGenericResourceOperationsSingleIDTests() [RecordedTest] public async Task GetGenericResourceOperationsWithSingleValidResource() { - string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}/"; + string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}"; var genericResourceOperations = Client.GetGenericResourceOperations(id); var genericResource = await genericResourceOperations.GetAsync(); Assert.AreEqual(200, genericResource.GetRawResponse().Status); @@ -100,7 +100,7 @@ public async Task GetGenericResourceOperationsWithSingleValidResource() [RecordedTest] public void GetGenericResourceOperationsWithSingleInvalidResource() { - string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1/"; + string id = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1"; var genericResourceOperations = Client.GetGenericResourceOperations(id); RequestFailedException exception = Assert.ThrowsAsync(async () => await genericResourceOperations.GetAsync()); Assert.AreEqual(404, exception.Status); @@ -112,7 +112,7 @@ public async Task GetGenericOperationsWithListOfValidResource() { var ids = new List() { - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}/" + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/{_rgName}" }; var genericResourceOperationsList = Client.GetGenericResourceOperations(ids); @@ -130,7 +130,7 @@ public void GetGenericOperationsWithListOfInvalidResource() { var ids = new List() { - $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/non-existent/" + $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/non-existent" }; var genericResourceOperationsList = Client.GetGenericResourceOperations(ids); diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ClientContextTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ClientContextTests.cs index 2080b0e382ee..8770e6128e2c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ClientContextTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ClientContextTests.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Azure.ResourceManager.Resources.Models; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ClientContextTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ContainerTryGetTest.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ContainerTryGetTest.cs index 9b16cca8121a..710a50fbd3db 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ContainerTryGetTest.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ContainerTryGetTest.cs @@ -7,7 +7,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ContainerTryGetTest : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureContainerTests.cs index ff09c5258f4c..d2a5e5a6c966 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureContainerTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class FeatureContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureOperationsTests.cs index b72b1213c7d8..235476c424a1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/FeatureOperationsTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class FeatureOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceContainerTests.cs index 9b5c9ccc4ba5..8fccbf7856c8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceContainerTests.cs @@ -5,7 +5,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class GenericResourceContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceExpandedOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceExpandedOperationsTests.cs index dcf05658a3d4..8c9ea22119eb 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceExpandedOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceExpandedOperationsTests.cs @@ -7,7 +7,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class GenericResourceExpandedOperationsTests : ResourceManagerTestBase diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceOperationsTests.cs index c90f22d29b9e..11ddc717e284 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/GenericResourceOperationsTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class GenericResourceOperationsTests : ResourceManagerTestBase diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/HttpPipelineTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/HttpPipelineTests.cs index c2e0d7e7f475..41f846ea3b5a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/HttpPipelineTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/HttpPipelineTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class HttpPipelineTests : ResourceManagerTestBase diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/LocationExpandedTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/LocationExpandedTests.cs index 1121452b5562..a5d3427e100c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/LocationExpandedTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/LocationExpandedTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class LocationExpandedTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupContainerTests.cs index eab2d2725bbe..d2748e41dafe 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupContainerTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Management.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ManagementGroupContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupOperationsTests.cs index 30418054c694..1e6768abc4b6 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ManagementGroupOperationsTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Management.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ManagementGroupOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagContainerTests.cs index 8b81458d31a1..35fe08b9a7bd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagContainerTests.cs @@ -9,7 +9,7 @@ using Azure.Core.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class PredefinedTagContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagOperationsTests.cs index aa586c62fbdd..70af6f8d7334 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/PreDefinedTagOperationsTests.cs @@ -7,7 +7,7 @@ using Azure.Core.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class PredefinedTagOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderContainerTests.cs index cda3b3e36507..c4f388cfc04f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderContainerTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ProviderContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderOperationsTests.cs index 80b79498e5e8..49e883678a91 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ProviderOperationsTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ProviderOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupBuilderTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupBuilderTests.cs index 0b5d4902de76..907310c6dd10 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupBuilderTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupBuilderTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceGroupBuilderTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupContainerTests.cs index f9f4407d1dfd..12ee980f0918 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupContainerTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceGroupContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupOperationsTests.cs index f2a2da30dcdf..18223e7140c9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceGroupOperationsTests.cs @@ -9,7 +9,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceGroupOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceListOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceListOperationsTests.cs index 79d3639557b9..cbcfa12a6501 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceListOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceListOperationsTests.cs @@ -1,10 +1,11 @@ using System.Threading.Tasks; using Azure.Core.TestFramework; +using Azure.ResourceManager.Core; using Azure.ResourceManager.Resources; using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceListOperationsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestBase.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestBase.cs index ba41533d1577..ccdd39f9db0b 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestBase.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestBase.cs @@ -10,7 +10,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceManagerTestBase : ManagementRecordedTestBase { @@ -45,7 +45,7 @@ protected static GenericResourceData ConstructGenericAvailabilitySet() return data; } - protected async Task CreateGenericAvailabilitySetAsync(ResourceGroupResourceIdentifier rgId) + protected async Task CreateGenericAvailabilitySetAsync(ResourceIdentifier rgId) { var genericResources = Client.DefaultSubscription.GetGenericResources(); GenericResourceData data = ConstructGenericAvailabilitySet(); @@ -53,7 +53,7 @@ protected async Task CreateGenericAvailabilitySetAsync(Resource return await genericResources.CreateOrUpdateAsync(asetId, data); } - protected async Task StartCreateGenericAvailabilitySetAsync(ResourceGroupResourceIdentifier rgId) + protected async Task StartCreateGenericAvailabilitySetAsync(ResourceIdentifier rgId) { var genericResources = Client.DefaultSubscription.GetGenericResources(); GenericResourceData data = ConstructGenericAvailabilitySet(); diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestEnvironment.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestEnvironment.cs index 8d17b1bc0618..2a4561957467 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestEnvironment.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResourceManagerTestEnvironment.cs @@ -3,7 +3,7 @@ using Azure.Core.TestFramework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResourceManagerTestEnvironment : TestEnvironment { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResponseExtensionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResponseExtensionsTests.cs index 5cd4d894f69c..33a8033ce4c7 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResponseExtensionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ResponseExtensionsTests.cs @@ -1,11 +1,11 @@ using System; -using System.Net.Http; using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; +using Azure.ResourceManager.Core; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ResponseExtensionsTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/RestApiContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/RestApiContainerTests.cs index 737cb6a89bf8..5855a201d805 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/RestApiContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/RestApiContainerTests.cs @@ -2,7 +2,7 @@ using Azure.Core.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class RestApiContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionContainerTests.cs index bc00c9525de0..567cc3e94137 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionContainerTests.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class SubscriptionContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionOperationsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionOperationsTests.cs index d3aeafc1d3f0..355304ba3c34 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionOperationsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/SubscriptionOperationsTests.cs @@ -10,7 +10,7 @@ using Azure.ResourceManager.Resources; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class SubscriptionOperationsTests : ResourceManagerTestBase diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TaggableResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TaggableResourceTests.cs index c3c07fb03fdf..9263807a1d63 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TaggableResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TaggableResourceTests.cs @@ -9,7 +9,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class TaggableResourceTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TenantContainerTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TenantContainerTests.cs index ae19a5767ed6..ae9e1d670211 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TenantContainerTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/TenantContainerTests.cs @@ -2,7 +2,7 @@ using Azure.Core.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class TenantContainerTests : ResourceManagerTestBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json index 9610dd3513f3..aaeccd000a95 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(False).json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5a471502cc785e70e671623a1a452721", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:20:44 GMT", + "Date": "Mon, 26 Jul 2021 00:51:21 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f9272029-351f-46ee-a702-537a55be49db", + "x-ms-correlation-request-id": "f0beb302-2651-49a3-ba29-87a613dc9ed5", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-request-id": "f9272029-351f-46ee-a702-537a55be49db", - "x-ms-routing-request-id": "WESTUS2:20210721T172045Z:f9272029-351f-46ee-a702-537a55be49db" + "x-ms-request-id": "f0beb302-2651-49a3-ba29-87a613dc9ed5", + "x-ms-routing-request-id": "WESTUS2:20210726T005122Z:f0beb302-2651-49a3-ba29-87a613dc9ed5" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-1b5ab7d024a528459e4a94fbafcb3667-4be2c04fa41c6444-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-1a60b64fb044b64f898bd4e824cf1094-11d0c50638249749-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "7f043350e1a08916b2e6d331bf887312", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:20:44 GMT", + "Date": "Mon, 26 Jul 2021 00:51:21 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3cde28eb-27b0-472f-b7a4-cd2678bf445c", + "x-ms-correlation-request-id": "0618f624-96ef-412a-aea9-de151078dcda", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "3cde28eb-27b0-472f-b7a4-cd2678bf445c", - "x-ms-routing-request-id": "WESTUS2:20210721T172045Z:3cde28eb-27b0-472f-b7a4-cd2678bf445c" + "x-ms-request-id": "0618f624-96ef-412a-aea9-de151078dcda", + "x-ms-routing-request-id": "WESTUS2:20210726T005122Z:0618f624-96ef-412a-aea9-de151078dcda" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -99,7 +99,7 @@ "Authorization": "Sanitized", "Content-Length": "39", "Content-Type": "application/json", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "1de8ca6ff16afc375aa8a238b9711bfb", "x-ms-return-client-request-id": "true" }, @@ -107,20 +107,20 @@ "location": "southcentralus", "tags": {} }, - "StatusCode": 200, + "StatusCode": 201, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:20:45 GMT", + "Date": "Mon, 26 Jul 2021 00:51:22 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "45da4f43-e972-4a16-ba15-e0b742bc1ca8", + "x-ms-correlation-request-id": "3c344ed0-5554-450b-8661-160ebba143e1", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "45da4f43-e972-4a16-ba15-e0b742bc1ca8", - "x-ms-routing-request-id": "WESTUS2:20210721T172046Z:45da4f43-e972-4a16-ba15-e0b742bc1ca8" + "x-ms-request-id": "3c344ed0-5554-450b-8661-160ebba143e1", + "x-ms-routing-request-id": "WESTUS2:20210726T005123Z:3c344ed0-5554-450b-8661-160ebba143e1" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json index 2257bdc57272..97eb237dbb08 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/ArmClientTests(True)Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5a471502cc785e70e671623a1a452721", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:21:28 GMT", + "Date": "Mon, 26 Jul 2021 00:52:11 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ccf1ac23-43a7-4e7f-98a5-a41a2190ef06", + "x-ms-correlation-request-id": "43eefd1e-8984-4b59-9822-a6dbbb27726e", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-request-id": "ccf1ac23-43a7-4e7f-98a5-a41a2190ef06", - "x-ms-routing-request-id": "WESTUS2:20210721T172128Z:ccf1ac23-43a7-4e7f-98a5-a41a2190ef06" + "x-ms-request-id": "43eefd1e-8984-4b59-9822-a6dbbb27726e", + "x-ms-routing-request-id": "WESTUS2:20210726T005212Z:43eefd1e-8984-4b59-9822-a6dbbb27726e" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-c74be2f53a55104c9de58414bbcf1582-3d8bd8227c2b714b-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-68d537d3d2a0224dafda3fff51cd0033-74c149852f1b2540-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "7f043350e1a08916b2e6d331bf887312", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:21:28 GMT", + "Date": "Mon, 26 Jul 2021 00:52:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "077fe9e6-9893-479b-b873-a052ba4f69f8", + "x-ms-correlation-request-id": "d6ef7d03-7423-4425-b048-d04770ded39e", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-request-id": "077fe9e6-9893-479b-b873-a052ba4f69f8", - "x-ms-routing-request-id": "WESTUS2:20210721T172128Z:077fe9e6-9893-479b-b873-a052ba4f69f8" + "x-ms-request-id": "d6ef7d03-7423-4425-b048-d04770ded39e", + "x-ms-routing-request-id": "WESTUS2:20210726T005213Z:d6ef7d03-7423-4425-b048-d04770ded39e" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -99,7 +99,7 @@ "Authorization": "Sanitized", "Content-Length": "39", "Content-Type": "application/json", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "1de8ca6ff16afc375aa8a238b9711bfb", "x-ms-return-client-request-id": "true" }, @@ -112,15 +112,15 @@ "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:21:29 GMT", + "Date": "Mon, 26 Jul 2021 00:52:12 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0c0a2c2a-e27e-47f0-bd3e-48dfb6f2239a", + "x-ms-correlation-request-id": "e1e75226-3bb7-4872-ba30-934b73b235fc", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-request-id": "0c0a2c2a-e27e-47f0-bd3e-48dfb6f2239a", - "x-ms-routing-request-id": "WESTUS2:20210721T172129Z:0c0a2c2a-e27e-47f0-bd3e-48dfb6f2239a" + "x-ms-request-id": "e1e75226-3bb7-4872-ba30-934b73b235fc", + "x-ms-routing-request-id": "WESTUS2:20210726T005213Z:e1e75226-3bb7-4872-ba30-934b73b235fc" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests().json index 2e10ce134bb8..a786d285df13 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "0eb3d93b133c8a58c719ba989fc8bd8f", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:20:46 GMT", + "Date": "Mon, 26 Jul 2021 00:51:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "90748175-a256-4b59-935e-0ef942fefe0d", + "x-ms-correlation-request-id": "5ad972a0-8e1e-42cd-a398-00dcee11161b", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-request-id": "90748175-a256-4b59-935e-0ef942fefe0d", - "x-ms-routing-request-id": "WESTUS2:20210721T172046Z:90748175-a256-4b59-935e-0ef942fefe0d" + "x-ms-request-id": "5ad972a0-8e1e-42cd-a398-00dcee11161b", + "x-ms-routing-request-id": "WESTUS2:20210726T005124Z:5ad972a0-8e1e-42cd-a398-00dcee11161b" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests()Async.json index e8c9f2b72a95..a559e59f32c4 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsTests()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210721.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "ed82218f3b5be08677d154bfc82678b3", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Wed, 21 Jul 2021 17:21:29 GMT", + "Date": "Mon, 26 Jul 2021 00:52:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d81dddf3-220e-4a5c-b4d5-afd2e3dfcb9f", + "x-ms-correlation-request-id": "2638b79c-d15e-4bf4-ac9e-acb7fa9a8158", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-request-id": "d81dddf3-220e-4a5c-b4d5-afd2e3dfcb9f", - "x-ms-routing-request-id": "WESTUS2:20210721T172129Z:d81dddf3-220e-4a5c-b4d5-afd2e3dfcb9f" + "x-ms-request-id": "2638b79c-d15e-4bf4-ac9e-acb7fa9a8158", + "x-ms-routing-request-id": "WESTUS2:20210726T005214Z:2638b79c-d15e-4bf4-ac9e-acb7fa9a8158" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource().json index 7529bfe0d5e5..c59059f45345 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "fff178d6ed5866066762532553bb0b30", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5b92bed7-33e2-4e73-b32e-6f4406729206", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-request-id": "5b92bed7-33e2-4e73-b32e-6f4406729206", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:5b92bed7-33e2-4e73-b32e-6f4406729206" + "x-ms-correlation-request-id": "672ab986-9041-4dd8-8a75-5cdbe6496844", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "672ab986-9041-4dd8-8a75-5cdbe6496844", + "x-ms-routing-request-id": "WESTUS2:20210726T005124Z:672ab986-9041-4dd8-8a75-5cdbe6496844" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,7 +51,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5f5613df99ea89dbe0435f022d33f1a9", "x-ms-return-client-request-id": "true" }, @@ -61,15 +61,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "4ced1e2c-0e34-4f1b-97c2-51eaa1ab72f9", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-request-id": "4ced1e2c-0e34-4f1b-97c2-51eaa1ab72f9", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:4ced1e2c-0e34-4f1b-97c2-51eaa1ab72f9" + "x-ms-correlation-request-id": "cdccb27c-699f-4d4a-bc18-ec8da7993f51", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "cdccb27c-699f-4d4a-bc18-ec8da7993f51", + "x-ms-routing-request-id": "WESTUS2:20210726T005124Z:cdccb27c-699f-4d4a-bc18-ec8da7993f51" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1238,12 +1238,12 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/non-existent/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/non-existent?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "681d18f8bcf8700deb324820f46c97ef", "x-ms-return-client-request-id": "true" }, @@ -1253,16 +1253,16 @@ "Cache-Control": "no-cache", "Content-Length": "104", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:23 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5514714b-26c3-4a89-8d8b-a63479f8beb6", + "x-ms-correlation-request-id": "fcfba24d-6ed3-499c-b37f-d2878d102ee0", "x-ms-failure-cause": "gateway", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-request-id": "5514714b-26c3-4a89-8d8b-a63479f8beb6", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:5514714b-26c3-4a89-8d8b-a63479f8beb6" + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-request-id": "fcfba24d-6ed3-499c-b37f-d2878d102ee0", + "x-ms-routing-request-id": "WESTUS2:20210726T005124Z:fcfba24d-6ed3-499c-b37f-d2878d102ee0" }, "ResponseBody": { "error": { @@ -1274,6 +1274,7 @@ ], "Variables": { "RandomSeed": "1176186604", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource()Async.json index 0d229901437a..6702718d8424 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfInvalidResource()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "fff178d6ed5866066762532553bb0b30", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3b872fbe-b460-4b19-b00a-a95c1f99812f", - "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-request-id": "3b872fbe-b460-4b19-b00a-a95c1f99812f", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:3b872fbe-b460-4b19-b00a-a95c1f99812f" + "x-ms-correlation-request-id": "d80a5ee7-80bc-4d11-9556-621f581f8ff8", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "d80a5ee7-80bc-4d11-9556-621f581f8ff8", + "x-ms-routing-request-id": "WESTUS2:20210726T005214Z:d80a5ee7-80bc-4d11-9556-621f581f8ff8" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,7 +51,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5f5613df99ea89dbe0435f022d33f1a9", "x-ms-return-client-request-id": "true" }, @@ -61,15 +61,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6bb7a1f7-1762-4f4d-b136-ee55e7bc41a4", - "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-request-id": "6bb7a1f7-1762-4f4d-b136-ee55e7bc41a4", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:6bb7a1f7-1762-4f4d-b136-ee55e7bc41a4" + "x-ms-correlation-request-id": "e4f35ac5-c09b-4882-a8bd-fd79a2515177", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "e4f35ac5-c09b-4882-a8bd-fd79a2515177", + "x-ms-routing-request-id": "WESTUS2:20210726T005214Z:e4f35ac5-c09b-4882-a8bd-fd79a2515177" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1238,12 +1238,12 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/non-existent/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/non-existent?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "681d18f8bcf8700deb324820f46c97ef", "x-ms-return-client-request-id": "true" }, @@ -1253,16 +1253,16 @@ "Cache-Control": "no-cache", "Content-Length": "104", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:13 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "79e5876c-7d67-4d5a-93d7-7c9752360ff0", + "x-ms-correlation-request-id": "e73f426d-08fa-4b47-a4d9-9887e28ecaf4", "x-ms-failure-cause": "gateway", - "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-request-id": "79e5876c-7d67-4d5a-93d7-7c9752360ff0", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:79e5876c-7d67-4d5a-93d7-7c9752360ff0" + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-request-id": "e73f426d-08fa-4b47-a4d9-9887e28ecaf4", + "x-ms-routing-request-id": "WESTUS2:20210726T005214Z:e73f426d-08fa-4b47-a4d9-9887e28ecaf4" }, "ResponseBody": { "error": { @@ -1274,6 +1274,7 @@ ], "Variables": { "RandomSeed": "1176186604", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource().json index c53f03f5d766..facaab7131df 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "03b22673cd589bc632da34fa8ebeecdd", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "353ebe69-3fd5-4e3d-99f7-5f0089aee530", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-request-id": "353ebe69-3fd5-4e3d-99f7-5f0089aee530", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:353ebe69-3fd5-4e3d-99f7-5f0089aee530" + "x-ms-correlation-request-id": "4d120567-f1bf-4132-9326-dfc3377fb8a8", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-request-id": "4d120567-f1bf-4132-9326-dfc3377fb8a8", + "x-ms-routing-request-id": "WESTUS2:20210726T005124Z:4d120567-f1bf-4132-9326-dfc3377fb8a8" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,7 +51,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "ba05ff9db8c329941c97cb3cfbd3cba6", "x-ms-return-client-request-id": "true" }, @@ -61,15 +61,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "34978ea1-373b-42c8-870d-720895d067a2", - "x-ms-ratelimit-remaining-subscription-reads": "11984", - "x-ms-request-id": "34978ea1-373b-42c8-870d-720895d067a2", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:34978ea1-373b-42c8-870d-720895d067a2" + "x-ms-correlation-request-id": "39bac991-4e6d-41ac-8864-2828121b5f32", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-request-id": "39bac991-4e6d-41ac-8864-2828121b5f32", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:39bac991-4e6d-41ac-8864-2828121b5f32" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1238,12 +1238,12 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "b060e2a71de0d9a31829b05fa7214486", "x-ms-return-client-request-id": "true" }, @@ -1253,15 +1253,15 @@ "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:56 GMT", + "Date": "Mon, 26 Jul 2021 00:51:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f2422f6b-dfe3-4786-818c-e316b909652d", - "x-ms-ratelimit-remaining-subscription-reads": "11983", - "x-ms-request-id": "f2422f6b-dfe3-4786-818c-e316b909652d", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:f2422f6b-dfe3-4786-818c-e316b909652d" + "x-ms-correlation-request-id": "bf299d14-9fca-45e2-8877-1fb918789f8a", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-request-id": "bf299d14-9fca-45e2-8877-1fb918789f8a", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:bf299d14-9fca-45e2-8877-1fb918789f8a" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", @@ -1277,6 +1277,7 @@ ], "Variables": { "RandomSeed": "129329977", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource()Async.json index cb2e1be10c6c..5025ea16ca9e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericOperationsWithListOfValidResource()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "15cd3fd2bc0730150f9cc5c030808029", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "638e82ad-5877-4942-9e37-ff30a70a93a9", - "x-ms-ratelimit-remaining-subscription-reads": "11982", - "x-ms-request-id": "638e82ad-5877-4942-9e37-ff30a70a93a9", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:638e82ad-5877-4942-9e37-ff30a70a93a9" + "x-ms-correlation-request-id": "01bbfec1-d518-4fe5-ab05-d2afeff13571", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-request-id": "01bbfec1-d518-4fe5-ab05-d2afeff13571", + "x-ms-routing-request-id": "WESTUS2:20210726T005214Z:01bbfec1-d518-4fe5-ab05-d2afeff13571" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,7 +51,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "bc343c692f023928889ec6859a769849", "x-ms-return-client-request-id": "true" }, @@ -61,15 +61,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "198c4644-148c-40b5-9b41-973314350c44", - "x-ms-ratelimit-remaining-subscription-reads": "11981", - "x-ms-request-id": "198c4644-148c-40b5-9b41-973314350c44", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:198c4644-148c-40b5-9b41-973314350c44" + "x-ms-correlation-request-id": "7d840986-2e0d-4d3a-bc3a-876e9d3d47e2", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-request-id": "7d840986-2e0d-4d3a-bc3a-876e9d3d47e2", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:7d840986-2e0d-4d3a-bc3a-876e9d3d47e2" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1238,12 +1238,12 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "94377ed6ad3d8024b8e3d077bdc8cea6", "x-ms-return-client-request-id": "true" }, @@ -1253,15 +1253,15 @@ "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "60ee22aa-ec11-4814-b8c8-58b304e19da4", - "x-ms-ratelimit-remaining-subscription-reads": "11980", - "x-ms-request-id": "60ee22aa-ec11-4814-b8c8-58b304e19da4", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:60ee22aa-ec11-4814-b8c8-58b304e19da4" + "x-ms-correlation-request-id": "e06a7728-ca42-469c-83b0-d96ca04e9bba", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-request-id": "e06a7728-ca42-469c-83b0-d96ca04e9bba", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:e06a7728-ca42-469c-83b0-d96ca04e9bba" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", @@ -1277,6 +1277,7 @@ ], "Variables": { "RandomSeed": "248817585", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest().json index 02034c6b9ec7..83ee628336fb 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "8f53a9e517d6796610db2498ee0aa671", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "efddfe67-7f0f-4d90-91e9-f5806a52e2fc", - "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-request-id": "efddfe67-7f0f-4d90-91e9-f5806a52e2fc", - "x-ms-routing-request-id": "WESTUS2:20210712T224257Z:efddfe67-7f0f-4d90-91e9-f5806a52e2fc" + "x-ms-correlation-request-id": "3f5e1d57-3c30-45a4-bc49-9efbe150e7cd", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-request-id": "3f5e1d57-3c30-45a4-bc49-9efbe150e7cd", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:3f5e1d57-3c30-45a4-bc49-9efbe150e7cd" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "1005163647", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest()Async.json index 0a212fbe6362..5e5b30bfba30 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationEmptyTest()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "4a2c43a9d7fdc394e066c1f2f03f3a9d", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3b2dbcd5-ca38-413a-98b2-7eb9a4cf9d6e", - "x-ms-ratelimit-remaining-subscription-reads": "11978", - "x-ms-request-id": "3b2dbcd5-ca38-413a-98b2-7eb9a4cf9d6e", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:3b2dbcd5-ca38-413a-98b2-7eb9a4cf9d6e" + "x-ms-correlation-request-id": "80477068-b9ed-49f7-9520-c9c69c8fe0d8", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-request-id": "80477068-b9ed-49f7-9520-c9c69c8fe0d8", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:80477068-b9ed-49f7-9520-c9c69c8fe0d8" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "54454898", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId().json index d072c1e1be53..6eaedb5d9ffa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId().json @@ -6,8 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "Request-Id": "|28442b5d-458bac2aad6b6e44.", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5b36cce4d8b6440da9769a1e4abf1f94", "x-ms-return-client-request-id": "true" }, @@ -17,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "f4ffa98b-1356-4dff-b37e-54aa255b5341", - "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-request-id": "f4ffa98b-1356-4dff-b37e-54aa255b5341", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:f4ffa98b-1356-4dff-b37e-54aa255b5341" + "x-ms-correlation-request-id": "2c377865-4f14-4ef4-8d29-7dd4abe13da2", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-request-id": "2c377865-4f14-4ef4-8d29-7dd4abe13da2", + "x-ms-routing-request-id": "WESTUS2:20210726T005126Z:2c377865-4f14-4ef4-8d29-7dd4abe13da2" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -49,6 +48,7 @@ ], "Variables": { "RandomSeed": "293300777", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId()Async.json index 78993964e50d..d997af2be39f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullId()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "d1fb875a5285579edf3d1821cd46642f", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:59 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "fe5ef188-b2fc-4ab6-9f14-f078075ccd2d", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-request-id": "fe5ef188-b2fc-4ab6-9f14-f078075ccd2d", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:fe5ef188-b2fc-4ab6-9f14-f078075ccd2d" + "x-ms-correlation-request-id": "6b5d932d-3405-4ba0-b4e2-926fa877d160", + "x-ms-ratelimit-remaining-subscription-reads": "11981", + "x-ms-request-id": "6b5d932d-3405-4ba0-b4e2-926fa877d160", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:6b5d932d-3405-4ba0-b4e2-926fa877d160" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "2096503466", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds().json index 2c075be06dc2..e4a6bdd937e2 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds().json @@ -6,8 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-d05e070b8fa30e4aa323926bda8921f3-38783948d99ed244-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "5df048b56051266ed016766021651ef4", "x-ms-return-client-request-id": "true" }, @@ -17,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5e953f4c-7c60-419b-b8f7-fd31c43093ab", - "x-ms-ratelimit-remaining-subscription-reads": "11967", - "x-ms-request-id": "5e953f4c-7c60-419b-b8f7-fd31c43093ab", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:5e953f4c-7c60-419b-b8f7-fd31c43093ab" + "x-ms-correlation-request-id": "8562276d-4539-447a-9faa-32bb7f0264bc", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-request-id": "8562276d-4539-447a-9faa-32bb7f0264bc", + "x-ms-routing-request-id": "WESTUS2:20210726T005126Z:8562276d-4539-447a-9faa-32bb7f0264bc" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -49,6 +48,7 @@ ], "Variables": { "RandomSeed": "1356406201", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds()Async.json index 908950a019ca..8753b5f172ae 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationWithNullSetOfIds()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "b1724a7f043f8f2db6a68e89e04c1eb4", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:59 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8b18c609-f83d-45d1-a8e5-8bb4212ac8c2", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-request-id": "8b18c609-f83d-45d1-a8e5-8bb4212ac8c2", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:8b18c609-f83d-45d1-a8e5-8bb4212ac8c2" + "x-ms-correlation-request-id": "ebfe9ac9-9fb3-4ce8-b7f5-7f8fc21f7cb0", + "x-ms-ratelimit-remaining-subscription-reads": "11980", + "x-ms-request-id": "ebfe9ac9-9fb3-4ce8-b7f5-7f8fc21f7cb0", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:ebfe9ac9-9fb3-4ce8-b7f5-7f8fc21f7cb0" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "1363497134", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests().json index bb4d36c716fe..527062c016dd 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "60080ba5a2ac8da3888d338db503af96", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:24 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "aebb8343-c22a-4fe5-9054-b7fcd44e4e9f", - "x-ms-ratelimit-remaining-subscription-reads": "11979", - "x-ms-request-id": "aebb8343-c22a-4fe5-9054-b7fcd44e4e9f", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:aebb8343-c22a-4fe5-9054-b7fcd44e4e9f" + "x-ms-correlation-request-id": "fe98ad84-d083-48bc-8935-0876f7b04395", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-request-id": "fe98ad84-d083-48bc-8935-0876f7b04395", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:fe98ad84-d083-48bc-8935-0876f7b04395" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "1274569526", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests()Async.json index d86d34b07c7e..db7b8e35309e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsSingleIDTests()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "2aa907ce87b7fb24b7c3375bf544f422", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "b026a222-86bd-4181-bbe9-2bbf7752ec88", - "x-ms-ratelimit-remaining-subscription-reads": "11974", - "x-ms-request-id": "b026a222-86bd-4181-bbe9-2bbf7752ec88", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:b026a222-86bd-4181-bbe9-2bbf7752ec88" + "x-ms-correlation-request-id": "5f238c9b-140d-4e58-be63-701b478bd122", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-request-id": "5f238c9b-140d-4e58-be63-701b478bd122", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:5f238c9b-140d-4e58-be63-701b478bd122" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "1468932213", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource().json index 8eb81ad03bac..ba1f73ca8a74 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "8452f61dcff28bd37c929efad100d5bf", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d636e562-20ea-4576-8f34-0991bd5f156f", - "x-ms-ratelimit-remaining-subscription-reads": "11977", - "x-ms-request-id": "d636e562-20ea-4576-8f34-0991bd5f156f", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:d636e562-20ea-4576-8f34-0991bd5f156f" + "x-ms-correlation-request-id": "149095a3-41ff-4d7a-93ae-0a4779cb384c", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "149095a3-41ff-4d7a-93ae-0a4779cb384c", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:149095a3-41ff-4d7a-93ae-0a4779cb384c" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-5624af30485098479ad1bcf0932fb3dd-8a5301637723054e-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-82742884b6638d45bc5da695bf7bce97-533b27271e871f47-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "cd5989a57a2d5d59af0831da884c949a", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "69dc64f0-06ad-47e8-b483-9b88fd55c87c", - "x-ms-ratelimit-remaining-subscription-reads": "11976", - "x-ms-request-id": "69dc64f0-06ad-47e8-b483-9b88fd55c87c", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:69dc64f0-06ad-47e8-b483-9b88fd55c87c" + "x-ms-correlation-request-id": "41a39120-cb37-464c-ab43-a78abb535de9", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-request-id": "41a39120-cb37-464c-ab43-a78abb535de9", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:41a39120-cb37-464c-ab43-a78abb535de9" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1239,13 +1239,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/foo-1/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/foo-1?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-5624af30485098479ad1bcf0932fb3dd-8f52a6749fc0b846-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-82742884b6638d45bc5da695bf7bce97-bef6603a9a5b4e4e-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "256cf19cc1d06814db6a73585db96cf0", "x-ms-return-client-request-id": "true" }, @@ -1255,16 +1255,16 @@ "Cache-Control": "no-cache", "Content-Length": "97", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "77012f7f-3182-44d7-b674-e2dff3b4a2a2", + "x-ms-correlation-request-id": "8bc224a7-9458-4068-9f74-163683b4bda2", "x-ms-failure-cause": "gateway", - "x-ms-ratelimit-remaining-subscription-reads": "11975", - "x-ms-request-id": "77012f7f-3182-44d7-b674-e2dff3b4a2a2", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:77012f7f-3182-44d7-b674-e2dff3b4a2a2" + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-request-id": "8bc224a7-9458-4068-9f74-163683b4bda2", + "x-ms-routing-request-id": "WESTUS2:20210726T005125Z:8bc224a7-9458-4068-9f74-163683b4bda2" }, "ResponseBody": { "error": { @@ -1276,6 +1276,7 @@ ], "Variables": { "RandomSeed": "960719231", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource()Async.json index f9232979f5a1..65dae9ab1137 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleInvalidResource()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "d9d4f9e773e1f4926221b6248fe6d67f", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ffc5cbd6-b8b8-4e08-8617-b71936424887", - "x-ms-ratelimit-remaining-subscription-reads": "11970", - "x-ms-request-id": "ffc5cbd6-b8b8-4e08-8617-b71936424887", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:ffc5cbd6-b8b8-4e08-8617-b71936424887" + "x-ms-correlation-request-id": "51c0fbd5-6c51-44ff-a757-f6efa4a424b5", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "51c0fbd5-6c51-44ff-a757-f6efa4a424b5", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:51c0fbd5-6c51-44ff-a757-f6efa4a424b5" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-9959ee9bc28d2b4f81f96c7e09543236-3754f11e0ac67e4e-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-b868274196e00b40b8d91c5fe3deab86-aeb870211f96c74e-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "50b76f28d619e604b6f1153554fe8161", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d36c9405-6ab4-4670-b556-f3f75348777b", - "x-ms-ratelimit-remaining-subscription-reads": "11969", - "x-ms-request-id": "d36c9405-6ab4-4670-b556-f3f75348777b", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:d36c9405-6ab4-4670-b556-f3f75348777b" + "x-ms-correlation-request-id": "6873301b-2bb1-4a17-b04f-f6bbf30a0ef7", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-request-id": "6873301b-2bb1-4a17-b04f-f6bbf30a0ef7", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:6873301b-2bb1-4a17-b04f-f6bbf30a0ef7" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1239,13 +1239,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/foo-1/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/foo-1?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-9959ee9bc28d2b4f81f96c7e09543236-b9397240ef97ff4f-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-b868274196e00b40b8d91c5fe3deab86-8ef2eff50eab2840-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "9ac66980cb80101e5fec3c01f035b843", "x-ms-return-client-request-id": "true" }, @@ -1255,16 +1255,16 @@ "Cache-Control": "no-cache", "Content-Length": "97", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:52:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7d06cb74-bb55-4592-9a1d-e67fd5df5033", + "x-ms-correlation-request-id": "0556aa43-27d0-4e85-b0f4-d9c7e91c4cf6", "x-ms-failure-cause": "gateway", - "x-ms-ratelimit-remaining-subscription-reads": "11968", - "x-ms-request-id": "7d06cb74-bb55-4592-9a1d-e67fd5df5033", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:7d06cb74-bb55-4592-9a1d-e67fd5df5033" + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-request-id": "0556aa43-27d0-4e85-b0f4-d9c7e91c4cf6", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:0556aa43-27d0-4e85-b0f4-d9c7e91c4cf6" }, "ResponseBody": { "error": { @@ -1276,6 +1276,7 @@ ], "Variables": { "RandomSeed": "967810164", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource().json index 8b307684b4b4..4bf68b1d9e3e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "abef9890c604fa01edaf32ba52b3ded4", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "3b5a09fd-2728-489c-b463-dd72481c26be", - "x-ms-ratelimit-remaining-subscription-reads": "11973", - "x-ms-request-id": "3b5a09fd-2728-489c-b463-dd72481c26be", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:3b5a09fd-2728-489c-b463-dd72481c26be" + "x-ms-correlation-request-id": "49d1c5a3-4cab-46b0-b271-6d8e10d78064", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-request-id": "49d1c5a3-4cab-46b0-b271-6d8e10d78064", + "x-ms-routing-request-id": "WESTUS2:20210726T005126Z:49d1c5a3-4cab-46b0-b271-6d8e10d78064" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-5aad46ada106e64ebf08932598ed32de-f2e1b5311dac7b4d-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-d58b1b4a6f55e94d860cb950ceb0de83-da863c52a09d9648-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "f22e9a4c4b34bdbb899aaf6bacfa7af3", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0327e8a4-d047-48a2-aa8c-d4c1a60b0813", - "x-ms-ratelimit-remaining-subscription-reads": "11972", - "x-ms-request-id": "0327e8a4-d047-48a2-aa8c-d4c1a60b0813", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:0327e8a4-d047-48a2-aa8c-d4c1a60b0813" + "x-ms-correlation-request-id": "fde161e5-470e-42b2-afc5-30a4df087173", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-request-id": "fde161e5-470e-42b2-afc5-30a4df087173", + "x-ms-routing-request-id": "WESTUS2:20210726T005126Z:fde161e5-470e-42b2-afc5-30a4df087173" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1239,13 +1239,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-5aad46ada106e64ebf08932598ed32de-b66ad23373a6d34f-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-d58b1b4a6f55e94d860cb950ceb0de83-33820b72179f6e4e-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "8de05a5389b3607407763250aa5af357", "x-ms-return-client-request-id": "true" }, @@ -1255,15 +1255,15 @@ "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:57 GMT", + "Date": "Mon, 26 Jul 2021 00:51:25 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "35fae6a8-6b44-4e30-84c7-e1155aaced66", - "x-ms-ratelimit-remaining-subscription-reads": "11971", - "x-ms-request-id": "35fae6a8-6b44-4e30-84c7-e1155aaced66", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:35fae6a8-6b44-4e30-84c7-e1155aaced66" + "x-ms-correlation-request-id": "84fbd74e-d0d6-44b4-a0b5-d241791b31d8", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-request-id": "84fbd74e-d0d6-44b4-a0b5-d241791b31d8", + "x-ms-routing-request-id": "WESTUS2:20210726T005126Z:84fbd74e-d0d6-44b4-a0b5-d241791b31d8" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", @@ -1279,6 +1279,7 @@ ], "Variables": { "RandomSeed": "1768768755", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource()Async.json index 36dacc4c8e29..d21501557932 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourceOperationsWithSingleValidResource()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "b951bc0c279a2c2239922c8cacec9003", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "164590e6-9812-4dab-9070-04f5d8bc104c", - "x-ms-ratelimit-remaining-subscription-reads": "11966", - "x-ms-request-id": "164590e6-9812-4dab-9070-04f5d8bc104c", - "x-ms-routing-request-id": "WESTUS2:20210712T224258Z:164590e6-9812-4dab-9070-04f5d8bc104c" + "x-ms-correlation-request-id": "b1609d57-8ec4-4bbb-b81e-ff9d74ab9aa5", + "x-ms-ratelimit-remaining-subscription-reads": "11984", + "x-ms-request-id": "b1609d57-8ec4-4bbb-b81e-ff9d74ab9aa5", + "x-ms-routing-request-id": "WESTUS2:20210726T005215Z:b1609d57-8ec4-4bbb-b81e-ff9d74ab9aa5" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -51,8 +51,8 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-eb265d014c895b489d2cb66312001d45-e0fd2f67d872bc49-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-3c4fa3301805864f8cf572e02b27a59d-082d9d63cbaa4d4f-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "395be66455874f1669c2f12b31a91758", "x-ms-return-client-request-id": "true" }, @@ -62,15 +62,15 @@ "Cache-Control": "no-cache", "Content-Length": "16481", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "8fc1fab0-373d-4d89-82e5-16195b3e3b14", - "x-ms-ratelimit-remaining-subscription-reads": "11965", - "x-ms-request-id": "8fc1fab0-373d-4d89-82e5-16195b3e3b14", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:8fc1fab0-373d-4d89-82e5-16195b3e3b14" + "x-ms-correlation-request-id": "4cfa120c-949d-4057-86a4-399fe2e1bb39", + "x-ms-ratelimit-remaining-subscription-reads": "11983", + "x-ms-request-id": "4cfa120c-949d-4057-86a4-399fe2e1bb39", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:4cfa120c-949d-4057-86a4-399fe2e1bb39" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Resources", @@ -1239,13 +1239,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828/?api-version=2019-05-01", + "RequestUri": "https://management.azure.com/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828?api-version=2019-05-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "traceparent": "00-eb265d014c895b489d2cb66312001d45-f7d6e50d73fa9549-00", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "traceparent": "00-3c4fa3301805864f8cf572e02b27a59d-4c548c2bc066754a-00", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "22e807d2e26ee2084a54a792c274842f", "x-ms-return-client-request-id": "true" }, @@ -1255,15 +1255,15 @@ "Cache-Control": "no-cache", "Content-Length": "237", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "57fe8a32-d064-41f5-a102-6a998da4028d", - "x-ms-ratelimit-remaining-subscription-reads": "11964", - "x-ms-request-id": "57fe8a32-d064-41f5-a102-6a998da4028d", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:57fe8a32-d064-41f5-a102-6a998da4028d" + "x-ms-correlation-request-id": "276d9527-3537-4780-aac7-9f23030f9ca6", + "x-ms-ratelimit-remaining-subscription-reads": "11982", + "x-ms-request-id": "276d9527-3537-4780-aac7-9f23030f9ca6", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:276d9527-3537-4780-aac7-9f23030f9ca6" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testRg-9828", @@ -1279,6 +1279,7 @@ ], "Variables": { "RandomSeed": "234803832", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests().json index 3dce94ec8002..e17233ff99d5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "9a3a1de13593d44a71c3d5f3bc5e683e", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:51:26 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "6fe382f2-b5c2-484a-b457-c5a034cf4fbf", - "x-ms-ratelimit-remaining-subscription-reads": "11963", - "x-ms-request-id": "6fe382f2-b5c2-484a-b457-c5a034cf4fbf", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:6fe382f2-b5c2-484a-b457-c5a034cf4fbf" + "x-ms-correlation-request-id": "af0508ac-777a-4264-abdd-4eb60cadb0fd", + "x-ms-ratelimit-remaining-subscription-reads": "11979", + "x-ms-request-id": "af0508ac-777a-4264-abdd-4eb60cadb0fd", + "x-ms-routing-request-id": "WESTUS2:20210726T005127Z:af0508ac-777a-4264-abdd-4eb60cadb0fd" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "1977607695", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests()Async.json index fab21927b195..3fef7a390a6a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/GetGenericResourcesOperationsTests()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "357170750c0ffc2170f3188efaa79fd8", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:59 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7096a24f-5421-4de5-b200-0e883caeca64", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-request-id": "7096a24f-5421-4de5-b200-0e883caeca64", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:7096a24f-5421-4de5-b200-0e883caeca64" + "x-ms-correlation-request-id": "d32bcae2-5fc1-4383-a866-00987d907ba1", + "x-ms-ratelimit-remaining-subscription-reads": "11979", + "x-ms-request-id": "d32bcae2-5fc1-4383-a866-00987d907ba1", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:d32bcae2-5fc1-4383-a866-00987d907ba1" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "880551783", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json index 8dc4f317d921..fb0061bf60a8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck().json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "33c69a93f85bebf3c5f940f97a9e731c", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:58 GMT", + "Date": "Mon, 26 Jul 2021 00:51:26 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "abb4a262-b536-4a0a-83ae-b907e0bf089f", - "x-ms-ratelimit-remaining-subscription-reads": "11962", - "x-ms-request-id": "abb4a262-b536-4a0a-83ae-b907e0bf089f", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:abb4a262-b536-4a0a-83ae-b907e0bf089f" + "x-ms-correlation-request-id": "b5e57b34-f3ff-4ab8-a550-cb0c9d57011d", + "x-ms-ratelimit-remaining-subscription-reads": "11978", + "x-ms-request-id": "b5e57b34-f3ff-4ab8-a550-cb0c9d57011d", + "x-ms-routing-request-id": "WESTUS2:20210726T005127Z:b5e57b34-f3ff-4ab8-a550-cb0c9d57011d" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "168997273", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json index dd058dd9a07e..9f48c6a60413 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/SessionRecords/ArmClientTests/TestArmClientParamCheck()Async.json @@ -6,7 +6,7 @@ "RequestHeaders": { "Accept": "application/json", "Authorization": "Sanitized", - "User-Agent": "azsdk-net-ResourceManager.Core/1.0.0-alpha.20210712.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", + "User-Agent": "azsdk-net-ResourceManager/1.0.0-alpha.20210725.1 (.NET Framework 4.8.4300.0; Microsoft Windows 10.0.19043 )", "x-ms-client-request-id": "053e3b04d40dba15c7a3dd5c371ad85e", "x-ms-return-client-request-id": "true" }, @@ -16,15 +16,15 @@ "Cache-Control": "no-cache", "Content-Length": "468", "Content-Type": "application/json; charset=utf-8", - "Date": "Mon, 12 Jul 2021 22:42:59 GMT", + "Date": "Mon, 26 Jul 2021 00:52:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1f922c29-3120-4f0b-8237-3c6c5e479b28", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-request-id": "1f922c29-3120-4f0b-8237-3c6c5e479b28", - "x-ms-routing-request-id": "WESTUS2:20210712T224259Z:1f922c29-3120-4f0b-8237-3c6c5e479b28" + "x-ms-correlation-request-id": "8df911fe-75e5-4413-a485-5c4b9d9f3bb5", + "x-ms-ratelimit-remaining-subscription-reads": "11978", + "x-ms-request-id": "8df911fe-75e5-4413-a485-5c4b9d9f3bb5", + "x-ms-routing-request-id": "WESTUS2:20210726T005216Z:8df911fe-75e5-4413-a485-5c4b9d9f3bb5" }, "ResponseBody": { "id": "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c", @@ -48,6 +48,7 @@ ], "Variables": { "RandomSeed": "2041229862", + "RESOURCE_MANAGER_URL": null, "SUBSCRIPTION_ID": "db1ab6f0-4769-4b27-930e-01e2ef9c123c" } } \ No newline at end of file diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ApiVersionsBaseTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ApiVersionsBaseTests.cs index f5ed047125f4..fbe831f20407 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ApiVersionsBaseTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ApiVersionsBaseTests.cs @@ -1,7 +1,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ApiVersionsBaseTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmClientOptionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmClientOptionsTests.cs index 6b78215b9dd2..8d5ceda2f7c3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmClientOptionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmClientOptionsTests.cs @@ -4,7 +4,7 @@ using Azure.Core.Pipeline; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ArmClientOptionsTests : ResourceManagerTestBase diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmVoidOperationTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmVoidOperationTests.cs index 76c081e04fa6..ed0b58b1387a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmVoidOperationTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ArmVoidOperationTests.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ArmVoidOperationTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/GenericResourceDataTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/GenericResourceDataTests.cs index 82e4d842e37a..65a1757637aa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/GenericResourceDataTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/GenericResourceDataTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class GenericResourceDataTests @@ -17,7 +17,7 @@ public class GenericResourceDataTests public void SerializationTestType1() { string expected = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "Unit", "TestAssets", "GenericResourceData", "SerializationTestType1.json")); - ResourceGroupResourceIdentifier id = Id; + ResourceIdentifier id = Id; Plan plan = new Plan("NameForPlan", "PublisherForPlan", "ProductForPlan", "PromotionCodeForPlan", "VersionForPlan"); Sku sku = new Sku("NameForSku", "TierForSku", "SizeForSku", "FamilyForSku", "ModelForSku", 15464547); GenericResourceData data = new GenericResourceData(id, id.Name, id.ResourceType, Location.EastUS, null, plan, null, "KindForResource", "ManagedByForResource", sku, null); @@ -30,7 +30,7 @@ public void SerializationTestType1() public void SerializationTestType2() { string expected = File.ReadAllText(Path.Combine(TestContext.CurrentContext.TestDirectory, "Unit", "TestAssets", "GenericResourceData", "SerializationTestType2.json")); - ResourceGroupResourceIdentifier id = Id; + ResourceIdentifier id = Id; var plan = new Plan("NameForPlan", "PublisherForPlan", "ProductForPlan", "PromotionCodeForPlan", "VersionForPlan"); var kind = "KindForResource"; var managedBy = "ManagedByForResource"; @@ -47,7 +47,7 @@ public void SerializationTestType2() public void InvalidSerializationTest() { string expected = "{\"properties\":{\"location\":\"eastus\",\"tags\":{}}}"; - ResourceGroupResourceIdentifier id = Id; + ResourceIdentifier id = Id; GenericResourceData data = new GenericResourceData(id, id.Name, id.ResourceType, Location.EastUS, null, null, null, null, null, null, null); var json = JsonHelper.SerializePropertiesToString(data); diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/IdentityTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/IdentityTests.cs index 320bf3818f84..51cf614e7b32 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/IdentityTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/IdentityTests.cs @@ -7,7 +7,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class IdentityTests @@ -29,7 +29,7 @@ public void CheckNoParamConstructor() [TestCase(null, true)] public void CheckUserTrueConstructor(string resourceID, bool invalidParameter) { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); if (invalidParameter) { @@ -57,7 +57,7 @@ public void CheckUserTrueConstructor(string resourceID, bool invalidParameter) [TestCase(null, true)] public void CheckUserFalseConstructor(string resourceID, bool invalidParameter) { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); if (invalidParameter) { @@ -99,7 +99,7 @@ public void EqualsNullOtherTest() [TestCase] public void EqualsReferenceTestTrue() { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity = new ResourceIdentity(system, dict1); @@ -110,11 +110,11 @@ public void EqualsReferenceTestTrue() [TestCase] public void EqualsTestTrue() { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity = new ResourceIdentity(system, dict1); - var dict2 = new Dictionary(); + var dict2 = new Dictionary(); dict2["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system2 = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity1 = new ResourceIdentity(system2, dict2); @@ -124,11 +124,11 @@ public void EqualsTestTrue() [TestCase] public void EqualsTestFalse() { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity = new ResourceIdentity(system, dict1); - var dict2 = new Dictionary(); + var dict2 = new Dictionary(); dict2["/subscriptions/d96407f5-db8f-4325-b582-84ad21310bd8/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system2 = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity1 = new ResourceIdentity(system2, dict2); @@ -138,11 +138,11 @@ public void EqualsTestFalse() [TestCase] public void EqualsTestFalseSameKey() { - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(Guid.Empty, Guid.Empty); var system = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity = new ResourceIdentity(system, dict1); - var dict2 = new Dictionary(); + var dict2 = new Dictionary(); dict2["/subscriptions/1ab27dfb-d2ee-4283-b1e3-550deaebb8e4/resourceGroups/tester/providers/Microsoft.Web/sites/autotest"] = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), Guid.Empty); var system2 = new SystemAssignedIdentity(Guid.Empty, Guid.Empty); ResourceIdentity identity1 = new ResourceIdentity(system2, dict2); @@ -280,7 +280,7 @@ public void TestSerializerValidSystemAndUser() { SystemAssignedIdentity systemAssignedIdentity = new SystemAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); UserAssignedIdentity userAssignedIdentity = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport"] = userAssignedIdentity; ResourceIdentity identity = new ResourceIdentity(systemAssignedIdentity, dict1); string system = "\"principalId\":\"de29bab1-49e1-4705-819b-4dfddceaaa98\",\"tenantId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\""; @@ -301,7 +301,7 @@ public void TestSerializerValidSystemAndMultUser() SystemAssignedIdentity systemAssignedIdentity = new SystemAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); UserAssignedIdentity userAssignedIdentity1 = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); UserAssignedIdentity userAssignedIdentity2 = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011cb47"), new Guid("de29bab1-49e1-4705-819b-4dfddcebaa98")); - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport1"] = userAssignedIdentity1; dict1["/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport2"] = userAssignedIdentity2; ResourceIdentity identity = new ResourceIdentity(systemAssignedIdentity, dict1); @@ -337,7 +337,7 @@ public void TestSerializerValidSystemOnly() public void TestSerializerValidUserEmptySystem() { UserAssignedIdentity userAssignedIdentity = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport"] = userAssignedIdentity; ResourceIdentity identity = new ResourceIdentity(dict1, true); string system = "\"principalId\":\"null\",\"tenantId\":\"null\""; @@ -356,7 +356,7 @@ public void TestSerializerValidUserEmptySystem() public void TestSerializerValidUserNullSystem() { UserAssignedIdentity userAssignedIdentity = new UserAssignedIdentity(new Guid("72f988bf-86f1-41af-91ab-2d7cd011db47"), new Guid("de29bab1-49e1-4705-819b-4dfddceaaa98")); - var dict1 = new Dictionary(); + var dict1 = new Dictionary(); dict1["/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport"] = userAssignedIdentity; ResourceIdentity identity = new ResourceIdentity(dict1, false); string user = "{\"clientId\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\",\"principalId\":\"de29bab1-49e1-4705-819b-4dfddceaaa98\"}"; diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/JsonAsserts.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/JsonAsserts.cs index 82ec2d9ed082..eebdc16e4e01 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/JsonAsserts.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/JsonAsserts.cs @@ -4,7 +4,7 @@ using Azure.Core; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { internal static class JsonAsserts { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ListExtensionsTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ListExtensionsTests.cs index a2cd4fab8d80..89d866f8baa8 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ListExtensionsTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ListExtensionsTests.cs @@ -1,8 +1,9 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Core; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ListExtensionsTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationResourceIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationResourceIdentifierTests.cs new file mode 100644 index 000000000000..a1dc94b6bebb --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationResourceIdentifierTests.cs @@ -0,0 +1,201 @@ +using System; +using Azure.ResourceManager.Resources.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Tests +{ + public class LocationResourceIdentifierTests : ResourceIdentifierTests + { + private const string LocationResourceId = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/locations/MyLocation"; + private const string LocationBaseResourceId = "/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2"; + private const string LocationInDifferentNamespace = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Compute/locations/westus2"; + + [Test] + public void LocationFromDiffNamespaceWithChildResouce() + { + string resourceId = $"{LocationInDifferentNamespace}/publishers/128technology"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("db1ab6f0-4769-4b27-930e-01e2ef9c123c", id.SubscriptionId); + Assert.AreEqual("Microsoft.Compute/locations/publishers", id.ResourceType.ToString()); + Assert.AreEqual("128technology", id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(true, id.IsChild); + ValidateLocationBaseResource(id.Parent, LocationInDifferentNamespace, false, "Microsoft.Compute/locations", "db1ab6f0-4769-4b27-930e-01e2ef9c123c"); + } + + [Test] + public void LocationWithChildResouce() + { + string resourceId = $"{LocationBaseResourceId}/myResourceType/myResourceName"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", id.SubscriptionId); + Assert.AreEqual("Microsoft.Resources/subscriptions/locations/myResourceType", id.ResourceType.ToString()); + Assert.AreEqual("myResourceName", id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(true, id.IsChild); + ValidateLocationBaseResource(id.Parent, LocationBaseResourceId, true, "Microsoft.Resources/subscriptions/locations", "17fecd63-33d8-4e43-ac6f-0aafa111b38d"); + } + + [Test] + public void LocationWithChildSingleton() + { + string resourceId = $"{LocationBaseResourceId}/myResourceType/myResourceName/mySingletonResource"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", id.SubscriptionId); + Assert.AreEqual("Microsoft.Resources/subscriptions/locations/myResourceType/mySingletonResource", id.ResourceType.ToString()); + Assert.AreEqual(string.Empty, id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(true, id.IsChild); + + var parentId = id.Parent; + Assert.AreEqual($"{LocationBaseResourceId}/myResourceType/myResourceName", parentId.ToString()); + Assert.AreEqual("westus2", parentId.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", parentId.SubscriptionId); + Assert.AreEqual("Microsoft.Resources/subscriptions/locations/myResourceType", parentId.ResourceType.ToString()); + Assert.AreEqual("myResourceName", parentId.Name); + Assert.IsNull(parentId.Provider); + Assert.AreEqual(true, parentId.IsChild); + + ValidateLocationBaseResource(parentId.Parent, LocationBaseResourceId, true, "Microsoft.Resources/subscriptions/locations", "17fecd63-33d8-4e43-ac6f-0aafa111b38d"); + } + + [Test] + public void LocationWithProviderResource() + { + string resourceId = $"{LocationBaseResourceId}/providers/myProvider/myResourceType/myResourceName"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", id.SubscriptionId); + Assert.AreEqual("myProvider/myResourceType", id.ResourceType.ToString()); + Assert.AreEqual("myResourceName", id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(false, id.IsChild); + + ValidateLocationBaseResource(id.Parent, LocationBaseResourceId, true, "Microsoft.Resources/subscriptions/locations", "17fecd63-33d8-4e43-ac6f-0aafa111b38d"); + } + + [Test] + public void LocationWithProviderResourceWithChild() + { + string resourceId = $"{LocationBaseResourceId}/providers/myProvider/myResourceType/myResourceName/myChildResource/myChildResourceName"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", id.SubscriptionId); + Assert.AreEqual("myProvider/myResourceType/myChildResource", id.ResourceType.ToString()); + Assert.AreEqual("myChildResourceName", id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(true, id.IsChild); + + var parentId = id.Parent; + Assert.AreEqual($"{LocationBaseResourceId}/providers/myProvider/myResourceType/myResourceName", parentId.ToString()); + Assert.AreEqual("westus2", parentId.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", parentId.SubscriptionId); + Assert.AreEqual("myProvider/myResourceType", parentId.ResourceType.ToString()); + Assert.AreEqual("myResourceName", parentId.Name); + Assert.IsNull(parentId.Provider); + Assert.AreEqual(false, parentId.IsChild); + + ValidateLocationBaseResource(parentId.Parent, LocationBaseResourceId, true, "Microsoft.Resources/subscriptions/locations", "17fecd63-33d8-4e43-ac6f-0aafa111b38d"); + } + + [Test] + public void LocationWithExtensionResource() + { + string resourceId = $"{LocationBaseResourceId}/providers/myProvider/myResourceType/myResourceName/providers/mySecondNamespace/myChildResource/myChildResourceName"; + var id = new ResourceIdentifier(resourceId); + Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual("westus2", id.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", id.SubscriptionId); + Assert.AreEqual("mySecondNamespace/myChildResource", id.ResourceType.ToString()); + Assert.AreEqual("myChildResourceName", id.Name); + Assert.IsNull(id.Provider); + Assert.AreEqual(false, id.IsChild); + + var parentId = id.Parent; + Assert.AreEqual($"{LocationBaseResourceId}/providers/myProvider/myResourceType/myResourceName", parentId.ToString()); + Assert.AreEqual("westus2", parentId.Location); + Assert.AreEqual("17fecd63-33d8-4e43-ac6f-0aafa111b38d", parentId.SubscriptionId); + Assert.AreEqual("myProvider/myResourceType", parentId.ResourceType.ToString()); + Assert.AreEqual("myResourceName", parentId.Name); + Assert.IsNull(parentId.Provider); + Assert.AreEqual(false, parentId.IsChild); + + ValidateLocationBaseResource(parentId.Parent, LocationBaseResourceId, true, "Microsoft.Resources/subscriptions/locations", "17fecd63-33d8-4e43-ac6f-0aafa111b38d"); + } + + [Test] + public void TryGetPropertiesForLocationResource() + { + ResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2/providers/Contoso.Widgets/widgets/myWidget"; + string subscription; + Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); + Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); + Location location; + Assert.AreEqual(true, id1.TryGetLocation(out location)); + Assert.AreEqual(Location.WestUS2, location); + Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); + ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"; + ResourceIdentifier parentId; + Assert.AreEqual(true, id1.TryGetParent(out parentId)); + Assert.IsTrue(expectedId.Equals(parentId)); + } + + [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, null, "roleAssignments", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", null)] + [TestCase(LocationResourceId, "", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "")] + [TestCase(LocationResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] + [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] + + public void TestAppendLocationProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) + { + ResourceIdentifier resource = resourceId; + if (providerNamespace is null || resourceTypeName is null || resourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else + { + var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; + Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); + } + } + + [TestCase(LocationResourceId, "wheels", "Wheel1")] + [TestCase(LocationResourceId, null, "wheel2")] + [TestCase(LocationResourceId, "wheels", null)] + [TestCase(LocationResourceId, "", "wheel2")] + [TestCase(LocationResourceId, "wheels", " ")] + [TestCase(LocationResourceId, "wheels/spokes", "wheel2")] + [TestCase(LocationResourceId, "wheels", "wheel1/wheel2")] + public void TestAppendLocationChildResource(string resourceId, string childTypeName, string childResourceName) + { + ResourceIdentifier resource = resourceId; + if (childTypeName is null || childResourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (childTypeName.Contains("/") || childResourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else + { + var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; + Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); + } + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationTests.cs index 15a357db71ef..7bba1847961d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/LocationTests.cs @@ -2,7 +2,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class LocationTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PlanTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PlanTests.cs index ea65abe38a30..54fd2b7b5b81 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PlanTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PlanTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] class PlanTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PropertyReferenceTypeTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PropertyReferenceTypeTests.cs index d098ca8f02de..2bde13f9c7d0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PropertyReferenceTypeTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/PropertyReferenceTypeTests.cs @@ -2,9 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using Azure.ResourceManager.Core; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class PropertyReferenceTypeTests { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ReferenceTypeTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ReferenceTypeTests.cs index 92080c7e90d6..a263d73aa9e0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ReferenceTypeTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ReferenceTypeTests.cs @@ -2,9 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using Azure.ResourceManager.Core; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class ReferenceTypeTests { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestResource.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestResource.cs index ecaaa4790e4e..311d614c73a2 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestResource.cs @@ -1,12 +1,12 @@ using Azure.ResourceManager.Resources.Models; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { - public class TestResource : Resource where TIdentifier : TenantResourceIdentifier - { - public TestResource(TIdentifier id) - :base(id, id.Name, id.ResourceType) - { - } - } + //public class TestResource : Resource + //{ + // public TestResource(TIdentifier id) + // :base(id, id.Name, id.ResourceType) + // { + // } + //} } diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestTrackedResource.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestTrackedResource.cs index a1643cb7af05..bf1a591608fe 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestTrackedResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/Resource/TestTrackedResource.cs @@ -1,14 +1,14 @@ using Azure.ResourceManager.Resources.Models; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { - public class TestTrackedResource : TrackedResource where TIdentifier : TenantResourceIdentifier + public class TestTrackedResource : TrackedResource { - public TestTrackedResource(TIdentifier id) : this(id, Location.Default) + public TestTrackedResource(ResourceIdentifier id) : this(id, Location.Default) { } - public TestTrackedResource(TIdentifier id, string location) + public TestTrackedResource(ResourceIdentifier id, string location) :base(id, id.Name, id.ResourceType, location, null) { } diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceGroupResourceIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceGroupResourceIdentifierTests.cs new file mode 100644 index 000000000000..f635453d4b34 --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceGroupResourceIdentifierTests.cs @@ -0,0 +1,162 @@ +using System; +using Azure.ResourceManager.Resources.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Tests +{ + public class ResourceGroupResourceIdentifierTests : ResourceIdentifierTests + { + const string TrackedResourceId = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/myVm"; + const string ResourceGroupResourceId = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg"; + + [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Compute", "virtualMachines", "myVM")] + [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "!@#$%^&*()-_+=;:'\",<.>/?", "Microsoft.Network", "virtualNetworks", "MvVM_vnet")] + [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Network", "publicIpAddresses", "!@#$%^&*()-_+=;:'\",<.>/?")] + public void CanParseRPIds(string subscription, string resourceGroup, string provider, string type, string name) + { + var resourceId = $"/subscriptions/{subscription}/resourceGroups/{Uri.EscapeDataString(resourceGroup)}/providers/{provider}/{type}/{Uri.EscapeDataString(name)}"; + ResourceIdentifier subject = resourceId; + Assert.AreEqual(resourceId, subject.ToString()); + Assert.AreEqual(subscription, subject.SubscriptionId); + Assert.AreEqual(resourceGroup, Uri.UnescapeDataString(subject.ResourceGroupName)); + Assert.AreEqual(provider, subject.ResourceType.Namespace); + Assert.AreEqual(type, subject.ResourceType.Type); + Assert.AreEqual(name, Uri.UnescapeDataString(subject.Name)); + } + + [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Web", "appServices/myApp/config", "appServices/config")] + public void CanParseProxyResource(string subscription, string rg, string resourceNamespace, string resource, string type) + { + string id = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/{resourceNamespace}/{resource}"; + ResourceIdentifier subject = id; + Assert.AreEqual(id, subject.ToString()); + Assert.AreEqual(subscription, subject.SubscriptionId); + Assert.AreEqual(resourceNamespace, subject.ResourceType.Namespace); + Assert.AreEqual(type, subject.ResourceType.Type); + } + + [Test] + public void CanParseResourceGroups() + { + ResourceIdentifier subject = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg"; + Assert.AreEqual("/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg", subject.ToString()); + Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); + Assert.AreEqual("myRg", subject.ResourceGroupName); + Assert.AreEqual("Microsoft.Resources", subject.ResourceType.Namespace); + Assert.AreEqual("resourceGroups", subject.ResourceType.Type); + } + + [TestCase("MyVnet", "MySubnet")] + [TestCase("!@#$%^&*()-_+=;:'\",<.>/?", "MySubnet")] + [TestCase("MyVnet", "!@#$%^&*()-_+=;:'\",<.>/?")] + public void CanParseChildResources(string parentName, string name) + { + var resourceId = $"/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/{Uri.EscapeDataString(parentName)}/subnets/{Uri.EscapeDataString(name)}"; + ResourceIdentifier subject = resourceId; + Assert.AreEqual(resourceId, subject.ToString()); + Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); + Assert.AreEqual("myRg", Uri.UnescapeDataString(subject.ResourceGroupName)); + Assert.AreEqual("Microsoft.Network", subject.ResourceType.Namespace); + Assert.AreEqual("virtualNetworks", subject.Parent.ResourceType.Type); + Assert.AreEqual("virtualNetworks/subnets", subject.ResourceType.Type); + Assert.AreEqual(name, Uri.UnescapeDataString(subject.Name)); + + // check parent type parsing + ResourceIdentifier parentResource = $"/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/{Uri.EscapeDataString(parentName)}"; + Assert.AreEqual(parentResource, subject.Parent); + Assert.AreEqual(parentResource.ToString(), subject.Parent.ToString()); + Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", ((ResourceIdentifier)subject.Parent).SubscriptionId); + Assert.AreEqual("myRg", Uri.UnescapeDataString(((ResourceIdentifier)subject.Parent).ResourceGroupName)); + Assert.AreEqual("Microsoft.Network", subject.Parent.ResourceType.Namespace); + Assert.AreEqual("virtualNetworks", subject.Parent.ResourceType.Type); + Assert.AreEqual(parentName, Uri.UnescapeDataString(subject.Parent.Name)); + } + + [TestCase(true, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport")] + [TestCase(false, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport2", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport")] + [TestCase(false, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test")] + public void CheckHashCode(bool expected, string resourceId1, string resourceId2) + { + ResourceIdentifier resourceIdentifier1 = new ResourceIdentifier(resourceId1); + ResourceIdentifier resourceIdentifier2 = new ResourceIdentifier(resourceId2); + Assert.AreEqual(expected, resourceIdentifier1.GetHashCode() == resourceIdentifier2.GetHashCode()); + } + + [Test] + public void EqualsObj() + { + object input = TrackedResourceId; + ResourceIdentifier resource = new ResourceIdentifier(TrackedResourceId); + Assert.AreEqual(true, resource.Equals(input)); + Assert.IsFalse(resource.Equals(new object())); + } + + [Test] + public void TryGetPropertiesForResourceGroupResource() + { + ResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg/providers/Contoso.Widgets/widgets/myWidget"; + string subscription; + Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); + Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); + Assert.AreEqual(false, id1.TryGetLocation(out _)); + string resourceGroupName; + Assert.AreEqual(true, id1.TryGetResourceGroupName(out resourceGroupName)); + Assert.AreEqual("myRg", resourceGroupName); + ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"; + ResourceIdentifier parentId; + Assert.AreEqual(true, id1.TryGetParent(out parentId)); + Assert.IsTrue(expectedId.Equals(parentId)); + } + + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, null, "roleAssignments", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", null)] + [TestCase(ResourceGroupResourceId, "", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "")] + [TestCase(ResourceGroupResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] + [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] + + public void TestAppendResourceGroupProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) + { + ResourceIdentifier resource = resourceId; + if (providerNamespace is null || resourceTypeName is null || resourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else + { + var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; + Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); + } + } + + [TestCase(ResourceGroupResourceId, "wheels", "Wheel1")] + [TestCase(ResourceGroupResourceId, "wheels", "Wheel2")] + [TestCase(ResourceGroupResourceId, null, "wheel2")] + [TestCase(ResourceGroupResourceId, "wheels", null)] + [TestCase(ResourceGroupResourceId, "", "wheel2")] + [TestCase(ResourceGroupResourceId, "wheels", " ")] + [TestCase(ResourceGroupResourceId, "wheels/spokes", "wheel2")] + [TestCase(ResourceGroupResourceId, "wheels", "wheel1/wheel2")] + public void TestAppendResourceGroupChildResource(string resourceId, string childTypeName, string childResourceName) + { + ResourceIdentifier resource = resourceId; + if (childTypeName is null || childResourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (childTypeName.Contains("/") || childResourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else + { + var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; + Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); + } + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceIdentifierTests.cs index ff24a047e0a4..60b6b7590816 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceIdentifierTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceIdentifierTests.cs @@ -2,7 +2,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ResourceIdentifierTests @@ -99,26 +99,7 @@ public void PublicConstructor(string resourceProviderID) } } - [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Compute", "virtualMachines", "myVM")] - [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "!@#$%^&*()-_+=;:'\",<.>/?", "Microsoft.Network", "virtualNetworks", "MvVM_vnet")] - [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Network", "publicIpAddresses", "!@#$%^&*()-_+=;:'\",<.>/?")] - public void CanParseRPIds(string subscription, string resourceGroup, string provider, string type, string name) - { - var resourceId = $"/subscriptions/{subscription}/resourceGroups/{Uri.EscapeDataString(resourceGroup)}/providers/{provider}/{type}/{Uri.EscapeDataString(name)}"; - ResourceGroupResourceIdentifier subject = resourceId; - Assert.AreEqual(resourceId, subject.ToString()); - Assert.AreEqual(subscription, subject.SubscriptionId); - Assert.AreEqual(resourceGroup, Uri.UnescapeDataString(subject.ResourceGroupName)); - Assert.AreEqual(provider, subject.ResourceType.Namespace); - Assert.AreEqual(type, subject.ResourceType.Type); - Assert.AreEqual(name, Uri.UnescapeDataString(subject.Name)); - } - - [TestCase(TrackedResourceId, "Microsoft.Authorization", "roleAssignments", "myRa")] - [TestCase(ChildResourceId, "Microsoft.Authorization", "roleAssignments", "myRa")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "myRa")] [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "myRa")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "myRa")] public void CanParseExtensionResourceIds(string baseId, string extensionNamespace, string extensionType, string extensionName) { ResourceIdentifier targetResourceId = baseId; @@ -130,74 +111,13 @@ public void CanParseExtensionResourceIds(string baseId, string extensionNamespac Assert.AreEqual(targetResourceId, subject.Parent); } - [TestCase("0c2f6471-1bf0-4dda-aec3-cb9272f09575", "myRg", "Microsoft.Web", "appServices/myApp/config", "appServices/config")] - public void CanParseProxyResource(string subscription, string rg, string resourceNamespace, string resource, string type) - { - string id = $"/subscriptions/{subscription}/resourceGroups/{rg}/providers/{resourceNamespace}/{resource}"; - ResourceGroupResourceIdentifier subject = id; - Assert.AreEqual(id, subject.ToString()); - Assert.AreEqual(subscription, subject.SubscriptionId); - Assert.AreEqual(resourceNamespace, subject.ResourceType.Namespace); - Assert.AreEqual(type, subject.ResourceType.Type); - } - - [Test] - public void CanParseSubscriptions() - { - SubscriptionResourceIdentifier subject = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575"; - Assert.AreEqual("/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.ToString()); - Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); - Assert.AreEqual("Microsoft.Resources", subject.ResourceType.Namespace); - Assert.AreEqual("subscriptions", subject.ResourceType.Type); - } - - [Test] - public void CanParseResourceGroups() - { - ResourceGroupResourceIdentifier subject = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg"; - Assert.AreEqual("/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg", subject.ToString()); - Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); - Assert.AreEqual("myRg", subject.ResourceGroupName); - Assert.AreEqual("Microsoft.Resources", subject.ResourceType.Namespace); - Assert.AreEqual("resourceGroups", subject.ResourceType.Type); - } - - [TestCase("MyVnet", "MySubnet")] - [TestCase("!@#$%^&*()-_+=;:'\",<.>/?", "MySubnet")] - [TestCase("MyVnet", "!@#$%^&*()-_+=;:'\",<.>/?")] - public void CanParseChildResources(string parentName, string name) - { - var resourceId = $"/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/{Uri.EscapeDataString(parentName)}/subnets/{Uri.EscapeDataString(name)}"; - ResourceGroupResourceIdentifier subject = resourceId; - Assert.AreEqual(resourceId, subject.ToString()); - Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); - Assert.AreEqual("myRg", Uri.UnescapeDataString(subject.ResourceGroupName)); - Assert.AreEqual("Microsoft.Network", subject.ResourceType.Namespace); - Assert.AreEqual("virtualNetworks", subject.Parent.ResourceType.Type); - Assert.AreEqual("virtualNetworks/subnets", subject.ResourceType.Type); - Assert.AreEqual(name, Uri.UnescapeDataString(subject.Name)); - - // check parent type parsing - ResourceGroupResourceIdentifier parentResource = $"/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/{Uri.EscapeDataString(parentName)}"; - Assert.AreEqual(parentResource, subject.Parent); - Assert.AreEqual(parentResource.ToString(), subject.Parent.ToString()); - Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", ((ResourceGroupResourceIdentifier)subject.Parent).SubscriptionId); - Assert.AreEqual("myRg", Uri.UnescapeDataString(((ResourceGroupResourceIdentifier)subject.Parent).ResourceGroupName)); - Assert.AreEqual("Microsoft.Network", subject.Parent.ResourceType.Namespace); - Assert.AreEqual("virtualNetworks", subject.Parent.ResourceType.Type); - Assert.AreEqual(parentName, Uri.UnescapeDataString(subject.Parent.Name)); - } - [TestCase("UnformattedString", Description = "Too Few Elements")] [TestCase("/subs/sub1/rgs/rg1/", Description = "No known parts")] [TestCase("/subscriptions/sub1/rgs/rg1/", Description = "Subscription not a Guid")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/resourceGroups", Description = "Too few parts")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets", Description = "Subscription resource with too few parts")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/widgets/myWidget", Description = "Subscription resource with invalid child")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/resourceGroups/myRg/widgets", Description = "ResourceGroup ID with Too few parts")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/resourceGroups/myRg/widgets/myWidget", Description = "ResourceGroup ID with invalid child")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/resourceGroups/myRg/providers/Microsoft.Widgets/widgets", Description = "ResourceGroup provider ID with Too few parts")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/incomplete", Description = "Too few parts for location resource")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/providers/incomplete", Description = "Too few parts for location resource")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/providers/myProvider/myResource/myResourceName/providers/incomplete", Description = "Too few parts for location resource")] [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/resourceGroups/myRg/providers/Company.MyProvider/myResources/myResourceName/providers/incomplete", Description = "Too few parts for resource group resource")] @@ -208,40 +128,39 @@ public void ThrowsOnInvalidUri(string resourceId) Assert.Throws(new TestDelegate(() => ConvertToResourceId(resourceId))); } - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/myResourceType/myResourceName", Description = "location child resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/myResourceType/myResourceName/mySingletonResource", Description = "location child singleton resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/providers/myProvider/myResourceType/myResourceName", Description = "location provider resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/providers/myProvider/myResourceType/myResourceName/myChildResource/myChildResourceName", Description = "location provider child resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/locations/westus2/providers/myProvider/myResourceType/myResourceName/providers/mySecondNamespace/myChildResource/myChildResourceName", Description = "location extension resource")] - public void CanParseValidLocationResource(string resourceId) + protected void ValidateLocationBaseResource(ResourceIdentifier locationResource, string expectedId, bool expectedChild, string expectedResourcetype, string expectedSubGuid) { - var id = ConvertToResourceId(resourceId); - Assert.AreEqual(resourceId, id.ToString()); + Assert.AreEqual(expectedId, locationResource.ToString()); + Assert.AreEqual(expectedChild, locationResource.IsChild); + Assert.AreEqual("westus2", locationResource.Location); + Assert.AreEqual("westus2", locationResource.Name); + Assert.IsNull(locationResource.Provider); + Assert.AreEqual(expectedResourcetype, locationResource.ResourceType.ToString()); + Assert.AreEqual(expectedSubGuid, locationResource.SubscriptionId); + ValidateSubscriptionResource(locationResource.Parent, locationResource.SubscriptionId); } - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/configuration", Description = "singleton homed in a subscription resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/providers/Contoso.Extensions/extensions/myExtension", Description = "Extension over a subscription resource")] - [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/flanges/myFlange", Description = "Child of a subscription resource")] - public void CanParseValidSubscriptionResource(string resourceId) + protected void ValidateSubscriptionResource(ResourceIdentifier subscriptionResource, string subscriptionId) { - SubscriptionResourceIdentifier subscription = resourceId; - Assert.AreEqual(resourceId, subscription.ToString()); + Assert.AreEqual($"/subscriptions/{subscriptionId}", subscriptionResource.ToString()); + Assert.AreEqual(true, subscriptionResource.IsChild); + Assert.IsNull(subscriptionResource.Location); + Assert.IsNull(subscriptionResource.Provider); + Assert.AreEqual(subscriptionId, subscriptionResource.Name); + Assert.AreEqual(subscriptionId, subscriptionResource.SubscriptionId); + Assert.AreEqual("Microsoft.Resources/subscriptions", subscriptionResource.ResourceType.ToString()); + ValidateTenantResource(subscriptionResource.Parent); } - [TestCase("/providers/Contoso.Widgets/widgets/myWidget/configuration", Description = "singleton homed in a tenant resource")] - [TestCase("/providers/Contoso.Widgets/widgets/myWidget/providers/Contoso.Extensions/extensions/myExtension", Description = "Extension over a subscription resource")] - [TestCase("/providers/Contoso.Widgets/widgets/myWidget/flanges/myFlange", Description = "Child of a subscription resource")] - public void CanParseValidTenantResource(string resourceId) + protected void ValidateTenantResource(ResourceIdentifier tenantResource) { - TenantResourceIdentifier tenant = resourceId; - Assert.AreEqual(resourceId, tenant.ToString()); - } - - [TestCase("/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/tagNames/azsecpack", Description = "No provider tagname")] - public void CanParseValidNoProviderResource(string resourceId) - { - SubscriptionResourceIdentifier subscription = resourceId; - Assert.AreEqual(resourceId, subscription.ToString()); + Assert.AreEqual("/", tenantResource.ToString()); + Assert.AreEqual(true, tenantResource.IsChild); + Assert.IsNull(tenantResource.Location); + Assert.IsNull(tenantResource.Provider); + Assert.AreEqual(string.Empty, tenantResource.Name); + Assert.IsNull(tenantResource.SubscriptionId); + Assert.AreEqual("Microsoft.Resources/tenants", tenantResource.ResourceType.ToString()); } public ResourceIdentifier ConvertToResourceId(string resourceId) @@ -250,16 +169,6 @@ public ResourceIdentifier ConvertToResourceId(string resourceId) return subject; } - [TestCase(true, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport")] - [TestCase(false, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport2", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport")] - [TestCase(false, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test/providers/Microsoft.Web/sites/autoreport", "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/nbhatia_test")] - public void CheckHashCode(bool expected, string resourceId1, string resourceId2) - { - ResourceIdentifier resourceIdentifier1 = new ResourceGroupResourceIdentifier(resourceId1); - ResourceIdentifier resourceIdentifier2 = new ResourceGroupResourceIdentifier(resourceId2); - Assert.AreEqual(expected, resourceIdentifier1.GetHashCode() == resourceIdentifier2.GetHashCode()); - } - [TestCase(TrackedResourceId, TrackedResourceId, true)] [TestCase(ChildResourceId, ChildResourceId, true)] [TestCase(null, null, true)] @@ -293,94 +202,6 @@ public void EqualsToString(string resourceProviderID1, string resourceProviderID Assert.AreEqual(expected, ResourceIdentifier.Equals(a, resourceProviderID2)); } - [Test] - public void EqualsObj() - { - object input = TrackedResourceId; - ResourceIdentifier resource = new ResourceGroupResourceIdentifier(TrackedResourceId); - Assert.AreEqual(true, resource.Equals(input)); - Assert.IsFalse(resource.Equals(new object())); - } - - [Test] - public void TryGetPropertiesForTenantResource() - { - TenantResourceIdentifier id1 = "/providers/Contoso.Widgets/widgets/myWidget"; - Assert.AreEqual(false, id1.TryGetSubscriptionId(out _)); - Assert.AreEqual(false, id1.TryGetLocation(out _)); - Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); - Assert.AreEqual(false, id1.TryGetParent(out _)); - TenantResourceIdentifier id2 = "/providers/Contoso.Widgets/widgets/myWidget/flages/myFlange"; - ResourceIdentifier parent; - Assert.AreEqual(true, id2.TryGetParent(out parent)); - Assert.AreEqual(true, id1.Equals(parent)); - } - - [Test] - public void TryGetPropertiesForSubscriptionResource() - { - SubscriptionResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/providers/Contoso.Widgets/widgets/myWidget"; - string subscription; - Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); - Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); - Assert.AreEqual(false, id1.TryGetLocation(out _)); - Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); - ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"; - ResourceIdentifier parentId; - Assert.AreEqual(true, id1.TryGetParent(out parentId)); - Assert.IsTrue(expectedId.Equals(parentId)); - } - - [Test] - public void TryGetPropertiesForSubscriptionProvider() - { - SubscriptionResourceIdentifier id1 = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Compute"; - string subscription; - Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); - Assert.AreEqual("db1ab6f0-4769-4b27-930e-01e2ef9c123c", subscription); - Assert.AreEqual(false, id1.TryGetLocation(out _)); - Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); - ResourceIdentifier expectedId = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c"; - ResourceIdentifier parentId; - Assert.AreEqual(true, id1.TryGetParent(out parentId)); - Assert.IsTrue(expectedId.Equals(parentId)); - } - - [Test] - public void TryGetPropertiesForLocationResource() - { - LocationResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2/providers/Contoso.Widgets/widgets/myWidget"; - string subscription; - Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); - Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); - Location location; - Assert.AreEqual(true, id1.TryGetLocation(out location)); - Assert.AreEqual(Location.WestUS2, location); - Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); - ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"; - ResourceIdentifier parentId; - Assert.AreEqual(true, id1.TryGetParent(out parentId)); - Assert.IsTrue(expectedId.Equals(parentId)); - } - - [Test] - public void TryGetPropertiesForResourceGroupResource() - { - ResourceGroupResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg/providers/Contoso.Widgets/widgets/myWidget"; - string subscription; - Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); - Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); - Assert.AreEqual(false, id1.TryGetLocation(out _)); - string resourceGroupName; - Assert.AreEqual(true, id1.TryGetResourceGroupName(out resourceGroupName)); - Assert.AreEqual("myRg", resourceGroupName); - ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"; - ResourceIdentifier parentId; - Assert.AreEqual(true, id1.TryGetParent(out parentId)); - Assert.IsTrue(expectedId.Equals(parentId)); - } - - [TestCase("/providers/Contoso.Widgets/widgets/myWidget", null, null, null, null, Description = "TenantResourceIdentifier")] [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/providers/Contoso.Widgets/widgets/myWidget", "6b085460-5f21-477e-ba44-1035046e9101", null, null, "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101", Description = "SubscriptionResourceIdentifier")] @@ -411,12 +232,12 @@ public void TryGetPropertiesForGenericResource(string resourceId, string subscri Assert.AreEqual(parent, outputParent.ToString()); } - [TestCase("/providers/Contoso.Widgets//widgets/myWidget", Description = "TenantResourceIdentifier")] - [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/providers//Contoso.Widgets/widgets/myWidget", + [TestCase("/providers/Contoso.Widgets/widgets/myWidget", Description = "TenantResourceIdentifier")] + [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/providers/Contoso.Widgets/widgets/myWidget", Description = "SubscriptionResourceIdentifier")] - [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101//locations/westus2/providers/Contoso.Widgets/widgets/myWidget", + [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2/providers/Contoso.Widgets/widgets/myWidget", Description = "LocationResourceIdentifier")] - [TestCase("/subscriptions//6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg/providers/Contoso.Widgets/widgets/myWidget", + [TestCase("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg/providers/Contoso.Widgets/widgets/myWidget", Description = "ResourceGroupResourceIdentifier")] public void ResourceIdRetainsOriginalInput(string resourceId) { @@ -424,28 +245,6 @@ public void ResourceIdRetainsOriginalInput(string resourceId) Assert.AreEqual(resourceId, id.ToString()); } - [Test] - public void ThrowOnMistypedResource() - { - TenantResourceIdentifier tenant; - Assert.Throws(() => tenant = new TenantResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101")); - Assert.Throws(() => tenant = new TenantResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2")); - Assert.Throws(() => tenant = new TenantResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg")); - Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"); - Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"); - Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"); - SubscriptionResourceIdentifier subscription = "/providers/Contoso.Widgets/widgets/myWidget"; - Assert.IsNull(subscription); - Assert.Throws(() => subscription = new SubscriptionResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2")); - Assert.Throws(() => subscription = new SubscriptionResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg")); - Assert.DoesNotThrow(() => subscription = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"); - Assert.DoesNotThrow(() => subscription = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"); - ResourceGroupResourceIdentifier group = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"; - Assert.IsNull(group); - LocationResourceIdentifier location = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"; - Assert.IsNull(location); - } - [TestCase(TrackedResourceId, TrackedResourceId, 0)] [TestCase(TrackedResourceId, ChildResourceId, -1)] [TestCase(ChildResourceId, TrackedResourceId, 1)] @@ -475,208 +274,6 @@ public void CompareToString(string resourceProviderID1, string resourceProviderI Assert.AreEqual(expected, a.CompareTo(b)); } - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget", "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", null, "roleAssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", null, "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", null)] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "", "roleAssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", " ", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] - public void TestAppendTenantProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) - { - TenantResourceIdentifier resource = resourceId; - if (providerNamespace is null || resourceTypeName is null || resourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else - { - var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; - Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); - } - } - - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget", "wheels", "Wheel1")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", "Wheel2")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", null, "wheel2")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", null)] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "", "wheel2")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", " ")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels/spokes", "wheel2")] - [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", "wheel1/wheel2")] - public void TestAppendTenantChildResource(string resourceId, string childTypeName, string childResourceName) - { - TenantResourceIdentifier resource = resourceId; - if (childTypeName is null || childResourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (childTypeName.Contains("/") || childResourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else - { - var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; - Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); - } - } - - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, null, "roleAssignments", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", null)] - [TestCase(SubscriptionResourceId, "", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "")] - [TestCase(SubscriptionResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] - [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] - - public void TestAppendSubscriptionProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) - { - SubscriptionResourceIdentifier resource = resourceId; - if (providerNamespace is null || resourceTypeName is null || resourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else - { - var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; - Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); - } - } - - [TestCase(SubscriptionResourceId, "wheels", "Wheel2")] - [TestCase(SubscriptionResourceId, null, "wheel2")] - [TestCase(SubscriptionResourceId, "wheels", null)] - [TestCase(SubscriptionResourceId, "", "wheel2")] - [TestCase(SubscriptionResourceId, "wheels", " ")] - [TestCase(SubscriptionResourceId, "wheels/spokes", "wheel2")] - [TestCase(SubscriptionResourceId, "wheels", "wheel1/wheel2")] - public void TestAppendSubscriptionChildResource(string resourceId, string childTypeName, string childResourceName) - { - SubscriptionResourceIdentifier resource = resourceId; - if (childTypeName is null || childResourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (childTypeName.Contains("/") || childResourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else - { - var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; - Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); - } - } - - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, null, "roleAssignments", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", null)] - [TestCase(ResourceGroupResourceId, "", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "")] - [TestCase(ResourceGroupResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] - [TestCase(ResourceGroupResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] - - public void TestAppendResourceGroupProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) - { - ResourceGroupResourceIdentifier resource = resourceId; - if (providerNamespace is null || resourceTypeName is null || resourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else - { - var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; - Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); - } - } - - [TestCase(ResourceGroupResourceId, "wheels", "Wheel1")] - [TestCase(ResourceGroupResourceId, "wheels", "Wheel2")] - [TestCase(ResourceGroupResourceId, null, "wheel2")] - [TestCase(ResourceGroupResourceId, "wheels", null)] - [TestCase(ResourceGroupResourceId, "", "wheel2")] - [TestCase(ResourceGroupResourceId, "wheels", " ")] - [TestCase(ResourceGroupResourceId, "wheels/spokes", "wheel2")] - [TestCase(ResourceGroupResourceId, "wheels", "wheel1/wheel2")] - public void TestAppendResourceGroupChildResource(string resourceId, string childTypeName, string childResourceName) - { - ResourceGroupResourceIdentifier resource = resourceId; - if (childTypeName is null || childResourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (childTypeName.Contains("/") || childResourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else - { - var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; - Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); - } - } - - [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, null, "roleAssignments", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", null)] - [TestCase(LocationResourceId, "", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "")] - [TestCase(LocationResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] - [TestCase(LocationResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] - - public void TestAppendLocationProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) - { - LocationResourceIdentifier resource = resourceId; - if (providerNamespace is null || resourceTypeName is null || resourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); - else - { - var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; - Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); - } - } - - [TestCase(LocationResourceId, "wheels", "Wheel1")] - [TestCase(LocationResourceId, null, "wheel2")] - [TestCase(LocationResourceId, "wheels", null)] - [TestCase(LocationResourceId, "", "wheel2")] - [TestCase(LocationResourceId, "wheels", " ")] - [TestCase(LocationResourceId, "wheels/spokes", "wheel2")] - [TestCase(LocationResourceId, "wheels", "wheel1/wheel2")] - public void TestAppendLocationChildResource(string resourceId, string childTypeName, string childResourceName) - { - LocationResourceIdentifier resource = resourceId; - if (childTypeName is null || childResourceName is null) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) - Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else if (childTypeName.Contains("/") || childResourceName.Contains("/")) - Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); - else - { - var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; - Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); - } - } - [TestCase(TrackedResourceId, TrackedResourceId, true, "object")] [TestCase(ChildResourceId, ChildResourceId, true, "object")] [TestCase(null, null, true, "object")] diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceListOperationsTest.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceListOperationsTest.cs index e4612c852b91..1aecf3a8668f 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceListOperationsTest.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceListOperationsTest.cs @@ -4,7 +4,7 @@ using Azure.ResourceManager.Resources.Models; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ResourceListOperationsTest @@ -38,7 +38,7 @@ private static GenericResourceData GetGenericResource( string managedBy, string location) { - TenantResourceIdentifier id = $"/subscriptions/{Guid.NewGuid().ToString()}/resourceGroups/myResourceGroup/providers/Microsoft.Widgets/widgets/myWidget"; + ResourceIdentifier id = $"/subscriptions/{Guid.NewGuid().ToString()}/resourceGroups/myResourceGroup/providers/Microsoft.Widgets/widgets/myWidget"; return new GenericResourceData(id, id.Name, id.ResourceType, location, tags, plan, null, kind, managedBy, sku, null); } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceNameFilterTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceNameFilterTests.cs index e4d1c54d7854..6d717cb2109d 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceNameFilterTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceNameFilterTests.cs @@ -3,7 +3,7 @@ using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ResourceNameFilterTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTagFilterTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTagFilterTests.cs index 160ea782baa5..ebbefa4e20aa 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTagFilterTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTagFilterTests.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ResourceTagFilterTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTypeTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTypeTests.cs index 1507a2750e54..b6ce63093848 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTypeTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/ResourceTypeTests.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class ResourceTypeTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs index 76c2a6625886..33c070f5a9b5 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/ArmClientOptionsExtensions.cs @@ -1,4 +1,4 @@ -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public static class AzureResourceManagerClientOptionsExtensions { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeResourceApiVersions.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeResourceApiVersions.cs index 89b6327d092b..99568f41d803 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeResourceApiVersions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeResourceApiVersions.cs @@ -1,4 +1,6 @@ -namespace Azure.ResourceManager.Core.Tests +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Tests { public class FakeResourceApiVersions : ApiVersionsBase { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeRpApiVersions.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeRpApiVersions.cs index 1e3e6dc21bb3..96e33ccb85f3 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeRpApiVersions.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/RpImplementations/FakeRpApiVersions.cs @@ -1,4 +1,4 @@ -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { public class FakeRpApiVersions { diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SkuTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SkuTests.cs index 3e2f81ca5e0c..74f0db5277db 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SkuTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SkuTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] class SkuTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubResourceTests.cs index e9a47da8fb49..7b0fe2843508 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubResourceTests.cs @@ -6,7 +6,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class SubResourceTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionProviderIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionProviderIdentifierTests.cs index 2a535e6129d8..ffbbe2b40a41 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionProviderIdentifierTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionProviderIdentifierTests.cs @@ -1,17 +1,17 @@ using NUnit.Framework; using System; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] - public class SubscriptionProviderIdentifierTests + public class SubscriptionProviderIdentifierTests : ResourceIdentifierTests { [TestCase("/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Insights")] public void ImplicitConstructorWithProvider(string resourceProviderID) { string x = resourceProviderID; string y; - SubscriptionProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.AreEqual("Microsoft.Insights", z.Provider); @@ -36,13 +36,13 @@ public void ImplicitConstructorWithSubnet(string resourceProviderID) { string x = resourceProviderID; string y; - SubscriptionProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.AreEqual("Microsoft.Insights", z.Provider); Assert.AreEqual("Microsoft.Network/virtualNetworks/subnets", z.ResourceType.ToString()); - Assert.AreEqual("Microsoft.Insights", (z.Parent as SubscriptionProviderIdentifier).Provider); - Assert.AreEqual("Microsoft.Insights", (z.Parent.Parent as SubscriptionProviderIdentifier).Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Parent.Provider); Assert.AreEqual("Microsoft.Network/virtualNetworks/subnets", z.ResourceType.ToString()); Assert.AreEqual("Microsoft.Network/virtualNetworks", z.Parent.ResourceType.ToString()); Assert.AreEqual("testvnet", z.Parent.Name); @@ -62,22 +62,22 @@ public void ImplicitConstructorWithSubnet(string resourceProviderID) } } - [TestCase("/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Insights/providers/Microsoft.Network/virtualNetworks/testvnet/")] + [TestCase("/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Insights/providers/Microsoft.Network/virtualNetworks/testvnet")] public void ImplicitConstructorWithVNet(string resourceProviderID) { string x = resourceProviderID; string y; - SubscriptionProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.AreEqual("Microsoft.Insights", z.Provider); Assert.AreEqual("Microsoft.Network/virtualNetworks", z.ResourceType.ToString()); - Assert.AreEqual("Microsoft.Insights", (z.Parent as SubscriptionProviderIdentifier).Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Provider); Assert.AreEqual("Microsoft.Network/virtualNetworks", z.ResourceType.ToString()); Assert.AreEqual("testvnet", z.Name); - Assert.AreEqual("Microsoft.Insights", (z.Parent as SubscriptionProviderIdentifier).Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Provider); Assert.AreEqual("Microsoft.Resources/providers", z.Parent.ResourceType.ToString()); - Assert.IsNull(z.Parent.Name); + Assert.AreEqual("Microsoft.Insights", z.Parent.Name); Assert.AreEqual("Microsoft.Resources/subscriptions", z.Parent.Parent.ResourceType.ToString()); Assert.AreEqual("db1ab6f0-4769-4b27-930e-01e2ef9c123c", z.Parent.Parent.Name); diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionResourceIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionResourceIdentifierTests.cs new file mode 100644 index 000000000000..26bc4be1478a --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SubscriptionResourceIdentifierTests.cs @@ -0,0 +1,127 @@ +using System; +using NUnit.Framework; + +namespace Azure.ResourceManager.Tests +{ + public class SubscriptionResourceIdentifierTests : ResourceIdentifierTests + { + const string SubscriptionResourceId = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575"; + + [Test] + public void CanParseSubscriptions() + { + ResourceIdentifier subject = "/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575"; + Assert.AreEqual("/subscriptions/0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.ToString()); + Assert.AreEqual("0c2f6471-1bf0-4dda-aec3-cb9272f09575", subject.SubscriptionId); + Assert.AreEqual("Microsoft.Resources", subject.ResourceType.Namespace); + Assert.AreEqual("subscriptions", subject.ResourceType.Type); + } + + [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/configuration", Description = "singleton homed in a subscription resource")] + [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/providers/Contoso.Extensions/extensions/myExtension", Description = "Extension over a subscription resource")] + [TestCase("/subscriptions/17fecd63-33d8-4e43-ac6f-0aafa111b38d/providers/Contoso.Widgets/widgets/myWidget/flanges/myFlange", Description = "Child of a subscription resource")] + public void CanParseValidSubscriptionResource(string resourceId) + { + ResourceIdentifier subscription = resourceId; + Assert.AreEqual(resourceId, subscription.ToString()); + } + + [TestCase("/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/tagNames/azsecpack", Description = "No provider tagname")] + public void CanParseValidNoProviderResource(string resourceId) + { + ResourceIdentifier subscription = resourceId; + Assert.AreEqual(resourceId, subscription.ToString()); + } + + [Test] + public void TryGetPropertiesForSubscriptionResource() + { + ResourceIdentifier id1 = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/providers/Contoso.Widgets/widgets/myWidget"; + string subscription; + Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); + Assert.AreEqual("6b085460-5f21-477e-ba44-1035046e9101", subscription); + Assert.AreEqual(false, id1.TryGetLocation(out _)); + Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); + ResourceIdentifier expectedId = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"; + ResourceIdentifier parentId; + Assert.AreEqual(true, id1.TryGetParent(out parentId)); + Assert.IsTrue(expectedId.Equals(parentId)); + } + + [Test] + public void TryGetPropertiesForSubscriptionProvider() + { + ResourceIdentifier id1 = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/providers/Microsoft.Compute"; + string subscription; + Assert.AreEqual(true, id1.TryGetSubscriptionId(out subscription)); + Assert.AreEqual("db1ab6f0-4769-4b27-930e-01e2ef9c123c", subscription); + Assert.AreEqual(false, id1.TryGetLocation(out _)); + Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); + ResourceIdentifier expectedId = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c"; + ResourceIdentifier parentId; + Assert.AreEqual(true, id1.TryGetParent(out parentId)); + Assert.IsTrue(expectedId.Equals(parentId)); + } + + [Test] + public void ThrowOnMistypedResource() + { + ResourceIdentifier subscription = "/providers/Contoso.Widgets/widgets/myWidget"; + Assert.IsNotNull(subscription); + Assert.DoesNotThrow(() => subscription = new ResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2")); + Assert.DoesNotThrow(() => subscription = new ResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg")); + Assert.DoesNotThrow(() => subscription = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"); + Assert.DoesNotThrow(() => subscription = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"); + } + + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, null, "roleAssignments", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", null, "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", null)] + [TestCase(SubscriptionResourceId, "", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", " ", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "")] + [TestCase(SubscriptionResourceId, "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] + [TestCase(SubscriptionResourceId, "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] + + public void TestAppendSubscriptionProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) + { + ResourceIdentifier resource = resourceId; + if (providerNamespace is null || resourceTypeName is null || resourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else + { + var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; + Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); + } + } + + [TestCase(SubscriptionResourceId, "wheels", "Wheel2")] + [TestCase(SubscriptionResourceId, null, "wheel2")] + [TestCase(SubscriptionResourceId, "wheels", null)] + [TestCase(SubscriptionResourceId, "", "wheel2")] + [TestCase(SubscriptionResourceId, "wheels", " ")] + [TestCase(SubscriptionResourceId, "wheels/spokes", "wheel2")] + [TestCase(SubscriptionResourceId, "wheels", "wheel1/wheel2")] + public void TestAppendSubscriptionChildResource(string resourceId, string childTypeName, string childResourceName) + { + ResourceIdentifier resource = resourceId; + if (childTypeName is null || childResourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (childTypeName.Contains("/") || childResourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else + { + var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; + Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); + } + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SystemAssignedIdentityTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SystemAssignedIdentityTests.cs index 935b0bd75232..93f5f4fa7e5c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SystemAssignedIdentityTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/SystemAssignedIdentityTests.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text.Json; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class SystemAssignedIdentityTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantProviderIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantProviderIdentifierTests.cs index cbae0b92b6c4..6b071b952df6 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantProviderIdentifierTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantProviderIdentifierTests.cs @@ -1,22 +1,22 @@ using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] - public class TenantProviderIdentifierTests + public class TenantProviderIdentifierTests : ResourceIdentifierTests { [TestCase("/providers/Microsoft.Insights")] public void ImplicitConstructorProviderOnly(string resourceProviderID) { string x = resourceProviderID; string y; - TenantProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.IsNotNull(z.Parent); Assert.AreEqual("Microsoft.Insights", z.Provider); Assert.AreEqual("Microsoft.Resources/providers", z.ResourceType.ToString()); - Assert.IsNull(z.Parent.Name); + Assert.AreEqual(string.Empty, z.Parent.Name); if (resourceProviderID is null) { @@ -35,13 +35,13 @@ public void ImplicitConstructorVirtualMachine(string resourceProviderID) { string x = resourceProviderID; string y; - TenantProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.AreEqual("myVmName", z.Name); Assert.AreEqual("Microsoft.Compute/virtualMachines", z.ResourceType.ToString()); Assert.AreEqual("Microsoft.Insights" ,z.Provider); - Assert.AreEqual("Microsoft.Insights", (z.Parent as TenantProviderIdentifier).Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Provider); Assert.AreEqual("Microsoft.Resources/providers", z.Parent.ResourceType.ToString()); if (resourceProviderID is null) @@ -61,17 +61,17 @@ public void ImplicitConstructorSubnet(string resourceProviderID) { string x = resourceProviderID; string y; - TenantProviderIdentifier z = x; + ResourceIdentifier z = x; y = z; Assert.AreEqual("testsubnet", z.Name); Assert.AreEqual("Microsoft.Network/virtualNetworks/subnets", z.ResourceType.ToString()); Assert.AreEqual("Microsoft.Insights", z.Provider); - Assert.AreEqual("Microsoft.Insights", (z.Parent as TenantProviderIdentifier).Provider); - Assert.AreEqual("Microsoft.Insights", (z.Parent.Parent as TenantProviderIdentifier).Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Provider); + Assert.AreEqual("Microsoft.Insights", z.Parent.Parent.Provider); Assert.AreEqual("testvnet", z.Parent.Name); Assert.AreEqual("Microsoft.Network/virtualNetworks", z.Parent.ResourceType.ToString()); - Assert.IsNull(z.Parent.Parent.Name); + Assert.AreEqual("Microsoft.Insights", z.Parent.Parent.Name); Assert.AreEqual("Microsoft.Resources/providers", z.Parent.Parent.ResourceType.ToString()); if (resourceProviderID is null) diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantResourceIdentifierTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantResourceIdentifierTests.cs new file mode 100644 index 000000000000..13083e7e39bb --- /dev/null +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TenantResourceIdentifierTests.cs @@ -0,0 +1,94 @@ +using System; +using NUnit.Framework; + +namespace Azure.ResourceManager.Tests +{ + public class TenantResourceIdentifierTests : ResourceIdentifierTests + { + [TestCase("/providers/Contoso.Widgets/widgets/myWidget/configuration", Description = "singleton homed in a tenant resource")] + [TestCase("/providers/Contoso.Widgets/widgets/myWidget/providers/Contoso.Extensions/extensions/myExtension", Description = "Extension over a subscription resource")] + [TestCase("/providers/Contoso.Widgets/widgets/myWidget/flanges/myFlange", Description = "Child of a subscription resource")] + public void CanParseValidTenantResource(string resourceId) + { + ResourceIdentifier tenant = resourceId; + Assert.AreEqual(resourceId, tenant.ToString()); + } + + [Test] + public void TryGetPropertiesForTenantResource() + { + ResourceIdentifier id1 = "/providers/Contoso.Widgets/widgets/myWidget"; + Assert.AreEqual(false, id1.TryGetSubscriptionId(out _)); + Assert.AreEqual(false, id1.TryGetLocation(out _)); + Assert.AreEqual(false, id1.TryGetResourceGroupName(out _)); + Assert.AreEqual(true, id1.TryGetParent(out _)); + ResourceIdentifier id2 = "/providers/Contoso.Widgets/widgets/myWidget/flages/myFlange"; + ResourceIdentifier parent; + Assert.AreEqual(true, id2.TryGetParent(out parent)); + Assert.AreEqual(true, id1.Equals(parent)); + } + + [Test] + public void ThrowOnMistypedResource() + { + ResourceIdentifier tenant; + Assert.DoesNotThrow(() => tenant = new ResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101")); + Assert.DoesNotThrow(() => tenant = new ResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2")); + Assert.DoesNotThrow(() => tenant = new ResourceIdentifier("/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg")); + Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101"); + Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/locations/westus2"); + Assert.DoesNotThrow(() => tenant = "/subscriptions/6b085460-5f21-477e-ba44-1035046e9101/resourceGroups/myRg"); + } + + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget", "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", null, "roleAssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", null, "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", null)] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "", "roleAssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", " ", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft/Authorization", "roleAssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleA/ssignments", "MyRoleAssignemnt")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "Microsoft.Authorization", "roleAssignments", "MyRole/Assignemnt")] + public void TestAppendTenantProviderResource(string resourceId, string providerNamespace, string resourceTypeName, string resourceName) + { + ResourceIdentifier resource = resourceId; + if (providerNamespace is null || resourceTypeName is null || resourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (string.IsNullOrWhiteSpace(providerNamespace) || string.IsNullOrWhiteSpace(resourceTypeName) || string.IsNullOrWhiteSpace(resourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else if (providerNamespace.Contains("/") || resourceTypeName.Contains("/") || resourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName)); + else + { + var expected = $"{resourceId}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}"; + Assert.AreEqual(expected, resource.AppendProviderResource(providerNamespace, resourceTypeName, resourceName).ToString()); + } + } + + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget", "wheels", "Wheel1")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", "Wheel2")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", null, "wheel2")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", null)] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "", "wheel2")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", " ")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels/spokes", "wheel2")] + [TestCase("/providers/Microsoft.Widgets/widgets/MyWidget/things/MyThing", "wheels", "wheel1/wheel2")] + public void TestAppendTenantChildResource(string resourceId, string childTypeName, string childResourceName) + { + ResourceIdentifier resource = resourceId; + if (childTypeName is null || childResourceName is null) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (string.IsNullOrWhiteSpace(childTypeName) || string.IsNullOrWhiteSpace(childResourceName)) + Assert.Throws(typeof(ArgumentNullException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else if (childTypeName.Contains("/") || childResourceName.Contains("/")) + Assert.Throws(typeof(ArgumentOutOfRangeException), () => resource.AppendChildResource(childTypeName, childResourceName)); + else + { + var expected = $"{resourceId}/{childTypeName}/{childResourceName}"; + Assert.AreEqual(expected, resource.AppendChildResource(childTypeName, childResourceName).ToString()); + } + } + } +} diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TrackedResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TrackedResourceTests.cs index b1cd18d59c7c..8784f59490fe 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TrackedResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/TrackedResourceTests.cs @@ -5,7 +5,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class TrackedResourceTests @@ -14,7 +14,7 @@ public class TrackedResourceTests public void SerializationTest() { string expected = "{\"properties\":{\"location\":\"eastus\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}}"; - TestTrackedResource data = new("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.ClassicStorage/storageAccounts/account1", Location.EastUS); + TestTrackedResource data = new("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.ClassicStorage/storageAccounts/account1", Location.EastUS); data.Tags.Add("key1", "value1"); data.Tags.Add("key2", "value2"); var json = JsonHelper.SerializePropertiesToString(data); @@ -25,7 +25,7 @@ public void SerializationTest() public void InvalidSerializationTest() { string expected = "{\"properties\":{\"location\":\"westus\",\"tags\":{}}}"; - TestTrackedResource data = new("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/foo"); + TestTrackedResource data = new("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/foo"); var json = JsonHelper.SerializePropertiesToString(data); Assert.IsTrue(expected.Equals(json)); } diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/UserAssignedIdentityTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/UserAssignedIdentityTests.cs index 14e40f89d74b..60e83c00df14 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/UserAssignedIdentityTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/UserAssignedIdentityTests.cs @@ -7,7 +7,7 @@ using System.Text; using System.Text.Json; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class UserAssignedIdentityTests diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/WritableSubResourceTests.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/WritableSubResourceTests.cs index 748f718c1f02..b6deeea54c1c 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/WritableSubResourceTests.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Unit/WritableSubResourceTests.cs @@ -3,7 +3,7 @@ using Azure.ResourceManager.TestFramework; using NUnit.Framework; -namespace Azure.ResourceManager.Core.Tests +namespace Azure.ResourceManager.Tests { [Parallelizable] public class WritableSubResourceTests