azure-storage 0.14.0.preview → 0.15.0.preview

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+ require "azure/storage/service/geo_replication"
27
+
28
+ module Azure::Storage
29
+ module Service
30
+ class StorageServiceStats
31
+ def initialize
32
+ @geo_replication = GeoReplication.new
33
+ yield self if block_given?
34
+ end
35
+
36
+ attr_accessor :geo_replication
37
+ end
38
+ end
39
+ end
@@ -36,7 +36,8 @@ module Azure::Storage
36
36
  client_config = options[:client] || Azure::Storage
37
37
  signer = options[:signer] || client_config.signer || Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)
38
38
  super(signer, client_config.storage_account_name, options, &block)
39
- @host = client.storage_table_host
39
+ @storage_service_host[:primary] = client.storage_table_host
40
+ @storage_service_host[:secondary] = client.storage_table_host true
40
41
  end
41
42
 
42
43
  # Public: Creates new table in the storage account
@@ -110,14 +111,17 @@ module Azure::Storage
110
111
  # * +:timeout+ - Integer. A timeout in seconds.
111
112
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
112
113
  # in the analytics logs when storage analytics logging is enabled.
114
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
115
+ # which location the request should be sent to.
113
116
  #
114
117
  # Returns the last updated time for the table
115
118
  def get_table(table_name, options = {})
116
119
  headers = {
117
120
  HeaderConstants::ACCEPT => Table::Serialization.get_accept_string(:full_meta),
118
121
  }
119
- response = call(:get, table_uri(table_name, new_query(options)), nil, headers, options)
120
- results = Table::Serialization.table_entries_from_json(response.body)
122
+ options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
123
+ response = call(:get, table_uri(table_name, new_query(options), options), nil, headers, options)
124
+ Table::Serialization.table_entries_from_json(response.body)
121
125
  rescue => e
122
126
  raise_with_response(e, response)
123
127
  end
@@ -136,6 +140,8 @@ module Azure::Storage
136
140
  # * +:timeout+ - Integer. A timeout in seconds.
137
141
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
138
142
  # in the analytics logs when storage analytics logging is enabled.
143
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
144
+ # which location the request should be sent to.
139
145
  # * +:accept+ - String. Specifies the accepted content-type of the response payload. Possible values are:
140
146
  # :no_meta
141
147
  # :min_meta
@@ -147,7 +153,9 @@ module Azure::Storage
147
153
  def query_tables(options = {})
148
154
  query = new_query(options)
149
155
  query[TableConstants::NEXT_TABLE_NAME] = options[:next_table_token] if options[:next_table_token]
150
- uri = collection_uri(query)
156
+
157
+ options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
158
+ uri = collection_uri(query, options)
151
159
 
