akamai / cli-property-manager

Use this Property Manager CLI to automate Akamai property changes and deployments across many environments.
Apache License 2.0
29 stars 22 forks source link

implement "retrieve" parameter to allow downloading JSON rules #68

Closed javiergarza closed 3 years ago

javiergarza commented 3 years ago

Right now in order to download the JSON rules of a property you need to run 2 commands: import + merge It will be great to implement a "retrieve" command which works similarly to the "property" CLI that will just pull the JSON rules from Akamai (this is one of the main reasons why people still use the legacy property CLI).

Here are the parameters the retrieve command had: --format Rules format only [boolean] --hostnames Retrieve hostnames for property [boolean] --variables Retrieve user variables [boolean] --propver Retrieve specified version [number] --file Output file [file]

For example to download the JSON rules of the latest version of a property into a file called "rules.json" you could run: akamai property-manager retrieve [property-name] --file rules.json

To retrieve version 2 you would run: akamai property-manager retrieve [property-name] --propver 2 --file rules_v2.json

javiergarza commented 3 years ago

Closing this since @aetsai shared with me the show-ruletree command can be used to download the rules in one go.

Here is the some sample usage: 1) To show the JSON rules (including property MD and warnings) of the latest version of a configuration: akamai property-manager show-ruletree --property 2) To show the JSON rules (excluding property MD and warnings) of the latest version of a configuration: akamai property-manager show-ruletree --property | jq .rules 3) To download the JSON rules (including property MD and warnings) of a given version of a configuration: akamai property-manager show-ruletree --property --propver --file