Exercises in Restful Integration and Continuous Delivery

Musing on Software Development and Technologies.

Sun 31 August 2014

IO::Iron::Applications - Command line tools for Iron.io services

Posted by Mikko Koivunalho in Technology   

IO::Iron::Applications - Command line tools for Iron.io services

IO::Iron::Applications is an auxiliary package for IO::Iron. IO::Iron contains the library for using the Iron.io cloud services in Perl programs. IO::Iron::Applications contains command line programs to operate those services.

IO::Iron::Applications is my addition to the IO::Iron interphase library package which I wrote earlier. The Iron.io WWW interface hud.iron.io Dashboard is great but a bit slow to use when you only need to quickly change some values in IronCache, send a message to IronMQ, erase or empty cache for debugging purposes or other similar activities. With these command line utilities the same functions can be performed fast from a normal shell and not using a web browser.

Policies

The programs take use of the IO::Iron package feature policies so wildcard characters can be used in cache names, item keys, etc.

For example, if iron_cache_policies.json:

{
    "definition":{
        "character_group":{
            "[:lim_uchar:]":"ABC",
            "[:low_digit:]":"01"
        }
    },
    "cache":{
        "name":[
            "cache_[:lim_uchar:]{1}0[:digit:]{1}"
        ],
        "item_key":[
            "item.02_[:lim_uchar:]{1,2}[:low_digit:]{1}"
        ]
    }
}

then

ironcache list items .* --cache cache_A01 --policies iron_cache_policies.json

would print out:

Cache                         Item                expires
cache_A01                     item.02_A0                               Key not exists.
cache_A01                     item.02_A1                               Key not exists.
cache_A01                     item.02_AA0                              Key not exists.
cache_A01                     item.02_AA1                              Key not exists.
cache_A01                     item.02_AB0                              Key not exists.
cache_A01                     item.02_AB1                              Key not exists.
cache_A01                     item.02_AC0                              Key not exists.
cache_A01                     item.02_AC1                              Key not exists.
cache_A01                     item.02_B0                               Key not exists.
cache_A01                     item.02_B1                               Key not exists.
cache_A01                     item.02_BA0                              Key not exists.
cache_A01                     item.02_BA1                              Key not exists.
cache_A01                     item.02_BB0                              Key not exists.
cache_A01                     item.02_BB1                              Key not exists.
cache_A01                     item.02_BC0                              Key not exists.
cache_A01                     item.02_BC1                              Key not exists.
cache_A01                     item.02_C0                               Key not exists.
cache_A01                     item.02_C1                               Key not exists.
cache_A01                     item.02_CA0                              Key not exists.
cache_A01                     item.02_CA1                              Key not exists.
cache_A01                     item.02_CB0                              Key not exists.
cache_A01                     item.02_CB1                              Key not exists.
cache_A01                     item.02_CC0                              Key not exists.
cache_A01                     item.02_CC1                              Key not exists.

On the command line, all normal regular expression are allowed. E.g.

item.02_A.{1}0

would return

Cache                         Item                expires
cache_A01                     item.02_AA0                              Key not exists.
cache_A01                     item.02_AB0                              Key not exists.
cache_A01                     item.02_AC0                              Key not exists.

Following command line programs are available:

ironcache

  • clear: Clear a cache. E.g. ironcache clear cache_main
  • delete: Delete a cache. E.g. ironcache delete cache_main
  • delete: Delete item from cache. E.g. ironcache delete item item.01_AB1
  • get: Get item/items from cache/caches. E.g. ironcache get item item.02_A.{2} --cache cache_A01 --config iron_cache.json --policies iron_cache_policies_test_01.json --warn
  • increment: Increment an item/items in cache/caches. E.g. ironcache increment item item.02_AC1,item.02_BC1 --cache cache_A01 --value 225
  • list: List caches or items in a cache/caches. E.g. ironcache list items .* --cache cache_A01 E.g. ironcache list caches
  • put: Put or replace item/items to a cache/caches. E.g. ironcache put item item.02_CC1,item.02_CC2 --cache cache_A01 -- value 123
  • show: Show the properties of a cache/caches. E.g. ironcache show cache cache_A01

    
 
 

Comments