azure-storage 0.11.0.preview → 0.11.1.preview

Sign up to get free protection for your applications and to get access to all the features.
@@ -294,7 +294,7 @@ module Azure::Storage
294
294
  end
295
295
 
296
296
  def expect_node(node_name, xml)
297
- raise "Xml is not a #{node_name} node." unless xml.name == node_name
297
+ raise "Xml is not a #{node_name} node. xml:\n#{xml}" unless xml.name == node_name
298
298
  end
299
299
  end
300
300
 
@@ -48,8 +48,8 @@ module Azure::Storage
48
48
  super(signer, account_name, options)
49
49
  end
50
50
 
51
- def call(method, uri, body=nil, headers={})
52
- super(method, uri, body, StorageService.service_properties_headers.merge(headers))
51
+ def call(method, uri, body=nil, headers={}, options={})
52
+ super(method, uri, body, StorageService.common_headers(options).merge(headers))
53
53
  end
54
54
 
55
55
  # Public: Get Storage Service properties
@@ -57,10 +57,15 @@ module Azure::Storage
57
57
  # See http://msdn.microsoft.com/en-us/library/azure/hh452239
58
58
  # See http://msdn.microsoft.com/en-us/library/azure/hh452243
59
59
  #
60
+ # ==== Options
61
+ #
62
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
63
+ # in the analytics logs when storage analytics logging is enabled.
64
+ #
60
65
  # Returns a Hash with the service properties or nil if the operation failed
61
- def get_service_properties
66
+ def get_service_properties(options={})
62
67
  uri = service_properties_uri
63
- response = call(:get, uri)
68
+ response = call(:get, uri, nil, {}, options)
64
69
  Serialization.service_properties_from_xml response.body
65
70
  end
66
71
 
@@ -71,11 +76,16 @@ module Azure::Storage
71
76
  # See http://msdn.microsoft.com/en-us/library/azure/hh452235
72
77
  # See http://msdn.microsoft.com/en-us/library/azure/hh452232
73
78
  #
79
+ # ==== Options
80
+ #
81
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
82
+ # in the analytics logs when storage analytics logging is enabled.
83
+ #
74
84
  # Returns boolean indicating success.
75
- def set_service_properties(service_properties)
85
+ def set_service_properties(service_properties, options={})
76
86
  body = Serialization.service_properties_to_xml service_properties
77
87
  uri = service_properties_uri
78
- call(:put, uri, body)
88
+ call(:put, uri, body, {}, options)
79
89
  nil
80
90
  end
81
91
 
@@ -144,11 +154,13 @@ module Azure::Storage
144
154
  alias with_query with_value
145
155
 
146
156
  # Declares a default hash object for request headers
