Skip to content

Commit

Permalink
[Storage][FileShare]Regenerate code for file tier
Browse files Browse the repository at this point in the history
  • Loading branch information
xiafu-msft committed Oct 6, 2020
1 parent fa6c1b8 commit 983a40a
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ async def force_close_handles(self, handle_id, timeout=None, marker=None, shares
"""Closes all handles open for given directory.
:param handle_id: Specifies handle ID opened on the file or directory
to be closed. Asterix (‘*’) is a wildcard that specifies all handles.
to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
:type handle_id: str
:param timeout: The timeout parameter is expressed in seconds. For
more information, see <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ async def force_close_handles(self, handle_id, timeout=None, marker=None, shares
"""Closes all handles open for given file.
:param handle_id: Specifies handle ID opened on the file or directory
to be closed. Asterix (‘*’) is a wildcard that specifies all handles.
to be closed. Asterisk (‘*’) is a wildcard that specifies all handles.
:type handle_id: str
:param timeout: The timeout parameter is expressed in seconds. For
more information, see <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, client, config, serializer, deserializer) -> None:
self._config = config
self.restype = "share"

async def create(self, timeout=None, metadata=None, quota=None, *, cls=None, **kwargs):
async def create(self, timeout=None, metadata=None, quota=None, access_tier=None, *, cls=None, **kwargs):
"""Creates a new share under the specified account. If the share with the
same name already exists, the operation fails.
Expand All @@ -51,6 +51,10 @@ async def create(self, timeout=None, metadata=None, quota=None, *, cls=None, **k
:type metadata: str
:param quota: Specifies the maximum size of the share, in gigabytes.
:type quota: int
:param access_tier: Specifies the access tier of the share. Possible
values include: 'TransactionOptimized', 'Hot', 'Cool'
:type access_tier: str or
~azure.storage.fileshare.models.ShareAccessTier
:param callable cls: A custom type or function that will be passed the
direct response
:return: None or the result of cls(response)
Expand Down Expand Up @@ -78,6 +82,8 @@ async def create(self, timeout=None, metadata=None, quota=None, *, cls=None, **k
header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str')
if quota is not None:
header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
if access_tier is not None:
header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')

# Construct and send request
Expand Down Expand Up @@ -163,6 +169,9 @@ async def get_properties(self, sharesnapshot=None, timeout=None, *, cls=None, **
'x-ms-share-provisioned-ingress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-ingress-mbps')),
'x-ms-share-provisioned-egress-mbps': self._deserialize('int', response.headers.get('x-ms-share-provisioned-egress-mbps')),
'x-ms-share-next-allowed-quota-downgrade-time': self._deserialize('rfc-1123', response.headers.get('x-ms-share-next-allowed-quota-downgrade-time')),
'x-ms-access-tier': self._deserialize('str', response.headers.get('x-ms-access-tier')),
'x-ms-access-tier-change-time': self._deserialize('rfc-1123', response.headers.get('x-ms-access-tier-change-time')),
'x-ms-access-tier-transition-state': self._deserialize('str', response.headers.get('x-ms-access-tier-transition-state')),
'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
}
return cls(response, None, response_headers)
Expand Down Expand Up @@ -428,8 +437,8 @@ async def get_permission(self, file_permission_key, timeout=None, *, cls=None, *
return deserialized
get_permission.metadata = {'url': '/{shareName}'}

async def set_quota(self, timeout=None, quota=None, *, cls=None, **kwargs):
"""Sets quota for the specified share.
async def set_properties(self, timeout=None, quota=None, access_tier=None, *, cls=None, **kwargs):
"""Sets properties for the specified share.
:param timeout: The timeout parameter is expressed in seconds. For
more information, see <a
Expand All @@ -438,6 +447,10 @@ async def set_quota(self, timeout=None, quota=None, *, cls=None, **kwargs):
:type timeout: int
:param quota: Specifies the maximum size of the share, in gigabytes.
:type quota: int
:param access_tier: Specifies the access tier of the share. Possible
values include: 'TransactionOptimized', 'Hot', 'Cool'
:type access_tier: str or
~azure.storage.fileshare.models.ShareAccessTier
:param callable cls: A custom type or function that will be passed the
direct response
:return: None or the result of cls(response)
Expand All @@ -449,7 +462,7 @@ async def set_quota(self, timeout=None, quota=None, *, cls=None, **kwargs):
comp = "properties"

# Construct URL
url = self.set_quota.metadata['url']
url = self.set_properties.metadata['url']
path_format_arguments = {
'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
}
Expand All @@ -467,6 +480,8 @@ async def set_quota(self, timeout=None, quota=None, *, cls=None, **kwargs):
header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
if quota is not None:
header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1)
if access_tier is not None:
header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str')

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
Expand All @@ -487,7 +502,7 @@ async def set_quota(self, timeout=None, quota=None, *, cls=None, **kwargs):
'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
}
return cls(response, None, response_headers)
set_quota.metadata = {'url': '/{shareName}'}
set_properties.metadata = {'url': '/{shareName}'}

async def set_metadata(self, timeout=None, metadata=None, *, cls=None, **kwargs):
"""Sets one or more user-defined name-value pairs for the specified share.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
from ._models_py3 import ListHandlesResponse
from ._models_py3 import ListSharesResponse
from ._models_py3 import Metrics
from ._models_py3 import ProtocolSettings
from ._models_py3 import Range
from ._models_py3 import RetentionPolicy
from ._models_py3 import ShareItem
from ._models_py3 import SharePermission
from ._models_py3 import ShareProperties
from ._models_py3 import ShareStats
from ._models_py3 import SignedIdentifier
from ._models_py3 import SmbMultichannel
from ._models_py3 import SmbSettings
from ._models_py3 import SourceModifiedAccessConditions
from ._models_py3 import StorageError, StorageErrorException
from ._models_py3 import StorageServiceProperties
Expand All @@ -49,13 +52,16 @@
from ._models import ListHandlesResponse
from ._models import ListSharesResponse
from ._models import Metrics
from ._models import ProtocolSettings
from ._models import Range
from ._models import RetentionPolicy
from ._models import ShareItem
from ._models import SharePermission
from ._models import ShareProperties
from ._models import ShareStats
from ._models import SignedIdentifier
from ._models import SmbMultichannel
from ._models import SmbSettings
from ._models import SourceModifiedAccessConditions
from ._models import StorageError, StorageErrorException
from ._models import StorageServiceProperties
Expand All @@ -68,6 +74,7 @@
LeaseStatusType,
ListSharesIncludeType,
PermissionCopyModeType,
ShareAccessTier,
StorageErrorCode,
)

