@@ -3407,7 +3407,7 @@ def undelete_blob(self, container_name, blob_name, timeout=None):
34073407
34083408 # ----------------------------Methods related to directory manipulations---------------------------- #
34093409
3410- def create_directory (self , container_name , directory_path , proposed_lease_id = None , lease_id = None , metadata = None ,
3410+ def create_directory (self , container_name , directory_path , lease_id = None , metadata = None ,
34113411 posix_permissions = None , posix_umask = None , timeout = None ):
34123412 """
34133413 Create a directory which can contain other directories or blobs.
@@ -3416,10 +3416,7 @@ def create_directory(self, container_name, directory_path, proposed_lease_id=Non
34163416 Name of existing container.
34173417 :param str directory_path:
34183418 Path of the directory to be created. Ex: 'dirfoo/dirbar'.
3419- :param str proposed_lease_id:
3420- Proposed lease ID, in a GUID string format. The Blob service
3421- returns 400 (Invalid request) if the proposed lease ID is not
3422- in the correct format.
3419+ The service will create parent directories if they do not exist yet.
34233420 :param str lease_id:
34243421 Required if the directory to be overwritten has an active lease.
34253422 :param metadata:
@@ -3459,16 +3456,15 @@ def create_directory(self, container_name, directory_path, proposed_lease_id=Non
34593456 'timeout' : _int_to_str (timeout ),
34603457 }
34613458 request .headers = {
3462- 'x-ms-proposed-lease-id' : _to_str (proposed_lease_id ),
34633459 'x-ms-lease-id' : _to_str (lease_id ),
34643460 'x-ms-permissions' : _to_str (posix_permissions ),
34653461 'x-ms-umask' : _to_str (posix_umask ),
34663462 }
3467- # TODO add test cases for lease and metadata
3463+ # TODO add test cases for lease
34683464 _add_file_or_directory_properties_header (metadata , request )
34693465 return self ._perform_request (request , parser = _parse_base_properties )
34703466
3471- def delete_directory (self , container_name , directory_path , fail_not_exist = False , recursive = True , marker = None ,
3467+ def delete_directory (self , container_name , directory_path , fail_not_exist = False , recursive = False , marker = None ,
34723468 lease_id = None , if_modified_since = None , if_unmodified_since = None , if_match = None ,
34733469 if_none_match = None , timeout = None ):
34743470 """
@@ -3551,22 +3547,28 @@ def delete_directory(self, container_name, directory_path, fail_not_exist=False,
35513547
35523548 def rename_path (self , container_name , new_path , source_path ,
35533549 mode = None , marker = None , lease_id = None , source_lease_id = None ,
3554- metadata = None , source_if_modified_since = None , source_if_unmodified_since = None ,
3550+ source_if_modified_since = None , source_if_unmodified_since = None ,
35553551 source_if_match = None , source_if_none_match = None , timeout = None ):
35563552 """
35573553 Rename a blob or directory(which can contain other directories or blobs).
35583554
35593555 :param str container_name:
35603556 Name of existing container.
35613557 :param str new_path:
3562- New path for source_path. Ex: 'dirfoo/dirsubfoo'.
3558+ New path for source_path. Ex: 'topdir1/dirsubfoo'.
3559+ Note that the path should be an absolute path under the container.
35633560 :param str source_path:
3564- Path to be renamed. Ex: 'dirfoo/dirbar'.
3561+ Path to be renamed. Ex: 'topdir1/dirbar'.
3562+ Note that the path should be an absolute path under the container.
35653563 :param mode:
35663564 Optional. Valid only when namespace is enabled.
35673565 This parameter determines the behavior of the rename operation.
35683566 The value must be "legacy" or "posix", and the default value will be "posix".
3569- A "posix" rename is done atomically; a "legacy" rename is done in batches and could return a marker.
3567+ Legacy: if the destination of the move is an existing directory and that directory is empty,
3568+ the source will overwrite the destination. If the directory is not empty, the move will fail.
3569+ Posix: if the destination of the move is an existing empty directory,
3570+ destination will be overwritten. Otherwise, the source will be moved into the destination directory.
3571+ If the destination is an existing file, the file will be overwritten.
35703572 :param marker:
35713573 Optional. When renaming a directory, the number of paths that are renamed with each invocation is limited.
35723574 If the number of paths to be renamed exceeds this limit,
@@ -3578,12 +3580,6 @@ def rename_path(self, container_name, new_path, source_path,
35783580 :param str source_lease_id:
35793581 Optional. A lease ID for the source_path.
35803582 The source_path must have an active lease and the lease ID must match.
3581- :param metadata:
3582- Optional. A dict with name_value pairs to associate with the path as metadata.
3583- Example:{'Category':'test'}.
3584- If metadata is specified, it will overwrite the existing metadata;
3585- otherwise, the existing metadata will be preserved.
3586- :type metadata: dict(str, str)
35873583 :param datetime source_if_modified_since:
35883584 Optional. A date and time value. Specify this header to perform the rename operation
35893585 only if the source has been modified since the specified date and time.
@@ -3625,8 +3621,6 @@ def rename_path(self, container_name, new_path, source_path,
36253621 'x-ms-source-if-match' : _to_str (source_if_match ),
36263622 'x-ms-source-if-none-match' : _to_str (source_if_none_match ),
36273623 }
3628- # TODO add test cases for lease and metadata
3629- _add_file_or_directory_properties_header (metadata , request )
36303624 return self ._perform_request (request , parser = _parse_continuation_token )
36313625
36323626 def get_path_access_control (self , container_name , path , user_principle_names = False ,
0 commit comments