本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties类的典型用法代码示例。如果您正苦于以下问题:C# ServiceProperties类的具体用法?C# ServiceProperties怎么用?C# ServiceProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceProperties类属于Microsoft.WindowsAzure.Storage.Shared.Protocol命名空间,在下文中一共展示了ServiceProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: FileServiceProperties
/// <summary>
/// Initializes a new instance of the <see cref="FileServiceProperties"/> class.
/// </summary>
public FileServiceProperties()
{
this.serviceProperties = new ServiceProperties();
this.serviceProperties.HourMetrics = null;
this.serviceProperties.MinuteMetrics = null;
this.serviceProperties.Logging = null;
}
开发者ID:renlesterdg,项目名称:azure-storage-net,代码行数:10,代码来源:FileServiceProperties.cs
示例2: SetServiceProperties
public Task SetServiceProperties(ServiceProperties properties, BlobRequestOptions requestOptions = null, OperationContext operationContext = null, CancellationToken cancellationToken = default(CancellationToken))
{
return AsyncTaskUtil.RunAsyncCancellable(
_inner.BeginSetServiceProperties(properties, requestOptions, operationContext, null, null),
_inner.EndSetServiceProperties,
cancellationToken);
}
开发者ID:Porges,项目名称:azure-storage-async,代码行数:7,代码来源:AsyncCloudBlobClient.cs
示例3: StorageSettings
public StorageSettings(string storageName, ServiceProperties serviceProperties)
{
InitializeComponent();
this.Icon = Bitmaps.Azure_Explorer_ico;
labelStorageAccount.Text = string.Format(labelStorageAccount.Text, storageName);
_serviceProperties = serviceProperties;
}
开发者ID:vaibhavkadian,项目名称:Azure-Media-Services-Explorer,代码行数:7,代码来源:StorageSettings.cs
示例4: InitializeCors
private void InitializeCors()
{
var tableServiceProperties = new ServiceProperties();
var tableClient =
new CloudStorageAccount(
new StorageCredentials(
CloudConfigurationManager.GetSetting("storageAccountName"),
CloudConfigurationManager.GetSetting("storageAccountKey")),
true).CreateCloudTableClient();
tableServiceProperties.HourMetrics = null;
tableServiceProperties.MinuteMetrics = null;
tableServiceProperties.Logging = null;
tableServiceProperties.Cors = new CorsProperties();
tableServiceProperties.Cors.CorsRules.Add(new CorsRule()
{
AllowedHeaders = new List<string>() { "*" },
AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Head ,
//AllowedOrigins = new List<string>() { "http://ercenkbike.azurewebsites.net/" },
AllowedOrigins = new List<string>() { "*" },
ExposedHeaders = new List<string>() { "*" },
MaxAgeInSeconds = 1800 // 30 minutes
});
tableClient.SetServiceProperties(tableServiceProperties);
}
开发者ID:morefun0302,项目名称:BikeTracker,代码行数:27,代码来源:Global.asax.cs
示例5: MyTestInitialize
public void MyTestInitialize()
{
props = DefaultServiceProperties();
if (TestBase.QueueBufferManager != null)
{
TestBase.QueueBufferManager.OutstandingBufferCount = 0;
}
}
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:9,代码来源:QueueAnalyticsUnitTests.cs
示例6: MyClassInitialize
public static void MyClassInitialize(TestContext testContext)
{
CloudQueueClient client = GenerateCloudQueueClient();
startProperties = client.GetServiceProperties();
if (TestBase.QueueBufferManager != null)
{
TestBase.QueueBufferManager.OutstandingBufferCount = 0;
}
}
开发者ID:huoxudong125,项目名称:azure-sdk-for-net,代码行数:9,代码来源:QueueAnalyticsUnitTests.cs
示例7: 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);
}
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:11,代码来源:RemoveAzureStorageCORSRule.cs
示例8: ConfigureCors
private void ConfigureCors(ServiceProperties serviceProperties)
{
serviceProperties.Cors = new CorsProperties();
serviceProperties.Cors.CorsRules.Add(new CorsRule
{
AllowedHeaders = new[] { "*" },
AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Head,
AllowedOrigins = new[] { "*" },
ExposedHeaders = new[] { "Cache-Control", "Content-Type", "Last-Modified", "ETag", "Accept-Ranges" },
MaxAgeInSeconds = 31536000
});
}
开发者ID:GusLab,项目名称:video-portal,代码行数:12,代码来源:BlobCorsInitializer.cs
示例9: ConfigureCors
/// <summary>
/// Adds CORS rule to the service properties.
/// </summary>
/// <param name="serviceProperties">ServiceProperties</param>
private static void ConfigureCors(ServiceProperties serviceProperties)
{
serviceProperties.Cors = new CorsProperties();
serviceProperties.Cors.CorsRules.Add(new CorsRule()
{
AllowedHeaders = new List<string>() { "*" },
AllowedMethods = CorsHttpMethods.Put | CorsHttpMethods.Get | CorsHttpMethods.Head | CorsHttpMethods.Post,
AllowedOrigins = new List<string>() { "*" },
ExposedHeaders = new List<string>() { "*" },
MaxAgeInSeconds = 1800 // 30 minutes
});
}
开发者ID:danieros,项目名称:AnimalReUnite,代码行数:16,代码来源:AzureCommon.cs
示例10: SetServicePropertiesAsync
/// <summary>
/// Sets the properties of the table service asynchronously.
/// </summary>
/// <param name="tableClient">Cloud table client.</param>
/// <param name="serviceProperties">The table service properties.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Task.</returns>
public static Task SetServicePropertiesAsync(
this CloudTableClient tableClient,
ServiceProperties serviceProperties,
CancellationToken cancellationToken = default (CancellationToken))
{
ICancellableAsyncResult asyncResult = tableClient.BeginSetServiceProperties(serviceProperties, null, null);
CancellationTokenRegistration registration = cancellationToken.Register(p => asyncResult.Cancel(), null);
return Task.Factory.FromAsync(
asyncResult,
result =>
{
registration.Dispose();
tableClient.EndSetServiceProperties(result);
});
}
开发者ID:dtretyakov,项目名称:WindowsAzure,代码行数:23,代码来源:CloudTableClientExtensions.cs
示例11: 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);
}
}
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:43,代码来源:SetAzureStorageCORSRule.cs
示例12: Main
static void Main(string[] args)
{
StorageCredentials storageCredentials = new StorageCredentials(args[0], args[1]);
CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, true);
var blobClient = storageAccount.CreateCloudBlobClient();
// Define our basics for quick op
ServiceProperties blobServiceProperties = new ServiceProperties()
{
HourMetrics = null,
MinuteMetrics = null,
Logging = null,
};
// Define our CORS rules (wide open here)
CorsRule corsRule = new CorsRule()
{
AllowedHeaders = new List<string>() { "*" },
AllowedMethods = CorsHttpMethods.Get | CorsHttpMethods.Post | CorsHttpMethods.Head | CorsHttpMethods.Put,
AllowedOrigins = new List<string>() { "*" },
ExposedHeaders = new List<string>() { "*", "Accept-Ranges", "Content-Range"},
MaxAgeInSeconds = 7200
};
// Set our rule
blobServiceProperties.Cors.CorsRules.Add(corsRule);
try
{
blobClient.SetServiceProperties(blobServiceProperties);
Console.Out.WriteLine("CORS is rollin' for " + args[0]);
}
catch (Exception e)
{
Console.Out.WriteLine(e.ToString());
}
}
开发者ID:justinribeiro,项目名称:set-cors-azure,代码行数:39,代码来源:Program.cs
示例13: SetServicePropertiesAsync
public IAsyncAction SetServicePropertiesAsync(ServiceProperties properties, BlobRequestOptions requestOptions, OperationContext operationContext)
{
BlobRequestOptions modifiedOptions = BlobRequestOptions.ApplyDefaults(requestOptions, BlobType.Unspecified, this);
operationContext = operationContext ?? new OperationContext();
return AsyncInfo.Run(async (token) => await Executor.ExecuteAsyncNullReturn(
this.SetServicePropertiesImpl(properties, modifiedOptions),
modifiedOptions.RetryPolicy,
operationContext,
token));
}
开发者ID:renlesterdg,项目名称:azure-storage-net,代码行数:10,代码来源:CloudBlobClient.cs
示例14: SetStorageServiceProperties
/// <summary>
/// Set service properties
/// </summary>
/// <param name="account">Cloud storage account</param>
/// <param name="type">Service type</param>
/// <param name="properties">Service properties</param>
/// <param name="options">Request options</param>
/// <param name="operationContext">Operation context</param>
public void SetStorageServiceProperties(StorageServiceType type, ServiceProperties properties, IRequestOptions options, OperationContext operationContext)
{
CloudStorageAccount account = StorageContext.StorageAccount;
switch (type)
{
case StorageServiceType.Blob:
account.CreateCloudBlobClient().SetServiceProperties(properties, (BlobRequestOptions)options, operationContext);
break;
case StorageServiceType.Queue:
account.CreateCloudQueueClient().SetServiceProperties(properties, (QueueRequestOptions)options, operationContext);
break;
case StorageServiceType.Table:
account.CreateCloudTableClient().SetServiceProperties(properties, (TableRequestOptions)options, operationContext);
break;
default:
throw new ArgumentException(Resources.InvalidStorageServiceType, "type");
}
}
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:26,代码来源:StorageBlobManagement.cs
示例15: DefaultServiceProperties
private static ServiceProperties DefaultServiceProperties()
{
ServiceProperties props = new ServiceProperties();
props.Logging.LoggingOperations = LoggingOperations.None;
props.Logging.RetentionDays = null;
props.Logging.Version = "1.0";
props.HourMetrics.MetricsLevel = MetricsLevel.None;
props.HourMetrics.RetentionDays = null;
props.HourMetrics.Version = "1.0";
props.MinuteMetrics.MetricsLevel = MetricsLevel.None;
props.MinuteMetrics.RetentionDays = null;
props.MinuteMetrics.Version = "1.0";
props.Cors.CorsRules = new List<CorsRule>();
return props;
}
开发者ID:benaadams,项目名称:azure-storage-net,代码行数:20,代码来源:QueueAnalyticsUnitTests.cs
示例16: SetServicePropertiesAsync
public Task SetServicePropertiesAsync(ServiceProperties properties, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
{
TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, this);
operationContext = operationContext ?? new OperationContext();
return Task.Run(async () => await Executor.ExecuteAsyncNullReturn(
this.SetServicePropertiesImpl(properties, modifiedOptions),
modifiedOptions.RetryPolicy,
operationContext,
cancellationToken), cancellationToken);
}
开发者ID:DaC24,项目名称:azure-storage-net,代码行数:10,代码来源:CloudTableClient.cs
示例17: BeginSetServiceProperties
public ICancellableAsyncResult BeginSetServiceProperties(ServiceProperties properties, BlobRequestOptions requestOptions, OperationContext operationContext, AsyncCallback callback, object state)
{
requestOptions = BlobRequestOptions.ApplyDefaults(requestOptions, BlobType.Unspecified, this);
operationContext = operationContext ?? new OperationContext();
return Executor.BeginExecuteAsync(
this.SetServicePropertiesImpl(properties, requestOptions),
requestOptions.RetryPolicy,
operationContext,
callback,
state);
}
开发者ID:jdkillian,项目名称:azure-sdk-for-net,代码行数:11,代码来源:CloudBlobClient.cs
示例18: FromServiceXml
/// <summary>
/// Constructs a <c>ServiceProperties</c> object from an XML document received from the service.
/// </summary>
/// <param name="servicePropertiesDocument">The XML document.</param>
/// <returns>A <c>ServiceProperties</c> object containing the properties in the XML document.</returns>
internal static ServiceProperties FromServiceXml(XDocument servicePropertiesDocument)
{
XElement servicePropertiesElement = servicePropertiesDocument.Element(StorageServicePropertiesName);
ServiceProperties properties = new ServiceProperties
{
Logging = ReadLoggingPropertiesFromXml(servicePropertiesElement.Element(LoggingName)),
HourMetrics = ReadMetricsPropertiesFromXml(servicePropertiesElement.Element(HourMetricsName)),
MinuteMetrics = ReadMetricsPropertiesFromXml(servicePropertiesElement.Element(MinuteMetricsName)),
Cors = ReadCorsPropertiesFromXml(servicePropertiesElement.Element(CorsName))
};
XElement defaultServiceVersionXml = servicePropertiesElement.Element(DefaultServiceVersionName);
if (defaultServiceVersionXml != null)
{
properties.DefaultServiceVersion = defaultServiceVersionXml.Value;
}
return properties;
}
开发者ID:vinaysh-msft,项目名称:azure-storage-net,代码行数:24,代码来源:ServiceProperties.cs
示例19: SetServicePropertiesImpl
private RESTCommand<NullType> SetServicePropertiesImpl(ServiceProperties properties, BlobRequestOptions requestOptions)
{
MemoryStream str = new MemoryStream();
try
{
properties.WriteServiceProperties(str);
}
catch (InvalidOperationException invalidOpException)
{
throw new ArgumentException(invalidOpException.Message, "properties");
}
str.Seek(0, SeekOrigin.Begin);
RESTCommand<NullType> retCmd = new RESTCommand<NullType>(this.Credentials, this.BaseUri);
retCmd.SendStream = str;
retCmd.BuildRequestDelegate = BlobHttpWebRequestFactory.SetServiceProperties;
retCmd.RecoveryAction = RecoveryActions.RewindStream;
retCmd.SignRequest = this.AuthenticationHandler.SignRequest;
retCmd.PreProcessResponse =
(cmd, resp, ex, ctx) =>
HttpResponseParsers.ProcessExpectedStatusCodeNoException(System.Net.HttpStatusCode.Accepted, resp, NullType.Value, cmd, ex, ctx);
retCmd.ApplyRequestOptions(requestOptions);
return retCmd;
}
开发者ID:jdkillian,项目名称:azure-sdk-for-net,代码行数:25,代码来源:CloudBlobClient.cs
示例20: SetServiceProperties
public void SetServiceProperties(ServiceProperties properties, BlobRequestOptions requestOptions = null, OperationContext operationContext = null)
{
requestOptions = BlobRequestOptions.ApplyDefaults(requestOptions, BlobType.Unspecified, this);
operationContext = operationContext ?? new OperationContext();
Executor.ExecuteSync(
this.SetServicePropertiesImpl(properties, requestOptions),
requestOptions.RetryPolicy,
operationContext);
}
开发者ID:jdkillian,项目名称:azure-sdk-for-net,代码行数:9,代码来源:CloudBlobClient.cs
注:本文中的Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论