Expand All @@ -86,17 +93,21 @@
'ListHandlesResponse',
'ListSharesResponse',
'Metrics',
'ProtocolSettings',
'Range',
'RetentionPolicy',
'ShareItem',
'SharePermission',
'ShareProperties',
'ShareStats',
'SignedIdentifier',
'SmbMultichannel',
'SmbSettings',
'SourceModifiedAccessConditions',
'StorageError', 'StorageErrorException',
'StorageServiceProperties',
'StorageErrorCode',
'ShareAccessTier',
'PermissionCopyModeType',
'DeleteSnapshotsOptionType',
'ListSharesIncludeType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class StorageErrorCode(str, Enum):
feature_version_mismatch = "FeatureVersionMismatch"


class ShareAccessTier(str, Enum):

transaction_optimized = "TransactionOptimized"
hot = "Hot"
cool = "Cool"


class PermissionCopyModeType(str, Enum):

source = "source"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,24 @@ def __init__(self, **kwargs):
self.retention_policy = kwargs.get('retention_policy', None)


class ProtocolSettings(Model):
"""Protocol settings.
:param smb_settings: Settings for SMB protocol.
:type smb_settings: ~azure.storage.fileshare.models.SmbSettings
"""

_attribute_map = {
'smb_settings': {'key': 'SmbSettings', 'type': 'SmbSettings', 'xml': {'name': 'SMB'}},
}
_xml_map = {
}

def __init__(self, **kwargs):
super(ProtocolSettings, self).__init__(**kwargs)
self.smb_settings = kwargs.get('smb_settings', None)


