/// <summary> /// Finds the resource definition by refId. /// </summary> /// <param name="model">The application model.</param> /// <param name="refId">The refId to search on.</param> /// <returns>The resource definition if found, or null.</returns> public static ResourceDefinition FindResourceDefinitionByRefId(this AzureIntegrationServicesModel model, string refId) { _ = model = model ?? throw new ArgumentNullException(nameof(model)); var results = model.FindAllResourceDefinitions(); return(results.Where(rd => rd.RefId == refId).FirstOrDefault()); }
/// <summary> /// Finds a resource definition with the given resource key. /// </summary> /// <param name="model">The application model.</param> /// <param name="definitionKey">The definition key.</param> /// <param name="definitionType">The definition type.</param> /// <returns>A resource definition, or null if none found.</returns> public static ResourceDefinition FindResourceDefinitionByKey(this AzureIntegrationServicesModel model, string definitionKey, string definitionType) { _ = model ?? throw new ArgumentNullException(nameof(model)); _ = definitionKey ?? throw new ArgumentNullException(nameof(definitionKey)); _ = definitionType ?? throw new ArgumentNullException(nameof(definitionType)); var results = model.FindAllResourceDefinitions(); return(results.Where(rd => rd.Key == definitionKey && rd.Type == definitionType).FirstOrDefault()); }