azure-storage-common2 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/azure/core/auth/authorizer.rb +36 -0
  3. data/lib/azure/core/auth/shared_key.rb +125 -0
  4. data/lib/azure/core/auth/shared_key_lite.rb +48 -0
  5. data/lib/azure/core/auth/signer.rb +51 -0
  6. data/lib/azure/core/default.rb +23 -0
  7. data/lib/azure/core/error.rb +21 -0
  8. data/lib/azure/core/filtered_service.rb +45 -0
  9. data/lib/azure/core/http/debug_filter.rb +36 -0
  10. data/lib/azure/core/http/http_error.rb +135 -0
  11. data/lib/azure/core/http/http_filter.rb +53 -0
  12. data/lib/azure/core/http/http_request.rb +195 -0
  13. data/lib/azure/core/http/http_response.rb +102 -0
  14. data/lib/azure/core/http/retry_policy.rb +84 -0
  15. data/lib/azure/core/http/signer_filter.rb +33 -0
  16. data/lib/azure/core/service.rb +46 -0
  17. data/lib/azure/core/signed_service.rb +45 -0
  18. data/lib/azure/core/utility.rb +244 -0
  19. data/lib/azure/core/version.rb +33 -0
  20. data/lib/azure/storage/common/autoload.rb +62 -0
  21. data/lib/azure/storage/common/client.rb +162 -0
  22. data/lib/azure/storage/common/client_options.rb +363 -0
  23. data/lib/azure/storage/common/client_options_error.rb +41 -0
  24. data/lib/azure/storage/common/configurable.rb +212 -0
  25. data/lib/azure/storage/common/core/auth/anonymous_signer.rb +43 -0
  26. data/lib/azure/storage/common/core/auth/shared_access_signature.rb +30 -0
  27. data/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb +399 -0
  28. data/lib/azure/storage/common/core/auth/shared_access_signature_signer.rb +57 -0
  29. data/lib/azure/storage/common/core/auth/shared_key.rb +60 -0
  30. data/lib/azure/storage/common/core/auth/token_signer.rb +43 -0
  31. data/lib/azure/storage/common/core/autoload.rb +53 -0
  32. data/lib/azure/storage/common/core/error.rb +43 -0
  33. data/lib/azure/storage/common/core/filter/exponential_retry_filter.rb +64 -0
  34. data/lib/azure/storage/common/core/filter/linear_retry_filter.rb +55 -0
  35. data/lib/azure/storage/common/core/filter/retry_filter.rb +300 -0
  36. data/lib/azure/storage/common/core/http_client.rb +82 -0
  37. data/lib/azure/storage/common/core/sr.rb +85 -0
  38. data/lib/azure/storage/common/core/token_credential.rb +64 -0
  39. data/lib/azure/storage/common/core/utility.rb +261 -0
  40. data/lib/azure/storage/common/core.rb +35 -0
  41. data/lib/azure/storage/common/default.rb +868 -0
  42. data/lib/azure/storage/common/service/access_policy.rb +37 -0
  43. data/lib/azure/storage/common/service/cors.rb +38 -0
  44. data/lib/azure/storage/common/service/cors_rule.rb +48 -0
  45. data/lib/azure/storage/common/service/enumeration_results.rb +32 -0
  46. data/lib/azure/storage/common/service/geo_replication.rb +40 -0
  47. data/lib/azure/storage/common/service/logging.rb +47 -0
  48. data/lib/azure/storage/common/service/metrics.rb +45 -0
  49. data/lib/azure/storage/common/service/retention_policy.rb +37 -0
  50. data/lib/azure/storage/common/service/serialization.rb +335 -0
  51. data/lib/azure/storage/common/service/signed_identifier.rb +40 -0
  52. data/lib/azure/storage/common/service/storage_service.rb +322 -0
  53. data/lib/azure/storage/common/service/storage_service_properties.rb +48 -0
  54. data/lib/azure/storage/common/service/storage_service_stats.rb +39 -0
  55. data/lib/azure/storage/common/service/user_delegation_key.rb +50 -0
  56. data/lib/azure/storage/common/version.rb +49 -0
  57. metadata +57 -2
