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 d4bff7b commit 4b7fa4f
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 13 deletions.
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 @@ -176,6 +182,9 @@ async def get_properties(self, sharesnapshot=None, timeout=None, lease_access_co
'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
'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 @@ -868,8 +877,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, lease_access_conditions=None, *, cls=None, **kwargs):
"""Sets quota for the specified share.
async def set_properties(self, timeout=None, quota=None, access_tier=None, lease_access_conditions=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 @@ -878,6 +887,10 @@ async def set_quota(self, timeout=None, quota=None, lease_access_conditions=None
: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 lease_access_conditions: Additional parameters for the
operation
:type lease_access_conditions:
Expand All @@ -897,7 +910,7 @@ async def set_quota(self, timeout=None, quota=None, lease_access_conditions=None
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 @@ -915,6 +928,8 @@ async def set_quota(self, timeout=None, quota=None, lease_access_conditions=None
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')
if lease_id is not None:
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')

Expand All @@ -937,7 +952,7 @@ async def set_quota(self, timeout=None, quota=None, lease_access_conditions=None
'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, lease_access_conditions=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 @@ -78,6 +78,7 @@
LeaseStatusType,
ListSharesIncludeType,
PermissionCopyModeType,
ShareAccessTier,
StorageErrorCode,
)

Expand Down Expand Up @@ -115,6 +116,7 @@
'LeaseDurationType',
'LeaseStateType',
'LeaseStatusType',
'ShareAccessTier',
'PermissionCopyModeType',
'DeleteSnapshotsOptionType',
'ListSharesIncludeType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ class LeaseStatusType(str, Enum):
unlocked = "unlocked"


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 @@ -773,6 +773,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
:param lease_status: Possible values include: 'locked', 'unlocked'
:type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType
:param lease_state: Possible values include: 'available', 'leased',
Expand All @@ -799,6 +805,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'}},
'lease_status': {'key': 'LeaseStatus', 'type': 'LeaseStatusType', 'xml': {'name': 'LeaseStatus'}},
'lease_state': {'key': 'LeaseState', 'type': 'LeaseStateType', 'xml': {'name': 'LeaseState'}},
'lease_duration': {'key': 'LeaseDuration', 'type': 'LeaseDurationType', 'xml': {'name': 'LeaseDuration'}},
Expand All @@ -817,6 +826,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)
self.lease_status = kwargs.get('lease_status', None)
self.lease_state = kwargs.get('lease_state', None)
self.lease_duration = kwargs.get('lease_duration', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,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
:param lease_status: Possible values include: 'locked', 'unlocked'
:type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType
:param lease_state: Possible values include: 'available', 'leased',
Expand All @@ -799,14 +805,17 @@ 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'}},
'lease_status': {'key': 'LeaseStatus', 'type': 'LeaseStatusType', 'xml': {'name': 'LeaseStatus'}},
'lease_state': {'key': 'LeaseState', 'type': 'LeaseStateType', 'xml': {'name': 'LeaseState'}},
'lease_duration': {'key': 'LeaseDuration', 'type': 'LeaseDurationType', 'xml': {'name': 'LeaseDuration'}},
}
_xml_map = {
}

def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: int=None, provisioned_ingress_mbps: int=None, provisioned_egress_mbps: int=None, next_allowed_quota_downgrade_time=None, deleted_time=None, remaining_retention_days: int=None, lease_status=None, lease_state=None, lease_duration=None, **kwargs) -> None:
def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: int=None, provisioned_ingress_mbps: int=None, provisioned_egress_mbps: int=None, next_allowed_quota_downgrade_time=None, deleted_time=None, remaining_retention_days: int=None, access_tier: str=None, access_tier_change_time=None, access_tier_transition_state: str=None, lease_status=None, lease_state=None, lease_duration=None, **kwargs) -> None:
super(ShareProperties, self).__init__(**kwargs)
self.last_modified = last_modified
self.etag = etag
Expand All @@ -817,6 +826,9 @@ def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: in
self.next_allowed_quota_downgrade_time = next_allowed_quota_downgrade_time
self.deleted_time = deleted_time
self.remaining_retention_days = remaining_retention_days
self.access_tier = access_tier
self.access_tier_change_time = access_tier_change_time
self.access_tier_transition_state = access_tier_transition_state
self.lease_status = lease_status
self.lease_state = lease_state
self.lease_duration = lease_duration
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):
self._config = config
self.restype = "share"

def create(self, timeout=None, metadata=None, quota=None, cls=None, **kwargs):
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 @@ def create(self, timeout=None, metadata=None, quota=None, cls=None, **kwargs):
: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 @@ def create(self, timeout=None, metadata=None, quota=None, cls=None, **kwargs):
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 @@ -176,6 +182,9 @@ def get_properties(self, sharesnapshot=None, timeout=None, lease_access_conditio
'x-ms-lease-duration': self._deserialize(models.LeaseDurationType, response.headers.get('x-ms-lease-duration')),
'x-ms-lease-state': self._deserialize(models.LeaseStateType, response.headers.get('x-ms-lease-state')),
'x-ms-lease-status': self._deserialize(models.LeaseStatusType, response.headers.get('x-ms-lease-status')),
'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 @@ -868,8 +877,8 @@ def get_permission(self, file_permission_key, timeout=None, cls=None, **kwargs):
return deserialized
get_permission.metadata = {'url': '/{shareName}'}

def set_quota(self, timeout=None, quota=None, lease_access_conditions=None, cls=None, **kwargs):
"""Sets quota for the specified share.
def set_properties(self, timeout=None, quota=None, access_tier=None, lease_access_conditions=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 @@ -878,6 +887,10 @@ def set_quota(self, timeout=None, quota=None, lease_access_conditions=None, cls=
: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 lease_access_conditions: Additional parameters for the
operation
:type lease_access_conditions:
Expand All @@ -897,7 +910,7 @@ def set_quota(self, timeout=None, quota=None, lease_access_conditions=None, cls=
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 @@ -915,6 +928,8 @@ def set_quota(self, timeout=None, quota=None, lease_access_conditions=None, cls=
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')
if lease_id is not None:
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')

Expand All @@ -937,7 +952,7 @@ def set_quota(self, timeout=None, quota=None, lease_access_conditions=None, cls=
'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}'}

def set_metadata(self, timeout=None, metadata=None, lease_access_conditions=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 @@ -501,7 +501,7 @@ def set_share_quota(self, quota, **kwargs):
access_conditions = get_access_conditions(kwargs.pop('lease', None))
timeout = kwargs.pop('timeout', None)
try:
return self._client.share.set_quota( # type: ignore
return self._client.share.set_properties( # type: ignore
timeout=timeout,
quota=quota,
lease_access_conditions=access_conditions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ async def set_share_quota(self, quota, **kwargs):
access_conditions = get_access_conditions(kwargs.pop('lease', None))
timeout = kwargs.pop('timeout', None)
try:
return await self._client.share.set_quota( # type: ignore
return await self._client.share.set_properties( # type: ignore
timeout=timeout,
quota=quota,
cls=return_response_headers,
Expand Down

0 comments on commit 4b7fa4f

Please sign in to comment.