Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR storage/resource-manager] [SRP] Add new API ListBlobServices #6536

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
from ._models import Usage
from ._models import UsageName
from ._models import VirtualNetworkRule
from ._paged_models import BlobServicePropertiesPaged
from ._paged_models import ListContainerItemPaged
from ._paged_models import OperationPaged
from ._paged_models import SkuPaged
Expand Down Expand Up @@ -239,6 +240,7 @@
'SkuPaged',
'StorageAccountPaged',
'UsagePaged',
'BlobServicePropertiesPaged',
'ListContainerItemPaged',
'ReasonCode',
'SkuName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ class UsagePaged(Paged):
def __init__(self, *args, **kwargs):

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

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

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

super(BlobServicePropertiesPaged, self).__init__(*args, **kwargs)
class ListContainerItemPaged(Paged):
"""
A paging container for iterating over a list of :class:`ListContainerItem <azure.mgmt.storage.v2019_04_01.models.ListContainerItem>` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,82 @@ def __init__(self, client, config, serializer, deserializer):

self.config = config

def list(
self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config):
"""List blob services of storage account. It returns a collection of one
object named default.

:param resource_group_name: The name of the resource group within the
user's subscription. The name is case insensitive.
:type resource_group_name: str
:param account_name: The name of the storage account within the
specified resource group. Storage account names must be between 3 and
24 characters in length and use numbers and lower-case letters only.
:type account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of BlobServiceProperties
:rtype:
~azure.mgmt.storage.v2019_04_01.models.BlobServicePropertiesPaged[~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)

else:
url = next_link
query_parameters = {}

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

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

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

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

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

return response

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

return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices'}

def set_service_properties(
self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config):
"""Sets the properties of a storage account’s Blob service, including
Expand Down