class Range(Model):
"""An Azure Storage file range.
Expand Down Expand Up @@ -721,6 +739,12 @@ class ShareProperties(Model):
:type deleted_time: datetime
:param remaining_retention_days:
:type remaining_retention_days: int
:param access_tier:
:type access_tier: str
:param access_tier_change_time:
:type access_tier_change_time: datetime
:param access_tier_transition_state:
:type access_tier_transition_state: str
"""

_validation = {
Expand All @@ -739,6 +763,9 @@ class ShareProperties(Model):
'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123', 'xml': {'name': 'NextAllowedQuotaDowngradeTime'}},
'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123', 'xml': {'name': 'DeletedTime'}},
'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int', 'xml': {'name': 'RemainingRetentionDays'}},
'access_tier': {'key': 'AccessTier', 'type': 'str', 'xml': {'name': 'AccessTier'}},
'access_tier_change_time': {'key': 'AccessTierChangeTime', 'type': 'rfc-1123', 'xml': {'name': 'AccessTierChangeTime'}},
'access_tier_transition_state': {'key': 'AccessTierTransitionState', 'type': 'str', 'xml': {'name': 'AccessTierTransitionState'}},
}
_xml_map = {
}
Expand All @@ -754,6 +781,9 @@ def __init__(self, **kwargs):
self.next_allowed_quota_downgrade_time = kwargs.get('next_allowed_quota_downgrade_time', None)
self.deleted_time = kwargs.get('deleted_time', None)
self.remaining_retention_days = kwargs.get('remaining_retention_days', None)
self.access_tier = kwargs.get('access_tier', None)
self.access_tier_change_time = kwargs.get('access_tier_change_time', None)
self.access_tier_transition_state = kwargs.get('access_tier_transition_state', None)


class ShareStats(Model):
Expand Down Expand Up @@ -810,6 +840,43 @@ def __init__(self, **kwargs):
self.access_policy = kwargs.get('access_policy', None)


class SmbMultichannel(Model):
"""Settings for SMB multichannel.
:param enabled: If SMB multichannel is enabled.
:type enabled: bool
"""

_attribute_map = {
'enabled': {'key': 'Enabled', 'type': 'bool', 'xml': {'name': 'Enabled'}},
}
_xml_map = {
'name': 'Multichannel'
}

def __init__(self, **kwargs):
super(SmbMultichannel, self).__init__(**kwargs)
self.enabled = kwargs.get('enabled', None)


class SmbSettings(Model):
"""Settings for SMB protocol.
:param multichannel: Settings for SMB Multichannel.
:type multichannel: ~azure.storage.fileshare.models.SmbMultichannel
"""

_attribute_map = {
'multichannel': {'key': 'Multichannel', 'type': 'SmbMultichannel', 'xml': {'name': 'Multichannel'}},
}
_xml_map = {
}

def __init__(self, **kwargs):
super(SmbSettings, self).__init__(**kwargs)
self.multichannel = kwargs.get('multichannel', None)


class SourceModifiedAccessConditions(Model):
"""Additional parameters for upload_range_from_url operation.
Expand Down Expand Up @@ -879,12 +946,15 @@ class StorageServiceProperties(Model):
:type minute_metrics: ~azure.storage.fileshare.models.Metrics
:param cors: The set of CORS rules.
:type cors: list[~azure.storage.fileshare.models.CorsRule]
:param protocol_settings: Protocol settings
:type protocol_settings: ~azure.storage.fileshare.models.ProtocolSettings
"""

_attribute_map = {
'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}},
'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}},
'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}},
'protocol_settings': {'key': 'ProtocolSettings', 'type': 'ProtocolSettings', 'xml': {'name': 'ProtocolSettings'}},
}
_xml_map = {
}
Expand All @@ -894,3 +964,4 @@ def __init__(self, **kwargs):
self.hour_metrics = kwargs.get('hour_metrics', None)
self.minute_metrics = kwargs.get('minute_metrics', None)
self.cors = kwargs.get('cors', None)
self.protocol_settings = kwargs.get('protocol_settings', None)
Loading

0 comments on commit 983a40a

Please sign in to comment.