本文整理汇总了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());
}
示例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();
}
}
示例3: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
client = GenerateCloudTableClient();
startProperties = client.GetServiceProperties();
}