Skip to content

Commit

Permalink
update Location in preparation to move to Azure.Core (Azure#25464)
Browse files Browse the repository at this point in the history
* finalize changes for RI and Loc objects

* remove regionaldisplayname
implicit and ctor expect name only
change private dictionary to use name directly
factory method to convert from displayName

* add copy from static in ctor case

* remove conditional application of to name logic

* assert regionaldisplayname still shows up after moving to locationExpanded

* switch to properties vs fields

* add param check to ctor for required name

* move FromDisplayName to an internal method on the single class that needs it for now

* remove IComparable on location

* Convert location to struct

* update from feedback

* remove null check on struct

* update keyvault tests

* revert recording change and update vault create to use displayname

* update to use displayname in all vault tests

* update api

* update location to implicitly convert either displayname or name

* update api

* Revert "update to use displayname in all vault tests"

This reverts commit 282fb9f.

* Revert "revert recording change and update vault create to use displayname"

This reverts commit f1f6c2e.

* Revert "update keyvault tests"

This reverts commit 1448e7c.

* temp fix to get autorest updated

* temp change to get private build out for back compat

* Revert "temp fix to get autorest updated"

This reverts commit 6a04eb7.

* Revert "temp change to get private build out for back compat"

This reverts commit dd68c21.

* Update AutoRest C# version to 3.0.0-beta.20211214.1

* Revert "Update AutoRest C# version to 3.0.0-beta.20211214.1"

This reverts commit ef53642.

* temp change for ci

* undo temp change

Co-authored-by: azure-sdk <azuresdk@microsoft.com>
  • Loading branch information
m-nash and azure-sdk authored Dec 17, 2021
1 parent fca611b commit 8c441ff
Show file tree
Hide file tree
Showing 18 changed files with 329 additions and 735 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public sealed partial class ResourceIdentifier : System.IComparable<Azure.Resour
{
public static readonly Azure.ResourceManager.ResourceIdentifier Root;
public ResourceIdentifier(string resourceId) { }
public Azure.ResourceManager.Resources.Models.Location Location { get { throw null; } }
public Azure.ResourceManager.Resources.Models.Location? Location { get { throw null; } }
public string Name { get { throw null; } }
public Azure.ResourceManager.ResourceIdentifier Parent { get { throw null; } }
public string Provider { get { throw null; } }
Expand Down Expand Up @@ -826,7 +826,7 @@ protected ResourceGroupCollection() { }
}
public partial class ResourceGroupData : Azure.ResourceManager.Models.TrackedResource
{
public ResourceGroupData(string location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { }
public ResourceGroupData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { }
public string ManagedBy { get { throw null; } set { } }
public Azure.ResourceManager.Resources.Models.ResourceGroupProperties Properties { get { throw null; } set { } }
}
Expand Down Expand Up @@ -877,15 +877,17 @@ protected SubscriptionCollection() { }
System.Collections.Generic.IEnumerator<Azure.ResourceManager.Resources.Subscription> System.Collections.Generic.IEnumerable<Azure.ResourceManager.Resources.Subscription>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class SubscriptionData : Azure.ResourceManager.Models.TrackedResource
public partial class SubscriptionData
{
internal SubscriptionData() : base (default(Azure.ResourceManager.Resources.Models.Location)) { }
internal SubscriptionData() { }
public string AuthorizationSource { get { throw null; } }
public string DisplayName { get { throw null; } }
public virtual Azure.ResourceManager.ResourceIdentifier Id { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.ResourceManager.Resources.Models.ManagedByTenant> ManagedByTenants { get { throw null; } }
public Azure.ResourceManager.Resources.Models.SubscriptionState? State { get { throw null; } }
public string SubscriptionGuid { get { throw null; } }
public Azure.ResourceManager.Resources.Models.SubscriptionPolicies SubscriptionPolicies { get { throw null; } }
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } }
public string TenantId { get { throw null; } }
}
public partial class TagResource : Azure.ResourceManager.Core.ArmResource
Expand Down Expand Up @@ -1049,75 +1051,76 @@ public partial class FeatureProperties
internal FeatureProperties() { }
public string State { get { throw null; } }
}
public partial class Location : System.IComparable<Azure.ResourceManager.Resources.Models.Location>, System.IEquatable<Azure.ResourceManager.Resources.Models.Location>
{
public static readonly Azure.ResourceManager.Resources.Models.Location AustraliaCentral;
public static readonly Azure.ResourceManager.Resources.Models.Location AustraliaCentral2;
public static readonly Azure.ResourceManager.Resources.Models.Location AustraliaEast;
public static readonly Azure.ResourceManager.Resources.Models.Location AustraliaSoutheast;
public static readonly Azure.ResourceManager.Resources.Models.Location BrazilSouth;
public static readonly Azure.ResourceManager.Resources.Models.Location BrazilSoutheast;
public static readonly Azure.ResourceManager.Resources.Models.Location CanadaCentral;
public static readonly Azure.ResourceManager.Resources.Models.Location CanadaEast;
public static readonly Azure.ResourceManager.Resources.Models.Location CentralIndia;
public static readonly Azure.ResourceManager.Resources.Models.Location CentralUS;
public static readonly Azure.ResourceManager.Resources.Models.Location EastAsia;
public static readonly Azure.ResourceManager.Resources.Models.Location EastUS;
public static readonly Azure.ResourceManager.Resources.Models.Location EastUS2;
public static readonly Azure.ResourceManager.Resources.Models.Location FranceCentral;
public static readonly Azure.ResourceManager.Resources.Models.Location FranceSouth;
public static readonly Azure.ResourceManager.Resources.Models.Location GermanyNorth;
public static readonly Azure.ResourceManager.Resources.Models.Location GermanyWestCentral;
public static readonly Azure.ResourceManager.Resources.Models.Location JapanEast;
public static readonly Azure.ResourceManager.Resources.Models.Location JapanWest;
public static readonly Azure.ResourceManager.Resources.Models.Location KoreaCentral;
public static readonly Azure.ResourceManager.Resources.Models.Location KoreaSouth;
public static readonly Azure.ResourceManager.Resources.Models.Location NorthCentralUS;
public static readonly Azure.ResourceManager.Resources.Models.Location NorthEurope;
public static readonly Azure.ResourceManager.Resources.Models.Location NorwayWest;
public static readonly Azure.ResourceManager.Resources.Models.Location SouthAfricaNorth;
public static readonly Azure.ResourceManager.Resources.Models.Location SouthAfricaWest;
public static readonly Azure.ResourceManager.Resources.Models.Location SouthCentralUS;
public static readonly Azure.ResourceManager.Resources.Models.Location SoutheastAsia;
public static readonly Azure.ResourceManager.Resources.Models.Location SouthIndia;
public static readonly Azure.ResourceManager.Resources.Models.Location SwitzerlandNorth;
public static readonly Azure.ResourceManager.Resources.Models.Location SwitzerlandWest;
public static readonly Azure.ResourceManager.Resources.Models.Location UAECentral;
public static readonly Azure.ResourceManager.Resources.Models.Location UAENorth;
public static readonly Azure.ResourceManager.Resources.Models.Location UKSouth;
public static readonly Azure.ResourceManager.Resources.Models.Location UKWest;
public static readonly Azure.ResourceManager.Resources.Models.Location WestCentralUS;
public static readonly Azure.ResourceManager.Resources.Models.Location WestEurope;
public static readonly Azure.ResourceManager.Resources.Models.Location WestIndia;
public static readonly Azure.ResourceManager.Resources.Models.Location WestUS;
public static readonly Azure.ResourceManager.Resources.Models.Location WestUS2;
protected Location() { }
public string CanonicalName { get { throw null; } }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct Location : System.IEquatable<Azure.ResourceManager.Resources.Models.Location>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public Location(string location) { throw null; }
public Location(string name, string displayName) { throw null; }
public static Azure.ResourceManager.Resources.Models.Location AustraliaCentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location AustraliaCentral2 { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location AustraliaEast { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location AustraliaSoutheast { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location BrazilSouth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location BrazilSoutheast { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location CanadaCentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location CanadaEast { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location CentralIndia { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location CentralUS { get { throw null; } }
public string DisplayName { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location EastAsia { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location EastUS { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location EastUS2 { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location FranceCentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location FranceSouth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location GermanyNorth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location GermanyWestCentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location JapanEast { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location JapanWest { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location KoreaCentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location KoreaSouth { get { throw null; } }
public string Name { get { throw null; } }
public string RegionalDisplayName { get { throw null; } }
public int CompareTo(Azure.ResourceManager.Resources.Models.Location other) { throw null; }
public static Azure.ResourceManager.Resources.Models.Location NorthCentralUS { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location NorthEurope { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location NorwayWest { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SouthAfricaNorth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SouthAfricaWest { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SouthCentralUS { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SoutheastAsia { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SouthIndia { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SwitzerlandNorth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location SwitzerlandWest { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location UAECentral { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location UAENorth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location UKSouth { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location UKWest { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location WestCentralUS { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location WestEurope { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location WestIndia { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location WestUS { get { throw null; } }
public static Azure.ResourceManager.Resources.Models.Location WestUS2 { get { throw null; } }
public bool Equals(Azure.ResourceManager.Resources.Models.Location other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public static bool operator >(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public static bool operator >=(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public static implicit operator string (Azure.ResourceManager.Resources.Models.Location other) { throw null; }
public static implicit operator Azure.ResourceManager.Resources.Models.Location (string other) { throw null; }
public static bool operator !=(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public static bool operator <(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public static bool operator <=(Azure.ResourceManager.Resources.Models.Location left, Azure.ResourceManager.Resources.Models.Location right) { throw null; }
public override string ToString() { throw null; }
}
public partial class LocationExpanded : Azure.ResourceManager.Resources.Models.Location
public partial class LocationExpanded
{
protected LocationExpanded() { }
public string DisplayName { get { throw null; } }
public string Id { get { throw null; } }
public Azure.ResourceManager.Resources.Models.LocationMetadata Metadata { get { throw null; } }
public string Name { get { throw null; } }
public string RegionalDisplayName { get { throw null; } }
public string SubscriptionId { get { throw null; } }
public static implicit operator Azure.ResourceManager.Resources.Models.Location (Azure.ResourceManager.Resources.Models.LocationExpanded location) { throw null; }
}
public partial class LocationMetadata
{
Expand Down
5 changes: 3 additions & 2 deletions sdk/resourcemanager/Azure.ResourceManager/src/ArmResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
using System.Linq;
using System.Text;

namespace Azure.ResourceManager.Core
{
Expand Down Expand Up @@ -129,7 +130,7 @@ protected IEnumerable<Location> ListAvailableLocations(ResourceType resourceType
var theResource = resourcePageableProvider.ResourceTypes.FirstOrDefault(r => resourceType.Type.Equals(r.ResourceType));
if (theResource is null)
throw new InvalidOperationException($"{resourceType.Type} not found for {resourceType.Type}");
return theResource.Locations.Select(l => (Location)l);
return theResource.Locations.Select(l => new Location(l));
}

/// <summary>
Expand All @@ -146,7 +147,7 @@ protected async Task<IEnumerable<Location>> ListAvailableLocationsAsync(Resource
var theResource = resourcePageableProvider.ResourceTypes.FirstOrDefault(r => resourceType.Type.Equals(r.ResourceType));
if (theResource is null)
throw new InvalidOperationException($"{resourceType.Type} not found for {resourceType.Type}");
return theResource.Locations.Select(l => (Location)l);
return theResource.Locations.Select(l => new Location(l));
}
}
}
Loading

0 comments on commit 8c441ff

Please sign in to comment.