From 7344d6db5a035b9e3f31c31d05f62a2612e9f562 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 29 Oct 2018 13:55:38 -0700 Subject: [PATCH 1/4] [AutoPR storage/resource-manager] Support for SRP BlobServiceProperties API (#3684) * Generated from c2b7a3b94ad0e66549b8fd915196892eeabfe349 Support for SRP BlobServiceProperties API * Packaging update of azure-mgmt-storage * Generated from 5f13feda58d8622708a190403ba2d4745a12ed61 Address CR comments; fix java section in readme.md --- azure-mgmt-storage/MANIFEST.in | 3 + .../mgmt/storage/storage_management_client.py | 13 ++ .../storage/v2018_07_01/models/__init__.py | 12 ++ .../models/blob_service_properties.py | 64 ++++++ .../models/blob_service_properties_py3.py | 64 ++++++ .../storage/v2018_07_01/models/cors_rule.py | 61 ++++++ .../v2018_07_01/models/cors_rule_py3.py | 61 ++++++ .../storage/v2018_07_01/models/cors_rules.py | 30 +++ .../v2018_07_01/models/cors_rules_py3.py | 30 +++ .../models/delete_retention_policy.py | 39 ++++ .../models/delete_retention_policy_py3.py | 39 ++++ .../v2018_07_01/operations/__init__.py | 2 + .../operations/blob_services_operations.py | 185 ++++++++++++++++++ .../v2018_07_01/storage_management_client.py | 5 + 14 files changed, 608 insertions(+) create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties_py3.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule_py3.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules_py3.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy_py3.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/blob_services_operations.py diff --git a/azure-mgmt-storage/MANIFEST.in b/azure-mgmt-storage/MANIFEST.in index bb37a2723dae..6ceb27f7a96e 100644 --- a/azure-mgmt-storage/MANIFEST.in +++ b/azure-mgmt-storage/MANIFEST.in @@ -1 +1,4 @@ include *.rst +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/azure-mgmt-storage/azure/mgmt/storage/storage_management_client.py b/azure-mgmt-storage/azure/mgmt/storage/storage_management_client.py index 13ffe3a4b20e..b20a506485c7 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/storage_management_client.py +++ b/azure-mgmt-storage/azure/mgmt/storage/storage_management_client.py @@ -162,6 +162,19 @@ def blob_containers(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 blob_services(self): + """Instance depends on the API version: + + * 2018-07-01: :class:`BlobServicesOperations` + """ + api_version = self._get_api_version('blob_services') + if api_version == '2018-07-01': + from .v2018_07_01.operations import BlobServicesOperations 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/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py index 7af0b0e1a1e1..c951f77e1575 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py @@ -55,6 +55,10 @@ from .legal_hold_py3 import LegalHold from .list_container_item_py3 import ListContainerItem from .list_container_items_py3 import ListContainerItems + from .cors_rule_py3 import CorsRule + from .cors_rules_py3 import CorsRules + from .delete_retention_policy_py3 import DeleteRetentionPolicy + from .blob_service_properties_py3 import BlobServiceProperties from .storage_account_management_policies_py3 import StorageAccountManagementPolicies from .management_policies_rules_set_parameter_py3 import ManagementPoliciesRulesSetParameter except (SyntaxError, ImportError): @@ -103,6 +107,10 @@ from .legal_hold import LegalHold from .list_container_item import ListContainerItem from .list_container_items import ListContainerItems + from .cors_rule import CorsRule + from .cors_rules import CorsRules + from .delete_retention_policy import DeleteRetentionPolicy + from .blob_service_properties import BlobServiceProperties from .storage_account_management_policies import StorageAccountManagementPolicies from .management_policies_rules_set_parameter import ManagementPoliciesRulesSetParameter from .operation_paged import OperationPaged @@ -184,6 +192,10 @@ 'LegalHold', 'ListContainerItem', 'ListContainerItems', + 'CorsRule', + 'CorsRules', + 'DeleteRetentionPolicy', + 'BlobServiceProperties', 'StorageAccountManagementPolicies', 'ManagementPoliciesRulesSetParameter', 'OperationPaged', diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties.py new file mode 100644 index 000000000000..912f341bb581 --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class BlobServiceProperties(Resource): + """The properties of a storage account’s Blob service. + + 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 Blob 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 Blob service. + :type cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules + :param default_service_version: DefaultServiceVersion indicates the + default version to use for requests to the Blob service if an incoming + request’s version is not specified. Possible values include version + 2008-10-27 and all more recent versions. + :type default_service_version: str + :param delete_retention_policy: The blob service properties for soft + delete. + :type delete_retention_policy: + ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy + """ + + _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'}, + 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, + 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, + } + + def __init__(self, **kwargs): + super(BlobServiceProperties, self).__init__(**kwargs) + self.cors = kwargs.get('cors', None) + self.default_service_version = kwargs.get('default_service_version', None) + self.delete_retention_policy = kwargs.get('delete_retention_policy', None) diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties_py3.py new file mode 100644 index 000000000000..b2532b2a6cfc --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/blob_service_properties_py3.py @@ -0,0 +1,64 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource_py3 import Resource + + +class BlobServiceProperties(Resource): + """The properties of a storage account’s Blob service. + + 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 Blob 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 Blob service. + :type cors: ~azure.mgmt.storage.v2018_07_01.models.CorsRules + :param default_service_version: DefaultServiceVersion indicates the + default version to use for requests to the Blob service if an incoming + request’s version is not specified. Possible values include version + 2008-10-27 and all more recent versions. + :type default_service_version: str + :param delete_retention_policy: The blob service properties for soft + delete. + :type delete_retention_policy: + ~azure.mgmt.storage.v2018_07_01.models.DeleteRetentionPolicy + """ + + _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'}, + 'default_service_version': {'key': 'properties.defaultServiceVersion', 'type': 'str'}, + 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, + } + + def __init__(self, *, cors=None, default_service_version: str=None, delete_retention_policy=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 diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule.py new file mode 100644 index 000000000000..0777423f048f --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CorsRule(Model): + """Specifies a CORS rule for the Blob service. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. Required if CorsRule element is present. + A list of origin domains that will be allowed via CORS, or "*" to allow + all domains + :type allowed_origins: list[str] + :param allowed_methods: Required. Required if CorsRule element is present. + A list of HTTP methods that are allowed to be executed by the origin. + :type allowed_methods: list[str] + :param max_age_in_seconds: Required. Required if CorsRule element is + present. The number of seconds that the client/browser should cache a + preflight response. + :type max_age_in_seconds: int + :param exposed_headers: Required. Required if CorsRule element is present. + A list of response headers to expose to CORS clients. + :type exposed_headers: list[str] + :param allowed_headers: Required. Required if CorsRule element is present. + A list of headers allowed to be part of the cross-origin request. + :type allowed_headers: list[str] + """ + + _validation = { + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'max_age_in_seconds': {'required': True}, + 'exposed_headers': {'required': True}, + 'allowed_headers': {'required': True}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, + 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = kwargs.get('allowed_origins', None) + self.allowed_methods = kwargs.get('allowed_methods', None) + self.max_age_in_seconds = kwargs.get('max_age_in_seconds', None) + self.exposed_headers = kwargs.get('exposed_headers', None) + self.allowed_headers = kwargs.get('allowed_headers', None) diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule_py3.py new file mode 100644 index 000000000000..b88a7928cd1c --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rule_py3.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CorsRule(Model): + """Specifies a CORS rule for the Blob service. + + All required parameters must be populated in order to send to Azure. + + :param allowed_origins: Required. Required if CorsRule element is present. + A list of origin domains that will be allowed via CORS, or "*" to allow + all domains + :type allowed_origins: list[str] + :param allowed_methods: Required. Required if CorsRule element is present. + A list of HTTP methods that are allowed to be executed by the origin. + :type allowed_methods: list[str] + :param max_age_in_seconds: Required. Required if CorsRule element is + present. The number of seconds that the client/browser should cache a + preflight response. + :type max_age_in_seconds: int + :param exposed_headers: Required. Required if CorsRule element is present. + A list of response headers to expose to CORS clients. + :type exposed_headers: list[str] + :param allowed_headers: Required. Required if CorsRule element is present. + A list of headers allowed to be part of the cross-origin request. + :type allowed_headers: list[str] + """ + + _validation = { + 'allowed_origins': {'required': True}, + 'allowed_methods': {'required': True}, + 'max_age_in_seconds': {'required': True}, + 'exposed_headers': {'required': True}, + 'allowed_headers': {'required': True}, + } + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, + 'max_age_in_seconds': {'key': 'maxAgeInSeconds', 'type': 'int'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, + } + + def __init__(self, *, allowed_origins, allowed_methods, max_age_in_seconds: int, exposed_headers, allowed_headers, **kwargs) -> None: + super(CorsRule, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.max_age_in_seconds = max_age_in_seconds + self.exposed_headers = exposed_headers + self.allowed_headers = allowed_headers diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules.py new file mode 100644 index 000000000000..4b021f3c3688 --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CorsRules(Model): + """Sets the CORS rules. You can include up to five CorsRule elements in the + request. . + + :param cors_rules: The List of CORS rules. You can include up to five + CorsRule elements in the request. + :type cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] + """ + + _attribute_map = { + 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, + } + + def __init__(self, **kwargs): + super(CorsRules, self).__init__(**kwargs) + self.cors_rules = kwargs.get('cors_rules', None) diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules_py3.py new file mode 100644 index 000000000000..7a8695adabaa --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/cors_rules_py3.py @@ -0,0 +1,30 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class CorsRules(Model): + """Sets the CORS rules. You can include up to five CorsRule elements in the + request. . + + :param cors_rules: The List of CORS rules. You can include up to five + CorsRule elements in the request. + :type cors_rules: list[~azure.mgmt.storage.v2018_07_01.models.CorsRule] + """ + + _attribute_map = { + 'cors_rules': {'key': 'corsRules', 'type': '[CorsRule]'}, + } + + def __init__(self, *, cors_rules=None, **kwargs) -> None: + super(CorsRules, self).__init__(**kwargs) + self.cors_rules = cors_rules diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy.py new file mode 100644 index 000000000000..1edc91c2320a --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DeleteRetentionPolicy(Model): + """The blob service properties for soft delete. + + :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the + Blob service. + :type enabled: bool + :param days: Indicates the number of days that the deleted blob should be + retained. The minimum specified value can be 1 and the maximum value can + be 365. + :type days: int + """ + + _validation = { + 'days': {'maximum': 365, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(DeleteRetentionPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy_py3.py new file mode 100644 index 000000000000..9fcc691aadad --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/delete_retention_policy_py3.py @@ -0,0 +1,39 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DeleteRetentionPolicy(Model): + """The blob service properties for soft delete. + + :param enabled: Indicates whether DeleteRetentionPolicy is enabled for the + Blob service. + :type enabled: bool + :param days: Indicates the number of days that the deleted blob should be + retained. The minimum specified value can be 1 and the maximum value can + be 365. + :type days: int + """ + + _validation = { + 'days': {'maximum': 365, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool=None, days: int=None, **kwargs) -> None: + super(DeleteRetentionPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.days = days diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py index 455c0dc48e1c..78a2d1b4828c 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py @@ -13,6 +13,7 @@ from .skus_operations import SkusOperations from .storage_accounts_operations import StorageAccountsOperations from .usages_operations import UsagesOperations +from .blob_services_operations import BlobServicesOperations from .blob_containers_operations import BlobContainersOperations from .management_policies_operations import ManagementPoliciesOperations @@ -21,6 +22,7 @@ 'SkusOperations', 'StorageAccountsOperations', 'UsagesOperations', + 'BlobServicesOperations', 'BlobContainersOperations', 'ManagementPoliciesOperations', ] diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/blob_services_operations.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/blob_services_operations.py new file mode 100644 index 000000000000..306a2f399adc --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/blob_services_operations.py @@ -0,0 +1,185 @@ +# 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 BlobServicesOperations(object): + """BlobServicesOperations operations. + + :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: "2018-07-01". + :ivar blob_services_name: The name of the blob Service within the specified storage account. Blob 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 = "2018-07-01" + self.blob_services_name = "default" + + self.config = config + + 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 + properties for Storage Analytics and 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 parameters: The properties of a storage account’s Blob service, + including properties for Storage Analytics and CORS (Cross-Origin + Resource Sharing) rules. + :type parameters: + ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties + :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: BlobServiceProperties or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # 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), + 'BlobServicesName': self._serialize.url("self.blob_services_name", self.blob_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, 'BlobServiceProperties') + + # 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('BlobServiceProperties', 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}/blobServices/{BlobServicesName}'} + + def get_service_properties( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """Gets the properties of a storage account’s Blob service, including + properties for Storage Analytics and 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: BlobServiceProperties or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties + 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), + 'BlobServicesName': self._serialize.url("self.blob_services_name", self.blob_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('BlobServiceProperties', 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}/blobServices/{BlobServicesName}'} diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/storage_management_client.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/storage_management_client.py index 9158bf02e751..05ed8b323576 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/storage_management_client.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/storage_management_client.py @@ -17,6 +17,7 @@ from .operations.skus_operations import SkusOperations from .operations.storage_accounts_operations import StorageAccountsOperations from .operations.usages_operations import UsagesOperations +from .operations.blob_services_operations import BlobServicesOperations from .operations.blob_containers_operations import BlobContainersOperations from .operations.management_policies_operations import ManagementPoliciesOperations from . import models @@ -68,6 +69,8 @@ class StorageManagementClient(SDKClient): :vartype storage_accounts: azure.mgmt.storage.v2018_07_01.operations.StorageAccountsOperations :ivar usages: Usages operations :vartype usages: azure.mgmt.storage.v2018_07_01.operations.UsagesOperations + :ivar blob_services: BlobServices operations + :vartype blob_services: azure.mgmt.storage.v2018_07_01.operations.BlobServicesOperations :ivar blob_containers: BlobContainers operations :vartype blob_containers: azure.mgmt.storage.v2018_07_01.operations.BlobContainersOperations :ivar management_policies: ManagementPolicies operations @@ -99,6 +102,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.usages = UsagesOperations( self._client, self.config, self._serialize, self._deserialize) + self.blob_services = BlobServicesOperations( + self._client, self.config, self._serialize, self._deserialize) self.blob_containers = BlobContainersOperations( self._client, self.config, self._serialize, self._deserialize) self.management_policies = ManagementPoliciesOperations( From b673676eaf69f30d669c6aa4f08534dbb04d3189 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 14 Nov 2018 07:35:50 -0800 Subject: [PATCH 2/4] Generated from 1f26996e492bf786c2acd06e0a4e46159c52df70 (#3792) Adds storage account quick failover API --- .../v2018_07_01/models/storage_account.py | 6 ++ .../v2018_07_01/models/storage_account_py3.py | 6 ++ .../operations/storage_accounts_operations.py | 85 +++++++++++++++++++ 3 files changed, 97 insertions(+) diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py index 379f54fc2b9f..e16361ff896d 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py @@ -105,6 +105,9 @@ class StorageAccount(TrackedResource): :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. :type is_hns_enabled: bool + :ivar failover_in_progress: If the failover is in progress, the value will + be true, otherwise, it will be null. + :vartype failover_in_progress: bool """ _validation = { @@ -127,6 +130,7 @@ class StorageAccount(TrackedResource): 'encryption': {'readonly': True}, 'access_tier': {'readonly': True}, 'network_rule_set': {'readonly': True}, + 'failover_in_progress': {'readonly': True}, } _attribute_map = { @@ -154,6 +158,7 @@ class StorageAccount(TrackedResource): 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -177,3 +182,4 @@ def __init__(self, **kwargs): self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) self.network_rule_set = None self.is_hns_enabled = kwargs.get('is_hns_enabled', None) + self.failover_in_progress = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py index b83276b42715..19f708119c3f 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py @@ -105,6 +105,9 @@ class StorageAccount(TrackedResource): :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. :type is_hns_enabled: bool + :ivar failover_in_progress: If the failover is in progress, the value will + be true, otherwise, it will be null. + :vartype failover_in_progress: bool """ _validation = { @@ -127,6 +130,7 @@ class StorageAccount(TrackedResource): 'encryption': {'readonly': True}, 'access_tier': {'readonly': True}, 'network_rule_set': {'readonly': True}, + 'failover_in_progress': {'readonly': True}, } _attribute_map = { @@ -154,6 +158,7 @@ class StorageAccount(TrackedResource): 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, } def __init__(self, *, location: str, tags=None, identity=None, enable_azure_files_aad_integration: bool=None, enable_https_traffic_only: bool=None, is_hns_enabled: bool=None, **kwargs) -> None: @@ -177,3 +182,4 @@ def __init__(self, *, location: str, tags=None, identity=None, enable_azure_file self.enable_https_traffic_only = enable_https_traffic_only self.network_rule_set = None self.is_hns_enabled = is_hns_enabled + self.failover_in_progress = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py index 7b34e2cada26..018aebf46674 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py @@ -840,3 +840,88 @@ def list_service_sas( return deserialized list_service_sas.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'} + + + def _failover_initial( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.failover.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 = {} + 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.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + 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 + + def failover( + self, resource_group_name, account_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Failover request can be triggered for a storage account in case of + availability issues. The failover occurs from the storage account's + primary cluster to secondary cluster for RA-GRS accounts. The secondary + cluster will become primary after failover. + + :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: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + account_name=account_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} From 1070a263a118682861e600cbff05bae587f75d18 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 15 Nov 2018 14:30:14 -0800 Subject: [PATCH 3/4] [AutoPR storage/resource-manager] Adds Geo Replication Stats in Azure Storage Account's properties (#3789) * Generated from 6363da5bf9a13499463df8ff5e443801d064ab84 Adds Geo Replication Stats in Azure Storage Account's properties * Generated from 126237ac76d98075599b17e0032c37e0af486e8b Merge branch 'master' into adds_geo_replication_stats --- .../storage/v2018_07_01/models/__init__.py | 7 +++ .../models/geo_replication_stats.py | 53 +++++++++++++++++++ .../models/geo_replication_stats_py3.py | 53 +++++++++++++++++++ .../v2018_07_01/models/storage_account.py | 6 +++ .../v2018_07_01/models/storage_account_py3.py | 6 +++ .../models/storage_management_client_enums.py | 12 +++++ .../operations/storage_accounts_operations.py | 10 +++- 7 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats.py create mode 100644 azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats_py3.py diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py index c951f77e1575..10fdba5e08a3 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py @@ -31,6 +31,7 @@ from .identity_py3 import Identity from .storage_account_create_parameters_py3 import StorageAccountCreateParameters from .endpoints_py3 import Endpoints + from .geo_replication_stats_py3 import GeoReplicationStats from .storage_account_py3 import StorageAccount from .storage_account_key_py3 import StorageAccountKey from .storage_account_list_keys_result_py3 import StorageAccountListKeysResult @@ -83,6 +84,7 @@ from .identity import Identity from .storage_account_create_parameters import StorageAccountCreateParameters from .endpoints import Endpoints + from .geo_replication_stats import GeoReplicationStats from .storage_account import StorageAccount from .storage_account_key import StorageAccountKey from .storage_account_list_keys_result import StorageAccountListKeysResult @@ -129,6 +131,7 @@ Bypass, DefaultAction, AccessTier, + GeoReplicationStatus, ProvisioningState, AccountStatus, KeyPermission, @@ -144,6 +147,7 @@ LeaseDuration, ImmutabilityPolicyState, ImmutabilityPolicyUpdateType, + StorageAccountExpand, ) __all__ = [ @@ -168,6 +172,7 @@ 'Identity', 'StorageAccountCreateParameters', 'Endpoints', + 'GeoReplicationStats', 'StorageAccount', 'StorageAccountKey', 'StorageAccountListKeysResult', @@ -213,6 +218,7 @@ 'Bypass', 'DefaultAction', 'AccessTier', + 'GeoReplicationStatus', 'ProvisioningState', 'AccountStatus', 'KeyPermission', @@ -228,4 +234,5 @@ 'LeaseDuration', 'ImmutabilityPolicyState', 'ImmutabilityPolicyUpdateType', + 'StorageAccountExpand', ] diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats.py new file mode 100644 index 000000000000..c5d108e0d189 --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 + enabled for the storage account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of the secondary location. Possible values are: - + Live: Indicates that the secondary location is active and operational. - + Bootstrap: Indicates initial synchronization from the primary location to + the secondary location is in progress.This typically occurs when + replication is first enabled. - Unavailable: Indicates that the secondary + location is temporarily unavailable. Possible values include: 'Live', + 'Bootstrap', 'Unavailable' + :vartype status: str or + ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStatus + :ivar last_sync_time: All primary writes preceding this UTC date/time + value are guaranteed to be available for read operations. Primary writes + following this point in time may or may not be available for reads. + Element may be default value if value of LastSyncTime is not available, + this can happen if secondary is offline or we are in bootstrap. + :vartype last_sync_time: datetime + """ + + _validation = { + 'status': {'readonly': True}, + 'last_sync_time': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(GeoReplicationStats, self).__init__(**kwargs) + self.status = None + self.last_sync_time = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats_py3.py new file mode 100644 index 000000000000..1f9b84b3602a --- /dev/null +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/geo_replication_stats_py3.py @@ -0,0 +1,53 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +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 + enabled for the storage account. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of the secondary location. Possible values are: - + Live: Indicates that the secondary location is active and operational. - + Bootstrap: Indicates initial synchronization from the primary location to + the secondary location is in progress.This typically occurs when + replication is first enabled. - Unavailable: Indicates that the secondary + location is temporarily unavailable. Possible values include: 'Live', + 'Bootstrap', 'Unavailable' + :vartype status: str or + ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStatus + :ivar last_sync_time: All primary writes preceding this UTC date/time + value are guaranteed to be available for read operations. Primary writes + following this point in time may or may not be available for reads. + Element may be default value if value of LastSyncTime is not available, + this can happen if secondary is offline or we are in bootstrap. + :vartype last_sync_time: datetime + """ + + _validation = { + 'status': {'readonly': True}, + 'last_sync_time': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'last_sync_time': {'key': 'lastSyncTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs) -> None: + super(GeoReplicationStats, self).__init__(**kwargs) + self.status = None + self.last_sync_time = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py index e16361ff896d..0c9c592accff 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account.py @@ -105,6 +105,9 @@ class StorageAccount(TrackedResource): :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. :type is_hns_enabled: bool + :ivar geo_replication_stats: Geo Replication Stats + :vartype geo_replication_stats: + ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool @@ -130,6 +133,7 @@ class StorageAccount(TrackedResource): 'encryption': {'readonly': True}, 'access_tier': {'readonly': True}, 'network_rule_set': {'readonly': True}, + 'geo_replication_stats': {'readonly': True}, 'failover_in_progress': {'readonly': True}, } @@ -158,6 +162,7 @@ class StorageAccount(TrackedResource): 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, } @@ -182,4 +187,5 @@ def __init__(self, **kwargs): self.enable_https_traffic_only = kwargs.get('enable_https_traffic_only', None) self.network_rule_set = None self.is_hns_enabled = kwargs.get('is_hns_enabled', None) + self.geo_replication_stats = None self.failover_in_progress = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py index 19f708119c3f..a08fcf8b985c 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_account_py3.py @@ -105,6 +105,9 @@ class StorageAccount(TrackedResource): :param is_hns_enabled: Account HierarchicalNamespace enabled if sets to true. :type is_hns_enabled: bool + :ivar geo_replication_stats: Geo Replication Stats + :vartype geo_replication_stats: + ~azure.mgmt.storage.v2018_07_01.models.GeoReplicationStats :ivar failover_in_progress: If the failover is in progress, the value will be true, otherwise, it will be null. :vartype failover_in_progress: bool @@ -130,6 +133,7 @@ class StorageAccount(TrackedResource): 'encryption': {'readonly': True}, 'access_tier': {'readonly': True}, 'network_rule_set': {'readonly': True}, + 'geo_replication_stats': {'readonly': True}, 'failover_in_progress': {'readonly': True}, } @@ -158,6 +162,7 @@ class StorageAccount(TrackedResource): 'enable_https_traffic_only': {'key': 'properties.supportsHttpsTrafficOnly', 'type': 'bool'}, 'network_rule_set': {'key': 'properties.networkAcls', 'type': 'NetworkRuleSet'}, 'is_hns_enabled': {'key': 'properties.isHnsEnabled', 'type': 'bool'}, + 'geo_replication_stats': {'key': 'properties.geoReplicationStats', 'type': 'GeoReplicationStats'}, 'failover_in_progress': {'key': 'properties.failoverInProgress', 'type': 'bool'}, } @@ -182,4 +187,5 @@ def __init__(self, *, location: str, tags=None, identity=None, enable_azure_file self.enable_https_traffic_only = enable_https_traffic_only self.network_rule_set = None self.is_hns_enabled = is_hns_enabled + self.geo_replication_stats = None self.failover_in_progress = None diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_management_client_enums.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_management_client_enums.py index aa998284e397..b8dd0a6874ef 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_management_client_enums.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/storage_management_client_enums.py @@ -89,6 +89,13 @@ class AccessTier(str, Enum): cool = "Cool" +class GeoReplicationStatus(str, Enum): + + live = "Live" + bootstrap = "Bootstrap" + unavailable = "Unavailable" + + class ProvisioningState(str, Enum): creating = "Creating" @@ -198,3 +205,8 @@ class ImmutabilityPolicyUpdateType(str, Enum): put = "put" lock = "lock" extend = "extend" + + +class StorageAccountExpand(str, Enum): + + geo_replication_stats = "geoReplicationStats" diff --git a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py index 018aebf46674..67f53973cb20 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py +++ b/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/storage_accounts_operations.py @@ -271,7 +271,7 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} def get_properties( - self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, expand=None, custom_headers=None, raw=False, **operation_config): """Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -283,6 +283,12 @@ def get_properties( 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 expand: May be used to expand the properties within account's + properties. By default, data is not included when fecthing properties. + Currently we only support geoReplicationStats. Possible values + include: 'geoReplicationStats' + :type expand: str or + ~azure.mgmt.storage.v2018_07_01.models.StorageAccountExpand :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -305,6 +311,8 @@ def get_properties( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'StorageAccountExpand') # Construct headers header_parameters = {} From 1e96e5dab44685f6708935af13c009ad0bfd3cf3 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 15 Nov 2018 15:57:47 -0800 Subject: [PATCH 4/4] 3.1.0 --- azure-mgmt-storage/HISTORY.rst | 11 +++++++++++ azure-mgmt-storage/azure/mgmt/storage/version.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-storage/HISTORY.rst b/azure-mgmt-storage/HISTORY.rst index 7d8682d91b59..5aa6f9b9fa41 100644 --- a/azure-mgmt-storage/HISTORY.rst +++ b/azure-mgmt-storage/HISTORY.rst @@ -3,6 +3,17 @@ Release History =============== +3.1.0 (2018-11-15) +++++++++++++++++++ + +**Features** + +- Model StorageAccount has a new parameter geo_replication_stats +- Model StorageAccount has a new parameter failover_in_progress +- Added operation StorageAccountsOperations.failover +- Added operation group BlobServicesOperations +- Operation StorageAccountsOperations.get_properties now support expand parameter + 3.0.0 (2018-09-27) ++++++++++++++++++ diff --git a/azure-mgmt-storage/azure/mgmt/storage/version.py b/azure-mgmt-storage/azure/mgmt/storage/version.py index 63bcd0444b12..21c32050402a 100644 --- a/azure-mgmt-storage/azure/mgmt/storage/version.py +++ b/azure-mgmt-storage/azure/mgmt/storage/version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0"