This module enables the use of Image and Video Manager (IM) in the Akamai CLI tool
Please ensure your API client has access to the "Image Manager" API (you may need to create a separate API client)
To install, use Akamai CLI:
akamai install image-manager
You may also use this as a stand-alone command by cloning this repository and compiling it yourself.
akamai image-manager [global flags] --policy-set POLICY-SET command
akamai video-manager [global flags] --policy-set POLICY-SET command
--edgerc value
— Location of the credentials file (default: user's directory like "/Users/jgarza") [$AKAMAI_EDGERC]--section value
— Section of the credentials file (default: "default") [$AKAMAI_EDGERC_SECTION]--debug
--d
- prints debug information--verbose
- Print verbose information--version
,-v
— Print the version--policy-set POLICY-SET
(REQUIRED) Name of the Image Manager policy to manage (grep for "policyTokenDefault" within the Property Manager configuration)--help
,-h
— Show help
list-policies
— List existing policies on given network, or both (default). Output can be formatted as JSON, or text tables (default); which is a human readable ascii table showing the policy name, creation date and creation user (useful for inventorying purposes).get-policy
— Retrieves a given policy on a given network (output can be saved into a file)set-policy
- Creates or updates a given policy on a given network (or both) using the JSON provided on a given input filedelete-policy
- Deletes a policy (given network or both)
Required arguments: --policy-set POLICY-SET, -p POLICY-SET
Showing the syntax
$ akamai image-manager --section default --policy-set example_com list-policies --help
usage: akamai-image-manager list-policies [-h] [--network network]
[--output-type json/text]
optional arguments:
-h, --help show this help message and exit
--network network, -n network
Network to list from (staging, production or both).
Default is both
--output-type json/text, -t json/text
Output type {json, text}. Default is text
$ akamai video-manager --section default --policy-set example_com list-policies --help
usage: akamai-video-manager list-policies [-h] [--network network]
[--output-type json/text]
optional arguments:
-h, --help show this help message and exit
--network network, -n network
Network to list from (staging, production or both).
Default is both
--output-type json/text, -t json/text
Output type {json, text}. Default is text
Retrieve a list of all policies in human readable format using a specific instance of the Image Manager behavior available on both networks:
$ akamai image-manager --section default --policy-set example_com list-policies
Policy: example_com Network: both Output: text
STAGING:
+--------------------------------+---------------------------+---------------------------+
| Policy name | Date Created | User |
+================================+===========================+===========================+
| .auto | 2018-04-19 18:18:13+0000 | system |
+--------------------------------+---------------------------+---------------------------+
| HeroBanner | 2018-09-03 17:42:32+0000 | 42uzkarfjv4pzsdf |
+--------------------------------+---------------------------+---------------------------+
| AvatarThumbnail | 2018-04-19 19:50:51+0000 | 42uzkarfjv4pzsdf |
+--------------------------------+---------------------------+---------------------------+
PRODUCTION:
+--------------------------------+---------------------------+---------------------------+
| Policy name | Date Created | User |
+================================+===========================+===========================+
| .auto | 2018-04-19 19:43:05+0000 | system |
+--------------------------------+---------------------------+---------------------------+
| HeroBanner | 2018-09-03 17:42:38+0000 | 42uzkarfjv4pzsdf |
+--------------------------------+---------------------------+---------------------------+
| AvatarThumbnail | 2018-04-19 21:11:38+0000 | 42uzkarfjv4pzsdf |
+--------------------------------+---------------------------+---------------------------+
The commands below accomplish the same as the previous one:
$ akamai image-manager --section default --policy-set example_com list-policies --network both --output-type text
$ akamai image-manager --section default --policy-set example_com list-policies -n both -t text
$ akamai image-manager --section default --policy-set example_com list-policies --network staging --output-type json
Saving the output in JSON format causes all the policies to be merged together on a single JSON response
$ akamai image-manager --section default --policy-set example_com get-policy --help
usage: akamai-image-manager get-policy [-h] [--network network] [--output-file filename]
name
positional arguments:
name Policy name to retrieve
optional arguments:
-h, --help show this help message and exit
--network network, -n network
Network to list from (staging or production). Default
is production
--output-file filename, -f filename
Save output to a file
$ akamai image-manager --section default --policy-set example_com get-policy HeroBanner
The commands below accomplish the same as the previous one:
$ akamai image-manager --section default --policy-set example_com get-policy HeroBanner --network production
$ akamai image-manager --section default --policy-set example_com get-policy HeroBanner -n production
$ akamai image-manager --section default --policy-set example_com get-policy HeroBanner --network staging
$ akamai image-manager --section default --policy-set example_com get-policy HeroBanner --network staging --output-file rules.json
$ akamai image-manager --section default --policy-set example_com set-policy --help
usage: akamai-image-manager set-policy [-h] --input-file filename [--network network] name
positional arguments:
name Policy name to update
optional arguments:
-h, --help show this help message and exit
--input-file filename, -f filename
JSON Config file
--network network, -n network
Network where the policy resides (staging, production
or both). Default is production
Create a policy called "HeroBanner" on production as indicated on a file called rules.json
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner --input-file rules.json
The commands below accomplish the same as the previous one:
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner --input-file rules.json --network production
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner -f rules.json --network production
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner -f rules.json -n production
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner --input-file rules.json --network staging
$ akamai image-manager --section default --policy-set example_com set-policy HeroBanner --input-file rules.json --network both
$ akamai image-manager --section default --policy-set example_com delete-policy --help
usage: akamai-image-manager delete-policy [-h] [--network network] name
positional arguments:
name Policy name to delete
optional arguments:
-h, --help show this help message and exit
--network network, -n network
Network to delete from (staging, production or both).
Default is production
Delete a policy called "HeroBanner" on production
$ akamai image-manager --section default --policy-set example_com delete-policy HeroBanner
The commands below accomplish the same as the previous one:
$ akamai image-manager --section default --policy-set example_com delete-policy HeroBanner --network production
$ akamai image-manager --section default --policy-set example_com delete-policy HeroBanner -n production
Delete a policy called "HeroBanner" on staging
$ akamai image-manager --section default --policy-set example_com delete-policy HeroBanner --network staging
$ akamai image-manager --section default --policy-set example_com delete-policy HeroBanner --network both
To update to the latest version:
$ akamai update image-manager
Please report any issues or enhancement ideas here in GitHub. Pull requests are welcomed!
TBD