Skip to content

Commit a7ca950

Browse files
authored
Merge pull request #338 from zezha-msft/wastore_master_0.36.0
Wastore master to Azure master 0.36.0
2 parents 2674a2c + 97bca1a commit a7ca950

File tree

639 files changed

+25930
-22385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

639 files changed

+25930
-22385
lines changed

ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
> See [BreakingChanges](BreakingChanges.md) for a detailed list of API breaks.
44
5+
## Version 0.36.0:
6+
7+
### Blob:
8+
- For Standard Storage Accounts only, added support for getting and setting the tier on an individual block blob.
9+
10+
### Table:
11+
- Fixed bug where inserting entity with an empty sting as RowKey or PartitionKey raised error.
12+
513
## Version 0.35.1:
614

715
### Blob:

azure/storage/_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import platform
1616

1717
__author__ = 'Microsoft Corp. <[email protected]>'
18-
__version__ = '0.35.1'
18+
__version__ = '0.36.0'
1919

2020
# x-ms-version for storage service.
2121
X_MS_VERSION = '2017-04-17'

azure/storage/_deserialization.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ def _get_download_size(start_range, end_range, resource_size):
5858
'content-range': (None, 'content_range', _to_str),
5959
'x-ms-blob-sequence-number': (None, 'page_blob_sequence_number', _int_to_str),
6060
'x-ms-blob-committed-block-count': (None, 'append_blob_committed_block_count', _int_to_str),
61-
'x-ms-access-tier': (None, 'blob_tier', _to_upper_str),
61+
'x-ms-access-tier': (None, 'blob_tier', _to_str),
6262
'x-ms-access-tier-inferred': (None, 'blob_tier_inferred', _bool),
63+
'x-ms-archive-status': (None, 'rehydration_status', _to_str),
6364
'x-ms-share-quota': (None, 'quota', _int_to_str),
6465
'x-ms-server-encrypted': (None, 'server_encrypted', _bool),
6566
'content-type': ('content_settings', 'content_type', _to_str),
@@ -114,6 +115,8 @@ def _parse_properties(response, result_class):
114115
attr = getattr(props, info[0])
115116
setattr(attr, info[1], info[2](value))
116117

118+
if hasattr(props, 'blob_type') and props.blob_type == 'PageBlob' and hasattr(props, 'blob_tier') and props.blob_tier is not None:
119+
props.blob_tier = _to_upper_str(props.blob_tier)
117120
return props
118121

119122
def _parse_length_from_content_range(content_range):

azure/storage/blob/_deserialization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ def _convert_xml_to_containers(response):
233233
'CopyProgress': ('copy', 'progress', _to_str),
234234
'CopyCompletionTime': ('copy', 'completion_time', _to_str),
235235
'CopyStatusDescription': ('copy', 'status_description', _to_str),
236-
'AccessTier': (None, 'blob_tier', _to_str)
236+
'AccessTier': (None, 'blob_tier', _to_str),
237+
'ArchiveStatus': (None, 'rehydration_status', _to_str)
237238
}
238239

239240
def _convert_xml_to_blob_list(response):
@@ -268,7 +269,7 @@ def _convert_xml_to_blob_list(response):
268269
<CopyProgress>bytes copied/bytes total</CopyProgress>
269270
<CopyCompletionTime>datetime</CopyCompletionTime>
270271
<CopyStatusDescription>error string</CopyStatusDescription>
271-
<AccessTier>P4 | P6 | P10 | P20 | P30 | P40 | P50 | P60</AccessTier>
272+
<AccessTier>P4 | P6 | P10 | P20 | P30 | P40 | P50 | P60 | Archive | Cool | Hot</AccessTier>
272273
</Properties>
273274
<Metadata>
274275
<Name>value</Name>
@@ -315,7 +316,6 @@ def _convert_xml_to_blob_list(response):
315316
attr = getattr(blob.properties, info[0])
316317
setattr(attr, info[1], info[2](property_element.text))
317318

318-
319319
# Metadata
320320
metadata_root_element = blob_element.find('Metadata')
321321
if metadata_root_element is not None:

