azure 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/azure.gemspec +1 -1
- data/lib/azure.rb +1 -0
- data/lib/azure/blob/blob.rb +1 -1
- data/lib/azure/blob/blob_service.rb +14 -9
- data/lib/azure/blob/block.rb +2 -2
- data/lib/azure/blob/serialization.rb +6 -6
- data/lib/azure/configurable.rb +8 -0
- data/lib/azure/core/filtered_service.rb +1 -1
- data/lib/azure/core/http/debug_filter.rb +2 -2
- data/lib/azure/core/http/http_error.rb +1 -1
- data/lib/azure/core/http/http_filter.rb +15 -15
- data/lib/azure/core/http/http_request.rb +6 -6
- data/lib/azure/core/http/http_response.rb +1 -1
- data/lib/azure/core/http/retry_policy.rb +12 -12
- data/lib/azure/core/http/signer_filter.rb +1 -1
- data/lib/azure/core/service.rb +1 -1
- data/lib/azure/queue/queue_service.rb +91 -91
- data/lib/azure/queue/serialization.rb +1 -1
- data/lib/azure/service/cors.rb +1 -1
- data/lib/azure/service/logging.rb +1 -1
- data/lib/azure/service/metrics.rb +1 -1
- data/lib/azure/service/serialization.rb +10 -10
- data/lib/azure/service/signed_identifier.rb +1 -1
- data/lib/azure/service/storage_service.rb +2 -2
- data/lib/azure/service_bus/auth/wrap_service.rb +2 -2
- data/lib/azure/service_bus/brokered_message.rb +6 -6
- data/lib/azure/service_bus/interval.rb +2 -2
- data/lib/azure/service_bus/queue.rb +11 -11
- data/lib/azure/service_bus/relay.rb +4 -4
- data/lib/azure/service_bus/resource.rb +1 -1
- data/lib/azure/service_bus/rule.rb +1 -1
- data/lib/azure/service_bus/serialization.rb +2 -2
- data/lib/azure/service_bus/service_bus_service.rb +92 -92
- data/lib/azure/service_bus/sql_filter.rb +1 -1
- data/lib/azure/service_bus/sql_rule_action.rb +3 -3
- data/lib/azure/service_bus/subscription.rb +1 -1
- data/lib/azure/service_bus/topic.rb +11 -11
- data/lib/azure/storage_management/storage_management_service.rb +2 -2
- data/lib/azure/table/batch.rb +28 -28
- data/lib/azure/table/batch_response.rb +5 -5
- data/lib/azure/table/edmtype.rb +1 -1
- data/lib/azure/table/entity.rb +2 -2
- data/lib/azure/table/query.rb +6 -6
- data/lib/azure/table/serialization.rb +4 -4
- data/lib/azure/table/table_service.rb +30 -30
- data/lib/azure/version.rb +1 -1
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +5 -4
- data/lib/azure/virtual_network_management/serialization.rb +2 -2
- data/test/fixtures/list_os_images.xml +1 -1
- data/test/fixtures/list_virtual_networks.xml +0 -1
- data/test/fixtures/management_certificate.pem +55 -0
- data/test/fixtures/management_certificate.publishsettings +12 -0
- data/test/fixtures/updated_storage_accounts.xml +8 -8
- data/test/integration/blob/blob_metadata_test.rb +5 -5
- data/test/integration/blob/blob_pages_test.rb +5 -5
- data/test/integration/blob/blob_properties_test.rb +3 -3
- data/test/integration/blob/block_blob_test.rb +64 -15
- data/test/integration/blob/container/container_acl_test.rb +2 -2
- data/test/integration/blob/container/container_metadata_test.rb +2 -2
- data/test/integration/blob/container/create_container_test.rb +3 -3
- data/test/integration/blob/container/delete_container_test.rb +1 -1
- data/test/integration/blob/container/get_container_properties_test.rb +2 -2
- data/test/integration/blob/container/list_containers_test.rb +3 -3
- data/test/integration/blob/copy_blob_test.rb +4 -4
- data/test/integration/blob/create_blob_snapshot_test.rb +2 -2
- data/test/integration/blob/create_page_blob_test.rb +2 -2
- data/test/integration/blob/delete_blob_test.rb +4 -4
- data/test/integration/blob/get_blob_test.rb +7 -7
- data/test/integration/blob/informative_errors_test.rb +2 -2
- data/test/integration/blob/lease/acquire_lease_test.rb +1 -1
- data/test/integration/blob/lease/break_lease_test.rb +2 -2
- data/test/integration/blob/lease/release_lease_test.rb +2 -2
- data/test/integration/blob/lease/renew_lease_test.rb +2 -2
- data/test/integration/blob/list_blobs_test.rb +1 -1
- data/test/integration/database/delete_sql_server_firewall_test.rb +0 -1
- data/test/integration/database/delete_sql_server_test.rb +0 -1
- data/test/integration/location/Location_List_test.rb +0 -1
- data/test/integration/location/RoleSize_List_test.rb +0 -1
- data/test/integration/queue/clear_messages_test.rb +3 -3
- data/test/integration/queue/create_message_test.rb +5 -5
- data/test/integration/queue/create_queue_test.rb +1 -1
- data/test/integration/queue/delete_message_test.rb +4 -4
- data/test/integration/queue/delete_queue_test.rb +1 -1
- data/test/integration/queue/informative_errors_test.rb +2 -2
- data/test/integration/queue/list_messages_encoded_test.rb +2 -2
- data/test/integration/queue/list_messages_test.rb +3 -3
- data/test/integration/queue/list_queues_test.rb +1 -1
- data/test/integration/queue/peek_messages_test.rb +3 -3
- data/test/integration/queue/queue_metadata_test.rb +4 -4
- data/test/integration/queue/update_message_test.rb +4 -4
- data/test/integration/service_bus/informative_errors_test.rb +1 -1
- data/test/integration/service_bus/queues_test.rb +6 -6
- data/test/integration/service_bus/relay_test.rb +3 -3
- data/test/integration/service_bus/rules_test.rb +2 -2
- data/test/integration/service_bus/subscriptions_test.rb +4 -4
- data/test/integration/service_bus/topics_test.rb +2 -2
- data/test/integration/table/delete_entity_batch_test.rb +3 -3
- data/test/integration/table/delete_entity_test.rb +3 -3
- data/test/integration/table/delete_table_test.rb +1 -1
- data/test/integration/table/get_table_test.rb +4 -4
- data/test/integration/table/informative_errors_test.rb +2 -2
- data/test/integration/table/insert_entity_batch_test.rb +3 -3
- data/test/integration/table/insert_entity_test.rb +3 -3
- data/test/integration/table/insert_or_merge_entity_batch_test.rb +7 -7
- data/test/integration/table/insert_or_merge_entity_test.rb +8 -8
- data/test/integration/table/insert_or_replace_entity_batch_test.rb +7 -7
- data/test/integration/table/insert_or_replace_entity_test.rb +7 -7
- data/test/integration/table/merge_entity_batch_test.rb +1 -1
- data/test/integration/table/merge_entity_test.rb +1 -1
- data/test/integration/table/query_entities_test.rb +21 -21
- data/test/integration/table/query_tables_test.rb +2 -2
- data/test/integration/table/query_test.rb +21 -21
- data/test/integration/table/table_acl_test.rb +4 -4
- data/test/integration/table/update_entity_batch_test.rb +6 -6
- data/test/integration/table/update_entity_test.rb +8 -8
- data/test/unit/config/azure_test.rb +19 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +3 -3
- data/test/unit/core/auth/shared_key_test.rb +2 -2
- data/test/unit/service/serialization_test.rb +44 -44
- metadata +4 -6
- data/.gitignore +0 -30
- data/.travis.yml +0 -13
- data/ChangeLog.txt +0 -56
- data/README.md +0 -702
|
@@ -37,9 +37,9 @@ module Azure
|
|
|
37
37
|
super()
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
attr_accessor :sql_expression
|
|
41
|
-
attr_accessor :compatibility_level
|
|
42
|
-
|
|
40
|
+
attr_accessor :sql_expression
|
|
41
|
+
attr_accessor :compatibility_level
|
|
42
|
+
|
|
43
43
|
def to_hash(hash={})
|
|
44
44
|
hash[:sql_expression]=sql_expression if sql_expression
|
|
45
45
|
hash[:compatibility_level]=compatibility_level.to_s if compatibility_level
|
|
@@ -50,10 +50,10 @@ module Azure
|
|
|
50
50
|
|
|
51
51
|
# MaxSizeInMegabytes: Number
|
|
52
52
|
#
|
|
53
|
-
# Specifies the maximum topic size in megabytes. Any attempt to enqueue a message that will cause the topic to
|
|
54
|
-
# exceed this value will fail. All messages that are stored in the topic or any of its subscriptions count
|
|
55
|
-
# towards this value. Multiple copies of a message that reside in one or multiple subscriptions count as a single
|
|
56
|
-
# messages. For example, if message m exists once in subscription s1 and twice in subscription s2, m is counted
|
|
53
|
+
# Specifies the maximum topic size in megabytes. Any attempt to enqueue a message that will cause the topic to
|
|
54
|
+
# exceed this value will fail. All messages that are stored in the topic or any of its subscriptions count
|
|
55
|
+
# towards this value. Multiple copies of a message that reside in one or multiple subscriptions count as a single
|
|
56
|
+
# messages. For example, if message m exists once in subscription s1 and twice in subscription s2, m is counted
|
|
57
57
|
# as a single message. You can only set this parameter at topic creation time using the following values:
|
|
58
58
|
#
|
|
59
59
|
# Range: 1 - 5*1024 MB
|
|
@@ -65,7 +65,7 @@ module Azure
|
|
|
65
65
|
def max_size_in_megabytes=(val)
|
|
66
66
|
_set 'MaxSizeInMegabytes', val
|
|
67
67
|
end
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
# SizeInBytes: Number
|
|
70
70
|
#
|
|
71
71
|
# Reflects the actual bytes toward the topic quota that messages in the topic currently occupy. (read-only)
|
|
@@ -81,9 +81,9 @@ module Azure
|
|
|
81
81
|
|
|
82
82
|
# DefaultMessageTimeToLive: XML datetime
|
|
83
83
|
#
|
|
84
|
-
# Determines how long a message lives in the associated subscriptions. Subscriptions inherit the TTL from the
|
|
85
|
-
# topic unless they are created explicitly with a smaller TTL. Based on whether dead-lettering is enabled, a
|
|
86
|
-
# message whose TTL has expired will either be moved to the subscription's associated DeadLtterQueue or will
|
|
84
|
+
# Determines how long a message lives in the associated subscriptions. Subscriptions inherit the TTL from the
|
|
85
|
+
# topic unless they are created explicitly with a smaller TTL. Based on whether dead-lettering is enabled, a
|
|
86
|
+
# message whose TTL has expired will either be moved to the subscription's associated DeadLtterQueue or will
|
|
87
87
|
# be permanently deleted. The following values are settable at topic creation time:
|
|
88
88
|
#
|
|
89
89
|
# Range: 1 second - TimeSpan.MaxValue
|
|
@@ -98,7 +98,7 @@ module Azure
|
|
|
98
98
|
|
|
99
99
|
# RequiresDuplicateDetection: True, False
|
|
100
100
|
#
|
|
101
|
-
# If enabled, the topic will detect duplicate messages within the time span specified by the
|
|
101
|
+
# If enabled, the topic will detect duplicate messages within the time span specified by the
|
|
102
102
|
# DuplicateDetectionHistoryTimeWindow property. Settable only at topic creation time.
|
|
103
103
|
#
|
|
104
104
|
# Default: false
|
|
@@ -140,8 +140,8 @@ module Azure
|
|
|
140
140
|
|
|
141
141
|
# EnableBatchedOperations
|
|
142
142
|
#
|
|
143
|
-
# Enables or disables service side batching behavior when performing operations for the specific queue. When
|
|
144
|
-
# enabled, service bus will collect/batch multiple operations to the backend to be more connection efficient.
|
|
143
|
+
# Enables or disables service side batching behavior when performing operations for the specific queue. When
|
|
144
|
+
# enabled, service bus will collect/batch multiple operations to the backend to be more connection efficient.
|
|
145
145
|
#
|
|
146
146
|
# If user wants lower operation latency then they can disable this feature.
|
|
147
147
|
def enable_batched_operations
|
|
@@ -83,7 +83,7 @@ module Azure
|
|
|
83
83
|
# * +:account_type+ - String. Specifies the type of storage account
|
|
84
84
|
#
|
|
85
85
|
# See http://msdn.microsoft.com/en-us/library/azure/hh264518.aspx
|
|
86
|
-
#
|
|
86
|
+
#
|
|
87
87
|
# Returns None
|
|
88
88
|
def create_storage_account(name, options = {})
|
|
89
89
|
raise 'Name not specified' if !name || name.class != String || name.empty?
|
|
@@ -146,7 +146,7 @@ module Azure
|
|
|
146
146
|
# * +name+ - String. Storage account name.
|
|
147
147
|
#
|
|
148
148
|
# See http://msdn.microsoft.com/en-us/library/azure/hh264517.aspx
|
|
149
|
-
#
|
|
149
|
+
#
|
|
150
150
|
# Returns: None
|
|
151
151
|
def delete_storage_account(name)
|
|
152
152
|
Azure::Loggerx.info "Deleting Storage Account #{name}."
|
data/lib/azure/table/batch.rb
CHANGED
|
@@ -22,7 +22,7 @@ require 'azure/core/http/http_error'
|
|
|
22
22
|
module Azure
|
|
23
23
|
module Table
|
|
24
24
|
# Represents a batch of table operations.
|
|
25
|
-
#
|
|
25
|
+
#
|
|
26
26
|
# Example usage (block syntax):
|
|
27
27
|
#
|
|
28
28
|
# results = Batch.new "table", "partition" do
|
|
@@ -37,9 +37,9 @@ module Azure
|
|
|
37
37
|
# .insert("row2", {"meta"=>"data"})
|
|
38
38
|
# .execute
|
|
39
39
|
#
|
|
40
|
-
# which is equivalent to (as class):
|
|
41
|
-
#
|
|
42
|
-
# svc = TableSerice.new
|
|
40
|
+
# which is equivalent to (as class):
|
|
41
|
+
#
|
|
42
|
+
# svc = TableSerice.new
|
|
43
43
|
#
|
|
44
44
|
# batch = Batch.new "table", "partition"
|
|
45
45
|
# batch.insert "row1", {"meta"=>"data"}
|
|
@@ -84,10 +84,10 @@ module Azure
|
|
|
84
84
|
@hash = hash
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def uri
|
|
87
|
+
def uri
|
|
88
88
|
@hash[:uri]
|
|
89
89
|
end
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
def status_code
|
|
92
92
|
@hash[:status_code].to_i
|
|
93
93
|
end
|
|
@@ -100,9 +100,9 @@ module Azure
|
|
|
100
100
|
protected
|
|
101
101
|
def add_operation(method, uri, body=nil, headers=nil)
|
|
102
102
|
op = {
|
|
103
|
-
:method => method,
|
|
104
|
-
:uri => uri,
|
|
105
|
-
:body => body,
|
|
103
|
+
:method => method,
|
|
104
|
+
:uri => uri,
|
|
105
|
+
:body => body,
|
|
106
106
|
:headers => headers
|
|
107
107
|
}
|
|
108
108
|
operations.push op
|
|
@@ -146,7 +146,7 @@ module Azure
|
|
|
146
146
|
# etag from headers
|
|
147
147
|
new_responses.push response[:headers]["etag"]
|
|
148
148
|
when :delete
|
|
149
|
-
# true
|
|
149
|
+
# true
|
|
150
150
|
new_responses.push nil
|
|
151
151
|
end
|
|
152
152
|
end
|
|
@@ -178,7 +178,7 @@ module Azure
|
|
|
178
178
|
body.add_line "#{k}: #{v}"
|
|
179
179
|
}
|
|
180
180
|
end
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
if op[:body]
|
|
183
183
|
body.add_line "Content-Type: application/atom+xml;type=entry"
|
|
184
184
|
body.add_line "Content-Length: #{op[:body].bytesize.to_s}"
|
|
@@ -186,7 +186,7 @@ module Azure
|
|
|
186
186
|
body.add_line op[:body]
|
|
187
187
|
else
|
|
188
188
|
body.add_line ""
|
|
189
|
-
end
|
|
189
|
+
end
|
|
190
190
|
|
|
191
191
|
content_id += 1
|
|
192
192
|
}
|
|
@@ -199,15 +199,15 @@ module Azure
|
|
|
199
199
|
# ==== Attributes
|
|
200
200
|
#
|
|
201
201
|
# * +row_key+ - String. The row key
|
|
202
|
-
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
202
|
+
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
203
203
|
#
|
|
204
204
|
# See http://msdn.microsoft.com/en-us/library/azure/dd179433
|
|
205
205
|
public
|
|
206
206
|
def insert(row_key, entity_values)
|
|
207
207
|
check_entity_key(row_key)
|
|
208
208
|
|
|
209
|
-
body = Azure::Table::Serialization.hash_to_entry_xml({
|
|
210
|
-
"PartitionKey" => partition,
|
|
209
|
+
body = Azure::Table::Serialization.hash_to_entry_xml({
|
|
210
|
+
"PartitionKey" => partition,
|
|
211
211
|
"RowKey" => row_key
|
|
212
212
|
}.merge(entity_values) ).to_xml
|
|
213
213
|
|
|
@@ -215,20 +215,20 @@ module Azure
|
|
|
215
215
|
self
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
# Public: Updates an existing entity in a table. The Update Entity operation replaces
|
|
218
|
+
# Public: Updates an existing entity in a table. The Update Entity operation replaces
|
|
219
219
|
# the entire entity and can be used to remove properties.
|
|
220
220
|
#
|
|
221
221
|
# ==== Attributes
|
|
222
222
|
#
|
|
223
223
|
# * +row_key+ - String. The row key
|
|
224
|
-
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
225
|
-
# * +options+ - Hash. Optional parameters.
|
|
224
|
+
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
225
|
+
# * +options+ - Hash. Optional parameters.
|
|
226
226
|
#
|
|
227
227
|
# ==== Options
|
|
228
228
|
#
|
|
229
229
|
# Accepted key/value pairs in options parameter are:
|
|
230
230
|
# * :if_match - String. A matching condition which is required for update (optional, Default="*")
|
|
231
|
-
# * :create_if_not_exists - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
231
|
+
# * :create_if_not_exists - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
232
232
|
# that entity will be inserted. If false, the operation will fail. (optional, Default=false)
|
|
233
233
|
#
|
|
234
234
|
# See http://msdn.microsoft.com/en-us/library/azure/dd179427
|
|
@@ -246,23 +246,23 @@ module Azure
|
|
|
246
246
|
add_operation(:put, uri, body, headers)
|
|
247
247
|
self
|
|
248
248
|
end
|
|
249
|
-
|
|
249
|
+
|
|
250
250
|
# Public: Updates an existing entity by updating the entity's properties. This operation
|
|
251
251
|
# does not replace the existing entity, as the update_entity operation does.
|
|
252
252
|
#
|
|
253
253
|
# ==== Attributes
|
|
254
254
|
#
|
|
255
255
|
# * +row_key+ - String. The row key
|
|
256
|
-
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
257
|
-
# * +options+ - Hash. Optional parameters.
|
|
256
|
+
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
257
|
+
# * +options+ - Hash. Optional parameters.
|
|
258
258
|
#
|
|
259
259
|
# ==== Options
|
|
260
260
|
#
|
|
261
261
|
# Accepted key/value pairs in options parameter are:
|
|
262
262
|
# * +if_match+ - String. A matching condition which is required for update (optional, Default="*")
|
|
263
|
-
# * +create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
263
|
+
# * +create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
264
264
|
# that entity will be inserted. If false, the operation will fail. (optional, Default=false)
|
|
265
|
-
#
|
|
265
|
+
#
|
|
266
266
|
# See http://msdn.microsoft.com/en-us/library/azure/dd179392
|
|
267
267
|
public
|
|
268
268
|
def merge(row_key, entity_values, options={})
|
|
@@ -285,7 +285,7 @@ module Azure
|
|
|
285
285
|
#
|
|
286
286
|
# * +row_key+ - String. The row key
|
|
287
287
|
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
288
|
-
#
|
|
288
|
+
#
|
|
289
289
|
# See http://msdn.microsoft.com/en-us/library/azure/hh452241
|
|
290
290
|
public
|
|
291
291
|
def insert_or_merge(row_key, entity_values)
|
|
@@ -298,8 +298,8 @@ module Azure
|
|
|
298
298
|
# ==== Attributes
|
|
299
299
|
#
|
|
300
300
|
# * +row_key+ - String. The row key
|
|
301
|
-
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
302
|
-
#
|
|
301
|
+
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
302
|
+
#
|
|
303
303
|
# See http://msdn.microsoft.com/en-us/library/azure/hh452242
|
|
304
304
|
public
|
|
305
305
|
def insert_or_replace(row_key, entity_values)
|
|
@@ -312,7 +312,7 @@ module Azure
|
|
|
312
312
|
# ==== Attributes
|
|
313
313
|
#
|
|
314
314
|
# * +row_key+ - String. The row key
|
|
315
|
-
# * +options+ - Hash. Optional parameters.
|
|
315
|
+
# * +options+ - Hash. Optional parameters.
|
|
316
316
|
#
|
|
317
317
|
# ==== Options
|
|
318
318
|
#
|
|
@@ -16,7 +16,7 @@ module Azure
|
|
|
16
16
|
module Table
|
|
17
17
|
module BatchResponse
|
|
18
18
|
def self.parse(data)
|
|
19
|
-
context = {
|
|
19
|
+
context = {
|
|
20
20
|
:lines => data.lines.to_a,
|
|
21
21
|
:index=> 0,
|
|
22
22
|
:responses => []
|
|
@@ -24,7 +24,7 @@ module Azure
|
|
|
24
24
|
|
|
25
25
|
find(context) { |c| batch_boundary c }
|
|
26
26
|
find(context) { |c| batch_headers c }
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
while(find(context){ |c| changeset_boundary_or_end c } == :boundary)
|
|
29
29
|
find(context) { |c| changeset_headers c }
|
|
30
30
|
find(context) { |c| response c }
|
|
@@ -51,7 +51,7 @@ module Azure
|
|
|
51
51
|
context[:responses].last[:body] ||= ""
|
|
52
52
|
context[:responses].last[:body] << current_line(context)
|
|
53
53
|
return context[:responses].last[:body]
|
|
54
|
-
else
|
|
54
|
+
else
|
|
55
55
|
context[:responses].last[:body] ||= ""
|
|
56
56
|
context[:responses].last[:body] << current_line(context)
|
|
57
57
|
return nil
|
|
@@ -79,7 +79,7 @@ module Azure
|
|
|
79
79
|
response = {:status_code => match[1], :message => match[2] }
|
|
80
80
|
context[:responses].push response
|
|
81
81
|
end
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
def self.changeset_headers(context)
|
|
84
84
|
current_line(context).strip == ''
|
|
85
85
|
end
|
|
@@ -109,7 +109,7 @@ module Azure
|
|
|
109
109
|
match = /--batchresponse_(.*)/.match(current_line(context))
|
|
110
110
|
match ? match[1] : nil
|
|
111
111
|
end
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
def self.current_line(context)
|
|
114
114
|
context[:lines][context[:index]]
|
|
115
115
|
end
|
data/lib/azure/table/edmtype.rb
CHANGED
data/lib/azure/table/entity.rb
CHANGED
data/lib/azure/table/query.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Azure
|
|
|
28
28
|
@table_service = Azure::Table::TableService.new
|
|
29
29
|
self.instance_eval(&block) if block_given?
|
|
30
30
|
end
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
attr_reader :table
|
|
33
33
|
attr_reader :partition_key
|
|
34
34
|
attr_reader :row_key
|
|
@@ -66,7 +66,7 @@ module Azure
|
|
|
66
66
|
@filters.push(p)
|
|
67
67
|
self
|
|
68
68
|
end
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
def top(n)
|
|
71
71
|
@top_n = n
|
|
72
72
|
self
|
|
@@ -85,11 +85,11 @@ module Azure
|
|
|
85
85
|
def execute
|
|
86
86
|
@table_service.query_entities(@table, {
|
|
87
87
|
:partition_key => @partition_key,
|
|
88
|
-
:row_key => @row_key,
|
|
88
|
+
:row_key => @row_key,
|
|
89
89
|
:select => @fields.map{ |f| f.to_s },
|
|
90
90
|
:filter => _build_filter_string,
|
|
91
91
|
:top => (@top_n ? @top_n.to_i : @top_n),
|
|
92
|
-
:continuation_token => {
|
|
92
|
+
:continuation_token => {
|
|
93
93
|
:next_partition_key => @next_partition_key,
|
|
94
94
|
:next_row_key => @next_row_key
|
|
95
95
|
}
|
|
@@ -102,8 +102,8 @@ module Azure
|
|
|
102
102
|
filters.each { |f|
|
|
103
103
|
clauses.push "#{f[0].to_s} #{f[1].to_s} #{Azure::Table::EdmType.serialize_query_value(f[2])}"
|
|
104
104
|
}
|
|
105
|
-
return nil if clauses.length == 0
|
|
106
|
-
|
|
105
|
+
return nil if clauses.length == 0
|
|
106
|
+
|
|
107
107
|
result << clauses.join(" and ")
|
|
108
108
|
result
|
|
109
109
|
end
|
|
@@ -34,7 +34,7 @@ module Azure
|
|
|
34
34
|
|
|
35
35
|
xml.entry entry_namespaces do |entry|
|
|
36
36
|
id ? entry.id(id): entry.id
|
|
37
|
-
entry.updated Time.now.xmlschema
|
|
37
|
+
entry.updated Time.now.xmlschema
|
|
38
38
|
entry.title
|
|
39
39
|
entry.author do |author|
|
|
40
40
|
author.name
|
|
@@ -74,9 +74,9 @@ module Azure
|
|
|
74
74
|
expect_node('feed', xml)
|
|
75
75
|
|
|
76
76
|
return nil unless (xml > 'entry').any?
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
results = []
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
if (xml > 'entry').count == 0
|
|
81
81
|
results.push hash_from_entry_xml((xml > 'entry'))
|
|
82
82
|
else
|
|
@@ -94,7 +94,7 @@ module Azure
|
|
|
94
94
|
result = {}
|
|
95
95
|
result[:etag] = xml['etag']
|
|
96
96
|
result[:updated] = Time.parse((xml > 'updated').text) if (xml > 'updated').any?
|
|
97
|
-
properties = {}
|
|
97
|
+
properties = {}
|
|
98
98
|
if (xml > 'content').any?
|
|
99
99
|
(xml > 'content').first.first_element_child.element_children.each do |prop|
|
|
100
100
|
properties[prop.name] = prop.text != '' ? Azure::Table::EdmType.unserialize_query_value(prop.text, prop['m:type']) : prop['null'] ? nil : ''
|
|
@@ -34,7 +34,7 @@ module Azure
|
|
|
34
34
|
# ==== Attributes
|
|
35
35
|
#
|
|
36
36
|
# * +table_name+ - String. The table name
|
|
37
|
-
# * +options+ - Hash. Optional parameters.
|
|
37
|
+
# * +options+ - Hash. Optional parameters.
|
|
38
38
|
#
|
|
39
39
|
# ==== Options
|
|
40
40
|
#
|
|
@@ -59,7 +59,7 @@ module Azure
|
|
|
59
59
|
# ==== Attributes
|
|
60
60
|
#
|
|
61
61
|
# * +table_name+ - String. The table name
|
|
62
|
-
# * +options+ - Hash. Optional parameters.
|
|
62
|
+
# * +options+ - Hash. Optional parameters.
|
|
63
63
|
#
|
|
64
64
|
# ==== Options
|
|
65
65
|
#
|
|
@@ -82,7 +82,7 @@ module Azure
|
|
|
82
82
|
# ==== Attributes
|
|
83
83
|
#
|
|
84
84
|
# * +table_name+ - String. The table name
|
|
85
|
-
# * +options+ - Hash. Optional parameters.
|
|
85
|
+
# * +options+ - Hash. Optional parameters.
|
|
86
86
|
#
|
|
87
87
|
# ==== Options
|
|
88
88
|
#
|
|
@@ -103,7 +103,7 @@ module Azure
|
|
|
103
103
|
#
|
|
104
104
|
# ==== Attributes
|
|
105
105
|
#
|
|
106
|
-
# * +options+ - Hash. Optional parameters.
|
|
106
|
+
# * +options+ - Hash. Optional parameters.
|
|
107
107
|
#
|
|
108
108
|
# ==== Options
|
|
109
109
|
#
|
|
@@ -135,7 +135,7 @@ module Azure
|
|
|
135
135
|
# ==== Attributes
|
|
136
136
|
#
|
|
137
137
|
# * +table_name+ - String. The table name
|
|
138
|
-
# * +options+ - Hash. Optional parameters.
|
|
138
|
+
# * +options+ - Hash. Optional parameters.
|
|
139
139
|
#
|
|
140
140
|
# ==== Options
|
|
141
141
|
#
|
|
@@ -161,14 +161,14 @@ module Azure
|
|
|
161
161
|
# ==== Attributes
|
|
162
162
|
#
|
|
163
163
|
# * +table_name+ - String. The table name
|
|
164
|
-
# * +options+ - Hash. Optional parameters.
|
|
164
|
+
# * +options+ - Hash. Optional parameters.
|
|
165
165
|
#
|
|
166
166
|
# ==== Options
|
|
167
167
|
#
|
|
168
168
|
# Accepted key/value pairs in options parameter are:
|
|
169
169
|
# * +:signed_identifiers+ - Array. A list of Azure::Entity::SignedIdentifier instances
|
|
170
170
|
# * +:timeout+ - Integer. A timeout in seconds.
|
|
171
|
-
#
|
|
171
|
+
#
|
|
172
172
|
# See http://msdn.microsoft.com/en-us/library/azure/jj159102
|
|
173
173
|
#
|
|
174
174
|
# Returns nil on success
|
|
@@ -190,8 +190,8 @@ module Azure
|
|
|
190
190
|
# ==== Attributes
|
|
191
191
|
#
|
|
192
192
|
# * +table_name+ - String. The table name
|
|
193
|
-
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
194
|
-
# * +options+ - Hash. Optional parameters.
|
|
193
|
+
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
194
|
+
# * +options+ - Hash. Optional parameters.
|
|
195
195
|
#
|
|
196
196
|
# ==== Options
|
|
197
197
|
#
|
|
@@ -208,7 +208,7 @@ module Azure
|
|
|
208
208
|
query['timeout'] = options[:timeout].to_s if options[:timeout]
|
|
209
209
|
|
|
210
210
|
response = call(:post, entities_uri(table_name, nil, nil, query), body)
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
result = Azure::Table::Serialization.hash_from_entry_xml(response.body)
|
|
213
213
|
|
|
214
214
|
Entity.new do |entity|
|
|
@@ -224,7 +224,7 @@ module Azure
|
|
|
224
224
|
# ==== Attributes
|
|
225
225
|
#
|
|
226
226
|
# * +table_name+ - String. The table name
|
|
227
|
-
# * +options+ - Hash. Optional parameters.
|
|
227
|
+
# * +options+ - Hash. Optional parameters.
|
|
228
228
|
#
|
|
229
229
|
# ==== Options
|
|
230
230
|
#
|
|
@@ -255,7 +255,7 @@ module Azure
|
|
|
255
255
|
entities = Azure::Service::EnumerationResults.new
|
|
256
256
|
|
|
257
257
|
results = (options[:partition_key] and options[:row_key]) ? [Azure::Table::Serialization.hash_from_entry_xml(response.body)] : Azure::Table::Serialization.entries_from_feed_xml(response.body)
|
|
258
|
-
|
|
258
|
+
|
|
259
259
|
results.each do |result|
|
|
260
260
|
entity = Entity.new do |e|
|
|
261
261
|
e.table = table_name
|
|
@@ -267,34 +267,34 @@ module Azure
|
|
|
267
267
|
end if results
|
|
268
268
|
|
|
269
269
|
entities.continuation_token = nil
|
|
270
|
-
entities.continuation_token = {
|
|
271
|
-
:next_partition_key=> response.headers["x-ms-continuation-NextPartitionKey"],
|
|
270
|
+
entities.continuation_token = {
|
|
271
|
+
:next_partition_key=> response.headers["x-ms-continuation-NextPartitionKey"],
|
|
272
272
|
:next_row_key => response.headers["x-ms-continuation-NextRowKey"]
|
|
273
273
|
} if response.headers["x-ms-continuation-NextPartitionKey"]
|
|
274
274
|
|
|
275
275
|
entities
|
|
276
276
|
end
|
|
277
277
|
|
|
278
|
-
# Public: Updates an existing entity in a table. The Update Entity operation replaces
|
|
278
|
+
# Public: Updates an existing entity in a table. The Update Entity operation replaces
|
|
279
279
|
# the entire entity and can be used to remove properties.
|
|
280
280
|
#
|
|
281
281
|
# ==== Attributes
|
|
282
282
|
#
|
|
283
283
|
# * +table_name+ - String. The table name
|
|
284
284
|
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
285
|
-
# * +options+ - Hash. Optional parameters.
|
|
285
|
+
# * +options+ - Hash. Optional parameters.
|
|
286
286
|
#
|
|
287
287
|
# ==== Options
|
|
288
288
|
#
|
|
289
289
|
# Accepted key/value pairs in options parameter are:
|
|
290
290
|
# * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
|
|
291
|
-
# * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
291
|
+
# * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
292
292
|
# that entity will be inserted. If false, the operation will fail. (optional, Default=false)
|
|
293
293
|
# * +:timeout+ - Integer. A timeout in seconds.
|
|
294
294
|
#
|
|
295
295
|
# See http://msdn.microsoft.com/en-us/library/azure/dd179427
|
|
296
296
|
#
|
|
297
|
-
# Returns the ETag for the entity on success
|
|
297
|
+
# Returns the ETag for the entity on success
|
|
298
298
|
def update_entity(table_name, entity_values, options={})
|
|
299
299
|
if_match = "*"
|
|
300
300
|
if_match = options[:if_match] if options[:if_match]
|
|
@@ -320,19 +320,19 @@ module Azure
|
|
|
320
320
|
#
|
|
321
321
|
# * +table_name+ - String. The table name
|
|
322
322
|
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
323
|
-
# * +options+ - Hash. Optional parameters.
|
|
323
|
+
# * +options+ - Hash. Optional parameters.
|
|
324
324
|
#
|
|
325
325
|
# ==== Options
|
|
326
326
|
#
|
|
327
327
|
# Accepted key/value pairs in options parameter are:
|
|
328
328
|
# * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
|
|
329
|
-
# * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
329
|
+
# * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
|
|
330
330
|
# that entity will be inserted. If false, the operation will fail. (optional, Default=false)
|
|
331
331
|
# * +:timeout+ - Integer. A timeout in seconds.
|
|
332
|
-
#
|
|
332
|
+
#
|
|
333
333
|
# See http://msdn.microsoft.com/en-us/library/azure/dd179392
|
|
334
|
-
#
|
|
335
|
-
# Returns the ETag for the entity on success
|
|
334
|
+
#
|
|
335
|
+
# Returns the ETag for the entity on success
|
|
336
336
|
def merge_entity(table_name, entity_values, options={})
|
|
337
337
|
if_match = "*"
|
|
338
338
|
if_match = options[:if_match] if options[:if_match]
|
|
@@ -357,16 +357,16 @@ module Azure
|
|
|
357
357
|
#
|
|
358
358
|
# * +table_name+ - String. The table name
|
|
359
359
|
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
360
|
-
# * +options+ - Hash. Optional parameters.
|
|
360
|
+
# * +options+ - Hash. Optional parameters.
|
|
361
361
|
#
|
|
362
362
|
# ==== Options
|
|
363
363
|
#
|
|
364
364
|
# Accepted key/value pairs in options parameter are:
|
|
365
365
|
# * +:timeout+ - Integer. A timeout in seconds.
|
|
366
|
-
#
|
|
366
|
+
#
|
|
367
367
|
# See http://msdn.microsoft.com/en-us/library/azure/hh452241
|
|
368
|
-
#
|
|
369
|
-
# Returns the ETag for the entity on success
|
|
368
|
+
#
|
|
369
|
+
# Returns the ETag for the entity on success
|
|
370
370
|
def insert_or_merge_entity(table_name, entity_values, options={})
|
|
371
371
|
options[:create_if_not_exists] = true
|
|
372
372
|
merge_entity(table_name, entity_values, options)
|
|
@@ -378,16 +378,16 @@ module Azure
|
|
|
378
378
|
#
|
|
379
379
|
# * +table_name+ - String. The table name
|
|
380
380
|
# * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
|
|
381
|
-
# * +options+ - Hash. Optional parameters.
|
|
381
|
+
# * +options+ - Hash. Optional parameters.
|
|
382
382
|
#
|
|
383
383
|
# ==== Options
|
|
384
384
|
#
|
|
385
385
|
# Accepted key/value pairs in options parameter are:
|
|
386
386
|
# * +:timeout+ - Integer. A timeout in seconds.
|
|
387
|
-
#
|
|
387
|
+
#
|
|
388
388
|
# See http://msdn.microsoft.com/en-us/library/azure/hh452242
|
|
389
389
|
#
|
|
390
|
-
# Returns the ETag for the entity on success
|
|
390
|
+
# Returns the ETag for the entity on success
|
|
391
391
|
def insert_or_replace_entity(table_name, entity_values, options={})
|
|
392
392
|
options[:create_if_not_exists] = true
|
|
393
393
|
update_entity(table_name, entity_values, options)
|