147
- def service_properties_headers
148
- {
157
+ def common_headers(options = {})
158
+ headers = {
149
159
  'x-ms-version' => Azure::Storage::Default::STG_VERSION,
150
160
  'User-Agent' => Azure::Storage::Default::USER_AGENT
151
161
  }
162
+ headers.merge!({'x-ms-client-request-id' => options[:request_id]}) if options[:request_id]
163
+ headers
152
164
  end
153
165
  end
154
166
 
@@ -42,14 +42,16 @@ module Azure::Storage
42
42
  #
43
43
  # ==== Attributes
44
44
  #
45
- # * +table_name+ - String. The table name
46
- # * +options+ - Hash. Optional parameters.
45
+ # * +table_name+ - String. The table name
46
+ # * +options+ - Hash. Optional parameters.
47
47
  #
48
48
  # ==== Options
49
49
  #
50
50
  # Accepted key/value pairs in options parameter are:
51
51
  #
52
- # * +:timeout+ - Integer. A timeout in seconds.
52
+ # * +:timeout+ - Integer. A timeout in seconds.
53
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
54
+ # in the analytics logs when storage analytics logging is enabled.
53
55
  #
54
56
  # See http://msdn.microsoft.com/en-us/library/azure/dd135729
55
57
  #
@@ -59,7 +61,7 @@ module Azure::Storage
59
61
  query['timeout'] = options[:timeout].to_s if options[:timeout]
60
62
 
61
63
  body = Table::Serialization.hash_to_entry_xml({"TableName" => table_name}).to_xml
62
- call(:post, collection_uri(query), body)
64
+ call(:post, collection_uri(query), body, {}, options)
63
65
  nil
64
66
  end
65
67
 
@@ -67,13 +69,15 @@ module Azure::Storage
67
69
  #
68
70
  # ==== Attributes
69
71
  #
70
- # * +table_name+ - String. The table name
71
- # * +options+ - Hash. Optional parameters.
72
+ # * +table_name+ - String. The table name
73
+ # * +options+ - Hash. Optional parameters.
72
74
  #
73
75
  # ==== Options
74
76
  #
75
77
  # Accepted key/value pairs in options parameter are:
76
- # * +:timeout+ - Integer. A timeout in seconds.
78
+ # * +:timeout+ - Integer. A timeout in seconds.
79
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
80
+ # in the analytics logs when storage analytics logging is enabled.
77
81
  #
78
82
  # See http://msdn.microsoft.com/en-us/library/azure/dd179387
79
83
  #
@@ -82,7 +86,7 @@ module Azure::Storage
82
86
  query = { }
83
87
  query["timeout"] = options[:timeout].to_s if options[:timeout]
84
88
 
85
- call(:delete, table_uri(table_name, query))
89
+ call(:delete, table_uri(table_name, query), nil, {}, options)
86
90
  nil
87
91
  end
88
92
 
@@ -90,36 +94,42 @@ module Azure::Storage
90
94
  #
91
95
  # ==== Attributes
92
96
  #
93
- # * +table_name+ - String. The table name
94
- # * +options+ - Hash. Optional parameters.
97
+ # * +table_name+ - String. The table name
98
+ # * +options+ - Hash. Optional parameters.
95
99
  #
96
100
  # ==== Options
97
101
  #
98
102
  # Accepted key/value pairs in options parameter are:
99
- # * +:timeout+ - Integer. A timeout in seconds.
103
+ # * +:timeout+ - Integer. A timeout in seconds.
104
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
105
+ # in the analytics logs when storage analytics logging is enabled.
100
106
  #
101
107
  # Returns the last updated time for the table
102
108
  def get_table(table_name, options={})
103
109
  query = { }
104
110
  query["timeout"] = options[:timeout].to_s if options[:timeout]
105
111
 
106
- response = call(:get, table_uri(table_name, query))
112
+ response = call(:get, table_uri(table_name, query), nil, {}, options)
107
113
  results = Table::Serialization.hash_from_entry_xml(response.body)
108
114
  results[:updated]
115
+ rescue => e
116
+ raise_with_response(e, response)
109
117
  end
110
118
 
111
119
  # Public: Gets a list of all tables on the account.
112
120
  #
113
121
  # ==== Attributes
114
122
  #
115
- # * +options+ - Hash. Optional parameters.
123
+ # * +options+ - Hash. Optional parameters.
116
124
  #
117
125
  # ==== Options
118
126
  #
119
127
  # Accepted key/value pairs in options parameter are:
120
- # * +:next_table_token+ - String. A token used to enumerate the next page of results, when the list of tables is
121
- # larger than a single operation can return at once. (optional)
122
- # * +:timeout+ - Integer. A timeout in seconds.
128
+ # * +:next_table_token+ - String. A token used to enumerate the next page of results, when the list of tables is
129
+ # larger than a single operation can return at once. (optional)
130
+ # * +:timeout+ - Integer. A timeout in seconds.
131
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
132
+ # in the analytics logs when storage analytics logging is enabled.
123
133
  #
124
134
  # See http://msdn.microsoft.com/en-us/library/azure/dd179405
125
135
  #
@@ -130,25 +140,29 @@ module Azure::Storage
130
140
  query["timeout"] = options[:timeout].to_s if options[:timeout]
131
141
  uri = collection_uri(query)
132
142
 
133
- response = call(:get, uri)
143
+ response = call(:get, uri, nil, {}, options)
134
144
  entries = Table::Serialization.entries_from_feed_xml(response.body) || []
135
145
 
136
146
  values = Azure::Service::EnumerationResults.new(entries)
137
147
  values.continuation_token = response.headers["x-ms-continuation-NextTableName"]
138
148
  values
149
+ rescue => e
150
+ raise_with_response(e, response)
139
151
  end
140
152
 
141
153
  # Public: Gets the access control list (ACL) for the table.
142
154
  #
143
155
  # ==== Attributes
144
156
  #
145
- # * +table_name+ - String. The table name
146
- # * +options+ - Hash. Optional parameters.
157
+ # * +table_name+ - String. The table name
158
+ # * +options+ - Hash. Optional parameters.
147
159
  #
148
160
  # ==== Options
149
161
  #
150
162
  # Accepted key/value pairs in options parameter are:
151
- # * +:timeout+ - Integer. A timeout in seconds.
163
+ # * +:timeout+ - Integer. A timeout in seconds.
164
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
165
+ # in the analytics logs when storage analytics logging is enabled.
152
166
  #
153
167
  # See http://msdn.microsoft.com/en-us/library/azure/jj159100
154
168
  #
@@ -157,25 +171,29 @@ module Azure::Storage
157
171
  query = { 'comp' => 'acl'}
158
172
  query['timeout'] = options[:timeout].to_s if options[:timeout]
159
173
 
160
- response = call(:get, generate_uri(table_name, query), nil, {'x-ms-version' => '2012-02-12'})
174
+ response = call(:get, generate_uri(table_name, query), nil, {'x-ms-version' => '2012-02-12'}, options)
161
175
 
162
176
  signed_identifiers = []
163
177
  signed_identifiers = Table::Serialization.signed_identifiers_from_xml response.body unless response.body == nil or response.body.length < 1
164
178
  signed_identifiers
179
+ rescue => e
180
+ raise_with_response(e, response)
165
181
  end
166
182
 
167
183
  # Public: Sets the access control list (ACL) for the table.
168
184
  #
169
185
  # ==== Attributes
170
186
  #
171
- # * +table_name+ - String. The table name
172
- # * +options+ - Hash. Optional parameters.
187
+ # * +table_name+ - String. The table name
188
+ # * +options+ - Hash. Optional parameters.
173
189
  #
174
190
  # ==== Options
175
191
  #
176
192
  # Accepted key/value pairs in options parameter are:
177
- # * +:signed_identifiers+ - Array. A list of Azure::Storage::Entity::SignedIdentifier instances
178
- # * +:timeout+ - Integer. A timeout in seconds.
193
+ # * +:signed_identifiers+ - Array. A list of Azure::Storage::Entity::SignedIdentifier instances
194
+ # * +:timeout+ - Integer. A timeout in seconds.
195
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
196
+ # in the analytics logs when storage analytics logging is enabled.
179
197
  #
180
198
  # See http://msdn.microsoft.com/en-us/library/azure/jj159102
181
199
  #
@@ -188,7 +206,7 @@ module Azure::Storage
188
206
  body = nil
189
207
  body = Table::Serialization.signed_identifiers_to_xml options[:signed_identifiers] if options[:signed_identifiers] && options[:signed_identifiers].length > 0
190
208
 
191
- call(:put, uri, body, {'x-ms-version' => '2012-02-12'})
209
+ call(:put, uri, body, {'x-ms-version' => '2012-02-12'}, options)
192
210
  nil
193
211
  end
194
212
 
@@ -197,14 +215,16 @@ module Azure::Storage
197
215
  #
198
216
  # ==== Attributes
199
217
  #
200
- # * +table_name+ - String. The table name
201
- # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
202
- # * +options+ - Hash. Optional parameters.
218
+ # * +table_name+ - String. The table name
219
+ # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
220
+ # * +options+ - Hash. Optional parameters.
203
221
  #
204
222
  # ==== Options
205
223
  #
206
224
  # Accepted key/value pairs in options parameter are:
207
- # * +:timeout+ - Integer. A timeout in seconds.
225
+ # * +:timeout+ - Integer. A timeout in seconds.
226
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
227
+ # in the analytics logs when storage analytics logging is enabled.
208
228
  #
209
229
  # See http://msdn.microsoft.com/en-us/library/azure/dd179433
210
230
  #
@@ -215,7 +235,7 @@ module Azure::Storage
215
235
  query = { }
216
236
  query['timeout'] = options[:timeout].to_s if options[:timeout]
217
237
 
218
- response = call(:post, entities_uri(table_name, nil, nil, query), body)
238
+ response = call(:post, entities_uri(table_name, nil, nil, query), body, {}, options)
219
239
 
220
240
  result = Table::Serialization.hash_from_entry_xml(response.body)
221
241
 
@@ -225,25 +245,29 @@ module Azure::Storage
225
245
  entity.etag = response.headers['etag'] || result[:etag]
226
246
  entity.properties = result[:properties]
227
247
  end
248
+ rescue => e
249
+ raise_with_response(e, response)
228
250
  end
229
251
 
230
252
  # Public: Queries entities for the given table name
231
253
  #
232
254
  # ==== Attributes
233
255
  #
234
- # * +table_name+ - String. The table name
235
- # * +options+ - Hash. Optional parameters.
256
+ # * +table_name+ - String. The table name
257
+ # * +options+ - Hash. Optional parameters.
236
258
  #
237
259
  # ==== Options
238
260
  #
239
261
  # Accepted key/value pairs in options parameter are:
240
- # * +:partition_key+ - String. The partition key (optional)
241
- # * +:row_key+ - String. The row key (optional)
242
- # * +:select+ - Array. An array of property names to return (optional)
243
- # * +:filter+ - String. A filter expression (optional)
244
- # * +:top+ - Integer. A limit for the number of results returned (optional)
245
- # * +:continuation_token+ - Hash. The continuation token.
246
- # * +:timeout+ - Integer. A timeout in seconds.
262
+ # * +:partition_key+ - String. The partition key (optional)
263
+ # * +:row_key+ - String. The row key (optional)
264
+ # * +:select+ - Array. An array of property names to return (optional)
265
+ # * +:filter+ - String. A filter expression (optional)
266
+ # * +:top+ - Integer. A limit for the number of results returned (optional)
267
+ # * +:continuation_token+ - Hash. The continuation token.
268
+ # * +:timeout+ - Integer. A timeout in seconds.
269
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
270
+ # in the analytics logs when storage analytics logging is enabled.
247
271
  #
248
272
  # See http://msdn.microsoft.com/en-us/library/azure/dd179421
249
273
  #
@@ -258,7 +282,7 @@ module Azure::Storage
258
282
  query["timeout"] = options[:timeout].to_s if options[:timeout]
259
283
 
260
284
  uri = entities_uri(table_name, options[:partition_key], options[:row_key], query)
261
- response = call(:get, uri, nil, { "DataServiceVersion" => "2.0;NetFx"})
285
+ response = call(:get, uri, nil, {"DataServiceVersion" => "2.0;NetFx"}, options)
262
286
 
263
287
  entities = Azure::Service::EnumerationResults.new
264
288
 
@@ -281,6 +305,8 @@ module Azure::Storage
281
305
  } if response.headers["x-ms-continuation-NextPartitionKey"]