@@ -0,0 +1,868 @@
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
+
27
+ require "rbconfig"
28
+ require "azure/storage/common/version"
29
+
30
+ module Azure::Storage::Common
31
+ module Default
32
+ # Default REST service (STG) version number. This is used only for SAS generator.
33
+ STG_VERSION = "2018-11-09"
34
+
35
+ # The number of default concurrent requests for parallel operation.
36
+ DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
37
+
38
+ # Constant representing a kilobyte (Non-SI version).
39
+ KB = 1024
40
+ # Constant representing a megabyte (Non-SI version).
41
+ MB = 1024 * 1024
42
+ # Constant representing a gigabyte (Non-SI version).
43
+ GB = 1024 * 1024 * 1024
44
+
45
+ # Specifies HTTP.
46
+ HTTP = "http"
47
+ # Specifies HTTPS.
48
+ HTTPS = "https"
49
+ # Default HTTP port.
50
+ DEFAULT_HTTP_PORT = 80
51
+ # Default HTTPS port.
52
+ DEFAULT_HTTPS_PORT = 443
53
+
54
+ # Marker for atom metadata.
55
+ XML_METADATA_MARKER = "$"
56
+ # Marker for atom value.
57
+ XML_VALUE_MARKER = "_"
58
+
59
+ def os
60
+ host_os = RbConfig::CONFIG["host_os"]
61
+ case host_os
62
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
63
+ "Windows #{host_os}"
64
+ when /darwin|mac os/
65
+ "MacOS #{host_os}"
66
+ when /linux/
67
+ "Linux #{host_os}"
68
+ when /solaris|bsd/
69
+ "Unix #{host_os}"
70
+ else
71
+ "Unknown #{host_os}"
72
+ end
73
+ end
74
+
75
+ module_function :os
76
+
77
+ class << self
78
+ def options
79
+ Hash[Azure::Storage::Common::Configurable.keys.map { |key| [key, send(key)] }]
80
+ end
81
+
82
+ # Default storage access key
83
+ # @return [String]
84
+ def storage_access_key
85
+ ENV["AZURE_STORAGE_ACCESS_KEY"]
86
+ end
87
+
88
+ # Default storage account name
89
+ # @return [String]
90
+ def storage_account_name
91
+ ENV["AZURE_STORAGE_ACCOUNT"]
92
+ end
93
+
94
+ # Default storage connection string
95
+ # @return [String]
96
+ def storage_connection_string
97
+ ENV["AZURE_STORAGE_CONNECTION_STRING"]
98
+ end
99
+
100
+ # Default storage shared access signature token
101
+ # @return [String]
102
+ def storage_sas_token
103
+ ENV["AZURE_STORAGE_SAS_TOKEN"]
104
+ end
105
+
106
+ # Default storage table host
107
+ # @return [String]
108
+ def storage_table_host
109
+ ENV["AZURE_STORAGE_TABLE_HOST"]
110
+ end
111
+
112
+ # Default storage blob host
113
+ # @return [String]
114
+ def storage_blob_host
115
+ ENV["AZURE_STORAGE_BLOB_HOST"]
116
+ end
117
+
118
+ # Default storage queue host
119
+ # @return [String]
120
+ def storage_queue_host
121
+ ENV["AZURE_STORAGE_QUEUE_HOST"]
122
+ end
123
+
124
+ # Default storage file host
125
+ # @return [String]
126
+ def storage_file_host
127
+ ENV["AZURE_STORAGE_FILE_HOST"]
128
+ end
129
+
130
+ # A placeholder to map with the Azure::Storage::Common::Configurable.keys
131
+ # @return nil
132
+ def signer
133
+ end
134
+ end
135
+ end
136
+
137
+ # Service Types
138
+ module ServiceType
139
+ BLOB = "blob"
140
+ QUEUE = "queue"
141
+ TABLE = "table"
142
+ FILE = "file"
143
+ end
144
+
145
+ # Specifies the location mode used to decide which location the request should be sent to.
146
+ module LocationMode
147
+ PRIMARY_ONLY = 0
148
+ PRIMARY_THEN_SECONDARY = 1
149
+ SECONDARY_ONLY = 2
150
+ SECONDARY_THEN_PRIMARY = 3
151
+ end
152
+
153
+ # Specifies the location used to indicate which location the operation (REST API) can be performed against.
154
+ # This is determined by the API and cannot be specified by the users.
155
+ module RequestLocationMode
156
+ PRIMARY_ONLY = 0
157
+ SECONDARY_ONLY = 1
158
+ PRIMARY_OR_SECONDARY = 2
159
+ end
160
+
161
+ # Represents a storage service location.
162
+ module StorageLocation
163
+ PRIMARY = 0
164
+ SECONDARY = 1
165
+ end
166
+
167
+ # Defines constants for use with shared access policies.
168
+ module AclConstants
169
+ # XML element for an access policy.
170
+ ACCESS_POLICY = "AccessPolicy"
171
+
172
+ # XML element for the end time of an access policy.
173
+ EXPIRY = "Expiry"
174
+
175
+ # XML attribute for IDs.
176
+ ID = "Id"
177
+
178
+ # XML element for the permission of an access policy.
179
+ PERMISSION = "Permission"
180
+
181
+ # XML element for a signed identifier.
182
+ SIGNED_IDENTIFIER_ELEMENT = "SignedIdentifier"
183
+
184
+ # XML element for signed identifiers.
185
+ SIGNED_IDENTIFIERS_ELEMENT = "SignedIdentifiers"
186
+
187
+ # XML element for the start time of an access policy.
188
+ START = "Start"
189
+ end
190
+
191
+ # Defines constants for use with service properties.
192
+ module ServicePropertiesConstants
193
+ # XML element for storage service properties.
194
+ STORAGE_SERVICE_PROPERTIES_ELEMENT = "StorageServiceProperties"
195
+
196
+ # Default analytics version to send for logging, hour metrics and minute metrics.
197
+ DEFAULT_ANALYTICS_VERSION = "1.0"
198
+
199
+ # XML element for logging.
200
+ LOGGING_ELEMENT = "Logging"
201
+
202
+ # XML element for version.
203
+ VERSION_ELEMENT = "Version"
204
+
205
+ # XML element for delete.
206
+ DELETE_ELEMENT = "Delete"
207
+
208
+ # XML element for read.
209
+ READ_ELEMENT = "Read"
210
+
211
+ # XML element for write.
212
+ WRITE_ELEMENT = "Write"
213
+
214
+ # XML element for retention policy.
215
+ RETENTION_POLICY_ELEMENT = "RetentionPolicy"
216
+
217
+ # XML element for enabled.
218
+ ENABLED_ELEMENT = "Enabled"
219
+
220
+ # XML element for days.
221
+ DAYS_ELEMENT = "Days"
222
+
223
+ # XML element for HourMetrics.
224
+ HOUR_METRICS_ELEMENT = "HourMetrics"
225
+
226
+ # XML element for MinuteMetrics.
227
+ MINUTE_METRICS_ELEMENT = "MinuteMetrics"
228
+
229
+ # XML element for Cors.
230
+ CORS_ELEMENT = "Cors"
231
+
232
+ # XML element for CorsRule.
233
+ CORS_RULE_ELEMENT = "CorsRule"
234
+
235
+ # XML element for AllowedOrigins.
236
+ ALLOWED_ORIGINS_ELEMENT = "AllowedOrigins"
237
+
238
+ # XML element for AllowedMethods.
239
+ ALLOWED_METHODS_ELEMENT = "AllowedMethods"
240
+
241
+ # XML element for MaxAgeInSeconds.
242
+ MAX_AGE_IN_SECONDS_ELEMENT = "MaxAgeInSeconds"
243
+
244
+ # XML element for ExposedHeaders.
245
+ EXPOSED_HEADERS_ELEMENT = "ExposedHeaders"
246
+
247
+ # XML element for AllowedHeaders.
248
+ ALLOWED_HEADERS_ELEMENT = "AllowedHeaders"
249
+
250
+ # XML element for IncludeAPIs.
251
+ INCLUDE_APIS_ELEMENT = "IncludeAPIs"
252
+
253
+ # XML element for DefaultServiceVersion.
254
+ DEFAULT_SERVICE_VERSION_ELEMENT = "DefaultServiceVersion"
255
+ end
256
+
257
+ # Defines constants for use with HTTP headers.
258
+ module HeaderConstants
259
+ # The accept ranges header.
260
+ ACCEPT_RANGES = "accept_ranges"
261
+
262
+ # The content transfer encoding header.
263
+ CONTENT_TRANSFER_ENCODING = "content-transfer-encoding"
264
+
265
+ # The transfer encoding header.
266
+ TRANSFER_ENCODING = "transfer-encoding"
267
+
268
+ # The server header.
269
+ SERVER = "server"
270
+
271
+ # The location header.
272
+ LOCATION = "location"
273
+
274
+ # The Last-Modified header
275
+ LAST_MODIFIED = "Last-Modified"
276
+
277
+ # The data service version.
278
+ DATA_SERVICE_VERSION = "DataServiceVersion"
279
+
280
+ # The maximum data service version.
281
+ MAX_DATA_SERVICE_VERSION = "maxdataserviceversion"
282
+
283
+ # The master Windows Azure Storage header prefix.
284
+ PREFIX_FOR_STORAGE = "x-ms-"
285
+
286
+ # The client request Id header.
287
+ CLIENT_REQUEST_ID = "x-ms-client-request-id"
288
+
289
+ # The header that specifies the approximate message count of a queue.
290
+ APPROXIMATE_MESSAGES_COUNT = "x-ms-approximate-messages-count"
291
+
292
+ # The Authorization header.
293
+ AUTHORIZATION = "authorization"
294
+
295
+ # The header that specifies public access to blobs.
296
+ BLOB_PUBLIC_ACCESS = "x-ms-blob-public-access"
297
+
298
+ # The header for the blob type.
299
+ BLOB_TYPE = "x-ms-blob-type"
300
+
301
+ # The header for the type.
302
+ TYPE = "x-ms-type"
303
+
304
+ # Specifies the block blob type.
305
+ BLOCK_BLOB = "blockblob"
306
+
307
+ # The CacheControl header.
308
+ CACHE_CONTROL = "cache-control"
309
+
310
+ # The header that specifies blob caching control.
311
+ BLOB_CACHE_CONTROL = "x-ms-blob-cache-control"
312
+
313
+ # The header that specifies caching control.
314
+ FILE_CACHE_CONTROL = "x-ms-cache-control"
315
+
316
+ # The copy status.
317
+ COPY_STATUS = "x-ms-copy-status"
318
+
319
+ # The copy completion time
320
+ COPY_COMPLETION_TIME = "x-ms-copy-completion-time"
321
+
322
+ # The copy status message
323
+ COPY_STATUS_DESCRIPTION = "x-ms-copy-status-description"
324
+
325
+ # The copy identifier.
326
+ COPY_ID = "x-ms-copy-id"
327
+
328
+ # Progress of any copy operation
329
+ COPY_PROGRESS = "x-ms-copy-progress"
330
+
331
+ # The copy action.
332
+ COPY_ACTION = "x-ms-copy-action"
333
+
334
+ # The ContentID header.
335
+ CONTENT_ID = "content-id"
336
+
337
+ # The ContentEncoding header.
338
+ CONTENT_ENCODING = "content-encoding"
339
+
340
+ # The header that specifies blob content encoding.
341
+ BLOB_CONTENT_ENCODING = "x-ms-blob-content-encoding"
342
+
343
+ # The header that specifies content encoding.
344
+ FILE_CONTENT_ENCODING = "x-ms-content-encoding"
345
+
346
+ # The ContentLangauge header.
347
+ CONTENT_LANGUAGE = "content-language"
348
+
349
+ # The header that specifies blob content language.
350
+ BLOB_CONTENT_LANGUAGE = "x-ms-blob-content-language"
351
+
352
+ # The header that specifies content language.
353
+ FILE_CONTENT_LANGUAGE = "x-ms-content-language"
354
+
355
+ # The ContentLength header.
356
+ CONTENT_LENGTH = "content-length"
357
+
358
+ # The header that specifies blob content length.
359
+ BLOB_CONTENT_LENGTH = "x-ms-blob-content-length"
360
+
361
+ # The header that specifies content length.
362
+ FILE_CONTENT_LENGTH = "x-ms-content-length"
363
+
364
+ # The ContentDisposition header.
365
+ CONTENT_DISPOSITION = "content-disposition"
366
+
367
+ # The header that specifies blob content disposition.
368
+ BLOB_CONTENT_DISPOSITION = "x-ms-blob-content-disposition"
369
+
370
+ # The header that specifies content disposition.
371
+ FILE_CONTENT_DISPOSITION = "x-ms-content-disposition"
372
+
373
+ # The ContentMD5 header.
374
+ CONTENT_MD5 = "content-md5"
375
+
376
+ # The header that specifies blob content MD5.
377
+ BLOB_CONTENT_MD5 = "x-ms-blob-content-md5"
378
+
379
+ # The header that specifies content MD5.
380
+ FILE_CONTENT_MD5 = "x-ms-content-md5"
381
+
382
+ # The ContentRange header.
383
+ CONTENT_RANGE = "cache-range"
384
+
385
+ # The ContentType header.
386
+ CONTENT_TYPE = "Content-Type"
387
+
388
+ # The header that specifies blob content type.
389
+ BLOB_CONTENT_TYPE = "x-ms-blob-content-type"
390
+
391
+ # The header that specifies content type.
392
+ FILE_CONTENT_TYPE = "x-ms-content-type"
393
+
394
+ # The header for copy source.
395
+ COPY_SOURCE = "x-ms-copy-source"
396
+
397
+ # The header that specifies the date.
398
+ DATE = "date"
399
+
400
+ # The header that specifies the date.
401
+ MS_DATE = "x-ms-date"
402
+
403
+ # The header to delete snapshots.
404
+ DELETE_SNAPSHOT = "x-ms-delete-snapshots"
405
+
406
+ # The ETag header.
407
+ ETAG = "etag"
408
+
409
+ # The IfMatch header.
410
+ IF_MATCH = "if-match"
411
+
412
+ # The IfModifiedSince header.
413
+ IF_MODIFIED_SINCE = "if-modified-since"
414
+
415
+ # The IfNoneMatch header.
416
+ IF_NONE_MATCH = "if-none-match"
417
+
418
+ # The IfUnmodifiedSince header.
419
+ IF_UNMODIFIED_SINCE = "if-unmodified-since"
420
+
421
+ # Specifies snapshots are to be included.
422
+ INCLUDE_SNAPSHOTS_VALUE = "include"
423
+
424
+ # Specifies that the content-type is JSON.
425
+ JSON_CONTENT_TYPE_VALUE = "application/json"
426
+
427
+ # The header that specifies lease ID.
428
+ LEASE_ID = "x-ms-lease-id"
429
+
430
+ # The header that specifies the lease break period.
431
+ LEASE_BREAK_PERIOD = "x-ms-lease-break-period"
432
+
433
+ # The header that specifies the proposed lease identifier.
434
+ PROPOSED_LEASE_ID = "x-ms-proposed-lease-id"
435
+
436
+ # The header that specifies the lease duration.
437
+ LEASE_DURATION = "x-ms-lease-duration"
438
+
439
+ # The header that specifies the source lease ID.
440
+ SOURCE_LEASE_ID = "x-ms-source-lease-id"
441
+
442
+ # The header that specifies lease time.
443
+ LEASE_TIME = "x-ms-lease-time"
444
+
445
+ # The header that specifies lease status.
446
+ LEASE_STATUS = "x-ms-lease-status"
447
+
448
+ # The header that specifies lease state.
449
+ LEASE_STATE = "x-ms-lease-state"
450
+
451
+ # Specifies the page blob type.
452
+ PAGE_BLOB = "PageBlob"
453
+
454
+ # The header that specifies page write mode.
455
+ PAGE_WRITE = "x-ms-page-write"
456
+
457
+ # The header that specifies file range write mode.
458
+ FILE_WRITE = "x-ms-write"
459
+
460
+ # The header that specifies whether the response should include the inserted entity.
461
+ PREFER = "Prefer"
462
+
463
+ # The header value which specifies that the response should include the inserted entity.
464
+ PREFER_CONTENT = "return-content"
465
+
466
+ # The header value which specifies that the response should not include the inserted entity.
467
+ PREFER_NO_CONTENT = "return-no-content"
468
+
469
+ # The header prefix for metadata.
470
+ PREFIX_FOR_STORAGE_METADATA = "x-ms-meta-"
471
+
472
+ # The header prefix for properties.
473
+ PREFIX_FOR_STORAGE_PROPERTIES = "x-ms-prop-"
474
+
475
+ # The Range header.
476
+ RANGE = "Range"
477
+
478
+ # The header that specifies if the request will populate the ContentMD5 header for range gets.
479
+ RANGE_GET_CONTENT_MD5 = "x-ms-range-get-content-md5"
480
+
481
+ # The format string for specifying ranges.
482
+ RANGE_HEADER_FORMAT = "bytes:%d-%d"
483
+
484
+ # The header that indicates the request ID.
485
+ REQUEST_ID = "x-ms-request-id"
486
+
487
+ # The header for specifying the sequence number.
488
+ SEQUENCE_NUMBER = "x-ms-blob-sequence-number"
489
+
490
+ # The header for specifying the If-Sequence-Number-EQ condition.
491
+ SEQUENCE_NUMBER_EQUAL = "x-ms-if-sequence-number-eq"
492
+
493
+ # The header for specifying the If-Sequence-Number-LT condition.
494
+ SEQUENCE_NUMBER_LESS_THAN = "x-ms-if-sequence-number-lt"
495
+
496
+ # The header for specifying the If-Sequence-Number-LE condition.
497
+ SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL = "x-ms-if-sequence-number-le"
498
+
499
+ # The header that specifies sequence number action.
500
+ SEQUENCE_NUMBER_ACTION = "x-ms-sequence-number-action"
501
+
502
+ # The header for the blob content length.
503
+ SIZE = "x-ms-blob-content-length"
504
+
505
+ # The header for snapshots.
506
+ SNAPSHOT = "x-ms-snapshot"
507
+
508
+ # Specifies only snapshots are to be included.
509
+ SNAPSHOTS_ONLY_VALUE = "only"
510
+
511
+ # The header for the If-Match condition.
512
+ SOURCE_IF_MATCH = "x-ms-source-if-match"
513
+
514
+ # The header for the If-Modified-Since condition.
515
+ SOURCE_IF_MODIFIED_SINCE = "x-ms-source-if-modified-since"
516
+
517
+ # The header for the If-None-Match condition.
518
+ SOURCE_IF_NONE_MATCH = "x-ms-source-if-none-match"
519
+
520
+ # The header for the If-Unmodified-Since condition.
521
+ SOURCE_IF_UNMODIFIED_SINCE = "x-ms-source-if-unmodified-since"
522
+
523
+ # The header for data ranges.
524
+ STORAGE_RANGE = "x-ms-range"
525
+
526
+ # The header for storage version.
527
+ STORAGE_VERSION = "x-ms-version"
528
+
529
+ # The UserAgent header.
530
+ USER_AGENT = "user-agent"
531
+
532
+ # The pop receipt header.
533
+ POP_RECEIPT = "x-ms-popreceipt"
534
+
535
+ # The time next visibile header.
536
+ TIME_NEXT_VISIBLE = "x-ms-time-next-visible"
537
+
538
+ # The approximate message counter header.
539
+ APPROXIMATE_MESSAGE_COUNT = "x-ms-approximate-message-count"
540
+
541
+ # The lease action header.
542
+ LEASE_ACTION = "x-ms-lease-action"
543
+
544
+ # The accept header.
545
+ ACCEPT = "Accept"
546
+
547
+ # The accept charset header.
548
+ ACCEPT_CHARSET = "Accept-Charset"
549
+
550
+ # The host header.
551
+ HOST = "host"
552
+
553
+ # The correlation identifier header.
554
+ CORRELATION_ID = "x-ms-correlation-id"
555
+
556
+ # The group identifier header.
557
+ GROUP_ID = "x-ms-group-id"
558
+
559
+ # The share quota header.
560
+ SHARE_QUOTA = "x-ms-share-quota"
561
+
562
+ # The max blob size header.
563
+ BLOB_CONDITION_MAX_SIZE = "x-ms-blob-condition-maxsize"
564
+
565
+ # The append blob position header.
566
+ BLOB_CONDITION_APPEND_POSITION = "x-ms-blob-condition-appendpos"
567
+
568
+ # The append blob append offset header.
569
+ BLOB_APPEND_OFFSET = "x-ms-blob-append-offset"
570
+
571
+ # The append blob committed block header.
572
+ BLOB_COMMITTED_BLOCK_COUNT = "x-ms-blob-committed-block-count"
573
+
574
+ # The returned response payload should be with no metadata.
575
+ ODATA_NO_META = "application/json;odata=nometadata"
576
+
577
+ # The returned response payload should be with minimal metadata.
578
+ ODATA_MIN_META = "application/json;odata=minimalmetadata"
579
+
580
+ # The returned response payload should be with full metadata.
581
+ ODATA_FULL_META = "application/json;odata=fullmetadata"
582
+
583
+ # The header for if request has been encrypted at server side.
584
+ REQUEST_SERVER_ENCRYPTED = "x-ms-request-server-encrypted"
585
+
586
+ # The header for if blob data and application metadata has been encrypted at server side.
587
+ SERVER_ENCRYPTED = "x-ms-server-encrypted"
588
+ end
589
+
590
+ module QueryStringConstants
591
+ # Query component for SAS API version.
592
+ API_VERSION = "api-version"
593
+
594
+ # The Comp value.
595
+ COMP = "comp"
596
+
597
+ # The Res Type.
598
+ RESTYPE = "restype"
599
+
600
+ # The copy Id.
601
+ COPY_ID = "copyid"
602
+
603
+ # The Snapshot value.
604
+ SNAPSHOT = "snapshot"
605
+
606
+ # The timeout value.
607
+ TIMEOUT = "timeout"
608
+
609
+ # The signed start time query string argument for shared access signature.
610
+ SIGNED_START = "st"
611
+
612
+ # The signed expiry time query string argument for shared access signature.
613
+ SIGNED_EXPIRY = "se"
614
+
615
+ # The signed resource query string argument for shared access signature.
616
+ SIGNED_RESOURCE = "sr"
617
+
618
+ # The signed permissions query string argument for shared access signature.
619
+ SIGNED_PERMISSIONS = "sp"
620
+
621
+ # The signed identifier query string argument for shared access signature.
622
+ SIGNED_IDENTIFIER = "si"
623
+
624
+ # The signature query string argument for shared access signature.
625
+ SIGNATURE = "sig"
626
+
627
+ # The signed version argument for shared access signature.
628
+ SIGNED_VERSION = "sv"
629
+
630
+ # The cache control argument for shared access signature.
631
+ CACHE_CONTROL = "rscc"
632
+
633
+ # The content type argument for shared access signature.
634
+ CONTENT_TYPE = "rsct"
635
+
636
+ # The content encoding argument for shared access signature.
637
+ CONTENT_ENCODING = "rsce"
638
+
639
+ # The content language argument for shared access signature.
640
+ CONTENT_LANGUAGE = "rscl"
641
+
642
+ # The content disposition argument for shared access signature.
643
+ CONTENT_DISPOSITION = "rscd"
644
+
645
+ # The block identifier query string argument for blob service.
646
+ BLOCK_ID = "blockid"
647
+
648
+ # The block list type query string argument for blob service.
649
+ BLOCK_LIST_TYPE = "blocklisttype"
650
+
651
+ # The prefix query string argument for listing operations.
652
+ PREFIX = "prefix"
653
+
654
+ # The marker query string argument for listing operations.
655
+ MARKER = "marker"
656
+
657
+ # The maxresults query string argument for listing operations.
658
+ MAX_RESULTS = "maxresults"
659
+
660
+ # The delimiter query string argument for listing operations.
661
+ DELIMITER = "delimiter"
662
+
663
+ # The include query string argument for listing operations.
664
+ INCLUDE = "include"
665
+
666
+ # The peekonly query string argument for queue service.
667
+ PEEK_ONLY = "peekonly"
668
+
669
+ # The numofmessages query string argument for queue service.
670
+ NUM_OF_MESSAGES = "numofmessages"
671
+
672
+ # The popreceipt query string argument for queue service.
673
+ POP_RECEIPT = "popreceipt"
674
+
675
+ # The visibilitytimeout query string argument for queue service.
676
+ VISIBILITY_TIMEOUT = "visibilitytimeout"
677
+
678
+ # The messagettl query string argument for queue service.
679
+ MESSAGE_TTL = "messagettl"
680
+
681
+ # The select query string argument.
682
+ SELECT = "$select"
683
+
684
+ # The filter query string argument.
685
+ FILTER = "$filter"
686
+
687
+ # The top query string argument.
688
+ TOP = "$top"
689
+
690
+ # The skip query string argument.
691
+ SKIP = "$skip"
692
+
693
+ # The next partition key query string argument for table service.
694
+ NEXT_PARTITION_KEY = "NextPartitionKey"
695
+
696
+ # The next row key query string argument for table service.
697
+ NEXT_ROW_KEY = "NextRowKey"
698
+
699
+ # The lock identifier for service bus messages.
700
+ LOCK_ID = "lockid"
701
+
702
+ # The table name for table SAS URI's.
703
+ TABLENAME = "tn"
704
+
705
+ # The starting Partition Key for tableSAS URI's.
706
+ STARTPK = "spk"
707
+
708
+ # The starting Partition Key for tableSAS URI's.
709
+ STARTRK = "srk"
710
+
711
+ # The ending Partition Key for tableSAS URI's.
712
+ ENDPK = "epk"
713
+
714
+ # The ending Partition Key for tableSAS URI's.
715
+ ENDRK = "erk"
716
+
717
+ # ACL
718
+ ACL = "acl"
719
+
720
+ # Incremental Copy
721
+ INCREMENTAL_COPY = "incrementalcopy"
722
+ end
723
+
724
+ module StorageServiceClientConstants
725
+ # The default protocol.
726
+ DEFAULT_PROTOCOL = "https"
727
+
728
+ # Default credentials.
729
+ DEVSTORE_STORAGE_ACCOUNT = "devstoreaccount1"
730
+ DEVSTORE_STORAGE_ACCESS_KEY = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
731
+
732
+ # The development store URI.
733
+ DEV_STORE_URI = "http://127.0.0.1"
734
+
735
+ # Development ServiceClient URLs.
736
+ DEVSTORE_BLOB_HOST_PORT = "10000"
737
+ DEVSTORE_QUEUE_HOST_PORT = "10001"
738
+ DEVSTORE_TABLE_HOST_PORT = "10002"
739
+ DEVSTORE_FILE_HOST_PORT = "10003"
740
+
741
+ DEFAULT_ENDPOINT_SUFFIX = "core.windows.net"
742
+ end
743
+
744
+ module HttpConstants
745
+ # Http Verbs
746
+ module HttpVerbs
747
+ PUT = "PUT"
748
+ GET = "GET"
749
+ DELETE = "DELETE"
750
+ POST = "POST"
751
+ MERGE = "MERGE"
752
+ HEAD = "HEAD"
753
+ end
754
+
755
+ # Response codes.
756
+ module HttpResponseCodes
757
+ Ok = 200
758
+ Created = 201
759
+ Accepted = 202
760
+ NoContent = 204
761
+ PartialContent = 206
762
+ BadRequest = 400
763
+ Unauthorized = 401
764
+ Forbidden = 403
765
+ NotFound = 404
766
+ Conflict = 409
767
+ LengthRequired = 411
768
+ PreconditionFailed = 412
769
+ end
770
+ end
771
+
772
+ # Constants for storage error strings
773
+ # More details are at = http://msdn.microsoft.com/en-us/library/azure/dd179357.aspx
774
+ module StorageErrorCodeStrings
775
+ # Not Modified (304) = The condition specified in the conditional header(s) was not met for a read operation.
776
+ # Precondition Failed (412) = The condition specified in the conditional header(s) was not met for a write operation.
777
+ CONDITION_NOT_MET = "ConditionNotMet"
778
+ # Bad Request (400) = A required HTTP header was not specified.
779
+ MISSING_REQUIRED_HEADER = "MissingRequiredHeader"
780
+ # Bad Request (400) = A required XML node was not specified in the request body.
781
+ MISSING_REQUIRED_XML_NODE = "MissingRequiredXmlNode"
782
+ # Bad Request (400) = One of the HTTP headers specified in the request is not supported.
783
+ UNSUPPORTED_HEADER = "UnsupportedHeader"
784
+ # Bad Request (400) = One of the XML nodes specified in the request body is not supported.
785
+ UNSUPPORTED_XML_NODE = "UnsupportedXmlNode"
786
+ # Bad Request (400) = The value provided for one of the HTTP headers was not in the correct format.
787
+ INVALID_HEADER_VALUE = "InvalidHeaderValue"
788
+ # Bad Request (400) = The value provided for one of the XML nodes in the request body was not in the correct format.
789
+ INVALID_XML_NODE_VALUE = "InvalidXmlNodeValue"
790
+ # Bad Request (400) = A required query parameter was not specified for this request.
791
+ MISSING_REQUIRED_QUERY_PARAMETER = "MissingRequiredQueryParameter"
792
+ # Bad Request (400) = One of the query parameters specified in the request URI is not supported.
793
+ UNSUPPORTED_QUERY_PARAMETER = "UnsupportedQueryParameter"
794
+ # Bad Request (400) = An invalid value was specified for one of the query parameters in the request URI.
795
+ INVALID_QUERY_PARAMETER_VALUE = "InvalidQueryParameterValue"
796
+ # Bad Request (400) = A query parameter specified in the request URI is outside the permissible range.
797
+ OUT_OF_RANGE_QUERY_PARAMETER_VALUE = "OutOfRangeQueryParameterValue"
798
+ # Bad Request (400) = The url in the request could not be parsed.
799
+ REQUEST_URL_FAILED_TO_PARSE = "RequestUrlFailedToParse"
800
+ # Bad Request (400) = The requested URI does not represent any resource on the server.
801
+ INVALID_URI = "InvalidUri"
802
+ # Bad Request (400) = The HTTP verb specified was not recognized by the server.
803
+ INVALID_HTTP_VERB = "InvalidHttpVerb"
804
+ # Bad Request (400) = The key for one of the metadata key-value pairs is empty.
805
+ EMPTY_METADATA_KEY = "EmptyMetadataKey"
806
+ # Bad Request (400) = The specified XML is not syntactically valid.
807
+ INVALID_XML_DOCUMENT = "InvalidXmlDocument"
808
+ # Bad Request (400) = The MD5 value specified in the request did not match the MD5 value calculated by the server.
809
+ MD5_MISMATCH = "Md5Mismatch"
810
+ # Bad Request (400) = The MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded.
811
+ INVALID_MD5 = "InvalidMd5"
812
+ # Bad Request (400) = One of the request inputs is out of range.
813
+ OUT_OF_RANGE_INPUT = "OutOfRangeInput"
814
+ # Bad Request (400) = The authentication information was not provided in the correct format. Verify the value of Authorization header.
815
+ INVALID_AUTHENTICATION_INFO = "InvalidAuthenticationInfo"
816
+ # Bad Request (400) = One of the request inputs is not valid.
817
+ INVALID_INPUT = "InvalidInput"
818
+ # Bad Request (400) = The specified metadata is invalid. It includes characters that are not permitted.
819
+ INVALID_METADATA = "InvalidMetadata"
820
+ # Bad Request (400) = The specifed resource name contains invalid characters.
821
+ INVALID_RESOURCE_NAME = "InvalidResourceName"
822
+ # Bad Request (400) = The size of the specified metadata exceeds the maximum size permitted.
823
+ METADATA_TOO_LARGE = "MetadataTooLarge"
824
+ # Bad Request (400) = Condition headers are not supported.
825
+ CONDITION_HEADER_NOT_SUPPORTED = "ConditionHeadersNotSupported"
826
+ # Bad Request (400) = Multiple condition headers are not supported.
827
+ MULTIPLE_CONDITION_HEADER_NOT_SUPPORTED = "MultipleConditionHeadersNotSupported"
828
+ # Forbidden (403) = Server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature.
829
+ AUTHENTICATION_FAILED = "AuthenticationFailed"
830
+ # Forbidden (403) = Read-access geo-redundant replication is not enabled for the account.
831
+ # Forbidden (403) = Write operations to the secondary location are not allowed.
832
+ # Forbidden (403) = The account being accessed does not have sufficient permissions to execute this operation.
833
+ INSUFFICIENT_ACCOUNT_PERMISSIONS = "InsufficientAccountPermissions"
834
+ # Not Found (404) = The specified resource does not exist.
835
+ RESOURCE_NOT_FOUND = "ResourceNotFound"
836
+ # Forbidden (403) = The specified account is disabled.
837
+ ACCOUNT_IS_DISABLED = "AccountIsDisabled"
838
+ # Method Not Allowed (405) = The resource doesn't support the specified HTTP verb.
839
+ UNSUPPORTED_HTTP_VERB = "UnsupportedHttpVerb"
840
+ # Conflict (409) = The specified account already exists.
841
+ ACCOUNT_ALREADY_EXISTS = "AccountAlreadyExists"
842
+ # Conflict (409) = The specified account is in the process of being created.
843
+ ACCOUNT_BEING_CREATED = "AccountBeingCreated"
844
+ # Conflict (409) = The specified resource already exists.
845
+ RESOURCE_ALREADY_EXISTS = "ResourceAlreadyExists"
846
+ # Conflict (409) = The specified resource type does not match the type of the existing resource.
847
+ RESOURCE_TYPE_MISMATCH = "ResourceTypeMismatch"
848
+ # Length Required (411) = The Content-Length header was not specified.
849
+ MISSING_CONTENT_LENGTH_HEADER = "MissingContentLengthHeader"
850
+ # Request Entity Too Large (413) = The size of the request body exceeds the maximum size permitted.
851
+ REQUEST_BODY_TOO_LARGE = "RequestBodyTooLarge"
852
+ # Requested Range Not Satisfiable (416) = The range specified is invalid for the current size of the resource.
853
+ INVALID_RANGE = "InvalidRange"
854
+ # Internal Server Error (500) = The server encountered an internal error. Please retry the request.
855
+ INTERNAL_ERROR = "InternalError"
856
+ # Internal Server Error (500) = The operation could not be completed within the permitted time.
857
+ OPERATION_TIMED_OUT = "OperationTimedOut"
858
+ # Service Unavailable (503) = The server is currently unable to receive requests. Please retry your request.
859
+ SERVER_BUSY = "ServerBusy"
860
+
861
+ # Legacy error code strings
862
+ UPDATE_CONDITION_NOT_SATISFIED = "UpdateConditionNotSatisfied"
863
+ CONTAINER_NOT_FOUND = "ContainerNotFound"
864
+ CONTAINER_ALREADY_EXISTS = "ContainerAlreadyExists"
865
+ CONTAINER_DISABLED = "ContainerDisabled"
866
+ CONTAINER_BEING_DELETED = "ContainerBeingDeleted"
867
+ end
868
+ end