Skip to content

Commit a69113c

Browse files
Generated code + feature implementation
1 parent fb95607 commit a69113c

23 files changed

+812
-333
lines changed

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,18 @@ def delete_blob(self, delete_snapshots: Optional[str] = None, **kwargs: Any) ->
932932
933933
.. versionadded:: 12.4.0
934934
935+
:keyword ~datetime.datetime access_tier_if_modified_since:
936+
A DateTime value. Azure expects the date value passed in to be UTC.
937+
If timezone is included, any non-UTC datetimes will be converted to UTC.
938+
If a date is passed in without timezone info, it is assumed to be UTC.
939+
Specify this header to perform the operation only if
940+
the access-tier has been modified since the specified date/time.
941+
:keyword ~datetime.datetime access_tier_if_unmodified_since:
942+
A DateTime value. Azure expects the date value passed in to be UTC.
943+
If timezone is included, any non-UTC datetimes will be converted to UTC.
944+
If a date is passed in without timezone info, it is assumed to be UTC.
945+
Specify this header to perform the operation only if
946+
the access-tier has been modified since the specified date/time.
935947
:keyword int timeout:
936948
Sets the server-side timeout for the operation in seconds. For more details see
937949
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
@@ -954,7 +966,8 @@ def delete_blob(self, delete_snapshots: Optional[str] = None, **kwargs: Any) ->
954966
snapshot=self.snapshot,
955967
version_id=get_version_id(self.version_id, kwargs),
956968
delete_snapshots=delete_snapshots,
957-
**kwargs)
969+
**kwargs
970+
)
958971
try:
959972
self._client.blob.delete(**options)
960973
except HttpResponseError as error:

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin):
287287
etag: Optional[str] = None,
288288
match_condition: Optional[MatchConditions] = None,
289289
if_tags_match_condition: Optional[str] = None,
290+
access_tier_if_modified_since: Optional[datetime] = None,
291+
access_tier_if_unmodified_since: Optional[datetime] = None,
290292
timeout: Optional[int] = None,
291293
**kwargs: Any
292294
) -> None: ...

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ def _generic_delete_blob_options(delete_snapshots: Optional[str] = None, **kwarg
393393
'snapshot': kwargs.pop('snapshot', None), # this is added for delete_blobs
394394
'delete_snapshots': delete_snapshots or None,
395395
'lease_access_conditions': access_conditions,
396-
'modified_access_conditions': mod_conditions}
396+
'modified_access_conditions': mod_conditions
397+
}
397398
options.update(kwargs)
398399
return options
399400

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
4848
:param base_url: Service URL. Required. Default value is "".
4949
:type base_url: str
5050
:keyword version: Specifies the version of the operation to use for this request. Default value
51-
is "2026-02-06". Note that overriding this default value may result in unsupported behavior.
51+
is "2026-04-06". Note that overriding this default value may result in unsupported behavior.
5252
:paramtype version: str
5353
"""
5454

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
2323
desired operation. Required.
2424
:type url: str
2525
:keyword version: Specifies the version of the operation to use for this request. Default value
26-
is "2026-02-06". Note that overriding this default value may result in unsupported behavior.
26+
is "2026-04-06". Note that overriding this default value may result in unsupported behavior.
2727
:paramtype version: str
2828
"""
2929

3030
def __init__(self, url: str, **kwargs: Any) -> None:
31-
version: Literal["2026-02-06"] = kwargs.pop("version", "2026-02-06")
31+
version: Literal["2026-04-06"] = kwargs.pop("version", "2026-04-06")
3232

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

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_utils/serialization.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sys
2222
import codecs
2323
from typing import (
24-
Dict,
2524
Any,
2625
cast,
2726
Optional,
@@ -31,7 +30,6 @@
3130
Mapping,
3231
Callable,
3332
MutableMapping,
34-
List,
3533
)
3634

