public RedisResource UpdateCache(string resourceGroupName, string cacheName, string skuFamily, int skuCapacity, string skuName,
                                         Hashtable redisConfiguration, bool?enableNonSslPort, Hashtable tenantSettings, int?shardCount, string MinimumTlsVersion, Hashtable tags)
        {
            _resourceManagementClient.Providers.Register("Microsoft.Cache");
            var parameters = new RedisUpdateParameters
            {
                Sku = new Microsoft.Azure.Management.Redis.Models.Sku
                {
                    Name     = skuName,
                    Family   = skuFamily,
                    Capacity = skuCapacity
                }
            };

            if (tags != null)
            {
                parameters.Tags = new Dictionary <string, string>();
                foreach (object key in tags.Keys)
                {
                    parameters.Tags.Add(key.ToString(), tags[key].ToString());
                }
            }

            if (redisConfiguration != null)
            {
                parameters.RedisConfiguration = new Dictionary <string, string>();
                foreach (object key in redisConfiguration.Keys)
                {
                    parameters.RedisConfiguration.Add(key.ToString(), redisConfiguration[key].ToString());
                }
            }

            parameters.EnableNonSslPort = enableNonSslPort;

            if (tenantSettings != null)
            {
                parameters.TenantSettings = new Dictionary <string, string>();
                foreach (object key in tenantSettings.Keys)
                {
                    // RP should disregard "InternalDependencyList" passed from user (it happens because of piping scenario)
                    string stringKey = key.ToString();
                    if (stringKey.Equals("InternalDependencyList", StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }
                    parameters.TenantSettings.Add(key.ToString(), tenantSettings[key].ToString());
                }
            }

            parameters.ShardCount = shardCount;

            if (!string.IsNullOrEmpty(MinimumTlsVersion))
            {
                parameters.MinimumTlsVersion = MinimumTlsVersion;
            }

            RedisResource response = _client.Redis.Update(resourceGroupName: resourceGroupName, name: cacheName, parameters: parameters);

            return(response);
        }
        public RedisResource UpdateCache(string resourceGroupName, string cacheName, string skuFamily, int skuCapacity, string skuName,
                                         Hashtable redisConfiguration, bool?enableNonSslPort, Hashtable tenantSettings, int?shardCount)
        {
            _resourceManagementClient.Providers.Register("Microsoft.Cache");
            var parameters = new RedisUpdateParameters
            {
                Sku = new Microsoft.Azure.Management.Redis.Models.Sku
                {
                    Name     = skuName,
                    Family   = skuFamily,
                    Capacity = skuCapacity
                }
            };

            if (redisConfiguration != null)
            {
                parameters.RedisConfiguration = new Dictionary <string, string>();
                foreach (object key in redisConfiguration.Keys)
                {
                    parameters.RedisConfiguration.Add(key.ToString(), redisConfiguration[key].ToString());
                }
            }

            parameters.EnableNonSslPort = enableNonSslPort;

            if (tenantSettings != null)
            {
                parameters.TenantSettings = new Dictionary <string, string>();
                foreach (object key in tenantSettings.Keys)
                {
                    parameters.TenantSettings.Add(key.ToString(), tenantSettings[key].ToString());
                }
            }

            parameters.ShardCount = shardCount;

            RedisResource response = _client.Redis.BeginUpdate(resourceGroupName: resourceGroupName, name: cacheName, parameters: parameters);

            return(response);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Update an existing Redis cache.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='name'>
 /// The name of the Redis cache.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Redis operation.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <RedisResource> UpdateAsync(this IRedisOperations operations, string resourceGroupName, string name, RedisUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Update an existing Redis cache.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group.
 /// </param>
 /// <param name='name'>
 /// The name of the Redis cache.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Redis operation.
 /// </param>
 public static RedisResource Update(this IRedisOperations operations, string resourceGroupName, string name, RedisUpdateParameters parameters)
 {
     return(operations.UpdateAsync(resourceGroupName, name, parameters).GetAwaiter().GetResult());
 }