azure/storage/blob/baseblobservice.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ def generate_account_shared_access_signature(self, resource_types, permission,
277277
been specified in an associated stored access policy. Azure will always
278278
convert values to UTC. If a date is passed in without timezone info, it
279279
is assumed to be UTC.
280-
:type expiry: date or str
280+
:type expiry: datetime.datetime or str
281281
:param start:
282282
The time at which the shared access signature becomes valid. If
283283
omitted, start time for this call is assumed to be the time when the
284284
storage service receives the request. Azure will always convert values
285285
to UTC. If a date is passed in without timezone info, it is assumed to
286286
be UTC.
287-
:type start: date or str
287+
:type start: datetime.datetime or str
288288
:param str ip:
289289
Specifies an IP address or a range of IP addresses from which to accept requests.
290290
If the IP address from which the request originates does not match the IP address
@@ -330,14 +330,14 @@ def generate_container_shared_access_signature(self, container_name,
330330
been specified in an associated stored access policy. Azure will always
331331
convert values to UTC. If a date is passed in without timezone info, it
332332
is assumed to be UTC.
333-
:type expiry: date or str
333+
:type expiry: datetime.datetime or str
334334
:param start:
335335
The time at which the shared access signature becomes valid. If
336336
omitted, start time for this call is assumed to be the time when the
337337
storage service receives the request. Azure will always convert values
338338
to UTC. If a date is passed in without timezone info, it is assumed to
339339
be UTC.
340-
:type start: date or str
340+
:type start: datetime.datetime or str
341341
:param str id:
342342
A unique value up to 64 characters in length that correlates to a
343343
stored access policy. To create a stored access policy, use
@@ -417,14 +417,14 @@ def generate_blob_shared_access_signature(
417417
been specified in an associated stored access policy. Azure will always
418418
convert values to UTC. If a date is passed in without timezone info, it
419419
is assumed to be UTC.
420-
:type expiry: date or str
420+
:type expiry: datetime.datetime or str
421421
:param start:
422422
The time at which the shared access signature becomes valid. If
423423
omitted, start time for this call is assumed to be the time when the
424424
storage service receives the request. Azure will always convert values
425425
to UTC. If a date is passed in without timezone info, it is assumed to
426426
be UTC.
427-
:type start: date or str
427+
:type start: datetime.datetime or str
428428
:param str id:
429429
A unique value up to 64 characters in length that correlates to a
430430
stored access policy. To create a stored access policy, use :func:`~set_container_acl`.

azure/storage/blob/blockblobservice.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,41 @@ def create_blob_from_text(
790790
if_none_match=if_none_match,
791791
timeout=timeout)
792792

793+
def set_standard_blob_tier(
794+
self, container_name, blob_name, standard_blob_tier, timeout=None):
795+
'''
796+
Sets the block blob tiers on the blob. This API is only supported for block blobs on standard storage accounts.
797+
798+
:param str container_name:
799+
Name of existing container.
800+
:param str blob_name:
801+
Name of blob to update.
802+
:param StandardBlobTier standard_blob_tier:
803+
A standard blob tier value to set the blob to. For this version of the library,
804+
this is only applicable to block blobs on standard storage accounts.
805+
:param int timeout:
806+
The timeout parameter is expressed in seconds. This method may make
807+
multiple calls to the Azure service and the timeout will apply to
808+
each call individually.
809+
'''
810+
_validate_not_none('container_name', container_name)
811+
_validate_not_none('blob_name', blob_name)
812+
_validate_not_none('standard_blob_tier', standard_blob_tier)
813+
814+
request = HTTPRequest()
815+
request.method = 'PUT'
816+
request.host_locations = self._get_host_locations()
817+
request.path = _get_path(container_name, blob_name)
818+
request.query = {
819+
'comp': 'tier',
820+
'timeout': _int_to_str(timeout),
821+
}
822+
request.headers = {
823+
'x-ms-access-tier': _to_str(standard_blob_tier)
824+
}
825+
826+
self._perform_request(request)
827+
793828
#-----Helper methods------------------------------------
794829
def _put_blob(self, container_name, blob_name, blob, content_settings=None,
795830
metadata=None, validate_content=False, lease_id=None, if_modified_since=None,

azure/storage/blob/models.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ class LeaseProperties(object):
239239
240240
:ivar str status:
241241
The lease status of the blob.
242+
Possible values: locked|unlocked
242243
:ivar str state:
243244
Lease state of the blob.
244-
Possible values: pending|success|aborted|failed
245+
Possible values: available|leased|expired|breaking|broken
245246
:ivar str duration:
246247
When a blob is leased, specifies whether the lease is of infinite or fixed duration.
247248
'''
@@ -713,4 +714,18 @@ class PremiumPageBlobTier(object):
713714
''' P50 Tier '''
714715

715716
P60 = 'P60'
716-
''' P60 Tier '''
717+
''' P60 Tier '''
718+
719+
class StandardBlobTier(object):
720+
'''
721+
Specifies the blob tier to set the blob to. This is only applicable for block blobs on standard storage accounts.
722+
'''
723+
724+
Archive = 'Archive'
725+
''' Archive '''
726+
727+
Cool = 'Cool'
728+
''' Cool '''
729+
730+
Hot = 'Hot'
731+
''' Hot '''

azure/storage/blob/pageblobservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ def set_premium_page_blob_tier(
11351135
Name of existing container.
11361136
:param str blob_name:
11371137
Name of blob to update.
1138-
:param premium_page_blob_tier:
1138+
:param PremiumPageBlobTier premium_page_blob_tier:
11391139
A page blob tier value to set the blob to. The tier correlates to the size of the
11401140
blob and number of allowed IOPS. This is only applicable to page blobs on
11411141
premium storage accounts.

azure/storage/cloudstorageaccount.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ def generate_shared_access_signature(self, services, resource_types,
162162
been specified in an associated stored access policy. Azure will always
163163
convert values to UTC. If a date is passed in without timezone info, it
164164
is assumed to be UTC.
165-
:type expiry: date or str
165+
:type expiry: datetime.datetime or str
166166
:param start:
167167
The time at which the shared access signature becomes valid. If
168168
omitted, start time for this call is assumed to be the time when the
169169
storage service receives the request. Azure will always convert values
170170
to UTC. If a date is passed in without timezone info, it is assumed to
171171
be UTC.
172-
:type start: date or str
172+
:type start: datetime.datetime or str
173173
:param str ip:
174174
Specifies an IP address or a range of IP addresses from which to accept requests.
175175
If the IP address from which the request originates does not match the IP address

azure/storage/file/fileservice.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,14 @@ def generate_account_shared_access_signature(self, resource_types, permission,
242242
been specified in an associated stored access policy. Azure will always
243243
convert values to UTC. If a date is passed in without timezone info, it
244244
is assumed to be UTC.
245-
:type expiry: date or str
245+
:type expiry: datetime.datetime or str
246246
:param start:
247247
The time at which the shared access signature becomes valid. If
248248
omitted, start time for this call is assumed to be the time when the
249249
storage service receives the request. Azure will always convert values
250250
to UTC. If a date is passed in without timezone info, it is assumed to
251251
be UTC.
252-
:type start: date or str
252+
:type start: datetime.datetime or str
253253
:param str ip:
254254
Specifies an IP address or a range of IP addresses from which to accept requests.
255255
If the IP address from which the request originates does not match the IP address
@@ -302,14 +302,14 @@ def generate_share_shared_access_signature(self, share_name,
302302
been specified in an associated stored access policy. Azure will always
303303
convert values to UTC. If a date is passed in without timezone info, it
304304
is assumed to be UTC.
305-
:type expiry: date or str
305+
:type expiry: datetime.datetime or str
306306
:param start:
307307
The time at which the shared access signature becomes valid. If
308308
omitted, start time for this call is assumed to be the time when the
309309
storage service receives the request. Azure will always convert values
310310
to UTC. If a date is passed in without timezone info, it is assumed to
311311
be UTC.
312-
:type start: date or str
312+
:type start: datetime.datetime or str
313313
:param str id:
314314
A unique value up to 64 characters in length that correlates to a
315315
stored access policy. To create a stored access policy, use :func:`~set_share_acl`.
@@ -400,14 +400,14 @@ def generate_file_shared_access_signature(self, share_name,
400400
been specified in an associated stored access policy. Azure will always
401401
convert values to UTC. If a date is passed in without timezone info, it
402402
is assumed to be UTC.
403-
:type expiry: date or str
403+
:type expiry: datetime.datetime or str
404404
:param start:
405405
The time at which the shared access signature becomes valid. If
406406
omitted, start time for this call is assumed to be the time when the
407407
storage service receives the request. Azure will always convert values
408408
to UTC. If a date is passed in without timezone info, it is assumed to
409409
be UTC.
410-
:type start: date or str
410+
:type start: datetime.datetime or str
411411
:param str id:
412412
A unique value up to 64 characters in length that correlates to a
413413
stored access policy. To create a stored access policy, use

0 commit comments

Comments
 (0)