本文整理汇总了C#中Subscription.GetCoreRestClient20131101方法的典型用法代码示例。如果您正苦于以下问题:C# Subscription.GetCoreRestClient20131101方法的具体用法?C# Subscription.GetCoreRestClient20131101怎么用?C# Subscription.GetCoreRestClient20131101使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription.GetCoreRestClient20131101方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAsync
internal async Task CreateAsync(Subscription subscription)
{
Contract.Requires(Subscription == null);
Contract.Requires(subscription != null);
Contract.Requires(!string.IsNullOrWhiteSpace(ServiceName));
Contract.Requires(!string.IsNullOrWhiteSpace(Label));
Contract.Requires(Location == null || Location.Trim().Length > 0);
Contract.Requires(AffinityGroup == null || AffinityGroup.Trim().Length > 0);
Contract.Requires((Location == null) != (AffinityGroup == null));
var azureNamespace = XmlNamespaces.WindowsAzure;
var content = new XElement(azureNamespace + "CreateStorageServiceInput",
new XElement(azureNamespace + "ServiceName", ServiceName),
string.IsNullOrWhiteSpace(Description) ? null : new XElement(azureNamespace + "Description", Description),
new XElement(azureNamespace + "Label", Label.ToBase64String()),
string.IsNullOrWhiteSpace(Location) ? null : new XElement(azureNamespace + "Location", Location),
string.IsNullOrWhiteSpace(AffinityGroup) ? null : new XElement(azureNamespace + "AffinityGroup", AffinityGroup),
new XElement(azureNamespace + "GeoReplicationEnabled", GeoReplicationEnabled ? "true" : "false"),
ExtendedProperties == null || ExtendedProperties.Count == 0
? new XElement(azureNamespace + "ExtendedProperties")
: new XElement(azureNamespace + "ExtendedProperties", ExtendedProperties.Select(kv =>
new XElement(azureNamespace + "ExtendedProperty",
new XElement(azureNamespace + "Name", kv.Key),
new XElement(azureNamespace + "Value", kv.Value)))),
new XElement(azureNamespace + "SecondaryReadEnabled", SecondaryReadEnabled ? "true" : "false"));
var hc = subscription.GetCoreRestClient20131101("services/storageservices");
await hc.PostAsync(content);
Subscription = subscription;
}