282
306
 
283
307
  entities
308
+ rescue => e
309
+ raise_with_response(e, response)
284
310
  end
285
311
 
286
312
  # Public: Updates an existing entity in a table. The Update Entity operation replaces
@@ -288,17 +314,19 @@ module Azure::Storage
288
314
  #
289
315
  # ==== Attributes
290
316
  #
291
- # * +table_name+ - String. The table name
292
- # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
293
- # * +options+ - Hash. Optional parameters.
317
+ # * +table_name+ - String. The table name
318
+ # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
319
+ # * +options+ - Hash. Optional parameters.
294
320
  #
295
321
  # ==== Options
296
322
  #
297
323
  # Accepted key/value pairs in options parameter are:
298
- # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
299
- # * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
300
- # that entity will be inserted. If false, the operation will fail. (optional, Default=false)
301
- # * +:timeout+ - Integer. A timeout in seconds.
324
+ # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
325
+ # * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
326
+ # that entity will be inserted. If false, the operation will fail. (optional, Default=false)
327
+ # * +:timeout+ - Integer. A timeout in seconds.
328
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
329
+ # in the analytics logs when storage analytics logging is enabled.
302
330
  #
303
331
  # See http://msdn.microsoft.com/en-us/library/azure/dd179427
304
332
  #
