Admin API - Rating Plan
Create rating plan (shell)
create_rating.txt
Instructions
- SSH into your Config Controller Node (node1) as training
- Navigate to the admin_api directory
cd /home/training/admin_api
- Create a txt file called create_rating.txt
vi create_rating.txt
Populate the file
Instructions
- Populate the newly created text file with the following data
{ "currency": "USD", "id": "engineering", "mapRules": { "BI": { "ruleclassType": "BYTES_IN", "rules": [ { "first": "0", "second": "0" } ] }, "BO": { "ruleclassType": "BYTES_OUT", "rules": [ { "first": "0", "second": "0" } ] }, "HD": { "ruleclassType": "HTTP_DELETE", "rules": [ { "first": "0", "second": "0" } ] }, "HG": { "ruleclassType": "HTTP_GET", "rules": [ { "first": "0", "second": "0" } ] }, "HP": { "ruleclassType": "HTTP_PUT", "rules": [ { "first": "0", "second": "0" } ] }, "SB": { "ruleclassType": "STORAGE_BYTE", "rules": [ { "first": "1", "second": "2" }, { "first": "10", "second": "1.5" }, { "first": "11", "second": "1" } ] } }, "name": "Engineering-RP" }
Info
The rating plan payload contains a number of areas of note, and all need to be included, but not all need to used
"currency": "USD", (Set the Currency for the rating plan)
"id": "engineering", (Give the rating plan a name)
This is followed by a number of map rules, each with a Key Pair called first: and second:
First: (The set limit),
second: the price within this limit.
Instructions
Use the supplied payload to create a Ratings policy called engineering with the Billing policy for Storage Bytes described in the previous slide, confirm it is created on completion.
curl -X PUT -H "Content-Type: application/json" -k -u sysadmin:$auth_pass -d @create_rating.txt https://localhost:19443/ratingPlan
Instructions
Check the rating plan from the CLI using
curl -s -X GET -k -u sysadmin:$auth_pass https://localhost:19443/ratingPlan?ratingPlanId=engineering | python3 -mjson.tool