RaftechNL / akamai-cli-netlist

Akamai CLI network lists command plugin
5 stars 3 forks source link
akamai akamai-api akamai-cli akamai-network edgerc netowork-lists

Akamai CLI for network lists

The Akamai Network List Kit is a CLI that wraps Akamai's {OPEN} APIs to let you manage network lists and their items along with activation. You can create/list/remove and search for items and lists.

Should you miss something we gladly accept patches :)

CLI uses custom Akamai API client

=================

Configuration and Installation

Credentials

Set up your credential files as described in the authorization and credentials sections of the getting started guide on developer.akamai.com.

Tools expect proper format of sections in edgerc file which example is shown below

NOTE: Default file location is ~/.edgerc

[default]
client_secret = XXXXXXXXXXXX
host = XXXXXXXXXXXX
access_token = XXXXXXXXXXXX
client_token = XXXXXXXXXXXX

In order to change config file which is being used you can

In order to change section which is being actively used you can

NOTE: Make sure your API client do have appropriate scopes enabled

Installation

The tool can be used as completly standalone binary or in conjuction with akamai-cli

Akamai-cli ( recommended )

  1. Execute the following from console akamai install https://github.com/apiheat/akamai-cli-netlist

Standalone

As part of automated releases/builds you can download latest version from the project release page

Usage

Account switch key (ask)

From version 5.0.0 you can now enjoy using single credentials across all of your accounts.Please make sure the scopes are set correctly and that you have correct rights across your contracts.

> akamai netlist  --account-switch-key 1123-ACS  search --searchPattern "some-Pattern_" | jq '.[] | { name, type}'

> akamai netlist  --account-switch-key 1-ABC782  get by-name --name some-list-name

> akamai netlist  -ask 1-8282AD  get by-name --name other_name_of_list

Functionality

In the section you will find all information regarding the usage of our tool.

Getting a network list

Getting a network list is possible either with name of the netlist or with the id.

Removing elements

Creating network list

Adding elements

To be sure that no mistakes are made sync supports --dry-run option which will only display changes which would be applied.

bash-5.0# akamai netlist sync --dry-run aka --id-src 1231_UNIQID1  --id-dst 1234_UNIQID
{
    "remmove": [
        "1.2.3.4"
    ],
    "add": [
        "5.6.6.8"
    ]
}

Before applying changes duplicates are automatically removed

In all cases if the sync process will recognize addresses that would need to be removed from the target list you need to use --force switch to indicate that you allow for that action.

Changes

v6.0.0

v5.0.0

v4.0.0

Development

In order to develop the tool with us do the following:

  1. Fork repository
  2. Clone it to your folder ( within GO path )
  3. Ensure you can restore dependencies by running
    dep ensure -v
  4. Make necessary changes
  5. Make sure solution builds properly ( feel free to add tests )
    go build -ldflags="-s -w -X main.appVer=1.2.3 -X main.appName=$(basename `pwd`)"