@@ -319,8 +347,10 @@ module Azure::Storage
319
347
 
320
348
  body = Table::Serialization.hash_to_entry_xml(entity_values).to_xml
321
349
 
322
- response = call(:put, uri, body, headers)
350
+ response = call(:put, uri, body, headers, options)
323
351
  response.headers["etag"]
352
+ rescue => e
353
+ raise_with_response(e, response)
324
354
  end
325
355
 
326
356
  # Public: Updates an existing entity by updating the entity's properties. This operation
@@ -328,17 +358,19 @@ module Azure::Storage
328
358
  #
329
359
  # ==== Attributes
330
360
  #
331
- # * +table_name+ - String. The table name
332
- # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
333
- # * +options+ - Hash. Optional parameters.
361
+ # * +table_name+ - String. The table name
362
+ # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
363
+ # * +options+ - Hash. Optional parameters.
334
364
  #
335
365
  # ==== Options
336
366
  #
337
367
  # Accepted key/value pairs in options parameter are:
338
- # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
339
- # * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
340
- # that entity will be inserted. If false, the operation will fail. (optional, Default=false)
341
- # * +:timeout+ - Integer. A timeout in seconds.
368
+ # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
369
+ # * +:create_if_not_exists+ - Boolean. If true, and partition_key and row_key do not reference and existing entity,
370
+ # that entity will be inserted. If false, the operation will fail. (optional, Default=false)
371
+ # * +:timeout+ - Integer. A timeout in seconds.
372
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
373
+ # in the analytics logs when storage analytics logging is enabled.
342
374
  #
