当前位置: 首页>>代码示例>>C#>>正文


C# CloudStorageAccount.CreateCloudBlobClient方法代码示例

本文整理汇总了C#中CloudStorageAccount.CreateCloudBlobClient方法的典型用法代码示例。如果您正苦于以下问题:C# CloudStorageAccount.CreateCloudBlobClient方法的具体用法?C# CloudStorageAccount.CreateCloudBlobClient怎么用?C# CloudStorageAccount.CreateCloudBlobClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CloudStorageAccount的用法示例。


在下文中一共展示了CloudStorageAccount.CreateCloudBlobClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloudStorageAccountClientUriVerify

        public void CloudStorageAccountClientUriVerify()
        {
            StorageCredentials cred = new StorageCredentials(TestBase.TargetTenantConfig.AccountName, TestBase.TargetTenantConfig.AccountKey);
            CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(cred, true);

            CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();
            CloudBlobContainer container = blobClient.GetContainerReference("container1");
            Assert.AreEqual(cloudStorageAccount.BlobEndpoint.ToString() + "container1", container.Uri.ToString());

            CloudQueueClient queueClient = cloudStorageAccount.CreateCloudQueueClient();
            CloudQueue queue = queueClient.GetQueueReference("queue1");
            Assert.AreEqual(cloudStorageAccount.QueueEndpoint.ToString() + "queue1", queue.Uri.ToString());

            CloudTableClient tableClient = cloudStorageAccount.CreateCloudTableClient();
            CloudTable table = tableClient.GetTableReference("table1");
            Assert.AreEqual(cloudStorageAccount.TableEndpoint.ToString() + "table1", table.Uri.ToString());
        }
开发者ID:jdkillian,项目名称:azure-sdk-for-net,代码行数:17,代码来源:CloudStorageAccountTests.cs

示例2: CloudStorageAccountWithStorageUri

        public void CloudStorageAccountWithStorageUri()
        {
            StorageUri blobEndpoint = new StorageUri(
                new Uri("http://" + AccountName + BlobService + EndpointSuffix),
                new Uri("http://" + AccountName + SecondarySuffix + BlobService + EndpointSuffix));

            StorageUri queueEndpoint = new StorageUri(
                new Uri("http://" + AccountName + QueueService + EndpointSuffix),
                new Uri("http://" + AccountName + SecondarySuffix + QueueService + EndpointSuffix));

            StorageUri tableEndpoint = new StorageUri(
                new Uri("http://" + AccountName + TableService + EndpointSuffix),
                new Uri("http://" + AccountName + SecondarySuffix + TableService + EndpointSuffix));

            StorageUri fileEndpoint = new StorageUri(
                new Uri("http://" + AccountName + FileService + EndpointSuffix),
                new Uri("http://" + AccountName + SecondarySuffix + FileService + EndpointSuffix));

#if WINDOWS_RT || ASPNET_K
            CloudStorageAccount account = CloudStorageAccount.Create(new StorageCredentials(), blobEndpoint, queueEndpoint, tableEndpoint, fileEndpoint);
#else
            CloudStorageAccount account = new CloudStorageAccount(new StorageCredentials(), blobEndpoint, queueEndpoint, tableEndpoint, fileEndpoint);
#endif
            Assert.IsTrue(blobEndpoint.Equals(account.BlobStorageUri));
            Assert.IsTrue(queueEndpoint.Equals(account.QueueStorageUri));
            Assert.IsTrue(tableEndpoint.Equals(account.TableStorageUri));
            Assert.IsTrue(fileEndpoint.Equals(account.FileStorageUri));

            account = new CloudStorageAccount(new StorageCredentials(AccountName, TestBase.StorageCredentials.ExportBase64EncodedKey()), false);
            Assert.IsTrue(blobEndpoint.Equals(account.BlobStorageUri));
            Assert.IsTrue(queueEndpoint.Equals(account.QueueStorageUri));
            Assert.IsTrue(tableEndpoint.Equals(account.TableStorageUri));
            Assert.IsTrue(fileEndpoint.Equals(account.FileStorageUri));

            account = CloudStorageAccount.Parse(string.Format("DefaultEndpointsProtocol=http;AccountName={0};AccountKey=", AccountName));
            Assert.IsTrue(blobEndpoint.Equals(account.BlobStorageUri));
            Assert.IsTrue(queueEndpoint.Equals(account.QueueStorageUri));
            Assert.IsTrue(tableEndpoint.Equals(account.TableStorageUri));
            Assert.IsTrue(fileEndpoint.Equals(account.FileStorageUri));

            Assert.IsTrue(blobEndpoint.Equals(account.CreateCloudBlobClient().StorageUri));
            Assert.IsTrue(queueEndpoint.Equals(account.CreateCloudQueueClient().StorageUri));
            Assert.IsTrue(tableEndpoint.Equals(account.CreateCloudTableClient().StorageUri));
            Assert.IsTrue(fileEndpoint.Equals(account.CreateCloudFileClient().StorageUri));

            Assert.IsTrue(blobEndpoint.PrimaryUri.Equals(account.BlobEndpoint));
            Assert.IsTrue(queueEndpoint.PrimaryUri.Equals(account.QueueEndpoint));
            Assert.IsTrue(tableEndpoint.PrimaryUri.Equals(account.TableEndpoint));
            Assert.IsTrue(fileEndpoint.PrimaryUri.Equals(account.FileEndpoint));
        }
