Coder Social home page Coder Social logo

akamai / cli-visitor-prioritization Goto Github PK

View Code? Open in Web Editor NEW
2.0 6.0 1.0 75 KB

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

Home Page: https://github.com/akamai/cli

License: Apache License 2.0

Python 100.00%
akamai-cli cli akamai visitor-prioritization vp cloudlets

cli-visitor-prioritization's Introduction

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.

cli-visitor-prioritization's People

Contributors

adedommelin-ducksify avatar aetsai avatar agent462 avatar akshayranganath avatar allancardenas avatar allancq17 avatar dshafik avatar markkilmer avatar vreddhi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

cli-visitor-prioritization's Issues

RequestsDependencyWarning: urllib3 and chardet

On a fresh install :

$ akamai vp
/root/.akamai-cli/src/cli-visitor-prioritization/lib/python3.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.2) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)

Showing verbose policy version incorrectly displays rule matches when using NOT

Given a VP policy version that has a rule that matches on the following:

  • URL Path is one of /testpath/*
    AND
  • URL Path is not one of /testpath/new/*

When viewing (verbose) the policy version using the CLI, the rule incorrectly displays the NOT path match and makes it look like the rule is matching all paths.

Rule Name: Cloud Throttle
  Traffic Percentage: 100.0

  Match Type: path
  Match Value: /testpath/*
  AND
  Match Type: path
  Match Value: /testpath/new/*

  Rule is DISABLED

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.