azure 0.7.0.pre → 0.7.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env_sample +3 -1
- data/.gitignore +15 -0
- data/LICENSE.txt +1 -1
- data/README.md +322 -248
- data/Rakefile +3 -1
- data/azure.gemspec +18 -14
- data/lib/azure.rb +124 -38
- data/lib/azure/base_management/base_management_service.rb +57 -69
- data/lib/azure/base_management/location.rb +1 -1
- data/lib/azure/base_management/management_http_request.rb +55 -58
- data/lib/azure/base_management/serialization.rb +5 -0
- data/lib/azure/base_management/sql_management_http_request.rb +10 -20
- data/lib/azure/blob/auth/shared_access_signature.rb +82 -76
- data/lib/azure/blob/blob_service.rb +196 -171
- data/lib/azure/client.rb +31 -0
- data/lib/azure/client_services.rb +98 -0
- data/lib/azure/cloud_service_management/cloud_service_management_service.rb +8 -10
- data/lib/azure/configurable.rb +290 -0
- data/lib/azure/core/auth/authorizer.rb +1 -1
- data/lib/azure/core/auth/shared_key.rb +48 -40
- data/lib/azure/core/auth/shared_key_lite.rb +9 -9
- data/lib/azure/core/auth/signer.rb +15 -12
- data/lib/azure/core/error.rb +2 -3
- data/lib/azure/core/filtered_service.rb +4 -3
- data/lib/azure/core/http/http_error.rb +10 -12
- data/lib/azure/core/http/http_request.rb +82 -69
- data/lib/azure/core/http/http_response.rb +12 -56
- data/lib/azure/core/http/signer_filter.rb +3 -4
- data/lib/azure/core/service.rb +8 -25
- data/lib/azure/core/signed_service.rb +7 -5
- data/lib/azure/core/utility.rb +45 -6
- data/lib/azure/default.rb +126 -0
- data/lib/azure/http_client.rb +85 -0
- data/lib/azure/queue/queue.rb +0 -1
- data/lib/azure/queue/queue_service.rb +6 -4
- data/lib/azure/queue/serialization.rb +0 -1
- data/lib/azure/service/storage_service.rb +9 -6
- data/lib/azure/service_bus/auth/shared_access_signer.rb +44 -0
- data/lib/azure/service_bus/auth/wrap_service.rb +5 -4
- data/lib/azure/service_bus/auth/wrap_signer.rb +14 -6
- data/lib/azure/service_bus/service_bus_service.rb +34 -30
- data/lib/azure/sql_database_management/errors.rb +11 -0
- data/lib/azure/sql_database_management/firewall_rule.rb +30 -0
- data/lib/azure/sql_database_management/serialization.rb +40 -53
- data/lib/azure/sql_database_management/sql_database_management_service.rb +141 -130
- data/lib/azure/sql_database_management/{sql_database.rb → sql_server.rb} +4 -3
- data/lib/azure/storage_management/storage_management_service.rb +9 -10
- data/lib/azure/table/auth/shared_key.rb +17 -50
- data/lib/azure/table/auth/shared_key_lite.rb +3 -3
- data/lib/azure/table/serialization.rb +24 -24
- data/lib/azure/table/table_service.rb +21 -18
- data/lib/azure/version.rb +1 -1
- data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +6 -12
- data/lib/azure/virtual_machine_management/serialization.rb +4 -1
- data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +29 -37
- data/lib/azure/virtual_network_management/virtual_network_management_service.rb +5 -6
- data/test/fixtures/list_locations.xml +150 -0
- data/test/fixtures/list_sql_database.xml +6 -18
- data/test/fixtures/list_sql_server_firewall.xml +18 -18
- data/test/fixtures/management_certificate.pfx +0 -0
- data/test/fixtures/virtual_machine.xml +1 -0
- data/test/integration/affinity_group/Create_Affinity_test.rb +1 -1
- data/test/integration/affinity_group/Update_Affinity_test.rb +4 -0
- data/test/integration/blob/blob_gb18030_test.rb +29 -29
- data/test/integration/blob/blob_pages_test.rb +16 -16
- data/test/integration/blob/container/create_container_test.rb +6 -6
- data/test/integration/blob/container/root_container_test.rb +2 -1
- data/test/integration/database/create_sql_server_firewall_test.rb +26 -31
- data/test/integration/database/create_sql_server_test.rb +6 -6
- data/test/integration/database/delete_sql_server_firewall_test.rb +18 -24
- data/test/integration/database/delete_sql_server_test.rb +9 -22
- data/test/integration/database/list_sql_server_firewall_test.rb +7 -8
- data/test/integration/database/list_sql_servers_test.rb +4 -4
- data/test/integration/database/reset_password_sql_server_test.rb +9 -11
- data/test/integration/location/RoleSize_List_test.rb +35 -0
- data/test/integration/queue/list_queues_test.rb +0 -1
- data/test/integration/service_bus/queues_scenario_test.rb +11 -11
- data/test/integration/service_bus/queues_test.rb +2 -2
- data/test/integration/service_bus/subscriptions_test.rb +25 -25
- data/test/integration/service_bus/topics_scenario_test.rb +6 -6
- data/test/integration/service_bus/topics_test.rb +15 -15
- data/test/integration/table/query_entities_test.rb +1 -0
- data/test/integration/table/table_acl_test.rb +9 -9
- data/test/integration/test_helper.rb +11 -9
- data/test/integration/vm/VM_Create_test.rb +23 -20
- data/test/integration/vnet/Virtual_Network_list_test.rb +1 -1
- data/test/test_helper.rb +5 -0
- data/test/unit/affinity_group/affinity_group_test.rb +4 -4
- data/test/unit/base_management/base_management_service_test.rb +19 -0
- data/test/unit/base_management/location_test.rb +6 -6
- data/test/unit/base_management/role_size_test.rb +50 -0
- data/test/unit/blob/auth/shared_access_signature_test.rb +19 -19
- data/test/unit/blob/blob_service_test.rb +583 -582
- data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +2 -2
- data/test/unit/config/azure_test.rb +112 -0
- data/test/unit/config/client_test.rb +37 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +15 -15
- data/test/unit/core/auth/shared_key_test.rb +26 -26
- data/test/unit/core/http/http_error_test.rb +13 -14
- data/test/unit/core/http/http_request_test.rb +78 -53
- data/test/unit/core/http/http_response_test.rb +2 -27
- data/test/unit/core/http/retry_policy_test.rb +3 -3
- data/test/unit/core/utility_test.rb +122 -0
- data/test/unit/database/serialization_test.rb +17 -20
- data/test/unit/database/sql_database_server_service_test.rb +97 -40
- data/test/unit/http_client_test.rb +74 -0
- data/test/unit/service/storage_service_test.rb +105 -101
- data/test/unit/storage_management/storage_management_service_test.rb +28 -28
- data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +4 -4
- data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +37 -20
- data/test/unit/vnet/virtual_network_management_service_test.rb +1 -1
- metadata +91 -20
- data/lib/azure/core.rb +0 -41
- data/lib/azure/core/configuration.rb +0 -218
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9dd1d283922e8aa96883838e6d018d17762b0ce
|
4
|
+
data.tar.gz: f1acae159ec7febe3a4799b712e9ea34f97f6713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4607decea2d04f8178c75817b67370ffacb6d8310a5cc18efd80e4b226ae95471fabe9eb0042e961c3ebd7836d0b8e961011df9432c88febdbbd74d0079ba153
|
7
|
+
data.tar.gz: 16e9dd28e7ae27e69b45c77c3fe66fd58b657f920e80c003a1bce4ba7cdb97e58b8ca1e2f678bf22ff30caf0a84d6c6d2269876687561dbf4b3a30777b8a2fef
|
data/.env_sample
CHANGED
@@ -8,4 +8,6 @@ AZURE_STORAGE_ACCESS_KEY="your storage access key"
|
|
8
8
|
AZURE_SERVICEBUS_NAMESPACE="your sb namespace"
|
9
9
|
AZURE_SERVICEBUS_ACCESS_KEY="your sb access key"
|
10
10
|
AZURE_MANAGEMENT_CERTIFICATE="your management cert path"
|
11
|
-
AZURE_SUBSCRIPTION_ID="your subscription id"
|
11
|
+
AZURE_SUBSCRIPTION_ID="your subscription id"
|
12
|
+
AZURE_SERVICEBUS_SAS_KEY="Service Bus SAS key"
|
13
|
+
AZURE_SERVICEBUS_SAS_KEY_NAME="Service Bus SAS key name"
|
data/.gitignore
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
.rvmrc
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
*.swp
|
5
|
+
*.tmproj
|
6
|
+
*~
|
7
|
+
.\#*
|
2
8
|
tags
|
3
9
|
/pkg
|
4
10
|
/doc
|
@@ -7,6 +13,15 @@ nbproject/*
|
|
7
13
|
*.gem
|
8
14
|
.idea/*
|
9
15
|
.project
|
16
|
+
.bundle
|
17
|
+
.config
|
18
|
+
.yardoc
|
19
|
+
_yardoc
|
20
|
+
coverage
|
21
|
+
doc/
|
22
|
+
lib/bundler/man
|
23
|
+
pkg
|
24
|
+
rdoc
|
10
25
|
|
11
26
|
|
12
27
|
.DS_Store
|
data/LICENSE.txt
CHANGED
@@ -187,7 +187,7 @@
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
188
188
|
identification within third-party archives.
|
189
189
|
|
190
|
-
Copyright
|
190
|
+
Copyright 2015 Microsoft Corporation
|
191
191
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
193
193
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -6,45 +6,26 @@
|
|
6
6
|
This project provides a Ruby package that makes it easy to access and manage Microsoft Azure Services like Storage, Service Bus and Virtual Machines.
|
7
7
|
|
8
8
|
# Library Features
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
* Tables
|
15
|
-
* create and delete tables
|
16
|
-
* create, query, insert, update, merge, and delete entities
|
17
|
-
* Queues
|
18
|
-
* create, list, and delete queues, and work with queue metadata
|
19
|
-
* create, get, peek, update, delete messages
|
20
|
-
* Service Bus
|
21
|
-
* Queues
|
22
|
-
* create, list and delete queues
|
23
|
-
* send, receive, unlock and delete messages
|
24
|
-
* Topics
|
25
|
-
* create, list, and delete topics
|
26
|
-
* send, receive, unlock and delete messages
|
27
|
-
* create, list, and delete subscriptions
|
28
|
-
* create, list, and delete rules
|
29
|
-
* Base Management
|
30
|
-
* list locations
|
31
|
-
* get, list, create, update, delete affinity groups
|
32
|
-
* Virtual Machine Management
|
33
|
-
* list images
|
34
|
-
* list, delete Disks
|
35
|
-
* Virtual Machines
|
36
|
-
* create linux based VMs and ssh with cert and key option enabled for ssh and WINRM (both http & https)enabled for windows based VMs
|
37
|
-
* list, shut down, delete, find virtual machine deployments. While shutting down your VMs the provisioning state would be deallocated and this VM will not be included in the billing cycle.
|
38
|
-
* Create VM for a specific virtual network
|
39
|
-
* Cloud Service Management
|
40
|
-
* create, list, delete cloud services
|
9
|
+
|
10
|
+
* [Storage](#storage)
|
11
|
+
* [Blobs](#blobs)
|
12
|
+
* [Tables](#tables)
|
13
|
+
* [Queues](#queues)
|
41
14
|
* Storage Account Management
|
42
|
-
|
43
|
-
*
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
*
|
15
|
+
* [Service Bus](#service-bus)
|
16
|
+
* [relays](#relays)
|
17
|
+
* [Queues](#sb-queues)
|
18
|
+
* [Topics](#topics)
|
19
|
+
* [Base Management](#base-mgmt)
|
20
|
+
* [Locations](#locations)
|
21
|
+
* [Affinity Groups](#affinity)
|
22
|
+
* [Virtual Machine Management](#vms)
|
23
|
+
* list, delete Disks
|
24
|
+
* manage virtual machines
|
25
|
+
* [list images](#images)
|
26
|
+
* Cloud Service Management
|
27
|
+
* [SQL Database Server Management](#sql)
|
28
|
+
* [Virtual Network Management](#vnets)
|
48
29
|
* List VNet
|
49
30
|
* Create VNet via parameters or xml file
|
50
31
|
|
@@ -55,6 +36,8 @@ This project provides a Ruby package that makes it easy to access and manage Mic
|
|
55
36
|
* Ruby 2.1
|
56
37
|
* Ruby 2.2
|
57
38
|
|
39
|
+
Note: x64 Ruby for Windows is known to have some compatibility issues.
|
40
|
+
|
58
41
|
# Getting Started
|
59
42
|
|
60
43
|
## Install the rubygem package
|
@@ -65,24 +48,6 @@ You can install the azure rubygem package directly.
|
|
65
48
|
gem install azure
|
66
49
|
```
|
67
50
|
|
68
|
-
## Download Source Code
|
69
|
-
|
70
|
-
To get the source code of the SDK via **git** just type:
|
71
|
-
|
72
|
-
```bash
|
73
|
-
git clone https://github.com/Azure/azure-sdk-for-ruby.git
|
74
|
-
cd ./azure-sdk-for-ruby
|
75
|
-
```
|
76
|
-
Then, run bundler to install all the gem dependencies:
|
77
|
-
|
78
|
-
```bash
|
79
|
-
bundle install
|
80
|
-
```
|
81
|
-
|
82
|
-
## Generate Documentation
|
83
|
-
|
84
|
-
Running the command ``rdoc`` will generate the API documentation in the `./doc` directory.
|
85
|
-
|
86
51
|
## Setup Connection
|
87
52
|
|
88
53
|
You can use this SDK against the Microsoft Azure Services in the cloud, or against the local Storage Emulator if you are on Windows. Service Bus and Microsoft Azure Service Management emulation are not supported. Of course, to use the Microsoft Azure Services in the cloud, you need to first [create a Microsoft Azure account](http://www.azure.com/en-us/pricing/free-trial/). After that, you can get the information you need to configure Storage and Service Bus from the [Microsoft Azure Portal](https://manage.azure.com).
|
@@ -92,63 +57,72 @@ There are two ways you can set up the connections:
|
|
92
57
|
1. [via code](#via-code)
|
93
58
|
2. [via environment variables](#via-environment-variables)
|
94
59
|
|
60
|
+
<a name="via-code"></a>
|
95
61
|
### Via Code
|
96
62
|
* Against Microsoft Azure Services in the cloud
|
97
63
|
|
98
|
-
|
64
|
+
```ruby
|
65
|
+
|
99
66
|
require "azure"
|
100
67
|
|
101
|
-
Azure.
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
68
|
+
Azure.storage_account_name = "<your azure storage account name>"
|
69
|
+
Azure.storage_access_key = "<your azure storage access key>"
|
70
|
+
|
71
|
+
# Configure these 3 properties to use Service Bus
|
72
|
+
Azure.sb_namespace = "<your azure service bus namespace>"
|
73
|
+
Azure.sb_access_key = "<your azure service bus access key>"
|
74
|
+
Azure.sb_issuer = "<your azure service bus issuer>"
|
75
|
+
|
76
|
+
# Configure these 3 properties to use Service Management. We support passwordless pfx & pem cert formats.
|
77
|
+
Azure.management_certificate = "<path to your *.pem or *.pfx>"
|
78
|
+
Azure.subscription_id = "<your Subscriptionid>"
|
79
|
+
|
80
|
+
# Configure a ca_cert.pem file if you are having issues with ssl peer verification
|
81
|
+
Azure.ca_file = "./ca_file.pem"
|
82
|
+
|
83
|
+
# Or create a specific instance of an Azure.client, which will inherit your default configuration settings.
|
84
|
+
client = Azure.client(storage_account_name: "your account name", storage_access_key: "your access key")
|
85
|
+
|
86
|
+
```
|
87
|
+
|
121
88
|
* Against local Emulator (Windows Only)
|
122
|
-
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
|
123
92
|
require "azure"
|
124
93
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
94
|
+
# Configure these 2 properties to use local Storage Emulator
|
95
|
+
Azure.storage_account_name = "devstoreaccount1"
|
96
|
+
Azure.storage_access_key = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
|
97
|
+
|
98
|
+
Azure.storage_blob_host = "http://127.0.0.1:10000/devstoreaccount1"
|
99
|
+
Azure.storage_queue_host = "http://127.0.0.1:10001/devstoreaccount1"
|
100
|
+
Azure.storage_table_host = "http://127.0.0.1:10002/devstoreaccount1"
|
101
|
+
|
102
|
+
# Local Service Bus Emulator is not supported
|
103
|
+
# Local Service Management emulation is not supported
|
104
|
+
|
105
|
+
```
|
106
|
+
|
107
|
+
<a name="via-environment-variables"></a>
|
136
108
|
### Via Environment Variables
|
109
|
+
|
137
110
|
* Against Microsoft Azure Services in the cloud
|
138
|
-
|
111
|
+
|
112
|
+
* Storage
|
139
113
|
|
140
114
|
```bash
|
141
115
|
AZURE_STORAGE_ACCOUNT = <your azure storage account name>
|
142
116
|
AZURE_STORAGE_ACCESS_KEY = <your azure storage access key>
|
143
117
|
```
|
144
|
-
|
118
|
+
* Service Bus
|
145
119
|
|
146
120
|
```bash
|
147
121
|
AZURE_SERVICEBUS_NAMESPACE = <your azure service bus namespace>
|
148
122
|
AZURE_SERVICEBUS_ACCESS_KEY = <your azure service bus access key>
|
149
123
|
AZURE_SERVICEBUS_ISSUER = <your azure service bus issuer>
|
150
124
|
```
|
151
|
-
|
125
|
+
* Service Management
|
152
126
|
|
153
127
|
```bash
|
154
128
|
AZURE_MANAGEMENT_CERTIFICATE = <path to *.pem or *.pfx>
|
@@ -157,13 +131,14 @@ There are two ways you can set up the connections:
|
|
157
131
|
AZURE_SQL_DATABASE_MANAGEMENT_ENDPOINT = <SQL Database Management Endpoint>
|
158
132
|
AZURE_SQL_DATABASE_AUTHENTICATION_MODE = <:management_certificate or :sql_server>
|
159
133
|
```
|
134
|
+
* [SSL Certificate File](https://gist.github.com/fnichol/867550)
|
160
135
|
|
161
|
-
* [SSL Certificate File](https://gist.github.com/fnichol/867550)
|
162
136
|
```bash
|
163
137
|
SSL_CERT_FILE=<path to *.pem>
|
164
138
|
```
|
165
139
|
* Against local Emulator (Windows Only)
|
166
|
-
|
140
|
+
|
141
|
+
* Storage
|
167
142
|
|
168
143
|
```bash
|
169
144
|
AZURE_STORAGE_ACCOUNT = devstoreaccount1
|
@@ -172,190 +147,224 @@ There are two ways you can set up the connections:
|
|
172
147
|
AZURE_STORAGE_QUEUE_HOST = http://127.0.0.1:10001/devstoreaccount1
|
173
148
|
AZURE_STORAGE_TABLE_HOST = http://127.0.0.1:10002/devstoreaccount1
|
174
149
|
```
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
* all the tests: ``rake test``
|
180
|
-
* a specific suite of tests: ``rake test:integration:blob``
|
181
|
-
* one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
|
150
|
+
* Service Bus: not supported
|
151
|
+
|
152
|
+
* Service Management: not supported
|
153
|
+
|
182
154
|
# Usage
|
183
|
-
|
155
|
+
|
156
|
+
<a name="storage"></a>
|
184
157
|
## Storage
|
185
158
|
|
186
|
-
###
|
159
|
+
### Setup your Storage Credentials
|
187
160
|
|
188
161
|
```ruby
|
162
|
+
|
189
163
|
# Require the azure rubygem
|
190
164
|
require "azure"
|
191
165
|
|
166
|
+
# Add your default storage credentials
|
167
|
+
Azure.storage_account_name = "your account name"
|
168
|
+
Azure.storage_access_key = "your access key"
|
169
|
+
|
170
|
+
# Or create a specific instance of an Azure.client
|
171
|
+
client = Azure.client(storage_account_name: "your account name", storage_access_key: "your access key")
|
172
|
+
|
173
|
+
default_blobs = Azure.blobs # uses the Azure.storage_account_name and Azure.storage_access_key
|
174
|
+
|
175
|
+
blobs = client.blobs # uses the client.storage_account_name and client.storage_access_key
|
176
|
+
|
177
|
+
```
|
178
|
+
<a name="blobs"></a>
|
179
|
+
### Blobs
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
|
192
183
|
# Create an azure storage blob service object
|
193
|
-
|
184
|
+
blobs = Azure.blobs
|
194
185
|
|
195
186
|
# Create a container
|
196
|
-
container =
|
187
|
+
container = blobs.create_container("test-container")
|
197
188
|
|
198
189
|
# Upload a Blob
|
199
190
|
content = File.open('test.jpg', 'rb') { |file| file.read }
|
200
|
-
|
191
|
+
blobs.create_block_blob(container.name, "image-blob", content)
|
201
192
|
|
202
193
|
# List containers
|
203
|
-
|
194
|
+
blobs.list_containers()
|
204
195
|
|
205
196
|
# List Blobs
|
206
|
-
|
197
|
+
blobs.list_blobs(container.name)
|
207
198
|
|
208
199
|
# Download a Blob
|
209
|
-
blob, content =
|
200
|
+
blob, content = blobs.get_blob(container.name, "image-blob")
|
210
201
|
File.open("download.png", "wb") {|f| f.write(content)}
|
211
202
|
|
212
203
|
# Delete a Blob
|
213
|
-
|
204
|
+
blobs.delete_blob(container.name, "image-blob")
|
205
|
+
|
214
206
|
```
|
207
|
+
<a name="tables"></a>
|
215
208
|
### Tables
|
216
209
|
|
217
210
|
```ruby
|
211
|
+
|
218
212
|
# Require the azure rubygem
|
219
213
|
require "azure"
|
220
214
|
|
221
215
|
# Create an azure storage table service object
|
222
|
-
|
216
|
+
tables = Azure.tables
|
223
217
|
|
224
218
|
# Create a table
|
225
|
-
|
219
|
+
tables.create_table("testtable")
|
226
220
|
|
227
221
|
# Insert an entity
|
228
222
|
entity = { "content" => "test entity", :partition_key => "test-partition-key", :row_key => "1" }
|
229
|
-
|
223
|
+
tables.insert_entity("testtable", entity)
|
230
224
|
|
231
225
|
# Get an entity
|
232
|
-
result =
|
226
|
+
result = tables.get_entity("testtable", "test-partition-key", "1")
|
233
227
|
|
234
228
|
# Update an entity
|
235
229
|
result.properties["content"] = "test entity with updated content"
|
236
|
-
|
230
|
+
tables.update_entity(result.table, result.properties)
|
237
231
|
|
238
232
|
# Query entities
|
239
233
|
query = { :filter => "content eq 'test entity'" }
|
240
|
-
result, token =
|
234
|
+
result, token = tables.query_entities("testtable", query)
|
241
235
|
|
242
236
|
# Delete an entity
|
243
|
-
|
237
|
+
tables.delete_entity("testtable", "test-partition-key", "1")
|
244
238
|
|
245
239
|
# delete a table
|
246
|
-
|
240
|
+
tables.delete_table("testtable")
|
241
|
+
|
247
242
|
```
|
243
|
+
|
244
|
+
<a name="queues"></a>
|
248
245
|
### Queues
|
249
246
|
|
250
247
|
```ruby
|
248
|
+
|
251
249
|
# Require the azure rubygem
|
252
250
|
require "azure"
|
253
251
|
|
254
252
|
# Create an azure storage queue service object
|
255
|
-
|
253
|
+
queues = Azure.queues
|
256
254
|
|
257
255
|
# Create a queue
|
258
|
-
|
256
|
+
queues.create_queue("test-queue")
|
259
257
|
|
260
258
|
# Create a message
|
261
|
-
|
259
|
+
queues.create_message("test-queue", "test message")
|
262
260
|
|
263
261
|
# Get one or more messages with setting the visibility timeout
|
264
|
-
result =
|
262
|
+
result = queues.list_messages("test-queue", 30, {:number_of_messages => 10})
|
265
263
|
|
266
264
|
# Get one or more messages without setting the visibility timeout
|
267
|
-
result =
|
265
|
+
result = queues.peek_messages("test-queue", {:number_of_messages => 10})
|
268
266
|
|
269
267
|
# Update a message
|
270
|
-
message =
|
271
|
-
pop_receipt, time_next_visible =
|
268
|
+
message = queues.list_messages("test-queue", 30)
|
269
|
+
pop_receipt, time_next_visible = queues.update_message("test-queue", message.id, message.pop_receipt, "updated test message", 30)
|
272
270
|
|
273
271
|
# Delete a message
|
274
|
-
message =
|
275
|
-
|
272
|
+
message = queues.list_messages("test-queue", 30)
|
273
|
+
queues.delete_message("test-queue", message.id, message.pop_receipt)
|
276
274
|
|
277
275
|
# Delete a queue
|
278
|
-
|
276
|
+
queues.delete_queue("test-queue")
|
277
|
+
|
279
278
|
```
|
279
|
+
|
280
|
+
<a name="service-bus"></a>
|
280
281
|
## Service Bus
|
281
282
|
|
283
|
+
<a name="relays"></a>
|
282
284
|
### Relay
|
283
285
|
|
284
286
|
```ruby
|
287
|
+
|
285
288
|
# Require the azure rubygem
|
286
289
|
require "azure"
|
287
290
|
|
288
291
|
# Create an azure service bus object
|
289
|
-
|
292
|
+
service_bus = Azure.service_bus
|
290
293
|
|
291
294
|
# Create a relay endpoint with just the endpoint name
|
292
|
-
relay1 =
|
295
|
+
relay1 = service_bus.create_relay("test-relay-1", { :relay_type => "Http" })
|
293
296
|
|
294
297
|
# Create a relay endpoint with a relay object
|
295
298
|
relay2 = Azure::ServiceBus::Relay.new("test-relay-2")
|
296
299
|
relay2.requires_client_authorization = false
|
297
|
-
relay2 =
|
300
|
+
relay2 = service_bus.create_relay(relay2)
|
298
301
|
|
299
302
|
# Delete a relay endpoint
|
300
|
-
|
303
|
+
service_bus.delete_relay("test-relay2")
|
304
|
+
|
301
305
|
```
|
302
306
|
|
307
|
+
<a name="sb-queues"></a>
|
303
308
|
### Queues
|
304
309
|
|
305
310
|
```ruby
|
311
|
+
|
306
312
|
# Require the azure rubygem
|
307
313
|
require "azure"
|
308
314
|
|
309
315
|
# Create an azure service bus object
|
310
|
-
|
316
|
+
service_bus = Azure.service_bus
|
311
317
|
|
312
318
|
# Create a queue with just the queue name
|
313
|
-
queue1 =
|
319
|
+
queue1 = service_bus.create_queue("test-queue-1")
|
314
320
|
|
315
321
|
# Create a queue with a queue object
|
316
322
|
queue2 = Azure::ServiceBus::Queue.new("test-queue-2")
|
317
323
|
queue2.max_size_in_megabytes = 2048
|
318
|
-
queue2 =
|
324
|
+
queue2 = service_bus.create_queue(queue2)
|
319
325
|
|
320
326
|
# Send a queue message with just the message body
|
321
|
-
|
327
|
+
service_bus.send_queue_message("test-queue-1", "test queue message")
|
322
328
|
|
323
329
|
# Send a queue message with a brokered message object
|
324
330
|
message = Azure::ServiceBus::BrokeredMessage.new("another test queue message")
|
325
331
|
message.correlation_id = "test-correlation-id-1"
|
326
|
-
|
332
|
+
service_bus.send_queue_message("test-queue-1", message)
|
327
333
|
|
328
334
|
# Receive a queue message
|
329
|
-
message =
|
335
|
+
message = service_bus.receive_queue_message("test-queue-1")
|
330
336
|
|
331
337
|
# Delete a queue message
|
332
|
-
|
338
|
+
service_bus.delete_queue_message(message)
|
333
339
|
|
334
340
|
# Delete a queue
|
335
|
-
|
341
|
+
service_bus.delete_queue("test-queue-1")
|
342
|
+
|
336
343
|
```
|
337
344
|
|
345
|
+
<a name="topics"></a>
|
338
346
|
### Topics
|
339
347
|
|
340
348
|
```ruby
|
349
|
+
|
341
350
|
# Require the azure rubygem
|
342
351
|
require "azure"
|
343
352
|
|
344
353
|
# Create an azure service bus object
|
345
|
-
|
354
|
+
service_bus = Azure.service_bus
|
346
355
|
|
347
356
|
# Create a topic with just the topic name
|
348
|
-
topic1 =
|
357
|
+
topic1 = service_bus.create_topic("test-topic-1")
|
349
358
|
|
350
359
|
# Create a topic with a topic object
|
351
360
|
topic2 = Azure::ServiceBus::Topic.new("test-topic-2")
|
352
361
|
topic2.max_size_in_megabytes = 2048
|
353
|
-
topic2 =
|
362
|
+
topic2 = service_bus.create_topic(topic2)
|
354
363
|
|
355
364
|
# Create a subscription
|
356
365
|
subscription = Azure::ServiceBus::Subscription.new("test-subscription-1")
|
357
366
|
subscription.topic = topic1.name
|
358
|
-
subscription =
|
367
|
+
subscription = service_bus.create_subscription(subscription)
|
359
368
|
|
360
369
|
# Send a topic message with just the message body
|
361
370
|
azure_service_bus.send_topic_message(topic1, "test topic message")
|
@@ -363,58 +372,59 @@ azure_service_bus.send_topic_message(topic1, "test topic message")
|
|
363
372
|
# Send a topic message with a brokered message object
|
364
373
|
message = Azure::ServiceBus::BrokeredMessage.new("another test topic message")
|
365
374
|
message.correlation_id = "test-correlation-id-1"
|
366
|
-
|
375
|
+
service_bus.send_topic_message(topic1, message)
|
367
376
|
|
368
377
|
# Receive a subscription message
|
369
|
-
message =
|
378
|
+
message = service_bus.receive_subscription_message(topic1.name, subscription.name)
|
370
379
|
|
371
380
|
# Delete a subscription message
|
372
|
-
|
381
|
+
service_bus.delete_subscription_message(message)
|
373
382
|
|
374
383
|
# Delete a subscription
|
375
|
-
|
384
|
+
service_bus.delete_subscription(subscription)
|
376
385
|
|
377
386
|
# Delete a topic
|
378
|
-
|
387
|
+
service_bus.delete_topic(topic1)
|
388
|
+
|
379
389
|
```
|
390
|
+
|
391
|
+
<a name="vms"></a>
|
380
392
|
## Virtual Machine Management
|
381
393
|
|
382
394
|
```ruby
|
395
|
+
|
383
396
|
# Require the azure rubygem
|
384
397
|
require 'azure'
|
385
398
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
config.subscription_id = "your subscription id"
|
390
|
-
config.management_endpoint = "https://management.core.windows.net"
|
391
|
-
end
|
399
|
+
# Configure these properties
|
400
|
+
Azure.management_certificate = "path to *.pem or *.pfx file"
|
401
|
+
Azure.subscription_id = "your subscription id"
|
392
402
|
|
393
|
-
#Create a virtual machine service object
|
394
|
-
|
403
|
+
# Create a virtual machine service object
|
404
|
+
vm_management = Azure.vm_management
|
395
405
|
|
396
|
-
#Get a list of existing virtual machines in your subscription
|
397
|
-
|
406
|
+
# Get a list of existing virtual machines in your subscription
|
407
|
+
vm_management.list_virtual_machines
|
398
408
|
|
399
|
-
#API to shutdown Virtual Machine
|
400
|
-
|
409
|
+
# API to shutdown Virtual Machine
|
410
|
+
vm_management.shutdown_virtual_machine('vm_name', 'cloud_service_name')
|
401
411
|
|
402
|
-
#API to start Virtual Machine
|
403
|
-
|
412
|
+
# API to start Virtual Machine
|
413
|
+
vm_management.start_virtual_machine('vm_name', 'cloud_service_name')
|
404
414
|
|
405
|
-
#API to restart Virtual Machine
|
406
|
-
|
415
|
+
# API to restart Virtual Machine
|
416
|
+
vm_management.restart_virtual_machine('vm_name', 'cloud_service_name')
|
407
417
|
|
408
|
-
#API for add disk to Virtual Machine
|
418
|
+
# API for add disk to Virtual Machine
|
409
419
|
options = {
|
410
420
|
:disk_label => 'disk-label',
|
411
421
|
:disk_size => 100, #In GB
|
412
422
|
:import => false,
|
413
423
|
:disk_name => 'Disk name' #Required when import is true
|
414
424
|
}
|
415
|
-
|
425
|
+
vm_management.add_data_disk('vm_name', 'cloud_service_name', options)
|
416
426
|
|
417
|
-
#API to add/update Virtual Machine endpoints
|
427
|
+
# API to add/update Virtual Machine endpoints
|
418
428
|
endpoint1 = {
|
419
429
|
:name => 'ep-1',
|
420
430
|
:public_port => 996,
|
@@ -429,15 +439,15 @@ endpoint2 = {
|
|
429
439
|
:load_balancer_name => ‘lb-ep2’,
|
430
440
|
:load_balancer => {:protocol => 'http', :path => 'hello'}
|
431
441
|
}
|
432
|
-
|
442
|
+
vm_management.update_endpoints('vm_name', 'cloud_service_name', endpoint1, endpoint2)
|
433
443
|
|
434
|
-
#API to delete Virtual Machine endpoint
|
435
|
-
|
444
|
+
# API to delete Virtual Machine endpoint
|
445
|
+
vm_management.delete_endpoint('vm_name', 'cloud_service_name', 'endpoint_name')
|
436
446
|
|
437
|
-
#API to delete Virtual Machine
|
438
|
-
|
447
|
+
# API to delete Virtual Machine
|
448
|
+
vm_management.delete_virtual_machine('vm_name', 'cloud_service_name')
|
439
449
|
|
440
|
-
#API to start deployment
|
450
|
+
# API to start deployment
|
441
451
|
params = {
|
442
452
|
:vm_name => 'vm_name',
|
443
453
|
:vm_user => 'azureuser',
|
@@ -447,23 +457,22 @@ params = {
|
|
447
457
|
}
|
448
458
|
options = {
|
449
459
|
:storage_account_name => 'storage_suse',
|
450
|
-
:winrm_transport => ['https','http'], #Currently http is supported. To enable https, set the transport protocol to https, simply rdp to the VM once VM is in ready state, export the certificate ( CN name would be the deployment name) from the certstore of the VM and install to your local machine and communicate WinRM via https.
|
451
460
|
:cloud_service_name => 'cloud_service_name',
|
452
461
|
:deployment_name =>'vm_name',
|
453
462
|
:tcp_endpoints => '80,3389:3390',
|
454
|
-
:private_key_file => '
|
463
|
+
:private_key_file => './private_key.key', # required for ssh
|
455
464
|
:ssh_port => 2222,
|
456
|
-
:vm_size => 'Small',
|
465
|
+
:vm_size => 'Small', # Use any Azure VM size
|
457
466
|
:affinity_group_name => 'affinity1',
|
458
467
|
:virtual_network_name => 'xplattestvnet',
|
459
468
|
:subnet_name => 'subnet1',
|
460
|
-
:availability_set_name => 'availabiltyset1'
|
469
|
+
:availability_set_name => 'availabiltyset1',
|
461
470
|
:reserved_ip_name => 'reservedipname'
|
462
471
|
}
|
463
|
-
|
472
|
+
vm_management.create_virtual_machine(params,options)
|
464
473
|
|
465
|
-
#API usage to add new roles under cloud service creating VM
|
466
|
-
#API add_role create multiple roles under the same cloud service. Atleast a single deployment should be created under a hosted service.
|
474
|
+
# API usage to add new roles under cloud service creating VM
|
475
|
+
# API add_role create multiple roles under the same cloud service. Atleast a single deployment should be created under a hosted service.
|
467
476
|
params = {
|
468
477
|
:vm_name => 'vm_name',
|
469
478
|
:cloud_service_name => 'cloud_service_name',
|
@@ -473,156 +482,221 @@ params = {
|
|
473
482
|
}
|
474
483
|
options = {
|
475
484
|
:storage_account_name => 'storage_suse',
|
476
|
-
:winrm_transport => ['https','http'],
|
485
|
+
:winrm_transport => ['https','http'], # Currently http(s) is supported.
|
477
486
|
:tcp_endpoints => '80,3389:3390',
|
478
|
-
:private_key_file => '
|
487
|
+
:private_key_file => './private_key.key', # Required for winrm(https) certificate.
|
479
488
|
:winrm_https_port => 5999,
|
480
|
-
:winrm_http_port => 6999,
|
481
|
-
:vm_size => 'Small',
|
489
|
+
:winrm_http_port => 6999, # Used to open different powershell port
|
490
|
+
:vm_size => 'Small', # Use any Azure VM size
|
482
491
|
:availability_set_name => 'availabiltyset'
|
483
492
|
}
|
484
|
-
|
493
|
+
vm_management.add_role(params, options)
|
494
|
+
|
495
|
+
```
|
496
|
+
|
497
|
+
<a name="images"></a>
|
498
|
+
## List Images
|
499
|
+
|
500
|
+
```ruby
|
485
501
|
|
486
|
-
#Get a list of available virtual machine images
|
487
|
-
|
488
|
-
|
502
|
+
# Get a list of available virtual machine images
|
503
|
+
vm_image_management = Azure.vm_image_management
|
504
|
+
vm_image_management.list_virtual_machine_images
|
489
505
|
|
490
|
-
|
491
|
-
|
506
|
+
```
|
507
|
+
|
508
|
+
<a name="base-mgmt"></a>
|
509
|
+
## Base Management
|
510
|
+
|
511
|
+
<a name="locations"></a>
|
512
|
+
```ruby
|
513
|
+
|
514
|
+
# Get a list of available regional data center locations
|
515
|
+
base_management = Azure.base_management
|
492
516
|
base_management.list_locations
|
517
|
+
|
493
518
|
```
|
494
|
-
|
519
|
+
|
520
|
+
<a name="affinity"></a>
|
521
|
+
### Affinity Group Management
|
495
522
|
|
496
523
|
```ruby
|
524
|
+
|
497
525
|
# Require the azure rubygem
|
498
526
|
require 'azure'
|
499
527
|
|
500
|
-
#Create a affinity group service object
|
501
|
-
|
528
|
+
# Create a affinity group service object
|
529
|
+
base_management = Azure.base_management
|
502
530
|
|
503
|
-
#Get a list of affinity group that are provisioned for a subscription.
|
504
|
-
|
531
|
+
# Get a list of affinity group that are provisioned for a subscription.
|
532
|
+
base_management.list_affinity_groups
|
505
533
|
|
506
|
-
#API to delete affinity group
|
507
|
-
|
534
|
+
# API to delete affinity group
|
535
|
+
base_management.delete_affinity_group('affinity-group-name')
|
508
536
|
|
509
|
-
#API to add a new affinity group to a subscription
|
537
|
+
# API to add a new affinity group to a subscription
|
510
538
|
options = {:description => 'Some Description'}
|
511
|
-
|
539
|
+
base_management.create_affinity_group('affinity-group-name', 'West US', 'Label Name', options)
|
512
540
|
|
513
|
-
#API to update affinity group
|
541
|
+
# API to update affinity group
|
514
542
|
options = {:description => 'Some Description'}
|
515
|
-
|
543
|
+
base_management.update_affinity_group('affinity-group-name', 'Label Name', options)
|
544
|
+
|
545
|
+
# API to list properties associated with the specified affinity group
|
546
|
+
base_management.get_affinity_group('affinity-group-name')
|
516
547
|
|
517
|
-
#API to list properties associated with the specified affinity group
|
518
|
-
base_management_service.get_affinity_group('affinity-group-name')
|
519
548
|
```
|
549
|
+
|
550
|
+
<a name="sql"></a>
|
520
551
|
## SQL Database Server Management
|
521
552
|
|
522
553
|
```ruby
|
554
|
+
|
523
555
|
# Require the azure rubygem
|
524
556
|
require 'azure'
|
525
557
|
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
config.management_endpoint = "https://management.database.windows.net:8443/"
|
530
|
-
#To access other service management apis use "https://management.core.windows.net".
|
531
|
-
end
|
558
|
+
# Configure these properties
|
559
|
+
Azure.management_certificate = "path to *.pem or *.pfx file"
|
560
|
+
Azure.subscription_id = "your subscription id"
|
532
561
|
|
533
|
-
#Create a database server service object
|
534
|
-
sql_db_service = Azure
|
562
|
+
# Create a database server service object
|
563
|
+
sql_db_service = Azure.sql_database_management
|
535
564
|
|
536
|
-
#Get a list of SQL Database servers that are provisioned for a subscription.
|
565
|
+
# Get a list of SQL Database servers that are provisioned for a subscription.
|
537
566
|
sql_db_service.list_servers
|
538
567
|
|
539
|
-
#API to delete SQL Database server
|
568
|
+
# API to delete SQL Database server
|
540
569
|
sql_db_service.delete_server('server_name')
|
541
570
|
|
542
|
-
#API to adds a new SQL Database server to a subscription
|
571
|
+
# API to adds a new SQL Database server to a subscription
|
543
572
|
sql_db_service.create_server('admin-login', 'ComplexPassword', 'West US')
|
544
573
|
|
545
|
-
#API to sets the administrative password of a SQL Database server for a subscription
|
574
|
+
# API to sets the administrative password of a SQL Database server for a subscription
|
546
575
|
sql_db_service.reset_password('server-name', 'NewPassword')
|
547
576
|
|
548
|
-
#Get a list of all the server-level firewall rules for a SQL Database server that belongs to a subscription
|
577
|
+
# Get a list of all the server-level firewall rules for a SQL Database server that belongs to a subscription
|
549
578
|
sql_db_service.list_sql_server_firewall_rules("server-name")
|
550
579
|
|
551
|
-
#API to adds a new server-level firewall rule or updates an existing server-level firewall rule for a SQL Database server with requester’s IP address.
|
580
|
+
# API to adds a new server-level firewall rule or updates an existing server-level firewall rule for a SQL Database server with requester’s IP address.
|
552
581
|
sql_db_service.delete_sql_server_firewall_rule("server-name", "rule-name")
|
553
582
|
|
554
|
-
#API to add/updates server-level firewall rule for a SQL Database server that belongs to a subscription
|
583
|
+
# API to add/updates server-level firewall rule for a SQL Database server that belongs to a subscription
|
555
584
|
ip_range = {:start_ip_address => "0.0.0.1", :end_ip_address => "0.0.0.5"}
|
556
585
|
sql_db_service.set_sql_server_firewall_rule("server-name", "rule-name", ip_range)
|
557
586
|
|
558
587
|
# If ip_range was not specified in the above api then the IP of the machine from where the api is being called would be set as the rule.
|
559
588
|
# To toggle between the option to allow Microsoft Azure services to access db server similar to azure portal just set the fire wall rule
|
560
589
|
# with iprange to be 0.0.0.0 as start and end.Remove the rule to unset this option.
|
590
|
+
|
561
591
|
```
|
592
|
+
|
593
|
+
<a name="vnets"></a>
|
562
594
|
## Virtual Network Management
|
563
595
|
|
564
596
|
```ruby
|
597
|
+
|
565
598
|
# Require the azure rubygem
|
566
599
|
require 'azure'
|
567
600
|
|
568
|
-
#Create a virtual network service object
|
569
|
-
|
570
|
-
vnet = Azure::VirtualNetworkManagementService.new
|
571
|
-
|
572
|
-
#API to get a list of virtual networks created for a subscription.
|
601
|
+
# Create a virtual network service object
|
602
|
+
vnet = Azure.network_management
|
573
603
|
|
604
|
+
# API to get a list of virtual networks created for a subscription.
|
574
605
|
vnet.list_virtual_networks
|
575
606
|
|
576
|
-
#API to configure virtual network with required and optional parameters
|
577
|
-
|
607
|
+
# API to configure virtual network with required and optional parameters
|
578
608
|
address_space = ['172.16.0.0/12', '10.0.0.0/8', '192.168.0.0/24']
|
579
|
-
|
580
609
|
subnets = [{:name => 'subnet-1', :ip_address=>'172.16.0.0', :cidr=>12}, {:name => 'subnet-2', :ip_address=>'10.0.0.0', :cidr=>8}]
|
581
|
-
|
582
610
|
dns_servers = [{:name => 'dns-1', :ip_address=>'1.2.3.4'}, {:name => 'dns-2', :ip_address=>'8.7.6.5'}]
|
583
|
-
|
584
611
|
options = {:subnet => subnets, :dns => dns_servers}
|
585
|
-
|
586
612
|
vnet.set_network_configuration('virtual-network-name', 'location_name', address_space, options)
|
587
613
|
|
588
|
-
#API to configure virtual network from xml file that can be exported from management portal and customized to add or delete vnet
|
589
|
-
|
614
|
+
# API to configure virtual network from xml file that can be exported from management portal and customized to add or delete vnet
|
590
615
|
vnetxml = './customnetwork.xml'
|
591
|
-
|
592
616
|
vnet.set_network_configuration(vnetxml)
|
617
|
+
|
593
618
|
```
|
594
619
|
|
595
|
-
#
|
620
|
+
# Getting Started with Certificates
|
596
621
|
|
597
622
|
Currently the sdk supports *.pem or *.pfx (passwordless pfx) for service management operations. Following are the steps discussed on various cert operations.
|
598
623
|
|
599
|
-
## Publish Settings
|
624
|
+
## Get Started with Publish Settings
|
600
625
|
|
601
626
|
* To create a pfx from the publishsettings, simply download the publishsettings file for your subscription
|
602
627
|
[https://manage.windowsazure.com/publishsettings](https://manage.windowsazure.com/publishsettings/index?client=powershell). Make sure you have this gem installed and
|
603
628
|
run `pfxer --in [path to your .publishsettings file]`. This will create a .pfx from your publish settings file which can
|
604
629
|
be supplied as a cert parameter for Service Management Commands.
|
605
630
|
|
606
|
-
##
|
631
|
+
## Get Started with OpenSSL
|
607
632
|
|
608
633
|
* Using the following openssl commands to create a cert and upload to Azure Management
|
609
|
-
* Generate public and private `openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout
|
610
|
-
* Generate public .cer for Azure upload `openssl x509 -inform pem -in
|
611
|
-
* Upload the `
|
612
|
-
* Combine the public and private into one `cat mycert.key mycert.pem > cert.pem`
|
634
|
+
* Generate public and private `openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout cert.pem -out cert.pem`
|
635
|
+
* Generate public .cer for Azure upload `openssl x509 -inform pem -in cert.pem -outform der -out mgmt.cer`
|
636
|
+
* Upload the `mgmt.cer` to Azure Management through [https://management.azure.com](https://management.azure.com)
|
613
637
|
* Use cert.pem as your cert parameter for Service Management Commands.
|
614
638
|
|
615
|
-
#
|
639
|
+
# Contribute Code or Provide Feedback
|
616
640
|
|
617
|
-
|
641
|
+
1. Fork it
|
642
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
643
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
644
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
645
|
+
5. Create new Pull Request
|
618
646
|
|
619
|
-
# Contribute Code or Provide Feedback
|
620
647
|
|
621
|
-
|
648
|
+
## Development Environment Setup
|
649
|
+
|
650
|
+
### Download Source Code
|
651
|
+
|
652
|
+
To get the source code of the SDK via **git** just type:
|
653
|
+
|
654
|
+
```bash
|
655
|
+
git clone https://github.com/Azure/azure-sdk-for-ruby.git
|
656
|
+
cd ./azure-sdk-for-ruby
|
657
|
+
```
|
658
|
+
|
659
|
+
Then, run bundler to install all the gem dependencies:
|
660
|
+
|
661
|
+
```bash
|
662
|
+
bundle install
|
663
|
+
```
|
664
|
+
|
665
|
+
### Setup the Environment for Integration Tests
|
666
|
+
|
667
|
+
If you would like to run the integration test suite, you will need to setup environment variables which will be used
|
668
|
+
during the integration tests. These tests will use these credentials to run live tests against Azure with the provided
|
669
|
+
credentials (you will be charged for usage, so verify the clean up scripts did their job at the end of a test run).
|
670
|
+
|
671
|
+
The root of the project contains a .env_sample file. This dot file is a sample of the actual environment vars needed to
|
672
|
+
run the integration tests.
|
673
|
+
|
674
|
+
Do the following to prepare your environment for integration tests:
|
675
|
+
|
676
|
+
* Copy .env_sample to .env **relative to root of the project dir**
|
677
|
+
* Update .env with your credentials **.env is in the .gitignore, so should only reside locally**
|
678
|
+
|
679
|
+
### Run Tests
|
680
|
+
|
681
|
+
You can use the following commands to run:
|
682
|
+
|
683
|
+
* All the tests: ``rake test``. **This will run integration tests if you have .env file or env vars setup**
|
684
|
+
* A specific suite of tests: ``rake test:unit``, ``rake test:integration``, ``rake test:integration:blob``, etc.
|
685
|
+
* one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
|
686
|
+
|
687
|
+
### Generate Documentation
|
688
|
+
|
689
|
+
Running the command ``yard`` will generate the API documentation in the `./doc` directory.
|
690
|
+
|
691
|
+
## Provide Feedback
|
692
|
+
|
622
693
|
If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-ruby/issues) section of the project.
|
623
694
|
|
624
|
-
#
|
695
|
+
# Maintainers
|
696
|
+
|
697
|
+
* [David Justice](https://github.com/devigned)
|
698
|
+
|
699
|
+
# Azure CLI Tooling
|
625
700
|
|
626
|
-
For documentation on
|
627
|
-
For documentation on Azure
|
628
|
-
For documentation on the Azure cross platform CLI tool for Windows, Mac and Linux, please see our readme [here](http://github.com/azure/azure-sdk-tools-xplat).
|
701
|
+
For documentation on [Azure PowerShell](http://github.com/azure/azure-powershell).
|
702
|
+
For documentation on [Azure CLI](http://github.com/azure/azure-xplat-cli).
|