本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.Clean方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceProperties.Clean方法的具体用法?C# ServiceProperties.Clean怎么用?C# ServiceProperties.Clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties
的用法示例。
在下文中一共展示了ServiceProperties.Clean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCmdlet
public override void ExecuteCmdlet()
{
ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.Clean();
serviceProperties.Cors = currentServiceProperties.Cors;
serviceProperties.Cors.CorsRules.Clear();
Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
GetRequestOptions(ServiceType), OperationContext);
}
示例2: ExecuteCmdlet
public override void ExecuteCmdlet()
{
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.Clean();
serviceProperties.Cors = new CorsProperties();
foreach (var corsRuleObject in this.CorsRules)
{
CorsRule corsRule = new CorsRule();
corsRule.AllowedHeaders = corsRuleObject.AllowedHeaders;
corsRule.AllowedOrigins = corsRuleObject.AllowedOrigins;
corsRule.ExposedHeaders = corsRuleObject.ExposedHeaders;
corsRule.MaxAgeInSeconds = corsRuleObject.MaxAgeInSeconds;
this.SetAllowedMethods(corsRule, corsRuleObject.AllowedMethods);
serviceProperties.Cors.CorsRules.Add(corsRule);
}
try
{
Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
GetRequestOptions(ServiceType), OperationContext);
}
catch (StorageException se)
{
if ((null != se.RequestInformation) &&
((int)HttpStatusCode.BadRequest == se.RequestInformation.HttpStatusCode) &&
(null != se.RequestInformation.ExtendedErrorInformation) &&
(string.Equals(InvalidXMLNodeValueError, se.RequestInformation.ExtendedErrorInformation.ErrorCode, StringComparison.OrdinalIgnoreCase) ||
string.Equals(InvalidXMLDocError, se.RequestInformation.ExtendedErrorInformation.ErrorCode, StringComparison.OrdinalIgnoreCase)))
{
throw new InvalidOperationException(Resources.CORSRuleError);
}
else
{
throw;
}
}
if (PassThru)
{
WriteObject(this.CorsRules);
}
}
示例3: ExecuteCmdlet
public override void ExecuteCmdlet()
{
CloudStorageAccount account = GetCloudStorageAccount();
ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(account, ServiceType, GetRequestOptions(ServiceType), OperationContext);
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.Clean();
serviceProperties.Logging = currentServiceProperties.Logging;
UpdateServiceProperties(serviceProperties.Logging);
Channel.SetStorageServiceProperties(account, ServiceType, serviceProperties,
GetRequestOptions(ServiceType), OperationContext);
if (PassThru)
{
WriteObject(serviceProperties.Logging);
}
}
示例4: ExecuteCmdlet
public override void ExecuteCmdlet()
{
if (StorageServiceType.File == ServiceType)
{
throw new PSInvalidOperationException(Resources.FileNotSupportMetrics);
}
ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.Clean();
bool isHourMetrics = false;
switch (MetricsType)
{
case ServiceMetricsType.Hour:
serviceProperties.HourMetrics = currentServiceProperties.HourMetrics;
UpdateServiceProperties(serviceProperties.HourMetrics);
isHourMetrics = true;
break;
case ServiceMetricsType.Minute:
serviceProperties.MinuteMetrics = currentServiceProperties.MinuteMetrics;
UpdateServiceProperties(serviceProperties.MinuteMetrics);
isHourMetrics = false;
break;
}
Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
GetRequestOptions(ServiceType), OperationContext);
if (PassThru)
{
if (isHourMetrics)
{
WriteObject(serviceProperties.HourMetrics);
}
else
{
WriteObject(serviceProperties.MinuteMetrics);
}
}
}
示例5: GetStorageServiceProperties
/// <summary>
/// Get the service properties
/// </summary>
/// <param name="account">Cloud storage account</param>
/// <param name="type">Service type</param>
/// <param name="options">Request options</param>
/// <param name="operationContext">Operation context</param>
/// <returns>The service properties of the specified service type</returns>
public ServiceProperties GetStorageServiceProperties(StorageServiceType type, IRequestOptions options, OperationContext operationContext)
{
CloudStorageAccount account = StorageContext.StorageAccount;
switch (type)
{
case StorageServiceType.Blob:
return account.CreateCloudBlobClient().GetServiceProperties((BlobRequestOptions) options, operationContext);
case StorageServiceType.Queue:
return account.CreateCloudQueueClient().GetServiceProperties((QueueRequestOptions) options, operationContext);
case StorageServiceType.Table:
return account.CreateCloudTableClient().GetServiceProperties((TableRequestOptions) options, operationContext);
case StorageServiceType.File:
FileServiceProperties fileServiceProperties = account.CreateCloudFileClient().GetServiceProperties((FileRequestOptions)options, operationContext);
ServiceProperties sp = new ServiceProperties();
sp.Clean();
sp.Cors = fileServiceProperties.Cors;
return sp;
default:
throw new ArgumentException(Resources.InvalidStorageServiceType, "type");
}
}
示例6: ExecuteCmdlet
public override void ExecuteCmdlet()
{
CloudStorageAccount account = GetCloudStorageAccount();
ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(account, ServiceType, GetRequestOptions(ServiceType), OperationContext);
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.Clean();
bool isHourMetrics = false;
switch (MetricsType)
{
case ServiceMetricsType.Hour:
serviceProperties.HourMetrics = currentServiceProperties.HourMetrics;
UpdateServiceProperties(serviceProperties.HourMetrics);
isHourMetrics = true;
break;
case ServiceMetricsType.Minute:
serviceProperties.MinuteMetrics = currentServiceProperties.MinuteMetrics;
UpdateServiceProperties(serviceProperties.MinuteMetrics);
isHourMetrics = false;
break;
}
Channel.SetStorageServiceProperties(account, ServiceType, serviceProperties,
GetRequestOptions(ServiceType), OperationContext);
if (PassThru)
{
if (isHourMetrics)
{
WriteObject(serviceProperties.HourMetrics);
}
else
{
WriteObject(serviceProperties.MinuteMetrics);
}
}
}