Akamai CLI for Visitor Prioritization

Access and control Visitor Prioritization cloudlet

 akamai install visitor-prioritization

Latest Release: v0.2.1

Release Date: 2018-07-27

Release Notes

Upgrade to include edgegrid-python==1.1.1 to fix bug with parsing credentials with python 3.7

Package Commands

Command Aliases Version Description Binaries Available
visitor-prioritization vp 0.1.0 Access and control Visitor Prioritization cloudlet

README

cli-visitor-prioritization

Provides a way to interact real-time with your Visitor Prioritization Cloudlet via Open APIs and without manually having to go into the Luna Portal. Provides various functionality such as viewing current policies, current status, rule details, and the ability to invoke actual percentage changes.

Local Install

  • Python 3+
  • pip install edgegrid-python

Credentials

In order to use this module, you need to: * Set up your credential files as described in the authorization and credentials sections of the Get Started pagegetting started guide on developer.akamai.comthe developer portal.
* When working through this process you need to give grants for the Cloudlets Policy Manager API. The section in your configuration file should be called ‘cloudlets’. [cloudlets] client_secret = [CLIENT_SECRET] host = [HOST] access_token = [ACCESS_TOKEN_HERE] client_token = [CLIENT_TOKEN_HERE]

Functionality (version 1.0.0)

The initial version of the cloudlet-visitor-prioritization provides the following functionality: * One-time setup/download of local policy ids necessary to invoke APIs quickly * List current policy details, previous versions, and rules * Update/Allow traffic to (make percentage updates) rule for the specified policy and invoke change immediately * Download the specified policy rules file in .json format to edit if necessary * Create a new policy version based on a raw json file * Activate a specific policy version

cli-cloudlet-visitor-prioritization

Main program that wraps this functionality in a command line utility: * setup * list * show * allow * disable * activate * download * create-version

setup

Does a one time download of Visitor Prioritization Cloudlet policyIds and groupIds and stores them in /setup folder for faster local retrieval. This command can be run anytime and will refresh the /setup folder based on the current list of policies.

%  akamai-visitor-prioritization setup

list

List current Visitor Prioritization Cloudlet policy names

%  akamai-visitor-prioritization list

show

Get specific details for a policy name. Available information include configurations that reference that policy, current version numbers on Akamai staging and production, version history, and current rule settings.

%  akamai-visitor-prioritization show --policy samplePolicyName
%  akamai-visitor-prioritization show --policy samplePolicyName --from-version 37
%  akamai-visitor-prioritization show --policy samplePolicyName --version 66
%  akamai-visitor-prioritization show --policy samplePolicyName --version 66 --verbose

The flags of interest for show are:

--policy <policyName>        Specified Visitor Prioritization Cloudlet policy name
--version <version>          Specific version number for that policy name (optional)
--from-version <fromVersion> If --version is not specified, list policy version details starting from --from-version value (optional)
--verbose                    If --version is specified, add --verbose to get full rule details including url paths and match criteria (optional)

allow

Make an actual change to percentage value for a specific rule name in the policy.

%  akamai-visitor-prioritization allow --percent 50 --policy samplePolicyName --rule 'ruleName' --network production
%  akamai-visitor-prioritization allow --percent -1 --policy samplePolicyName --rule 'ruleName' --network staging
%  akamai-visitor-prioritization allow --percent 100 --policy samplePolicyName --rule 'ruleName' --network production --force

The flags of interest for allow are:

--percent <value>       Acceptable values are -1 (= All to Waiting Room), 0 <= 100 (100 = everyone allowed)
--policy <policyName>   Specified Visitor Prioritization Cloudlet policy name
--rule <ruleName>       Name of rule in policy that should be changed. Use single quotes ('') in case rule name has spaces. If multiple rules exist for the same name, all of them will be updated.
--network <network>     Either staging or production ; will make change based on latest version on that network
--allrules              Apply this change to all rules in the policy without needing specific --rule name
--force                 Use this flag if you want to proceed without confirmation (only for --network production)

disable

Disable or make inactive for a specific rule name in the policy.

%  akamai-visitor-prioritization disable --policy samplePolicyName --rule 'ruleName' --network production
%  akamai-visitor-prioritization disable --policy samplePolicyName --rule 'ruleName' --network staging
%  akamai-visitor-prioritization disable --policy samplePolicyName --allrules --network production --force

The flags of interest for throttle are:

--policy <policyName>   Specified Visitor Prioritization Cloudlet policy name
--rule <ruleName>       Name of rule in policy that should be changed. Use single quotes ('') in case rule name has spaces. If multiple rules exist for the same name, all of them will be updated.
--network <network>     Either staging or production ; will make change based on latest version on that network
--allrules              Apply this change to all rules in the policy without needing specific --rule name
--force                 Use this flag if you want to proceed without confirmation (only for --network production)

activate

Activate a specified version for a policy to the appropriate network (staging or production)

%  akamai-visitor-prioritization activate --policy samplePolicyName --version 87 --network staging
%  akamai-visitor-prioritization activate --policy samplePolicyName --version 71 --network production

The flags of interest for activate are:

--policy <policyName>   Specified Visitor Prioritization Cloudlet policy name
--version <version>     Specific version number for that policy name
--network <network>     Either staging or production

download

Download the raw policy rules for a specified version in json format for local editing if desired.

%  akamai-visitor-prioritization download --policy samplePolicyName --version 87
%  akamai-visitor-prioritization download --policy samplePolicyName --version 71 --output-file savefilename.json

The flags of interest for download are:

--policy <policyName>     Specified Visitor Prioritization Cloudlet policy name
--version <version>       Specific version number for that policy name
--output-file <filename>  Filename to be saved in /rules folder (optional) 

create-version

Create a new policy version from a raw json file

%  akamai-visitor-prioritization create-version --policy samplePolicyName
%  akamai-visitor-prioritization create-version --policy samplePolicyName --file filename.json
%  akamai-visitor-prioritization create-version --policy samplePolicyName --file filename.json --force

The flags of interest for create-version are:

--policy <policyName>  Specified Visitor Prioritization Cloudlet policy name
--file <file>            Filename of raw .json file to be used as policy details. This file should be in the /rules folder (optional)
--force                Use this flag if you want to proceed without confirmation if description field in json has not been updated