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

[Fileshare] Share enable protocol share squash root #15048

Merged
merged 19 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -28,6 +28,7 @@
ShareSmbSettings,
SmbMultichannel,
ShareProtocolSettings,
ShareProtocols,
AccessPolicy,
FileSasPermissions,
ShareSasPermissions,
Expand All @@ -37,6 +38,9 @@
HandleItem,
ShareAccessTier
)
from ._generated.models import (
ShareRootSquash
)

__version__ = VERSION

Expand All @@ -63,13 +67,15 @@
'AccessPolicy',
'FileSasPermissions',
'ShareSasPermissions',
'ShareProtocols',
'ShareProperties',
'DirectoryProperties',
'FileProperties',
'ContentSettings',
'Handle',
'NTFSAttributes',
'HandleItem',
'ShareRootSquash',
'generate_account_sas',
'generate_share_sas',
'generate_file_sas'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, version, url, **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)}
self.api_version = '2020-02-10'
self.api_version = '2020-04-08'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2020-02-10'
self.api_version = '2020-04-08'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

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, access_tier=None, *, cls=None, **kwargs):
async def create(self, timeout=None, metadata=None, quota=None, access_tier=None, enabled_protocols=None, root_squash=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 @@ -55,6 +55,13 @@ async def create(self, timeout=None, metadata=None, quota=None, access_tier=None
values include: 'TransactionOptimized', 'Hot', 'Cool'
:type access_tier: str or
~azure.storage.fileshare.models.ShareAccessTier
:param enabled_protocols: Protocols to enable on the share.
:type enabled_protocols: str
:param root_squash: Root squash to set on the share. Only valid for
NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
'AllSquash'
:type root_squash: str or
~azure.storage.fileshare.models.ShareRootSquash
: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 @@ -85,6 +92,10 @@ async def create(self, timeout=None, metadata=None, quota=None, access_tier=None
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')
if enabled_protocols is not None:
header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str')
if root_squash is not None:
header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')

# Construct and send request
request = self._client.put(url, query_parameters, header_parameters)
Expand Down Expand Up @@ -185,6 +196,8 @@ async def get_properties(self, sharesnapshot=None, timeout=None, lease_access_co
'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-enabled-protocols': self._deserialize('str', response.headers.get('x-ms-enabled-protocols')),
'x-ms-root-squash': self._deserialize(models.ShareRootSquash, response.headers.get('x-ms-root-squash')),
'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
}
return cls(response, None, response_headers)
Expand Down Expand Up @@ -877,7 +890,7 @@ async def get_permission(self, file_permission_key, timeout=None, *, cls=None, *
return deserialized
get_permission.metadata = {'url': '/{shareName}'}

async def set_properties(self, timeout=None, quota=None, access_tier=None, lease_access_conditions=None, *, cls=None, **kwargs):
async def set_properties(self, timeout=None, quota=None, access_tier=None, root_squash=None, lease_access_conditions=None, *, cls=None, **kwargs):
"""Sets properties for the specified share.

:param timeout: The timeout parameter is expressed in seconds. For
Expand All @@ -891,6 +904,11 @@ async def set_properties(self, timeout=None, quota=None, access_tier=None, lease
values include: 'TransactionOptimized', 'Hot', 'Cool'
:type access_tier: str or
~azure.storage.fileshare.models.ShareAccessTier
:param root_squash: Root squash to set on the share. Only valid for
NFS shares. Possible values include: 'NoRootSquash', 'RootSquash',
'AllSquash'
:type root_squash: str or
~azure.storage.fileshare.models.ShareRootSquash
:param lease_access_conditions: Additional parameters for the
operation
:type lease_access_conditions:
Expand Down Expand Up @@ -930,6 +948,8 @@ async def set_properties(self, timeout=None, quota=None, access_tier=None, lease
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 root_squash is not None:
header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'ShareRootSquash')
if lease_id is not None:
header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
from ._models_py3 import Metrics
from ._models_py3 import RetentionPolicy
from ._models_py3 import ShareFileRangeList
from ._models_py3 import ShareItem
from ._models_py3 import ShareItemInternal
from ._models_py3 import SharePermission
from ._models_py3 import ShareProperties
from ._models_py3 import SharePropertiesInternal
from ._models_py3 import ShareProtocolSettings
from ._models_py3 import ShareSmbSettings
from ._models_py3 import ShareStats
Expand Down Expand Up @@ -58,9 +58,9 @@
from ._models import Metrics
from ._models import RetentionPolicy
from ._models import ShareFileRangeList
from ._models import ShareItem
from ._models import ShareItemInternal
from ._models import SharePermission
from ._models import ShareProperties
from ._models import SharePropertiesInternal
from ._models import ShareProtocolSettings
from ._models import ShareSmbSettings
from ._models import ShareStats
Expand All @@ -79,6 +79,7 @@
ListSharesIncludeType,
PermissionCopyModeType,
ShareAccessTier,
ShareRootSquash,
StorageErrorCode,
)

Expand All @@ -101,9 +102,9 @@
'Metrics',
'RetentionPolicy',
'ShareFileRangeList',
'ShareItem',
'ShareItemInternal',
'SharePermission',
'ShareProperties',
'SharePropertiesInternal',
'ShareProtocolSettings',
'ShareSmbSettings',
'ShareStats',
Expand All @@ -116,6 +117,7 @@
'LeaseDurationType',
'LeaseStateType',
'LeaseStatusType',
'ShareRootSquash',
'ShareAccessTier',
'PermissionCopyModeType',
'DeleteSnapshotsOptionType',
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 ShareRootSquash(str, Enum):

no_root_squash = "NoRootSquash"
root_squash = "RootSquash"
all_squash = "AllSquash"


class ShareAccessTier(str, Enum):

transaction_optimized = "TransactionOptimized"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ class ListSharesResponse(Model):
:param max_results:
:type max_results: int
:param share_items:
:type share_items: list[~azure.storage.fileshare.models.ShareItem]
:type share_items: list[~azure.storage.fileshare.models.ShareItemInternal]
:param next_marker: Required.
:type next_marker: str
"""
Expand All @@ -568,7 +568,7 @@ class ListSharesResponse(Model):
'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
'share_items': {'key': 'ShareItems', 'type': '[ShareItem]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
}
_xml_map = {
Expand Down Expand Up @@ -679,7 +679,7 @@ def __init__(self, **kwargs):
self.clear_ranges = kwargs.get('clear_ranges', None)


class ShareItem(Model):
class ShareItemInternal(Model):
"""A listed Azure Storage share item.

All required parameters must be populated in order to send to Azure.
Expand All @@ -693,7 +693,7 @@ class ShareItem(Model):
:param version:
:type version: str
:param properties: Required.
:type properties: ~azure.storage.fileshare.models.ShareProperties
:type properties: ~azure.storage.fileshare.models.SharePropertiesInternal
:param metadata:
:type metadata: dict[str, str]
"""
Expand All @@ -708,15 +708,15 @@ class ShareItem(Model):
'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'properties': {'key': 'Properties', 'type': 'ShareProperties', 'xml': {'name': 'Properties'}},
'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal', 'xml': {'name': 'Properties'}},
'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
}
_xml_map = {
'name': 'Share'
}

def __init__(self, **kwargs):
super(ShareItem, self).__init__(**kwargs)
super(ShareItemInternal, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.snapshot = kwargs.get('snapshot', None)
self.deleted = kwargs.get('deleted', None)
Expand Down Expand Up @@ -750,7 +750,7 @@ def __init__(self, **kwargs):
self.permission = kwargs.get('permission', None)


class ShareProperties(Model):
class SharePropertiesInternal(Model):
"""Properties of a share.

All required parameters must be populated in order to send to Azure.
Expand Down Expand Up @@ -787,6 +787,11 @@ class ShareProperties(Model):
:param lease_duration: Possible values include: 'infinite', 'fixed'
:type lease_duration: str or
~azure.storage.fileshare.models.LeaseDurationType
:param enabled_protocols:
:type enabled_protocols: str
:param root_squash: Possible values include: 'NoRootSquash', 'RootSquash',
'AllSquash'
:type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
"""

_validation = {
Expand All @@ -811,12 +816,14 @@ class ShareProperties(Model):
'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'}},
'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str', 'xml': {'name': 'EnabledProtocols'}},
'root_squash': {'key': 'RootSquash', 'type': 'ShareRootSquash', 'xml': {'name': 'RootSquash'}},
}
_xml_map = {
}

def __init__(self, **kwargs):
super(ShareProperties, self).__init__(**kwargs)
super(SharePropertiesInternal, self).__init__(**kwargs)
self.last_modified = kwargs.get('last_modified', None)
self.etag = kwargs.get('etag', None)
self.quota = kwargs.get('quota', None)
Expand All @@ -832,6 +839,8 @@ def __init__(self, **kwargs):
self.lease_status = kwargs.get('lease_status', None)
self.lease_state = kwargs.get('lease_state', None)
self.lease_duration = kwargs.get('lease_duration', None)
self.enabled_protocols = kwargs.get('enabled_protocols', None)
self.root_squash = kwargs.get('root_squash', None)


class ShareProtocolSettings(Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ class ListSharesResponse(Model):
:param max_results:
:type max_results: int
:param share_items:
:type share_items: list[~azure.storage.fileshare.models.ShareItem]
:type share_items: list[~azure.storage.fileshare.models.ShareItemInternal]
:param next_marker: Required.
:type next_marker: str
"""
Expand All @@ -568,7 +568,7 @@ class ListSharesResponse(Model):
'prefix': {'key': 'Prefix', 'type': 'str', 'xml': {'name': 'Prefix'}},
'marker': {'key': 'Marker', 'type': 'str', 'xml': {'name': 'Marker'}},
'max_results': {'key': 'MaxResults', 'type': 'int', 'xml': {'name': 'MaxResults'}},
'share_items': {'key': 'ShareItems', 'type': '[ShareItem]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
'share_items': {'key': 'ShareItems', 'type': '[ShareItemInternal]', 'xml': {'name': 'Shares', 'itemsName': 'Shares', 'wrapped': True}},
'next_marker': {'key': 'NextMarker', 'type': 'str', 'xml': {'name': 'NextMarker'}},
}
_xml_map = {
Expand Down Expand Up @@ -679,7 +679,7 @@ def __init__(self, *, ranges=None, clear_ranges=None, **kwargs) -> None:
self.clear_ranges = clear_ranges


class ShareItem(Model):
class ShareItemInternal(Model):
"""A listed Azure Storage share item.

All required parameters must be populated in order to send to Azure.
Expand All @@ -693,7 +693,7 @@ class ShareItem(Model):
:param version:
:type version: str
:param properties: Required.
:type properties: ~azure.storage.fileshare.models.ShareProperties
:type properties: ~azure.storage.fileshare.models.SharePropertiesInternal
:param metadata:
:type metadata: dict[str, str]
"""
Expand All @@ -708,15 +708,15 @@ class ShareItem(Model):
'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'properties': {'key': 'Properties', 'type': 'ShareProperties', 'xml': {'name': 'Properties'}},
'properties': {'key': 'Properties', 'type': 'SharePropertiesInternal', 'xml': {'name': 'Properties'}},
'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
}
_xml_map = {
'name': 'Share'
}

def __init__(self, *, name: str, properties, snapshot: str=None, deleted: bool=None, version: str=None, metadata=None, **kwargs) -> None:
super(ShareItem, self).__init__(**kwargs)
super(ShareItemInternal, self).__init__(**kwargs)
self.name = name
self.snapshot = snapshot
self.deleted = deleted
Expand Down Expand Up @@ -750,7 +750,7 @@ def __init__(self, *, permission: str, **kwargs) -> None:
self.permission = permission


class ShareProperties(Model):
class SharePropertiesInternal(Model):
"""Properties of a share.

All required parameters must be populated in order to send to Azure.
Expand Down Expand Up @@ -787,6 +787,11 @@ class ShareProperties(Model):
:param lease_duration: Possible values include: 'infinite', 'fixed'
:type lease_duration: str or
~azure.storage.fileshare.models.LeaseDurationType
:param enabled_protocols:
:type enabled_protocols: str
:param root_squash: Possible values include: 'NoRootSquash', 'RootSquash',
'AllSquash'
:type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash
"""

_validation = {
Expand All @@ -811,12 +816,14 @@ class ShareProperties(Model):
'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'}},
'enabled_protocols': {'key': 'EnabledProtocols', 'type': 'str', 'xml': {'name': 'EnabledProtocols'}},
'root_squash': {'key': 'RootSquash', 'type': 'ShareRootSquash', 'xml': {'name': 'RootSquash'}},
}
_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, 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)
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, enabled_protocols: str=None, root_squash=None, **kwargs) -> None:
super(SharePropertiesInternal, self).__init__(**kwargs)
self.last_modified = last_modified
self.etag = etag
self.quota = quota
Expand All @@ -832,6 +839,8 @@ def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: in
self.lease_status = lease_status
self.lease_state = lease_state
self.lease_duration = lease_duration
self.enabled_protocols = enabled_protocols
self.root_squash = root_squash


class ShareProtocolSettings(Model):
Expand Down
Loading