azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

[Storage] Matching `_shared` folder contents across all packages

Open vincenttran-msft opened this issue 1 year ago • 1 comments

This PR aims to unify all the contents of the _shared folders for the blob, datalake, queue, and file-share packages.

In general, my process was to use blob's _shared folder as the "source of truth" for most things as it is where most new changes will be added (and then not uniformly added to the other _shared folders)

Things to callout when unifying:

  • Biggest change came from: Support for Oauth import/export managed disks here. I am assuming this will go everywhere eventually so most of the work was getting the shared folders to all contain these changes (please correct me if this won't go everywhere, then I will have to make all the packages look similar to each other excluding this change 😢)
  • shared_access_signature.py will be different for file-share and queue since they do not support encryption scope
  • parser.py is mostly barren except for in blob -- I opted to copy blob's parser.py to every other file (which is likely overkill) just because I anticipate most new features in blob that require these parser changes will eventually trickle down to other packages
  • In response_handlers.py metadata parsing went from response.headers.items to response.http_reponse.headers.items. Not sure how this will play out because I'm assuming if it works in its current state, will the same information be contained in response.http_response vs response.headers? Pending pipeline run for the answer 😄
  • In policies.py specifically the on_request method, the queue package is the only file with this workaround (and thus will differ from other files):
# Hack to fix generated code adding '/messages' after SAS parameters
        includes_messages = request.http_request.url.endswith('/messages')
        if includes_messages:
            request.http_request.url = request.http_request.url[:-(len('/messages'))]
            request.http_request.url = urljoin(request.http_request.url, 'messages')

Therefore, the only differences in the _shared folders now is:

  • Queue generated code hack
  • shared_access_signature.py differences for packages that don't support encryption scope (file-share & queue)
  • Docstring differences that callout the package name

vincenttran-msft avatar Dec 21 '22 23:12 vincenttran-msft

API change check

API changes are not detected in this pull request.

azure-sdk avatar Jan 04 '23 02:01 azure-sdk