Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] File SDK rename #8164

Merged
merged 30 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
20013f3
Renamed package dir
annatisch Oct 23, 2019
c36777b
Renamed namespace dir
annatisch Oct 23, 2019
a5d776b
Some packaging updates
annatisch Oct 23, 2019
a909504
Renamed ShareServiceClient
annatisch Oct 23, 2019
d14dbf1
Renamed _share_service_client
annatisch Oct 23, 2019
4864c4b
Renamed ShareDirectoryClient
annatisch Oct 23, 2019
f5d8ebb
Renamed ShareFileClient
annatisch Oct 23, 2019
6150bd6
Updated namespace references
annatisch Oct 23, 2019
453bc8b
Some fixes
annatisch Oct 23, 2019
5ad611f
Other repo components
annatisch Oct 23, 2019
06429a8
Synced shared models
annatisch Oct 23, 2019
9d8351e
More repo components
annatisch Oct 24, 2019
b4a82a9
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 24, 2019
dd1e63d
Pylint fix
annatisch Oct 24, 2019
8c73dec
Updated user agent
annatisch Oct 24, 2019
5702cb1
Unique share names
annatisch Oct 24, 2019
1405484
Revert "Unique share names"
annatisch Oct 24, 2019
500e49c
Classmethod return types
annatisch Oct 24, 2019
dc52435
Updated release notes
annatisch Oct 24, 2019
2188a44
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 24, 2019
3855f88
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 24, 2019
4bd1af9
Merge fix
annatisch Oct 24, 2019
d22ec02
Updated namespace references
annatisch Oct 24, 2019
c63780d
Updated readme
annatisch Oct 24, 2019
67ba403
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 24, 2019
7f4804a
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 25, 2019
86c16cb
Manual sample merge
annatisch Oct 25, 2019
0018623
Merge remote-tracking branch 'upstream/master' into storage-file-rename
annatisch Oct 25, 2019
7e65a7d
Updated samples
annatisch Oct 25, 2019
be6b29c
Merge fix
annatisch Oct 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ known_content_issues:
- ['sdk/loganalytics/azure-loganalytics/README.rst', '#4554']
- ['sdk/servicefabric/azure-servicefabric/README.rst', '#4554']
- ['sdk/core/azure-servicemanagement-legacy/README.rst', '#4554']
- ['sdk/storage/azure-storage-file/swagger/README.md', '#4554']
- ['sdk/storage/azure-storage-file-share/swagger/README.md', '#4554']
- ['sdk/storage/azure-storage-queue/swagger/README.md', '#4554']
- ['sdk/storage/azure-storage-blob/swagger/README.md', '#4554']

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ code_reports
# Azure Storage test credentials
sdk/storage/azure-storage-blob/tests/settings_real.py
sdk/storage/azure-storage-queue/tests/settings_real.py
sdk/storage/azure-storage-file/tests/settings_real.py
sdk/storage/azure-storage-file-share/tests/settings_real.py
*.code-workspace
sdk/cosmos/azure-cosmos/test/test_config.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The libraries released in July preview:
- [azure-keyvault-secrets](./sdk/keyvault/azure-keyvault-secrets)
- [azure-identity](./sdk/identity/azure-identity)
- [azure-storage-blob](./sdk/storage/azure-storage-blob)
- [azure-storage-file](./sdk/storage/azure-storage-file)
- [azure-storage-file](./sdk/storage/azure-storage-file-share)
lmazuel marked this conversation as resolved.
Show resolved Hide resolved
- [azure-storage-queue](./sdk/storage/azure-storage-queue)

