use of com.microsoft.azure.management.redis.RedisCaches in project azure-tools-for-java by Microsoft.
the class AzureRedisMvpModel method getRedisCaches.
/**
* Get all redis caches.
* @return A map containing RedisCaches with subscription id as the key
*/
public HashMap<String, RedisCaches> getRedisCaches() {
HashMap<String, RedisCaches> redisCacheMaps = new HashMap<>();
List<Subscription> subscriptions = az(AzureAccount.class).account().getSelectedSubscriptions();
for (Subscription subscription : subscriptions) {
Azure azure = AuthMethodManager.getInstance().getAzureClient(subscription.getId());
if (azure.redisCaches() == null) {
continue;
}
redisCacheMaps.put(subscription.getId(), azure.redisCaches());
}
return redisCacheMaps;
}
use of com.microsoft.azure.management.redis.RedisCaches in project azure-tools-for-java by Microsoft.
the class AzureRedisMvpModel method getRedisCache.
/**
* Get a Redis Cache by Id.
* @param sid Subscription Id
* @param id Redis cache's id
* @return Redis Cache Object
*/
public RedisCache getRedisCache(String sid, String id) {
Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
RedisCaches redisCaches = azure.redisCaches();
if (redisCaches == null) {
return null;
}
return redisCaches.getById(id);
}
use of com.microsoft.azure.management.redis.RedisCaches in project azure-tools-for-java by Microsoft.
the class RedisCacheCreatorScenario method setUp.
@Before
public void setUp() throws Exception {
RedisCaches redisCaches = mock(RedisCaches.class);
redisCacheCreator = new RedisCacheCreator(redisCaches, DNS_NAME, REGION_NAME, GROUP_NAME);
creatorMap = redisCacheCreator.CreatorMap();
}
use of com.microsoft.azure.management.redis.RedisCaches in project azure-tools-for-java by Microsoft.
the class AzureRedisMvpModel method deleteRedisCache.
/**
* Delete a redis cache.
* @param sid Subscription Id
* @param id Redis cache's id
*/
public void deleteRedisCache(String sid, String id) {
Azure azure = AuthMethodManager.getInstance().getAzureClient(sid);
RedisCaches redisCaches = azure.redisCaches();
if (redisCaches == null) {
return;
}
redisCaches.deleteById(id);
}
use of com.microsoft.azure.management.redis.RedisCaches in project azure-tools-for-java by Microsoft.
the class RedisCacheModulePresenter method onModuleRefresh.
/**
* Called from view when the view needs refresh.
*/
public void onModuleRefresh() {
final HashMap<String, ArrayList<NodeContent>> nodeMap = new HashMap<>();
final HashMap<String, RedisCaches> redisCachesMap = azureRedisMvpModel.getRedisCaches();
for (final String sid : redisCachesMap.keySet()) {
final ArrayList<NodeContent> nodeContentList = new ArrayList<>();
for (final RedisCache redisCache : redisCachesMap.get(sid).list()) {
nodeContentList.add(new NodeContent(redisCache.id(), redisCache.name(), redisCache.provisioningState()));
}
nodeMap.put(sid, nodeContentList);
}
getMvpView().showNode(nodeMap);
}
Aggregations