BASH: Fast Purge via CCU v3 API

Document created by Luca Genasci on Aug 7, 2017Last modified by Luca Genasci on Dec 12, 2017
Version 2Show Document
  • View in full screen mode

Hi,

 

In collaboration with Marco De March of Akamai Italy I created a simple bash script for fast purging the Akamai cache.

You will find the files attached and run the script:

 

Updated 12.12.2017: new version 0.2 of script. Now it works correctly with cpcode and without domain option.

$> ./aka_purge.sh --help

To display options:

usage: aka_purge.sh [OPTIONS] -o <obj1[,obj2,obj3,...]>

Purge the Akamai cache via CCU REST API v3.

REMARKS
  Please create a config file in ~/.akarc or /etc/.akarc

PARAMETERS:
    -o | --objects        List of objects to purge (with comma separated values)


OPTIONS:
    -t | --type           Type of objects
                            Possible values: url, cpcode or tag
                            Default: url

    -d | --domain         Domain site (es. your.domain.com).
                          To use with type=url

    -a | --action         The desired action to manage the cache
                            Possible values: invalidate or delete
                            Default: invalidate

    -n | --network        The network on which you want to invalidate or delete content
                            Possible values: staging or production
                            Default: production

    -h | --help           Show this message
    -v | --version        Show version


CONFIG FILE:

  In the config file the following values have to been declared:
    client_secret = <your client secret>
    client_token = <your client token>
    access_token = <your access token>
    host = <your akamai host>

  There is the possibility to set the default values:
    network = <staging | production>
    action  = <invalidate | delete>
    type    = <url | cpcode | tag>

  If no values are declared the default ones are:
    network = staging
    action  = invalidate
    type    = url

 

I hope that this script helps someone.

 

Best Regards.

Attachments

Outcomes