开发者ID:DaC24,项目名称:azure-storage-net,代码行数:50,代码来源:StorageUriTests.cs

示例3: CloudStorageAccountClientMethods

        public void CloudStorageAccountClientMethods()
        {
            CloudStorageAccount account = new CloudStorageAccount(TestBase.StorageCredentials, false);
            CloudBlobClient blob = account.CreateCloudBlobClient();
            CloudQueueClient queue = account.CreateCloudQueueClient();
            CloudTableClient table = account.CreateCloudTableClient();

            // check endpoints
            Assert.AreEqual(account.BlobEndpoint, blob.BaseUri, "Blob endpoint doesn't match account");
            Assert.AreEqual(account.QueueEndpoint, queue.BaseUri, "Queue endpoint doesn't match account");
            Assert.AreEqual(account.TableEndpoint, table.BaseUri, "Table endpoint doesn't match account");

            // check storage uris
            Assert.AreEqual(account.BlobStorageUri, blob.StorageUri, "Blob endpoint doesn't match account");
            Assert.AreEqual(account.QueueStorageUri, queue.StorageUri, "Queue endpoint doesn't match account");
            Assert.AreEqual(account.TableStorageUri, table.StorageUri, "Table endpoint doesn't match account");

            // check creds
            Assert.AreEqual(account.Credentials, blob.Credentials, "Blob creds don't match account");
            Assert.AreEqual(account.Credentials, queue.Credentials, "Queue creds don't match account");
            Assert.AreEqual(account.Credentials, table.Credentials, "Table creds don't match account");
        }
开发者ID:BurtHarris,项目名称:azure-storage-net,代码行数:22,代码来源:CloudStorageAccountTests.cs

示例4: CleanupResourcesAsync

        /// <summary>
        /// Deletes the job and pool
        /// </summary>
        /// <param name="batchClient">The BatchClient to use when interacting with the Batch service.</param>
        /// <param name="jobId">The ID of the job.</param>
        /// <param name="blobContainerNames">The name of the containers created for the jobs resource files.</param>
        /// <returns>An asynchronous <see cref="Task"/> representing the operation.</returns>
        private async Task CleanupResourcesAsync(BatchClient batchClient, string jobId, IEnumerable<string> blobContainerNames)
        {
            // Delete the blob containers which contain the task input files since we no longer need them
            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new StorageCredentials(this.configurationSettings.StorageAccountName,
                    this.configurationSettings.StorageAccountKey),
                    new Uri(this.configurationSettings.StorageBlobEndpoint),
                    null,
                    null,
                    null);

            CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
            foreach (string blobContainerName in blobContainerNames)
            {
                CloudBlobContainer container = cloudBlobClient.GetContainerReference(blobContainerName);
                Console.WriteLine("Deleting container: {0}", blobContainerName);
                
                await container.DeleteAsync();
            }

            // Delete the job to ensure the tasks are cleaned up
            if (!string.IsNullOrEmpty(jobId) && this.configurationSettings.ShouldDeleteJob)
            {
                Console.WriteLine("Deleting job: {0}", jobId);
                await batchClient.JobOperations.DeleteJobAsync(jobId);
            }

            if (this.configurationSettings.ShouldDeletePool)
            {
                Console.WriteLine("Deleting pool: {0}", this.configurationSettings.PoolId);
                await batchClient.PoolOperations.DeletePoolAsync(this.configurationSettings.PoolId);
            }
        }
开发者ID:haricr,项目名称:azure-batch-samples,代码行数:40,代码来源:JobSubmitter.cs


注:本文中的CloudStorageAccount.CreateCloudBlobClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。