diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/__init__.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/__init__.py index 3886fa1dba1b..cbefffc4d583 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/__init__.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/__init__.py @@ -138,16 +138,16 @@ from ._data_share_management_client_enums import ( Type, ProvisioningState, - Status, + DataSetMappingStatus, + OutputType, InvitationStatus, - ShareKind, - SynchronizationMode, DataSetType, + Status, ShareSubscriptionStatus, RecurrenceInterval, + SynchronizationMode, TriggerStatus, - DataSetMappingStatus, - OutputType, + ShareKind, ) __all__ = [ @@ -211,26 +211,26 @@ 'DataSetMappingPaged', 'InvitationPaged', 'OperationModelPaged', - 'SharePaged', - 'ShareSynchronizationPaged', 'SynchronizationDetailsPaged', + 'ShareSynchronizationPaged', + 'SharePaged', 'ProviderShareSubscriptionPaged', - 'ShareSubscriptionPaged', 'SourceShareSynchronizationSettingPaged', 'ShareSubscriptionSynchronizationPaged', + 'ShareSubscriptionPaged', 'ConsumerSourceDataSetPaged', 'SynchronizationSettingPaged', 'TriggerPaged', 'Type', 'ProvisioningState', - 'Status', + 'DataSetMappingStatus', + 'OutputType', 'InvitationStatus', - 'ShareKind', - 'SynchronizationMode', 'DataSetType', + 'Status', 'ShareSubscriptionStatus', 'RecurrenceInterval', + 'SynchronizationMode', 'TriggerStatus', - 'DataSetMappingStatus', - 'OutputType', + 'ShareKind', ] diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_data_share_management_client_enums.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_data_share_management_client_enums.py index 84d018a2e46b..371a6751d3a2 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_data_share_management_client_enums.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_data_share_management_client_enums.py @@ -26,14 +26,16 @@ class ProvisioningState(str, Enum): failed = "Failed" -class Status(str, Enum): +class DataSetMappingStatus(str, Enum): - accepted = "Accepted" - in_progress = "InProgress" - transient_failure = "TransientFailure" - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" + ok = "Ok" + broken = "Broken" + + +class OutputType(str, Enum): + + csv = "Csv" + parquet = "Parquet" class InvitationStatus(str, Enum): @@ -44,18 +46,6 @@ class InvitationStatus(str, Enum): withdrawn = "Withdrawn" -class ShareKind(str, Enum): - - copy_based = "CopyBased" - in_place = "InPlace" - - -class SynchronizationMode(str, Enum): - - incremental = "Incremental" - full_sync = "FullSync" - - class DataSetType(str, Enum): blob = "Blob" @@ -72,6 +62,16 @@ class DataSetType(str, Enum): sql_dw_table = "SqlDWTable" +class Status(str, Enum): + + accepted = "Accepted" + in_progress = "InProgress" + transient_failure = "TransientFailure" + succeeded = "Succeeded" + failed = "Failed" + canceled = "Canceled" + + class ShareSubscriptionStatus(str, Enum): active = "Active" @@ -86,6 +86,12 @@ class RecurrenceInterval(str, Enum): day = "Day" +class SynchronizationMode(str, Enum): + + incremental = "Incremental" + full_sync = "FullSync" + + class TriggerStatus(str, Enum): active = "Active" @@ -93,13 +99,7 @@ class TriggerStatus(str, Enum): source_synchronization_setting_deleted = "SourceSynchronizationSettingDeleted" -class DataSetMappingStatus(str, Enum): - - ok = "Ok" - broken = "Broken" - - -class OutputType(str, Enum): +class ShareKind(str, Enum): - csv = "Csv" - parquet = "Parquet" + copy_based = "CopyBased" + in_place = "InPlace" diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models.py index b67c05eb25df..2bd5041e433b 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models.py @@ -172,10 +172,10 @@ class DataSet(ProxyDto): """A DataSet data transfer object. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BlobDataSet, BlobFolderDataSet, BlobContainerDataSet, - ADLSGen2FileDataSet, ADLSGen2FolderDataSet, ADLSGen2FileSystemDataSet, - ADLSGen1FolderDataSet, ADLSGen1FileDataSet, KustoClusterDataSet, - KustoDatabaseDataSet, SqlDWTableDataSet, SqlDBTableDataSet + sub-classes are: ADLSGen1FileDataSet, ADLSGen1FolderDataSet, + ADLSGen2FileDataSet, ADLSGen2FileSystemDataSet, ADLSGen2FolderDataSet, + BlobContainerDataSet, BlobDataSet, BlobFolderDataSet, KustoClusterDataSet, + KustoDatabaseDataSet, SqlDBTableDataSet, SqlDWTableDataSet Variables are only populated by the server, and will be ignored when sending a request. @@ -207,7 +207,7 @@ class DataSet(ProxyDto): } _subtype_map = { - 'kind': {'Blob': 'BlobDataSet', 'BlobFolder': 'BlobFolderDataSet', 'Container': 'BlobContainerDataSet', 'AdlsGen2File': 'ADLSGen2FileDataSet', 'AdlsGen2Folder': 'ADLSGen2FolderDataSet', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSet', 'AdlsGen1Folder': 'ADLSGen1FolderDataSet', 'AdlsGen1File': 'ADLSGen1FileDataSet', 'KustoCluster': 'KustoClusterDataSet', 'KustoDatabase': 'KustoDatabaseDataSet', 'SqlDWTable': 'SqlDWTableDataSet', 'SqlDBTable': 'SqlDBTableDataSet'} + 'kind': {'AdlsGen1File': 'ADLSGen1FileDataSet', 'AdlsGen1Folder': 'ADLSGen1FolderDataSet', 'AdlsGen2File': 'ADLSGen2FileDataSet', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSet', 'AdlsGen2Folder': 'ADLSGen2FolderDataSet', 'Container': 'BlobContainerDataSet', 'Blob': 'BlobDataSet', 'BlobFolder': 'BlobFolderDataSet', 'KustoCluster': 'KustoClusterDataSet', 'KustoDatabase': 'KustoDatabaseDataSet', 'SqlDBTable': 'SqlDBTableDataSet', 'SqlDWTable': 'SqlDWTableDataSet'} } def __init__(self, **kwargs): @@ -417,11 +417,11 @@ class DataSetMapping(ProxyDto): """A data set mapping data transfer object. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BlobDataSetMapping, BlobFolderDataSetMapping, - BlobContainerDataSetMapping, ADLSGen2FileDataSetMapping, - ADLSGen2FolderDataSetMapping, ADLSGen2FileSystemDataSetMapping, + sub-classes are: ADLSGen2FileDataSetMapping, + ADLSGen2FileSystemDataSetMapping, ADLSGen2FolderDataSetMapping, + BlobContainerDataSetMapping, BlobDataSetMapping, BlobFolderDataSetMapping, KustoClusterDataSetMapping, KustoDatabaseDataSetMapping, - SqlDWTableDataSetMapping, SqlDBTableDataSetMapping + SqlDBTableDataSetMapping, SqlDWTableDataSetMapping Variables are only populated by the server, and will be ignored when sending a request. @@ -453,7 +453,7 @@ class DataSetMapping(ProxyDto): } _subtype_map = { - 'kind': {'Blob': 'BlobDataSetMapping', 'BlobFolder': 'BlobFolderDataSetMapping', 'Container': 'BlobContainerDataSetMapping', 'AdlsGen2File': 'ADLSGen2FileDataSetMapping', 'AdlsGen2Folder': 'ADLSGen2FolderDataSetMapping', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSetMapping', 'KustoCluster': 'KustoClusterDataSetMapping', 'KustoDatabase': 'KustoDatabaseDataSetMapping', 'SqlDWTable': 'SqlDWTableDataSetMapping', 'SqlDBTable': 'SqlDBTableDataSetMapping'} + 'kind': {'AdlsGen2File': 'ADLSGen2FileDataSetMapping', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSetMapping', 'AdlsGen2Folder': 'ADLSGen2FolderDataSetMapping', 'Container': 'BlobContainerDataSetMapping', 'Blob': 'BlobDataSetMapping', 'BlobFolder': 'BlobFolderDataSetMapping', 'KustoCluster': 'KustoClusterDataSetMapping', 'KustoDatabase': 'KustoDatabaseDataSetMapping', 'SqlDBTable': 'SqlDBTableDataSetMapping', 'SqlDWTable': 'SqlDWTableDataSetMapping'} } def __init__(self, **kwargs): diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models_py3.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models_py3.py index 91cd2c4d872c..c837df5b173d 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models_py3.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_models_py3.py @@ -172,10 +172,10 @@ class DataSet(ProxyDto): """A DataSet data transfer object. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BlobDataSet, BlobFolderDataSet, BlobContainerDataSet, - ADLSGen2FileDataSet, ADLSGen2FolderDataSet, ADLSGen2FileSystemDataSet, - ADLSGen1FolderDataSet, ADLSGen1FileDataSet, KustoClusterDataSet, - KustoDatabaseDataSet, SqlDWTableDataSet, SqlDBTableDataSet + sub-classes are: ADLSGen1FileDataSet, ADLSGen1FolderDataSet, + ADLSGen2FileDataSet, ADLSGen2FileSystemDataSet, ADLSGen2FolderDataSet, + BlobContainerDataSet, BlobDataSet, BlobFolderDataSet, KustoClusterDataSet, + KustoDatabaseDataSet, SqlDBTableDataSet, SqlDWTableDataSet Variables are only populated by the server, and will be ignored when sending a request. @@ -207,7 +207,7 @@ class DataSet(ProxyDto): } _subtype_map = { - 'kind': {'Blob': 'BlobDataSet', 'BlobFolder': 'BlobFolderDataSet', 'Container': 'BlobContainerDataSet', 'AdlsGen2File': 'ADLSGen2FileDataSet', 'AdlsGen2Folder': 'ADLSGen2FolderDataSet', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSet', 'AdlsGen1Folder': 'ADLSGen1FolderDataSet', 'AdlsGen1File': 'ADLSGen1FileDataSet', 'KustoCluster': 'KustoClusterDataSet', 'KustoDatabase': 'KustoDatabaseDataSet', 'SqlDWTable': 'SqlDWTableDataSet', 'SqlDBTable': 'SqlDBTableDataSet'} + 'kind': {'AdlsGen1File': 'ADLSGen1FileDataSet', 'AdlsGen1Folder': 'ADLSGen1FolderDataSet', 'AdlsGen2File': 'ADLSGen2FileDataSet', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSet', 'AdlsGen2Folder': 'ADLSGen2FolderDataSet', 'Container': 'BlobContainerDataSet', 'Blob': 'BlobDataSet', 'BlobFolder': 'BlobFolderDataSet', 'KustoCluster': 'KustoClusterDataSet', 'KustoDatabase': 'KustoDatabaseDataSet', 'SqlDBTable': 'SqlDBTableDataSet', 'SqlDWTable': 'SqlDWTableDataSet'} } def __init__(self, **kwargs) -> None: @@ -417,11 +417,11 @@ class DataSetMapping(ProxyDto): """A data set mapping data transfer object. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BlobDataSetMapping, BlobFolderDataSetMapping, - BlobContainerDataSetMapping, ADLSGen2FileDataSetMapping, - ADLSGen2FolderDataSetMapping, ADLSGen2FileSystemDataSetMapping, + sub-classes are: ADLSGen2FileDataSetMapping, + ADLSGen2FileSystemDataSetMapping, ADLSGen2FolderDataSetMapping, + BlobContainerDataSetMapping, BlobDataSetMapping, BlobFolderDataSetMapping, KustoClusterDataSetMapping, KustoDatabaseDataSetMapping, - SqlDWTableDataSetMapping, SqlDBTableDataSetMapping + SqlDBTableDataSetMapping, SqlDWTableDataSetMapping Variables are only populated by the server, and will be ignored when sending a request. @@ -453,7 +453,7 @@ class DataSetMapping(ProxyDto): } _subtype_map = { - 'kind': {'Blob': 'BlobDataSetMapping', 'BlobFolder': 'BlobFolderDataSetMapping', 'Container': 'BlobContainerDataSetMapping', 'AdlsGen2File': 'ADLSGen2FileDataSetMapping', 'AdlsGen2Folder': 'ADLSGen2FolderDataSetMapping', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSetMapping', 'KustoCluster': 'KustoClusterDataSetMapping', 'KustoDatabase': 'KustoDatabaseDataSetMapping', 'SqlDWTable': 'SqlDWTableDataSetMapping', 'SqlDBTable': 'SqlDBTableDataSetMapping'} + 'kind': {'AdlsGen2File': 'ADLSGen2FileDataSetMapping', 'AdlsGen2FileSystem': 'ADLSGen2FileSystemDataSetMapping', 'AdlsGen2Folder': 'ADLSGen2FolderDataSetMapping', 'Container': 'BlobContainerDataSetMapping', 'Blob': 'BlobDataSetMapping', 'BlobFolder': 'BlobFolderDataSetMapping', 'KustoCluster': 'KustoClusterDataSetMapping', 'KustoDatabase': 'KustoDatabaseDataSetMapping', 'SqlDBTable': 'SqlDBTableDataSetMapping', 'SqlDWTable': 'SqlDWTableDataSetMapping'} } def __init__(self, **kwargs) -> None: diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_paged_models.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_paged_models.py index ade4b8a64811..1238d5d91882 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_paged_models.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/models/_paged_models.py @@ -90,19 +90,19 @@ class OperationModelPaged(Paged): def __init__(self, *args, **kwargs): super(OperationModelPaged, self).__init__(*args, **kwargs) -class SharePaged(Paged): +class SynchronizationDetailsPaged(Paged): """ - A paging container for iterating over a list of :class:`Share ` object + A paging container for iterating over a list of :class:`SynchronizationDetails ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Share]'} + 'current_page': {'key': 'value', 'type': '[SynchronizationDetails]'} } def __init__(self, *args, **kwargs): - super(SharePaged, self).__init__(*args, **kwargs) + super(SynchronizationDetailsPaged, self).__init__(*args, **kwargs) class ShareSynchronizationPaged(Paged): """ A paging container for iterating over a list of :class:`ShareSynchronization ` object @@ -116,19 +116,19 @@ class ShareSynchronizationPaged(Paged): def __init__(self, *args, **kwargs): super(ShareSynchronizationPaged, self).__init__(*args, **kwargs) -class SynchronizationDetailsPaged(Paged): +class SharePaged(Paged): """ - A paging container for iterating over a list of :class:`SynchronizationDetails ` object + A paging container for iterating over a list of :class:`Share ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SynchronizationDetails]'} + 'current_page': {'key': 'value', 'type': '[Share]'} } def __init__(self, *args, **kwargs): - super(SynchronizationDetailsPaged, self).__init__(*args, **kwargs) + super(SharePaged, self).__init__(*args, **kwargs) class ProviderShareSubscriptionPaged(Paged): """ A paging container for iterating over a list of :class:`ProviderShareSubscription ` object @@ -142,45 +142,45 @@ class ProviderShareSubscriptionPaged(Paged): def __init__(self, *args, **kwargs): super(ProviderShareSubscriptionPaged, self).__init__(*args, **kwargs) -class ShareSubscriptionPaged(Paged): +class SourceShareSynchronizationSettingPaged(Paged): """ - A paging container for iterating over a list of :class:`ShareSubscription ` object + A paging container for iterating over a list of :class:`SourceShareSynchronizationSetting ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ShareSubscription]'} + 'current_page': {'key': 'value', 'type': '[SourceShareSynchronizationSetting]'} } def __init__(self, *args, **kwargs): - super(ShareSubscriptionPaged, self).__init__(*args, **kwargs) -class SourceShareSynchronizationSettingPaged(Paged): + super(SourceShareSynchronizationSettingPaged, self).__init__(*args, **kwargs) +class ShareSubscriptionSynchronizationPaged(Paged): """ - A paging container for iterating over a list of :class:`SourceShareSynchronizationSetting ` object + A paging container for iterating over a list of :class:`ShareSubscriptionSynchronization ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SourceShareSynchronizationSetting]'} + 'current_page': {'key': 'value', 'type': '[ShareSubscriptionSynchronization]'} } def __init__(self, *args, **kwargs): - super(SourceShareSynchronizationSettingPaged, self).__init__(*args, **kwargs) -class ShareSubscriptionSynchronizationPaged(Paged): + super(ShareSubscriptionSynchronizationPaged, self).__init__(*args, **kwargs) +class ShareSubscriptionPaged(Paged): """ - A paging container for iterating over a list of :class:`ShareSubscriptionSynchronization ` object + A paging container for iterating over a list of :class:`ShareSubscription ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ShareSubscriptionSynchronization]'} + 'current_page': {'key': 'value', 'type': '[ShareSubscription]'} } def __init__(self, *args, **kwargs): - super(ShareSubscriptionSynchronizationPaged, self).__init__(*args, **kwargs) + super(ShareSubscriptionPaged, self).__init__(*args, **kwargs) class ConsumerSourceDataSetPaged(Paged): """ A paging container for iterating over a list of :class:`ConsumerSourceDataSet ` object diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_accounts_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_accounts_operations.py index 247999b1aad7..1ceb7fe9d923 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_accounts_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_accounts_operations.py @@ -40,6 +40,77 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_by_subscription( + self, skip_token=None, custom_headers=None, raw=False, **operation_config): + """List Accounts in a subscription. + + List Accounts in Subscription. + + :param skip_token: Continuation token + :type skip_token: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Account + :rtype: + ~azure.mgmt.datashare.models.AccountPaged[~azure.mgmt.datashare.models.Account] + :raises: + :class:`DataShareErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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.DataShareErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AccountPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} + def get( self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): """Get an account under a resource group. @@ -369,77 +440,6 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}'} - def list_by_subscription( - self, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List Accounts in a subscription. - - List Accounts in Subscription. - - :param skip_token: Continuation token - :type skip_token: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Account - :rtype: - ~azure.mgmt.datashare.models.AccountPaged[~azure.mgmt.datashare.models.Account] - :raises: - :class:`DataShareErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - 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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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.DataShareErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AccountPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} - def list_by_resource_group( self, resource_group_name, skip_token=None, custom_headers=None, raw=False, **operation_config): """List Accounts in a resource group. diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_consumer_invitations_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_consumer_invitations_operations.py index babbd197d2b7..18c025534081 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_consumer_invitations_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_consumer_invitations_operations.py @@ -38,71 +38,72 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def reject_invitation( - self, location, invitation_id, custom_headers=None, raw=False, **operation_config): - """Rejects the invitation identified by invitationId. + def list_invitations( + self, skip_token=None, custom_headers=None, raw=False, **operation_config): + """List the invitations. - Reject an invitation. + Lists invitations. - :param location: Location of the invitation - :type location: str - :param invitation_id: Unique id of the invitation. - :type invitation_id: str + :param skip_token: The continuation token + :type skip_token: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ConsumerInvitation or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.datashare.models.ConsumerInvitation or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of ConsumerInvitation + :rtype: + ~azure.mgmt.datashare.models.ConsumerInvitationPaged[~azure.mgmt.datashare.models.ConsumerInvitation] :raises: :class:`DataShareErrorException` """ - invitation = models.ConsumerInvitation(invitation_id=invitation_id) + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_invitations.metadata['url'] - # Construct URL - url = self.reject_invitation.metadata['url'] - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str') - } - 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + else: + url = next_link + query_parameters = {} - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - 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 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 body - body_content = self._serialize.body(invitation, 'ConsumerInvitation') + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + def internal_paging(next_link=None): + request = prepare_request(next_link) - if response.status_code not in [200]: - raise models.DataShareErrorException(self._deserialize, response) + response = self._client.send(request, stream=False, **operation_config) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConsumerInvitation', response) + if response.status_code not in [200]: + raise models.DataShareErrorException(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.ConsumerInvitationPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} + list_invitations.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} def get( self, location, invitation_id, custom_headers=None, raw=False, **operation_config): @@ -165,69 +166,68 @@ def get( return deserialized get.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}'} - def list_invitations( - self, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List the invitations. + def reject_invitation( + self, location, invitation_id, custom_headers=None, raw=False, **operation_config): + """Rejects the invitation identified by invitationId. - Lists invitations. + Reject an invitation. - :param skip_token: The continuation token - :type skip_token: str + :param location: Location of the invitation + :type location: str + :param invitation_id: Unique id of the invitation. + :type invitation_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of ConsumerInvitation - :rtype: - ~azure.mgmt.datashare.models.ConsumerInvitationPaged[~azure.mgmt.datashare.models.ConsumerInvitation] + :return: ConsumerInvitation or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.datashare.models.ConsumerInvitation or + ~msrest.pipeline.ClientRawResponse :raises: :class:`DataShareErrorException` """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_invitations.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + invitation = models.ConsumerInvitation(invitation_id=invitation_id) - else: - url = next_link - query_parameters = {} + # Construct URL + url = self.reject_invitation.metadata['url'] + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str') + } + url = self._client.format_url(url, **path_format_arguments) - # 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 parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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') - def internal_paging(next_link=None): - request = prepare_request(next_link) + # Construct body + body_content = self._serialize.body(invitation, 'ConsumerInvitation') - response = self._client.send(request, stream=False, **operation_config) + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: - raise models.DataShareErrorException(self._deserialize, response) + if response.status_code not in [200]: + raise models.DataShareErrorException(self._deserialize, response) - return response + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ConsumerInvitation', response) - # Deserialize response - header_dict = None if raw: - header_dict = {} - deserialized = models.ConsumerInvitationPaged(internal_paging, self._deserialize.dependencies, header_dict) + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response return deserialized - list_invitations.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} + reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_set_mappings_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_set_mappings_operations.py index c8cd5cf2906f..3127f072631f 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_set_mappings_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_set_mappings_operations.py @@ -247,7 +247,7 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}'} def list_by_share_subscription( - self, resource_group_name, account_name, share_subscription_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_subscription_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): """List DataSetMappings in a share subscription. List DataSetMappings in a share subscription. @@ -260,6 +260,10 @@ def list_by_share_subscription( :type share_subscription_name: str :param skip_token: Continuation token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -288,6 +292,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_sets_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_sets_operations.py index df50352d19d3..3cb6417fd9eb 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_sets_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_data_sets_operations.py @@ -273,7 +273,7 @@ def get_long_running_output(response): delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}'} def list_by_share( - self, resource_group_name, account_name, share_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): """List DataSets in a share. List DataSets in a share. @@ -286,6 +286,10 @@ def list_by_share( :type share_name: str :param skip_token: continuation token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -314,6 +318,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_invitations_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_invitations_operations.py index 19d8707745e6..25131ebd2b91 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_invitations_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_invitations_operations.py @@ -243,7 +243,7 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/invitations/{invitationName}'} def list_by_share( - self, resource_group_name, account_name, share_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): """List all Invitations in a share. List invitations in a share. @@ -256,6 +256,10 @@ def list_by_share( :type share_name: str :param skip_token: The continuation token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -284,6 +288,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_provider_share_subscriptions_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_provider_share_subscriptions_operations.py index e7ee3aec5a69..6edc33cc1d50 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_provider_share_subscriptions_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_provider_share_subscriptions_operations.py @@ -40,11 +40,11 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get_by_share( + def reinstate( self, resource_group_name, account_name, share_name, provider_share_subscription_id, custom_headers=None, raw=False, **operation_config): - """Get share subscription in a provider share. + """Reinstate share subscription in a provider share. - Get share subscription in a provider share. + Reinstate share subscription in a provider share. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -66,7 +66,7 @@ def get_by_share( :class:`DataShareErrorException` """ # Construct URL - url = self.get_by_share.metadata['url'] + url = self.reinstate.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -91,7 +91,7 @@ def get_by_share( 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) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -106,87 +106,7 @@ def get_by_share( return client_raw_response return deserialized - get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} - - def list_by_share( - self, resource_group_name, account_name, share_name, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List of available share subscriptions to a provider share. - - List share subscriptions in a provider share. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_name: The name of the share. - :type share_name: str - :param skip_token: Continuation Token - :type skip_token: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ProviderShareSubscription - :rtype: - ~azure.mgmt.datashare.models.ProviderShareSubscriptionPaged[~azure.mgmt.datashare.models.ProviderShareSubscription] - :raises: - :class:`DataShareErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_share.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareName': self._serialize.url("share_name", share_name, 'str') - } - 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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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.DataShareErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ProviderShareSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} + reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} def _revoke_initial( @@ -293,11 +213,11 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) revoke.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/revoke'} - def reinstate( + def get_by_share( self, resource_group_name, account_name, share_name, provider_share_subscription_id, custom_headers=None, raw=False, **operation_config): - """Reinstate share subscription in a provider share. + """Get share subscription in a provider share. - Reinstate share subscription in a provider share. + Get share subscription in a provider share. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -319,7 +239,7 @@ def reinstate( :class:`DataShareErrorException` """ # Construct URL - url = self.reinstate.metadata['url'] + url = self.get_by_share.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -344,7 +264,7 @@ def reinstate( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + 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]: @@ -359,4 +279,84 @@ def reinstate( return client_raw_response return deserialized - reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} + get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} + + def list_by_share( + self, resource_group_name, account_name, share_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + """List of available share subscriptions to a provider share. + + List share subscriptions in a provider share. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param share_name: The name of the share. + :type share_name: str + :param skip_token: Continuation Token + :type skip_token: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ProviderShareSubscription + :rtype: + ~azure.mgmt.datashare.models.ProviderShareSubscriptionPaged[~azure.mgmt.datashare.models.ProviderShareSubscription] + :raises: + :class:`DataShareErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_share.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareName': self._serialize.url("share_name", share_name, 'str') + } + 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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.DataShareErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ProviderShareSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_share_subscriptions_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_share_subscriptions_operations.py index c78cc7dab0c3..66c7ab19d301 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_share_subscriptions_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_share_subscriptions_operations.py @@ -40,102 +40,13 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get( - self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, **operation_config): - """Get shareSubscription in an account. - - Get a shareSubscription in an account. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_subscription_name: The name of the shareSubscription. - :type share_subscription_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ShareSubscription or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.datashare.models.ShareSubscription or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DataShareErrorException` - """ - # Construct URL - url = self.get.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') - } - 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') - - # 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.DataShareErrorException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ShareSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} - def create( - self, resource_group_name, account_name, share_subscription_name, invitation_id, source_share_location, custom_headers=None, raw=False, **operation_config): - """Create shareSubscription in an account. - - Create a shareSubscription in an account. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_subscription_name: The name of the shareSubscription. - :type share_subscription_name: str - :param invitation_id: The invitation id. - :type invitation_id: str - :param source_share_location: Source share location. - :type source_share_location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ShareSubscription or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.datashare.models.ShareSubscription or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`DataShareErrorException` - """ - share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) + def _cancel_synchronization_initial( + self, resource_group_name, account_name, share_subscription_name, synchronization_id, custom_headers=None, raw=False, **operation_config): + share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) # Construct URL - url = self.create.metadata['url'] + url = self.cancel_synchronization.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -160,66 +71,21 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(share_subscription, 'ShareSubscription') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 201]: - raise models.DataShareErrorException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ShareSubscription', response) - if response.status_code == 201: - deserialized = self._deserialize('ShareSubscription', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} - - - def _delete_initial( - self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') - } - 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') - - # 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') + body_content = self._serialize.body(share_subscription_synchronization, 'ShareSubscriptionSynchronization') # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 202, 204]: + if response.status_code not in [200, 202]: raise models.DataShareErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('OperationResponse', response) + deserialized = self._deserialize('ShareSubscriptionSynchronization', response) + if response.status_code == 202: + deserialized = self._deserialize('ShareSubscriptionSynchronization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -227,11 +93,11 @@ def _delete_initial( return deserialized - def delete( - self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete shareSubscription in an account. + def cancel_synchronization( + self, resource_group_name, account_name, share_subscription_name, synchronization_id, custom_headers=None, raw=False, polling=True, **operation_config): + """Request cancellation of a data share snapshot. - Delete a shareSubscription in an account. + Request to cancel a synchronization. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -239,31 +105,35 @@ def delete( :type account_name: str :param share_subscription_name: The name of the shareSubscription. :type share_subscription_name: str + :param synchronization_id: Synchronization id + :type synchronization_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns OperationResponse or - ClientRawResponse if raw==True + :return: An instance of LROPoller that returns + ShareSubscriptionSynchronization or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.datashare.models.OperationResponse] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.datashare.models.ShareSubscriptionSynchronization] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.datashare.models.OperationResponse]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.datashare.models.ShareSubscriptionSynchronization]] :raises: :class:`DataShareErrorException` """ - raw_result = self._delete_initial( + raw_result = self._cancel_synchronization_initial( resource_group_name=resource_group_name, account_name=account_name, share_subscription_name=share_subscription_name, + synchronization_id=synchronization_id, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): - deserialized = self._deserialize('OperationResponse', response) + deserialized = self._deserialize('ShareSubscriptionSynchronization', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -274,43 +144,47 @@ def get_long_running_output(response): lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} + cancel_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} - def list_by_account( - self, resource_group_name, account_name, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List of available share subscriptions under an account. + def list_source_share_synchronization_settings( + self, resource_group_name, account_name, share_subscription_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + """Get source share synchronization settings for a shareSubscription. - List share subscriptions in an account. + Get synchronization settings set on a share. :param resource_group_name: The resource group name. :type resource_group_name: str :param account_name: The name of the share account. :type account_name: str - :param skip_token: Continuation Token + :param share_subscription_name: The name of the shareSubscription. + :type share_subscription_name: str + :param skip_token: Continuation token :type skip_token: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of ShareSubscription + :return: An iterator like instance of + SourceShareSynchronizationSetting :rtype: - ~azure.mgmt.datashare.models.ShareSubscriptionPaged[~azure.mgmt.datashare.models.ShareSubscription] + ~azure.mgmt.datashare.models.SourceShareSynchronizationSettingPaged[~azure.mgmt.datashare.models.SourceShareSynchronizationSetting] :raises: :class:`DataShareErrorException` """ def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_account.metadata['url'] + url = self.list_source_share_synchronization_settings.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str') + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -335,7 +209,7 @@ def prepare_request(next_link=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) + request = self._client.post(url, query_parameters, header_parameters) return request def internal_paging(next_link=None): @@ -352,41 +226,48 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.ShareSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.SourceShareSynchronizationSettingPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} + list_source_share_synchronization_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} - def list_source_share_synchronization_settings( - self, resource_group_name, account_name, share_subscription_name, skip_token=None, custom_headers=None, raw=False, **operation_config): - """Get source share synchronization settings for a shareSubscription. + def list_synchronization_details( + self, resource_group_name, account_name, share_subscription_name, synchronization_id, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + """List data set level details for a share subscription synchronization. - Get synchronization settings set on a share. + List synchronization details. :param resource_group_name: The resource group name. :type resource_group_name: str :param account_name: The name of the share account. :type account_name: str - :param share_subscription_name: The name of the shareSubscription. + :param share_subscription_name: The name of the share subscription. :type share_subscription_name: str + :param synchronization_id: Synchronization id + :type synchronization_id: str :param skip_token: Continuation token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: An iterator like instance of - SourceShareSynchronizationSetting + :return: An iterator like instance of SynchronizationDetails :rtype: - ~azure.mgmt.datashare.models.SourceShareSynchronizationSettingPaged[~azure.mgmt.datashare.models.SourceShareSynchronizationSetting] + ~azure.mgmt.datashare.models.SynchronizationDetailsPaged[~azure.mgmt.datashare.models.SynchronizationDetails] :raises: :class:`DataShareErrorException` """ + share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) + def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_source_share_synchronization_settings.metadata['url'] + url = self.list_synchronization_details.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -400,6 +281,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link @@ -408,6 +293,7 @@ def prepare_request(next_link=None): # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -415,8 +301,11 @@ def prepare_request(next_link=None): 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 body + body_content = self._serialize.body(share_subscription_synchronization, 'ShareSubscriptionSynchronization') + # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) return request def internal_paging(next_link=None): @@ -433,13 +322,13 @@ def internal_paging(next_link=None): header_dict = None if raw: header_dict = {} - deserialized = models.SourceShareSynchronizationSettingPaged(internal_paging, self._deserialize.dependencies, header_dict) + deserialized = models.SynchronizationDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized - list_source_share_synchronization_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} + list_synchronization_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} def list_synchronizations( - self, resource_group_name, account_name, share_subscription_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_subscription_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): """List Synchronizations in a share subscription. List synchronizations of a share subscription. @@ -452,6 +341,10 @@ def list_synchronizations( :type share_subscription_name: str :param skip_token: Continuation token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -480,6 +373,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link @@ -518,98 +415,10 @@ def internal_paging(next_link=None): return deserialized list_synchronizations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizations'} - def list_synchronization_details( - self, resource_group_name, account_name, share_subscription_name, synchronization_id, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List data set level details for a share subscription synchronization. - List synchronization details. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_subscription_name: The name of the share subscription. - :type share_subscription_name: str - :param synchronization_id: Synchronization id - :type synchronization_id: str - :param skip_token: Continuation token - :type skip_token: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SynchronizationDetails - :rtype: - ~azure.mgmt.datashare.models.SynchronizationDetailsPaged[~azure.mgmt.datashare.models.SynchronizationDetails] - :raises: - :class:`DataShareErrorException` - """ - share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_details.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') - } - 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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - 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 body - body_content = self._serialize.body(share_subscription_synchronization, 'ShareSubscriptionSynchronization') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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.DataShareErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SynchronizationDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_synchronization_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} - - - def _synchronize_method_initial( - self, resource_group_name, account_name, share_subscription_name, synchronization_mode=None, custom_headers=None, raw=False, **operation_config): - synchronize = models.Synchronize(synchronization_mode=synchronization_mode) + def _synchronize_method_initial( + self, resource_group_name, account_name, share_subscription_name, synchronization_mode=None, custom_headers=None, raw=False, **operation_config): + synchronize = models.Synchronize(synchronization_mode=synchronization_mode) # Construct URL url = self.synchronize_method.metadata['url'] @@ -719,13 +528,102 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) synchronize_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/Synchronize'} + def get( + self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, **operation_config): + """Get shareSubscription in an account. - def _cancel_synchronization_initial( - self, resource_group_name, account_name, share_subscription_name, synchronization_id, custom_headers=None, raw=False, **operation_config): - share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) + Get a shareSubscription in an account. + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param share_subscription_name: The name of the shareSubscription. + :type share_subscription_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ShareSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.datashare.models.ShareSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DataShareErrorException` + """ # Construct URL - url = self.cancel_synchronization.metadata['url'] + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') + } + 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') + + # 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.DataShareErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ShareSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} + + def create( + self, resource_group_name, account_name, share_subscription_name, invitation_id, source_share_location, custom_headers=None, raw=False, **operation_config): + """Create shareSubscription in an account. + + Create a shareSubscription in an account. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param share_subscription_name: The name of the shareSubscription. + :type share_subscription_name: str + :param invitation_id: The invitation id. + :type invitation_id: str + :param source_share_location: Source share location. + :type source_share_location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ShareSubscription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.datashare.models.ShareSubscription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`DataShareErrorException` + """ + share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) + + # Construct URL + url = self.create.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -750,21 +648,66 @@ def _cancel_synchronization_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(share_subscription_synchronization, 'ShareSubscriptionSynchronization') + body_content = self._serialize.body(share_subscription, 'ShareSubscription') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: + raise models.DataShareErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ShareSubscription', response) + if response.status_code == 201: + deserialized = self._deserialize('ShareSubscription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} + + + def _delete_initial( + self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareSubscriptionName': self._serialize.url("share_subscription_name", share_subscription_name, 'str') + } + 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') + + # 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.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: raise models.DataShareErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ShareSubscriptionSynchronization', response) - if response.status_code == 202: - deserialized = self._deserialize('ShareSubscriptionSynchronization', response) + deserialized = self._deserialize('OperationResponse', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -772,11 +715,11 @@ def _cancel_synchronization_initial( return deserialized - def cancel_synchronization( - self, resource_group_name, account_name, share_subscription_name, synchronization_id, custom_headers=None, raw=False, polling=True, **operation_config): - """Request cancellation of a data share snapshot. + def delete( + self, resource_group_name, account_name, share_subscription_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Delete shareSubscription in an account. - Request to cancel a synchronization. + Delete a shareSubscription in an account. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -784,35 +727,31 @@ def cancel_synchronization( :type account_name: str :param share_subscription_name: The name of the shareSubscription. :type share_subscription_name: str - :param synchronization_id: Synchronization id - :type synchronization_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - ShareSubscriptionSynchronization or - ClientRawResponse if raw==True + :return: An instance of LROPoller that returns OperationResponse or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.datashare.models.ShareSubscriptionSynchronization] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.datashare.models.OperationResponse] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.datashare.models.ShareSubscriptionSynchronization]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.datashare.models.OperationResponse]] :raises: :class:`DataShareErrorException` """ - raw_result = self._cancel_synchronization_initial( + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, share_subscription_name=share_subscription_name, - synchronization_id=synchronization_id, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): - deserialized = self._deserialize('ShareSubscriptionSynchronization', response) + deserialized = self._deserialize('OperationResponse', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -823,8 +762,93 @@ def get_long_running_output(response): lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - cancel_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} + + def list_by_account( + self, resource_group_name, account_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + """List of available share subscriptions under an account. + + List share subscriptions in an account. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param skip_token: Continuation Token + :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ShareSubscription + :rtype: + ~azure.mgmt.datashare.models.ShareSubscriptionPaged[~azure.mgmt.datashare.models.ShareSubscription] + :raises: + :class:`DataShareErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_account.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, '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.DataShareErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ShareSubscriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} diff --git a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_shares_operations.py b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_shares_operations.py index 4d00b63fb7ad..c12c620ebf40 100644 --- a/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_shares_operations.py +++ b/sdk/datashare/azure-mgmt-datashare/azure/mgmt/datashare/operations/_shares_operations.py @@ -40,6 +40,189 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list_synchronization_details( + self, resource_group_name, account_name, share_name, share_synchronization, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + """List data set level details for a share synchronization. + + List synchronization details. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param share_name: The name of the share. + :type share_name: str + :param share_synchronization: Share Synchronization payload. + :type share_synchronization: + ~azure.mgmt.datashare.models.ShareSynchronization + :param skip_token: Continuation token + :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of SynchronizationDetails + :rtype: + ~azure.mgmt.datashare.models.SynchronizationDetailsPaged[~azure.mgmt.datashare.models.SynchronizationDetails] + :raises: + :class:`DataShareErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronization_details.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareName': self._serialize.url("share_name", share_name, 'str') + } + 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(share_synchronization, 'ShareSynchronization') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + 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.DataShareErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.SynchronizationDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_synchronization_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'} + + def list_synchronizations( + self, resource_group_name, account_name, share_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): + """List Synchronizations in a share. + + List synchronizations of a share. + + :param resource_group_name: The resource group name. + :type resource_group_name: str + :param account_name: The name of the share account. + :type account_name: str + :param share_name: The name of the share. + :type share_name: str + :param skip_token: Continuation token + :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ShareSynchronization + :rtype: + ~azure.mgmt.datashare.models.ShareSynchronizationPaged[~azure.mgmt.datashare.models.ShareSynchronization] + :raises: + :class:`DataShareErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronizations.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'shareName': self._serialize.url("share_name", share_name, 'str') + } + 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') + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, '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.post(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.DataShareErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ShareSynchronizationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_synchronizations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} + def get( self, resource_group_name, account_name, share_name, custom_headers=None, raw=False, **operation_config): """Get a specified share. @@ -277,7 +460,7 @@ def get_long_running_output(response): delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}'} def list_by_account( - self, resource_group_name, account_name, skip_token=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, skip_token=None, filter=None, orderby=None, custom_headers=None, raw=False, **operation_config): """List of available shares under an account. List shares in an account. @@ -288,6 +471,10 @@ def list_by_account( :type account_name: str :param skip_token: Continuation Token :type skip_token: str + :param filter: Filters the results using OData syntax. + :type filter: str + :param orderby: Sorts the results using OData syntax. + :type orderby: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -315,6 +502,10 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') else: url = next_link @@ -352,170 +543,3 @@ def internal_paging(next_link=None): return deserialized list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares'} - - def list_synchronizations( - self, resource_group_name, account_name, share_name, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List Synchronizations in a share. - - List synchronizations of a share. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_name: The name of the share. - :type share_name: str - :param skip_token: Continuation token - :type skip_token: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ShareSynchronization - :rtype: - ~azure.mgmt.datashare.models.ShareSynchronizationPaged[~azure.mgmt.datashare.models.ShareSynchronization] - :raises: - :class:`DataShareErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronizations.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareName': self._serialize.url("share_name", share_name, 'str') - } - 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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, '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.post(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.DataShareErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ShareSynchronizationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_synchronizations.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} - - def list_synchronization_details( - self, resource_group_name, account_name, share_name, share_synchronization, skip_token=None, custom_headers=None, raw=False, **operation_config): - """List data set level details for a share synchronization. - - List synchronization details. - - :param resource_group_name: The resource group name. - :type resource_group_name: str - :param account_name: The name of the share account. - :type account_name: str - :param share_name: The name of the share. - :type share_name: str - :param share_synchronization: Share Synchronization payload. - :type share_synchronization: - ~azure.mgmt.datashare.models.ShareSynchronization - :param skip_token: Continuation token - :type skip_token: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SynchronizationDetails - :rtype: - ~azure.mgmt.datashare.models.SynchronizationDetailsPaged[~azure.mgmt.datashare.models.SynchronizationDetails] - :raises: - :class:`DataShareErrorException` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_details.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'shareName': self._serialize.url("share_name", share_name, 'str') - } - 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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - 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 body - body_content = self._serialize.body(share_synchronization, 'ShareSynchronization') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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.DataShareErrorException(self._deserialize, response) - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SynchronizationDetailsPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_synchronization_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'}