From 51daf69b6a42c44e519ed8422bdf0058088d3b4b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 30 Dec 2018 16:35:39 +0000 Subject: [PATCH] Generated from 1a24198dd982a4fcb510456404994241f55dc883 Settings API --- .../azure/mgmt/security/models/__init__.py | 6 +-- .../security/models/data_export_setting.py | 7 +-- .../models/data_export_setting_py3.py | 11 ++-- .../security/models/security_center_enums.py | 1 + .../azure/mgmt/security/models/setting.py | 21 +++----- .../mgmt/security/models/setting_kind1.py | 29 ----------- .../mgmt/security/models/setting_kind1_py3.py | 29 ----------- .../azure/mgmt/security/models/setting_py3.py | 25 +++------ .../mgmt/security/models/setting_resource.py | 51 +++++++++++++++++++ .../security/models/setting_resource_py3.py | 51 +++++++++++++++++++ .../operations/settings_operations.py | 18 ++++--- 11 files changed, 141 insertions(+), 108 deletions(-) delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py delete mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_resource.py create mode 100644 azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py diff --git a/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/azure-mgmt-security/azure/mgmt/security/models/__init__.py index 47bdff08e273..0c052e4712b5 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -21,7 +21,7 @@ from .advanced_threat_protection_setting_py3 import AdvancedThreatProtectionSetting from .setting_py3 import Setting from .data_export_setting_py3 import DataExportSetting - from .setting_kind1_py3 import SettingKind1 + from .setting_resource_py3 import SettingResource from .sensitivity_label_py3 import SensitivityLabel from .information_protection_keyword_py3 import InformationProtectionKeyword from .information_type_py3 import InformationType @@ -75,7 +75,7 @@ from .advanced_threat_protection_setting import AdvancedThreatProtectionSetting from .setting import Setting from .data_export_setting import DataExportSetting - from .setting_kind1 import SettingKind1 + from .setting_resource import SettingResource from .sensitivity_label import SensitivityLabel from .information_protection_keyword import InformationProtectionKeyword from .information_type import InformationType @@ -160,7 +160,7 @@ 'AdvancedThreatProtectionSetting', 'Setting', 'DataExportSetting', - 'SettingKind1', + 'SettingResource', 'SensitivityLabel', 'InformationProtectionKeyword', 'InformationType', diff --git a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py index c2eb09c8bebe..8c355e50e6ff 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py +++ b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting.py @@ -26,8 +26,10 @@ class DataExportSetting(Setting): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param enabled: Required. Is the data export setting is enabled :type enabled: bool """ @@ -51,4 +53,3 @@ class DataExportSetting(Setting): def __init__(self, **kwargs): super(DataExportSetting, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) - self.kind = 'DataExportSetting' diff --git a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py index adab9fae1f04..05d8e11208fc 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/data_export_setting_py3.py @@ -26,8 +26,10 @@ class DataExportSetting(Setting): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param enabled: Required. Is the data export setting is enabled :type enabled: bool """ @@ -48,7 +50,6 @@ class DataExportSetting(Setting): 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, } - def __init__(self, *, enabled: bool, **kwargs) -> None: - super(DataExportSetting, self).__init__(**kwargs) + def __init__(self, *, kind, enabled: bool, **kwargs) -> None: + super(DataExportSetting, self).__init__(kind=kind, **kwargs) self.enabled = enabled - self.kind = 'DataExportSetting' diff --git a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py index 951d2c9525c7..fc73b5aaf5d9 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py +++ b/azure-mgmt-security/azure/mgmt/security/models/security_center_enums.py @@ -39,6 +39,7 @@ class AutoProvision(str, Enum): class SettingKind(str, Enum): data_export_setting = "DataExportSetting" + alert_suppression_setting = "AlertSuppressionSetting" class SecurityFamily(str, Enum): diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting.py b/azure-mgmt-security/azure/mgmt/security/models/setting.py index 6d9a06822f41..9dd2c8f9944c 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/setting.py +++ b/azure-mgmt-security/azure/mgmt/security/models/setting.py @@ -9,15 +9,12 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .setting_resource import SettingResource -class Setting(Model): +class Setting(SettingResource): """Represents a security setting in Azure Security Center. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DataExportSetting - Variables are only populated by the server, and will be ignored when sending a request. @@ -29,8 +26,10 @@ class Setting(Model): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind """ _validation = { @@ -47,13 +46,5 @@ class Setting(Model): 'kind': {'key': 'kind', 'type': 'str'}, } - _subtype_map = { - 'kind': {'DataExportSetting': 'DataExportSetting'} - } - def __init__(self, **kwargs): super(Setting, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = None diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py b/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py deleted file mode 100644 index 4f3753aae68d..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 SettingKind1(Model): - """The kind of the security setting. - - :param kind: the kind of the settings string. Possible values include: - 'DataExportSetting' - :type kind: str or ~azure.mgmt.security.models.SettingKind - """ - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SettingKind1, self).__init__(**kwargs) - self.kind = kwargs.get('kind', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py deleted file mode 100644 index 33f8f077ff41..000000000000 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_kind1_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# 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 SettingKind1(Model): - """The kind of the security setting. - - :param kind: the kind of the settings string. Possible values include: - 'DataExportSetting' - :type kind: str or ~azure.mgmt.security.models.SettingKind - """ - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - } - - def __init__(self, *, kind=None, **kwargs) -> None: - super(SettingKind1, self).__init__(**kwargs) - self.kind = kind diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py index fa644684fb2f..0611d4ebdd49 100644 --- a/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_py3.py @@ -9,15 +9,12 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .setting_resource_py3 import SettingResource -class Setting(Model): +class Setting(SettingResource): """Represents a security setting in Azure Security Center. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: DataExportSetting - Variables are only populated by the server, and will be ignored when sending a request. @@ -29,8 +26,10 @@ class Setting(Model): :vartype name: str :ivar type: Resource type :vartype type: str - :param kind: Required. Constant filled by server. - :type kind: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind """ _validation = { @@ -47,13 +46,5 @@ class Setting(Model): 'kind': {'key': 'kind', 'type': 'str'}, } - _subtype_map = { - 'kind': {'DataExportSetting': 'DataExportSetting'} - } - - def __init__(self, **kwargs) -> None: - super(Setting, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = None + def __init__(self, *, kind, **kwargs) -> None: + super(Setting, self).__init__(kind=kind, **kwargs) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py b/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py new file mode 100644 index 000000000000..d20bda7cab66 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_resource.py @@ -0,0 +1,51 @@ +# 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 SettingResource(Resource): + """The kind of the security setting. + + 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: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SettingResource, self).__init__(**kwargs) + self.kind = kwargs.get('kind', None) diff --git a/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py b/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py new file mode 100644 index 000000000000..4feeff7166c5 --- /dev/null +++ b/azure-mgmt-security/azure/mgmt/security/models/setting_resource_py3.py @@ -0,0 +1,51 @@ +# 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 SettingResource(Resource): + """The kind of the security setting. + + 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: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param kind: Required. the kind of the settings string + (DataExportSetting). Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + def __init__(self, *, kind, **kwargs) -> None: + super(SettingResource, self).__init__(**kwargs) + self.kind = kind diff --git a/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py b/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py index 47b9c1b6d7f5..6aef42b410e1 100644 --- a/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py +++ b/azure-mgmt-security/azure/mgmt/security/operations/settings_operations.py @@ -105,8 +105,8 @@ def get( self, setting_name, custom_headers=None, raw=False, **operation_config): """Settings of different configurations in security center. - :param setting_name: Name of setting. Possible values include: 'MCAS', - 'WDATP' + :param setting_name: Name of setting: (MCAS/WDATP). Possible values + include: 'MCAS', 'WDATP' :type setting_name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -162,14 +162,16 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}'} def update( - self, setting_name, setting, custom_headers=None, raw=False, **operation_config): + self, setting_name, kind, custom_headers=None, raw=False, **operation_config): """updating settings about different configurations in security center. - :param setting_name: Name of setting. Possible values include: 'MCAS', - 'WDATP' + :param setting_name: Name of setting: (MCAS/WDATP). Possible values + include: 'MCAS', 'WDATP' :type setting_name: str - :param setting: Setting object - :type setting: ~azure.mgmt.security.models.Setting + :param kind: the kind of the settings string (DataExportSetting). + Possible values include: 'DataExportSetting', + 'AlertSuppressionSetting' + :type kind: str or ~azure.mgmt.security.models.SettingKind :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -180,6 +182,8 @@ def update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + setting = models.Setting(kind=kind) + # Construct URL url = self.update.metadata['url'] path_format_arguments = {