forked from softlayer/softlayer.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
243 lines (192 loc) · 10 KB
/
Copy pathindex.html
File metadata and controls
243 lines (192 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="SoftLayer API Examples, implementations, and release notes.">
<meta name="author" content="SoftLayer">
<title>Order a Local Load Balancer - https://softlayer.github.io/</title>
<link rel="canonical" href="https://softlayer.github.io/python/createlbpython/">
<link href="https://softlayer.github.io/css/bootstrap.css" rel="stylesheet">
<link href="https://softlayer.github.io/css/font-awesome.css" rel="stylesheet">
<link href="https://softlayer.github.io/css/custom.css" rel="stylesheet">
<link href="https://softlayer.github.io/css/highlight/solarized_dark.css" rel="stylesheet">
<script src="https://softlayer.github.io/js/highlight.pack.js"></script>
<script src="https://softlayer.github.io/js/jquery.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<link rel="shortcut icon" href="https://softlayer.github.io/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css"
href="//fonts.googleapis.com/css?family=Lato" />
<script>
$(document).ready(function() {
$('table').addClass("table table-hover table-striped")
})
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-88235803-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://softlayer.github.io/">SoftLayer API Examples</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="https://softlayer.github.io/go/">go</a></li>
<li><a href="https://softlayer.github.io/perl/">perl</a></li>
<li><a href="https://softlayer.github.io/php/">php</a></li>
<li><a href="https://softlayer.github.io/python/">python</a></li>
<li><a href="https://softlayer.github.io/rest/">rest</a></li>
<li><a href="https://softlayer.github.io/ruby/">ruby</a></li>
<li><a href="https://softlayer.github.io/tools/">tools</a></li>
</ul>
<div id="custom-search-input" class="pull-right">
<form class="navbar-form" role="search" method="get" action="https://www.bing.com/">
<div class="input-group col-md-12">
<input type="text" class="form-control input-md" placeholder="Search" name="q" id="srch-term">
<input type="hidden" name="q1" value="site:softlayer.github.io" />
<div class="input-group-btn">
<button class="btn btn-info" type="submit">
<i class="glyphicon glyphicon-search"></i>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-3">
<div style="word-wrap: break-word;">
<h4>April 29, 2016<br></h4>
</div>
</div>
<div class="col-md-9">
<strong>Classes <span class="fa fa-book"/></strong>
<a class="label label-primary" href="https://softlayer.github.io/classes/softlayer_product_order">SoftLayer_Product_Order</a>
<br>
<strong>Tags <span class="fa fa-tags"/></strong>
<a class="label label-danger" href="https://softlayer.github.io/tags/placeorder">placeOrder</a>
<a class="label label-danger" href="https://softlayer.github.io/tags/verifyorder">verifyOrder</a>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="well well-sm release-note" style="word-wrap: break-word;">
<h3>Order a Local Load Balancer<br> <small>Order a local load balancer using SoftLayer_Product_Item_Price objects</small></h3>
<pre><code class="language-python">"""
Order a load balancer
Important manual pages:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Product_Item_Price
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/verifyOrder
http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
import json
# The package to order load balancers.
packageId = 194
# Build a skeleton SoftLayer_Product_Item_Price objects. These objects contain
# much more than ids, but SoftLayer's ordering system only needs the price's id
# to know what you want to order.
# Since Load Balancers can have Location Specific itemPriceId's I am using the following script to
# return just the standard (location agnostic) itemPriceId's.
# https://gist.github.com/greyhoundforty/a0b55afcab9bc758405e21a39b93c63d
# In my case I am going with 'Load Balancer 500 VIP Connections'
prices = [
{
"id": 2078
}
]
# Declare the API client.
client = SoftLayer.Client()
productOrderService = client['SoftLayer_Product_Order']
orderData = {
"prices": prices,
"packageId": packageId,
"location": "DALLAS06"
}
try:
# verifyOrder() will check your order for errors. Replace this with a call to
# placeOrder() when you're ready to order. Both calls return a receipt object
# that you can use for your records.
response = productOrderService.verifyOrder(orderData)
print(json.dumps(response, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
# If there was an error returned from the SoftLayer API then bomb out with the
# error message.
print("Unable to place the order. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
</code></pre>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading" style="padding: 2px 15px;">
<h4>More Documentation</h4>
</div>
<div class="panel-body">
<a href="http://sldn.softlayer.com/reference/softlayerapi"><i class="fa fa-link"></i> SoftLayer API Reference<br></a>
<a href="https://github.com/softlayer/softlayer-java"><i class="fa fa-github"></i> softlayer-java<br></a>
<a href="https://github.com/softlayer/softlayer-api-perl-client"><i class="fa fa-github"></i> softlayer-perl<br></a>
<a href="https://github.com/softlayer/softlayer-api-php-client"><i class="fa fa-github"></i> softlayer-php<br></a>
<a href="https://github.com/softlayer/softlayer-python"><i class="fa fa-github"></i> softlayer-python<br></a>
<a href="https://github.com/softlayer/softlayer-ruby"><i class="fa fa-github"></i> softlayer-ruby<br></a>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading text-center" style="padding: 2px 15px;">
<a href="https://www.facebook.com/IBMBluemixIaaS/"><i class="fa fa-facebook-square" alt="facebook"></i> </a>
<a href="https://twitter.com/IBMBluemixIaaS"><i class="fa fa-twitter" alt="twitter"></i> </a>
<a href="http://www.linkedin.com/company/softlayer-technologies-inc-" alt="linked-in"><i class="fa fa-linkedin-square"></i> </a>
<a href="https://github.com/softlayer"><i class="fa fa-github" alt="github"></i> </a>
<a href="irc://irc.freenode.net/softlayer"><i class="fa fa-comment" alt="irc"></i> </a>
</div>
</div>
</div>
<div class="col-md-6">
<div class="well well-sm" style="word-wrap: break-word;">
<strong>Feedback? <span class="fa fa-comment"/></strong>
<p>
We would love to hear it<br>
<a class="" href="https://github.com/softlayer/api_examples/issues/new?title=Feedback%20for%20python%20-%20Order%20a%20Local%20Load%20Balancer&body=Feedback+regarding%3A%20https%3a%2f%2fsoftlayer.github.io%2fpython%2fcreatelbpython%2f"><span class="fa fa-github-square"/> Open an issue</a>
</p>
</div>
</div>
</div>
<footer>
<div class="row">
<hr>
<div class="col-sm-12">
<p>© SoftLayer 2015<br>
Built with <a href="https://github.com/spf13/hugo">Hugo</a></p>
</div>
</div>
</footer>
</div>
<script src="https://softlayer.github.io/js/jquery.js"></script>
<script src="https://softlayer.github.io/js/bootstrap.js"></script>
</body>
</html>
/python/createlbpython/