>NOTE: If you need to ensure your code is ready for production use one of the stable libraries.
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/package_service_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@
"service_name": "Storage",
"manually_generated": true
},
"azure-storage-file": {
"azure-storage-file-share": {
"category": "Client",
"service_name": "Storage",
"manually_generated": true
Expand Down
2 changes: 1 addition & 1 deletion eng/tox/import_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"azure.keyvault.secrets", # Github issue 7879
"azure.appconfiguration", # Github issue 7879. revisit and close after azure-core POST b4 is released.
"azure.storage.blob", # Github issue 7879.
"azure.storage.file", # Github issue 7879.
"azure.storage.fileshare", # Github issue 7879.
"azure.storage.queue", # Github issue 7879.
"azure",
"azure-mgmt"]
Expand Down
2 changes: 1 addition & 1 deletion packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@
| [`azure-servicefabric`]( sdk/servicefabric/azure-servicefabric/setup.py )| [Readme](sdk/servicefabric/azure-servicefabric/README.rst) | [Changelog](sdk/servicefabric/azure-servicefabric/HISTORY.rst) | [PyPI]( https://pypi.org/project/azure-servicefabric ) |
| [`azure-servicemanagement-legacy`]( sdk/core/azure-servicemanagement-legacy/setup.py )| [Readme](sdk/core/azure-servicemanagement-legacy/README.rst) | [Changelog](sdk/core/azure-servicemanagement-legacy/HISTORY.rst) | [PyPI]( https://pypi.org/project/azure-servicemanagement-legacy ) |
| [`azure-storage-blob`]( sdk/storage/azure-storage-blob/setup.py )| [Readme](sdk/storage/azure-storage-blob/README.md) | N/A | [PyPI]( https://pypi.org/project/azure-storage-blob ) |
| [`azure-storage-file`]( sdk/storage/azure-storage-file/setup.py )| [Readme](sdk/storage/azure-storage-file/README.md) | N/A | [PyPI]( https://pypi.org/project/azure-storage-file ) |
| [`azure-storage-file-share`]( sdk/storage/azure-storage-file-share/setup.py )| [Readme](sdk/storage/azure-storage-file-share/README.md) | N/A | [PyPI]( https://pypi.org/project/azure-storage-file-share ) |
| [`azure-storage-queue`]( sdk/storage/azure-storage-queue/setup.py )| [Readme](sdk/storage/azure-storage-queue/README.md) | N/A | [PyPI]( https://pypi.org/project/azure-storage-queue ) |
2 changes: 1 addition & 1 deletion scripts/pylint_custom_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ In the case of a false positive, use the disable command to remove the pylint er
| client-method-name-no-double-underscore | Don't use method names prefixed with "__". | # pylint:disable=client-method-name-no-double-underscore | [link](https://azure.github.io/azure-sdk/python_introduction.html#public-vs-private) |
| specify-parameter-names-in-call | Specify the parameter names when calling methods with more than 2 required positional parameters. e.g. self.get_foo(one, two, three=three, four=four, five=five) | # pylint:disable=specify-parameter-names-in-call | [link](https://azure.github.io/azure-sdk/python_introduction.html#method-signatures) |
| connection-string-should-not-be-constructor-param | Remove connection string parameter from client constructor. Create a method that creates the client using a connection string. | # pylint:disable=connection-string-should-not-be-constructor-param | [link](https://azure.github.io/azure-sdk/python_design.html#constructors-and-factory-methods) |
| package-name-incorrect | Change your distribution package name to only include dashes, e.g. azure-storage-file | # pylint:disable=package-name-incorrect | [link](https://azure.github.io/azure-sdk/python_implementation.html#packaging) |
| package-name-incorrect | Change your distribution package name to only include dashes, e.g. azure-storage-file-share | # pylint:disable=package-name-incorrect | [link](https://azure.github.io/azure-sdk/python_implementation.html#packaging) |
| client-suffix-needed | Service client types should use a "Client" suffix, e.g. BlobClient. | # pylint:disable=client-suffix-needed | [link](https://azure.github.io/azure-sdk/python_design.html#clients) |
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def from_blob_url(cls, blob_url, credential=None, snapshot=None, **kwargs):
The optional blob snapshot on which to operate. This can be the snapshot ID string
or the response returned from :func:`create_snapshot`. If specified, this will override
the snapshot in the url.
:returns: A Blob client.
:rtype: ~azure.storage.blob.BlobClient
"""
try:
if not blob_url.lower().startswith('http'):
Expand Down Expand Up @@ -218,8 +220,7 @@ def from_connection_string(
credential=None, # type: Optional[Any]
**kwargs # type: Any
): # type: (...) -> BlobClient
"""
Create BlobClient from a Connection String.
"""Create BlobClient from a Connection String.

:param str conn_str:
A connection string to an Azure Storage account.
Expand All @@ -236,6 +237,8 @@ def from_connection_string(
access key values. The value can be a SAS token string, an account shared access
key, or an instance of a TokenCredentials class from azure.identity.
Credentials provided here will take precedence over those in the connection string.
:returns: A Blob client.
:rtype: ~azure.storage.blob.BlobClient

.. admonition:: Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def from_connection_string(
access key values. The value can be a SAS token string, an account shared access
key, or an instance of a TokenCredentials class from azure.identity.
Credentials provided here will take precedence over those in the connection string.
:returns: A Blob service client.
:rtype: ~azure.storage.blob.BlobServiceClient

.. admonition:: Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def from_container_url(cls, container_url, credential=None, **kwargs):
access key values. The value can be a SAS token string, an account shared access
key, or an instance of a TokenCredentials class from azure.identity.
Credentials provided here will take precedence over those in the connection string.
:returns: A container client.
:rtype: ~azure.storage.blob.ContainerClient
"""
try:
if not container_url.lower().startswith('http'):
Expand Down Expand Up @@ -187,6 +189,8 @@ def from_connection_string(
access key values. The value can be a SAS token string, an account shared access
key, or an instance of a TokenCredentials class from azure.identity.
Credentials provided here will take precedence over those in the connection string.
:returns: A container client.
:rtype: ~azure.storage.blob.ContainerClient

.. admonition:: Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ def __init__(
self._hosts = kwargs.get("_hosts")
self.scheme = parsed_url.scheme

if service not in ["blob", "queue", "file"]:
if service not in ["blob", "queue", "file-share"]:
annatisch marked this conversation as resolved.
Show resolved Hide resolved
raise ValueError("Invalid service: {}".format(service))
account = parsed_url.netloc.split(".{}.core.".format(service))
service_name = service.split('-')[0]
account = parsed_url.netloc.split(".{}.core.".format(service_name))
self.account_name = account[0] if len(account) > 1 else None
secondary_hostname = None

Expand All @@ -89,7 +90,8 @@ def __init__(
raise ValueError("Token credential is only supported with HTTPS.")
if hasattr(self.credential, "account_name"):
self.account_name = self.credential.account_name
secondary_hostname = "{}-secondary.{}.{}".format(self.credential.account_name, service, SERVICE_HOST_BASE)
secondary_hostname = "{}-secondary.{}.{}".format(
self.credential.account_name, service_name, SERVICE_HOST_BASE)

if not self._hosts:
if len(account) > 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,25 +348,24 @@ def from_string(cls, permission):
parsed._str = permission # pylint: disable = protected-access
return parsed


class Services(object):
"""Specifies the services accessible with the account SAS.

:param bool blob:
Access for the `~azure.storage.blob.BlobServiceClient`
:param bool queue:
Access for the `~azure.storage.queue.QueueServiceClient`
:param bool file:
Access for the `~azure.storage.file.FileServiceClient`
:param bool fileshare:
Access for the `~azure.storage.fileshare.ShareServiceClient`
"""

def __init__(self, blob=False, queue=False, file=False):
def __init__(self, blob=False, queue=False, fileshare=False):
self.blob = blob
self.queue = queue
self.file = file
self.fileshare = fileshare
self._str = (('b' if self.blob else '') +
('q' if self.queue else '') +
('f' if self.file else ''))
('f' if self.fileshare else ''))

def __str__(self):
return self._str
Expand All @@ -392,6 +391,7 @@ def from_string(cls, string):
parsed._str = string # pylint: disable = protected-access
return parsed


class UserDelegationKey(object):
"""
Represents a user delegation key, provided to the user by Azure Storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,34 @@

## Version 12.0.0b5:

**Breaking changes**
**Important: This package was previously named azure-storage-file**

Going forward, to use this SDK, please install `azure-storage-file-share`.
Additionally:
- The namespace within the package has also been renamed to `azure.storage.fileshare`.
- `FileServiceClient` has been renamed to `ShareServiceClient`.
- `DirectoryClient` has been renamed to `ShareDirectoryClient`.
- `FileClient` has been renamed to `ShareFileClient`.

**Additional Breaking changes**

- `ShareClient` now accepts only `account_url` with mandatory a string param `share_name`.
To use a share_url, the method `from_share_url` must be used.
- `DirectoryClient` now accepts only `account_url` with mandatory string params `share_name` and `directory_path`.
- `ShareDirectoryClient` now accepts only `account_url` with mandatory string params `share_name` and `directory_path`.
To use a directory_url, the method `from_directory_url` must be used.
- `FileClient` now accepts only `account_url` with mandatory string params `share_name` and
- `ShareFileClient` now accepts only `account_url` with mandatory string params `share_name` and
`file_path`. To use a file_url, the method `from_file_url` must be used.
- `file_permission_key` parameter has been renamed to `permission_key`
- `set_share_access_policy` has required parameter `signed_identifiers`.
- NoRetry policy has been removed. Use keyword argument `retry_total=0` for no retries.
- Removed types that were accidentally exposed from two modules. Only `FileServiceClient`, `ShareClient`, `DirectoryClient` and `FileClient` should be imported from azure.storage.file.aio
- `NoRetry` policy has been removed. Use keyword argument `retry_total=0` for no retries.
- Removed types that were accidentally exposed from two modules. Only `ShareServiceClient`, `ShareClient`, `ShareDirectoryClient` and `ShareFileClient` should be imported from azure.storage.fileshare.aio
- Some parameters have become keyword only, rather than positional. Some examples include:
- `loop`
- `max_concurrency`
- `validate_content`
- `timeout` etc.
- Client and model files have been made internal. Users should import from the top level modules `azure.storage.file` and `azure.storage.file.aio` only.
- The `generate_shared_access_signature` methods on each of `FileServiceClient`, `ShareClient` and `FileClient` have been replaced by module level functions `generate_account_sas`, `generate_share_sas` and `generate_file_sas`.
- Client and model files have been made internal. Users should import from the top level modules `azure.storage.fileshare` and `azure.storage.fileshare.aio` only.
- The `generate_shared_access_signature` methods on each of `ShareServiceClient`, `ShareClient` and `ShareFileClient` have been replaced by module level functions `generate_account_sas`, `generate_share_sas` and `generate_file_sas`.
- `start_range` and `end_range` params are now renamed to and behave like`offset` and `length` in
the following APIs:
- download_file
Expand All @@ -38,10 +47,9 @@ the following APIs:
- `StorageStreamDownloader` now has new functions:
- `readall()`: Reads the complete download stream, returning bytes. This replaces the functions `content_as_bytes` and `content_as_text` which have been deprecated.
- `readinto(stream)`: Download the complete stream into the supplied writable stream, returning the number of bytes written. This replaces the function `download_to_stream` which has been deprecated.
- `FileClient.close_handles` and `DirectoryClient.close_handles` have both been replaced by two functions each; `close_handle(handle)` and `close_all_handles()`. These functions are blocking and return integer (the number of closed handles) rather than polling objects.
- `ShareFileClient.close_handles` and `ShareDirectoryClient.close_handles` have both been replaced by two functions each; `close_handle(handle)` and `close_all_handles()`. These functions are blocking and return integers (the number of closed handles) rather than polling objects.
- `get_service_properties` now returns a dict with keys consistent to `set_service_properties`


**New features**

- `ResourceTypes`, `NTFSAttributes`, and `Services` now have method `from_string` which takes parameters as a string.
Expand Down
Loading