本文整理匯總了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();
}