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] Add x-ms-creation-time to response on download #28745

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["AzureBlobStorage"]
__all__ = [
"AzureBlobStorage",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any
from typing import Any, Union

from azure.core import PipelineClient
from azure.core.rest import HttpRequest, HttpResponse

from . import models
from . import models as _models
from ._configuration import AzureBlobStorageConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
Expand Down Expand Up @@ -43,20 +43,20 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
:param url: The URL of the service account, container, or blob that is the target of the
desired operation. Required.
:type url: str
:param version: Specifies the version of the operation to use for this request. "2021-12-02"
Required.
:type version: str or ~azure.storage.blob.models.Enum2
:param base_url: Service URL. Required. Default value is "".
:type base_url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, url: str, base_url: str = "", **kwargs: Any
self, url: str, version: Union[str, _models.Enum2], base_url: str = "", **kwargs: Any
) -> None:
self._config = AzureBlobStorageConfiguration(url=url, **kwargs)
self._config = AzureBlobStorageConfiguration(url=url, version=version, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
Expand Down Expand Up @@ -89,15 +89,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> AzureBlobStorage
def __enter__(self) -> "AzureBlobStorage":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import Any
from typing import Any, Union

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from . import models as _models

VERSION = "unknown"


Expand All @@ -23,27 +25,24 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many-
:param url: The URL of the service account, container, or blob that is the target of the
desired operation. Required.
:type url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2021-12-02". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
:param version: Specifies the version of the operation to use for this request. "2021-12-02"
Required.
:type version: str or ~azure.storage.blob.models.Enum2
"""

def __init__(self, url: str, **kwargs: Any) -> None:
def __init__(self, url: str, version: Union[str, _models.Enum2], **kwargs: Any) -> None:
super(AzureBlobStorageConfiguration, self).__init__(**kwargs)
version = kwargs.pop("version", "2021-12-02") # type: str

if url is None:
raise ValueError("Parameter 'url' must not be None.")
if version is None:
raise ValueError("Parameter 'version' must not be None.")

self.url = url
self.version = version
kwargs.setdefault("sdk_moniker", "azureblobstorage/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
Expand Down
Loading