/// <summary> /// Creates a new <see cref="ResourceId"/> /// </summary> /// <param name="resourceId">The fully-qualified resource Id</param> /// <param name="output">The resource Id</param> public static bool TryParse(string resourceId, out ResourceId output) { ResourceGroupLevelResourceId groupLevelResourceId; if (ResourceGroupLevelResourceId.TryParse(resourceId, out groupLevelResourceId)) { output = groupLevelResourceId; return(true); } SubscriptionLevelResourceId subscriptionLevelResourceId; if (SubscriptionLevelResourceId.TryParse(resourceId, out subscriptionLevelResourceId)) { output = subscriptionLevelResourceId; return(true); } TenantLevelResourceId tenantLevelResourceId; if (TenantLevelResourceId.TryParse(resourceId, out tenantLevelResourceId)) { output = tenantLevelResourceId; return(true); } output = null; return(false); }
/// <summary> /// Creates a new <see cref="ResourceGroupLevelResourceId"/> /// </summary> /// <param name="resourceId">The resource Id string</param> public static ResourceGroupLevelResourceId Parse(string resourceId) { ResourceGroupLevelResourceId output; if (!ResourceGroupLevelResourceId.TryParse(resourceId, out output)) { throw new ArgumentException($"Unable to parse fully qualified resource id '{resourceId}'.", nameof(resourceId)); } return(output); }