Skip to content

Commit

Permalink
Resource tier support for CLI (#30)
Browse files Browse the repository at this point in the history
* adding list tokens command and adding retrieve single token

* Resource Tier support for CLI

Co-authored-by: Bala <sbala@akamai.com>
  • Loading branch information
swathimr and swathimr authored Apr 5, 2021
1 parent 956326b commit 604fa65
Show file tree
Hide file tree
Showing 18 changed files with 1,806 additions and 449 deletions.
66 changes: 63 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Commands:
| list-groups \| lg `[group-identifier]` | Customer Developer can find their EdgeWorkers access level per Luna Access Control Group. |
| list-ids \| li `[options] [edgeworker-identifier]` | List EdgeWorker ids currently registered. |
| register \| create-id `<group-identifier> <edgeworker-name>` | Register a new EdgeWorker id to reference in Property Manager behavior. |
| update-id \| ui `<edgeworker-identifier> <group-identifier> <edgeworker-name>` | Allows Customer Developer to update an existing EdgeWorker Identifier's Luna ACG or Name attributes. |
| update-id \| ui `<edgeworker-identifier> <group-identifier> <edgeworker-name> [options]` | Allows Customer Developer to update an existing EdgeWorker Identifier's Luna ACG or Name attributes. |
| list-versions \| lv `<edgeworker-identifier> [version-identifier]` | List Version information of a given EdgeWorker Id. |
| upload \| create-version `[options] <edgeworker-identifier>` | Creates a new version of a given EdgeWorker Id which includes the code bundle. |
| download \| download-version `[options] <edgeworker-identifier> <version-identifier>` | Download the code bundle of an EdgeWorker version. |
Expand All @@ -69,6 +69,10 @@ Commands:
| validate \| vv `<bundlePath>` | Validates a code bundle version without uploading the code bundle. |
| create-auth-token \| auth `[options] <secretKey>` | Generates an authentication token that can be used to get detailed EdgeWorker debug response headers. |
| generate-secret \| secret `[options]` | Generates a secret key that can be used to generate auth token or in property variable. |
| clone \| clone `<edgeworker-identifier> <resourceTierId> [options]` | Clones an Edgeworker from the existing Edgeworker Id. |
| list-contracts \| li-contracts `[options]` | List of contract ids that user has access to. |
| list-restiers \| li-restiers `[options]` | List Resource Tiers that can be used to create or clone EdgeWorker Id. |
| show-restier \| show-restier `<edgeworker-identifier>` | Customers can get Resource Tier details for a specific EdgeWorker Id. |

### List Permission Groups with EdgeWorkers Access
Customer Developer can find their EdgeWorkers access level per Luna Access Control Group.
Expand Down Expand Up @@ -97,6 +101,7 @@ Usage: `akamai edgeworkers list-ids [options] [edgeworker-identifier]`
| - | - |
| -h, --help | output usage information |
| --groupId `<groupId>` | Filter EdgeWorker Id list by Permission Group |
| --resourceTierId `<resourceTierId>` | Filter Edgeworker Id by Resource Tier |

| Argument | Existence | Description |
| - | - | - |
Expand Down Expand Up @@ -128,6 +133,7 @@ Usage: `akamai edgeworkers update-id [options] <edgeworker-identifier> <group-id

| Option | Description |
| - | - |
| --resourceTierId | New Resource tier id to which the Edgeworker will be associated |
| -h, --help | output usage information |

| Argument | Existence | Description |
Expand All @@ -141,6 +147,8 @@ Usage: `akamai edgeworkers update-id [options] <edgeworker-identifier> <group-id

2. EdgeWorker id details response body (JSON) will be provided with 200 response code.

3. Resource Tier ID provided should be same as the one the EdgeWorker ID already has. In order to provide a different resource tier id, please use the clone operation.

### List EdgeWorker Versions
List Version information of a given EdgeWorker Id.

Expand Down Expand Up @@ -225,8 +233,8 @@ Usage: `akamai edgeworkers status [options] <edgeworker-identifier>`
| Option | Description |
| - | - |
| -h, --help | output usage information |
| --versionId `<versionId>` | Version Identifier |
| --activationId `<activationId>` | Activation Identifier |
| --versionId `<versionId>` | Version identifier |
| --activationId `<activationId>` | Activation identifier |

| Argument | Existence | Description |
| - | - | - |
Expand Down Expand Up @@ -328,6 +336,58 @@ Generates a random secret key that can be used to create edgeworkers authenticat

Usage: `akamai edgeworkers generate-secret`

### Clone an Edgeworker Id
Allows customer to clone an Edgeworker from an existing Edgeworker Id.

Usage: `akamai edgeworkers clone <edgeworker-identifier> <resourceTierId> [options]`

| Option | Description |
| - | - |
| -h, --help | output usage information |
| --ewName | Name of the Edgeworker |
| --groupId | Group identifier |

| Argument | Existence | Description |
| - | - | - |
| resourceTierId | required | Resource tier id to which the Edgeworker will be cloned.

#### Key Details
1. This endpoint allows user to select a different Resource Tier ID for a specific EdgeWorker id by cloning it. Cloning to the same resource tier will fail.

### List Contracts
List of contract ids that user has access to.

Usage: `akamai list-contracts`

| Option | Description |
| - | - |
| -h, --help | output usage information |

### List Resource Tiers for a specific Contract ID
Allows customers to list Resource Tiers that can be used to create or clone EdgeWorker IDs.

Usage: `akamai list-restiers`

| Option | Description |
| - | - |
| -h, --help | output usage information |

#### Key Details
1. User will be prompted with list of contract ids that user has access to. The selected contract id will be used to fetch resource tier.

### Fetch the Resource Tier for a specific EdgeWorker Id
Customers can get Resource Tier details for a specific EdgeWorker Id.

Usage: `akamai show-restier <edgeworkerId>`

| Option | Description |
| - | - |
| -h, --help | output usage information |

| Argument | Existence | Description |
| - | - | - |
| edgeworkerId | required | Edgeworker identifier.

## Resources
For more information on EdgeWorkers, refer to the following resources:
* [EdgeWorkers Developer Page](https://developer.akamai.com/edgeworkers)
Expand Down
4 changes: 2 additions & 2 deletions cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"commands": [
{
"name": "edgeworkers",
"version": "0.5.3",
"version": "1.0.0",
"aliases": ["ew", "edgeworkers"],
"description": "Manage Akamai EdgeWorkers code bundles."
},
{
"name": "edgekv",
"version": "0.5.3",
"version": "1.0.0",
"aliases": ["ekv", "edgekv"],
"description": "Manage Akamai EdgeKV database."
}
Expand Down
30 changes: 29 additions & 1 deletion docs/edgekv_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* [ Delete Item](###delete-item)
* [ List Items](###list-items)
* [ Create an Access Token](###create-an-access-token)
* [ List Access Tokens](###list-access-tokens)
* [ Retrieve Access Token](###retrieve-access-token)
* [ Resources](##resources)
* [ Reporting Issues](##reporting-issues)

Expand Down Expand Up @@ -103,6 +105,9 @@ Commands:
| delete item \| del item `<environment> <namespace> <groupId> <itemId>` | Delete an item for the given namespace, group id, and item id in an Akamai environment. |
| list items `<environment> <namespace> <groupId>` | List the items for the given namespace and group id in an Akamai environment. |
| create token \| create tkn `<tokenName> [options]` | Create an EdgeKV access token. |
| list tokens | List of all tokens the user has permission to download. |
| download token `<tokenName> [options]` | Download an edgekv token. |


Return Codes:

Expand Down Expand Up @@ -295,7 +300,7 @@ Example:

| Option | Existence | Description |
| - | - | - |
| --save_path | Optional | Path specifying where to save the edgekv_tokens.js token file. We recommend that you save the token file in the same location as the EdgeWorkers code bundle file (.tgz). The EdgeWorkers code bundle is then automatically updated every time this command updates the edgekv_tokens.js token file.If a path is not provided the token value is displayed. This token must be securely stored and manually added to the edgekv_tokens.js token file and EdgeWorkers code bundle. |
| --save_path | Optional | Path specifying where to save the edgekv_tokens.js token file. We recommend that you save the token file in the same location as the EdgeWorkers code bundle file (.tgz). The EdgeWorkers code bundle is then automatically updated every time this command updates the edgekv_tokens.js token file. If a path is not provided the token value is displayed. This token must be securely stored and manually added to the edgekv_tokens.js token file and EdgeWorkers code bundle. |
| -o, --overwrite | Optional | This option is used in conjunction with the --save_path option to overwrite the value of an existing token with the same name in the edgekv_tokens.js file. |
| --staging | Required | Acceptable value: 'allow', 'deny'. <br />Specifies whether the token will be allowed or denied in the staging environment. |
| -- production | Required | Acceptable value: 'allow', 'deny'. <br />Specifies whether the token will be allowed or denied in the production environment. |
Expand All @@ -313,6 +318,29 @@ Example:
2. The token name can be between 1 and 32 characters in length.
3. The expiry date must be at least 1 day in the future and no more than 6 months from the current date.

### List Access Tokens

List of all tokens the user has permission to download.

Usage: `akamai edgekv list tokens`

| Option | Description |
| - | - |
| -h, --help | Display information on how to use this EdgeKV command. |

### Retrieve Access Token

Retrieve an edgeKV access token.

Usage:
`akamai edgekv download token <tokenName> --save_path=<path> --overwrite`

| Option | Existence | Description |
| - | - | - |
| --save_path | Optional | Path specifying where to save the edgekv_tokens.js token file. We recommend that you save the token file in the same location as the EdgeWorkers code bundle file (.tgz). The EdgeWorkers code bundle is then automatically updated every time this command updates the edgekv_tokens.js token file. If a path is not provided the token value is displayed. This token must be securely stored and manually added to the edgekv_tokens.js token file and EdgeWorkers code bundle. |
| -o, --overwrite | Optional | This option is used in conjunction with the --save_path option to overwrite the value of an existing token with the same name in the edgekv_tokens.js file. |
| -h, --help | Display information on how to use this EdgeKV command. |

___
## Resources

Expand Down
Loading

0 comments on commit 604fa65

Please sign in to comment.