343
375
  # See http://msdn.microsoft.com/en-us/library/azure/dd179392
344
376
  #
@@ -359,22 +391,26 @@ module Azure::Storage
359
391
 
360
392
  body = Table::Serialization.hash_to_entry_xml(entity_values).to_xml
361
393
 
362
- response = call(:post, uri, body, headers)
394
+ response = call(:post, uri, body, headers, options)
363
395
  response.headers["etag"]
396
+ rescue => e
397
+ raise_with_response(e, response)
364
398
  end
365
399
 
366
400
  # Public: Inserts or updates an existing entity within a table by merging new property values into the entity.
367
401
  #
368
402
  # ==== Attributes
369
403
  #
370
- # * +table_name+ - String. The table name
371
- # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
372
- # * +options+ - Hash. Optional parameters.
404
+ # * +table_name+ - String. The table name
405
+ # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
406
+ # * +options+ - Hash. Optional parameters.
373
407
  #
374
408
  # ==== Options
375
409
  #
376
410
  # Accepted key/value pairs in options parameter are:
377
- # * +:timeout+ - Integer. A timeout in seconds.
411
+ # * +:timeout+ - Integer. A timeout in seconds.
412
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
413
+ # in the analytics logs when storage analytics logging is enabled.
378
414
  #
379
415
  # See http://msdn.microsoft.com/en-us/library/azure/hh452241
380
416
  #
@@ -388,14 +424,16 @@ module Azure::Storage
388
424
  #
389
425
  # ==== Attributes
390
426
  #
391
- # * +table_name+ - String. The table name
392
- # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
393
- # * +options+ - Hash. Optional parameters.
427
+ # * +table_name+ - String. The table name
428
+ # * +entity_values+ - Hash. A hash of the name/value pairs for the entity.
429
+ # * +options+ - Hash. Optional parameters.
394
430
  #
395
431
  # ==== Options
396
432
  #
397
433
  # Accepted key/value pairs in options parameter are:
398
- # * +:timeout+ - Integer. A timeout in seconds.
434
+ # * +:timeout+ - Integer. A timeout in seconds.
435
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
436
+ # in the analytics logs when storage analytics logging is enabled.
399
437
  #
400
438
  # See http://msdn.microsoft.com/en-us/library/azure/hh452242
401
439
  #
@@ -409,16 +447,18 @@ module Azure::Storage
409
447
  #
410
448
  # ==== Attributes
411
449
  #
