Пример #1
0
        public BlobFeedAction(string expectedFeedUrl, string accountKey, MSBuild.TaskLoggingHelper Log)
        {
            // This blob feed action regex is custom because of the way that nuget handles query strings (it doesn't)
            // Instead of encoding the query string containing the SAS at the end of the URL we encode it at the beginning.
            // As a result, we can't parse this feed url like a traditional feed url.  When this changes, this code could be simplified and
            // BlobUriParser could be used instead.
            this.Log = Log;
            Match m = Regex.Match(expectedFeedUrl, feedRegex);

            if (m.Success)
            {
                string accountName   = m.Groups["accountname"].Value;
                string containerName = m.Groups["containername"].Value;
                string relativePath  = m.Groups["relativepath"].Value;
                feed     = new BlobFeed(accountName, accountKey, containerName, relativePath, Log);
                feedUrl  = m.Groups["feedurl"].Value;
                hasToken = !string.IsNullOrEmpty(m.Groups["token"].Value);

                source = new SleetSource
                {
                    Name             = feed.ContainerName,
                    Type             = "azure",
                    Path             = feedUrl,
                    Container        = feed.ContainerName,
                    FeedSubPath      = feed.RelativePath,
                    ConnectionString = $"DefaultEndpointsProtocol=https;AccountName={feed.AccountName};AccountKey={feed.AccountKey};EndpointSuffix=core.windows.net"
                };
            }
            else
            {
                throw new Exception("Unable to parse expected feed. Please check ExpectedFeedUrl.");
            }
        }
Пример #2
0
        public BlobFeedAction(string expectedFeedUrl, string accountKey, MSBuild.TaskLoggingHelper Log)
        {
            this.Log = Log;
            Match m = Regex.Match(expectedFeedUrl, feedRegex);

            if (m.Success)
            {
                string accountName   = m.Groups["accountname"].Value;
                string containerName = m.Groups["containername"].Value;
                string relativePath  = m.Groups["relativepath"].Value;
                feed     = new BlobFeed(accountName, accountKey, containerName, relativePath, Log);
                feedUrl  = m.Groups["feedurl"].Value;
                hasToken = !string.IsNullOrEmpty(m.Groups["token"].Value);

                source = new SleetSource
                {
                    Name             = feed.ContainerName,
                    Type             = "azure",
                    Path             = feedUrl,
                    Container        = feed.ContainerName,
                    FeedSubPath      = feed.RelativePath,
                    ConnectionString = $"DefaultEndpointsProtocol=https;AccountName={feed.AccountName};AccountKey={feed.AccountKey};EndpointSuffix=core.windows.net"
                };
            }
            else
            {
                throw new Exception("Unable to parse expected feed. Please check ExpectedFeedUrl.");
            }
        }
Пример #3
0
        public BlobFeedAction(string expectedFeedUrl, string accountKey, string indexDirectory, MSBuild.TaskLoggingHelper Log)
        {
            this.Log = Log;
            Match m = Regex.Match(expectedFeedUrl, feedRegex);

            if (m.Success)
            {
                string accountName   = m.Groups["accountname"].Value;
                string containerName = m.Groups["containername"].Value;
                string relativePath  = m.Groups["relativepath"].Value;
                string feedUrl       = m.Groups["feedurl"].Value;

                bool isPublic = string.IsNullOrWhiteSpace(m.Groups["token"].Value);
                this.feed = new BlobFeed(accountName, accountKey, containerName, feedUrl, string.IsNullOrWhiteSpace(indexDirectory) ? Path.GetTempPath() : indexDirectory, Log, isPublic);
            }
            else
            {
                throw new Exception("Unable to parse expected feed. Please check ExpectedFeedUrl.");
            }
        }
Пример #4
0
 public BlobFeedAction(string accountName, string accountKey, string containerName, string indexDirectory, MSBuild.TaskLoggingHelper Log)
 {
     this.feed = new BlobFeed(accountName, accountKey, containerName, string.IsNullOrWhiteSpace(indexDirectory) ? Path.GetTempPath() : indexDirectory, Log);
     this.Log  = Log;
 }