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 8dc5a6fb6dee..c0f6cd03ebe9 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 @@ -237,6 +237,19 @@ def management_policies(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 object_replication_policies(self): + """Instance depends on the API version: + + * 2019-06-01: :class:`ObjectReplicationPoliciesOperations` + """ + api_version = self._get_api_version('object_replication_policies') + if api_version == '2019-06-01': + from .v2019_06_01.operations import ObjectReplicationPoliciesOperations 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 operations(self): """Instance depends on the API version: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py index 215670463ba7..955359f0b0e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py @@ -20,6 +20,7 @@ from .operations import ManagementPoliciesOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations +from .operations import ObjectReplicationPoliciesOperations from .operations import EncryptionScopesOperations from .operations import BlobServicesOperations from .operations import BlobContainersOperations @@ -48,6 +49,8 @@ class StorageManagementClient(SDKClient): :vartype private_endpoint_connections: azure.mgmt.storage.v2019_06_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResources operations :vartype private_link_resources: azure.mgmt.storage.v2019_06_01.operations.PrivateLinkResourcesOperations + :ivar object_replication_policies: ObjectReplicationPolicies operations + :vartype object_replication_policies: azure.mgmt.storage.v2019_06_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopes operations :vartype encryption_scopes: azure.mgmt.storage.v2019_06_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServices operations @@ -92,6 +95,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.encryption_scopes = EncryptionScopesOperations( self._client, self.config, self._serialize, self._deserialize) self.blob_services = BlobServicesOperations( diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py index dca930d902ba..825458fba64b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py @@ -62,6 +62,9 @@ from ._models_py3 import ManagementPolicySnapShot from ._models_py3 import MetricSpecification from ._models_py3 import NetworkRuleSet + from ._models_py3 import ObjectReplicationPolicy + from ._models_py3 import ObjectReplicationPolicyFilter + from ._models_py3 import ObjectReplicationPolicyRule from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import PrivateEndpoint @@ -147,6 +150,9 @@ from ._models import ManagementPolicySnapShot from ._models import MetricSpecification from ._models import NetworkRuleSet + from ._models import ObjectReplicationPolicy + from ._models import ObjectReplicationPolicyFilter + from ._models import ObjectReplicationPolicyRule from ._models import Operation from ._models import OperationDisplay from ._models import PrivateEndpoint @@ -183,6 +189,7 @@ from ._paged_models import EncryptionScopePaged from ._paged_models import FileShareItemPaged from ._paged_models import ListContainerItemPaged +from ._paged_models import ObjectReplicationPolicyPaged from ._paged_models import OperationPaged from ._paged_models import SkuInformationPaged from ._paged_models import StorageAccountPaged @@ -281,6 +288,9 @@ 'ManagementPolicySnapShot', 'MetricSpecification', 'NetworkRuleSet', + 'ObjectReplicationPolicy', + 'ObjectReplicationPolicyFilter', + 'ObjectReplicationPolicyRule', 'Operation', 'OperationDisplay', 'PrivateEndpoint', @@ -317,6 +327,7 @@ 'SkuInformationPaged', 'StorageAccountPaged', 'UsagePaged', + 'ObjectReplicationPolicyPaged', 'EncryptionScopePaged', 'BlobServicePropertiesPaged', 'ListContainerItemPaged', diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py index f468bcf7ac20..3ae54832ea74 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py @@ -383,9 +383,11 @@ class BlobRestoreRange(Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. Empty means account start. + :param start_range: Required. Blob start range. This is inclusive. Empty + means account start. :type start_range: str - :param end_range: Required. Blob end range. Empty means account end. + :param end_range: Required. Blob end range. This is exclusive. Empty means + account end. :type end_range: str """ @@ -2191,6 +2193,130 @@ def __init__(self, **kwargs): self.default_action = kwargs.get('default_action', "Allow") +class ObjectReplicationPolicy(Resource): + """The replication policy between two storage accounts. Multiple rules can be + defined in one policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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 policy_id: A unique id for object replication policy. + :vartype policy_id: str + :ivar enabled_time: Indicates when the policy is enabled on the source + account. + :vartype enabled_time: datetime + :param source_account: Required. Required. Source account name. + :type source_account: str + :param destination_account: Required. Required. Destination account name. + :type destination_account: str + :param rules: The storage account object replication rules. + :type rules: + list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_id': {'readonly': True}, + 'enabled_time': {'readonly': True}, + 'source_account': {'required': True}, + 'destination_account': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, + 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, + 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, + 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicy, self).__init__(**kwargs) + self.policy_id = None + self.enabled_time = None + self.source_account = kwargs.get('source_account', None) + self.destination_account = kwargs.get('destination_account', None) + self.rules = kwargs.get('rules', None) + + +class ObjectReplicationPolicyFilter(Model): + """Filters limit replication to a subset of blobs within the storage account. + A logical OR is performed on values in the filter. If multiple filters are + defined, a logical AND is performed on all filters. + + :param prefix_match: Optional. Filters the results to replicate only blobs + whose names begin with the specified prefix. + :type prefix_match: list[str] + :param min_creation_time: Blobs created after the time will be replicated + to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. + Example: 2020-02-19T16:05:00Z + :type min_creation_time: str + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) + self.prefix_match = kwargs.get('prefix_match', None) + self.min_creation_time = kwargs.get('min_creation_time', None) + + +class ObjectReplicationPolicyRule(Model): + """The replication policy rule between two containers. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Rule Id is auto-generated for each new rule on destination + account. It is required for put policy on source account. + :type rule_id: str + :param source_container: Required. Required. Source container name. + :type source_container: str + :param destination_container: Required. Required. Destination container + name. + :type destination_container: str + :param filters: Optional. An object that defines the filter set. + :type filters: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + """ + + _validation = { + 'source_container': {'required': True}, + 'destination_container': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'source_container': {'key': 'sourceContainer', 'type': 'str'}, + 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, + 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicyRule, self).__init__(**kwargs) + self.rule_id = kwargs.get('rule_id', None) + self.source_container = kwargs.get('source_container', None) + self.destination_container = kwargs.get('destination_container', None) + self.filters = kwargs.get('filters', None) + + class Operation(Model): """Storage REST API operation definition. @@ -2455,6 +2581,9 @@ def __init__(self, **kwargs): class RestorePolicyProperties(Model): """The blob service properties for blob restore policy. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param enabled: Required. Blob restore is enabled if set to true. @@ -2462,22 +2591,28 @@ class RestorePolicyProperties(Model): :param days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. :type days: int + :ivar last_enabled_time: Returns the date and time the restore policy was + last enabled. + :vartype last_enabled_time: datetime """ _validation = { 'enabled': {'required': True}, 'days': {'maximum': 365, 'minimum': 1}, + 'last_enabled_time': {'readonly': True}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'days': {'key': 'days', 'type': 'int'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, } def __init__(self, **kwargs): super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.days = kwargs.get('days', None) + self.last_enabled_time = None class Restriction(Model): diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py index 05e6f0c193d7..cadc881d9b92 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py @@ -383,9 +383,11 @@ class BlobRestoreRange(Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. Empty means account start. + :param start_range: Required. Blob start range. This is inclusive. Empty + means account start. :type start_range: str - :param end_range: Required. Blob end range. Empty means account end. + :param end_range: Required. Blob end range. This is exclusive. Empty means + account end. :type end_range: str """ @@ -2191,6 +2193,130 @@ def __init__(self, *, bypass="AzureServices", virtual_network_rules=None, ip_rul self.default_action = default_action +class ObjectReplicationPolicy(Resource): + """The replication policy between two storage accounts. Multiple rules can be + defined in one policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :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 policy_id: A unique id for object replication policy. + :vartype policy_id: str + :ivar enabled_time: Indicates when the policy is enabled on the source + account. + :vartype enabled_time: datetime + :param source_account: Required. Required. Source account name. + :type source_account: str + :param destination_account: Required. Required. Destination account name. + :type destination_account: str + :param rules: The storage account object replication rules. + :type rules: + list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_id': {'readonly': True}, + 'enabled_time': {'readonly': True}, + 'source_account': {'required': True}, + 'destination_account': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, + 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, + 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, + 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, + } + + def __init__(self, *, source_account: str, destination_account: str, rules=None, **kwargs) -> None: + super(ObjectReplicationPolicy, self).__init__(**kwargs) + self.policy_id = None + self.enabled_time = None + self.source_account = source_account + self.destination_account = destination_account + self.rules = rules + + +class ObjectReplicationPolicyFilter(Model): + """Filters limit replication to a subset of blobs within the storage account. + A logical OR is performed on values in the filter. If multiple filters are + defined, a logical AND is performed on all filters. + + :param prefix_match: Optional. Filters the results to replicate only blobs + whose names begin with the specified prefix. + :type prefix_match: list[str] + :param min_creation_time: Blobs created after the time will be replicated + to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. + Example: 2020-02-19T16:05:00Z + :type min_creation_time: str + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, + } + + def __init__(self, *, prefix_match=None, min_creation_time: str=None, **kwargs) -> None: + super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) + self.prefix_match = prefix_match + self.min_creation_time = min_creation_time + + +class ObjectReplicationPolicyRule(Model): + """The replication policy rule between two containers. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Rule Id is auto-generated for each new rule on destination + account. It is required for put policy on source account. + :type rule_id: str + :param source_container: Required. Required. Source container name. + :type source_container: str + :param destination_container: Required. Required. Destination container + name. + :type destination_container: str + :param filters: Optional. An object that defines the filter set. + :type filters: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + """ + + _validation = { + 'source_container': {'required': True}, + 'destination_container': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'source_container': {'key': 'sourceContainer', 'type': 'str'}, + 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, + 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, + } + + def __init__(self, *, source_container: str, destination_container: str, rule_id: str=None, filters=None, **kwargs) -> None: + super(ObjectReplicationPolicyRule, self).__init__(**kwargs) + self.rule_id = rule_id + self.source_container = source_container + self.destination_container = destination_container + self.filters = filters + + class Operation(Model): """Storage REST API operation definition. @@ -2455,6 +2581,9 @@ def __init__(self, **kwargs) -> None: class RestorePolicyProperties(Model): """The blob service properties for blob restore policy. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param enabled: Required. Blob restore is enabled if set to true. @@ -2462,22 +2591,28 @@ class RestorePolicyProperties(Model): :param days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. :type days: int + :ivar last_enabled_time: Returns the date and time the restore policy was + last enabled. + :vartype last_enabled_time: datetime """ _validation = { 'enabled': {'required': True}, 'days': {'maximum': 365, 'minimum': 1}, + 'last_enabled_time': {'readonly': True}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'days': {'key': 'days', 'type': 'int'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, } def __init__(self, *, enabled: bool, days: int=None, **kwargs) -> None: super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days + self.last_enabled_time = None class Restriction(Model): diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py index 2d27addefa8b..d82ca88ae5a5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py @@ -64,6 +64,19 @@ class UsagePaged(Paged): def __init__(self, *args, **kwargs): super(UsagePaged, self).__init__(*args, **kwargs) +class ObjectReplicationPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ObjectReplicationPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ObjectReplicationPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ObjectReplicationPolicyPaged, self).__init__(*args, **kwargs) class EncryptionScopePaged(Paged): """ A paging container for iterating over a list of :class:`EncryptionScope ` object diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py index b7aa936eb73a..e0f831848449 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py @@ -16,6 +16,7 @@ from ._management_policies_operations import ManagementPoliciesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations from ._encryption_scopes_operations import EncryptionScopesOperations from ._blob_services_operations import BlobServicesOperations from ._blob_containers_operations import BlobContainersOperations @@ -30,6 +31,7 @@ 'ManagementPoliciesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'ObjectReplicationPoliciesOperations', 'EncryptionScopesOperations', 'BlobServicesOperations', 'BlobContainersOperations', diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py new file mode 100644 index 000000000000..84cff954bc16 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py @@ -0,0 +1,316 @@ +# 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 .. import models + + +class ObjectReplicationPoliciesOperations(object): + """ObjectReplicationPoliciesOperations 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-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01" + + self.config = config + + def list( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """List the object replication policies associated with the storage + 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 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 ObjectReplicationPolicy + :rtype: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] + :raises: + :class:`ErrorResponseException` + """ + 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]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ObjectReplicationPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} + + def get( + self, resource_group_name, account_name, object_replication_policy_id, custom_headers=None, raw=False, **operation_config): + """Get the object replication policy of the storage account by policy ID. + + :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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ObjectReplicationPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ObjectReplicationPolicy', 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}/objectReplicationPolicies/{objectReplicationPolicyId}'} + + def create_or_update( + self, resource_group_name, account_name, object_replication_policy_id, properties, custom_headers=None, raw=False, **operation_config): + """Create or update the object replication policy of the storage 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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: str + :param properties: The object replication policy set to a storage + account. A unique policy ID will be created if absent. + :type properties: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + :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: ObjectReplicationPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_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), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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(properties, 'ObjectReplicationPolicy') + + # 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]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ObjectReplicationPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} + + def delete( + self, resource_group_name, account_name, object_replication_policy_id, custom_headers=None, raw=False, **operation_config): + """Deletes the object replication policy associated with the specified + storage 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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # 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), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'}