Skip to content

Akamai CLI for Visitor Prioritization allows you to access and control the Visitor Prioritization cloudlet

License

Notifications You must be signed in to change notification settings

akamai/cli-visitor-prioritization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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 --num-versions 15
%  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)
--num-versions <numversions> If --version is not specified, list how many policy version details to return  (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

Contribution

By submitting a contribution (the “Contribution”) to this project, and for good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, you (the “Assignor”) irrevocably convey, transfer, and assign the Contribution to the owner of the repository (the “Assignee”), and the Assignee hereby accepts, all of your right, title, and interest in and to the Contribution along with all associated copyrights, copyright registrations, and/or applications for registration and all issuances, extensions and renewals thereof (collectively, the “Assigned Copyrights”). You also assign all of your rights of any kind whatsoever accruing under the Assigned Copyrights provided by applicable law of any jurisdiction, by international treaties and conventions and otherwise throughout the world.

Notice

Copyright 2020 – Akamai Technologies, Inc.

All works contained in this repository, excepting those explicitly otherwise labeled, are the property of Akamai Technologies, Inc.