diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_account_operations_async.py b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_account_operations_async.py index 298fbc8da31..aea13e80544 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_account_operations_async.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_account_operations_async.py @@ -43,6 +43,77 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + def list_by_subscription( + self, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.AccountList"]: + """List Accounts in Subscription. + + List Accounts in a subscription. + + :param skip_token: Continuation token. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} # type: ignore + async def get( self, resource_group_name: str, @@ -398,77 +469,6 @@ async def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}'} # type: ignore - def list_by_subscription( - self, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.AccountList"]: - """List Accounts in Subscription. - - List Accounts in a subscription. - - :param skip_token: Continuation token. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccountList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.AccountList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('AccountList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} # type: ignore - def list_by_resource_group( self, resource_group_name: str, diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_consumer_invitation_operations_async.py b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_consumer_invitation_operations_async.py index 9e2a316d343..b3a46ed6e28 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_consumer_invitation_operations_async.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_consumer_invitation_operations_async.py @@ -41,19 +41,86 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def reject_invitation( + def list_invitation( + self, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ConsumerInvitationList"]: + """Lists invitations. + + List the invitations. + + :param skip_token: The continuation token. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConsumerInvitationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ConsumerInvitationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_invitation.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConsumerInvitationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_invitation.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} # type: ignore + + async def get( self, location: str, invitation_id: str, **kwargs ) -> "models.ConsumerInvitation": - """Reject an invitation. + """Get an invitation. - Rejects the invitation identified by invitationId. + Gets the invitation identified by invitationId. :param location: Location of the invitation. :type location: str - :param invitation_id: Unique id of the invitation. + :param invitation_id: An invitation id. :type invitation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConsumerInvitation, or the result of cls(response) @@ -63,15 +130,13 @@ async def reject_invitation( cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitation"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) - - _invitation = models.ConsumerInvitation(invitation_id=invitation_id) api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.reject_invitation.metadata['url'] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), + 'invitationId': self._serialize.url("invitation_id", invitation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -81,15 +146,10 @@ async def reject_invitation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_invitation, 'ConsumerInvitation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - + request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,21 +164,21 @@ async def reject_invitation( return cls(pipeline_response, deserialized, {}) return deserialized - reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} # type: ignore + get.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}'} # type: ignore - async def get( + async def reject_invitation( self, location: str, invitation_id: str, **kwargs ) -> "models.ConsumerInvitation": - """Get an invitation. + """Reject an invitation. - Gets the invitation identified by invitationId. + Rejects the invitation identified by invitationId. :param location: Location of the invitation. :type location: str - :param invitation_id: An invitation id. + :param invitation_id: Unique id of the invitation. :type invitation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConsumerInvitation, or the result of cls(response) @@ -128,13 +188,15 @@ async def get( cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitation"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + + _invitation = models.ConsumerInvitation(invitation_id=invitation_id) api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.get.metadata['url'] # type: ignore + url = self.reject_invitation.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), - 'invitationId': self._serialize.url("invitation_id", invitation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -144,10 +206,15 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_invitation, 'ConsumerInvitation') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,71 +229,4 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}'} # type: ignore - - def list_invitation( - self, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.ConsumerInvitationList"]: - """Lists invitations. - - List the invitations. - - :param skip_token: The continuation token. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConsumerInvitationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ConsumerInvitationList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_invitation.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ConsumerInvitationList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_invitation.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} # type: ignore + reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_provider_share_subscription_operations_async.py b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_provider_share_subscription_operations_async.py index 4225abf44ff..04fb6675a3e 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_provider_share_subscription_operations_async.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_provider_share_subscription_operations_async.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def get_by_share( + async def reinstate( self, resource_group_name: str, account_name: str, @@ -51,9 +51,9 @@ async def get_by_share( provider_share_subscription_id: str, **kwargs ) -> "models.ProviderShareSubscription": - """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 @@ -74,7 +74,7 @@ async def get_by_share( api_version = "2019-11-01" # Construct URL - url = self.get_by_share.metadata['url'] # type: ignore + url = self.reinstate.metadata['url'] # type: ignore 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'), @@ -93,7 +93,7 @@ async def get_by_share( header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,90 +108,7 @@ async def get_by_share( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} # type: ignore - - def list_by_share( - self, - resource_group_name: str, - account_name: str, - share_name: str, - skip_token: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.ProviderShareSubscriptionList"]: - """List share subscriptions in a provider share. - - List of available share subscriptions to 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderShareSubscriptionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ProviderShareSubscriptionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderShareSubscriptionList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_share.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ProviderShareSubscriptionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} # type: ignore + reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} # type: ignore async def _revoke_initial( self, @@ -308,7 +225,7 @@ def get_long_running_output(pipeline_response): return await async_poller(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'} # type: ignore - async def reinstate( + async def get_by_share( self, resource_group_name: str, account_name: str, @@ -316,9 +233,9 @@ async def reinstate( provider_share_subscription_id: str, **kwargs ) -> "models.ProviderShareSubscription": - """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 @@ -339,7 +256,7 @@ async def reinstate( api_version = "2019-11-01" # Construct URL - url = self.reinstate.metadata['url'] # type: ignore + url = self.get_by_share.metadata['url'] # type: ignore 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'), @@ -358,7 +275,7 @@ async def reinstate( header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,4 +290,87 @@ async def reinstate( return cls(pipeline_response, deserialized, {}) return deserialized - reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} # type: ignore + get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} # type: ignore + + def list_by_share( + self, + resource_group_name: str, + account_name: str, + share_name: str, + skip_token: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ProviderShareSubscriptionList"]: + """List share subscriptions in a provider share. + + List of available share subscriptions to 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderShareSubscriptionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ProviderShareSubscriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderShareSubscriptionList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_share.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderShareSubscriptionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_operations_async.py b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_operations_async.py index cb8d08eec19..fe2717baa62 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_operations_async.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_operations_async.py @@ -44,6 +44,226 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + def list_synchronization_detail( + self, + resource_group_name: str, + account_name: str, + share_name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + orderby: Optional[str] = None, + consumer_email: Optional[str] = None, + consumer_name: Optional[str] = None, + consumer_tenant_name: Optional[str] = None, + duration_ms: Optional[int] = None, + end_time: Optional[datetime.datetime] = None, + message: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + status: Optional[str] = None, + synchronization_id: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.SynchronizationDetailsList"]: + """List synchronization details. + + List data set level details for a share synchronization. + + :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 consumer_email: Email of the user who created the synchronization. + :type consumer_email: str + :param consumer_name: Name of the user who created the synchronization. + :type consumer_name: str + :param consumer_tenant_name: Tenant name of the consumer who created the synchronization. + :type consumer_tenant_name: str + :param duration_ms: synchronization duration. + :type duration_ms: int + :param end_time: End time of synchronization. + :type end_time: ~datetime.datetime + :param message: message of synchronization. + :type message: str + :param start_time: start time of synchronization. + :type start_time: ~datetime.datetime + :param status: Raw Status. + :type status: str + :param synchronization_id: Synchronization id. + :type synchronization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SynchronizationDetailsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + _share_synchronization = models.ShareSynchronization(consumer_email=consumer_email, consumer_name=consumer_name, consumer_tenant_name=consumer_tenant_name, duration_ms=duration_ms, end_time=end_time, message=message, start_time=start_time, status=status, synchronization_id=synchronization_id) + api_version = "2019-11-01" + content_type = "application/json" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronization_detail.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_share_synchronization, 'ShareSynchronization') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'} # type: ignore + + def list_synchronization( + self, + resource_group_name: str, + account_name: str, + share_name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ShareSynchronizationList"]: + """List synchronizations of a share. + + List Synchronizations in 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareSynchronizationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ShareSynchronizationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSynchronizationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronization.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ShareSynchronizationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} # type: ignore + async def get( self, resource_group_name: str, @@ -386,223 +606,3 @@ async def get_next(next_link=None): get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares'} # type: ignore - - def list_synchronization( - self, - resource_group_name: str, - account_name: str, - share_name: str, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.ShareSynchronizationList"]: - """List synchronizations of a share. - - List Synchronizations in 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ShareSynchronizationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ShareSynchronizationList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSynchronizationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareSynchronizationList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} # type: ignore - - def list_synchronization_detail( - self, - resource_group_name: str, - account_name: str, - share_name: str, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - orderby: Optional[str] = None, - consumer_email: Optional[str] = None, - consumer_name: Optional[str] = None, - consumer_tenant_name: Optional[str] = None, - duration_ms: Optional[int] = None, - end_time: Optional[datetime.datetime] = None, - message: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - status: Optional[str] = None, - synchronization_id: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.SynchronizationDetailsList"]: - """List synchronization details. - - List data set level details for a share synchronization. - - :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 consumer_email: Email of the user who created the synchronization. - :type consumer_email: str - :param consumer_name: Name of the user who created the synchronization. - :type consumer_name: str - :param consumer_tenant_name: Tenant name of the consumer who created the synchronization. - :type consumer_tenant_name: str - :param duration_ms: synchronization duration. - :type duration_ms: int - :param end_time: End time of synchronization. - :type end_time: ~datetime.datetime - :param message: message of synchronization. - :type message: str - :param start_time: start time of synchronization. - :type start_time: ~datetime.datetime - :param status: Raw Status. - :type status: str - :param synchronization_id: Synchronization id. - :type synchronization_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SynchronizationDetailsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - _share_synchronization = models.ShareSynchronization(consumer_email=consumer_email, consumer_name=consumer_name, consumer_tenant_name=consumer_tenant_name, duration_ms=duration_ms, end_time=end_time, message=message, start_time=start_time, status=status, synchronization_id=synchronization_id) - api_version = "2019-11-01" - content_type = "application/json" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_detail.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_synchronization, 'ShareSynchronization') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_subscription_operations_async.py b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_subscription_operations_async.py index d1324b00708..5cee322d266 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_subscription_operations_async.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/aio/operations_async/_share_subscription_operations_async.py @@ -43,107 +43,24 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def get( - self, - resource_group_name: str, - account_name: str, - share_subscription_name: str, - **kwargs - ) -> "models.ShareSubscription": - """Get a shareSubscription in an account. - - Get 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ShareSubscription, or the result of cls(response) - :rtype: ~data_share_management_client.models.ShareSubscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DataShareError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - - async def create( + async def _cancel_synchronization_initial( self, resource_group_name: str, account_name: str, share_subscription_name: str, - invitation_id: str, - source_share_location: str, + synchronization_id: str, **kwargs - ) -> "models.ShareSubscription": - """Create a shareSubscription in an account. - - Create 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ShareSubscription, or the result of cls(response) - :rtype: ~data_share_management_client.models.ShareSubscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] + ) -> "models.ShareSubscriptionSynchronization": + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) - _share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) + _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._cancel_synchronization_initial.metadata['url'] # type: ignore 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'), @@ -163,91 +80,42 @@ async def create( # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription, 'ShareSubscription') + body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DataShareError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - account_name: str, - share_subscription_name: str, - **kwargs - ) -> "models.OperationResponse": - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DataShareError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationResponse', pipeline_response) + if response.status_code == 202: + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + _cancel_synchronization_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore - async def delete( + async def cancel_synchronization( self, resource_group_name: str, account_name: str, share_subscription_name: str, + synchronization_id: str, **kwargs - ) -> "models.OperationResponse": - """Delete a shareSubscription in an account. + ) -> "models.ShareSubscriptionSynchronization": + """Request to cancel a synchronization. - Delete shareSubscription in an account. + Request cancellation of a data share snapshot. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -255,25 +123,28 @@ async 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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: OperationResponse, or the result of cls(response) - :rtype: ~data_share_management_client.models.OperationResponse + :return: ShareSubscriptionSynchronization, or the result of cls(response) + :rtype: ~data_share_management_client.models.ShareSubscriptionSynchronization :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_initial( + raw_result = await self._cancel_synchronization_initial( resource_group_name=resource_group_name, account_name=account_name, share_subscription_name=share_subscription_name, + synchronization_id=synchronization_id, cls=lambda x,y,z: x, **kwargs ) @@ -282,47 +153,44 @@ async def delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationResponse', pipeline_response) + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + cancel_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore - def list_by_account( + def list_source_share_synchronization_setting( self, resource_group_name: str, account_name: str, + share_subscription_name: str, skip_token: Optional[str] = None, - filter: Optional[str] = None, - orderby: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.ShareSubscriptionList"]: - """List share subscriptions in an account. + ) -> AsyncIterable["models.SourceShareSynchronizationSettingList"]: + """Get synchronization settings set on a share. - List of available share subscriptions under an account. + Get source share synchronization settings for a shareSubscription. :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 filter: Filters the results using OData syntax. - :type filter: str - :param orderby: Sorts the results using OData syntax. - :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ShareSubscriptionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ShareSubscriptionList] + :return: An iterator like instance of either SourceShareSynchronizationSettingList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SourceShareSynchronizationSettingList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceShareSynchronizationSettingList"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" @@ -330,11 +198,12 @@ def list_by_account( def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore + url = self.list_source_share_synchronization_setting.metadata['url'] # type: ignore 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 @@ -342,10 +211,6 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("api_version", 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 @@ -355,11 +220,11 @@ def prepare_request(next_link=None): header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ShareSubscriptionList', pipeline_response) + deserialized = self._deserialize('SourceShareSynchronizationSettingList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -381,42 +246,53 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} # type: ignore + list_source_share_synchronization_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} # type: ignore - def list_source_share_synchronization_setting( + def list_synchronization_detail( self, resource_group_name: str, account_name: str, share_subscription_name: str, + synchronization_id: str, skip_token: Optional[str] = None, + filter: Optional[str] = None, + orderby: Optional[str] = None, **kwargs - ) -> AsyncIterable["models.SourceShareSynchronizationSettingList"]: - """Get synchronization settings set on a share. + ) -> AsyncIterable["models.SynchronizationDetailsList"]: + """List synchronization details. - Get source share synchronization settings for a shareSubscription. + List data set level details for a share subscription synchronization. :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 :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceShareSynchronizationSettingList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SourceShareSynchronizationSettingList] + :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SynchronizationDetailsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SourceShareSynchronizationSettingList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) api_version = "2019-11-01" + content_type = "application/json" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_source_share_synchronization_setting.metadata['url'] # type: ignore + url = self.list_synchronization_detail.metadata['url'] # type: ignore 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'), @@ -429,20 +305,29 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SourceShareSynchronizationSettingList', pipeline_response) + deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -464,7 +349,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_source_share_synchronization_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} # type: ignore + list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} # type: ignore def list_synchronization( self, @@ -559,109 +444,6 @@ async def get_next(next_link=None): ) list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizations'} # type: ignore - def list_synchronization_detail( - self, - resource_group_name: str, - account_name: str, - share_subscription_name: str, - synchronization_id: str, - skip_token: Optional[str] = None, - filter: Optional[str] = None, - orderby: Optional[str] = None, - **kwargs - ) -> AsyncIterable["models.SynchronizationDetailsList"]: - """List synchronization details. - - List data set level details for a share subscription synchronization. - - :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 filter: Filters the results using OData syntax. - :type filter: str - :param orderby: Sorts the results using OData syntax. - :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.SynchronizationDetailsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) - api_version = "2019-11-01" - content_type = "application/json" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_detail.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} # type: ignore - async def _synchronize_initial( self, resource_group_name: str, @@ -785,24 +567,107 @@ def get_long_running_output(pipeline_response): return await async_poller(self._client, raw_result, get_long_running_output, polling_method) synchronize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/Synchronize'} # type: ignore - async def _cancel_synchronization_initial( + async def get( self, resource_group_name: str, account_name: str, share_subscription_name: str, - synchronization_id: str, **kwargs - ) -> "models.ShareSubscriptionSynchronization": - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] + ) -> "models.ShareSubscription": + """Get a shareSubscription in an account. + + Get 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShareSubscription, or the result of cls(response) + :rtype: ~data_share_management_client.models.ShareSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" - _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DataShareError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ShareSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + account_name: str, + share_subscription_name: str, + invitation_id: str, + source_share_location: str, + **kwargs + ) -> "models.ShareSubscription": + """Create a shareSubscription in an account. + + Create 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShareSubscription, or the result of cls(response) + :rtype: ~data_share_management_client.models.ShareSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._cancel_synchronization_initial.metadata['url'] # type: ignore + url = self.create.metadata['url'] # type: ignore 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'), @@ -822,42 +687,91 @@ async def _cancel_synchronization_initial( # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') + body_content = self._serialize.body(_share_subscription, 'ShareSubscription') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DataShareError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + deserialized = self._deserialize('ShareSubscription', pipeline_response) - if response.status_code == 202: - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + if response.status_code == 201: + deserialized = self._deserialize('ShareSubscription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_synchronization_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - async def cancel_synchronization( + async def _delete_initial( self, resource_group_name: str, account_name: str, share_subscription_name: str, - synchronization_id: str, **kwargs - ) -> "models.ShareSubscriptionSynchronization": - """Request to cancel a synchronization. + ) -> "models.OperationResponse": + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" - Request cancellation of a data share snapshot. + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DataShareError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + share_subscription_name: str, + **kwargs + ) -> "models.OperationResponse": + """Delete a shareSubscription in an account. + + Delete shareSubscription in an account. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -865,28 +779,25 @@ async 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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ShareSubscriptionSynchronization, or the result of cls(response) - :rtype: ~data_share_management_client.models.ShareSubscriptionSynchronization + :return: OperationResponse, or the result of cls(response) + :rtype: ~data_share_management_client.models.OperationResponse :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) - raw_result = await self._cancel_synchronization_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, share_subscription_name=share_subscription_name, - synchronization_id=synchronization_id, cls=lambda x,y,z: x, **kwargs ) @@ -895,14 +806,103 @@ async def cancel_synchronization( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + deserialized = self._deserialize('OperationResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(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'} # type: ignore + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + def list_by_account( + self, + resource_group_name: str, + account_name: str, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + orderby: Optional[str] = None, + **kwargs + ) -> AsyncIterable["models.ShareSubscriptionList"]: + """List share subscriptions in an account. + + List of available share subscriptions under 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareSubscriptionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~data_share_management_client.models.ShareSubscriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_account.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ShareSubscriptionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_account_operations.py b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_account_operations.py index 8478f73a6d4..627717c36d0 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_account_operations.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_account_operations.py @@ -47,6 +47,78 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def list_by_subscription( + self, + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.AccountList"] + """List Accounts in Subscription. + + List Accounts in a subscription. + + :param skip_token: Continuation token. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AccountList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.AccountList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AccountList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} # type: ignore + def get( self, resource_group_name, # type: str @@ -408,78 +480,6 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}'} # type: ignore - def list_by_subscription( - self, - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.AccountList"] - """List Accounts in Subscription. - - List Accounts in a subscription. - - :param skip_token: Continuation token. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AccountList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.AccountList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AccountList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('AccountList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts'} # type: ignore - def list_by_resource_group( self, resource_group_name, # type: str diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_consumer_invitation_operations.py b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_consumer_invitation_operations.py index 17ef7870672..9c86a2d2fef 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_consumer_invitation_operations.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_consumer_invitation_operations.py @@ -45,20 +45,88 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def reject_invitation( + def list_invitation( + self, + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ConsumerInvitationList"] + """Lists invitations. + + List the invitations. + + :param skip_token: The continuation token. + :type skip_token: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConsumerInvitationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ConsumerInvitationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_invitation.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConsumerInvitationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_invitation.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} # type: ignore + + def get( self, location, # type: str invitation_id, # type: str **kwargs # type: Any ): # type: (...) -> "models.ConsumerInvitation" - """Reject an invitation. + """Get an invitation. - Rejects the invitation identified by invitationId. + Gets the invitation identified by invitationId. :param location: Location of the invitation. :type location: str - :param invitation_id: Unique id of the invitation. + :param invitation_id: An invitation id. :type invitation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConsumerInvitation, or the result of cls(response) @@ -68,15 +136,13 @@ def reject_invitation( cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitation"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) - - _invitation = models.ConsumerInvitation(invitation_id=invitation_id) api_version = "2019-11-01" - content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.reject_invitation.metadata['url'] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), + 'invitationId': self._serialize.url("invitation_id", invitation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -86,15 +152,10 @@ def reject_invitation( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_invitation, 'ConsumerInvitation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - + request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,22 +170,22 @@ def reject_invitation( return cls(pipeline_response, deserialized, {}) return deserialized - reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} # type: ignore + get.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}'} # type: ignore - def get( + def reject_invitation( self, location, # type: str invitation_id, # type: str **kwargs # type: Any ): # type: (...) -> "models.ConsumerInvitation" - """Get an invitation. + """Reject an invitation. - Gets the invitation identified by invitationId. + Rejects the invitation identified by invitationId. :param location: Location of the invitation. :type location: str - :param invitation_id: An invitation id. + :param invitation_id: Unique id of the invitation. :type invitation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ConsumerInvitation, or the result of cls(response) @@ -134,13 +195,15 @@ def get( cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitation"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + + _invitation = models.ConsumerInvitation(invitation_id=invitation_id) api_version = "2019-11-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.get.metadata['url'] # type: ignore + url = self.reject_invitation.metadata['url'] # type: ignore path_format_arguments = { 'location': self._serialize.url("location", location, 'str'), - 'invitationId': self._serialize.url("invitation_id", invitation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) @@ -150,10 +213,15 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_invitation, 'ConsumerInvitation') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,72 +236,4 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/consumerInvitations/{invitationId}'} # type: ignore - - def list_invitation( - self, - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ConsumerInvitationList"] - """Lists invitations. - - List the invitations. - - :param skip_token: The continuation token. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConsumerInvitationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ConsumerInvitationList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ConsumerInvitationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_invitation.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ConsumerInvitationList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_invitation.metadata = {'url': '/providers/Microsoft.DataShare/ListInvitations'} # type: ignore + reject_invitation.metadata = {'url': '/providers/Microsoft.DataShare/locations/{location}/RejectInvitation'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_provider_share_subscription_operations.py b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_provider_share_subscription_operations.py index aecfd61699e..421cceb072c 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_provider_share_subscription_operations.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_provider_share_subscription_operations.py @@ -47,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def get_by_share( + def reinstate( self, resource_group_name, # type: str account_name, # type: str @@ -56,9 +56,9 @@ def get_by_share( **kwargs # type: Any ): # type: (...) -> "models.ProviderShareSubscription" - """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 @@ -79,7 +79,7 @@ def get_by_share( api_version = "2019-11-01" # Construct URL - url = self.get_by_share.metadata['url'] # type: ignore + url = self.reinstate.metadata['url'] # type: ignore 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'), @@ -98,7 +98,7 @@ def get_by_share( header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,91 +113,7 @@ def get_by_share( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} # type: ignore - - def list_by_share( - self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ProviderShareSubscriptionList"] - """List share subscriptions in a provider share. - - List of available share subscriptions to 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ProviderShareSubscriptionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ProviderShareSubscriptionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderShareSubscriptionList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_by_share.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ProviderShareSubscriptionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} # type: ignore + reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} # type: ignore def _revoke_initial( self, @@ -316,7 +232,7 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_revoke.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/revoke'} # type: ignore - def reinstate( + def get_by_share( self, resource_group_name, # type: str account_name, # type: str @@ -325,9 +241,9 @@ def reinstate( **kwargs # type: Any ): # type: (...) -> "models.ProviderShareSubscription" - """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 @@ -348,7 +264,7 @@ def reinstate( api_version = "2019-11-01" # Construct URL - url = self.reinstate.metadata['url'] # type: ignore + url = self.get_by_share.metadata['url'] # type: ignore 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'), @@ -367,7 +283,7 @@ def reinstate( header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -382,4 +298,88 @@ def reinstate( return cls(pipeline_response, deserialized, {}) return deserialized - reinstate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}/reinstate'} # type: ignore + get_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions/{providerShareSubscriptionId}'} # type: ignore + + def list_by_share( + self, + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + skip_token=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ProviderShareSubscriptionList"] + """List share subscriptions in a provider share. + + List of available share subscriptions to 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProviderShareSubscriptionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ProviderShareSubscriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ProviderShareSubscriptionList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_share.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProviderShareSubscriptionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_share.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/providerShareSubscriptions'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_operations.py b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_operations.py index 39dda1fdc3b..a522f7bf988 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_operations.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_operations.py @@ -48,6 +48,228 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + def list_synchronization_detail( + self, + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] + consumer_email=None, # type: Optional[str] + consumer_name=None, # type: Optional[str] + consumer_tenant_name=None, # type: Optional[str] + duration_ms=None, # type: Optional[int] + end_time=None, # type: Optional[datetime.datetime] + message=None, # type: Optional[str] + start_time=None, # type: Optional[datetime.datetime] + status=None, # type: Optional[str] + synchronization_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SynchronizationDetailsList"] + """List synchronization details. + + List data set level details for a share synchronization. + + :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 consumer_email: Email of the user who created the synchronization. + :type consumer_email: str + :param consumer_name: Name of the user who created the synchronization. + :type consumer_name: str + :param consumer_tenant_name: Tenant name of the consumer who created the synchronization. + :type consumer_tenant_name: str + :param duration_ms: synchronization duration. + :type duration_ms: int + :param end_time: End time of synchronization. + :type end_time: ~datetime.datetime + :param message: message of synchronization. + :type message: str + :param start_time: start time of synchronization. + :type start_time: ~datetime.datetime + :param status: Raw Status. + :type status: str + :param synchronization_id: Synchronization id. + :type synchronization_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SynchronizationDetailsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + _share_synchronization = models.ShareSynchronization(consumer_email=consumer_email, consumer_name=consumer_name, consumer_tenant_name=consumer_tenant_name, duration_ms=duration_ms, end_time=end_time, message=message, start_time=start_time, status=status, synchronization_id=synchronization_id) + api_version = "2019-11-01" + content_type = "application/json" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronization_detail.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_share_synchronization, 'ShareSynchronization') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'} # type: ignore + + def list_synchronization( + self, + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ShareSynchronizationList"] + """List synchronizations of a share. + + List Synchronizations in 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareSynchronizationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ShareSynchronizationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSynchronizationList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_synchronization.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ShareSynchronizationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} # type: ignore + def get( self, resource_group_name, # type: str @@ -395,225 +617,3 @@ def get_next(next_link=None): get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares'} # type: ignore - - def list_synchronization( - self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ShareSynchronizationList"] - """List synchronizations of a share. - - List Synchronizations in 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ShareSynchronizationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ShareSynchronizationList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSynchronizationList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ShareSynchronizationList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizations'} # type: ignore - - def list_synchronization_detail( - self, - resource_group_name, # type: str - account_name, # type: str - share_name, # type: str - skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - orderby=None, # type: Optional[str] - consumer_email=None, # type: Optional[str] - consumer_name=None, # type: Optional[str] - consumer_tenant_name=None, # type: Optional[str] - duration_ms=None, # type: Optional[int] - end_time=None, # type: Optional[datetime.datetime] - message=None, # type: Optional[str] - start_time=None, # type: Optional[datetime.datetime] - status=None, # type: Optional[str] - synchronization_id=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.SynchronizationDetailsList"] - """List synchronization details. - - List data set level details for a share synchronization. - - :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 consumer_email: Email of the user who created the synchronization. - :type consumer_email: str - :param consumer_name: Name of the user who created the synchronization. - :type consumer_name: str - :param consumer_tenant_name: Tenant name of the consumer who created the synchronization. - :type consumer_tenant_name: str - :param duration_ms: synchronization duration. - :type duration_ms: int - :param end_time: End time of synchronization. - :type end_time: ~datetime.datetime - :param message: message of synchronization. - :type message: str - :param start_time: start time of synchronization. - :type start_time: ~datetime.datetime - :param status: Raw Status. - :type status: str - :param synchronization_id: Synchronization id. - :type synchronization_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SynchronizationDetailsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - _share_synchronization = models.ShareSynchronization(consumer_email=consumer_email, consumer_name=consumer_name, consumer_tenant_name=consumer_tenant_name, duration_ms=duration_ms, end_time=end_time, message=message, start_time=start_time, status=status, synchronization_id=synchronization_id) - api_version = "2019-11-01" - content_type = "application/json" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_detail.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_synchronization, 'ShareSynchronization') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/listSynchronizationDetails'} # type: ignore diff --git a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_subscription_operations.py b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_subscription_operations.py index 152c960538f..3bec808d48d 100644 --- a/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_subscription_operations.py +++ b/src/datashare/azext_datashare/vendored_sdks/datashare/operations/_share_subscription_operations.py @@ -47,109 +47,25 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def get( - self, - resource_group_name, # type: str - account_name, # type: str - share_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.ShareSubscription" - """Get a shareSubscription in an account. - - Get 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ShareSubscription, or the result of cls(response) - :rtype: ~data_share_management_client.models.ShareSubscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DataShareError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - - def create( + def _cancel_synchronization_initial( self, resource_group_name, # type: str account_name, # type: str share_subscription_name, # type: str - invitation_id, # type: str - source_share_location, # type: str + synchronization_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ShareSubscription" - """Create a shareSubscription in an account. - - Create 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ShareSubscription, or the result of cls(response) - :rtype: ~data_share_management_client.models.ShareSubscription - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] + # type: (...) -> "models.ShareSubscriptionSynchronization" + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) - _share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) + _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create.metadata['url'] # type: ignore + url = self._cancel_synchronization_initial.metadata['url'] # type: ignore 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'), @@ -169,93 +85,43 @@ def create( # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription, 'ShareSubscription') + body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DataShareError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ShareSubscription', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name, # type: str - account_name, # type: str - share_subscription_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.OperationResponse" - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-11-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.DataShareError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationResponse', pipeline_response) + if response.status_code == 202: + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + _cancel_synchronization_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore - def begin_delete( + def begin_cancel_synchronization( self, resource_group_name, # type: str account_name, # type: str share_subscription_name, # type: str + synchronization_id, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller - """Delete a shareSubscription in an account. + """Request to cancel a synchronization. - Delete shareSubscription in an account. + Request cancellation of a data share snapshot. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -263,25 +129,28 @@ def begin_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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OperationResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~data_share_management_client.models.OperationResponse] + :return: An instance of LROPoller that returns either ShareSubscriptionSynchronization or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~data_share_management_client.models.ShareSubscriptionSynchronization] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) - 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, cls=lambda x,y,z: x, **kwargs ) @@ -290,48 +159,45 @@ def begin_delete( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('OperationResponse', pipeline_response) + deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + begin_cancel_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore - def list_by_account( + def list_source_share_synchronization_setting( self, resource_group_name, # type: str account_name, # type: str + share_subscription_name, # type: str skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ShareSubscriptionList"] - """List share subscriptions in an account. + # type: (...) -> Iterable["models.SourceShareSynchronizationSettingList"] + """Get synchronization settings set on a share. - List of available share subscriptions under an account. + Get source share synchronization settings for a shareSubscription. :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 filter: Filters the results using OData syntax. - :type filter: str - :param orderby: Sorts the results using OData syntax. - :type orderby: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ShareSubscriptionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ShareSubscriptionList] + :return: An iterator like instance of either SourceShareSynchronizationSettingList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SourceShareSynchronizationSettingList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.SourceShareSynchronizationSettingList"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) api_version = "2019-11-01" @@ -339,11 +205,12 @@ def list_by_account( def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_account.metadata['url'] # type: ignore + url = self.list_source_share_synchronization_setting.metadata['url'] # type: ignore 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 @@ -351,10 +218,6 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("api_version", 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 @@ -364,11 +227,11 @@ def prepare_request(next_link=None): header_parameters['Accept'] = 'application/json' # 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 extract_data(pipeline_response): - deserialized = self._deserialize('ShareSubscriptionList', pipeline_response) + deserialized = self._deserialize('SourceShareSynchronizationSettingList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -390,43 +253,54 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} # type: ignore + list_source_share_synchronization_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} # type: ignore - def list_source_share_synchronization_setting( + def list_synchronization_detail( self, resource_group_name, # type: str account_name, # type: str share_subscription_name, # type: str + synchronization_id, # type: str skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable["models.SourceShareSynchronizationSettingList"] - """Get synchronization settings set on a share. + # type: (...) -> Iterable["models.SynchronizationDetailsList"] + """List synchronization details. - Get source share synchronization settings for a shareSubscription. + List data set level details for a share subscription synchronization. :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 :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceShareSynchronizationSettingList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SourceShareSynchronizationSettingList] + :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SynchronizationDetailsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SourceShareSynchronizationSettingList"] + cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) api_version = "2019-11-01" + content_type = "application/json" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_source_share_synchronization_setting.metadata['url'] # type: ignore + url = self.list_synchronization_detail.metadata['url'] # type: ignore 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'), @@ -439,20 +313,29 @@ def prepare_request(next_link=None): query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + return request def extract_data(pipeline_response): - deserialized = self._deserialize('SourceShareSynchronizationSettingList', pipeline_response) + deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -474,7 +357,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_source_share_synchronization_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSourceShareSynchronizationSettings'} # type: ignore + list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} # type: ignore def list_synchronization( self, @@ -570,110 +453,6 @@ def get_next(next_link=None): ) list_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizations'} # type: ignore - def list_synchronization_detail( - self, - resource_group_name, # type: str - account_name, # type: str - share_subscription_name, # type: str - synchronization_id, # type: str - skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - orderby=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.SynchronizationDetailsList"] - """List synchronization details. - - List data set level details for a share subscription synchronization. - - :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 filter: Filters the results using OData syntax. - :type filter: str - :param orderby: Sorts the results using OData syntax. - :type orderby: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SynchronizationDetailsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.SynchronizationDetailsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SynchronizationDetailsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) - api_version = "2019-11-01" - content_type = "application/json" - - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list_synchronization_detail.metadata['url'] # type: ignore - 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 = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - # Construct and send request - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SynchronizationDetailsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize(models.DataShareError, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_synchronization_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/listSynchronizationDetails'} # type: ignore - def _synchronize_initial( self, resource_group_name, # type: str @@ -799,25 +578,109 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_synchronize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/Synchronize'} # type: ignore - def _cancel_synchronization_initial( + def get( self, resource_group_name, # type: str account_name, # type: str share_subscription_name, # type: str - synchronization_id, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ShareSubscriptionSynchronization" - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] + # type: (...) -> "models.ShareSubscription" + """Get a shareSubscription in an account. + + Get 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShareSubscription, or the result of cls(response) + :rtype: ~data_share_management_client.models.ShareSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" - _share_subscription_synchronization = models.ShareSubscriptionSynchronization(synchronization_id=synchronization_id) + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DataShareError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ShareSubscription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + account_name, # type: str + share_subscription_name, # type: str + invitation_id, # type: str + source_share_location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.ShareSubscription" + """Create a shareSubscription in an account. + + Create 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ShareSubscription, or the result of cls(response) + :rtype: ~data_share_management_client.models.ShareSubscription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscription"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _share_subscription = models.ShareSubscription(invitation_id=invitation_id, source_share_location=source_share_location) api_version = "2019-11-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._cancel_synchronization_initial.metadata['url'] # type: ignore + url = self.create.metadata['url'] # type: ignore 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'), @@ -837,43 +700,93 @@ def _cancel_synchronization_initial( # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_share_subscription_synchronization, 'ShareSubscriptionSynchronization') + body_content = self._serialize.body(_share_subscription, 'ShareSubscription') body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize(models.DataShareError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + deserialized = self._deserialize('ShareSubscription', pipeline_response) - if response.status_code == 202: - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + if response.status_code == 201: + deserialized = self._deserialize('ShareSubscription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_synchronization_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore - def begin_cancel_synchronization( + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + share_subscription_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.OperationResponse" + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.DataShareError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + def begin_delete( self, resource_group_name, # type: str account_name, # type: str share_subscription_name, # type: str - synchronization_id, # type: str **kwargs # type: Any ): # type: (...) -> LROPoller - """Request to cancel a synchronization. + """Delete a shareSubscription in an account. - Request cancellation of a data share snapshot. + Delete shareSubscription in an account. :param resource_group_name: The resource group name. :type resource_group_name: str @@ -881,28 +794,25 @@ def begin_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 :keyword callable cls: A custom type or function that will be passed the direct response :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ShareSubscriptionSynchronization or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~data_share_management_client.models.ShareSubscriptionSynchronization] + :return: An instance of LROPoller that returns either OperationResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~data_share_management_client.models.OperationResponse] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionSynchronization"] + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationResponse"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) - 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, cls=lambda x,y,z: x, **kwargs ) @@ -911,14 +821,104 @@ def begin_cancel_synchronization( kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize('ShareSubscriptionSynchronization', pipeline_response) + deserialized = self._deserialize('OperationResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel_synchronization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/cancelSynchronization'} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}'} # type: ignore + + def list_by_account( + self, + resource_group_name, # type: str + account_name, # type: str + skip_token=None, # type: Optional[str] + filter=None, # type: Optional[str] + orderby=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.ShareSubscriptionList"] + """List share subscriptions in an account. + + List of available share subscriptions under 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ShareSubscriptionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~data_share_management_client.models.ShareSubscriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ShareSubscriptionList"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_account.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", 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 = {} # type: Dict[str, Any] + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ShareSubscriptionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.DataShareError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions'} # type: ignore