コード例 #1
0
        private void parseException(string uri)
        {
            string bucket;
            string region;
            string itemLocalPath;
            IDictionary <string, string> queryParams;

            S3V4URLHelpers.Parse(uri, out bucket, out region, out itemLocalPath, out queryParams);
        }
コード例 #2
0
        public S3V4URI(string path)
        {
            m_Path = path;//.TrimEnd('/');
            m_Uri  = new Uri(path);

            S3V4URLHelpers.Parse(m_Uri, out m_Bucket, out m_Region, out m_LocalPath, out m_QueryParams);

            m_LocalName  = m_Uri.GetLocalName();
            m_ParentPath = m_Uri.GetParentURL();
        }
コード例 #3
0
        public void ParseFolderFile()
        {
            string bucket;
            string region;
            string itemLocalPath;

            S3V4URLHelpers.Parse("https://it-adapter.s3-ap-southeast-1.amazonaws.com/MyFolder/MyFile1.txt", out bucket, out region, out itemLocalPath);

            Assert.AreEqual("it-adapter", bucket);
            Assert.AreEqual("ap-southeast-1", region);
            Assert.AreEqual("MyFolder/MyFile1.txt", itemLocalPath);
        }
コード例 #4
0
        public void ParseFolderRoot()
        {
            string bucket;
            string region;
            string itemLocalPath;

            S3V4URLHelpers.Parse("https://dxw.s3-us-west-2.amazonaws.com/MyFolder/", out bucket, out region, out itemLocalPath);

            Assert.AreEqual("dxw", bucket);
            Assert.AreEqual("us-west-2", region);
            Assert.AreEqual("MyFolder/", itemLocalPath);
        }
コード例 #5
0
        public void ParseDefaultRegion()
        {
            string bucket;
            string region;
            string itemLocalPath;

            S3V4URLHelpers.Parse("https://dxw.s3.amazonaws.com/", out bucket, out region, out itemLocalPath);

            Assert.AreEqual("dxw", bucket);
            Assert.AreEqual(S3V4URLHelpers.US_EAST_1, region);
            Assert.AreEqual(string.Empty, itemLocalPath);
        }
コード例 #6
0
        public void ParseRoot()
        {
            string bucket;
            string region;
            string itemLocalPath;

            S3V4URLHelpers.Parse("https://dxw.s3-us-west-2.amazonaws.com/", out bucket, out region, out itemLocalPath);

            Aver.AreEqual("dxw", bucket);
            Aver.AreEqual("us-west-2", region);
            Aver.AreEqual(string.Empty, itemLocalPath);
        }
コード例 #7
0
        public void ParseFolderFileParameters()
        {
            string bucket;
            string region;
            string itemLocalPath;
            IDictionary <string, string> queryParams;

            S3V4URLHelpers.Parse("https://dxw.s3-us-west-2.amazonaws.com/MyFolder/MyFile1.txt?marker=1&max-keys=100",
                                 out bucket, out region, out itemLocalPath, out queryParams);

            Assert.AreEqual("dxw", bucket);
            Assert.AreEqual("us-west-2", region);
            Assert.AreEqual("MyFolder/MyFile1.txt", itemLocalPath);

            Assert.IsNotNull(queryParams);
            Assert.AreEqual(2, queryParams.Count);
            Assert.IsTrue(queryParams.ContainsKey("marker"));
            Assert.IsTrue(queryParams.ContainsKey("max-keys"));
            Assert.AreEqual("1", queryParams["marker"]);
            Assert.AreEqual("100", queryParams["max-keys"]);
        }