Skip to content

telstra/Programmable-Network-SDK-bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telstra Programmable Network

Overview

This is a Bash client script for accessing Telstra Programmable Network API service.

The script uses cURL underneath for making all REST calls.

Usage

# Make sure the script has executable rights
$ chmod u+x TelstraTPN

# Print the list of operations available on the service
$ ./TelstraTPN -h

# Print the service description
$ ./TelstraTPN --about

# Print detailed information about specific operation
$ ./TelstraTPN <operationId> -h

# Make GET request
./TelstraTPN --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
TelstraTPN -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>

# Make POST request
$ echo '<body_content>' | TelstraTPN --host <hostname> --content-type json <operationId> -

# Make POST request with simple JSON content, e.g.:
# {
#   "key1": "value1",
#   "key2": "value2",
#   "key3": 23
# }
$ echo '<body_content>' | TelstraTPN --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -

# Preview the cURL command without actually executing it
$ TelstraTPN --host http://<hostname>:<port> --dry-run <operationid>

Docker image

You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:

docker build -t my-rest-client .
docker run -it my-rest-client

By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.

Shell completion

Bash

The generated bash-completion script can be either directly loaded to the current Bash session using:

source TelstraTPN.bash-completion

Alternatively, the script can be copied to the /etc/bash-completion.d (or on OSX with Homebrew to /usr/local/etc/bash-completion.d):

sudo cp TelstraTPN.bash-completion /etc/bash-completion.d/TelstraTPN

OS X

On OSX you might need to install bash-completion using Homebrew:

brew install bash-completion

and add the following to the ~/.bashrc:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Zsh

In Zsh, the generated _TelstraTPN Zsh completion file must be copied to one of the folders under $FPATH variable.

Documentation for API Endpoints

All URIs are relative to **

Class Method HTTP request Description
AuthenticationApi authGeneratetokenPost POST /1.0.0/auth/generatetoken Create an authentication token
AuthenticationApi authValidatetokenGet GET /1.0.0/auth/validatetoken Validate authentication token
ContractsApi inventoryLinksContractByLinkidAndContractidGet GET /1.0.0/inventory/links/{linkid}/contract/{contractid} Get active Contract by ContractID
ContractsApi inventoryLinksContractByLinkidAndContractidPut PUT /1.0.0/inventory/links/{linkid}/contract/{contractid} Update active Contract by ContractID
ContractsApi inventoryLinksContractByLinkidPost POST /1.0.0/inventory/links/{linkid}/contract Create new Contract on specified link
CustomersApi accountByCustomeruuidGet GET /1.0.0/account/{customeruuid} Get account information details
CustomersApi accountUserByCustomeruuidGet GET /1.0.0/account/{customeruuid}/user List users
DatacentresApi inventoryDatacentersGet GET /1.0.0/inventory/datacenters Get list of all the data centers
EndpointsApi eis100EndpointsAssignTopologyTagByEndpointuuidPost POST /eis/1.0.0/endpoints/{endpointuuid}/assign_topology_tag Assign a Topology Tag to an Endpoint
EndpointsApi inventoryEndpointByEndpointuuidGet GET /1.0.0/inventory/endpoint/{endpointuuid} Get information about the specified endpoint
EndpointsApi inventoryEndpointsCustomeruuidByCustomeruuidGet GET /1.0.0/inventory/endpoints/customeruuid/{customeruuid} Get list of endpoints for a customer
EndpointsApi inventoryRegularendpointPost POST /1.0.0/inventory/regularendpoint Create Physical (Port) Endpoint
EndpointsApi inventoryVnfendpointPost POST /1.0.0/inventory/vnfendpoint Create VNF Endpoint
LinksApi inventoryLinkPost POST /1.0.0/inventory/link Create Link and initial Contract
LinksApi inventoryLinksByLinkidGet GET /1.0.0/inventory/links/{linkid} Get details of specified link
LinksApi inventoryLinksCustomerByCustomeruuidGet GET /1.0.0/inventory/links/customer/{customeruuid} Get active Links
LinksApi inventoryLinksHistoryByLinkidGet GET /1.0.0/inventory/links/history/{linkid} Get Link history
TopologiesApi ttms100TopologyTagByTopotaguuidDelete DELETE /ttms/1.0.0/topology_tag/{topotaguuid}/ Delete a topology tag
TopologiesApi ttms100TopologyTagByTopotaguuidGet GET /ttms/1.0.0/topology_tag/{topotaguuid}/ Get information about the specified topology tag
TopologiesApi ttms100TopologyTagByTopotaguuidPut PUT /ttms/1.0.0/topology_tag/{topotaguuid}/ Update a topology tag's name and/or description
TopologiesApi ttms100TopologyTagGet GET /ttms/1.0.0/topology_tag List all topology tags
TopologiesApi ttms100TopologyTagObjectsByTopotaguuidGet GET /ttms/1.0.0/topology_tag/{topotaguuid}/objects/ List objects for Topology
TopologiesApi ttms100TopologyTagPost POST /ttms/1.0.0/topology_tag Create a named topology tag
VnfsApi marketplaceImageGet GET /1.0.0/marketplace/image List images in the Marketplace
VportsApi inventoryRegularvportPost POST /1.0.0/inventory/regularvport Create VPort for physical endpoint
VportsApi inventoryVnfVportPost POST /1.0.0/inventory/vnf/vport Create VNF VPort
VportsApi inventoryVportByVportuuidGet GET /1.0.0/inventory/vport/{vportuuid} Get information about the specified VPort

Documentation For Models

Documentation For Authorization

auth

Releases

No releases published

Packages

No packages published

Languages