152
160
  headers = {
153
161
  HeaderConstants::ACCEPT => Table::Serialization.get_accept_string(options[:accept]),
@@ -175,6 +183,8 @@ module Azure::Storage
175
183
  # * +:timeout+ - Integer. A timeout in seconds.
176
184
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
177
185
  # in the analytics logs when storage analytics logging is enabled.
186
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
187
+ # which location the request should be sent to.
178
188
  #
179
189
  # See http://msdn.microsoft.com/en-us/library/azure/jj159100
180
190
  #
@@ -183,7 +193,8 @@ module Azure::Storage
183
193
  query = new_query(options)
184
194
  query[QueryStringConstants::COMP] = QueryStringConstants::ACL
185
195
 
186
- response = call(:get, generate_uri(table_name, query), nil, { "x-ms-version" => "2012-02-12" }, options)
196
+ options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
197
+ response = call(:get, generate_uri(table_name, query, options), nil, { "x-ms-version" => "2012-02-12" }, options)
187
198
 
188
199
  signed_identifiers = []
189
200
  signed_identifiers = Table::Serialization.signed_identifiers_from_xml response.body unless response.body == nil || response.body.length < 1
@@ -247,7 +258,7 @@ module Azure::Storage
247
258
  # Returns a Azure::Storage::Entity::Table::Entity
248
259
  def insert_entity(table_name, entity_values, options = {})
249
260
  body = Table::Serialization.hash_to_json(entity_values)
250
- time = EdmType::to_edm_time(Time.now)
261
+ #time = EdmType::to_edm_time(Time.now)
251
262
  headers = {
252
263
  HeaderConstants::ACCEPT => Table::Serialization.get_accept_string(options[:accept])
253
264
  }
@@ -278,6 +289,8 @@ module Azure::Storage
278
289
  # * +:timeout+ - Integer. A timeout in seconds.
279
290
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
280
291
  # in the analytics logs when storage analytics logging is enabled.
292
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
293
+ # which location the request should be sent to.
281
294
  # * +:accept+ - String. Specifies the accepted content-type of the response payload. Possible values are:
282
295
  # :no_meta
283
296
  # :min_meta
@@ -294,7 +307,8 @@ module Azure::Storage
294
307
  query[QueryStringConstants::NEXT_PARTITION_KEY] = options[:continuation_token][:next_partition_key] if options[:continuation_token] && options[:continuation_token][:next_partition_key]
295
308
  query[QueryStringConstants::NEXT_ROW_KEY] = options[:continuation_token][:next_row_key] if options[:continuation_token] && options[:continuation_token][:next_row_key]
296
309
 
297
- uri = entities_uri(table_name, options[:partition_key], options[:row_key], query)
310
+ options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
311
+ uri = entities_uri(table_name, options[:partition_key], options[:row_key], query, options)
298
312
 
299
313
  headers = {
300
314
  HeaderConstants::ACCEPT => Table::Serialization.get_accept_string(options[:accept])
@@ -484,6 +498,8 @@ module Azure::Storage
484
498
  # * +:timeout+ - Integer. A timeout in seconds.
485
499
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
486
500
  # in the analytics logs when storage analytics logging is enabled.
501
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
502
+ # which location the request should be sent to.
487
503
  #
488
504
  # See http://msdn.microsoft.com/en-us/library/azure/dd894038
489
505
  #
@@ -496,7 +512,8 @@ module Azure::Storage
496
512
  }
497
513
 
498
514
  body = batch.to_body
499
- response = call(:post, generate_uri("/$batch", new_query(options)), body, headers, options, true)
515
+ options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
516
+ response = call(:post, generate_uri("/$batch", new_query(options), options), body, headers, options, true)
500
517
  batch.parse_response(response)
501
518
  rescue => e
502
519
  raise_with_response(e, response)
@@ -517,6 +534,8 @@ module Azure::Storage
517
534
  # * +:timeout+ - Integer. A timeout in seconds.
518
535
  # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
519
536
  # in the analytics logs when storage analytics logging is enabled.
537
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
538
+ # which location the request should be sent to.
520
539
  #
521
540
  # Returns an Azure::Storage::Table::Entity instance on success
522
541
  def get_entity(table_name, partition_key, row_key, options = {})
@@ -530,8 +549,8 @@ module Azure::Storage
530
549
  #
531
550
  # Returns a URI
532
551
  protected
533
- def collection_uri(query = {})
534
- generate_uri("Tables", query)
552
+ def collection_uri(query = {}, options = {})
553
+ generate_uri("Tables", query, options)
535
554
  end
536
555
 
537
556
  # Public: Generate the URI for a specific table.
@@ -542,9 +561,9 @@ module Azure::Storage
542
561
  #
543
562
  # Returns a URI
544
563
  public
545
- def table_uri(name, query = {})
564
+ def table_uri(name, query = {}, options = {})
546
565
  return name if name.kind_of? ::URI
547
- generate_uri("Tables('#{name}')", query)
566
+ generate_uri("Tables('#{name}')", query, options)
548
567
  end
549
568
 
550
569
  # Public: Generate the URI for an entity or group of entities in a table.
@@ -559,7 +578,7 @@ module Azure::Storage
559
578
  #
560
579
  # Returns a URI
561
580
  public
562
- def entities_uri(table_name, partition_key = nil, row_key = nil, query = {})
581
+ def entities_uri(table_name, partition_key = nil, row_key = nil, query = {}, options = {})
563
582
  return table_name if table_name.kind_of? ::URI
564
583
 
565
584
  path = if partition_key && row_key
@@ -570,7 +589,7 @@ module Azure::Storage
570
589
  "%s()" % table_name.encode("UTF-8")
571
590
  end
572
591
 
573
- uri = generate_uri(path)
592
+ uri = generate_uri(path, query, options)
574
593
  qs = []
575
594
  if query
576
595
  query.each do | key, val |
@@ -29,7 +29,7 @@ module Azure
29
29
  class Version
30
30
  # Fields represent the parts defined in http://semver.org/
31
31
  MAJOR = 0 unless defined? MAJOR
32
- MINOR = 14 unless defined? MINOR
32
+ MINOR = 15 unless defined? MINOR
33
33
  UPDATE = 0 unless defined? UPDATE
34
34
  PRE = "preview" unless defined? PRE
35
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.preview
4
+ version: 0.15.0.preview
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2017-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure-core
@@ -190,6 +190,7 @@ files:
190
190
  - lib/azure/storage/client_options_error.rb
191
191
  - lib/azure/storage/configurable.rb
192
192
  - lib/azure/storage/core.rb
193
+ - lib/azure/storage/core/auth/anonymous_signer.rb
193
194
  - lib/azure/storage/core/auth/shared_access_signature.rb
194
195
  - lib/azure/storage/core/auth/shared_access_signature_generator.rb
195
196
  - lib/azure/storage/core/auth/shared_access_signature_signer.rb
@@ -216,6 +217,7 @@ files:
216
217
  - lib/azure/storage/service/cors.rb
217
218
  - lib/azure/storage/service/cors_rule.rb
218
219
  - lib/azure/storage/service/enumeration_results.rb
220
+ - lib/azure/storage/service/geo_replication.rb
219
221
  - lib/azure/storage/service/logging.rb
220
222
  - lib/azure/storage/service/metrics.rb
221
223
  - lib/azure/storage/service/retention_policy.rb
@@ -223,6 +225,7 @@ files:
223
225
  - lib/azure/storage/service/signed_identifier.rb
224
226
  - lib/azure/storage/service/storage_service.rb
225
227
  - lib/azure/storage/service/storage_service_properties.rb
228
+ - lib/azure/storage/service/storage_service_stats.rb
226
229
  - lib/azure/storage/table/auth/shared_key.rb
227
230
  - lib/azure/storage/table/batch.rb
228
231
  - lib/azure/storage/table/batch_response.rb