From a7c368fba92703b8cdfb7f9935429db1e76fbcf3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 11 Dec 2020 06:59:35 +0000 Subject: [PATCH] CodeGen from PR 11540 in Azure/azure-rest-api-specs Merge 2c763521f4763a35608e9bedce145ccde84b9c6c into df0cad373960e6d02474859995c1696c762c70fd --- .../azure/mgmt/security/_security_center.py | 5 + .../azure/mgmt/security/models/__init__.py | 28 +- .../azure/mgmt/security/models/_models.py | 320 +++++++++++------ .../azure/mgmt/security/models/_models_py3.py | 324 ++++++++++++------ .../security/models/_security_center_enums.py | 17 + .../mgmt/security/operations/__init__.py | 2 + .../_iot_defender_settings_operations.py | 57 +++ .../operations/_iot_sensors_operations.py | 100 +++++- .../operations/_iot_sites_operations.py | 276 +++++++++++++++ .../_on_premise_iot_sensors_operations.py | 68 ++++ 10 files changed, 985 insertions(+), 212 deletions(-) create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sites_operations.py diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py index de0ae7d443e3..77962bb0dbf3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py @@ -66,6 +66,7 @@ from .operations import DevicesForHubOperations from .operations import DeviceOperations from .operations import OnPremiseIotSensorsOperations +from .operations import IotSitesOperations from . import models @@ -181,6 +182,8 @@ class SecurityCenter(SDKClient): :vartype device: azure.mgmt.security.operations.DeviceOperations :ivar on_premise_iot_sensors: OnPremiseIotSensors operations :vartype on_premise_iot_sensors: azure.mgmt.security.operations.OnPremiseIotSensorsOperations + :ivar iot_sites: IotSites operations + :vartype iot_sites: azure.mgmt.security.operations.IotSitesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -309,3 +312,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.on_premise_iot_sensors = OnPremiseIotSensorsOperations( self._client, self.config, self._serialize, self._deserialize) + self.iot_sites = IotSitesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/__init__.py index f182e6ae46be..60c422aceb8e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/__init__.py @@ -111,9 +111,11 @@ from ._models_py3 import IoTSecuritySolutionAnalyticsModelList from ._models_py3 import IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem from ._models_py3 import IoTSecuritySolutionModel - from ._models_py3 import IotSensor from ._models_py3 import IotSensorsList + from ._models_py3 import IotSensorsModel from ._models_py3 import IoTSeverityMetrics + from ._models_py3 import IotSitesList + from ._models_py3 import IotSitesModel from ._models_py3 import IpAddress from ._models_py3 import JitNetworkAccessPolicy from ._models_py3 import JitNetworkAccessPolicyInitiatePort @@ -148,7 +150,6 @@ from ._models_py3 import PackageDownloadsSensor from ._models_py3 import PackageDownloadsSensorFull from ._models_py3 import PackageDownloadsSensorFullOvf - from ._models_py3 import PackageDownloadsThreatIntelligence from ._models_py3 import PathRecommendation from ._models_py3 import Pricing from ._models_py3 import PricingList @@ -164,6 +165,7 @@ from ._models_py3 import RegulatoryComplianceControl from ._models_py3 import RegulatoryComplianceStandard from ._models_py3 import Remediation + from ._models_py3 import ResetPasswordInput from ._models_py3 import Resource from ._models_py3 import ResourceDetails from ._models_py3 import ResourceIdentifier @@ -204,7 +206,6 @@ from ._models_py3 import ServerVulnerabilityProperties from ._models_py3 import ServicePrincipalProperties from ._models_py3 import Setting - from ._models_py3 import SettingResource from ._models_py3 import Site from ._models_py3 import SqlServerVulnerabilityProperties from ._models_py3 import SubAssessmentStatus @@ -221,6 +222,7 @@ from ._models_py3 import TwinUpdatesNotInAllowedRange from ._models_py3 import UnauthorizedOperationsNotInAllowedRange from ._models_py3 import UpdateIotSecuritySolutionData + from ._models_py3 import UpgradePackageDownloadInfo from ._models_py3 import UserDefinedResourcesProperties from ._models_py3 import UserRecommendation from ._models_py3 import VaRule @@ -329,9 +331,11 @@ from ._models import IoTSecuritySolutionAnalyticsModelList from ._models import IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem from ._models import IoTSecuritySolutionModel - from ._models import IotSensor from ._models import IotSensorsList + from ._models import IotSensorsModel from ._models import IoTSeverityMetrics + from ._models import IotSitesList + from ._models import IotSitesModel from ._models import IpAddress from ._models import JitNetworkAccessPolicy from ._models import JitNetworkAccessPolicyInitiatePort @@ -366,7 +370,6 @@ from ._models import PackageDownloadsSensor from ._models import PackageDownloadsSensorFull from ._models import PackageDownloadsSensorFullOvf - from ._models import PackageDownloadsThreatIntelligence from ._models import PathRecommendation from ._models import Pricing from ._models import PricingList @@ -382,6 +385,7 @@ from ._models import RegulatoryComplianceControl from ._models import RegulatoryComplianceStandard from ._models import Remediation + from ._models import ResetPasswordInput from ._models import Resource from ._models import ResourceDetails from ._models import ResourceIdentifier @@ -422,7 +426,6 @@ from ._models import ServerVulnerabilityProperties from ._models import ServicePrincipalProperties from ._models import Setting - from ._models import SettingResource from ._models import Site from ._models import SqlServerVulnerabilityProperties from ._models import SubAssessmentStatus @@ -439,6 +442,7 @@ from ._models import TwinUpdatesNotInAllowedRange from ._models import UnauthorizedOperationsNotInAllowedRange from ._models import UpdateIotSecuritySolutionData + from ._models import UpgradePackageDownloadInfo from ._models import UserDefinedResourcesProperties from ._models import UserRecommendation from ._models import VaRule @@ -536,6 +540,8 @@ RuleSeverity, RuleType, VersionKind, + SensorStatus, + TiStatus, MacSignificance, RelationToIpStatus, ManagementState, @@ -652,9 +658,11 @@ 'IoTSecuritySolutionAnalyticsModelList', 'IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem', 'IoTSecuritySolutionModel', - 'IotSensor', 'IotSensorsList', + 'IotSensorsModel', 'IoTSeverityMetrics', + 'IotSitesList', + 'IotSitesModel', 'IpAddress', 'JitNetworkAccessPolicy', 'JitNetworkAccessPolicyInitiatePort', @@ -689,7 +697,6 @@ 'PackageDownloadsSensor', 'PackageDownloadsSensorFull', 'PackageDownloadsSensorFullOvf', - 'PackageDownloadsThreatIntelligence', 'PathRecommendation', 'Pricing', 'PricingList', @@ -705,6 +712,7 @@ 'RegulatoryComplianceControl', 'RegulatoryComplianceStandard', 'Remediation', + 'ResetPasswordInput', 'Resource', 'ResourceDetails', 'ResourceIdentifier', @@ -745,7 +753,6 @@ 'ServerVulnerabilityProperties', 'ServicePrincipalProperties', 'Setting', - 'SettingResource', 'Site', 'SqlServerVulnerabilityProperties', 'SubAssessmentStatus', @@ -762,6 +769,7 @@ 'TwinUpdatesNotInAllowedRange', 'UnauthorizedOperationsNotInAllowedRange', 'UpdateIotSecuritySolutionData', + 'UpgradePackageDownloadInfo', 'UserDefinedResourcesProperties', 'UserRecommendation', 'VaRule', @@ -858,6 +866,8 @@ 'RuleSeverity', 'RuleType', 'VersionKind', + 'SensorStatus', + 'TiStatus', 'MacSignificance', 'RelationToIpStatus', 'ManagementState', diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py index 941c6b8b9bde..4bd955936d1f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models.py @@ -1797,7 +1797,8 @@ class AutomationSource(Model): https://aka.ms/ASCAutomationSchemas. :param event_source: A valid event source type. Possible values include: - 'Assessments', 'SubAssessments', 'Alerts' + 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', + 'SecureScoreControls' :type event_source: str or ~azure.mgmt.security.models.EventSource :param rule_sets: A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). @@ -2789,54 +2790,9 @@ def __init__(self, **kwargs): self.base = None -class SettingResource(Resource): +class Setting(Resource): """The kind of the security setting. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: 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. Constant filled by server. - :type kind: str - """ - - _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'}, - } - - _subtype_map = { - 'kind': {'Setting': 'Setting'} - } - - def __init__(self, **kwargs): - super(SettingResource, self).__init__(**kwargs) - self.kind = None - self.kind = 'SettingResource' - - -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: DataExportSettings @@ -2875,6 +2831,7 @@ class Setting(SettingResource): def __init__(self, **kwargs): super(Setting, self).__init__(**kwargs) + self.kind = None self.kind = 'Setting' @@ -4947,8 +4904,31 @@ def __init__(self, **kwargs): self.unmasked_ip_logging_status = kwargs.get('unmasked_ip_logging_status', "Disabled") -class IotSensor(Resource): - """IoT sensor. +class IotSensorsList(Model): + """List of IoT sensors. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List data + :vartype value: list[~azure.mgmt.security.models.IotSensorsModel] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotSensorsModel]'}, + } + + def __init__(self, **kwargs): + super(IotSensorsList, self).__init__(**kwargs) + self.value = None + + +class IotSensorsModel(Resource): + """IoT sensor model. Variables are only populated by the server, and will be ignored when sending a request. @@ -4959,36 +4939,106 @@ class IotSensor(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param properties: IoT sensor properties - :type properties: object + :ivar connectivity_time: Last connectivity time of the IoT sensor + :vartype connectivity_time: str + :ivar creation_time: Creation time of the IoT sensor + :vartype creation_time: str + :ivar dynamic_learning: Dynamic mode status of the IoT sensor + :vartype dynamic_learning: bool + :ivar learning_mode: Learning mode status of the IoT sensor + :vartype learning_mode: bool + :ivar sensor_status: Status of the IoT sensor. Possible values include: + 'Ok', 'Disconnected', 'Unavailable' + :vartype sensor_status: str or ~azure.mgmt.security.models.SensorStatus + :ivar sensor_version: Version of the IoT sensor + :vartype sensor_version: str + :param ti_automatic_updates: TI Automatic mode status of the IoT sensor + :type ti_automatic_updates: bool + :ivar ti_status: TI Status of the IoT sensor. Possible values include: + 'Ok', 'Failed', 'InProgress', 'UpdateAvailable' + :vartype ti_status: str or ~azure.mgmt.security.models.TiStatus + :ivar ti_version: TI Version of the IoT sensor + :vartype ti_version: str + :param zone: Zone of the IoT sensor + :type zone: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'connectivity_time': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'dynamic_learning': {'readonly': True}, + 'learning_mode': {'readonly': True}, + 'sensor_status': {'readonly': True}, + 'sensor_version': {'readonly': True}, + 'ti_status': {'readonly': True}, + 'ti_version': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'connectivity_time': {'key': 'properties.connectivityTime', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'dynamic_learning': {'key': 'properties.dynamicLearning', 'type': 'bool'}, + 'learning_mode': {'key': 'properties.learningMode', 'type': 'bool'}, + 'sensor_status': {'key': 'properties.sensorStatus', 'type': 'str'}, + 'sensor_version': {'key': 'properties.sensorVersion', 'type': 'str'}, + 'ti_automatic_updates': {'key': 'properties.tiAutomaticUpdates', 'type': 'bool'}, + 'ti_status': {'key': 'properties.tiStatus', 'type': 'str'}, + 'ti_version': {'key': 'properties.tiVersion', 'type': 'str'}, + 'zone': {'key': 'properties.zone', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IotSensorsModel, self).__init__(**kwargs) + self.connectivity_time = None + self.creation_time = None + self.dynamic_learning = None + self.learning_mode = None + self.sensor_status = None + self.sensor_version = None + self.ti_automatic_updates = kwargs.get('ti_automatic_updates', None) + self.ti_status = None + self.ti_version = None + self.zone = kwargs.get('zone', None) + + +class IoTSeverityMetrics(Model): + """IoT Security solution analytics severity metrics. + + :param high: Count of high severity alerts/recommendations. + :type high: int + :param medium: Count of medium severity alerts/recommendations. + :type medium: int + :param low: Count of low severity alerts/recommendations. + :type low: int + """ + + _attribute_map = { + 'high': {'key': 'high', 'type': 'int'}, + 'medium': {'key': 'medium', 'type': 'int'}, + 'low': {'key': 'low', 'type': 'int'}, } def __init__(self, **kwargs): - super(IotSensor, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) + super(IoTSeverityMetrics, self).__init__(**kwargs) + self.high = kwargs.get('high', None) + self.medium = kwargs.get('medium', None) + self.low = kwargs.get('low', None) -class IotSensorsList(Model): - """List of IoT sensors. +class IotSitesList(Model): + """List of IoT sites. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List data - :vartype value: list[~azure.mgmt.security.models.IotSensor] + :vartype value: list[~azure.mgmt.security.models.IotSitesModel] """ _validation = { @@ -4996,36 +5046,53 @@ class IotSensorsList(Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[IotSensor]'}, + 'value': {'key': 'value', 'type': '[IotSitesModel]'}, } def __init__(self, **kwargs): - super(IotSensorsList, self).__init__(**kwargs) + super(IotSitesList, self).__init__(**kwargs) self.value = None -class IoTSeverityMetrics(Model): - """IoT Security solution analytics severity metrics. +class IotSitesModel(Resource): + """IoT site model. - :param high: Count of high severity alerts/recommendations. - :type high: int - :param medium: Count of medium severity alerts/recommendations. - :type medium: int - :param low: Count of low severity alerts/recommendations. - :type low: int + 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 display_name: Required. Display name of the IoT site + :type display_name: str + :param tags: Tags of the IoT site + :type tags: dict[str, str] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'required': True}, + } + _attribute_map = { - 'high': {'key': 'high', 'type': 'int'}, - 'medium': {'key': 'medium', 'type': 'int'}, - 'low': {'key': 'low', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'tags': {'key': 'properties.tags', 'type': '{str}'}, } def __init__(self, **kwargs): - super(IoTSeverityMetrics, self).__init__(**kwargs) - self.high = kwargs.get('high', None) - self.medium = kwargs.get('medium', None) - self.low = kwargs.get('low', None) + super(IotSitesModel, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.tags = kwargs.get('tags', None) class IpAddress(Model): @@ -6054,19 +6121,39 @@ class PackageDownloads(Model): ~azure.mgmt.security.models.PackageDownloadsCentralManager :ivar threat_intelligence: All downloads for threat intelligence :vartype threat_intelligence: - ~azure.mgmt.security.models.PackageDownloadsThreatIntelligence + list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar snmp: SNMP Server file + :vartype snmp: list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar wmi_tool: Used for local configuration export + :vartype wmi_tool: list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar authorized_devices_import_template: Authorized devices import + template + :vartype authorized_devices_import_template: + list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar device_information_update_import_template: Authorized devices import + template + :vartype device_information_update_import_template: + list[~azure.mgmt.security.models.PackageDownloadInfo] """ _validation = { 'sensor': {'readonly': True}, 'central_manager': {'readonly': True}, 'threat_intelligence': {'readonly': True}, + 'snmp': {'readonly': True}, + 'wmi_tool': {'readonly': True}, + 'authorized_devices_import_template': {'readonly': True}, + 'device_information_update_import_template': {'readonly': True}, } _attribute_map = { 'sensor': {'key': 'sensor', 'type': 'PackageDownloadsSensor'}, 'central_manager': {'key': 'centralManager', 'type': 'PackageDownloadsCentralManager'}, - 'threat_intelligence': {'key': 'threatIntelligence', 'type': 'PackageDownloadsThreatIntelligence'}, + 'threat_intelligence': {'key': 'threatIntelligence', 'type': '[PackageDownloadInfo]'}, + 'snmp': {'key': 'snmp', 'type': '[PackageDownloadInfo]'}, + 'wmi_tool': {'key': 'wmiTool', 'type': '[PackageDownloadInfo]'}, + 'authorized_devices_import_template': {'key': 'authorizedDevicesImportTemplate', 'type': '[PackageDownloadInfo]'}, + 'device_information_update_import_template': {'key': 'deviceInformationUpdateImportTemplate', 'type': '[PackageDownloadInfo]'}, } def __init__(self, **kwargs): @@ -6074,6 +6161,10 @@ def __init__(self, **kwargs): self.sensor = None self.central_manager = None self.threat_intelligence = None + self.snmp = None + self.wmi_tool = None + self.authorized_devices_import_template = None + self.device_information_update_import_template = None class PackageDownloadsCentralManager(Model): @@ -6087,7 +6178,8 @@ class PackageDownloadsCentralManager(Model): ~azure.mgmt.security.models.PackageDownloadsCentralManagerFull :ivar upgrade: Central Manager upgrade package downloads (on existing installations) - :vartype upgrade: list[~azure.mgmt.security.models.PackageDownloadInfo] + :vartype upgrade: + list[~azure.mgmt.security.models.UpgradePackageDownloadInfo] """ _validation = { @@ -6097,7 +6189,7 @@ class PackageDownloadsCentralManager(Model): _attribute_map = { 'full': {'key': 'full', 'type': 'PackageDownloadsCentralManagerFull'}, - 'upgrade': {'key': 'upgrade', 'type': '[PackageDownloadInfo]'}, + 'upgrade': {'key': 'upgrade', 'type': '[UpgradePackageDownloadInfo]'}, } def __init__(self, **kwargs): @@ -6187,7 +6279,8 @@ class PackageDownloadsSensor(Model): :vartype full: ~azure.mgmt.security.models.PackageDownloadsSensorFull :param upgrade: Sensor upgrade package downloads (on existing installations) - :type upgrade: list[~azure.mgmt.security.models.PackageDownloadInfo] + :type upgrade: + list[~azure.mgmt.security.models.UpgradePackageDownloadInfo] """ _validation = { @@ -6196,7 +6289,7 @@ class PackageDownloadsSensor(Model): _attribute_map = { 'full': {'key': 'full', 'type': 'PackageDownloadsSensorFull'}, - 'upgrade': {'key': 'upgrade', 'type': '[PackageDownloadInfo]'}, + 'upgrade': {'key': 'upgrade', 'type': '[UpgradePackageDownloadInfo]'}, } def __init__(self, **kwargs): @@ -6266,22 +6359,6 @@ def __init__(self, **kwargs): self.line = None -class PackageDownloadsThreatIntelligence(Model): - """All downloads for threat intelligence. - - :param link: Download link - :type link: str - """ - - _attribute_map = { - 'link': {'key': 'link', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PackageDownloadsThreatIntelligence, self).__init__(**kwargs) - self.link = kwargs.get('link', None) - - class PathRecommendation(Model): """Represents a path that is recommended to be allowed and its properties. @@ -6909,6 +6986,22 @@ def __init__(self, **kwargs): self.portal_link = kwargs.get('portal_link', None) +class ResetPasswordInput(Model): + """Reset password input. + + :param appliance_id: The appliance id of the sensor. + :type appliance_id: str + """ + + _attribute_map = { + 'appliance_id': {'key': 'applianceId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ResetPasswordInput, self).__init__(**kwargs) + self.appliance_id = kwargs.get('appliance_id', None) + + class Rule(Model): """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote @@ -8860,6 +8953,41 @@ def __init__(self, **kwargs): self.recommendations_configuration = kwargs.get('recommendations_configuration', None) +class UpgradePackageDownloadInfo(PackageDownloadInfo): + """Information on a specific package upgrade download. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar version: Version number + :vartype version: str + :param link: Download link + :type link: str + :ivar version_kind: Kind of the version. Possible values include: + 'Latest', 'Previous', 'Preview' + :vartype version_kind: str or ~azure.mgmt.security.models.VersionKind + :ivar from_version: Minimum base version for upgrade + :vartype from_version: str + """ + + _validation = { + 'version': {'readonly': True}, + 'version_kind': {'readonly': True}, + 'from_version': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'link': {'key': 'link', 'type': 'str'}, + 'version_kind': {'key': 'versionKind', 'type': 'str'}, + 'from_version': {'key': 'fromVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpgradePackageDownloadInfo, self).__init__(**kwargs) + self.from_version = None + + class UserDefinedResourcesProperties(Model): """Properties of the IoT Security solution's user defined resources. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models_py3.py index 13585f8f3453..7c02abdf0d93 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_models_py3.py @@ -1797,7 +1797,8 @@ class AutomationSource(Model): https://aka.ms/ASCAutomationSchemas. :param event_source: A valid event source type. Possible values include: - 'Assessments', 'SubAssessments', 'Alerts' + 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', + 'SecureScoreControls' :type event_source: str or ~azure.mgmt.security.models.EventSource :param rule_sets: A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). @@ -2789,54 +2790,9 @@ def __init__(self, **kwargs) -> None: self.base = None -class SettingResource(Resource): +class Setting(Resource): """The kind of the security setting. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: 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. Constant filled by server. - :type kind: str - """ - - _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'}, - } - - _subtype_map = { - 'kind': {'Setting': 'Setting'} - } - - def __init__(self, **kwargs) -> None: - super(SettingResource, self).__init__(**kwargs) - self.kind = None - self.kind = 'SettingResource' - - -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: DataExportSettings @@ -2875,6 +2831,7 @@ class Setting(SettingResource): def __init__(self, **kwargs) -> None: super(Setting, self).__init__(**kwargs) + self.kind = None self.kind = 'Setting' @@ -4947,8 +4904,31 @@ def __init__(self, *, display_name: str, iot_hubs, tags=None, location: str=None self.unmasked_ip_logging_status = unmasked_ip_logging_status -class IotSensor(Resource): - """IoT sensor. +class IotSensorsList(Model): + """List of IoT sensors. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: List data + :vartype value: list[~azure.mgmt.security.models.IotSensorsModel] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotSensorsModel]'}, + } + + def __init__(self, **kwargs) -> None: + super(IotSensorsList, self).__init__(**kwargs) + self.value = None + + +class IotSensorsModel(Resource): + """IoT sensor model. Variables are only populated by the server, and will be ignored when sending a request. @@ -4959,36 +4939,106 @@ class IotSensor(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param properties: IoT sensor properties - :type properties: object + :ivar connectivity_time: Last connectivity time of the IoT sensor + :vartype connectivity_time: str + :ivar creation_time: Creation time of the IoT sensor + :vartype creation_time: str + :ivar dynamic_learning: Dynamic mode status of the IoT sensor + :vartype dynamic_learning: bool + :ivar learning_mode: Learning mode status of the IoT sensor + :vartype learning_mode: bool + :ivar sensor_status: Status of the IoT sensor. Possible values include: + 'Ok', 'Disconnected', 'Unavailable' + :vartype sensor_status: str or ~azure.mgmt.security.models.SensorStatus + :ivar sensor_version: Version of the IoT sensor + :vartype sensor_version: str + :param ti_automatic_updates: TI Automatic mode status of the IoT sensor + :type ti_automatic_updates: bool + :ivar ti_status: TI Status of the IoT sensor. Possible values include: + 'Ok', 'Failed', 'InProgress', 'UpdateAvailable' + :vartype ti_status: str or ~azure.mgmt.security.models.TiStatus + :ivar ti_version: TI Version of the IoT sensor + :vartype ti_version: str + :param zone: Zone of the IoT sensor + :type zone: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'connectivity_time': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'dynamic_learning': {'readonly': True}, + 'learning_mode': {'readonly': True}, + 'sensor_status': {'readonly': True}, + 'sensor_version': {'readonly': True}, + 'ti_status': {'readonly': True}, + 'ti_version': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, + 'connectivity_time': {'key': 'properties.connectivityTime', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, + 'dynamic_learning': {'key': 'properties.dynamicLearning', 'type': 'bool'}, + 'learning_mode': {'key': 'properties.learningMode', 'type': 'bool'}, + 'sensor_status': {'key': 'properties.sensorStatus', 'type': 'str'}, + 'sensor_version': {'key': 'properties.sensorVersion', 'type': 'str'}, + 'ti_automatic_updates': {'key': 'properties.tiAutomaticUpdates', 'type': 'bool'}, + 'ti_status': {'key': 'properties.tiStatus', 'type': 'str'}, + 'ti_version': {'key': 'properties.tiVersion', 'type': 'str'}, + 'zone': {'key': 'properties.zone', 'type': 'str'}, + } + + def __init__(self, *, ti_automatic_updates: bool=None, zone: str=None, **kwargs) -> None: + super(IotSensorsModel, self).__init__(**kwargs) + self.connectivity_time = None + self.creation_time = None + self.dynamic_learning = None + self.learning_mode = None + self.sensor_status = None + self.sensor_version = None + self.ti_automatic_updates = ti_automatic_updates + self.ti_status = None + self.ti_version = None + self.zone = zone + + +class IoTSeverityMetrics(Model): + """IoT Security solution analytics severity metrics. + + :param high: Count of high severity alerts/recommendations. + :type high: int + :param medium: Count of medium severity alerts/recommendations. + :type medium: int + :param low: Count of low severity alerts/recommendations. + :type low: int + """ + + _attribute_map = { + 'high': {'key': 'high', 'type': 'int'}, + 'medium': {'key': 'medium', 'type': 'int'}, + 'low': {'key': 'low', 'type': 'int'}, } - def __init__(self, *, properties=None, **kwargs) -> None: - super(IotSensor, self).__init__(**kwargs) - self.properties = properties + def __init__(self, *, high: int=None, medium: int=None, low: int=None, **kwargs) -> None: + super(IoTSeverityMetrics, self).__init__(**kwargs) + self.high = high + self.medium = medium + self.low = low -class IotSensorsList(Model): - """List of IoT sensors. +class IotSitesList(Model): + """List of IoT sites. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List data - :vartype value: list[~azure.mgmt.security.models.IotSensor] + :vartype value: list[~azure.mgmt.security.models.IotSitesModel] """ _validation = { @@ -4996,36 +5046,53 @@ class IotSensorsList(Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[IotSensor]'}, + 'value': {'key': 'value', 'type': '[IotSitesModel]'}, } def __init__(self, **kwargs) -> None: - super(IotSensorsList, self).__init__(**kwargs) + super(IotSitesList, self).__init__(**kwargs) self.value = None -class IoTSeverityMetrics(Model): - """IoT Security solution analytics severity metrics. +class IotSitesModel(Resource): + """IoT site model. - :param high: Count of high severity alerts/recommendations. - :type high: int - :param medium: Count of medium severity alerts/recommendations. - :type medium: int - :param low: Count of low severity alerts/recommendations. - :type low: int + 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 display_name: Required. Display name of the IoT site + :type display_name: str + :param tags: Tags of the IoT site + :type tags: dict[str, str] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'required': True}, + } + _attribute_map = { - 'high': {'key': 'high', 'type': 'int'}, - 'medium': {'key': 'medium', 'type': 'int'}, - 'low': {'key': 'low', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'tags': {'key': 'properties.tags', 'type': '{str}'}, } - def __init__(self, *, high: int=None, medium: int=None, low: int=None, **kwargs) -> None: - super(IoTSeverityMetrics, self).__init__(**kwargs) - self.high = high - self.medium = medium - self.low = low + def __init__(self, *, display_name: str, tags=None, **kwargs) -> None: + super(IotSitesModel, self).__init__(**kwargs) + self.display_name = display_name + self.tags = tags class IpAddress(Model): @@ -6054,19 +6121,39 @@ class PackageDownloads(Model): ~azure.mgmt.security.models.PackageDownloadsCentralManager :ivar threat_intelligence: All downloads for threat intelligence :vartype threat_intelligence: - ~azure.mgmt.security.models.PackageDownloadsThreatIntelligence + list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar snmp: SNMP Server file + :vartype snmp: list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar wmi_tool: Used for local configuration export + :vartype wmi_tool: list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar authorized_devices_import_template: Authorized devices import + template + :vartype authorized_devices_import_template: + list[~azure.mgmt.security.models.PackageDownloadInfo] + :ivar device_information_update_import_template: Authorized devices import + template + :vartype device_information_update_import_template: + list[~azure.mgmt.security.models.PackageDownloadInfo] """ _validation = { 'sensor': {'readonly': True}, 'central_manager': {'readonly': True}, 'threat_intelligence': {'readonly': True}, + 'snmp': {'readonly': True}, + 'wmi_tool': {'readonly': True}, + 'authorized_devices_import_template': {'readonly': True}, + 'device_information_update_import_template': {'readonly': True}, } _attribute_map = { 'sensor': {'key': 'sensor', 'type': 'PackageDownloadsSensor'}, 'central_manager': {'key': 'centralManager', 'type': 'PackageDownloadsCentralManager'}, - 'threat_intelligence': {'key': 'threatIntelligence', 'type': 'PackageDownloadsThreatIntelligence'}, + 'threat_intelligence': {'key': 'threatIntelligence', 'type': '[PackageDownloadInfo]'}, + 'snmp': {'key': 'snmp', 'type': '[PackageDownloadInfo]'}, + 'wmi_tool': {'key': 'wmiTool', 'type': '[PackageDownloadInfo]'}, + 'authorized_devices_import_template': {'key': 'authorizedDevicesImportTemplate', 'type': '[PackageDownloadInfo]'}, + 'device_information_update_import_template': {'key': 'deviceInformationUpdateImportTemplate', 'type': '[PackageDownloadInfo]'}, } def __init__(self, **kwargs) -> None: @@ -6074,6 +6161,10 @@ def __init__(self, **kwargs) -> None: self.sensor = None self.central_manager = None self.threat_intelligence = None + self.snmp = None + self.wmi_tool = None + self.authorized_devices_import_template = None + self.device_information_update_import_template = None class PackageDownloadsCentralManager(Model): @@ -6087,7 +6178,8 @@ class PackageDownloadsCentralManager(Model): ~azure.mgmt.security.models.PackageDownloadsCentralManagerFull :ivar upgrade: Central Manager upgrade package downloads (on existing installations) - :vartype upgrade: list[~azure.mgmt.security.models.PackageDownloadInfo] + :vartype upgrade: + list[~azure.mgmt.security.models.UpgradePackageDownloadInfo] """ _validation = { @@ -6097,7 +6189,7 @@ class PackageDownloadsCentralManager(Model): _attribute_map = { 'full': {'key': 'full', 'type': 'PackageDownloadsCentralManagerFull'}, - 'upgrade': {'key': 'upgrade', 'type': '[PackageDownloadInfo]'}, + 'upgrade': {'key': 'upgrade', 'type': '[UpgradePackageDownloadInfo]'}, } def __init__(self, **kwargs) -> None: @@ -6187,7 +6279,8 @@ class PackageDownloadsSensor(Model): :vartype full: ~azure.mgmt.security.models.PackageDownloadsSensorFull :param upgrade: Sensor upgrade package downloads (on existing installations) - :type upgrade: list[~azure.mgmt.security.models.PackageDownloadInfo] + :type upgrade: + list[~azure.mgmt.security.models.UpgradePackageDownloadInfo] """ _validation = { @@ -6196,7 +6289,7 @@ class PackageDownloadsSensor(Model): _attribute_map = { 'full': {'key': 'full', 'type': 'PackageDownloadsSensorFull'}, - 'upgrade': {'key': 'upgrade', 'type': '[PackageDownloadInfo]'}, + 'upgrade': {'key': 'upgrade', 'type': '[UpgradePackageDownloadInfo]'}, } def __init__(self, *, upgrade=None, **kwargs) -> None: @@ -6266,22 +6359,6 @@ def __init__(self, **kwargs) -> None: self.line = None -class PackageDownloadsThreatIntelligence(Model): - """All downloads for threat intelligence. - - :param link: Download link - :type link: str - """ - - _attribute_map = { - 'link': {'key': 'link', 'type': 'str'}, - } - - def __init__(self, *, link: str=None, **kwargs) -> None: - super(PackageDownloadsThreatIntelligence, self).__init__(**kwargs) - self.link = link - - class PathRecommendation(Model): """Represents a path that is recommended to be allowed and its properties. @@ -6909,6 +6986,22 @@ def __init__(self, *, description: str=None, scripts=None, automated: bool=None, self.portal_link = portal_link +class ResetPasswordInput(Model): + """Reset password input. + + :param appliance_id: The appliance id of the sensor. + :type appliance_id: str + """ + + _attribute_map = { + 'appliance_id': {'key': 'applianceId', 'type': 'str'}, + } + + def __init__(self, *, appliance_id: str=None, **kwargs) -> None: + super(ResetPasswordInput, self).__init__(**kwargs) + self.appliance_id = appliance_id + + class Rule(Model): """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote @@ -8860,6 +8953,41 @@ def __init__(self, *, tags=None, user_defined_resources=None, recommendations_co self.recommendations_configuration = recommendations_configuration +class UpgradePackageDownloadInfo(PackageDownloadInfo): + """Information on a specific package upgrade download. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar version: Version number + :vartype version: str + :param link: Download link + :type link: str + :ivar version_kind: Kind of the version. Possible values include: + 'Latest', 'Previous', 'Preview' + :vartype version_kind: str or ~azure.mgmt.security.models.VersionKind + :ivar from_version: Minimum base version for upgrade + :vartype from_version: str + """ + + _validation = { + 'version': {'readonly': True}, + 'version_kind': {'readonly': True}, + 'from_version': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'link': {'key': 'link', 'type': 'str'}, + 'version_kind': {'key': 'versionKind', 'type': 'str'}, + 'from_version': {'key': 'fromVersion', 'type': 'str'}, + } + + def __init__(self, *, link: str=None, **kwargs) -> None: + super(UpgradePackageDownloadInfo, self).__init__(link=link, **kwargs) + self.from_version = None + + class UserDefinedResourcesProperties(Model): """Properties of the IoT Security solution's user defined resources. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_security_center_enums.py index 651c39085b1f..ae1d6207dfcb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models/_security_center_enums.py @@ -181,6 +181,8 @@ class EventSource(str, Enum): assessments = "Assessments" sub_assessments = "SubAssessments" alerts = "Alerts" + secure_scores = "SecureScores" + secure_score_controls = "SecureScoreControls" class PropertyType(str, Enum): @@ -423,6 +425,21 @@ class VersionKind(str, Enum): preview = "Preview" +class SensorStatus(str, Enum): + + ok = "Ok" + disconnected = "Disconnected" + unavailable = "Unavailable" + + +class TiStatus(str, Enum): + + ok = "Ok" + failed = "Failed" + in_progress = "InProgress" + update_available = "UpdateAvailable" + + class MacSignificance(str, Enum): primary = "Primary" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/__init__.py index 751d0d5098d5..bc56e84ac3c9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/__init__.py @@ -62,6 +62,7 @@ from ._devices_for_hub_operations import DevicesForHubOperations from ._device_operations import DeviceOperations from ._on_premise_iot_sensors_operations import OnPremiseIotSensorsOperations +from ._iot_sites_operations import IotSitesOperations __all__ = [ 'ComplianceResultsOperations', @@ -117,4 +118,5 @@ 'DevicesForHubOperations', 'DeviceOperations', 'OnPremiseIotSensorsOperations', + 'IotSitesOperations', ] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_defender_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_defender_settings_operations.py index 679341957e37..e54adb272187 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_defender_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_defender_settings_operations.py @@ -320,3 +320,60 @@ def package_downloads_method( return deserialized package_downloads_method.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default/packageDownloads'} + + def download_manager_activation( + self, custom_headers=None, raw=False, callback=None, **operation_config): + """Download manager activation data defined for this subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.download_manager_activation.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$') + } + 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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/zip' + 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=True, **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 = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + download_manager_activation.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default/downloadManagerActivation'} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sensors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sensors_operations.py index 0565ee6ba734..3933c456ea24 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sensors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sensors_operations.py @@ -111,8 +111,8 @@ def get( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: IotSensor or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.IotSensor or + :return: IotSensorsModel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.IotSensorsModel or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ @@ -149,7 +149,7 @@ def get( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IotSensor', response) + deserialized = self._deserialize('IotSensorsModel', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -159,7 +159,7 @@ def get( get.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}'} def create_or_update( - self, scope, iot_sensor_name, custom_headers=None, raw=False, **operation_config): + self, scope, iot_sensor_name, ti_automatic_updates=None, zone=None, custom_headers=None, raw=False, **operation_config): """Create or update IoT sensor. :param scope: Scope of the query (IoT Hub, @@ -167,16 +167,23 @@ def create_or_update( :type scope: str :param iot_sensor_name: Name of the IoT sensor :type iot_sensor_name: str + :param ti_automatic_updates: TI Automatic mode status of the IoT + sensor + :type ti_automatic_updates: bool + :param zone: Zone of the IoT sensor + :type zone: 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: IotSensor or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.security.models.IotSensor or + :return: IotSensorsModel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.IotSensorsModel or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + iot_sensors_model = models.IotSensorsModel(ti_automatic_updates=ti_automatic_updates, zone=zone) + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -192,6 +199,7 @@ def create_or_update( # 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: @@ -199,8 +207,11 @@ def create_or_update( 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(iot_sensors_model, 'IotSensorsModel') + # Construct and send request - request = self._client.put(url, query_parameters, header_parameters) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200, 201]: @@ -210,9 +221,9 @@ def create_or_update( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IotSensor', response) + deserialized = self._deserialize('IotSensorsModel', response) if response.status_code == 201: - deserialized = self._deserialize('IotSensor', response) + deserialized = self._deserialize('IotSensorsModel', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -336,3 +347,74 @@ def download_activation( return deserialized download_activation.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadActivation'} + + def download_reset_password( + self, scope, iot_sensor_name, appliance_id=None, custom_headers=None, raw=False, callback=None, **operation_config): + """Download file for reset password of the sensor. + + :param scope: Scope of the query (IoT Hub, + /providers/Microsoft.Devices/iotHubs/myHub) + :type scope: str + :param iot_sensor_name: Name of the IoT sensor + :type iot_sensor_name: str + :param appliance_id: The appliance id of the sensor. + :type appliance_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 callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + body = models.ResetPasswordInput(appliance_id=appliance_id) + + # Construct URL + url = self.download_reset_password.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True), + 'iotSensorName': self._serialize.url("iot_sensor_name", iot_sensor_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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/zip' + 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(body, 'ResetPasswordInput') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=True, **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 = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + download_reset_password.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadResetPassword'} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sites_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sites_operations.py new file mode 100644 index 000000000000..3f275513d948 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_iot_sites_operations.py @@ -0,0 +1,276 @@ +# 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 IotSitesOperations(object): + """IotSitesOperations 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: API version for the operation. Constant value: "2020-08-06-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-08-06-preview" + + self.config = config + + def list( + self, scope, custom_headers=None, raw=False, **operation_config): + """List IoT sites. + + :param scope: Scope of the query (IoT Hub, + /providers/Microsoft.Devices/iotHubs/myHub) + :type scope: 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: IotSitesList or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.IotSitesList or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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') + + # 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('IotSitesList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSites'} + + def get( + self, scope, custom_headers=None, raw=False, **operation_config): + """Get IoT site. + + :param scope: Scope of the query (IoT Hub, + /providers/Microsoft.Devices/iotHubs/myHub) + :type scope: 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: IotSitesModel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.IotSitesModel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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') + + # 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('IotSitesModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSites/default'} + + def create_or_update( + self, scope, display_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Create or update IoT site. + + :param scope: Scope of the query (IoT Hub, + /providers/Microsoft.Devices/iotHubs/myHub) + :type scope: str + :param display_name: Display name of the IoT site + :type display_name: str + :param tags: Tags of the IoT site + :type tags: dict[str, 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: IotSitesModel or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.IotSitesModel or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + iot_sites_model = models.IotSitesModel(display_name=display_name, tags=tags) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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') + + # 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(iot_sites_model, 'IotSitesModel') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IotSitesModel', response) + if response.status_code == 201: + deserialized = self._deserialize('IotSitesModel', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSites/default'} + + def delete( + self, scope, custom_headers=None, raw=False, **operation_config): + """Delete IoT site. + + :param scope: Scope of the query (IoT Hub, + /providers/Microsoft.Devices/iotHubs/myHub) + :type scope: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'scope': self._serialize.url("scope", scope, 'str', skip_quote=True) + } + 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') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/{scope}/providers/Microsoft.Security/iotSites/default'} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_on_premise_iot_sensors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_on_premise_iot_sensors_operations.py index bd5c73f7dcd8..234ea698cd85 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_on_premise_iot_sensors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_on_premise_iot_sensors_operations.py @@ -321,3 +321,71 @@ def download_activation( return deserialized download_activation.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}/downloadActivation'} + + def download_reset_password( + self, on_premise_iot_sensor_name, appliance_id=None, custom_headers=None, raw=False, callback=None, **operation_config): + """Download file for reset password of the sensor. + + :param on_premise_iot_sensor_name: Name of the on-premise IoT sensor + :type on_premise_iot_sensor_name: str + :param appliance_id: The appliance id of the sensor. + :type appliance_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 callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + body = models.ResetPasswordInput(appliance_id=appliance_id) + + # Construct URL + url = self.download_reset_password.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'onPremiseIotSensorName': self._serialize.url("on_premise_iot_sensor_name", on_premise_iot_sensor_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') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/zip' + 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(body, 'ResetPasswordInput') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=True, **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 = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + download_reset_password.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}/downloadResetPassword'}