コード例 #1
0
        public override void ExecuteCmdlet()
        {
            if (StorageServiceType.File == ServiceType)
            {
                throw new PSInvalidOperationException(Resources.FileNotSupportLogging);
            }

            StorageClient.ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);

            // Premium Account not support classic metrics and logging
            if (currentServiceProperties.Logging == null)
            {
                AccountProperties accountProperties = Channel.GetAccountProperties();
                if (accountProperties.SkuName.Contains("Premium"))
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "This Storage account doesn't support Classic Logging, since it’s a Premium Storage account: {0}", Channel.StorageContext.StorageAccountName));
                }
            }

            StorageClient.ServiceProperties serviceProperties = new StorageClient.ServiceProperties();
            serviceProperties.Clean();
            serviceProperties.Logging = currentServiceProperties.Logging;

            UpdateServiceProperties(serviceProperties.Logging);

            Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
                                                GetRequestOptions(ServiceType), OperationContext);

            if (PassThru)
            {
                WriteObject(serviceProperties.Logging);
            }
        }
コード例 #2
0
        public override void ExecuteCmdlet()
        {
            if (StorageServiceType.File == ServiceType)
            {
                throw new PSInvalidOperationException(Resources.FileNotSupportLogging);
            }

            StorageClient.ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);
            StorageClient.ServiceProperties serviceProperties        = new StorageClient.ServiceProperties();
            serviceProperties.Clean();
            serviceProperties.Logging = currentServiceProperties.Logging;

            UpdateServiceProperties(serviceProperties.Logging);

            Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
                                                GetRequestOptions(ServiceType), OperationContext);

            if (PassThru)
            {
                WriteObject(serviceProperties.Logging);
            }
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            if (StorageServiceType.File == ServiceType)
            {
                throw new PSInvalidOperationException(Resources.FileNotSupportLogging);
            }

            StorageClient.ServiceProperties currentServiceProperties = Channel.GetStorageServiceProperties(ServiceType, GetRequestOptions(ServiceType), OperationContext);
            StorageClient.ServiceProperties serviceProperties = new StorageClient.ServiceProperties();
            serviceProperties.Clean();
            serviceProperties.Logging = currentServiceProperties.Logging;

            UpdateServiceProperties(serviceProperties.Logging);

            Channel.SetStorageServiceProperties(ServiceType, serviceProperties,
                GetRequestOptions(ServiceType), OperationContext);

            if (PassThru)
            {
                WriteObject(serviceProperties.Logging);
            }
        }