diff --git a/sdk/storage/azure-mgmt-storage/README.rst b/sdk/storage/azure-mgmt-storage/README.rst index e8a573239aa7..5b9e52dc5b2d 100644 --- a/sdk/storage/azure-mgmt-storage/README.rst +++ b/sdk/storage/azure-mgmt-storage/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure Storage Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py index 3db1f662464e..55a44cdd62b7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py @@ -14,7 +14,6 @@ from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from .version import VERSION from ._configuration import StorageManagementClientConfiguration @@ -51,8 +50,8 @@ class StorageManagementClient(MultiApiClientMixin, SDKClient): _PROFILE_TAG = "azure.mgmt.storage.StorageManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { + None: DEFAULT_API_VERSION, 'usage': '2018-02-01', - None: DEFAULT_API_VERSION }}, _PROFILE_TAG + " latest" ) @@ -161,6 +160,32 @@ def blob_services(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def file_services(self): + """Instance depends on the API version: + + * 2019-04-01: :class:`FileServicesOperations` + """ + api_version = self._get_api_version('file_services') + if api_version == '2019-04-01': + from .v2019_04_01.operations import FileServicesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def file_shares(self): + """Instance depends on the API version: + + * 2019-04-01: :class:`FileSharesOperations` + """ + api_version = self._get_api_version('file_shares') + if api_version == '2019-04-01': + from .v2019_04_01.operations import FileSharesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def management_policies(self): """Instance depends on the API version: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py index 7e77a50bfd13..2020d3f71048 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/models.py @@ -4,13 +4,5 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2015_06_15.models import * -from .v2016_01_01.models import * -from .v2016_12_01.models import * -from .v2017_06_01.models import * -from .v2017_10_01.models import * from .v2018_02_01.models import * -from .v2018_03_01_preview.models import * -from .v2018_07_01.models import * -from .v2018_11_01.models import * from .v2019_04_01.models import * diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py index 94c3a1b0bdea..8e55758b8f70 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py @@ -20,6 +20,8 @@ from .operations import ManagementPoliciesOperations from .operations import BlobServicesOperations from .operations import BlobContainersOperations +from .operations import FileServicesOperations +from .operations import FileSharesOperations from . import models @@ -43,6 +45,10 @@ class StorageManagementClient(SDKClient): :vartype blob_services: azure.mgmt.storage.v2019_04_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainers operations :vartype blob_containers: azure.mgmt.storage.v2019_04_01.operations.BlobContainersOperations + :ivar file_services: FileServices operations + :vartype file_services: azure.mgmt.storage.v2019_04_01.operations.FileServicesOperations + :ivar file_shares: FileShares operations + :vartype file_shares: azure.mgmt.storage.v2019_04_01.operations.FileSharesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -77,3 +83,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.blob_containers = BlobContainersOperations( self._client, self.config, self._serialize, self._deserialize) + self.file_services = FileServicesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.file_shares = FileSharesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py index 68d5bcd5f9a7..3c0de6b2c59e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py @@ -15,6 +15,7 @@ from ._models_py3 import AzureFilesIdentityBasedAuthentication from ._models_py3 import BlobContainer from ._models_py3 import BlobServiceProperties + from ._models_py3 import ChangeFeed from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import CorsRule from ._models_py3 import CorsRules @@ -27,6 +28,10 @@ from ._models_py3 import EncryptionService from ._models_py3 import EncryptionServices from ._models_py3 import Endpoints + from ._models_py3 import FileServiceItems + from ._models_py3 import FileServiceProperties + from ._models_py3 import FileShare + from ._models_py3 import FileShareItem from ._models_py3 import GeoReplicationStats from ._models_py3 import Identity from ._models_py3 import ImmutabilityPolicy @@ -78,6 +83,7 @@ from ._models import AzureFilesIdentityBasedAuthentication from ._models import BlobContainer from ._models import BlobServiceProperties + from ._models import ChangeFeed from ._models import CheckNameAvailabilityResult from ._models import CorsRule from ._models import CorsRules @@ -90,6 +96,10 @@ from ._models import EncryptionService from ._models import EncryptionServices from ._models import Endpoints + from ._models import FileServiceItems + from ._models import FileServiceProperties + from ._models import FileShare + from ._models import FileShareItem from ._models import GeoReplicationStats from ._models import Identity from ._models import ImmutabilityPolicy @@ -135,6 +145,8 @@ from ._models import Usage from ._models import UsageName from ._models import VirtualNetworkRule +from ._paged_models import BlobServicePropertiesPaged +from ._paged_models import FileShareItemPaged from ._paged_models import ListContainerItemPaged from ._paged_models import OperationPaged from ._paged_models import SkuPaged @@ -178,6 +190,7 @@ 'AzureFilesIdentityBasedAuthentication', 'BlobContainer', 'BlobServiceProperties', + 'ChangeFeed', 'CheckNameAvailabilityResult', 'CorsRule', 'CorsRules', @@ -190,6 +203,10 @@ 'EncryptionService', 'EncryptionServices', 'Endpoints', + 'FileServiceItems', + 'FileServiceProperties', + 'FileShare', + 'FileShareItem', 'GeoReplicationStats', 'Identity', 'ImmutabilityPolicy', @@ -239,7 +256,9 @@ 'SkuPaged', 'StorageAccountPaged', 'UsagePaged', + 'BlobServicePropertiesPaged', 'ListContainerItemPaged', + 'FileShareItemPaged', 'ReasonCode', 'SkuName', 'SkuTier', diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py index 8861ef04f4fe..d65b71635257 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class AccountSasParameters(Model): @@ -315,6 +316,8 @@ class BlobServiceProperties(Resource): :param automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. :type automatic_snapshot_policy_enabled: bool + :param change_feed: The blob service properties for change feed events. + :type change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed """ _validation = { @@ -331,6 +334,7 @@ class BlobServiceProperties(Resource): 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, + 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, } def __init__(self, **kwargs): @@ -339,6 +343,24 @@ def __init__(self, **kwargs): self.default_service_version = kwargs.get('default_service_version', None) self.delete_retention_policy = kwargs.get('delete_retention_policy', None) self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) + self.change_feed = kwargs.get('change_feed', None) + + +class ChangeFeed(Model): + """The blob service properties for change feed events. + + :param enabled: Indicates whether change feed event logging is enabled for + the Blob service. + :type enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ChangeFeed, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) class CheckNameAvailabilityResult(Model): @@ -380,12 +402,63 @@ def __init__(self, **kwargs): class CloudError(Model): - """CloudError. + """An error response from the Storage service. + + :param error: + :type error: ~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Storage service. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] """ _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } + def __init__(self, **kwargs): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + class CorsRule(Model): """Specifies a CORS rule for the Blob service. @@ -488,17 +561,17 @@ class DateAfterCreation(Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Integer value - indicating the age in days after creation - :type days_after_creation_greater_than: int + :param days_after_creation_greater_than: Required. Value indicating the + age in days after creation + :type days_after_creation_greater_than: float """ _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0}, + 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, } _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'int'}, + 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, } def __init__(self, **kwargs): @@ -511,17 +584,17 @@ class DateAfterModification(Model): All required parameters must be populated in order to send to Azure. - :param days_after_modification_greater_than: Required. Integer value - indicating the age in days after last modification - :type days_after_modification_greater_than: int + :param days_after_modification_greater_than: Required. Value indicating + the age in days after last modification + :type days_after_modification_greater_than: float """ _validation = { - 'days_after_modification_greater_than': {'required': True, 'minimum': 0}, + 'days_after_modification_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, } _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'int'}, + 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, } def __init__(self, **kwargs): @@ -726,6 +799,176 @@ def __init__(self, **kwargs): self.dfs = None +class FileServiceItems(Model): + """FileServiceItems. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of file services returned. + :vartype value: + list[~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, + } + + def __init__(self, **kwargs): + super(FileServiceItems, self).__init__(**kwargs) + self.value = None + + +class FileServiceProperties(Resource): + """The properties of File services in storage account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param cors: Specifies CORS rules for the File service. You can include up + to five CorsRule elements in the request. If no CorsRule elements are + included in the request body, all CORS rules will be deleted, and CORS + will be disabled for the File service. + :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + } + + def __init__(self, **kwargs): + super(FileServiceProperties, self).__init__(**kwargs) + self.cors = kwargs.get('cors', None) + + +class FileShare(AzureEntityResource): + """Properties of the file share, including Id, resource name, resource type, + Etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last + modified. + :vartype last_modified_time: datetime + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must be + greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 5120, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FileShare, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = kwargs.get('metadata', None) + self.share_quota = kwargs.get('share_quota', None) + + +class FileShareItem(AzureEntityResource): + """The file share properties be listed out. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last + modified. + :vartype last_modified_time: datetime + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must be + greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 5120, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FileShareItem, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = kwargs.get('metadata', None) + self.share_quota = kwargs.get('share_quota', None) + + class GeoReplicationStats(Model): """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is @@ -2226,9 +2469,8 @@ class StorageAccountCreateParameters(Model): at this time. To clear the existing custom domain, use an empty string for the custom domain name property. :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If - left unspecified the account encryption settings will remain the same. The - default setting is unencrypted. + :param encryption: Not applicable. Azure Storage encryption is enabled for + all storage accounts and cannot be disabled. :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption :param network_rule_set: Network rule set :type network_rule_set: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py index 42f4cb5b84f5..4bbb299a95bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class AccountSasParameters(Model): @@ -315,6 +316,8 @@ class BlobServiceProperties(Resource): :param automatic_snapshot_policy_enabled: Automatic Snapshot is enabled if set to true. :type automatic_snapshot_policy_enabled: bool + :param change_feed: The blob service properties for change feed events. + :type change_feed: ~azure.mgmt.storage.v2019_04_01.models.ChangeFeed """ _validation = { @@ -331,14 +334,33 @@ class BlobServiceProperties(Resource): 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, + 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, } - def __init__(self, *, cors=None, default_service_version: str=None, delete_retention_policy=None, automatic_snapshot_policy_enabled: bool=None, **kwargs) -> None: + def __init__(self, *, cors=None, default_service_version: str=None, delete_retention_policy=None, automatic_snapshot_policy_enabled: bool=None, change_feed=None, **kwargs) -> None: super(BlobServiceProperties, self).__init__(**kwargs) self.cors = cors self.default_service_version = default_service_version self.delete_retention_policy = delete_retention_policy self.automatic_snapshot_policy_enabled = automatic_snapshot_policy_enabled + self.change_feed = change_feed + + +class ChangeFeed(Model): + """The blob service properties for change feed events. + + :param enabled: Indicates whether change feed event logging is enabled for + the Blob service. + :type enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__(self, *, enabled: bool=None, **kwargs) -> None: + super(ChangeFeed, self).__init__(**kwargs) + self.enabled = enabled class CheckNameAvailabilityResult(Model): @@ -380,12 +402,63 @@ def __init__(self, **kwargs) -> None: class CloudError(Model): - """CloudError. + """An error response from the Storage service. + + :param error: + :type error: ~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody """ _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, } + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Storage service. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.storage.v2019_04_01.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + class CorsRule(Model): """Specifies a CORS rule for the Blob service. @@ -488,20 +561,20 @@ class DateAfterCreation(Model): All required parameters must be populated in order to send to Azure. - :param days_after_creation_greater_than: Required. Integer value - indicating the age in days after creation - :type days_after_creation_greater_than: int + :param days_after_creation_greater_than: Required. Value indicating the + age in days after creation + :type days_after_creation_greater_than: float """ _validation = { - 'days_after_creation_greater_than': {'required': True, 'minimum': 0}, + 'days_after_creation_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, } _attribute_map = { - 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'int'}, + 'days_after_creation_greater_than': {'key': 'daysAfterCreationGreaterThan', 'type': 'float'}, } - def __init__(self, *, days_after_creation_greater_than: int, **kwargs) -> None: + def __init__(self, *, days_after_creation_greater_than: float, **kwargs) -> None: super(DateAfterCreation, self).__init__(**kwargs) self.days_after_creation_greater_than = days_after_creation_greater_than @@ -511,20 +584,20 @@ class DateAfterModification(Model): All required parameters must be populated in order to send to Azure. - :param days_after_modification_greater_than: Required. Integer value - indicating the age in days after last modification - :type days_after_modification_greater_than: int + :param days_after_modification_greater_than: Required. Value indicating + the age in days after last modification + :type days_after_modification_greater_than: float """ _validation = { - 'days_after_modification_greater_than': {'required': True, 'minimum': 0}, + 'days_after_modification_greater_than': {'required': True, 'minimum': 0, 'multiple': 1}, } _attribute_map = { - 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'int'}, + 'days_after_modification_greater_than': {'key': 'daysAfterModificationGreaterThan', 'type': 'float'}, } - def __init__(self, *, days_after_modification_greater_than: int, **kwargs) -> None: + def __init__(self, *, days_after_modification_greater_than: float, **kwargs) -> None: super(DateAfterModification, self).__init__(**kwargs) self.days_after_modification_greater_than = days_after_modification_greater_than @@ -726,6 +799,176 @@ def __init__(self, **kwargs) -> None: self.dfs = None +class FileServiceItems(Model): + """FileServiceItems. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List of file services returned. + :vartype value: + list[~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FileServiceProperties]'}, + } + + def __init__(self, **kwargs) -> None: + super(FileServiceItems, self).__init__(**kwargs) + self.value = None + + +class FileServiceProperties(Resource): + """The properties of File services in storage account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param cors: Specifies CORS rules for the File service. You can include up + to five CorsRule elements in the request. If no CorsRule elements are + included in the request body, all CORS rules will be deleted, and CORS + will be disabled for the File service. + :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'cors': {'key': 'properties.cors', 'type': 'CorsRules'}, + } + + def __init__(self, *, cors=None, **kwargs) -> None: + super(FileServiceProperties, self).__init__(**kwargs) + self.cors = cors + + +class FileShare(AzureEntityResource): + """Properties of the file share, including Id, resource name, resource type, + Etag. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last + modified. + :vartype last_modified_time: datetime + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must be + greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 5120, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + } + + def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + super(FileShare, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = metadata + self.share_quota = share_quota + + +class FileShareItem(AzureEntityResource): + """The file share properties be listed out. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar last_modified_time: Returns the date and time the share was last + modified. + :vartype last_modified_time: datetime + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must be + greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'share_quota': {'maximum': 5120, 'minimum': 1}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, + 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + } + + def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + super(FileShareItem, self).__init__(**kwargs) + self.last_modified_time = None + self.metadata = metadata + self.share_quota = share_quota + + class GeoReplicationStats(Model): """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is @@ -2226,9 +2469,8 @@ class StorageAccountCreateParameters(Model): at this time. To clear the existing custom domain, use an empty string for the custom domain name property. :type custom_domain: ~azure.mgmt.storage.v2019_04_01.models.CustomDomain - :param encryption: Provides the encryption settings on the account. If - left unspecified the account encryption settings will remain the same. The - default setting is unencrypted. + :param encryption: Not applicable. Azure Storage encryption is enabled for + all storage accounts and cannot be disabled. :type encryption: ~azure.mgmt.storage.v2019_04_01.models.Encryption :param network_rule_set: Network rule set :type network_rule_set: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py index 753f43a46ea8..b1c9ac4fe23c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py @@ -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 ` 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 ` object @@ -77,3 +90,16 @@ class ListContainerItemPaged(Paged): def __init__(self, *args, **kwargs): super(ListContainerItemPaged, self).__init__(*args, **kwargs) +class FileShareItemPaged(Paged): + """ + A paging container for iterating over a list of :class:`FileShareItem ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[FileShareItem]'} + } + + def __init__(self, *args, **kwargs): + + super(FileShareItemPaged, self).__init__(*args, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py index 7bb554454062..ca747d46755f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py @@ -16,6 +16,8 @@ from ._management_policies_operations import ManagementPoliciesOperations from ._blob_services_operations import BlobServicesOperations from ._blob_containers_operations import BlobContainersOperations +from ._file_services_operations import FileServicesOperations +from ._file_shares_operations import FileSharesOperations __all__ = [ 'Operations', @@ -25,4 +27,6 @@ 'ManagementPoliciesOperations', 'BlobServicesOperations', 'BlobContainersOperations', + 'FileServicesOperations', + 'FileSharesOperations', ] diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py index f4da4bd3f6f8..1e50f320bcfe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py @@ -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`. + :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` + """ + 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 diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py new file mode 100644 index 000000000000..f4a2afc781e4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py @@ -0,0 +1,249 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class FileServicesOperations(object): + """FileServicesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-04-01". + :ivar file_services_name: The name of the file Service within the specified storage account. File Service Name must be "default". Constant value: "default". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-04-01" + self.file_services_name = "default" + + self.config = config + + def list( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """List all file services in storage accounts. + + :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`. + :return: FileServiceItems or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceItems or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileServiceItems', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} + + def set_service_properties( + self, resource_group_name, account_name, cors=None, custom_headers=None, raw=False, **operation_config): + """Sets the properties of file services in storage accounts, including + CORS (Cross-Origin Resource Sharing) rules. . + + :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 cors: Specifies CORS rules for the File service. You can + include up to five CorsRule elements in the request. If no CorsRule + elements are included in the request body, all CORS rules will be + deleted, and CORS will be disabled for the File service. + :type cors: ~azure.mgmt.storage.v2019_04_01.models.CorsRules + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: FileServiceProperties or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.FileServiceProperties(cors=cors) + + # Construct URL + url = self.set_service_properties.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'FileServicesName': self._serialize.url("self.file_services_name", self.file_services_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'FileServiceProperties') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileServiceProperties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} + + def get_service_properties( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Gets the properties of file services in storage accounts, including + CORS (Cross-Origin Resource Sharing) rules. + + :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`. + :return: FileServiceProperties or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_service_properties.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'FileServicesName': self._serialize.url("self.file_services_name", self.file_services_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileServiceProperties', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py new file mode 100644 index 000000000000..b874ff7f630d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py @@ -0,0 +1,437 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class FileSharesOperations(object): + """FileSharesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-04-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-04-01" + + self.config = config + + def list( + self, resource_group_name, account_name, skip_token=None, maxpagesize=None, filter=None, custom_headers=None, raw=False, **operation_config): + """Lists all shares. + + :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 skip_token: Optional. Continuation token for the list + operation. + :type skip_token: str + :param maxpagesize: Optional. Specified maximum number of shares that + can be included in the list. + :type maxpagesize: str + :param filter: Optional. When specified, only share names starting + with the filter will be listed. + :type filter: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of FileShareItem + :rtype: + ~azure.mgmt.storage.v2019_04_01.models.FileShareItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] + :raises: :class:`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) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + 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.FileShareItemPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} + + def create( + self, resource_group_name, account_name, share_name, metadata=None, share_quota=None, custom_headers=None, raw=False, **operation_config): + """Creates a new share under the specified account as described by request + body. The share resource includes metadata and properties for that + share. It does not include a list of the files contained by the share. + . + + :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 share_name: The name of the file share within the specified + storage account. File share names must be between 3 and 63 characters + in length and use numbers, lower-case letters and dash (-) only. Every + dash (-) character must be immediately preceded and followed by a + letter or number. + :type share_name: str + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must + be greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: FileShare or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + file_share = models.FileShare(metadata=metadata, share_quota=share_quota) + + # Construct URL + url = self.create.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), + 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, 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) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(file_share, 'FileShare') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileShare', response) + if response.status_code == 201: + deserialized = self._deserialize('FileShare', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} + + def update( + self, resource_group_name, account_name, share_name, metadata=None, share_quota=None, custom_headers=None, raw=False, **operation_config): + """Updates share properties as specified in request body. Properties not + mentioned in the request will not be changed. Update fails if the + specified share does not already exist. . + + :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 share_name: The name of the file share within the specified + storage account. File share names must be between 3 and 63 characters + in length and use numbers, lower-case letters and dash (-) only. Every + dash (-) character must be immediately preceded and followed by a + letter or number. + :type share_name: str + :param metadata: A name-value pair to associate with the share as + metadata. + :type metadata: dict[str, str] + :param share_quota: The maximum size of the share, in gigabytes. Must + be greater than 0, and less than or equal to 5TB (5120). + :type share_quota: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: FileShare or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + file_share = models.FileShare(metadata=metadata, share_quota=share_quota) + + # Construct URL + url = self.update.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), + 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, 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) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(file_share, 'FileShare') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + 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 + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileShare', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} + + def get( + self, resource_group_name, account_name, share_name, custom_headers=None, raw=False, **operation_config): + """Gets properties of a specified share. + + :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 share_name: The name of the file share within the specified + storage account. File share names must be between 3 and 63 characters + in length and use numbers, lower-case letters and dash (-) only. Every + dash (-) character must be immediately preceded and followed by a + letter or number. + :type share_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: FileShare or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.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), + 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, 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) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('FileShare', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} + + def delete( + self, resource_group_name, account_name, share_name, custom_headers=None, raw=False, **operation_config): + """Deletes specified share under its account. + + :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 share_name: The name of the file share within the specified + storage account. File share names must be between 3 and 63 characters + in length and use numbers, lower-case letters and dash (-) only. Every + dash (-) character must be immediately preceded and followed by a + letter or number. + :type share_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.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), + 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, 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) + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} diff --git a/sdk/storage/azure-mgmt-storage/setup.py b/sdk/storage/azure-mgmt-storage/setup.py index 8bef269c261e..8609a1e171a7 100644 --- a/sdk/storage/azure-mgmt-storage/setup.py +++ b/sdk/storage/azure-mgmt-storage/setup.py @@ -64,7 +64,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7',