3735
try:
@@ -229,12 +227,12 @@ class Model:
229227
serialization and deserialization.
230228
"""
231229

232-
_subtype_map: Dict[str, Dict[str, Any]] = {}
233-
_attribute_map: Dict[str, Dict[str, Any]] = {}
234-
_validation: Dict[str, Dict[str, Any]] = {}
230+
_subtype_map: dict[str, dict[str, Any]] = {}
231+
_attribute_map: dict[str, dict[str, Any]] = {}
232+
_validation: dict[str, dict[str, Any]] = {}
235233

236234
def __init__(self, **kwargs: Any) -> None:
237-
self.additional_properties: Optional[Dict[str, Any]] = {}
235+
self.additional_properties: Optional[dict[str, Any]] = {}
238236
for k in kwargs: # pylint: disable=consider-using-dict-items
239237
if k not in self._attribute_map:
240238
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
311309
def as_dict(
312310
self,
313311
keep_readonly: bool = True,
314-
key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer,
312+
key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer,
315313
**kwargs: Any
316314
) -> JSON:
317315
"""Return a dict that can be serialized using json.dump.
@@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self:
380378
def from_dict(
381379
cls,
382380
data: Any,
383-
key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None,
381+
key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None,
384382
content_type: Optional[str] = None,
385383
) -> Self:
386384
"""Parse a dict using given key extractor return a model.
@@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects):
414412
return {}
415413
result = dict(cls._subtype_map[key])
416414
for valuetype in cls._subtype_map[key].values():
417-
result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access
415+
result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access
418416
return result
419417

420418
@classmethod
@@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
528526
"[]": self.serialize_iter,
529527
"{}": self.serialize_dict,
530528
}
531-
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
529+
self.dependencies: dict[str, type] = dict(classes) if classes else {}
532530
self.key_transformer = full_restapi_key_transformer
533531
self.client_side_validation = True
534532

@@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to
579577

580578
if attr_name == "additional_properties" and attr_desc["key"] == "":
581579
if target_obj.additional_properties is not None:
582-
serialized.update(target_obj.additional_properties)
580+
serialized |= target_obj.additional_properties
583581
continue
584582
try:
585583

@@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs):
789787

790788
# If dependencies is empty, try with current data class
791789
# It has to be a subclass of Enum anyway
792-
enum_type = self.dependencies.get(data_type, data.__class__)
790+
enum_type = self.dependencies.get(data_type, cast(type, data.__class__))
793791
if issubclass(enum_type, Enum):
794792
return Serializer.serialize_enum(data, enum_obj=enum_type)
795793

@@ -1184,7 +1182,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen
11841182

11851183
while "." in key:
11861184
# Need the cast, as for some reasons "split" is typed as list[str | Any]
1187-
dict_keys = cast(List[str], _FLATTEN.split(key))
1185+
dict_keys = cast(list[str], _FLATTEN.split(key))
11881186
if len(dict_keys) == 1:
11891187
key = _decode_attribute_map_key(dict_keys[0])
11901188
break
@@ -1386,7 +1384,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
13861384
"duration": (isodate.Duration, datetime.timedelta),
13871385
"iso-8601": (datetime.datetime),
13881386
}
1389-
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
1387+
self.dependencies: dict[str, type] = dict(classes) if classes else {}
13901388
self.key_extractors = [rest_key_extractor, xml_key_extractor]
13911389
# Additional properties only works if the "rest_key_extractor" is used to
13921390
# extract the keys. Making it to work whatever the key extractor is too much

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
4848
:param base_url: Service URL. Required. Default value is "".
4949
:type base_url: str
5050
:keyword version: Specifies the version of the operation to use for this request. Default value
51-
is "2026-02-06". Note that overriding this default value may result in unsupported behavior.
51+
is "2026-04-06". Note that overriding this default value may result in unsupported behavior.
5252
:paramtype version: str
5353
"""
5454

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
2323
desired operation. Required.
2424
:type url: str
2525
:keyword version: Specifies the version of the operation to use for this request. Default value
26-
is "2026-02-06". Note that overriding this default value may result in unsupported behavior.
26+
is "2026-04-06". Note that overriding this default value may result in unsupported behavior.
2727
:paramtype version: str
2828
"""
2929

3030
def __init__(self, url: str, **kwargs: Any) -> None:
31-
version: Literal["2026-02-06"] = kwargs.pop("version", "2026-02-06")
31+
version: Literal["2026-04-06"] = kwargs.pop("version", "2026-04-06")
3232

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

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# --------------------------------------------------------------------------
99
from collections.abc import MutableMapping
1010
import datetime
11-
from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union
11+
from typing import Any, Callable, IO, Literal, Optional, TypeVar, Union
1212

1313
from azure.core import AsyncPipelineClient
1414
from azure.core.exceptions import (
@@ -35,7 +35,7 @@
3535
from .._configuration import AzureBlobStorageConfiguration
3636

3737
T = TypeVar("T")
38-
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
38+
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]]
3939

4040

4141
class AppendBlobOperations:
@@ -62,7 +62,7 @@ async def create(
6262
self,
6363
content_length: int,
6464
timeout: Optional[int] = None,
65-
metadata: Optional[Dict[str, str]] = None,
65+
metadata: Optional[dict[str, str]] = None,
6666
request_id_parameter: Optional[str] = None,
6767
blob_tags_string: Optional[str] = None,
6868
immutability_policy_expiry: Optional[datetime.datetime] = None,
@@ -215,7 +215,10 @@ async def create(
215215

216216
if response.status_code not in [201]:
217217
map_error(status_code=response.status_code, response=response, error_map=error_map)
218-
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
218+
error = self._deserialize.failsafe_deserialize(
219+
_models.StorageError,
220+
pipeline_response,
221+
)
219222
raise HttpResponseError(response=response, model=error)
220223

221224
response_headers = {}
@@ -390,7 +393,10 @@ async def append_block(
390393

391394
if response.status_code not in [201]:
392395
map_error(status_code=response.status_code, response=response, error_map=error_map)
393-
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
396+
error = self._deserialize.failsafe_deserialize(
397+
_models.StorageError,
398+
pipeline_response,
399+
)
394400
raise HttpResponseError(response=response, model=error)
395401

396402
response_headers = {}
@@ -598,7 +604,10 @@ async def append_block_from_url(
598604

599605
if response.status_code not in [201]:
600606
map_error(status_code=response.status_code, response=response, error_map=error_map)
601-
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
607+
error = self._deserialize.failsafe_deserialize(
608+
_models.StorageError,
609+
pipeline_response,
610+
)
602611
raise HttpResponseError(response=response, model=error)
603612

604613
response_headers = {}
@@ -719,7 +728,10 @@ async def seal(
719728

720729
if response.status_code not in [200]:
721730
map_error(status_code=response.status_code, response=response, error_map=error_map)
722-
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
731+
error = self._deserialize.failsafe_deserialize(
732+
_models.StorageError,
733+
pipeline_response,
734+
)
723735
raise HttpResponseError(response=response, model=error)
724736

725737
response_headers = {}

0 commit comments

Comments
 (0)