Skip to content

Commit 86c3489

Browse files
author
André Rodrigues
committed
Merge pull request #64 from huguesv/mgmt
Mgmt
2 parents 3e4404d + 1e050c8 commit 86c3489

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4863
-262
lines changed

ChangeLog.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
2012-??-?? Version 0.9.0
2-
* Initial Release
1+
2012-10-16 Version 0.6.0
2+
* Added service management API
3+
* Added ability to specify custom hosts
4+
* Added proxy server support (HTTP CONNECT tunneling)
5+
2012-06-06 Version 0.5.0
6+
* Initial Release

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ Python Developer Center.
2121
* Service Bus
2222
* Queues: create, list and delete queues; create, list, and delete subscriptions; send, receive, unlock and delete messages
2323
* Topics: create, list, and delete topics; create, list, and delete rules
24+
* Service Management
25+
* storage accounts: create, update, delete, list, regenerate keys
26+
* affinity groups: create, update, delete, list, get properties
27+
* locations: list
28+
* hosted services: create, update, delete, list, get properties
29+
* deployment: create, get, delete, swap, change configuration, update status, upgrade, rollback
30+
* role instance: reboot, reimage
31+
* discover addresses and ports for the endpoints of other role instances in your service
32+
* get configuration settings and access local resources
33+
* get role instance information for current role and other role instances
34+
* query and set the status of the current role
2435

2536
# Getting Started
2637
## Download Source Code
@@ -193,6 +204,78 @@ sbs.send_topic_message('taskdiscussion', msg)
193204
msg = sbs.receive_subscription_message('taskdiscussion', 'client1')
194205
```
195206

207+
208+
## Service Management
209+
210+
### Set-up certificates
211+
212+
You need to create two certificates, one for the server (a .cer file) and one for the client (a .pem file). To create the .pem file using [OpenSSL](http://www.openssl.org), execute this:
213+
214+
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
215+
216+
To create the .cer certificate, execute this:
217+
218+
openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer
219+
220+
### List Available Locations
221+
222+
```Python
223+
locations = sms.list_locations()
224+
for location in locations:
225+
print(location.name)
226+
```
227+
228+
### Create a Storage Service
229+
230+
To create a storage service, you need a name for the service (between 3 and 24 lowercase characters and unique within Windows Azure), a label (up to 100 characters, automatically encoded to base-64), and either a location or an affinity group.
231+
232+
```Python
233+
name = "mystorageservice"
234+
desc = name
235+
label = name
236+
location = 'West US'
237+
238+
result = sms.create_storage_account(name, desc, label, location=location)
239+
```
240+
241+
242+
### Create a Cloud Service
243+
244+
A cloud service is also known as a hosted service (from earlier versions of Windows Azure). The **create_hosted_service** method allows you to create a new hosted service by providing a hosted service name (which must be unique in Windows Azure), a label (automatically encoded to base-64), and the location *or* the affinity group for your service.
245+
246+
```Python
247+
name = "myhostedservice"
248+
desc = name
249+
label = name
250+
location = 'West US'
251+
252+
result = sms.create_hosted_service(name, label, desc, location=location)
253+
```
254+
255+
### Create a Deployment
256+
257+
To make a new deployment to Azure you must store the package file in a Windows Azure Blob Storage account under the same subscription as the hosted service to which the package is being uploaded. You can create a deployment package with the [Windows Azure PowerShell cmdlets](https://www.windowsazure.com/en-us/develop/php/how-to-guides/powershell-cmdlets/), or with the [cspack commandline tool](http://msdn.microsoft.com/en-us/library/windowsazure/gg432988.aspx).
258+
259+
```Python
260+
service_name = "myhostedservice"
261+
deployment_name = "v1"
262+
slot = 'Production'
263+
package_url = "URL_for_.cspkg_file"
264+
configuration = base64.b64encode(open(file_path, 'rb').read('path_to_.cscfg_file'))
265+
label = service_name
266+
267+
result = sms.create_deployment(service_name,
268+
slot,
269+
deployment_name,
270+
package_url,
271+
label,
272+
configuration)
273+
274+
operation = sms.get_operation_status(result.request_id)
275+
print('Operation status: ' + operation.status)
276+
```
277+
278+
196279
** For more examples please see the [Windows Azure Python Developer Center](http://www.windowsazure.com/en-us/develop/python) **
197280

198281
# Need Help?

src/azure.pyproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
<InterpreterArguments />
2121
<InterpreterId>2af0f10d-7135-4994-9156-5d01c9c11b7e</InterpreterId>
2222
<InterpreterVersion>2.7</InterpreterVersion>
23+
<SccProjectName>SAK</SccProjectName>
24+
<SccProvider>SAK</SccProvider>
25+
<SccAuxPath>SAK</SccAuxPath>
26+
<SccLocalPath>SAK</SccLocalPath>
2327
</PropertyGroup>
2428
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
2529
<DebugSymbols>true</DebugSymbols>
@@ -34,6 +38,8 @@
3438
<Compile Include="azure\http\httpclient.py" />
3539
<Compile Include="azure\http\winhttp.py" />
3640
<Compile Include="azure\http\__init__.py" />
41+
<Compile Include="azure\servicemanagement\servicemanagementservice.py" />
42+
<Compile Include="azure\servicemanagement\__init__.py" />
3743
<Compile Include="azure\servicebus\servicebusservice.py" />
3844
<Compile Include="azure\storage\blobservice.py" />
3945
<Compile Include="azure\storage\queueservice.py" />
@@ -44,10 +50,12 @@
4450
<Compile Include="azure\servicebus\__init__.py" />
4551
<Compile Include="azure\storage\storageclient.py" />
4652
<Compile Include="azure\storage\__init__.py" />
53+
<Compile Include="setup.py" />
4754
</ItemGroup>
4855
<ItemGroup>
56+
<Folder Include="azure\" />
4957
<Folder Include="azure\http" />
50-
<Folder Include="azure\tests\" />
58+
<Folder Include="azure\servicemanagement" />
5159
<Folder Include="azure\servicebus\" />
5260
<Folder Include="azure\storage" />
5361
</ItemGroup>

0 commit comments

Comments
 (0)