412
- # * +table_name+ - String. The table name
413
- # * +partition_key+ - String. The partition key
414
- # * +row_key+ - String. The row key
415
- # * +options+ - Hash. Optional parameters.
450
+ # * +table_name+ - String. The table name
451
+ # * +partition_key+ - String. The partition key
452
+ # * +row_key+ - String. The row key
453
+ # * +options+ - Hash. Optional parameters.
416
454
  #
417
455
  # ==== Options
418
456
  #
419
457
  # Accepted key/value pairs in options parameter are:
420
- # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
421
- # * +:timeout+ - Integer. A timeout in seconds.
458
+ # * +:if_match+ - String. A matching condition which is required for update (optional, Default="*")
459
+ # * +:timeout+ - Integer. A timeout in seconds.
460
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
461
+ # in the analytics logs when storage analytics logging is enabled.
422
462
  #
423
463
  # See http://msdn.microsoft.com/en-us/library/azure/dd135727
424
464
  #
@@ -430,7 +470,7 @@ module Azure::Storage
430
470
  query = { }
431
471
  query["timeout"] = options[:timeout].to_s if options[:timeout]
432
472
 
433
- call(:delete, entities_uri(table_name, partition_key, row_key, query), nil, { "If-Match"=> if_match })
473
+ call(:delete, entities_uri(table_name, partition_key, row_key, query), nil, { "If-Match"=> if_match }, options)
434
474
  nil
435
475
  end
436
476
 
@@ -438,13 +478,15 @@ module Azure::Storage
438
478
  #
439
479
  # ==== Attributes
440
480
  #
441
- # * +batch+ - The Azure::Storage::Table::Batch instance to execute.
442
- # * +options+ - Hash. Optional parameters.
481
+ # * +batch+ - The Azure::Storage::Table::Batch instance to execute.
482
+ # * +options+ - Hash. Optional parameters.
443
483
  #
444
484
  # ==== Options
445
485
  #
446
486
  # Accepted key/value pairs in options parameter are:
447
- # * +:timeout+ - Integer. A timeout in seconds.
487
+ # * +:timeout+ - Integer. A timeout in seconds.
488
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
489
+ # in the analytics logs when storage analytics logging is enabled.
448
490
  #
449
491
  # See http://msdn.microsoft.com/en-us/library/azure/dd894038
450
492
  #
@@ -460,23 +502,27 @@ module Azure::Storage
460
502
  query["timeout"] = options[:timeout].to_s if options[:timeout]
461
503
 
462
504
  body = batch.to_body
463
- response = call(:post, generate_uri('/$batch', query), body, headers)
505
+ response = call(:post, generate_uri('/$batch', query), body, headers, options)
464
506
  batch.parse_response(response)
507
+ rescue => e
508
+ raise_with_response(e, response)
465
509
  end
466
510
 
467
511
  # Public: Gets an existing entity in the table.
468
512
  #
469
513
  # ==== Attributes
470
514
  #
471
- # * +table_name+ - String. The table name
472
- # * +partition_key+ - String. The partition key
473
- # * +row_key+ - String. The row key
474
- # * +options+ - Hash. Optional parameters.
515
+ # * +table_name+ - String. The table name
516
+ # * +partition_key+ - String. The partition key
517
+ # * +row_key+ - String. The row key
518
+ # * +options+ - Hash. Optional parameters.
475
519
  #
476
520
  # ==== Options
477
521
  #
478
522
  # Accepted key/value pairs in options parameter are:
479
- # * +:timeout+ - Integer. A timeout in seconds.
523
+ # * +:timeout+ - Integer. A timeout in seconds.
524
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
525
+ # in the analytics logs when storage analytics logging is enabled.
480
526
  #
481
527
  # Returns an Azure::Storage::Table::Entity instance on success
482
528
  def get_entity(table_name, partition_key, row_key, options={})
@@ -568,6 +614,12 @@ module Azure::Storage
568
614
 
569
615
  value
570
616
  end
617
+
618
+ protected
619
+ def raise_with_response(e, response)
620
+ raise e if response.nil?
621
+ raise "Response header: #{response.headers.inspect}\nResponse body: #{response.body.inspect}\n#{e.inspect}\n#{e.backtrace.join("\n")}"
622
+ end
571
623
  end
572
624
  end
573
625
  end