/// <summary> /// Verifies if a tracked resource has a corresponding ListBySubscription operation /// </summary> /// <param name="definitions"></param> /// <param name="context"></param> /// <returns></returns> public override IEnumerable <ValidationMessage> GetValidationMessages(Dictionary <string, Schema> definitions, RuleContext context) { // Retrieve the list of TrackedResources IEnumerable <string> parentTrackedResources = context.ParentTrackedResourceModels; foreach (string trackedResource in parentTrackedResources) { Operation operation = ValidationUtilities.GetListBySubscriptionOperation(trackedResource, definitions, context.Root); if (operation == null) { yield return(new ValidationMessage(new FileObjectPath(context.File, context.Path.AppendProperty(trackedResource)), this, trackedResource)); } } }
public override IEnumerable <ValidationMessage> GetValidationMessages(Dictionary <string, Schema> definitions, RuleContext context) { IEnumerable <string> parentTrackedResourceModels = context.ParentTrackedResourceModels; foreach (string resourceModel in parentTrackedResourceModels) { Operation listByResourceGroupOperation = ValidationUtilities.GetListByResourceGroupOperation(resourceModel, definitions, context.Root); Operation listBySubscriptionOperation = ValidationUtilities.GetListBySubscriptionOperation(resourceModel, definitions, context.Root); if (listByResourceGroupOperation != null && listBySubscriptionOperation != null) { JObject rgXMSPageableExtension = (JObject)listByResourceGroupOperation.Extensions[ValidationUtilities.XmsPageable]; JObject subXMSPageableExtension = (JObject)listBySubscriptionOperation.Extensions[ValidationUtilities.XmsPageable]; if (!IsEqual(rgXMSPageableExtension, subXMSPageableExtension)) { yield return(new ValidationMessage(new FileObjectPath(context.File, context.Path.AppendProperty(resourceModel)), this, resourceModel)); } } } }