Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR security/resource-manager] Settings API - changed the kind to work with .net nuget #4113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions azure-mgmt-security/azure/mgmt/security/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -160,7 +160,7 @@
'AdvancedThreatProtectionSetting',
'Setting',
'DataExportSetting',
'SettingKind1',
'SettingResource',
'SensitivityLabel',
'InformationProtectionKeyword',
'InformationType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class AutoProvision(str, Enum):
class SettingKind(str, Enum):

data_export_setting = "DataExportSetting"
alert_suppression_setting = "AlertSuppressionSetting"


class SecurityFamily(str, Enum):
Expand Down
21 changes: 6 additions & 15 deletions azure-mgmt-security/azure/mgmt/security/models/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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 = {
Expand All @@ -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
29 changes: 0 additions & 29 deletions azure-mgmt-security/azure/mgmt/security/models/setting_kind1.py

This file was deleted.

This file was deleted.

25 changes: 8 additions & 17 deletions azure-mgmt-security/azure/mgmt/security/models/setting_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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 = {
Expand All @@ -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)
51 changes: 51 additions & 0 deletions azure-mgmt-security/azure/mgmt/security/models/setting_resource.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -180,6 +182,8 @@ def update(
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
setting = models.Setting(kind=kind)

# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
Expand Down