Akamai As Code Training

GIT - CLI

2023-01-30 Mon 16:22

1. GIT Basics

GIT Basic Configuration - Identity

- git config --global user.name Your Name
- git config --global user.email your@email.com

GIT Basic Configuration - Alias

- git config --global alias.co commit
- git config --global alias.st status
- git config --global alias.br branch
- git config --global alias.l log --oneline -10
- git config --global alias.ltree log --color --graph
  --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s
  %Cgreen(%cr)%C(bold blue) <%an> %Creset' --abbrev-commit
  --date-order

2. Akamai CLI

General Akamai CLI usage

akamai [global flags] command [command flags] [arguments...]

01_akamai_cli.jpg

Akamai CLI – Getting Help

Example how to get help from a command (it apply to any command)

- akamai pm -h
- akamai pm command -h

02_akamai_cli_help.jpg

3. Akamai CLI - DNS

Akamai CLI – DNS – Create Zone

Example create DNS zone

akamai --accountkey accountID dns create-zoneconfig newzone.com
--type primary --contractid contractID --groupid groupID
--initialize

Akamai CLI – DNS – Create Record

Example create a CName entry

akamai dns --accountkey accountID create-recordset newzone.com
--name newrecord.newzone.com --type cname –ttl seconds
--rdata FQDN

Akamai CLI – DNS – List

Example list DNS zone information

akamai dns --accountkey accountID list-zoneconfig --search newzone.com

Example list DNS record information

akamai dns --accountkey accountID list-recordsets newrecord.newzone.com

4. Akamai CLI - PM

Akamai CLI – PM – New Property with Template

Create a new PM property based on template

akamai pm -a accountID new-property -e template.config.com_pm
-n template_version -p newconfig.name.com_pm
-e, --propertyId <propertyId/propertyName> Optional. Use an existing
property as the blueprint for the new one. Enter either a property ID
or an exact property name. The CLI looks up the group ID, contract ID,
and product ID of the existing property and uses that data to create a
new property.

-n, --propver <propver> Add only if using a property as a
template. Enter the version of the existing property to use as the
blueprint. Uses latest version if omitted.

-p, --property <propertyName> Property name. Optional if a default
property was previously set with the set-default command.

Akamai CLI – PM – New Property with no Template

Create a new PM property based on product ID

akamai pm -a accountID new-property -c contractId -g groupId
-d productId -p newconfig.name.com_pm
-c, --contractId <contractId> Enter the contract ID to use. Optional
if using -e with a property ID or name.

-d, --productId <productId> Enter the product ID to use. Optional if
using -e with a property ID or name.

-g, --groupId <groupId> Enter the group ID for the property. Optional
if using -e with a property ID or name.

-p, --property <propertyName> Property name. Optional if a default
property was previously set with the set-default command.

Akamai CLI – PM – Property Update

Update PM property configuration with json file

akamai pm -a accountID property-update --note "Version note"
-p newconfig.name.com_pm --propver configversion --file logic.json
--file <file> Specify the JSON file containing the rules. PM json
specifications:
https://techdocs.akamai.com/property-mgr/reference/rule-trees

--note <message> Alias of --message. Add comments for the
property. -p, --property <property> The name or ID of the property you
are updating. --propver <propver> Optional. Select the property
version to update

Akamai CLI – PM – JSON

03_akamai_cli_json.jpg

PM Rule Tree Specification

Akamai CLI – PM – Match

04_akamai_match.jpg

Rule tree criteria specification

Akamai CLI – PM – Behaviors

05_akamai_behavior.jpg

Rule tree behavior specification

Akamai CLI – PM – Property Activation

Activate an Akamai PM property

akamai pm -a accountID activate-version -m "Activivation note"
-e "email list" -p newconfig.name.com_pm --propver configversion
-n <network> -w
-m, --message <message>    Enter a message describing the reason for
			   activating.
-n, --network <network>    Network, either 'production' or 'staging'. You can
			   shorten 'production' to 'prod' or 'p' and
			   'staging' to 'stage' or 's'.
-p, --property <property>  Property name or property ID. Optional if default
			   property was previously set using set-default.
--propver <propver>       Optional. The property version to activate. Uses
			   latest version if not specified.
-w, --wait-for-activate    Prevents you from entering more commands until
			   activation is complete. May take several minutes.

5. Akamai CLI - Pipeline

Akamai CLI – Pipeline - Create

Usage: akamai pipeline new-pipeline|np [options] <environments...>
akamai pipeline -a accountID new-pipeline -e template_property_pm 
-n template_version
-p new_pipeline_name <space separated environments>
-e, --propertyId <propertyId/propertyName> Optional. Use an existing
property as the blueprint for the new one. Enter either a property ID
or an exact property name. The CLI looks up the group ID, contract ID,
and product ID of the existing property and uses that data to create a
new property.

-n, --propver <propver> Add only if using a property as a
template. Enter the version of the existing property to use as the
blueprint. Uses latest version if omitted.

-p, --property <propertyName> Property name.

Akamai CLI – Pipeline - Tree

# example
akamai pipeline -a accoundID new-pipeline -e a_config_as_template_pm -n template_version -p new_pipeline demo1 demo2 demo3

06_akamai_pipeline_tree.jpg

Akamai CLI – Pipeline - Variables

Template File variableDefinitions.json variables.json (environment)
08_akamai_pipeline_variables.jpg 09_akamai_pipeline_variables_2.jpg 10_akamai_pipeline_variables_3.jpg

Akamai CLI – Pipeline - Merge

Pipeline merge an environment

akamai pipeline merge -n -p pipeline_name environment
-n, --no-validate Merge the environment without validating.
-p, --pipeline <pipelineName> Pipeline name.

07_akamai_pipeline_merge.jpg

6. Thank you

Any question?