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

[AutoPR storage/resource-manager] Align File swagger with the Blob swagger #6884

Merged
merged 1 commit into from
Aug 28, 2019
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 @@ -31,7 +31,6 @@
from ._models_py3 import FileServiceProperties
from ._models_py3 import FileShare
from ._models_py3 import FileShareItem
from ._models_py3 import FileShareItems
from ._models_py3 import GeoReplicationStats
from ._models_py3 import Identity
from ._models_py3 import ImmutabilityPolicy
Expand Down Expand Up @@ -99,7 +98,6 @@
from ._models import FileServiceProperties
from ._models import FileShare
from ._models import FileShareItem
from ._models import FileShareItems
from ._models import GeoReplicationStats
from ._models import Identity
from ._models import ImmutabilityPolicy
Expand Down Expand Up @@ -146,6 +144,7 @@
from ._models import UsageName
from ._models import VirtualNetworkRule
from ._paged_models import BlobServicePropertiesPaged
from ._paged_models import FileShareItemPaged
from ._paged_models import ListContainerItemPaged
from ._paged_models import OperationPaged
from ._paged_models import SkuPaged
Expand Down Expand Up @@ -205,7 +204,6 @@
'FileServiceProperties',
'FileShare',
'FileShareItem',
'FileShareItems',
'GeoReplicationStats',
'Identity',
'ImmutabilityPolicy',
Expand Down Expand Up @@ -257,6 +255,7 @@
'UsagePaged',
'BlobServicePropertiesPaged',
'ListContainerItemPaged',
'FileShareItemPaged',
'ReasonCode',
'SkuName',
'SkuTier',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,37 +957,6 @@ def __init__(self, **kwargs):
self.share_quota = kwargs.get('share_quota', None)


class FileShareItems(Model):
"""Response schema. Contains list of shares returned, and if paging is
requested or required, a URL to next page of shares.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar value: List of file shares returned.
:vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileShareItem]
:ivar next_link: Request URL that can be used to query next page of
shares. Returned when total number of requested shares exceed maximum page
size.
:vartype next_link: str
"""

_validation = {
'value': {'readonly': True},
'next_link': {'readonly': True},
}

_attribute_map = {
'value': {'key': 'value', 'type': '[FileShareItem]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}

def __init__(self, **kwargs):
super(FileShareItems, self).__init__(**kwargs)
self.value = None
self.next_link = None


class GeoReplicationStats(Model):
"""Statistics related to replication for storage account's Blob, Table, Queue
and File services. It is only available when geo-redundant replication is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,37 +957,6 @@ def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None:
self.share_quota = share_quota


class FileShareItems(Model):
"""Response schema. Contains list of shares returned, and if paging is
requested or required, a URL to next page of shares.

Variables are only populated by the server, and will be ignored when
sending a request.

:ivar value: List of file shares returned.
:vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileShareItem]
:ivar next_link: Request URL that can be used to query next page of
shares. Returned when total number of requested shares exceed maximum page
size.
:vartype next_link: str
"""

_validation = {
'value': {'readonly': True},
'next_link': {'readonly': True},
}

_attribute_map = {
'value': {'key': 'value', 'type': '[FileShareItem]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
super(FileShareItems, self).__init__(**kwargs)
self.value = None
self.next_link = None


class GeoReplicationStats(Model):
"""Statistics related to replication for storage account's Blob, Table, Queue
and File services. It is only available when geo-redundant replication is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,16 @@ class ListContainerItemPaged(Paged):
def __init__(self, *args, **kwargs):

super(ListContainerItemPaged, self).__init__(*args, **kwargs)
class FileShareItemPaged(Paged):
"""
A paging container for iterating over a list of :class:`FileShareItem <azure.mgmt.storage.v2019_04_01.models.FileShareItem>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[FileShareItem]'}
}

def __init__(self, *args, **kwargs):

super(FileShareItemPaged, self).__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def list(
return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'}

def put_service_properties(
def set_service_properties(
self, resource_group_name, account_name, cors=None, custom_headers=None, raw=False, **operation_config):
"""Sets the properties of file services in storage accounts, including
CORS (Cross-Origin Resource Sharing) rules. .
Expand Down Expand Up @@ -134,7 +134,7 @@ def put_service_properties(
parameters = models.FileServiceProperties(cors=cors)

# Construct URL
url = self.put_service_properties.metadata['url']
url = self.set_service_properties.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3),
Expand Down Expand Up @@ -177,7 +177,7 @@ def put_service_properties(
return client_raw_response

return deserialized
put_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'}
set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'}

def get_service_properties(
self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,55 +63,66 @@ def list(
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: FileShareItems or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShareItems or
~msrest.pipeline.ClientRawResponse
:return: An iterator like instance of FileShareItem
:rtype:
~azure.mgmt.storage.v2019_04_01.models.FileShareItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItem]
:raises:
:class:`ErrorResponseException<azure.mgmt.storage.v2019_04_01.models.ErrorResponseException>`
"""
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)
if skip_token is not None:
query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str')
if maxpagesize is not None:
query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str')
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('FileShareItems', response)

def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)
if skip_token is not None:
query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str')
if maxpagesize is not None:
query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str')
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
return request

def internal_paging(next_link=None):
request = prepare_request(next_link)

response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

return response

# Deserialize response
header_dict = None
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
header_dict = {}
deserialized = models.FileShareItemPaged(internal_paging, self._deserialize.dependencies, header_dict)

return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'}
Expand Down