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


C# CloudTableClient.GetServiceProperties方法代码示例

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


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

示例1: TestCorsRules

        private void TestCorsRules(CloudTableClient client, IList<CorsRule> corsProps)
        {
            props.Cors.CorsRules.Clear();

            foreach (CorsRule rule in corsProps)
            {
                props.Cors.CorsRules.Add(rule);
            }

            client.SetServiceProperties(props);
            TestHelper.AssertServicePropertiesAreEqual(props, client.GetServiceProperties());
        }
开发者ID:BurtHarris,项目名称:azure-storage-net,代码行数:12,代码来源:TableAnalyticsUnitTests.cs

示例2: TableSasInvalidOperations

        public void TableSasInvalidOperations()
        {
            CloudTableClient tableClient = GenerateCloudTableClient();
            CloudTable table = tableClient.GetTableReference("T" + Guid.NewGuid().ToString("N"));

            try
            {
                table.Create();
                // Prepare SAS authentication with full permissions
                string sasString = table.GetSharedAccessSignature(
                                        new SharedAccessTablePolicy
                                        {
                                            Permissions = SharedAccessTablePermissions.Delete,
                                            SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(30)
                                        },
                                        null,
                                        null,
                                        null,
                                        null,
                                        null);

                CloudTableClient sasClient = new CloudTableClient(tableClient.BaseUri, new StorageCredentials(sasString));

                // Construct a valid set of service properties to upload.
                ServiceProperties properties = new ServiceProperties();
                properties.Logging.Version = Constants.AnalyticsConstants.LoggingVersionV1;
                properties.HourMetrics.Version = Constants.AnalyticsConstants.MetricsVersionV1;
                properties.Logging.RetentionDays = 9;
                sasClient.GetServiceProperties();
                sasClient.SetServiceProperties(properties);

                // Test invalid client operations
                // BUGBUG: ListTables hides the exception. We should fix this
                // TestHelpers.ExpectedException(() => sasClient.ListTablesSegmented(), "List tables with SAS", HttpStatusCode.Forbidden);
                TestHelper.ExpectedException((ctx) => sasClient.GetServiceProperties(), "Get service properties with SAS", (int)HttpStatusCode.Forbidden);
                TestHelper.ExpectedException((ctx) => sasClient.SetServiceProperties(properties), "Set service properties with SAS", (int)HttpStatusCode.Forbidden);

                CloudTable sasTable = sasClient.GetTableReference(table.Name);

                // Verify that creation fails with SAS
                TestHelper.ExpectedException((ctx) => sasTable.Create(null, ctx), "Create a table with SAS", (int)HttpStatusCode.Forbidden);

                // Create the table.
                table.Create();

                // Test invalid table operations
                TestHelper.ExpectedException((ctx) => sasTable.Delete(null, ctx), "Delete a table with SAS", (int)HttpStatusCode.Forbidden);
                TestHelper.ExpectedException((ctx) => sasTable.GetPermissions(null, ctx), "Get ACL with SAS", (int)HttpStatusCode.Forbidden);
                TestHelper.ExpectedException((ctx) => sasTable.SetPermissions(new TablePermissions(), null, ctx), "Set ACL with SAS", (int)HttpStatusCode.Forbidden);
            }
            finally
            {
                table.DeleteIfExists();
            }
        }
开发者ID:rwalka,项目名称:azure-storage-net,代码行数:55,代码来源:TableSasUnitTests.cs

示例3: MyClassInitialize

 public static void MyClassInitialize(TestContext testContext)
 {
     client = GenerateCloudTableClient();
     startProperties = client.GetServiceProperties();
 }
开发者ID:BurtHarris,项目名称:azure-storage-net,代码行数:5,代码来源:TableAnalyticsUnitTests.cs


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