Softlayer Python PDF
Softlayer Python PDF
Softlayer Python PDF
Documentation
Release latest
1 Installation 3
1.1 What’s Included . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Using Pip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Debian/Ubuntu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 From Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Configuration File 5
3 API Documentation 7
3.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.1 SoftLayer.account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 SoftLayer.autoscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3 SoftLayer.block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.4 SoftLayer.cdn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.5 SoftLayer.dedicatedhost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.6 SoftLayer.dns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2.7 SoftLayer.event_log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2.8 SoftLayer.file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2.9 SoftLayer.firewall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.2.10 SoftLayer.hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.2.11 SoftLayer.image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.12 SoftLayer.ipsec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.2.13 SoftLayer.load_balancer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2.14 SoftLayer.metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.2.15 SoftLayer.network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2.16 SoftLayer.ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.2.17 SoftLayer.sshkey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.2.18 SoftLayer.ssl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.2.19 SoftLayer.ticket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.2.20 SoftLayer.vs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.2.21 SoftLayer.vs_capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.2.22 SoftLayer.vs_placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.3 Making API Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.4 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.5 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.5.1 SoftLayer Python API Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
i
4 Command-line Interface 73
4.1 Account Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1.1 account summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1.2 account events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1.3 account event-detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1.4 account invoices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.1.5 account invoice-detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.2 Autoscale Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2.1 autoscale list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2.2 autoscale detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2.3 autoscale scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.2.4 autoscale logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.2.5 autoscale tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.2.6 autoscale edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.3 Call API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.3.1 call-api . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.4 Interacting with CDN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.4.1 cdn detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.4.2 cdn list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.4.3 cdn origin-add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.4.4 cdn origin-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.4.5 cdn origin-remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.4.6 cdn purge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.5 Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.5.1 config setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.5.2 config show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.6 Event-Log Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.6.1 event-log get . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.6.2 event-log types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.7 Interacting with Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.7.1 hw bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.7.2 hw cancel-reasons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.7.3 hw cancel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.7.4 hw create-options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.7.5 hw create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
4.7.6 hw credentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.7.7 hw detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.7.8 hw edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.7.9 hw list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.7.10 hw power-cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.7.11 hw power-off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.7.12 hw power-on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.7.13 hw reboot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.7.14 hw reload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.7.15 hw rescue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.7.16 hw reflash-firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.7.17 hw update-firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.7.18 hw toggle-ipmi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.7.19 hw ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.8 Interacting with IPSEC Tunnels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.8.1 ipsec list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.8.2 ipsec detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.8.3 ipsec update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.8.4 ipsec configure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
ii
4.8.5 ipsec subnet-add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.8.6 ipsec subnet-remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.8.7 ipsec translation-add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.8.8 ipsec translation-remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.8.9 ipsec translation-update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.9 LoadBalancers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.9.1 LBaaS Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.9.2 NetScaler Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.10 Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.10.1 order package-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.10.2 order package-locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.10.3 order category-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.10.4 order item-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.10.5 order preset-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.10.6 order place . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4.10.7 order place <preset> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.10.8 order place <Virtual Server> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.11 Quotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.11.1 order quote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.11.2 order quote-list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.11.3 order quote-detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.11.4 order place-quote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.12 Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.12.1 summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.12.2 report bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.13 Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.13.1 user create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.13.2 user list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.13.3 user detail <user> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
4.13.4 user edit-permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.13.5 user edit-details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.14 Working with Virtual Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.14.1 vs bandwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
4.14.2 vs cancel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.14.3 vs capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.14.4 vs create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.14.5 vs create-options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.14.6 vs dns-sync . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.14.7 vs edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
4.14.8 vs list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
4.14.9 vs pause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.14.10 vs power-on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.14.11 vs power-off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.14.12 vs resume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.14.13 vs rescue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.14.14 vs reboot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.14.15 vs ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.14.16 vs upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.14.17 vs usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.14.18 Reserved Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
4.14.19 Placement Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
4.15 Configuration Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
4.16 Usage Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
iii
5 Debugging 131
6 Contributing 133
6.1 Contribution Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.1.1 Code Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.1.2 Setting Up A Dev Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
6.1.3 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.1.4 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.1.5 Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.1.6 Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.1.7 Developer Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.2 Command-Line Interface Developer Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.2.1 First Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
6.2.2 Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
6.2.3 Accessing the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
6.2.4 Aborting execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Index 143
iv
SoftLayer API Python Client Documentation, Release latest
Contents 1
SoftLayer API Python Client Documentation, Release latest
2 Contents
CHAPTER 1
Installation
When you install softlayer-python you you will get the following:
• a python package called ‘SoftLayer’ (casing is important) available in your python path.
• a command-line client placed in your system path named ‘slcli’.
1.3 Debian/Ubuntu
For Debian “jessie” (currently testing) and Ubuntu 14.04, official system packages are available. These are typically
a couple versions behind so it is recommended to install from pypi if problems are encountered.
3
SoftLayer API Python Client Documentation, Release latest
Once you have a copy of the source you can install it with one of the following commands:
Or:
$ pip install .
For more information about working with the source, or contributing to the project, please see the Contribution Guide.
4 Chapter 1. Installation
CHAPTER 2
Configuration File
The SoftLayer API bindings load your settings from a number of different locations.
• Input directly into SoftLayer.create_client_from_env(. . . )
• Enviorment variables (SL_USERNAME, SL_API_KEY)
• Config file locations (~/.softlayer, /etc/softlayer.conf )
• Or argument (-C/path/to/config or –config=/path/to/config)
The configuration file is INI-based and requires the softlayer section to be present. The only required fields are
username and api_key. You can optionally supply the endpoint_url as well. This file is created automatically by the
slcli setup command detailed here: Configuration Setup.
Config Example
[softlayer]
username = username
api_key = oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha
endpoint_url = https://api.softlayer.com/xmlrpc/v3/
timeout = 40
[softlayer]
username = apikey
api_key = 123cNyhzg45Ab6789ADyzwR_2LAagNVbySgY73tAQOz1
endpoint_url = https://api.softlayer.com/rest/v3.1/
timeout = 40
5
SoftLayer API Python Client Documentation, Release latest
API Documentation
This is the primary API client to make API calls. It deals with constructing and executing XML-RPC calls against the
SoftLayer API. Below are some links that will help to use the SoftLayer API.
• SoftLayer API Documentation
• Source on GitHub
You can pass in your username and api_key when creating a SoftLayer client instance. However, you can also set
these in the environmental variables ‘SL_USERNAME’ and ‘SL_API_KEY’.
Creating a client instance by passing in the username/api_key:
import SoftLayer
client = SoftLayer.create_client_from_env(username='YOUR_USERNAME', api_key='YOUR_API_
˓→KEY')
$ export SL_USERNAME=YOUR_USERNAME
$ export SL_API_KEY=YOUR_API_KEY
$ python
>>> import SoftLayer
>>> client = SoftLayer.create_client_from_env()
7
SoftLayer API Python Client Documentation, Release latest
Below is an example of creating a client instance with more options. This will create a client with the private API
endpoint (only accessible from the SoftLayer private network) and a timeout of 4 minutes.
client = SoftLayer.create_client_from_env(username='YOUR_USERNAME',
api_key='YOUR_API_KEY'
endpoint_url=SoftLayer.API_PRIVATE_ENDPOINT,
timeout=240)
3.2 Managers
For day-to-day operation, most users will find the managers to be the most convenient means for interacting with
the API. Managers abstract a lot of the complexities of using the API into classes that provide a simpler interface to
various services. These are higher-level interfaces to the SoftLayer API.
from SoftLayer import VSManager, Client
client = Client(...)
vs = VSManager(client)
vs.list_instances()
[...]
Available managers:
3.2.1 SoftLayer.account
Account manager
license MIT, see License for more details.
class SoftLayer.managers.account.AccountManager(client)
Common functions for getting information from the Account service
Parameters client (SoftLayer.API.BaseClient) – the client instance
ack_event(event_id)
Acknowledge an event. This mostly prevents it from appearing as a notification in the control portal.
Parameters event_id (int) – Notification_Occurrence_Event ID you want to ack
Returns True on success, Exception otherwise.
get_billing_items(identifier)
Gets all topLevelBillingItems from a specific invoice
Parameters identifier (int) – Invoice Id
Returns Billing_Invoice_Item
get_event(event_id)
Gets details about a maintenance event
Parameters event_id (int) – Notification_Occurrence_Event ID
Returns Notification_Occurrence_Event
get_invoices(limit=50, closed=False, get_all=False)
Gets an accounts invoices.
Parameters
• limit (int) – Number of invoices to get back in a single call.
3.2.2 SoftLayer.autoscale
Autoscale manager
license MIT, see LICENSE for more details.
class SoftLayer.managers.autoscale.AutoScaleManager(client)
Manager for interacting with Autoscale instances.
details(identifier, mask=None)
Calls SoftLayer_Scale_Group::getObject()
Parameters
• identifier – SoftLayer_Scale_Group id
• mask – optional SoftLayer_Scale_Group objectMask
edit(identifier, template)
Calls SoftLayer_Scale_Group::editObject()
Parameters
• identifier – SoftLayer_Scale_Group id
• template – SoftLayer_Scale_Group
get_logs(identifier, mask=None, object_filter=None)
Calls SoftLayer_Scale_Group::getLogs()
Parameters
• identifier – SoftLayer_Scale_Group Id
• mask – optional SoftLayer_Scale_Group_Log objectMask
• object_filter – optional SoftLayer_Scale_Group_Log objectFilter
get_policy(identifier, mask=None)
Calls SoftLayer_Scale_Policy::getObject()
Parameters
3.2. Managers 9
SoftLayer API Python Client Documentation, Release latest
• identifier – SoftLayer_Scale_Policy id
• mask – optional SoftLayer_Scale_Policy objectMask
get_virtual_guests(identifier, mask=None)
Calls SoftLayer_Scale_Group::getVirtualGuestMembers()
Parameters
• identifier – SoftLayer_Scale_Group Id
• mask – optional SoftLayer_Scale_Member objectMask
list(mask=None)
Calls SoftLayer_Account::getScaleGroups()
Parameters mask – optional SoftLayer_Scale_Group objectMask
scale(identifier, amount)
Calls SoftLayer_Scale_Group::scale()
Parameters
• identifier – SoftLayer_Scale_Group Id
• amount – positive or negative number to scale the group by
scale_to(identifier, amount)
Calls SoftLayer_Scale_Group::scaleTo()
Parameters
• identifier – SoftLayer_Scale_Group Id
• amount – number to scale the group to.
3.2.3 SoftLayer.block
3.2. Managers 11
SoftLayer API Python Client Documentation, Release latest
Parameters
• volume_id (integer) – The id of the volume
• schedule_type (string) – ‘HOURLY’|’DAILY’|’WEEKLY’
Returns Returns whether successfully disabled or not
enable_snapshots(volume_id, schedule_type, retention_count, minute, hour, day_of_week,
**kwargs)
Enables snapshots for a specific block volume at a given schedule
Parameters
• volume_id (integer) – The id of the volume
• schedule_type (string) – ‘HOURLY’|’DAILY’|’WEEKLY’
• retention_count (integer) – Number of snapshots to be kept
• minute (integer) – Minute when to take snapshot
• hour (integer) – Hour when to take snapshot
• day_of_week (string) – Day when to take snapshot
Returns Returns whether successfully scheduled or not
failback_from_replicant(volume_id, replicant_id)
Failback from a volume replicant.
Parameters
• volume_id (integer) – The id of the volume
• replicant_id (integer) – ID of replicant to failback from
Returns Returns whether failback was successful or not
failover_to_replicant(volume_id, replicant_id, immediate=False)
Failover to a volume replicant.
Parameters
• volume_id (integer) – The id of the volume
• replicant_id (integer) – ID of replicant to failover to
• immediate (boolean) – Flag indicating if failover is immediate
Returns Returns whether failover was successful or not
get_block_volume_access_list(volume_id, **kwargs)
Returns a list of authorized hosts for a specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns a list of authorized hosts for a specified volume.
get_block_volume_details(volume_id, **kwargs)
Returns details about the specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns details about the specified volume.
get_block_volume_snapshot_list(volume_id, **kwargs)
Returns a list of snapshots for the specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns a list of snapshots for the specified volume.
get_replication_locations(volume_id)
Acquires list of the datacenters to which a volume can be replicated.
Parameters volume_id – The ID of the primary volume to be replicated
Returns Returns an array of SoftLayer_Network_Storage objects
get_replication_partners(volume_id)
Acquires list of replicant volumes pertaining to the given volume.
Parameters volume_id – The ID of the primary volume to be replicated
Returns Returns an array of SoftLayer_Location objects
list_block_volumes(datacenter=None, username=None, storage_type=None, **kwargs)
Returns a list of block volumes.
Parameters
• datacenter – Datacenter short name (e.g.: dal09)
• username – Name of volume.
• storage_type – Type of volume: Endurance or Performance
• kwargs –
Returns Returns a list of block volumes.
list_volume_schedules(volume_id)
Lists schedules for a given volume
Parameters volume_id (integer) – The id of the volume
Returns Returns list of schedules assigned to a given volume
order_block_volume(storage_type, location, size, os_type, iops=None, tier_level=None,
snapshot_size=None, service_offering=’storage_as_a_service’,
hourly_billing_flag=False)
Places an order for a block volume.
Parameters
• storage_type – ‘performance’ or ‘endurance’
• location – Datacenter in which to order iSCSI volume
• size – Size of the desired volume, in GB
• os_type – OS Type to use for volume alignment, see help for list
• iops – Number of IOPs for a “Performance” order
• tier_level – Tier level to use for an “Endurance” order
3.2. Managers 13
SoftLayer API Python Client Documentation, Release latest
• snapshot_size – The size of optional snapshot space, if snapshot space should also
be ordered (None if not ordered)
• service_offering – Requested offering package to use in the order (‘stor-
age_as_a_service’, ‘enterprise’, or ‘performance’)
• hourly_billing_flag – Billing type, monthly (False) or hourly (True), default to
monthly.
order_duplicate_volume(origin_volume_id, origin_snapshot_id=None, duplicate_size=None,
duplicate_iops=None, duplicate_tier_level=None, dupli-
cate_snapshot_size=None, hourly_billing_flag=False)
Places an order for a duplicate block volume.
Parameters
• origin_volume_id – The ID of the origin volume to be duplicated
• origin_snapshot_id – Origin snapshot ID to use for duplication
• duplicate_size – Size/capacity for the duplicate volume
• duplicate_iops – The IOPS per GB for the duplicate volume
• duplicate_tier_level – Tier level for the duplicate volume
• duplicate_snapshot_size – Snapshot space size for the duplicate
• hourly_billing_flag – Billing type, monthly (False) or hourly (True), default to
monthly.
Returns Returns a SoftLayer_Container_Product_Order_Receipt
order_modified_volume(volume_id, new_size=None, new_iops=None, new_tier_level=None)
Places an order for modifying an existing block volume.
Parameters
• volume_id – The ID of the volume to be modified
• new_size – The new size/capacity for the volume
• new_iops – The new IOPS for the volume
• new_tier_level – The new tier level for the volume
Returns Returns a SoftLayer_Container_Product_Order_Receipt
order_replicant_volume(volume_id, snapshot_schedule, location, tier=None, os_type=None)
Places an order for a replicant block volume.
Parameters
• volume_id – The ID of the primary volume to be replicated
• snapshot_schedule – The primary volume’s snapshot schedule to use for replication
• location – The location for the ordered replicant volume
• tier – The tier (IOPS per GB) of the primary volume
• os_type – The OS type of the primary volume
Returns Returns a SoftLayer_Container_Product_Order_Receipt
order_snapshot_space(volume_id, capacity, tier, upgrade, **kwargs)
Orders snapshot space for the given block volume.
Parameters
3.2.4 SoftLayer.cdn
CDN Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.cdn.CDNManager(client)
Manage Content Delivery Networks in the account.
See product information here: https://www.ibm.com/cloud/cdn https://cloud.ibm.com/docs/infrastructure/
CDN?topic=CDN-about-content-delivery-networks-cdn-
Parameters client (SoftLayer.API.BaseClient) – the client instance
add_origin(unique_id, origin, path, origin_type=’server’, header=None, port=80, protocol=’http’,
bucket_name=None, file_extensions=None, optimize_for=’web’, cache_query=’include
all’)
Creates an origin path for an existing CDN.
Parameters
• unique_id (str) – The unique ID associated with the CDN.
• path (str) – relative path to the domain provided, e.g. “/articles/video”
• origin (str) – ip address or hostname if origin_type=server, API endpoint for your S3
object storage if origin_type=storage
3.2. Managers 15
SoftLayer API Python Client Documentation, Release latest
list_cdn(**kwargs)
Lists Content Delivery Networks for the active user.
Parameters **kwargs (dict) – header-level options (mask, limit, etc.)
Returns The list of CDN objects in the account
purge_content(unique_id, path)
Purges a URL or path from the CDN.
Parameters
• unique_id (str) – The unique ID associated with the CDN.
• path (str) – A string of url or path that should be purged.
Returns A Container_Network_CdnMarketplace_Configuration_Cache_Purge array object
remove_origin(unique_id, path)
Removes an origin pull mapping with the given origin pull ID.
Parameters
• unique_id (str) – The unique ID associated with the CDN.
• path (str) – The origin path to delete.
Returns A string value
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
start_data
Retrieve the cdn usage metric start date.
3.2.5 SoftLayer.dedicatedhost
DH Manager/helpers
license MIT, see License for more details.
class SoftLayer.managers.dedicated_host.DedicatedHostManager(client, order-
ing_manager=None)
Manages SoftLayer Dedicated Hosts.
See product information here https://www.ibm.com/cloud/dedicated
Parameters
• client (SoftLayer.API.BaseClient) – the client instance
• ordering_manager (SoftLayer.managers.OrderingManager) – an optional
manager to handle ordering. If none is provided, one will be auto initialized.
cancel_guests(host_id)
Cancel all guests into the dedicated host immediately.
To cancel an specified guest use the method VSManager.cancel_instance()
3.2. Managers 17
SoftLayer API Python Client Documentation, Release latest
cancel_host(host_id)
Cancel a dedicated host immediately, it fails if there are still guests in the host.
Parameters host_id – The ID of the dedicated host to be cancelled.
Returns True on success or an exception
get_create_options()
Returns valid options for ordering a dedicated host.
get_host(host_id, **kwargs)
Get details about a dedicated host.
:param integer : the host ID :returns: A dictionary containing host information.
Example:
get_router_options(datacenter=None, flavor=None)
Returns available backend routers for the dedicated host.
list_guests(host_id, tags=None, cpus=None, memory=None, hostname=None, domain=None, lo-
cal_disk=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs)
Retrieve a list of all virtual servers on the dedicated host.
Example:
# Print out a list of instances with 4 cpu cores in the host id 12345.
Parameters
• host_id (integer) – the identifier of dedicated host
• tags (list) – filter based on list of tags
3.2. Managers 19
SoftLayer API Python Client Documentation, Release latest
3.2.6 SoftLayer.dns
DNS Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.dns.DNSManager(client)
Manage SoftLayer DNS.
See product information here: http://www.softlayer.com/DOMAIN-SERVICES
Parameters client (SoftLayer.API.BaseClient) – the client instance
create_record(zone_id, record, record_type, data, ttl=60)
Create a resource record on a domain.
Parameters
• id (integer) – the zone’s ID
• record – the name of the record to add
• record_type – the type of record (A, AAAA, CNAME, TXT, etc.)
• data – the record’s value
• ttl (integer) – the TTL or time-to-live value (default: 60)
create_record_mx(zone_id, record, data, ttl=60, priority=10)
Create a mx resource record on a domain.
Parameters
• id (integer) – the zone’s ID
• record – the name of the record to add
• data – the record’s value
• ttl (integer) – the TTL or time-to-live value (default: 60)
• priority (integer) – the priority of the target host
create_record_ptr(record, data, ttl=60)
Create a reverse record.
Parameters
• record – the public ip address of device for which you would like to manage reverse
DNS.
• data – the record’s value
• ttl (integer) – the TTL or time-to-live value (default: 60)
create_record_srv(zone_id, record, data, protocol, port, service, ttl=60, priority=20, weight=10)
Create a resource record on a domain.
Parameters
• id (integer) – the zone’s ID
3.2. Managers 21
SoftLayer API Python Client Documentation, Release latest
3.2.7 SoftLayer.event_log
Network Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.event_log.EventLogManager(client)
Provides an interface for the SoftLayer Event Log Service.
See product information here: http://sldn.softlayer.com/reference/services/SoftLayer_Event_Log
static build_filter(date_min=None, date_max=None, obj_event=None, obj_id=None,
obj_type=None, utc_offset=None)
Returns a query filter that can be passed into EventLogManager.get_event_logs
Parameters
• date_min (string) – Lower bound date in MM/DD/YYYY format
• date_max (string) – Upper bound date in MM/DD/YYYY format
• obj_event (string) – The name of the events we want to filter by
• obj_id (int) – The id of the event we want to filter by
• obj_type (string) – The type of event we want to filter by
• utc_offset (string) – The UTC offset we want to use when converting date_min
and date_max. (default ‘+0000’)
Returns dict: The generated query filter
get_event_log_types()
Returns a list of event log types
Returns List of event log types
event_mgr = SoftLayer.EventLogManager(env.client)
request_filter = event_mgr.build_filter(date_min="01/01/2019", date_max="02/
˓→01/2019")
logs = event_mgr.get_event_logs(request_filter)
for log in logs:
print("Event Name: {}".format(log['eventName']))
Parameters
• request_filter (dict) – filter dict
• log_limit (int) – number of results to get in one API call
• iterator (bool) – False will only make one API call for log_limit results. True will
keep making API calls until all logs have been retreived. There may be a lot of these.
Returns List of event logs. If iterator=True, will return a python generator object instead.
3.2.8 SoftLayer.file
3.2. Managers 23
SoftLayer API Python Client Documentation, Release latest
• minute (integer) – The minute of the hour at which HOURLY, DAILY, and WEEKLY
snapshots should be taken
• hour (integer) – The hour of the day at which DAILY and WEEKLY snapshots should
be taken
• day_of_week (string|integer) – The day of the week on which WEEKLY snap-
shots should be taken, either as a string (‘SUNDAY’) or integer (‘0’ is Sunday)
Returns Returns whether successfully scheduled or not
failback_from_replicant(volume_id, replicant_id)
Failback from a volume replicant.
Parameters
• volume_id (integer) – The ID of the volume
• replicant_id (integer) – ID of replicant to failback from
Returns Returns whether failback was successful or not
failover_to_replicant(volume_id, replicant_id, immediate=False)
Failover to a volume replicant.
Parameters
• volume_id (integer) – The ID of the volume
• replicant_id (integer) – ID of replicant to failover to
• immediate (boolean) – Flag indicating if failover is immediate
Returns Returns whether failover was successful or not
get_file_volume_access_list(volume_id, **kwargs)
Returns a list of authorized hosts for a specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns a list of authorized hosts for a specified volume.
get_file_volume_details(volume_id, **kwargs)
Returns details about the specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns details about the specified volume.
get_file_volume_snapshot_list(volume_id, **kwargs)
Returns a list of snapshots for the specified volume.
Parameters
• volume_id – ID of volume.
• kwargs –
Returns Returns a list of snapshots for the specified volume.
3.2. Managers 25
SoftLayer API Python Client Documentation, Release latest
get_replication_locations(volume_id)
Acquires list of the datacenters to which a volume can be replicated.
Parameters volume_id – The ID of the primary volume to be replicated
Returns Returns an array of SoftLayer_Network_Storage objects
get_replication_partners(volume_id)
Acquires list of replicant volumes pertaining to the given volume.
Parameters volume_id – The ID of the primary volume to be replicated
Returns Returns an array of SoftLayer_Location objects
list_file_volumes(datacenter=None, username=None, storage_type=None, **kwargs)
Returns a list of file volumes.
Parameters
• datacenter – Datacenter short name (e.g.: dal09)
• username – Name of volume.
• storage_type – Type of volume: Endurance or Performance
• kwargs –
Returns Returns a list of file volumes.
list_volume_schedules(volume_id)
Lists schedules for a given volume
Parameters volume_id (integer) – The id of the volume
Returns Returns list of schedules assigned to a given volume
order_duplicate_volume(origin_volume_id, origin_snapshot_id=None, duplicate_size=None,
duplicate_iops=None, duplicate_tier_level=None, dupli-
cate_snapshot_size=None, hourly_billing_flag=False)
Places an order for a duplicate file volume.
Parameters
• origin_volume_id – The ID of the origin volume to be duplicated
• origin_snapshot_id – Origin snapshot ID to use for duplication
• duplicate_size – Size/capacity for the duplicate volume
• duplicate_iops – The IOPS per GB for the duplicate volume
• duplicate_tier_level – Tier level for the duplicate volume
• duplicate_snapshot_size – Snapshot space size for the duplicate
• hourly_billing_flag – Billing type, monthly (False) or hourly (True), default to
monthly.
Returns Returns a SoftLayer_Container_Product_Order_Receipt
order_file_volume(storage_type, location, size, iops=None, tier_level=None,
snapshot_size=None, service_offering=’storage_as_a_service’,
hourly_billing_flag=False)
Places an order for a file volume.
Parameters
• storage_type – ‘performance’ or ‘endurance’
3.2. Managers 27
SoftLayer API Python Client Documentation, Release latest
Returns list
restore_from_snapshot(volume_id, snapshot_id)
Restores a specific volume from a snapshot
Parameters
• volume_id (integer) – The ID of the volume
• snapshot_id (integer) – The id of the restore point
Returns Returns whether successfully restored or not
3.2.9 SoftLayer.firewall
Firewall Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.firewall.FirewallManager(client)
Manages SoftLayer firewalls
See product information here: http://www.softlayer.com/firewalls
Parameters client (SoftLayer.API.BaseClient) – the client instance
add_standard_firewall(server_id, is_virt=True)
Creates a firewall for the specified virtual/hardware server.
Parameters
• server_id (int) – The ID of the server to create the firewall for
• is_virt (bool) – If true, will create the firewall for a virtual server, otherwise for a
hardware server.
Returns A dictionary containing the standard virtual server firewall order
add_vlan_firewall(vlan_id, ha_enabled=False)
Creates a firewall for the specified vlan.
Parameters
• vlan_id (int) – The ID of the vlan to create the firewall for
• ha_enabled (bool) – If True, an HA firewall will be created
Returns A dictionary containing the VLAN firewall order
cancel_firewall(firewall_id, dedicated=False)
Cancels the specified firewall.
Parameters
• firewall_id (int) – Firewall ID to be cancelled.
• dedicated (bool) – If true, the firewall instance is dedicated, otherwise, the firewall
instance is shared.
edit_dedicated_fwl_rules(firewall_id, rules)
Edit the rules for dedicated firewall.
Parameters
• firewall_id (integer) – the instance ID of the dedicated firewall
3.2. Managers 29
SoftLayer API Python Client Documentation, Release latest
3.2.10 SoftLayer.hardware
Hardware Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.hardware.HardwareManager(client, ordering_manager=None)
Manage SoftLayer hardware servers.
Example:
Parameters
• hardware_id (int) – The ID of the hardware to be cancelled.
• reason (string) – The reason code for the cancellation. This should come from
get_cancellation_reasons().
• comment (string) – An optional comment to include with the cancellation.
• immediate (bool) – If set to True, will automatically update the cancelation ticket to
request the resource be reclaimed asap. This request still has to be reviewed by a human
Returns True on success or an exception
Example:
get_bandwidth_allocation(instance_id)
Combines getBandwidthAllotmentDetail() and getBillingCycleBandwidthUsage()
get_bandwidth_data(instance_id, start_date=None, end_date=None, direction=None,
rollup=3600)
Gets bandwidth data for a server
Will get averaged bandwidth data for a given time period. If you use a rollup over 3600 be aware that the
API will bump your start/end date to align with how data is stored. For example if you have a rollup of
86400 your start_date will be bumped to 00:00. If you are not using a time in the start/end date fields, this
won’t really matter.
Parameters
• instance_id (int) – Hardware Id to get data for
• start_date (date) – Date to start pulling data for.
• end_date (date) – Date to finish pulling data for
• direction (string) – Can be either ‘public’, ‘private’, or None for both.
• rollup (int) – 300, 600, 1800, 3600, 43200 or 86400 seconds to average data over.
get_cancellation_reasons()
Returns a dictionary of valid cancellation reasons.
These can be used when cancelling a dedicated server via cancel_hardware().
3.2. Managers 31
SoftLayer API Python Client Documentation, Release latest
get_create_options()
Returns valid options for ordering hardware.
get_hardware(hardware_id, **kwargs)
Get details about a hardware device.
Parameters id (integer) – the hardware ID
Returns A dictionary containing a large amount of information about the specified server.
Example:
object_mask = "mask[id,networkVlans[vlanNumber]]"
# Object masks are optional
result = mgr.get_hardware(hardware_id=1234,mask=object_mask)
get_tracking_id(instance_id)
Returns the Metric Tracking Object Id for a hardware server
Parameters instance_id (int) – Id of the hardware server
list_hardware(tags=None, cpus=None, memory=None, hostname=None, domain=None, datacen-
ter=None, nic_speed=None, public_ip=None, private_ip=None, **kwargs)
List all hardware (servers and bare metal computing instances).
param list tags filter based on tags
param integer cpus filter based on number of CPUS
param integer memory filter based on amount of memory in gigabytes
param string hostname filter based on hostname
param string domain filter based on domain
param string datacenter filter based on datacenter
param integer nic_speed filter based on network speed (in MBPS)
param string public_ip filter based on public ip address
param string private_ip filter based on private ip address
param dict **kwargs response-level options (mask, limit, etc.)
returns Returns a list of dictionaries representing the matching hardware. This list will
contain both dedicated servers and bare metal computing instances
Example:
place_order(**kwargs)
Places an order for a piece of hardware.
See get_create_options() for valid arguments.
Parameters
• size (string) – server size name or presetId
• hostname (string) – server hostname
• domain (string) – server domain name
result = mgr.rescue(1234)
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
3.2. Managers 33
SoftLayer API Python Client Documentation, Release latest
verify_order(**kwargs)
Verifies an order for a piece of hardware.
See place_order() for a list of available options.
wait_for_ready(instance_id, limit=14400, delay=10, pending=False)
Determine if a Server is ready.
A server is ready when no transactions are running on it.
Parameters
• instance_id (int) – The instance ID with the pending transaction
• limit (int) – The maximum amount of seconds to wait.
• delay (int) – The number of seconds to sleep before checks. Defaults to 10.
3.2.11 SoftLayer.image
Image Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.image.ImageManager(client)
Manages SoftLayer server images.
See product information here: https://console.bluemix.net/docs/infrastructure/image-templates/image_index.
html
Parameters client (SoftLayer.API.BaseClient) – the client instance
delete_image(image_id)
Deletes the specified image.
Parameters image_id (int) – The ID of the image.
edit(image_id, name=None, note=None, tag=None)
Edit image related details.
Parameters
• image_id (int) – The ID of the image
3.2. Managers 35
SoftLayer API Python Client Documentation, Release latest
3.2.12 SoftLayer.ipsec
3.2. Managers 37
SoftLayer API Python Client Documentation, Release latest
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
update_translation(context_id, translation_id, static_ip=None, remote_ip=None, notes=None)
Updates an address translation entry using the given values.
Parameters
• context_id (int) – The id-value representing the context instance.
• template (dict) – A key-value mapping of translation properties.
• static_ip (string) – The static IP address value to update.
• remote_ip (string) – The remote IP address value to update.
• notes (string) – The notes value to update.
Return bool True if the update was successful.
update_tunnel_context(context_id, friendly_name=None, remote_peer=None,
preshared_key=None, phase1_auth=None,
phase1_crypto=None, phase1_dh=None, phase1_key_ttl=None,
phase2_auth=None, phase2_crypto=None, phase2_dh=None,
phase2_forward_secrecy=None, phase2_key_ttl=None)
Updates a tunnel context using the given values.
Parameters
• context_id (string) – The id-value representing the context.
• friendly_name (string) – The friendly name value to update.
• remote_peer (string) – The remote peer IP address value to update.
• preshared_key (string) – The preshared key value to update.
• phase1_auth (string) – The phase 1 authentication value to update.
• phase1_crypto (string) – The phase 1 encryption value to update.
• phase1_dh (string) – The phase 1 diffie hellman group value to update.
• phase1_key_ttl (string) – The phase 1 key life value to update.
• phase2_auth (string) – The phase 2 authentication value to update.
• phase2_crypto (string) – The phase 2 encryption value to update.
• phase2_df (string) – The phase 2 diffie hellman group value to update.
• phase2_forward_secriecy (string) – The phase 2 perfect forward secrecy value
to update.
• phase2_key_ttl (string) – The phase 2 key life value to update.
Return bool True if the update was successful.
3.2. Managers 39
SoftLayer API Python Client Documentation, Release latest
3.2.13 SoftLayer.load_balancer
Parameters
• identifier – UUID of the LBaaS instance
• SoftLayer_Network_LBaaS_L7Pool (pool) – Description of the pool
• SoftLayer_Network_LBaaS_L7Member[] (members) – Array of servers with
their address, port, weight
• SoftLayer_Network_LBaaS_L7HealthMonitor (monitor) – A health moni-
tor
• SoftLayer_Network_LBaaS_L7SessionAffinity (session) – Weather to
use affinity
add_lb_listener(identifier, listener)
Adds or update a listener to a LBaaS instance
When using this to update a listener, just include the ‘listenerUuid’ in the listener object See the follow-
ing for listener configuration options https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_
LBaaS_LoadBalancerProtocolConfiguration/
Parameters
• identifier – UUID of the LBaaS instance
• listener – Object with all listener configurations
add_lb_member(identifier, service_info)
Adds a member to a LBaaS instance
https://sldn.softlayer.com/reference/services/SoftLayer_Network_LBaaS_Member/
deleteLoadBalancerMembers/ :param identifier: UUID of the LBaaS instance :param service_info:
datatypes/SoftLayer_Network_LBaaS_LoadBalancerServerInstanceInfo
cancel_lbaas(uuid)
Cancels a LBaaS instance.
https://sldn.softlayer.com/reference/services/SoftLayer_Network_LBaaS_LoadBalancer/
cancelLoadBalancer/ :param uuid string: UUID of the LBaaS instance to cancel
del_lb_l7_pool(identifier)
Deletes a l7 pool
3.2. Managers 41
SoftLayer API Python Client Documentation, Release latest
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
update_lb_health_monitors(uuid, checks)
calls SoftLayer_Network_LBaaS_HealthMonitor::updateLoadBalancerHealthMonitors()
• updateLoadBalancerHealthMonitors
• SoftLayer_Network_LBaaS_LoadBalancerHealthMonitorConfiguration
Parameters
• uuid – loadBalancerUuid
• list (checks) – SoftLayer_Network_LBaaS_LoadBalancerHealthMonitorConfiguration[]
3.2.14 SoftLayer.metadata
Metadata Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.metadata.MetadataManager(client=None, timeout=5)
Provides an interface for the SoftLayer metadata service.
See product information here: http://sldn.softlayer.com/reference/services/SoftLayer_Resource_Metadata
This provides metadata about the resourse it is called from. See METADATA_ATTRIBUTES for full list of
attributes.
Usage:
get(name, param=None)
Retreive a metadata attribute.
Parameters
• name (string) – name of the attribute to retrieve. See attribs
• param – Required parameter for some attributes
private_network(**kwargs)
Returns details about the private network.
Parameters
3.2.15 SoftLayer.network
Network Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.network.NetworkManager(client)
Manage SoftLayer network objects: VLANs, subnets, IPs and rwhois
See product information here: http://www.softlayer.com/networking
Parameters client (SoftLayer.API.BaseClient) – the client instance
add_global_ip(version=4, test_order=False)
Adds a global IP address to the account.
Parameters
• version (int) – Specifies whether this is IPv4 or IPv6
• test_order (bool) – If true, this will only verify the order.
add_securitygroup_rule(group_id, remote_ip=None, remote_group=None, direction=None,
ethertype=None, port_max=None, port_min=None, protocol=None)
Add a rule to a security group
Parameters
• group_id (int) – The ID of the security group to add this rule to
• remote_ip (str) – The remote IP or CIDR to enforce the rule on
• remote_group (int) – The remote security group ID to enforce the rule on
• direction (str) – The direction to enforce (egress or ingress)
• ethertype (str) – The ethertype to enforce (IPv4 or IPv6)
• port_max (int) – The upper port bound to enforce (icmp code if the protocol is icmp)
• port_min (int) – The lower port bound to enforce (icmp type if the protocol is icmp)
• protocol (str) – The protocol to enforce (icmp, udp, tcp)
add_securitygroup_rules(group_id, rules)
Add rules to a security group
Parameters
3.2. Managers 43
SoftLayer API Python Client Documentation, Release latest
detach_securitygroup_component(group_id, component_id)
Detaches a network component from a security group.
Parameters
• group_id (int) – The ID of the security group
• component_id (int) – The ID of the component to detach
detach_securitygroup_components(group_id, component_ids)
Detaches network components from a security group.
Parameters
• group_id (int) – The ID of the security group
• component_ids (list) – The IDs of the network components to detach
edit_rwhois(abuse_email=None, address1=None, address2=None, city=None, com-
pany_name=None, country=None, first_name=None, last_name=None,
postal_code=None, private_residence=None, state=None)
Edit rwhois record.
edit_securitygroup(group_id, name=None, description=None)
Edit security group details.
Parameters
• group_id (int) – The ID of the security group
• name (string) – The name of the security group
• description (string) – The description of the security group
edit_securitygroup_rule(group_id, rule_id, remote_ip=None, remote_group=None, direc-
tion=None, ethertype=None, port_max=None, port_min=None, pro-
tocol=None)
Edit a security group rule.
Parameters
• group_id (int) – The ID of the security group the rule belongs to
• rule_id (int) – The ID of the rule to edit
• remote_ip (str) – The remote IP or CIDR to enforce the rule on
• remote_group (int) – The remote security group ID to enforce the rule on
• direction (str) – The direction to enforce (egress or ingress)
• ethertype (str) – The ethertype to enforce (IPv4 or IPv6)
• port_max (str) – The upper port bound to enforce
• port_min (str) – The lower port bound to enforce
• protocol (str) – The protocol to enforce (icmp, udp, tcp)
get_event_logs_by_request_id(request_id)
Gets all event logs by the given request id
Parameters request_id (string) – The request id we want to filter on
get_nas_credentials(identifier, **kwargs)
Returns a list of IDs of VLANs which match the given VLAN name.
Parameters instance_id (integer) – the instance ID
3.2. Managers 45
SoftLayer API Python Client Documentation, Release latest
Returns A dictionary containing a large amount of information about the specified instance.
get_rwhois()
Returns the RWhois information about the current account.
Returns A dictionary containing the account’s RWhois information.
get_securitygroup(group_id, **kwargs)
Returns the information about the given security group.
Parameters id (string) – The ID for the security group
Returns A diction of information about the security group
get_subnet(subnet_id, **kwargs)
Returns information about a single subnet.
Parameters id (string) – Either the ID for the subnet or its network identifier
Returns A dictionary of information about the subnet
get_vlan(vlan_id)
Returns information about a single VLAN.
Parameters id (int) – The unique identifier for the VLAN
Returns A dictionary containing a large amount of information about the specified VLAN.
ip_lookup(ip_address)
Looks up an IP address and returns network information about it.
Parameters ip_address (string) – An IP address. Can be IPv4 or IPv6
Returns A dictionary of information about the IP
list_global_ips(version=None, identifier=None, **kwargs)
Returns a list of all global IP address records on the account.
Parameters
• version (int) – Only returns IPs of this version (4 or 6)
• identifier (string) – If specified, the list will only contain the global ips matching
this network identifier.
list_securitygroup_rules(group_id)
List security group rules associated with a security group.
Parameters group_id (int) – The security group to list rules for
list_securitygroups(**kwargs)
List security groups.
list_subnets(identifier=None, datacenter=None, version=0, subnet_type=None, net-
work_space=None, **kwargs)
Display a list of all subnets on the account.
This provides a quick overview of all subnets including information about data center residence and the
number of devices attached.
Parameters
• identifier (string) – If specified, the list will only contain the subnet matching this
network identifier.
• datacenter (string) – If specified, the list will only contain subnets in the specified
data center.
3.2. Managers 47
SoftLayer API Python Client Documentation, Release latest
3.2.16 SoftLayer.ordering
Ordering Manager
license MIT, see LICENSE for more details.
class SoftLayer.managers.ordering.OrderingManager(client)
Manager to help ordering via the SoftLayer API.
Parameters client (SoftLayer.API.BaseClient) – the client instance
static filter_outlet_packages(packages)
Remove packages designated as OUTLET.
Those type of packages must be handled in a different way, and they are not supported at the moment.
Parameters packages – Dictionary of packages. Name and description keys must be present
in each of them.
generate_order(package_keyname, location, item_keynames, complex_type=None, hourly=True,
preset_keyname=None, extras=None, quantity=1)
Generates an order with the given package and prices.
This function takes in parameters needed for an order and generates an order dictionary. This dictionary
can then be used in either verify or placeOrder().
Parameters
• package_keyname (str) – The keyname for the package being ordered
• location (str) – The datacenter location string for ordering (Ex: DALLAS13)
• item_keynames (list) – The list of item keyname strings to order. To see list of
possible keynames for a package, use list_items() (or slcli order item-list)
• complex_type (str) – The complex type to send with the order. Typically begins with
SoftLayer_Container_Product_Order_.
• hourly (bool) – If true, uses hourly billing, otherwise uses monthly billing
• preset_keyname (string) – If needed, specifies a preset to use for that package. To
see a list of possible keynames for a package, use list_preset() (or slcli order preset-list)
• extras (dict) – The extra data for the order in dictionary format. Example: A VSI
order requires hostname and domain to be set, so extras will look like the following: {‘vir-
tualGuests’: [{‘hostname’: ‘test’, ‘domain’: ‘softlayer.com’}]}
• quantity (int) – The number of resources to order
generate_order_template(quote_id, extra, quantity=1)
Generate a complete order template.
Parameters
• quote_id (int) – ID of target quote
• extra (dictionary) – Overrides for the defaults of Soft-
Layer_Container_Product_Order
• quantity (int) – Number of items to order.
static get_item_price_id(core, prices)
get item price id
get_item_prices(package_id)
Get item prices.
Retrieve a SoftLayer_Product_Package item prices record.
Parameters package_id (int) – package identifier.
Returns A list of price IDs associated with the given package.
get_location_id(location)
Finds the location ID of a given datacenter
This is mostly used so either a dc name, or regions keyname can be used when ordering :param str location:
Region Keyname (DALLAS13) or datacenter name (dal13) :returns: integer id of the datacenter
static get_only_active_packages(packages)
Return only active packages.
If a package is active, it is eligible for ordering This will inspect the ‘isActive’ property on the provided
packages
Parameters packages – Dictionary of packages, isActive key must be present
get_order_container(quote_id)
Generate an order container from a quote object.
Parameters quote_id – ID number of target quote
get_package_by_key(package_keyname, mask=None)
Get a single package with a given key.
If no packages are found, returns None
Parameters
• package_keyname – string representing the package key name we are interested in.
• mask (string) – Mask to specify the properties we want to retrieve
get_package_by_type(package_type, mask=None)
Get a single package of a given type.
Syntactic sugar to retrieve a single package of a given type. If multiple packages share the given type, this
will return the first one returned by the API. If no packages are found, returns None
Parameters package_type (string) – representing the package type key name we are
interested in
get_package_id_by_type(package_type)
Return the package ID of a Product Package with a given type.
Parameters package_type (string) – representing the package type key name we are
interested in
Raises ValueError – when no package of the given type is found
get_packages_of_type(package_types, mask=None)
Get packages that match a certain type.
Each ordering package has a type, so return all packages that match the types we are looking for
Parameters
• package_types (list) – List of strings representing the package type keynames we
are interested in.
• mask (string) – Mask to specify the properties we want to retrieve
3.2. Managers 49
SoftLayer API Python Client Documentation, Release latest
extras = {
'hardware': {'hostname': 'test', 'domain': 'testing.com'},
'quantity': 2
}
manager = ordering.OrderingManager(env.client)
result = manager.order_quote(12345, extras)
Parameters
• quote_id (int) – ID for the target quote
• extra (dictionary) – Overrides for the defaults of Soft-
Layer_Container_Product_Order
• quantity (int) – Quantity to override default
package_locations(package_keyname)
List datacenter locations for a package keyname
Parameters package_keyname (str) – The package for which to get the items.
Returns List of locations a package is orderable in
place_order(package_keyname, location, item_keynames, complex_type=None, hourly=True, pre-
set_keyname=None, extras=None, quantity=1)
Places an order with the given package and prices.
This function takes in parameters needed for an order and places the order.
Parameters
• package_keyname (str) – The keyname for the package being ordered
• location (str) – The datacenter location string for ordering (Ex: DALLAS13)
• item_keynames (list) – The list of item keyname strings to order. To see list of
possible keynames for a package, use list_items() (or slcli order item-list)
• complex_type (str) – The complex type to send with the order. Typically begins with
SoftLayer_Container_Product_Order_.
• hourly (bool) – If true, uses hourly billing, otherwise uses monthly billing
• preset_keyname (string) – If needed, specifies a preset to use for that package. To
see a list of possible keynames for a package, use list_preset() (or slcli order preset-list)
• extras (dict) – The extra data for the order in dictionary format. Example: A VSI
order requires hostname and domain to be set, so extras will look like the following: {‘vir-
tualGuests’: [{‘hostname’: ‘test’, domain’: ‘softlayer.com’}]}
• quantity (int) – The number of resources to order
place_quote(package_keyname, location, item_keynames, complex_type=None, pre-
set_keyname=None, extras=None, quantity=1, quote_name=None, send_email=False)
Place a quote with the given package and prices.
This function takes in parameters needed for an order and places the quote.
Parameters
• package_keyname (str) – The keyname for the package being ordered
• location (str) – The datacenter location string for ordering (Ex: DALLAS13)
3.2. Managers 51
SoftLayer API Python Client Documentation, Release latest
• item_keynames (list) – The list of item keyname strings to order. To see list of
possible keynames for a package, use list_items() (or slcli order item-list)
• complex_type (str) – The complex type to send with the order. Typically begins with
SoftLayer_Container_Product_Order_.
• preset_keyname (string) – If needed, specifies a preset to use for that package. To
see a list of possible keynames for a package, use list_preset() (or slcli order preset-list)
• extras (dict) – The extra data for the order in dictionary format. Example: A VSI
order requires hostname and domain to be set, so extras will look like the following: {‘vir-
tualGuests’: [{‘hostname’: ‘test’, domain’: ‘softlayer.com’}]}
• quantity (int) – The number of resources to order
• quote_name (string) – A custom name to be assigned to the quote (optional).
• send_email (bool) – This flag indicates that the quote should be sent to the email
address associated with the account or order.
verify_order(package_keyname, location, item_keynames, complex_type=None, hourly=True, pre-
set_keyname=None, extras=None, quantity=1)
Verifies an order with the given package and prices.
This function takes in parameters needed for an order and verifies the order to ensure the given items are
compatible with the given package.
Parameters
• package_keyname (str) – The keyname for the package being ordered
• location (str) – The datacenter location string for ordering (Ex: DALLAS13)
• item_keynames (list) – The list of item keyname strings to order. To see list of
possible keynames for a package, use list_items() (or slcli order item-list)
• complex_type (str) – The complex type to send with the order. Typically begins with
SoftLayer_Container_Product_Order_.
• hourly (bool) – If true, uses hourly billing, otherwise uses monthly billing
• preset_keyname (string) – If needed, specifies a preset to use for that package. To
see a list of possible keynames for a package, use list_preset() (or slcli order preset-list)
• extras (dict) – The extra data for the order in dictionary format. Example: A VSI
order requires hostname and domain to be set, so extras will look like the following: ‘vir-
tualGuests’: [{‘hostname’: ‘test’, ‘domain’: ‘softlayer.com’}]}
• quantity (int) – The number of resources to order
verify_quote(quote_id, extra)
Verifies that a quote order is valid.
extras = {
'hardware': {'hostname': 'test', 'domain': 'testing.com'},
'quantity': 2
}
manager = ordering.OrderingManager(env.client)
result = manager.verify_quote(12345, extras)
Parameters
• quote_id (int) – ID for the target quote
3.2.17 SoftLayer.sshkey
3.2. Managers 53
SoftLayer API Python Client Documentation, Release latest
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
3.2.18 SoftLayer.ssl
SSL Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.ssl.SSLManager(client)
Manages SSL certificates in SoftLayer.
See product information here: http://www.softlayer.com/ssl-certificates
Example:
add_certificate(certificate)
Creates a new certificate.
Parameters certificate (dict) – A dictionary representing the parts of the certificate. See
sldn.softlayer.com for more info.
Example:
cert = ??
result = mgr.add_certificate(certificate=cert)
edit_certificate(certificate)
Updates a certificate with the included options.
The provided dict must include an ‘id’ key and value corresponding to the certificate ID that should be
updated.
Parameters certificate (dict) – the certificate to update.
Example:
get_certificate(cert_id)
Gets a certificate with the ID specified.
Parameters cert_id (integer) – the certificate ID to retrieve
Example:
cert = mgr.get_certificate(cert_id=1234)
print(cert)
list_certs(method=’all’)
List all certificates.
Parameters method (string) – The type of certificates to list. Options are ‘all’, ‘expired’,
and ‘valid’.
Returns A list of dictionaries representing the requested SSL certs.
Example:
remove_certificate(cert_id)
Removes a certificate.
Parameters cert_id (integer) – a certificate ID to remove
Example:
3.2.19 SoftLayer.ticket
Ticket Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.ticket.TicketManager(client)
Manages SoftLayer support tickets.
See product information here: http://www.softlayer.com/support
Parameters client (SoftLayer.API.BaseClient) – the client instance
attach_hardware(ticket_id=None, hardware_id=None)
Attach hardware to a ticket.
Parameters
• ticket_id (integer) – the id of the ticket to attach to
• hardware_id (integer) – the id of the hardware to attach
Returns dict – The new ticket attachment
attach_virtual_server(ticket_id=None, virtual_id=None)
Attach a virtual server to a ticket.
Parameters
3.2. Managers 55
SoftLayer API Python Client Documentation, Release latest
update_ticket(ticket_id=None, body=None)
Update a ticket.
Parameters
• ticket_id (integer) – the id of the ticket to update
• body (string) – entry to update in the ticket
upload_attachment(ticket_id=None, file_path=None, file_name=None)
Upload an attachment to a ticket.
Parameters
• ticket_id (integer) – the id of the ticket to upload the attachment to
• file_path (string) – The path of the attachment to be uploaded
• file_name (string) – The name of the attachment shown in the ticket
Returns dict – The uploaded attachment
3.2.20 SoftLayer.vs
VS Manager/helpers
license MIT, see LICENSE for more details.
class SoftLayer.managers.vs.VSManager(client, ordering_manager=None)
Manages SoftLayer Virtual Servers.
See product information here: http://www.softlayer.com/virtual-servers
Example:
Parameters
• client (SoftLayer.API.BaseClient) – the client instance
• ordering_manager (SoftLayer.managers.OrderingManager) – an optional
manager to handle ordering. If none is provided, one will be auto initialized.
cancel_instance(instance_id)
Cancel an instance immediately, deleting all its data.
Parameters instance_id (integer) – the instance ID to cancel
Example:
3.2. Managers 57
SoftLayer API Python Client Documentation, Release latest
Example:: name = “Testing Images” notes = “Some notes about this image” result =
mgr.capture(instance_id=12345, name=name, notes=notes)
Parameters
• instance_id (int) – The ID of the VS
• public (bool) – Flag to indicate which interface to change. True (default) means the
public interface. False indicates the private interface.
• speed (int) – The port speed to set.
create_instance(**kwargs)
Creates a new virtual server instance.
Example:
new_vsi = {
'domain': u'test01.labs.sftlyr.ws',
'hostname': u'minion05',
'datacenter': u'hkg02',
'flavor': 'BL1_1X2X100'
'dedicated': False,
'private': False,
(continues on next page)
vsi = mgr.create_instance(**new_vsi)
# vsi will have the newly created vsi details if done properly.
print vsi
Parameters
• cpus (int) – The number of virtual CPUs to include in the instance.
• memory (int) – The amount of RAM to order.
• hourly (bool) – Flag to indicate if this server should be billed hourly (default) or
monthly.
• hostname (string) – The hostname to use for the new server.
• domain (string) – The domain to use for the new server.
• local_disk (bool) – Flag to indicate if this should be a local disk (default) or a SAN
disk.
• datacenter (string) – The short name of the data center in which the VS should
reside.
• os_code (string) – The operating system to use. Cannot be specified if image_id is
specified.
• image_id (int) – The GUID of the image to load onto the server. Cannot be specified
if os_code is specified.
• dedicated (bool) – Flag to indicate if this should be housed on adedicated or shared
host (default). This will incur a fee on your account.
• public_vlan (int) – The ID of the public VLAN on which you want this VS placed.
• public_security_groups (list) – The list of security group IDs to apply to the
public interface
• private_security_groups (list) – The list of security group IDs to apply to the
private interface
• private_vlan (int) – The ID of the private VLAN on which you want this VS placed.
• disks (list) – A list of disk capacities for this server.
• post_uri (string) – The URI of the post-install script to run after reload
• private (bool) – If true, the VS will be provisioned only with access to the private
network. Defaults to false
• ssh_keys (list) – The SSH keys to add to the root user
• nic_speed (int) – The port speed to set
• tags (string) – tags to set on the VS as a comma separated list
3.2. Managers 59
SoftLayer API Python Client Documentation, Release latest
• flavor (string) – The key name of the public virtual server flavor being ordered.
• host_id (int) – The host id of a dedicated host to provision a dedicated host virtual
server on.
create_instances(config_list)
Creates multiple virtual server instances.
This takes a list of dictionaries using the same arguments as create_instance().
Example:
vsi = mgr.create_instances(config_list=instances)
#vsi will be a dictionary of all the new virtual servers
print vsi
• tags (string) – tags to set on the VS as a comma separated list. Use the empty string
to remove all tags.
Returns bool – True or an Exception
get_bandwidth_allocation(instance_id)
Combines getBandwidthAllotmentDetail() and getBillingCycleBandwidthUsage()
get_bandwidth_data(instance_id, start_date=None, end_date=None, direction=None,
rollup=3600)
Gets bandwidth data for a server
Will get averaged bandwidth data for a given time period. If you use a rollup over 3600 be aware that the
API will bump your start/end date to align with how data is stored. For example if you have a rollup of
86400 your start_date will be bumped to 00:00. If you are not using a time in the start/end date fields, this
won’t really matter.
Parameters
• instance_id (int) – Hardware Id to get data for
• start_date (date) – Date to start pulling data for.
• end_date (date) – Date to finish pulling data for
• direction (string) – Can be either ‘public’, ‘private’, or None for both.
• rollup (int) – 300, 600, 1800, 3600, 43200 or 86400 seconds to average data over.
get_create_options()
Retrieves the available options for creating a VS.
Returns A dictionary of creation options.
Example:
get_instance(instance_id, **kwargs)
Get details about a virtual server instance.
Parameters instance_id (integer) – the instance ID
Returns A dictionary containing a large amount of information about the specified instance.
Example:
3.2. Managers 61
SoftLayer API Python Client Documentation, Release latest
Parameters
• hourly (boolean) – include hourly instances
• monthly (boolean) – include monthly instances
• tags (list) – filter based on list of tags
• cpus (integer) – filter based on number of CPUS
• memory (integer) – filter based on amount of memory
• hostname (string) – filter based on hostname
• domain (string) – filter based on domain
• local_disk (string) – filter based on local_disk
• datacenter (string) – filter based on datacenter
• nic_speed (integer) – filter based on network speed (in MBPS)
• public_ip (string) – filter based on public ip address
• private_ip (string) – filter based on private ip address
• transient (boolean) – filter on transient or non-transient instances
• **kwargs (dict) – response-level options (mask, limit, etc.)
order_guest(guest_object, test=False)
Uses Product_Order::placeOrder to create a virtual guest.
Useful when creating a virtual guest with options not supported by Virtual_Guest::createObject specifically
ipv6 support.
Parameters guest_object (dictionary) – See Soft-
Layer.CLI.virt.create._parse_create_args
Example:
new_vsi = {
'domain': u'test01.labs.sftlyr.ws',
'hostname': u'minion05',
'datacenter': u'hkg02',
'flavor': 'BL1_1X2X100'
'dedicated': False,
'private': False,
'transient': False,
'os_code' : u'UBUNTU_LATEST',
'hourly': True,
'ssh_keys': [1234],
'disks': ('100','25'),
'local_disk': True,
'tags': 'test, pleaseCancel',
'public_security_groups': [12, 15],
'ipv6': True
}
vsi = mgr.order_guest(new_vsi)
# vsi will have the newly created vsi receipt.
# vsi['orderDetails']['virtualGuests'] will be an array of created Guests
print vsi
Warning: This will reformat the primary drive. Post-provision script MUST be HTTPS for it to be
executed.
Example:
3.2. Managers 63
SoftLayer API Python Client Documentation, Release latest
rescue(instance_id)
Reboot a VSI into the Xen recsue kernel.
Parameters instance_id (integer) – the instance ID to rescue
Returns bool – True or an Exception
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
set_tags(tags, guest_id)
Sets tags on a guest with a retry decorator
Just calls guest.setTags, but if it fails from an APIError will retry
upgrade(instance_id, cpus=None, memory=None, nic_speed=None, public=True, preset=None)
Upgrades a VS instance.
Example:
Parameters
• instance_id (int) – Instance id of the VS to be upgraded
• cpus (int) – The number of virtual CPUs to upgrade to of a VS instance.
• preset (string) – preset assigned to the vsi
• memory (int) – RAM of the VS to be upgraded to.
• nic_speed (int) – The port speed to set
• public (bool) – CPU will be in Private/Public Node.
Returns bool
verify_create_instance(**kwargs)
Verifies an instance creation command.
Without actually placing an order. See create_instance() for a list of available options.
Example:
new_vsi = {
'domain': u'test01.labs.sftlyr.ws',
'hostname': u'minion05',
'datacenter': u'hkg02',
'flavor': 'BL1_1X2X100'
'dedicated': False,
(continues on next page)
vsi = mgr.verify_create_instance(**new_vsi)
# vsi will be a SoftLayer_Container_Product_Order_Virtual_Guest
# if your order is correct. Otherwise you will get an exception
print vsi
3.2.21 SoftLayer.vs_capacity
3.2. Managers 65
SoftLayer API Python Client Documentation, Release latest
Parameters
• client (SoftLayer.API.BaseClient) – the client instance
• ordering_manager (SoftLayer.managers.OrderingManager) – an optional
manager to handle ordering. If none is provided, one will be auto initialized.
list()
List Reserved Capacities
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
3.2.22 SoftLayer.vs_placement
create(placement_object)
Creates a placement group
A placement_object is defined as:
placement_object = {
'backendRouterId': 12345,
'name': 'Test Name',
'ruleId': 12345
}
• https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/
delete(group_id)
Deletes a PlacementGroup
Placement group must be empty to be deleted. https://softlayer.github.io/reference/services/SoftLayer_
Virtual_PlacementGroup/deleteObject
get_all_rules()
Returns all available rules for creating a placement group
3.2. Managers 67
SoftLayer API Python Client Documentation, Release latest
get_backend_router_id_from_hostname(hostname)
Finds the backend router Id that matches the hostname given
No way to use an objectFilter to find a backendRouter, so we have to search the hard way.
get_object(group_id, mask=None)
Returns a PlacementGroup Object
https://softlayer.github.io/reference/services/SoftLayer_Virtual_PlacementGroup/getObject
get_routers()
Calls SoftLayer_Virtual_PlacementGroup::getAvailableRouters()
get_rule_id_from_name(name)
Finds the rule that matches name.
SoftLayer_Virtual_PlacementGroup_Rule.getAllObjects doesn’t support objectFilters.
list(mask=None)
List existing placement groups
Calls SoftLayer_Account::getPlacementGroups
resolve_ids(identifier)
Takes a string and tries to resolve to a list of matching ids.
What exactly ‘identifier’ can be depends on the resolvers
Parameters identifier (string) – identifying string
Returns list
If you need more power or functionality than the managers provide, you can make direct API calls as well.
For full control over your account and services, you can directly call the SoftLayer API. The SoftLayer API client for
python leverages SoftLayer’s XML-RPC API. It supports authentication, object masks, object filters, limits, offsets,
and retrieving objects by id. The following section assumes you have an initialized client named ‘client’.
The best way to test our setup is to call the getObject method on the SoftLayer_Account service.
client.call('Account', 'getObject')
For a more complex example we’ll retrieve a support ticket with id 123456 along with the ticket’s updates, the user it’s
assigned to, the servers attached to it, and the datacenter those servers are in. To retrieve our extra information using
an object mask.
Retrieve a ticket using object masks.
Now add an update to the ticket with Ticket.addUpdate. This uses a parameter, which translate to positional arguments
in the order that they appear in the API docs.
client.call('Account', 'getVirtualGuests',
filter={'virtualGuests': {'domain': {'operation': 'example.com'}}})
This call gets tickets created between the beginning of March 1, 2013 and March 15, 2013. More information on
Object Filters.
NOTE The value field for startDate and endDate is in [], if you do not put the date in brackets the filter
will not work.
client.call('Account', 'getTickets',
filter={
'tickets': {
'createDate': {
'operation': 'betweenDate',
'options': [
{'name': 'startDate', 'value': ['03/01/2013 0:0:0']},
{'name': 'endDate', 'value': ['03/15/2013 23:59:59']}
]
}
}
}
)
NOTE client.call(iter=True) will pull all results, then return. client.iter_call() will return a generator,
and only make API calls as you iterate over the results.
Here’s how to create a new Cloud Compute Instance using SoftLayer_Virtual_Guest.createObject. Be warned, this
call actually creates an hourly virtual server so this will have billing implications.
client.call('Virtual_Guest', 'createObject', {
'hostname': 'myhostname',
'domain': 'example.com',
'startCpus': 1,
'maxMemory': 1024,
'hourlyBillingFlag': 'true',
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
'localDiskFlag': 'false'
})
3.4 Debugging
If you ever need to figure out what exact API call the client is making, you can do the following:
NOTE the print_reproduceable method produces different output for REST and XML-RPC endpoints. If you are using
REST, this will produce a CURL call. IF you are using XML-RPC, it will produce some pure python code you can
use outside of the SoftLayer library.
Usage:
• username – an optional API username if you wish to bypass the package’s built-in user-
name
• api_key – an optional API key if you wish to bypass the package’s built in API key
• endpoint_url – the API endpoint base URL you wish to connect to. Set this to
API_PRIVATE_ENDPOINT to connect via SoftLayer’s private network.
• proxy – proxy to be used to make API calls
• timeout (integer) – timeout for API requests
• auth – an object which responds to get_headers() to be inserted into the xml-rpc headers.
Example: BasicAuthentication
• config_file – A path to a configuration file used to load settings
• user_agent – an optional User Agent to report when making API calls if you wish to
bypass the packages built in User Agent string
• transport – An object that’s callable with this signature: trans-
port(SoftLayer.transports.Request)
• verify (bool) – decide to verify the server’s SSL/TLS cert. DO NOT SET TO FALSE
WITHOUT UNDERSTANDING THE IMPLICATIONS.
Usage:
SoftLayer.Client(**kwargs)
Get a SoftLayer API Client using environmental settings.
Deprecated in favor of create_client_from_env()
class SoftLayer.BasicAuthentication(username, api_key)
Token-based authentication class.
Parameters
• str (api_key) – a user’s username
• str – a user’s API key
get_request(request)
Sets token-based auth headers.
exception SoftLayer.SoftLayerError
The base SoftLayer error.
exception SoftLayer.SoftLayerAPIError(fault_code, fault_string, *args)
SoftLayerAPIError is an exception raised during API errors.
Provides faultCode and faultString properties.
class SoftLayer.SoftLayerListResult(items=None, total_count=0)
A SoftLayer API list result.
total_count = None
total count of items that exist on the server. This is useful when paginating through a large list of objects.
Command-line Interface
The SoftLayer command line interface is available via the slcli command available in your PATH. The slcli command
is a reference implementation of SoftLayer API bindings for python and how to efficiently make API calls. See the
Usage Examples section to see how to discover all of the functionality not fully documented here.
Options
--ack-all
Acknowledge every upcoming event. Doing so will turn off the popup in the control portal
73
SoftLayer API Python Client Documentation, Release latest
Options
--ack
Acknowledge Event. Doing so will turn off the popup in the control portal
Arguments
IDENTIFIER
Required argument
List invoices
Options
--limit <limit>
How many invoices to get back. [default: 50]
--closed
Include invoices with a CLOSED status. [default: False]
--all
Return ALL invoices. There may be a lot of these. [default: False]
Invoice details
Options
--details
Shows a very detailed list of charges [default: False]
Arguments
IDENTIFIER
Required argument
Arguments
IDENTIFIER
Required argument
Options
--up, --down
‘–up’ adds guests, ‘–down’ removes guests.
--by, --to
‘–by’ will add/remove the specified number of guests. ‘–to’ will add/remove a number of guests to get the
group’s guest count to the specified number. [required]
--amount <amount>
Number of guests for the scale action. [required]
Arguments
IDENTIFIER
Required argument
Options
Arguments
IDENTIFIER
Required argument
Options
Arguments
IDENTIFIER
Required argument
Options
--name <name>
Scale group’s name.
--min <minimum>
Set the minimum number of guests
--max <maximum>
Set the maximum number of guests
--userdata <userdata>
User defined metadata string
-F, --userfile <userfile>
Read userdata from a file
--cpu <cpu>
Number of CPUs for new guests (existing not effected
--memory <memory>
RAM in MB or GB for new guests (existing not effected
Arguments
IDENTIFIER
Required argument
4.3.1 call-api
Call arbitrary API endpoints with the given SERVICE and METHOD.
Example:
Options
--id <_id>
Init parameter
-f, --filter <_filters>
Object filters. This should be of the form: ‘property=value’ or ‘nested.property=value’. Complex filters like
betweenDate are not currently supported. (multiple occurrence permitted)
--mask <mask>
String-based object mask
--limit <limit>
Result limit
--offset <offset>
Result offset
--output-python, --no-output-python
Show python example code instead of executing the call
Arguments
SERVICE
Required argument
METHOD
Required argument
PARAMETERS
Optional argument(s)
Options
--history <history>
Bandwidth, Hits, Ratio counted over history number of days ago. 89 is the maximum.
Arguments
UNIQUE_ID
Required argument
Options
--sortby <sortby>
Column to sort by
Options unique_id|domain|origin|vendor|cname|status
Options
Arguments
UNIQUE_ID
Required argument
ORIGIN
Required argument
PATH
Required argument
Arguments
UNIQUE_ID
Required argument
Arguments
UNIQUE_ID
Required argument
ORIGIN_PATH
Required argument
Arguments
UNIQUE_ID
Required argument
PATH
Required argument
4.5 Config
Options
Currently the types are as follows, more may be added in the future.
:......................:
: types :
:......................:
: Account :
: CDN :
: User :
: Bare Metal Instance :
: API Authentication :
: Server :
: CCI :
: Image :
: Bluemix LB :
: Facility :
: Cloud Object Storage :
: Security Group :
:......................:
4.7.1 hw bandwidth
Options
Arguments
IDENTIFIER
Required argument
4.7.2 hw cancel-reasons
hw cancel-reasons [OPTIONS]
4.7.3 hw cancel
Options
--immediate
Cancels the server immediately (instead of on the billing anniversary)
--comment <comment>
An optional comment to add to the cancellation ticket
--reason <reason>
An optional cancellation reason. See cancel-reasons for a list of available options
Arguments
IDENTIFIER
Required argument
4.7.4 hw create-options
hw create-options [OPTIONS]
4.7.5 hw create
hw create [OPTIONS]
Options
4.7.6 hw credentials
Arguments
IDENTIFIER
Required argument
4.7.7 hw detail
Options
--passwords
Show passwords (check over your shoulder!)
--price
Show associated prices
Arguments
IDENTIFIER
Required argument
4.7.8 hw edit
Options
Options 0|10|100|1000|10000|-1
Arguments
IDENTIFIER
Required argument
When setting port speed, use “-1” to indicate best possible configuration. Using 10/100/1000/10000 on a server with a
redundant interface may result the interface entering a degraded state. See setPublicNetworkInterfaceSpeed for more
information.
4.7.9 hw list
hw list [OPTIONS]
Options
4.7.10 hw power-cycle
Arguments
IDENTIFIER
Required argument
4.7.11 hw power-off
Arguments
IDENTIFIER
Required argument
4.7.12 hw power-on
Power on a server.
Arguments
IDENTIFIER
Required argument
4.7.13 hw reboot
Options
--hard, --soft
Perform a hard or soft reboot
Arguments
IDENTIFIER
Required argument
4.7.14 hw reload
Options
Arguments
IDENTIFIER
Required argument
4.7.15 hw rescue
Arguments
IDENTIFIER
Required argument
4.7.16 hw reflash-firmware
Arguments
IDENTIFIER
Required argument
Reflash here means the current version of the firmware running on your server will be re-flashed onto the selected
hardware. This does require a reboot. See slcli hw update-firmware if you want the newest version.
4.7.17 hw update-firmware
Arguments
IDENTIFIER
Required argument
This function updates the firmware of a server. If already at the latest version, no software is installed.
4.7.18 hw toggle-ipmi
Options
--enable, --disable
Whether enable (DEFAULT) or disable the interface.
Arguments
IDENTIFIER
Required argument
4.7.19 hw ready
Options
--wait <wait>
Seconds to wait [default: 0]
Arguments
IDENTIFIER
Required argument
The IPSEC Command-line Interface commands can be used to configure an existing IPSEC tunnel context. Subnets in
the SoftLayer private network can be associated to the tunnel context along with user-defined remote subnets. Address
translation entries may also be defined to provide NAT functionality from static subnet IP addresses associated with
the tunnel context to user-defined remote subnet IP addresses.
Note: Most CLI actions that affect an IPSEC tunnel context do not result in configuration changes to SoftLayer
network devices. A separate configure command is available to issue a device configuration request.
To see more information about the IPSEC tunnel context module and API internaction, see IPSEC Module documen-
tation.
A list of all IPSEC tunnel contexts associated with the current user’s account can be retrieved via the ipsec list
command. This provides a brief overview of all tunnel contexts and can be used to retrieve an individual context’s
identifier, which all other CLI commands require.
$ slcli ipsec list
:.....:..........:...............:..........................:........................
˓→:...........................:
:.....:..........:...............:..........................:........................
˓→:...........................:
More detailed information can be retrieved for an individual context using the ipsec detail command. Using
the detail command, information about associated internal subnets, remote subnets, static subnets, service subnets and
address translations may also be retrieved using multiple instances of the -i|--include option.
$ slcli ipsec detail 445 -i at -i is -i rs -i sr -i ss
Context Details:
:.................................:...........................:
: name : value :
:.................................:...........................:
: id : 445 :
: name : ipsec038 :
: friendly name : ipsec tunnel :
: internal peer IP address : 173.192.250.79 :
: remote peer IP address : 158.85.80.22 :
: advanced configuration flag : 0 :
: preshared key : secret :
: phase 1 authentication : MD5 :
: phase 1 diffie hellman group : 0 :
: phase 1 encryption : DES :
(continues on next page)
Internal Subnets:
:........:....................:......:......:
: id : network identifier : cidr : note :
:........:....................:......:......:
: 180767 : 10.28.67.128 : 26 : :
:........:....................:......:......:
Remote Subnets:
:......:....................:......:......:
: id : network identifier : cidr : note :
:......:....................:......:......:
: 7852 : 158.85.80.20 : 30 : :
:......:....................:......:......:
Static Subnets:
:........:....................:......:......:
: id : network identifier : cidr : note :
:........:....................:......:......:
: 231807 : 10.1.249.84 : 30 : :
:........:....................:......:......:
Service Subnets:
:........:....................:......:......:
: id : network identifier : cidr : note :
:........:....................:......:......:
: 162079 : 10.0.80.0 : 25 : :
:........:....................:......:......:
Most values listed in the tunnel context detail printout can be modified using the ipsec update command. The
following is given when executing with the -h|--help option and highlights all properties that may be modified.
$ slcli ipsec update -h
Usage: slcli ipsec update [OPTIONS] CONTEXT_ID
Updates are made atomically, so either all are accepted or none are.
Options:
--friendly-name TEXT Friendly name value
--remote-peer TEXT Remote peer IP address value
--preshared-key TEXT Preshared key value
--p1-auth, --phase1-auth [MD5|SHA1|SHA256]
Phase 1 authentication value
--p1-crypto, --phase1-crypto [DES|3DES|AES128|AES192|AES256]
Phase 1 encryption value
--p1-dh, --phase1-dh [0|1|2|5] Phase 1 diffie hellman group value
--p1-key-ttl, --phase1-key-ttl INTEGER RANGE
Phase 1 key life value
--p2-auth, --phase2-auth [MD5|SHA1|SHA256]
Phase 2 authentication value
--p2-crypto, --phase2-crypto [DES|3DES|AES128|AES192|AES256]
Phase 2 encryption value
--p2-dh, --phase2-dh [0|1|2|5] Phase 2 diffie hellman group value
--p2-forward-secrecy, --phase2-forward-secrecy INTEGER RANGE
Phase 2 perfect forward secrecy value
--p2-key-ttl, --phase2-key-ttl INTEGER RANGE
Phase 2 key life value
-h, --help Show this message and exit.
A request to configure SoftLayer network devices for a given tunnel context can be issued using the ipsec
configure command.
Note: Once a configuration request is received, the IPSEC tunnel context will be placed into an unmodifiable state, and
further changes against the tunnel context will be prevented. Once configuration changes have been made, the tunnel
context may again be modified. The unmodifiable state of a tunnel context is indicated by an advanced configuration
flag value of 1.
Internal, remote and service subnets can be associated to an IPSEC tunnel context using the ipsec subnet-add
command. Additionally, remote subnets can be created using this same command, which will then be associated to
the targeted tunnel context.
Note: The targeted subnet type must be specified. A subnet id must be provided when associating internal and service
subnets. Either a subnet id or a network identifier must be provided when associating remote subnets. If a network
identifier is provided when associating a remote subnet, that subnet will first be created and then associated to the
tunnel context.
The following is an example of creating and associating a remote subnet to a tunnel context.
Internal, remote and service subnets can be disassociated from an IPSEC tunnel context via the ipsec
subnet-remove command.
Note: The targeted subnet id and type must be specified. When disassociating remote subnets, that subnet record will
also be deleted.
Address translation entries can be added to a tunnel context to provide NAT functionality from a statically
routed subnet associated with the tunnel context to a remote subnet. This action is performed with the ipsec
translation-add command.
Note: Both static and remote IP address values must be specified. An optional note value may also be provided.
Address translation entries can be removed using the ipsec translation-remove command.
The following is an example of removing an address translation entry.
Address translation entries may also be modified using the ipsec translation-update command.
The following is an example of updating an existing address translation entry.
4.9 LoadBalancers
• LBaaS Product
• LBaaS Documentation
loadbal detail
Arguments
IDENTIFIER
Required argument
loadbal list
loadbal health
Options
--uuid <uuid>
Health check UUID to modify. [required]
-i, --interval <interval>
Seconds between checks. [2-60]
-r, --retry <retry>
Number of times before marking as DOWN. [1-10]
-t, --timeout <timeout>
Seconds to wait for a connection. [1-59]
-u, --url <url>
Url path for HTTP/HTTPS checks.
Arguments
IDENTIFIER
Required argument
loadbal member-add
Options
--private, --public
Private or public IP of the new member. [required]
-m, --member <member>
Member IP address. [required]
-w, --weight <weight>
Weight of this member.
Arguments
IDENTIFIER
Required argument
loadbal member-remote
4.9. LoadBalancers 95
SoftLayer API Python Client Documentation, Release latest
Options
Arguments
IDENTIFIER
Required argument
loadbal pool-add
Options
Arguments
IDENTIFIER
Required argument
loadbal pool-edit
Options
Arguments
IDENTIFIER
Required argument
LISTENER
Required argument
loadbal pool-delete
4.9. LoadBalancers 97
SoftLayer API Python Client Documentation, Release latest
Arguments
IDENTIFIER
Required argument
LISTENER
Required argument
loadbal l7pool-add
Options
Arguments
IDENTIFIER
Required argument
loadbal l7pool-del
Arguments
IDENTIFIER
Required argument
loadbal order
Options
loadbal order-options
4.9. LoadBalancers 99
SoftLayer API Python Client Documentation, Release latest
Options
loadbal cancel
Arguments
IDENTIFIER
Required argument
loadbal ns-detail
Arguments
IDENTIFIER
Required argument
loadbal ns-list
4.10 Ordering
The Order Command-line Interface commands can be used to build an order for any product in the SoftLayer catalog.
The basic flow for ordering goes something like this. . .
1. package-list
2. category-list <package key name>
3. item-list <package key name>
4. place <package key name> <item key names> <location>
Options
--keyword <keyword>
A word (or string) used to filter package names.
--package_type <package_type>
The keyname for the type of package. BARE_METAL_CPU for example
Note:
• CLOUD_SERVER: These are Virtual Servers
• BARE_METAL_INSTANCE: Hourly Bare Metal
• BARE_METAL_SERVER: Other monthly server types
• #_PROC_#_DRIVES: Packages in this format will contain only this CPU model and Drive bays
• ADDITIONAL_PRODUCTS: Additional IPs, Vlans, SSL certs and other things are in here
• NETWORK_GATEWAY_APPLIANCE: Vyattas
Bluemix services listed here may still need to be ordered through the Bluemix CLI/Portal
Arguments
PACKAGE_KEYNAME
Required argument
Options
--required
List only the required categories for the package
Arguments
PACKAGE_KEYNAME
Required argument
Shows all the available categories for a certain package, useful in finding the required categories. Categories that are
required will need to have a corresponding item included with any orders
These are all the required categories for BARE_METAL_SERVER
Note: Items with a numbered category, like disk0 or gpu0, can be included multiple times in an order to match how
many of the item you want to order.
# List Ubuntu OSes from the os category of the Bare Metal package
slcli order item-list BARE_METAL_SERVER --category os --keyword ubuntu
Options
--keyword <keyword>
A word (or string) used to filter item names.
--category <category>
Category code to filter items by
Arguments
PACKAGE_KEYNAME
Required argument
Shows all the prices for a given package. Collect all the items you want included on your server. Don’t forget to
include the required category items. If forgotten, order place will tell you about it.
Note: Presets are set CPU / RAM / Disk allotments. You still need to specify required items. Some packages do not
have presets.
Options
--keyword <keyword>
A word (or string) used to filter preset names.
Arguments
PACKAGE_KEYNAME
Required argument
Options
--preset <preset>
The order preset (if required by the package)
--verify
Flag denoting whether or not to only verify the order, not place it
--quantity <quantity>
The quantity of the item being ordered
--billing <billing>
Billing rate [default: hourly]
Options hourly|monthly
--complex-type <complex_type>
The complex type of the order. Starts with ‘SoftLayer_Container_Product_Order’.
--extras <extras>
JSON string denoting extra data that needs to be sent with the order
Arguments
PACKAGE_KEYNAME
Required argument
LOCATION
Required argument
ORDER_ITEMS
Optional argument(s)
Now that you have the package you want, the prices needed, and found a location, it is time to place an order.
4.11 Quotes
Options
--verify
If specified, will only show what the quote will order, will NOT place an order [default: False]
--quantity <quantity>
The quantity of the item being ordered if different from quoted value
--complex-type <complex_type>
The complex type of the order. Starts with ‘SoftLayer_Container_Product_Order’. [default: Soft-
Layer_Container_Product_Order_Hardware_Server]
-u, --userdata <userdata>
User defined metadata string
-F, --userfile <userfile>
Read userdata from file
-i, --postinstall <postinstall>
Post-install script to download
-k, --key <key>
SSH keys to add to the root user (multiple occurrence permitted)
--fqdn <fqdn>
<hostname>.<domain.name.tld> formatted name to use. Specify one fqdn per server (multiple occurrence per-
mitted) [required]
--image <image>
Image ID. See: ‘slcli image list’ for reference
Arguments
QUOTE
Required argument
View a quote
Arguments
QUOTE
Required argument
Place a quote.
This CLI command is used for creating a quote of the specified package in the given location (denoted by a data-
center’s long name). Orders made via the CLI can then be converted to be made programmatically by calling Soft-
Layer.OrderingManager.place_quote() with the same keynames.
Packages for ordering can be retrieved from slcli order package-list Presets for ordering can be retrieved from slcli
order preset-list (not all packages have presets)
Items can be retrieved from slcli order item-list. In order to find required items for the order, use slcli order category-
list, and then provide the –category option for each category code in slcli order item-list.
Example:
# Place quote a VSI with 4 CPU, 16 GB RAM, 100 GB SAN disk,
# Ubuntu 16.04, and 1 Gbps public & private uplink in dal13
slcli order place-quote --name "foobar" --send-email CLOUD_SERVER DALLAS13 \
GUEST_CORES_4 \
RAM_16_GB \
REBOOT_REMOTE_CONSOLE \
1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS \
BANDWIDTH_0_GB_2 \
1_IP_ADDRESS \
GUEST_DISK_100_GB_SAN \
OS_UBUNTU_16_04_LTS_XENIAL_XERUS_MINIMAL_64_BIT_FOR_VSI \
MONITORING_HOST_PING \
NOTIFICATION_EMAIL_AND_TICKET \
AUTOMATED_NOTIFICATION \
UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT \
NESSUS_VULNERABILITY_ASSESSMENT_REPORTING \
--extras '{"virtualGuests": [{"hostname": "test", "domain": "softlayer.com"}]}' \
--complex-type SoftLayer_Container_Product_Order_Virtual_Guest
Options
--preset <preset>
The order preset (if required by the package)
--name <name>
A custom name to be assigned to the quote (optional)
--send-email
The quote will be sent to the email address associated with your user.
--complex-type <complex_type>
The complex type of the order. Starts with ‘SoftLayer_Container_Product_Order’.
--extras <extras>
JSON string denoting extra data that needs to be sent with the order
Arguments
PACKAGE_KEYNAME
Required argument
LOCATION
Required argument
ORDER_ITEMS
Optional argument(s)
4.12 Reports
4.12.1 summary
Account summary.
summary [OPTIONS]
Options
--sortby <sortby>
Column to sort by
Options datacenter|hardware|virtual_servers|vlans|subnets|public_ips
A list of datacenters, and how many servers, VSI, vlans, subnets and public_ips are in each.
Options
--start <start>
datetime in the format ‘YYYY-MM-DD’ or ‘YYYY-MM-DD HH:MM:SS’
--end <end>
datetime in the format ‘YYYY-MM-DD’ or ‘YYYY-MM-DD HH:MM:SS’
--sortby <sortby>
Column to sort by [default: hostname]
4.13 Users
Version 5.6.0 introduces the ability to interact with user accounts from the cli.
Options
-e, --email TEXT Email address for this user. Required for creation. [required]
-p, --password TEXT Password to set for this user. If no password is provided, user will be sent
an email to generate one, which expires in 24 hours. ‘-p generate’ will create
a password for you (Requires Python 3.6+). Passwords require 8+ characters,
upper and lowercase, a number and a symbol.
-u, --from-user TEXT Base user to use as a template for creating this user. Will default to the user
running this command. Information provided in –template supersedes this tem-
plate.
-t, --template TEXT A json string describing https://softlayer.github.io/reference/datatypes/
SoftLayer_User_Customer/
-a, --api-key Create an API key for this user.
-h, --help Show this message and exit.
This command will list all Active users on the account that your user has access to view. There is the option to also
filter by username
Gives a variety of details about a specific user. <user> can be a user id, or username. Will always print a basic set of
information about the user, but there are a few extra flags to pull in more detailed information.
Will list the permissions the user has. To see a list of all possible permissions, or to change a user’s permissions, see
user permissions <user>
Will list the Hardware and Dedicated Hosts the user is able to access.
Will list the Virtual Guests the user has access to.
Show login history of this user for the last 30 days. IBMId Users will show logins properly, but may not show failed
logins.
Shows things that are logged in the Event_Log service. Logins, reboots, reloads, and other such actions will show up
here.
Will list off all permission keyNames, along with which are assigned to that specific user.
Enable or Disable specific permissions. It is possible to set multiple permissions in one command as well.
Will enable TICKET_EDIT, TICKET_ADD, and TICKET_SEARCH permissions for the USERID
Options
Using the SoftLayer portal to order virtual servers is fine, but for a number of reasons it’s often more convenient to use
the command line. For this, you can use SoftLayer’s command-line client to make administrative tasks quicker and
easier. This page gives an intro to working with SoftLayer virtual servers using SoftLayer’s command-line client.
Note: The following assumes that the client is already configured with valid SoftLayer credentials.
First, let’s list the current virtual servers with slcli vs list.
$ slcli vs list
:.....:............:.........................:.......:........:..............:........
˓→.....:....................:........:
:.....:............:.........................:.......:........:..............:........
˓→.....:....................:........:
We don’t have any virtual servers yet! Let’s fix that. Before we can create a virtual server (VS), we need to know what
options are available to us: RAM, CPU, operating systems, disk sizes, disk types, datacenters, and so on. Luckily,
there’s a simple command to show all options: slcli vs create-options.
Some values were ommitted for brevity
$ slcli vs create-options
:................................:....................................................
˓→.............................:
: name : value
˓→ :
:................................:....................................................
˓→.............................:
: datacenter : ams01
˓→ :
: : ams03
˓→ :
: : wdc07
˓→ :
: flavors (balanced) : B1_1X2X25
˓→ :
: : B1_1X2X25
˓→ :
: : B1_1X2X100
˓→ :
: cpus (standard) : 1,2,4,8,12,16,32,56
˓→ :
: cpus (dedicated) : 1,2,4,8,16,32,56
˓→ :
: cpus (dedicated host) : 1,2,4,8,12,16,32,56
˓→ :
: memory : 1024,2048,4096,6144,8192,12288,16384,32768,49152,
˓→65536,131072,247808 :
: memory (dedicated host) : 1024,2048,4096,6144,8192,12288,16384,32768,49152,
˓→65536,131072,247808 :
: os (CENTOS) : CENTOS_5_64
˓→ :
: : CENTOS_LATEST_64
˓→ :
: os (CLOUDLINUX) : CLOUDLINUX_5_64
˓→ :
: : CLOUDLINUX_6_64
˓→ :
: : CLOUDLINUX_LATEST
˓→ :
: : CLOUDLINUX_LATEST_64
˓→ :
(continues on next page)
Here’s the command to create a 2-core virtual server with 1GiB memory, running Ubuntu 14.04 LTS, and that is billed
on an hourly basis in the San Jose 1 datacenter using the command slcli vs create.
$ slcli vs create --hostname=example --domain=softlayer.com -f B1_1X2X25 -o DEBIAN_
˓→LATEST_64 --datacenter=ams01 --billing=hourly
This action will incur charges on your account. Continue? [y/N]: y
:..........:.................................:......................................:.
˓→..........................:
: ID : FQDN : guid :
˓→ Order Date :
:..........:.................................:......................................:.
˓→..........................:
:..........:.................................:......................................:.
˓→..........................:
(continues on next page)
After the last command, the virtual server is now being built. It should instantly appear in your virtual server list now.
$ slcli vs list
:.........:............:.......................:.......:........:................:....
˓→..........:....................:
Cool. You may ask, “It’s creating. . . but how do I know when it’s done?” Well, here’s how:
When the previous command returns, you’ll know that the virtual server has finished the provisioning process and is
ready to use. This is very useful for chaining commands together.
Now that you have your virtual server, let’s get access to it. To do that, use the slcli vs detail command. From the
example below, you can see that the username is ‘root’ and password is ‘ABCDEFGH’.
Warning: Be careful when using the –passwords flag. This will print the virtual server’s password on the screen.
Make sure no one is looking over your shoulder. It’s also advisable to change your root password soon after
creating your virtual server, or to create a user with sudo access and disable SSH-based login directly to the root
account.
4.14.1 vs bandwidth
Options
Arguments
IDENTIFIER
Required argument
If no timezone is specified, IMS local time (CST) will be assumed, which might not match your user’s selected
timezone.
4.14.2 vs cancel
Arguments
IDENTIFIER
Required argument
4.14.3 vs capture
Options
Arguments
IDENTIFIER
Required argument
4.14.4 vs create
vs create [OPTIONS]
Options
4.14.5 vs create-options
4.14.6 vs dns-sync
Options
-a, --a-record
Sync the A record for the host
--aaaa-record
Sync the AAAA record for the host
--ptr
Sync the PTR record for the host
--ttl <ttl>
Sets the TTL for the A and/or PTR records [default: 7200]
Arguments
IDENTIFIER
Required argument
4.14.7 vs edit
Options
Arguments
IDENTIFIER
Required argument
4.14.8 vs list
vs list [OPTIONS]
Options
4.14.9 vs pause
Arguments
IDENTIFIER
Required argument
4.14.10 vs power-on
Arguments
IDENTIFIER
Required argument
4.14.11 vs power-off
Options
--hard, --soft
Perform a hard shutdown
Arguments
IDENTIFIER
Required argument
4.14.12 vs resume
Arguments
IDENTIFIER
Required argument
4.14.13 vs rescue
Arguments
IDENTIFIER
Required argument
4.14.14 vs reboot
Options
--hard, --soft
Perform a hard or soft reboot
Arguments
IDENTIFIER
Required argument
4.14.15 vs ready
Options
--wait <wait>
Seconds to wait [default: 0]
Arguments
IDENTIFIER
Required argument
4.14.16 vs upgrade
Options
--cpu <cpu>
Number of CPU cores
--private
CPU core will be on a dedicated host server.
--memory <memory>
Memory in megabytes
--network <network>
Network port speed in Mbps
--flavor <flavor>
Flavor keyName Do not use –memory, –cpu or –private, if you are using flavors
Arguments
IDENTIFIER
Required argument
4.14.17 vs usage
Options
Arguments
IDENTIFIER
Required argument
There are two main concepts for Reserved Capacity. The Reserved Capacity Group and the Reserved Capacity Instance
The Reserved Capacity Group, is a set block of capacity set aside for you at the time of the order. It will contain a
set number of Instances which are all the same size. Instances can be ordered like normal VSIs, with the exception
that you need to include the reservedCapacityGroupId, and it must be the same size as the group you are ordering the
instance in.
• About Reserved Capacity
• Reserved Capacity FAQ
The SLCLI supports some basic Reserved Capacity Features.
vs capacity create
Warning: These groups can not be canceled until their contract expires in 1 or 3 years!
vs cacpacity create_options
This command will print out the Flavors that can be used to create a Reserved Capacity Group, as well as the backend
routers available, as those are needed when creating a new group.
vs capacity create_guest
This command will create a virtual server (Reserved Capacity Instance) inside of your Reserved Capacity Group. This
command works very similar to the slcli vs create command.
vs capacity detail
This command will print out some basic information about the specified Reserved Capacity Group.
vs capacity list
This command will list out all Reserved Capacity Groups. a # symbol represents a filled instance, and a - symbol
respresents an empty instance
: Reserved Capacity
˓→ :
:......:......................:............:......................:..............:....
˓→.......................:
:......:......................:............:......................:..............:....
˓→.......................:
A Placement Group is a way to control which physical servers your virtual servers get provisioned onto.
To create a Virtual_PlacementGroup object, you will need to know the following:
• backendRouterId, from getAvailableRouters
• ruleId, from getAllObjects
• name, can be any string, but most be unique on your account
Once a placement group is created, you can create new virtual servers in that group. Existing VSIs cannot be moved
into a placement group. When ordering a VSI in a placement group, make sure to set the placementGroupId for each
guest in your order.
use the –placementgroup option with vs create to specify creating a VSI in a specific group.
Placement groups can only be deleted once all the virtual guests in the group have been reclaimed.
vs placementgroup create
Options
vs placementgroup create-options
This command will print out the available routers and rule sets for use in creating a placement group.
vs placementgroup delete
This command will remove a placement group. The placement group needs to be empty for this command to succeed.
Options
--purge Delete all guests in this placement group. The group itself can be deleted once all
VMs are fully reclaimed
You can use the flag –purge to auto-cancel all VSIs in a placement group. You will still need to wait for them to be
reclaimed before proceeding to delete the group itself.
vs placementgroup list
: Placement Groups
˓→ :
:.......:...................:................:........:........:......................
˓→.....:
:.......:...................:................:........:........:......................
˓→.....:
vs placementgroup detail
This command will provide some detailed information about a specific placement group
$ slcli setup
Username []: username
API Key or Password []:
Endpoint (public|private|custom): public
:..............:..................................................................:
: Name : Value :
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:
Are you sure you want to write settings to "/home/me/.softlayer"? [y/N]: y
If you are using an account created from the https://cloud.ibm.com portal, your username will be literally apikey, and
use the key provided. How to create an IBM apikey
To see more about the config file format, see Configuration File.
Options:
--format [table|raw|json|jsonraw] Output format [default: raw]
-C, --config PATH Config file location [default: ~\.softlayer]
-v, --verbose Sets the debug noise level, specify multiple
˓→times for more verbosity.
Commands:
block Block Storage.
call-api Call arbitrary API endpoints.
cdn Content Delivery Network.
config CLI configuration.
dedicatedhost Dedicated Host.
dns Domain Name System.
event-log Event Logs.
file File Storage.
firewall Firewalls.
globalip Global IP addresses.
hardware Hardware servers.
image Compute images.
ipsec IPSEC VPN
loadbal Load balancers.
metadata Find details about this machine.
nas Network Attached Storage.
object-storage Object Storage.
order View and order from the catalog.
report Reports.
rwhois Referral Whois.
securitygroup Network security groups.
setup Edit configuration.
shell Enters a shell for slcli.
sshkey SSH Keys.
ssl SSL Certificates.
subnet Network subnets.
summary Account summary.
ticket Support tickets.
user Manage Users.
virtual Virtual Servers.
vlan Network VLANs.
As you can see, there are a number of commands/sections. To look at the list of subcommands for virtual servers type
slcli vs. For example:
$ slcli vs
Usage: slcli vs [OPTIONS] COMMAND [ARGS]...
Virtual Servers.
Options:
--help Show this message and exit.
Commands:
cancel Cancel virtual servers.
capture Capture SoftLayer image.
create Order/create virtual servers.
create-options Virtual server order options.
credentials List virtual server credentials.
detail Get details for a virtual server.
dns-sync Sync DNS records.
edit Edit a virtual server's details.
list List virtual servers.
network Manage network settings.
pause Pauses an active virtual server.
power_off Power off an active virtual server.
power_on Power on a virtual server.
ready Check if a virtual server is ready.
reboot Reboot an active virtual server.
reload Reload operating system on a virtual server.
rescue Reboot into a rescue image.
resume Resumes a paused virtual server.
upgrade Upgrade a virtual server.
Finally, we can make an actual call. Let’s list out the virtual servers on our account by using slcli vs list.
$ slcli vs list
:.........:............:....................:.......:........:................:.......
˓→.......:....................:
Most commands will take in additional options/arguments. To see all available actions, use –help.
Debugging
To see exactly what API call is being made by the SLCLI, you can use the verbose option.
A single -v will show a simple version of the API call, along with some statistics
slcli -v vs detail 74397127
Calling: SoftLayer_Virtual_Guest::getObject(id=74397127, mask='id,globalIdentifier,
˓→fullyQualifiedDomainName,hostname,domain', filter='None', args=(), limit=None,
˓→offset=None))
:..................:..............................................................:
: name : value :
:..................:..............................................................:
: execution_time : 2.020334s :
: api_calls : SoftLayer_Virtual_Guest::getObject (1.515583s) :
: : SoftLayer_Virtual_Guest::getReverseDomainRecords (0.494480s) :
: version : softlayer-python/v5.7.2 :
: python_version : 3.7.3 (default, Mar 27 2019, 09:23:15) :
: : [Clang 10.0.1 (clang-1001.0.46.3)] :
: library_location : /Users/chris/Code/py3/lib/python3.7/site-packages/SoftLayer :
:..................:..............................................................:
Using -vv will print out some API call details in the summary as well.
slcli -vv account summary
Calling: SoftLayer_Account::getObject(id=None, mask='mask[ nextInvoiceTotalAmount,
˓→pendingInvoice[invoiceTotalAmount], blockDeviceTemplateGroupCount,
:..................:.............................................................:
: name : value :
:..................:.............................................................:
: execution_time : 0.921271s :
: api_calls : SoftLayer_Account::getObject (0.911208s) :
(continues on next page)
131
SoftLayer API Python Client Documentation, Release latest
Using -vvv will print out the exact API that can be used without the softlayer-python framework, A simple python
code snippet for XML-RPC, a curl call for REST API calls. This is dependant on the endpoint you are using in the
config file.
˓→%0A++++++++++++pendingInvoice%5BinvoiceTotalAmount%5D%2C
˓→%0A++++++++++++blockDeviceTemplateGroupCount%2C%0A++++++++++++dedicatedHostCount%2C
˓→%0A++++++++++++domainCount%2C%0A++++++++++++hardwareCount%2C
˓→%0A++++++++++++networkStorageCount%2C%0A++++++++++++openTicketCount%2C
˓→%0A++++++++++++networkVlanCount%2C%0A++++++++++++subnetCount%2C
˓→%0A++++++++++++userCount%2C%0A++++++++++++virtualGuestCount%0A++++++++++++%5D'
Contributing
This page explains how to get started contributing code to the SoftLayer API Python Bindings project.
Before working with the SoftLayer Python API client source, we strongly recommend that you know how to use
Python’s virtual environment, virtualenv. Virtualenv allows you to create isolated Python environments that are indi-
vidually tailored to particular development projects. Each environment can have its own set of libraries and even its
own Python interpreter. This keeps them fully isolated, reducing the possibility of library conflicts between different
projects.
After you have virtualenv, you should set up a virtual environment and activate it whenever you are working on
softlayer-python. The commands needed to setup an environment and activate it might look something like this:
Please refer to the virtualenv documentation for more information about creating, and working with virtual environ-
ments.
133
SoftLayer API Python Client Documentation, Release latest
Once you have an appropriate environment, you will then download the SoftLayer API Python Bindings source code
by following the installation instructions. Change into softlayer-python source directory and run the following to
install the pre-requisites that you’ll need in order to run the test suites:
6.1.3 Testing
The project has a mix of functional and unit tests. Before submitting changes to be integrated into the project, you
should validate your code using tox. Simply issue the tox command from the root of the source tree:
tox
In addition to testing different versions of Python, tox checks for common mistakes in the code using Flake8 and
pylint. You should eliminate the linting errors that are reported before submitting your code. You can run only the
linting checks by using this command:
tox -eanalysis
The project’s configuration instructs tox to test against many different versions of Python. A tox test will use as many
of those as it can find on your local computer. Rather than installing all those versions, we recommend that you point
the Travis continuous integration tool at your GitHub fork. Travis will run the test against the full suite of Python
versions every time you push new code.
Using tox to run tests in multiple environments can be very time consuming. If you wish to quickly run the tests in
your own environment, you may do so using py.test. The command to do that is:
py.test tests
Fixtures
Testing of this project relies quite heavily on fixtures to simulate API calls. When running the unit tests, we use the
FixtureTransport class, which instead of making actual API calls, loads data from /fixtures/SoftLayer_Service_Name.py
and tries to find a variable that matches the method you are calling.
When adding new Fixtures you should try to sanitize the data of any account identifiying results, such as account ids,
username, and that sort of thing. It is ok to leave the id in place for things like datacenter ids, price ids.
To Overwrite a fixture, you can use a mock object to do so. Like either of these two methods:
# From tests/CLI/modules/vs_capacity_tests.py
from SoftLayer.fixtures import SoftLayer_Product_Package
def test_create_test(self):
item_mock = self.set_mock('SoftLayer_Product_Package', 'getItems')
item_mock.return_value = SoftLayer_Product_Package.getItems_RESERVED_CAPACITY
def test_detail_pending(self):
capacity_mock = self.set_mock('SoftLayer_Virtual_ReservedCapacityGroup',
˓→'getObject')
get_object = {
'name': 'test-capacity',
'instances': []
}
capacity_mock.return_value = get_object
6.1.4 Documentation
The project is documented in reStructuredText and built using Sphinx. If you have fabric installed, you simply need
to run the following to build the docs:
fab make_html
The documentation will be built in docs/_build/html. If you don’t have fabric, use the following commands.
cd docs
make html
sphinx-build -b html ./ ./html
6.1.5 Style
This project tries to follow PEP 8 and most of the style suggestions that pyflakes recommends. Run Flake8 regularly.
Flake8, with project-specific exceptions, can be run by using tox:
tox -e analysis
Autopep8 can fix a lot of the simple flake8 errors about whitespace and indention.
6.1.6 Contributing
Contributing to the Python API bindings follows the fork-pull-request model on GitHub. The project uses GitHub’s
issue tracker and pull requests to manage source control, bug fixes and new feature development regarding the API
bindings and the CLI. In order to contribute, we require that you sign a contributer agreemenet:
• Sign our contributor agreement (CLA) You can find the CLA here.
• If you’re contributing on behalf of your employer we’ll need a signed copy of our corporate contributor agree-
ment (CCLA) as well. You can find the CCLA here.
The SoftLayer CLI can be used to manage many different SoftLayer services directly from the command line.
The command line parsing is currently based on click, which is a command parsing library along with some additions
to dynamically load modules from a routes-like file and from entry points.
For the first example, we can create slcli table-example by creating the following file at Soft-
Layer/CLI/table_example.py:
import click
@click.command()
@environment.pass_env
def cli(env):
"""This returns an table that highlights how tables are output"""
# create a table with two columns: col1, col2
table = formatting.Table(['col1', 'col2'])
# add rows
table.add_row(['test', 'test'])
table.add_row(['test2', 'test2'])
env.fout(table)
Then we need to register it so that slcli table-example will know to route to this new module. We do that by adding
ALL_ROUTES in SoftLayer/CLI/routes.py to include the following:
...
('table-example', 'SoftLayer.CLI.table_example:cli'),
...
Which gives us
$ slcli table-example
:.......:.......:
: col1 : col2 :
:.......:.......:
: test : test :
: test2 : test2 :
:.......:.......:
Formatting of the data represented in the table is actually controlled upstream from the CLIRunnable’s making sup-
porting more data formats in the future easier.
6.2.2 Arguments
A command usually isn’t very useful without context or arguments of some kind. With click, you have a large array
of argument and option types at your disposal. Additionally, with the SoftLayer CLI, we have global options and
context which is stored in SoftLayer.CLI.environment.Environment and is attainable through a decorator located at
SoftLayer.CLI.environment.pass_env. An example of options and the environment is shown below. It also shows how
output should be done using env.out instead of printing. This is used for testing and to have a consistent way to print
things onto the screen.
import click
@click.command()
@click.option("--number",
required=True,
type=click.INT,
help="print different output")
@click.option("--choice",
type=click.Choice(['this', 'that']),
help="print different output")
@click.option("--test", help="print different output")
@environment.pass_env
def cli(env, number, choice, test):
"""Argument parsing example"""
if test:
env.out("Just testing, move along...")
else:
env.out("This is fo'realz!")
if choice == 'this':
env.out("Selected this")
elif choice == 'that':
env.out("Selected that")
A SoftLayer client is stood up for every command and is available through Soft-
Layer.CLI.environment.Environment.client. The example below shows how to make a simple API call to the
SoftLayer_Account::getObject.
import click
@click.command()
@environment.pass_env
def cli(env):
"""Using the SoftLayer API client"""
account = env.client['Account'].getObject()
return account['companyName']
When a confirmation fails, you probably want to stop execution and give a non-zero exit code. To do that, raise a
SoftLayer.CLI.exceptions.CLIAbort exception with the message for the user as the first parameter. This will prevent
any further execution and properly return the right error code.
External Links
139
SoftLayer API Python Client Documentation, Release latest
s
SoftLayer, 70
SoftLayer.managers.account, 8
SoftLayer.managers.autoscale, 9
SoftLayer.managers.block, 10
SoftLayer.managers.cdn, 15
SoftLayer.managers.dedicated_host, 17
SoftLayer.managers.dns, 20
SoftLayer.managers.event_log, 22
SoftLayer.managers.file, 23
SoftLayer.managers.firewall, 28
SoftLayer.managers.hardware, 29
SoftLayer.managers.image, 34
SoftLayer.managers.ipsec, 36
SoftLayer.managers.load_balancer, 39
SoftLayer.managers.metadata, 42
SoftLayer.managers.network, 43
SoftLayer.managers.ordering, 48
SoftLayer.managers.sshkey, 53
SoftLayer.managers.ssl, 54
SoftLayer.managers.ticket, 55
SoftLayer.managers.vs, 57
SoftLayer.managers.vs_capacity, 65
SoftLayer.managers.vs_placement, 67
141
SoftLayer API Python Client Documentation, Release latest
143
SoftLayer API Python Client Documentation, Release latest
144 Index
SoftLayer API Python Client Documentation, Release latest
Index 145
SoftLayer API Python Client Documentation, Release latest
146 Index
SoftLayer API Python Client Documentation, Release latest
Index 147
SoftLayer API Python Client Documentation, Release latest
148 Index
SoftLayer API Python Client Documentation, Release latest
Index 149
SoftLayer API Python Client Documentation, Release latest
Layer.managers.ipsec.IPSECManager Layer.managers.block.BlockStorageManager
method), 37 method), 11
create_securitygroup() (Soft- delete_snapshot() (Soft-
Layer.managers.network.NetworkManager Layer.managers.file.FileStorageManager
method), 44 method), 24
create_snapshot() (Soft- delete_zone() (Soft-
Layer.managers.block.BlockStorageManager Layer.managers.dns.DNSManager method),
method), 11 21
create_snapshot() (Soft- detach_hardware() (Soft-
Layer.managers.file.FileStorageManager Layer.managers.ticket.TicketManager method),
method), 24 56
create_ticket() (Soft- detach_securitygroup_component() (Soft-
Layer.managers.ticket.TicketManager method), Layer.managers.network.NetworkManager
56 method), 44
create_translation() (Soft- detach_securitygroup_components() (Soft-
Layer.managers.ipsec.IPSECManager Layer.managers.network.NetworkManager
method), 37 method), 45
create_zone() (Soft- detach_virtual_server() (Soft-
Layer.managers.dns.DNSManager method), Layer.managers.ticket.TicketManager method),
21 56
details() (SoftLayer.managers.autoscale.AutoScaleManager
D method), 9
deauthorize_host_to_volume() (Soft- disable_snapshots() (Soft-
Layer.managers.block.BlockStorageManager Layer.managers.block.BlockStorageManager
method), 11 method), 11
deauthorize_host_to_volume() (Soft- disable_snapshots() (Soft-
Layer.managers.file.FileStorageManager Layer.managers.file.FileStorageManager
method), 24 method), 24
DedicatedHostManager (class in Soft- DNSManager (class in SoftLayer.managers.dns), 20
Layer.managers.dedicated_host), 17 dump_zone() (SoftLayer.managers.dns.DNSManager
del_lb_l7_pool() (Soft- method), 21
Layer.managers.load_balancer.LoadBalancerManager
method), 40 E
delete() (SoftLayer.managers.vs_placement.PlacementManager
edit() (SoftLayer.managers.autoscale.AutoScaleManager
method), 67 method), 9
delete_image() (Soft- edit() (SoftLayer.managers.hardware.HardwareManager
Layer.managers.image.ImageManager method), 31
method), 34 edit() (SoftLayer.managers.image.ImageManager
delete_key() (Soft- method), 34
Layer.managers.sshkey.SshKeyManager edit() (SoftLayer.managers.vs.VSManager method),
method), 53 60
delete_lb_member() (Soft- edit_certificate() (Soft-
Layer.managers.load_balancer.LoadBalancerManager Layer.managers.ssl.SSLManager method),
method), 41 54
delete_record() (Soft- edit_dedicated_fwl_rules() (Soft-
Layer.managers.dns.DNSManager method), Layer.managers.firewall.FirewallManager
21 method), 28
delete_remote_subnet() (Soft- edit_key() (SoftLayer.managers.sshkey.SshKeyManager
Layer.managers.ipsec.IPSECManager method), 53
method), 37 edit_record() (Soft-
delete_securitygroup() (Soft- Layer.managers.dns.DNSManager method),
Layer.managers.network.NetworkManager 21
method), 44 edit_rwhois() (Soft-
delete_snapshot() (Soft- Layer.managers.network.NetworkManager
150 Index
SoftLayer API Python Client Documentation, Release latest
Index 151
SoftLayer API Python Client Documentation, Release latest
152 Index
SoftLayer API Python Client Documentation, Release latest
Index 153
SoftLayer API Python Client Documentation, Release latest
154 Index
SoftLayer API Python Client Documentation, Release latest
Index 155
SoftLayer API Python Client Documentation, Release latest
156 Index
SoftLayer API Python Client Documentation, Release latest
Index 157
SoftLayer API Python Client Documentation, Release latest
158 Index
SoftLayer API Python Client Documentation, Release latest
Index 159
SoftLayer API Python Client Documentation, Release latest
SoftLayerError, 72 V
SoftLayerListResult (class in SoftLayer), 72 verify_create_instance() (Soft-
SshKeyManager (class in SoftLayer.managers.sshkey), Layer.managers.vs.VSManager method),
53 64
SSLManager (class in SoftLayer.managers.ssl), 54 verify_order() (Soft-
start_data (SoftLayer.managers.cdn.CDNManager Layer.managers.dedicated_host.DedicatedHostManager
attribute), 17 method), 19
summary command line option verify_order() (Soft-
-sortby <sortby>, 108 Layer.managers.hardware.HardwareManager
summary_by_datacenter() (Soft- method), 34
Layer.managers.network.NetworkManager verify_order() (Soft-
method), 47 Layer.managers.ordering.OrderingManager
method), 52
T verify_quote() (Soft-
TicketManager (class in SoftLayer.managers.ticket), Layer.managers.ordering.OrderingManager
55 method), 52
total_count (SoftLayer.SoftLayerListResult at- vs-bandwidth command line option
tribute), 72 -e, -end_date <end_date>, 114
-p, -summary_period
U <summary_period>, 114
unassign_global_ip() (Soft- -q, -quite_summary, 114
Layer.managers.network.NetworkManager -s, -start_date <start_date>, 114
method), 47 IDENTIFIER, 114
UNIQUE_ID vs-cancel command line option
cdn-detail command line option, 78 IDENTIFIER, 115
cdn-origin-add command line option, vs-capture command line option
79 -all <all>, 115
cdn-origin-list command line -note <note>, 115
option, 80 -n, -name <name>, 115
cdn-origin-remove command line IDENTIFIER, 115
option, 80 vs-create command line option
cdn-purge command line option, 80 -billing <billing>, 116
update_firmware() (Soft- -boot-mode <boot_mode>, 116
Layer.managers.hardware.HardwareManager -dedicated, -public, 116
method), 33 -disk <disk>, 116
update_lb_health_monitors() (Soft- -export <export>, 116
Layer.managers.load_balancer.LoadBalancerManager-host-id <host_id>, 116
method), 42 -image <image>, 116
update_ticket() (Soft- -ipv6, 117
Layer.managers.ticket.TicketManager method), -like <like>, 116
56 -placementgroup <placementgroup>,
update_translation() (Soft- 117
Layer.managers.ipsec.IPSECManager -private, 116
method), 39 -san, 116
update_tunnel_context() (Soft- -subnet-private <subnet_private>,
Layer.managers.ipsec.IPSECManager 117
method), 39 -subnet-public <subnet_public>, 117
upgrade() (SoftLayer.managers.vs.VSManager -test, 116
method), 64 -transient, 117
upload_attachment() (Soft- -vlan-private <vlan_private>, 117
Layer.managers.ticket.TicketManager method), -vlan-public <vlan_public>, 117
57 -wait <wait>, 117
-D, -domain <domain>, 115
-F, -userfile <userfile>, 116
160 Index
SoftLayer API Python Client Documentation, Release latest
Index 161