Search in sources :

Example 1 with ScheduleEntry

use of com.microsoft.azure.management.redis.ScheduleEntry in project azure-sdk-for-java by Azure.

the class Utils method print.

/**
     * Print Redis Cache.
     * @param redisCache a Redis cache.
     */
public static void print(RedisCache redisCache) {
    StringBuilder redisInfo = new StringBuilder().append("Redis Cache Name: ").append(redisCache.name()).append("\n\tResource group: ").append(redisCache.resourceGroupName()).append("\n\tRegion: ").append(redisCache.region()).append("\n\tSKU Name: ").append(redisCache.sku().name()).append("\n\tSKU Family: ").append(redisCache.sku().family()).append("\n\tHost name: ").append(redisCache.hostName()).append("\n\tSSL port: ").append(redisCache.sslPort()).append("\n\tNon-SSL port (6379) enabled: ").append(redisCache.nonSslPort());
    if (redisCache.redisConfiguration() != null && !redisCache.redisConfiguration().isEmpty()) {
        redisInfo.append("\n\tRedis Configuration:");
        for (Map.Entry<String, String> redisConfiguration : redisCache.redisConfiguration().entrySet()) {
            redisInfo.append("\n\t  '").append(redisConfiguration.getKey()).append("' : '").append(redisConfiguration.getValue()).append("'");
        }
    }
    if (redisCache.isPremium()) {
        RedisCachePremium premium = redisCache.asPremium();
        List<ScheduleEntry> scheduleEntries = premium.listPatchSchedules();
        if (scheduleEntries != null && !scheduleEntries.isEmpty()) {
            redisInfo.append("\n\tRedis Patch Schedule:");
            for (ScheduleEntry schedule : scheduleEntries) {
                redisInfo.append("\n\t\tDay: '").append(schedule.dayOfWeek()).append("', start at: '").append(schedule.startHourUtc()).append("', maintenance window: '").append(schedule.maintenanceWindow()).append("'");
            }
        }
    }
    System.out.println(redisInfo.toString());
}
Also used : ScheduleEntry(com.microsoft.azure.management.redis.ScheduleEntry) ConnectionString(com.microsoft.azure.management.appservice.ConnectionString) RedisCachePremium(com.microsoft.azure.management.redis.RedisCachePremium) Map(java.util.Map)

Example 2 with ScheduleEntry

use of com.microsoft.azure.management.redis.ScheduleEntry in project azure-sdk-for-java by Azure.

the class RedisCacheImpl method updatePatchSchedules.

private void updatePatchSchedules() {
    if (this.scheduleEntries != null && !this.scheduleEntries.isEmpty()) {
        RedisPatchScheduleInner parameters = new RedisPatchScheduleInner().withScheduleEntries(new ArrayList<ScheduleEntryInner>());
        for (ScheduleEntry entry : this.scheduleEntries.values()) {
            parameters.scheduleEntries().add(new ScheduleEntryInner().withDayOfWeek(entry.dayOfWeek()).withMaintenanceWindow(entry.maintenanceWindow()).withStartHourUtc(entry.startHourUtc()));
        }
        this.manager().inner().patchSchedules().createOrUpdate(resourceGroupName(), name(), parameters.scheduleEntries());
    }
}
Also used : ScheduleEntry(com.microsoft.azure.management.redis.ScheduleEntry)

Aggregations

ScheduleEntry (com.microsoft.azure.management.redis.ScheduleEntry)2 ConnectionString (com.microsoft.azure.management.appservice.ConnectionString)1 RedisCachePremium (com.microsoft.azure.management.redis.RedisCachePremium)1 Map (java.util.Map)1