@@ -40,6 +40,77 @@ def __init__(self, client, config, serializer, deserializer):
4040
4141 self .config = config
4242
43+ def list_by_subscription (
44+ self , skip_token = None , custom_headers = None , raw = False , ** operation_config ):
45+ """List Accounts in a subscription.
46+
47+ List Accounts in Subscription.
48+
49+ :param skip_token: Continuation token
50+ :type skip_token: str
51+ :param dict custom_headers: headers that will be added to the request
52+ :param bool raw: returns the direct response alongside the
53+ deserialized response
54+ :param operation_config: :ref:`Operation configuration
55+ overrides<msrest:optionsforoperations>`.
56+ :return: An iterator like instance of Account
57+ :rtype:
58+ ~azure.mgmt.datashare.models.AccountPaged[~azure.mgmt.datashare.models.Account]
59+ :raises:
60+ :class:`DataShareErrorException<azure.mgmt.datashare.models.DataShareErrorException>`
61+ """
62+ def prepare_request (next_link = None ):
63+ if not next_link :
64+ # Construct URL
65+ url = self .list_by_subscription .metadata ['url' ]
66+ path_format_arguments = {
67+ 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' )
68+ }
69+ url = self ._client .format_url (url , ** path_format_arguments )
70+
71+ # Construct parameters
72+ query_parameters = {}
73+ query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
74+ if skip_token is not None :
75+ query_parameters ['$skipToken' ] = self ._serialize .query ("skip_token" , skip_token , 'str' )
76+
77+ else :
78+ url = next_link
79+ query_parameters = {}
80+
81+ # Construct headers
82+ header_parameters = {}
83+ header_parameters ['Accept' ] = 'application/json'
84+ if self .config .generate_client_request_id :
85+ header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
86+ if custom_headers :
87+ header_parameters .update (custom_headers )
88+ if self .config .accept_language is not None :
89+ header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
90+
91+ # Construct and send request
92+ request = self ._client .get (url , query_parameters , header_parameters )
93+ return request
94+
95+ def internal_paging (next_link = None ):
96+ request = prepare_request (next_link )
97+
98+ response = self ._client .send (request , stream = False , ** operation_config )
99+
100+ if response .status_code not in [200 ]:
101+ raise models .DataShareErrorException (self ._deserialize , response )
102+
103+ return response
104+
105+ # Deserialize response
106+ header_dict = None
107+ if raw :
108+ header_dict = {}
109+ deserialized = models .AccountPaged (internal_paging , self ._deserialize .dependencies , header_dict )
110+
111+ return deserialized
112+ list_by_subscription .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts' }
113+
43114 def get (
44115 self , resource_group_name , account_name , custom_headers = None , raw = False , ** operation_config ):
45116 """Get an account under a resource group.
@@ -369,77 +440,6 @@ def update(
369440 return deserialized
370441 update .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}' }
371442
372- def list_by_subscription (
373- self , skip_token = None , custom_headers = None , raw = False , ** operation_config ):
374- """List Accounts in a subscription.
375-
376- List Accounts in Subscription.
377-
378- :param skip_token: Continuation token
379- :type skip_token: str
380- :param dict custom_headers: headers that will be added to the request
381- :param bool raw: returns the direct response alongside the
382- deserialized response
383- :param operation_config: :ref:`Operation configuration
384- overrides<msrest:optionsforoperations>`.
385- :return: An iterator like instance of Account
386- :rtype:
387- ~azure.mgmt.datashare.models.AccountPaged[~azure.mgmt.datashare.models.Account]
388- :raises:
389- :class:`DataShareErrorException<azure.mgmt.datashare.models.DataShareErrorException>`
390- """
391- def prepare_request (next_link = None ):
392- if not next_link :
393- # Construct URL
394- url = self .list_by_subscription .metadata ['url' ]
395- path_format_arguments = {
396- 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' )
397- }
398- url = self ._client .format_url (url , ** path_format_arguments )
399-
400- # Construct parameters
401- query_parameters = {}
402- query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
403- if skip_token is not None :
404- query_parameters ['$skipToken' ] = self ._serialize .query ("skip_token" , skip_token , 'str' )
405-
406- else :
407- url = next_link
408- query_parameters = {}
409-
410- # Construct headers
411- header_parameters = {}
412- header_parameters ['Accept' ] = 'application/json'
413- if self .config .generate_client_request_id :
414- header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
415- if custom_headers :
416- header_parameters .update (custom_headers )
417- if self .config .accept_language is not None :
418- header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
419-
420- # Construct and send request
421- request = self ._client .get (url , query_parameters , header_parameters )
422- return request
423-
424- def internal_paging (next_link = None ):
425- request = prepare_request (next_link )
426-
427- response = self ._client .send (request , stream = False , ** operation_config )
428-
429- if response .status_code not in [200 ]:
430- raise models .DataShareErrorException (self ._deserialize , response )
431-
432- return response
433-
434- # Deserialize response
435- header_dict = None
436- if raw :
437- header_dict = {}
438- deserialized = models .AccountPaged (internal_paging , self ._deserialize .dependencies , header_dict )
439-
440- return deserialized
441- list_by_subscription .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.DataShare/accounts' }
442-
443443 def list_by_resource_group (
444444 self , resource_group_name , skip_token = None , custom_headers = None , raw = False , ** operation_config ):
445445 """List Accounts in a resource group.
0 commit comments