当前位置: 首页>>代码示例>>C#>>正文


C# ServiceProperties.Clean方法代码示例

本文整理汇总了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);
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:11,代码来源:RemoveAzureStorageCORSRule.cs

示例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);
            }
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:43,代码来源:SetAzureStorageCORSRule.cs

示例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);
            }
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:18,代码来源:SetAzureStorageServiceLogging.cs

示例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);
                }
            }
        }
开发者ID:nityasharma,项目名称:azure-powershell,代码行数:42,代码来源:SetAzureStorageServiceMetrics.cs

示例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");
     }
 }
开发者ID:nityasharma,项目名称:azure-powershell,代码行数:29,代码来源:StorageBlobManagement.cs

示例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);
                }
            }
        }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:38,代码来源:SetAzureStorageServiceMetrics.cs


注:本文中的Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.Clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。