项目作者: telstra

项目描述 :
Telstra Programmable Network SDK - Bash Library
高级语言: Shell
项目地址: git://github.com/telstra/Programmable-Network-SDK-bash.git
创建时间: 2017-12-19T03:35:56Z
项目社区:https://github.com/telstra/Programmable-Network-SDK-bash

开源协议:Apache License 2.0

下载


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

  1. # Make sure the script has executable rights
  2. $ chmod u+x TelstraTPN
  3. # Print the list of operations available on the service
  4. $ ./TelstraTPN -h
  5. # Print the service description
  6. $ ./TelstraTPN --about
  7. # Print detailed information about specific operation
  8. $ ./TelstraTPN <operationId> -h
  9. # Make GET request
  10. ./TelstraTPN --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
  11. # Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
  12. TelstraTPN -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
  13. # Make POST request
  14. $ echo '<body_content>' | TelstraTPN --host <hostname> --content-type json <operationId> -
  15. # Make POST request with simple JSON content, e.g.:
  16. # {
  17. # "key1": "value1",
  18. # "key2": "value2",
  19. # "key3": 23
  20. # }
  21. $ echo '<body_content>' | TelstraTPN --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -
  22. # Preview the cURL command without actually executing it
  23. $ 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:

  1. docker build -t my-rest-client .
  2. 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:

  1. 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):

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

OS X

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

  1. brew install bash-completion

and add the following to the ~/.bashrc:

  1. if [ -f $(brew --prefix)/etc/bash_completion ]; then
  2. . $(brew --prefix)/etc/bash_completion
  3. 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