private static IDictionary <string, string> Match(string a, string b) { var pathA = BlobPathSource.Create(a); BlobPath pathB = null; BlobPath.TryParse(b, false, out pathB); IReadOnlyDictionary <string, object> bindingData = pathA.CreateBindingData(pathB); if (bindingData == null) { return(null); } IDictionary <string, string> matches = new Dictionary <string, string>(); foreach (KeyValuePair <string, object> item in bindingData) { matches.Add(item.Key, item.Value.ToString()); } return(matches); }
public FixedBlobPathSource(BlobPath innerPath) { _innerPath = innerPath; }
private static bool TryParseAndValidate(string value, out string errorMessage, out BlobPath path, bool isContainerBinding = false) { BlobPath possiblePath; if (!isContainerBinding && TryParseAbsUrl(value, out possiblePath)) { path = possiblePath; errorMessage = null; return(true); } if (!TryParse(value, isContainerBinding, out possiblePath)) { errorMessage = $"Invalid blob path specified : '{value}'. Blob identifiers must be in the format 'container/blob'."; path = null; return(false); } if (!BlobClientExtensions.IsValidContainerName(possiblePath.ContainerName)) { errorMessage = "Invalid container name: " + possiblePath.ContainerName; path = null; return(false); } // for container bindings, we allow an empty blob name/path string possibleErrorMessage; if (!(isContainerBinding && string.IsNullOrEmpty(possiblePath.BlobName)) && !BlobClientExtensions.IsValidBlobName(possiblePath.BlobName, out possibleErrorMessage)) { errorMessage = possibleErrorMessage; path = null; return(false); } errorMessage = null; path = possiblePath; return(true); }