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 ae045fa6ea81..5a7bb4cf072e 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 @@ -63,6 +63,9 @@ from .operations import DevicesForHubOperations from .operations import DeviceOperations from .operations import OnPremiseIotSensorsOperations +from .operations import SqlVulnerabilityAssessmentScansOperations +from .operations import SqlVulnerabilityAssessmentScanResultsOperations +from .operations import SqlVulnerabilityAssessmentBaselineRulesOperations from . import models @@ -172,6 +175,12 @@ 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 sql_vulnerability_assessment_scans: SqlVulnerabilityAssessmentScans operations + :vartype sql_vulnerability_assessment_scans: azure.mgmt.security.operations.SqlVulnerabilityAssessmentScansOperations + :ivar sql_vulnerability_assessment_scan_results: SqlVulnerabilityAssessmentScanResults operations + :vartype sql_vulnerability_assessment_scan_results: azure.mgmt.security.operations.SqlVulnerabilityAssessmentScanResultsOperations + :ivar sql_vulnerability_assessment_baseline_rules: SqlVulnerabilityAssessmentBaselineRules operations + :vartype sql_vulnerability_assessment_baseline_rules: azure.mgmt.security.operations.SqlVulnerabilityAssessmentBaselineRulesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -294,3 +303,9 @@ 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.sql_vulnerability_assessment_scans = SqlVulnerabilityAssessmentScansOperations( + self._client, self.config, self._serialize, self._deserialize) + self.sql_vulnerability_assessment_scan_results = SqlVulnerabilityAssessmentScanResultsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.sql_vulnerability_assessment_baseline_rules = SqlVulnerabilityAssessmentBaselineRulesOperations( + 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 fa0e0280c09a..294ce6b4cb06 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 @@ -52,6 +52,9 @@ from ._models_py3 import AzureResourceIdentifier from ._models_py3 import AzureResourceLink from ._models_py3 import AzureTrackedResourceLocation + from ._models_py3 import Baseline + from ._models_py3 import BaselineAdjustedResult + from ._models_py3 import BenchmarkReference from ._models_py3 import CefExternalSecuritySolution from ._models_py3 import CefSolutionProperties from ._models_py3 import Compliance @@ -152,15 +155,28 @@ from ._models_py3 import Protocol1 from ._models_py3 import ProxyServerProperties from ._models_py3 import PublisherInfo + from ._models_py3 import QueryCheck from ._models_py3 import QueuePurgesNotInAllowedRange from ._models_py3 import RecommendationConfigurationProperties from ._models_py3 import RegulatoryComplianceAssessment from ._models_py3 import RegulatoryComplianceControl from ._models_py3 import RegulatoryComplianceStandard + from ._models_py3 import Remediation from ._models_py3 import Resource from ._models_py3 import ResourceDetails from ._models_py3 import ResourceIdentifier from ._models_py3 import Rule + from ._models_py3 import RuleResults + from ._models_py3 import RuleResultsInput + from ._models_py3 import RuleResultsProperties + from ._models_py3 import RulesResults + from ._models_py3 import RulesResultsInput + from ._models_py3 import Scan + from ._models_py3 import ScanProperties + from ._models_py3 import ScanResult + from ._models_py3 import ScanResultProperties + from ._models_py3 import ScanResults + from ._models_py3 import Scans from ._models_py3 import ScopeElement from ._models_py3 import SecureScoreControlDefinitionItem from ._models_py3 import SecureScoreControlDefinitionSource @@ -180,12 +196,14 @@ from ._models_py3 import SecurityTask from ._models_py3 import SecurityTaskParameters from ._models_py3 import SensitivityLabel + from ._models_py3 import Sensor from ._models_py3 import ServerVulnerabilityAssessment from ._models_py3 import ServerVulnerabilityAssessmentsList 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 from ._models_py3 import SuppressionAlertsScope @@ -203,6 +221,7 @@ from ._models_py3 import UpdateIotSecuritySolutionData from ._models_py3 import UserDefinedResourcesProperties from ._models_py3 import UserRecommendation + from ._models_py3 import VaRule from ._models_py3 import VendorReference from ._models_py3 import VmRecommendation from ._models_py3 import WorkspaceSetting @@ -249,6 +268,9 @@ from ._models import AzureResourceIdentifier from ._models import AzureResourceLink from ._models import AzureTrackedResourceLocation + from ._models import Baseline + from ._models import BaselineAdjustedResult + from ._models import BenchmarkReference from ._models import CefExternalSecuritySolution from ._models import CefSolutionProperties from ._models import Compliance @@ -349,15 +371,28 @@ from ._models import Protocol1 from ._models import ProxyServerProperties from ._models import PublisherInfo + from ._models import QueryCheck from ._models import QueuePurgesNotInAllowedRange from ._models import RecommendationConfigurationProperties from ._models import RegulatoryComplianceAssessment from ._models import RegulatoryComplianceControl from ._models import RegulatoryComplianceStandard + from ._models import Remediation from ._models import Resource from ._models import ResourceDetails from ._models import ResourceIdentifier from ._models import Rule + from ._models import RuleResults + from ._models import RuleResultsInput + from ._models import RuleResultsProperties + from ._models import RulesResults + from ._models import RulesResultsInput + from ._models import Scan + from ._models import ScanProperties + from ._models import ScanResult + from ._models import ScanResultProperties + from ._models import ScanResults + from ._models import Scans from ._models import ScopeElement from ._models import SecureScoreControlDefinitionItem from ._models import SecureScoreControlDefinitionSource @@ -377,12 +412,14 @@ from ._models import SecurityTask from ._models import SecurityTaskParameters from ._models import SensitivityLabel + from ._models import Sensor from ._models import ServerVulnerabilityAssessment from ._models import ServerVulnerabilityAssessmentsList 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 from ._models import SuppressionAlertsScope @@ -400,6 +437,7 @@ from ._models import UpdateIotSecuritySolutionData from ._models import UserDefinedResourcesProperties from ._models import UserRecommendation + from ._models import VaRule from ._models import VendorReference from ._models import VmRecommendation from ._models import WorkspaceSetting @@ -496,6 +534,11 @@ ProgrammingState, ScanningFunctionality, DeviceStatus, + ScanTriggerType, + ScanState, + RuleStatus, + RuleSeverity, + RuleType, ExpandEnum, ConnectionType, ExpandControlsEnum, @@ -544,6 +587,9 @@ 'AzureResourceIdentifier', 'AzureResourceLink', 'AzureTrackedResourceLocation', + 'Baseline', + 'BaselineAdjustedResult', + 'BenchmarkReference', 'CefExternalSecuritySolution', 'CefSolutionProperties', 'Compliance', @@ -644,15 +690,28 @@ 'Protocol1', 'ProxyServerProperties', 'PublisherInfo', + 'QueryCheck', 'QueuePurgesNotInAllowedRange', 'RecommendationConfigurationProperties', 'RegulatoryComplianceAssessment', 'RegulatoryComplianceControl', 'RegulatoryComplianceStandard', + 'Remediation', 'Resource', 'ResourceDetails', 'ResourceIdentifier', 'Rule', + 'RuleResults', + 'RuleResultsInput', + 'RuleResultsProperties', + 'RulesResults', + 'RulesResultsInput', + 'Scan', + 'ScanProperties', + 'ScanResult', + 'ScanResultProperties', + 'ScanResults', + 'Scans', 'ScopeElement', 'SecureScoreControlDefinitionItem', 'SecureScoreControlDefinitionSource', @@ -672,12 +731,14 @@ 'SecurityTask', 'SecurityTaskParameters', 'SensitivityLabel', + 'Sensor', 'ServerVulnerabilityAssessment', 'ServerVulnerabilityAssessmentsList', 'ServerVulnerabilityProperties', 'ServicePrincipalProperties', 'Setting', 'SettingResource', + 'Site', 'SqlServerVulnerabilityProperties', 'SubAssessmentStatus', 'SuppressionAlertsScope', @@ -695,6 +756,7 @@ 'UpdateIotSecuritySolutionData', 'UserDefinedResourcesProperties', 'UserRecommendation', + 'VaRule', 'VendorReference', 'VmRecommendation', 'WorkspaceSetting', @@ -790,6 +852,11 @@ 'ProgrammingState', 'ScanningFunctionality', 'DeviceStatus', + 'ScanTriggerType', + 'ScanState', + 'RuleStatus', + 'RuleSeverity', + 'RuleType', 'ExpandEnum', 'ConnectionType', 'ExpandControlsEnum', 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 66bda5c2b521..3b706cb5ac32 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 @@ -1911,8 +1911,8 @@ def __init__(self, **kwargs): class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsProperties): """AWS cloud account connector based assume role, the role enables delegating - access to your AWS resources. The role is composed of role arn and external - id, for more details, refer to Creating a Role to Delegate Permissions to an IAM User (write only). @@ -1969,7 +1969,7 @@ def __init__(self, **kwargs): class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): """AWS cloud account connector based credentials, the credentials is composed - of access key id and secret key, for more details, refer to Creating an IAM User in Your AWS Account (write only). @@ -2183,6 +2183,75 @@ def __init__(self, **kwargs): self.location = kwargs.get('location', None) +class Baseline(Model): + """Baseline details. + + :param expected_results: Expected results. + :type expected_results: list[list[str]] + :param updated_time: Baseline update time (UTC). + :type updated_time: datetime + """ + + _attribute_map = { + 'expected_results': {'key': 'expectedResults', 'type': '[[str]]'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(Baseline, self).__init__(**kwargs) + self.expected_results = kwargs.get('expected_results', None) + self.updated_time = kwargs.get('updated_time', None) + + +class BaselineAdjustedResult(Model): + """The rule result adjusted with baseline. + + :param baseline: + :type baseline: ~azure.mgmt.security.models.Baseline + :param status: Possible values include: 'NonFinding', 'Finding', + 'InternalError' + :type status: str or ~azure.mgmt.security.models.RuleStatus + :param results_not_in_baseline: Results the are not in baseline. + :type results_not_in_baseline: list[list[str]] + :param results_only_in_baseline: Results the are in baseline. + :type results_only_in_baseline: list[list[str]] + """ + + _attribute_map = { + 'baseline': {'key': 'baseline', 'type': 'Baseline'}, + 'status': {'key': 'status', 'type': 'str'}, + 'results_not_in_baseline': {'key': 'resultsNotInBaseline', 'type': '[[str]]'}, + 'results_only_in_baseline': {'key': 'resultsOnlyInBaseline', 'type': '[[str]]'}, + } + + def __init__(self, **kwargs): + super(BaselineAdjustedResult, self).__init__(**kwargs) + self.baseline = kwargs.get('baseline', None) + self.status = kwargs.get('status', None) + self.results_not_in_baseline = kwargs.get('results_not_in_baseline', None) + self.results_only_in_baseline = kwargs.get('results_only_in_baseline', None) + + +class BenchmarkReference(Model): + """The benchmark references. + + :param benchmark: The benchmark name. + :type benchmark: str + :param reference: The benchmark reference. + :type reference: str + """ + + _attribute_map = { + 'benchmark': {'key': 'benchmark', 'type': 'str'}, + 'reference': {'key': 'reference', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BenchmarkReference, self).__init__(**kwargs) + self.benchmark = kwargs.get('benchmark', None) + self.reference = kwargs.get('reference', None) + + class CefExternalSecuritySolution(ExternalSecuritySolution): """Represents a security solution which sends CEF logs to an OMS workspace. @@ -2571,8 +2640,8 @@ class ConnectorSetting(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param hybrid_compute_settings: Settings for hybrid compute management, - these settings are relevant only Arc autoProvision (Hybrid Compute). + :param hybrid_compute_settings: Settings for hybrid compute management. + These settings are relevant only for Arc autoProvision (Hybrid Compute). :type hybrid_compute_settings: ~azure.mgmt.security.models.HybridComputeSettingsProperties :param authentication_details: Settings for authentication management, @@ -2969,13 +3038,10 @@ class Device(Resource): :vartype last_scan_time: datetime :ivar risk_score: risk score of the device. :vartype risk_score: int - :ivar sensor_name: When the device is unmanaged, the sensor that scanned - this device. - :vartype sensor_name: str - :ivar site_name: The sensor site name. - :vartype site_name: str - :ivar zone_name: The sensor zone name. - :vartype zone_name: str + :ivar sensors: List of sensors that scanned this device. + :vartype sensors: list[~azure.mgmt.security.models.Sensor] + :ivar site: + :vartype site: ~azure.mgmt.security.models.Site :ivar device_status: Device status. Possible values include: 'Active', 'Removed' :vartype device_status: str or ~azure.mgmt.security.models.DeviceStatus @@ -2999,9 +3065,8 @@ class Device(Resource): 'scanning_functionality': {'readonly': True}, 'last_scan_time': {'readonly': True}, 'risk_score': {'readonly': True, 'maximum': 100, 'minimum': 0}, - 'sensor_name': {'readonly': True}, - 'site_name': {'readonly': True}, - 'zone_name': {'readonly': True}, + 'sensors': {'readonly': True}, + 'site': {'readonly': True}, 'device_status': {'readonly': True}, } @@ -3030,9 +3095,8 @@ class Device(Resource): 'scanning_functionality': {'key': 'properties.scanningFunctionality', 'type': 'str'}, 'last_scan_time': {'key': 'properties.lastScanTime', 'type': 'iso-8601'}, 'risk_score': {'key': 'properties.riskScore', 'type': 'int'}, - 'sensor_name': {'key': 'properties.sensorName', 'type': 'str'}, - 'site_name': {'key': 'properties.siteName', 'type': 'str'}, - 'zone_name': {'key': 'properties.zoneName', 'type': 'str'}, + 'sensors': {'key': 'properties.sensors', 'type': '[Sensor]'}, + 'site': {'key': 'properties.site', 'type': 'Site'}, 'device_status': {'key': 'properties.deviceStatus', 'type': 'str'}, } @@ -3059,9 +3123,8 @@ def __init__(self, **kwargs): self.scanning_functionality = None self.last_scan_time = None self.risk_score = None - self.sensor_name = None - self.site_name = None - self.zone_name = None + self.sensors = None + self.site = None self.device_status = None @@ -3437,8 +3500,8 @@ def __init__(self, **kwargs): class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): """GCP cloud account connector based service to service credentials, the - credentials is composed of organization id and json api key (write - only). + credentials are composed of the organization ID and a JSON API key (write + only). Variables are only populated by the server, and will be ignored when sending a request. @@ -3455,14 +3518,14 @@ class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): ~azure.mgmt.security.models.PermissionProperty] :param authentication_type: Required. Constant filled by server. :type authentication_type: str - :param organization_id: Required. The Organization ID of the GCP cloud + :param organization_id: Required. The organization ID of the GCP cloud account :type organization_id: str :param type: Required. Type field of the API key (write only) :type type: str - :param project_id: Required. Project Id field of the API key (write only) + :param project_id: Required. Project ID field of the API key (write only) :type project_id: str - :param private_key_id: Required. Private key Id field of the API key + :param private_key_id: Required. Private key ID field of the API key (write only) :type private_key_id: str :param private_key: Required. Private key field of the API key (write @@ -3471,16 +3534,16 @@ class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): :param client_email: Required. Client email field of the API key (write only) :type client_email: str - :param client_id: Required. Client Id field of the API key (write only) + :param client_id: Required. Client ID field of the API key (write only) :type client_id: str - :param auth_uri: Required. Auth Uri field of the API key (write only) + :param auth_uri: Required. Auth URI field of the API key (write only) :type auth_uri: str - :param token_uri: Required. Token Uri field of the API key (write only) + :param token_uri: Required. Token URI field of the API key (write only) :type token_uri: str :param auth_provider_x509_cert_url: Required. Auth provider x509 - certificate url field of the API key (write only) + certificate URL field of the API key (write only) :type auth_provider_x509_cert_url: str - :param client_x509_cert_url: Required. Client x509 certificate url field + :param client_x509_cert_url: Required. Client x509 certificate URL field of the API key (write only) :type client_x509_cert_url: str """ @@ -3702,7 +3765,7 @@ class HybridComputeSettingsProperties(Model): :param resource_group_name: The name of the resource group where Arc (Hybrid Compute) connectors are connected. :type resource_group_name: str - :param region: The location where the meta data of machines will be stored + :param region: The location where the metadata of machines will be stored :type region: str :param proxy_server: For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure @@ -6396,6 +6459,30 @@ def __init__(self, **kwargs): self.version = kwargs.get('version', None) +class QueryCheck(Model): + """The rule query details. + + :param query: The rule query. + :type query: str + :param expected_result: Expected result. + :type expected_result: list[list[str]] + :param column_names: Column names of expected result. + :type column_names: list[str] + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'expected_result': {'key': 'expectedResult', 'type': '[[str]]'}, + 'column_names': {'key': 'columnNames', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(QueryCheck, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + self.expected_result = kwargs.get('expected_result', None) + self.column_names = kwargs.get('column_names', None) + + class QueuePurgesNotInAllowedRange(TimeWindowCustomAlertRule): """Number of device queue purges is not in allowed range. @@ -6688,6 +6775,34 @@ def __init__(self, **kwargs): self.unsupported_controls = None +class Remediation(Model): + """Remediation details. + + :param description: Remediation description. + :type description: str + :param scripts: Remediation script. + :type scripts: list[str] + :param automated: Is remediation automated. + :type automated: bool + :param portal_link: Optional link to remediate in Azure Portal. + :type portal_link: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'scripts': {'key': 'scripts', 'type': '[str]'}, + 'automated': {'key': 'automated', 'type': 'bool'}, + 'portal_link': {'key': 'portalLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Remediation, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.scripts = kwargs.get('scripts', None) + self.automated = kwargs.get('automated', None) + self.portal_link = kwargs.get('portal_link', None) + + class Rule(Model): """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote @@ -6726,6 +6841,330 @@ def __init__(self, **kwargs): self.ip_addresses = kwargs.get('ip_addresses', None) +class RuleResults(Resource): + """Rule results. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.RuleResultsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RuleResultsProperties'}, + } + + def __init__(self, **kwargs): + super(RuleResults, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class RuleResultsInput(Model): + """Rule results input. + + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: list[list[str]] + """ + + _attribute_map = { + 'latest_scan': {'key': 'latestScan', 'type': 'bool'}, + 'results': {'key': 'results', 'type': '[[str]]'}, + } + + def __init__(self, **kwargs): + super(RuleResultsInput, self).__init__(**kwargs) + self.latest_scan = kwargs.get('latest_scan', None) + self.results = kwargs.get('results', None) + + +class RuleResultsProperties(Model): + """Rule results properties. + + :param results: Expected results in the baseline. + :type results: list[list[str]] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[[str]]'}, + } + + def __init__(self, **kwargs): + super(RuleResultsProperties, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class RulesResults(Model): + """A list of rules results. + + :param value: List of rule results. + :type value: list[~azure.mgmt.security.models.RuleResults] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RuleResults]'}, + } + + def __init__(self, **kwargs): + super(RulesResults, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class RulesResultsInput(Model): + """Rules results input. + + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: dict[str, list[list[str]]] + """ + + _attribute_map = { + 'latest_scan': {'key': 'latestScan', 'type': 'bool'}, + 'results': {'key': 'results', 'type': '{[[str]]}'}, + } + + def __init__(self, **kwargs): + super(RulesResultsInput, self).__init__(**kwargs) + self.latest_scan = kwargs.get('latest_scan', None) + self.results = kwargs.get('results', None) + + +class Scan(Resource): + """A vulnerability assessment scan record. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.ScanProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ScanProperties'}, + } + + def __init__(self, **kwargs): + super(Scan, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ScanProperties(Model): + """A vulnerability assessment scan record properties. + + :param trigger_type: Possible values include: 'OnDemand', 'Recurring' + :type trigger_type: str or ~azure.mgmt.security.models.ScanTriggerType + :param state: Possible values include: 'Failed', 'FailedToRun', + 'InProgress', 'Passed' + :type state: str or ~azure.mgmt.security.models.ScanState + :param server: The server name. + :type server: str + :param database: The database name. + :type database: str + :param sql_version: The SQL version. + :type sql_version: str + :param start_time: The scan start time (UTC). + :type start_time: datetime + :param end_time: Scan results are valid until end time (UTC). + :type end_time: datetime + :param high_severity_failed_rules_count: The number of failed rules with + high severity. + :type high_severity_failed_rules_count: int + :param medium_severity_failed_rules_count: The number of failed rules with + medium severity. + :type medium_severity_failed_rules_count: int + :param low_severity_failed_rules_count: The number of failed rules with + low severity. + :type low_severity_failed_rules_count: int + :param total_passed_rules_count: The number of total passed rules. + :type total_passed_rules_count: int + :param total_failed_rules_count: The number of total failed rules. + :type total_failed_rules_count: int + :param total_rules_count: The number of total rules assessed. + :type total_rules_count: int + :param is_baseline_applied: Baseline created for this database, and has + one or more rules. + :type is_baseline_applied: bool + """ + + _attribute_map = { + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'server': {'key': 'server', 'type': 'str'}, + 'database': {'key': 'database', 'type': 'str'}, + 'sql_version': {'key': 'sqlVersion', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'high_severity_failed_rules_count': {'key': 'highSeverityFailedRulesCount', 'type': 'int'}, + 'medium_severity_failed_rules_count': {'key': 'mediumSeverityFailedRulesCount', 'type': 'int'}, + 'low_severity_failed_rules_count': {'key': 'lowSeverityFailedRulesCount', 'type': 'int'}, + 'total_passed_rules_count': {'key': 'totalPassedRulesCount', 'type': 'int'}, + 'total_failed_rules_count': {'key': 'totalFailedRulesCount', 'type': 'int'}, + 'total_rules_count': {'key': 'totalRulesCount', 'type': 'int'}, + 'is_baseline_applied': {'key': 'isBaselineApplied', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(ScanProperties, self).__init__(**kwargs) + self.trigger_type = kwargs.get('trigger_type', None) + self.state = kwargs.get('state', None) + self.server = kwargs.get('server', None) + self.database = kwargs.get('database', None) + self.sql_version = kwargs.get('sql_version', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.high_severity_failed_rules_count = kwargs.get('high_severity_failed_rules_count', None) + self.medium_severity_failed_rules_count = kwargs.get('medium_severity_failed_rules_count', None) + self.low_severity_failed_rules_count = kwargs.get('low_severity_failed_rules_count', None) + self.total_passed_rules_count = kwargs.get('total_passed_rules_count', None) + self.total_failed_rules_count = kwargs.get('total_failed_rules_count', None) + self.total_rules_count = kwargs.get('total_rules_count', None) + self.is_baseline_applied = kwargs.get('is_baseline_applied', None) + + +class ScanResult(Resource): + """A vulnerability assessment scan result for a single rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.ScanResultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ScanResultProperties'}, + } + + def __init__(self, **kwargs): + super(ScanResult, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ScanResultProperties(Model): + """A vulnerability assessment scan result properties for a single rule. + + :param rule_id: The rule Id. + :type rule_id: str + :param status: Possible values include: 'NonFinding', 'Finding', + 'InternalError' + :type status: str or ~azure.mgmt.security.models.RuleStatus + :param is_trimmed: Indicated whether the results specified here are + trimmed. + :type is_trimmed: bool + :param query_results: The results of the query that was run. + :type query_results: list[list[str]] + :param remediation: + :type remediation: ~azure.mgmt.security.models.Remediation + :param baseline_adjusted_result: + :type baseline_adjusted_result: + ~azure.mgmt.security.models.BaselineAdjustedResult + :param rule_metadata: + :type rule_metadata: ~azure.mgmt.security.models.VaRule + """ + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'is_trimmed': {'key': 'isTrimmed', 'type': 'bool'}, + 'query_results': {'key': 'queryResults', 'type': '[[str]]'}, + 'remediation': {'key': 'remediation', 'type': 'Remediation'}, + 'baseline_adjusted_result': {'key': 'baselineAdjustedResult', 'type': 'BaselineAdjustedResult'}, + 'rule_metadata': {'key': 'ruleMetadata', 'type': 'VaRule'}, + } + + def __init__(self, **kwargs): + super(ScanResultProperties, self).__init__(**kwargs) + self.rule_id = kwargs.get('rule_id', None) + self.status = kwargs.get('status', None) + self.is_trimmed = kwargs.get('is_trimmed', None) + self.query_results = kwargs.get('query_results', None) + self.remediation = kwargs.get('remediation', None) + self.baseline_adjusted_result = kwargs.get('baseline_adjusted_result', None) + self.rule_metadata = kwargs.get('rule_metadata', None) + + +class ScanResults(Model): + """A list of vulnerability assessment scan results. + + :param value: List of vulnerability assessment scan results. + :type value: list[~azure.mgmt.security.models.ScanResult] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScanResult]'}, + } + + def __init__(self, **kwargs): + super(ScanResults, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Scans(Model): + """A list of vulnerability assessment scan records. + + :param value: List of vulnerability assessment scan records. + :type value: list[~azure.mgmt.security.models.Scan] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Scan]'}, + } + + def __init__(self, **kwargs): + super(Scans, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class ScopeElement(Model): """A more specific scope used to identify the alerts to suppress. @@ -7708,6 +8147,34 @@ def __init__(self, **kwargs): self.enabled = kwargs.get('enabled', None) +class Sensor(Model): + """Sensor data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Sensor name + :vartype name: str + :ivar zone: Zone Name. + :vartype zone: str + """ + + _validation = { + 'name': {'readonly': True}, + 'zone': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Sensor, self).__init__(**kwargs) + self.name = None + self.zone = None + + class ServerVulnerabilityAssessment(Resource): """Describes the server vulnerability assessment details on a resource. @@ -7827,7 +8294,7 @@ def __init__(self, **kwargs): class ServicePrincipalProperties(Model): """Details of the service principal. - :param application_id: Application id of service principal. + :param application_id: Application ID of service principal. :type application_id: str :param secret: A secret string that the application uses to prove its identity, also can be referred to as application password (write only). @@ -7845,6 +8312,29 @@ def __init__(self, **kwargs): self.secret = kwargs.get('secret', None) +class Site(Model): + """Site data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar display_name: Site display name + :vartype display_name: str + """ + + _validation = { + 'display_name': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Site, self).__init__(**kwargs) + self.display_name = None + + class SqlServerVulnerabilityProperties(AdditionalData): """Details of the resource that was assessed. @@ -8316,6 +8806,57 @@ def __init__(self, **kwargs): self.recommendation_action = kwargs.get('recommendation_action', None) +class VaRule(Model): + """vulnerability assessment rule metadata details. + + :param rule_id: The rule Id. + :type rule_id: str + :param severity: Possible values include: 'High', 'Medium', 'Low', + 'Informational', 'Obsolete' + :type severity: str or ~azure.mgmt.security.models.RuleSeverity + :param category: The rule category. + :type category: str + :param rule_type: Possible values include: 'Binary', 'BaselineExpected', + 'PositiveList', 'NegativeList' + :type rule_type: str or ~azure.mgmt.security.models.RuleType + :param title: The rule title. + :type title: str + :param description: The rule description. + :type description: str + :param rationale: The rule rationale. + :type rationale: str + :param query_check: + :type query_check: ~azure.mgmt.security.models.QueryCheck + :param benchmark_references: The benchmark references. + :type benchmark_references: + list[~azure.mgmt.security.models.BenchmarkReference] + """ + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'rationale': {'key': 'rationale', 'type': 'str'}, + 'query_check': {'key': 'queryCheck', 'type': 'QueryCheck'}, + 'benchmark_references': {'key': 'benchmarkReferences', 'type': '[BenchmarkReference]'}, + } + + def __init__(self, **kwargs): + super(VaRule, self).__init__(**kwargs) + self.rule_id = kwargs.get('rule_id', None) + self.severity = kwargs.get('severity', None) + self.category = kwargs.get('category', None) + self.rule_type = kwargs.get('rule_type', None) + self.title = kwargs.get('title', None) + self.description = kwargs.get('description', None) + self.rationale = kwargs.get('rationale', None) + self.query_check = kwargs.get('query_check', None) + self.benchmark_references = kwargs.get('benchmark_references', None) + + class VendorReference(Model): """Vendor reference. 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 75e17c9195ef..5028f843edcc 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 @@ -1911,8 +1911,8 @@ def __init__(self, *, auto_provision, **kwargs) -> None: class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsProperties): """AWS cloud account connector based assume role, the role enables delegating - access to your AWS resources. The role is composed of role arn and external - id, for more details, refer to Creating a Role to Delegate Permissions to an IAM User (write only). @@ -1969,7 +1969,7 @@ def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs) class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): """AWS cloud account connector based credentials, the credentials is composed - of access key id and secret key, for more details, refer to Creating an IAM User in Your AWS Account (write only). @@ -2183,6 +2183,75 @@ def __init__(self, *, location: str=None, **kwargs) -> None: self.location = location +class Baseline(Model): + """Baseline details. + + :param expected_results: Expected results. + :type expected_results: list[list[str]] + :param updated_time: Baseline update time (UTC). + :type updated_time: datetime + """ + + _attribute_map = { + 'expected_results': {'key': 'expectedResults', 'type': '[[str]]'}, + 'updated_time': {'key': 'updatedTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, expected_results=None, updated_time=None, **kwargs) -> None: + super(Baseline, self).__init__(**kwargs) + self.expected_results = expected_results + self.updated_time = updated_time + + +class BaselineAdjustedResult(Model): + """The rule result adjusted with baseline. + + :param baseline: + :type baseline: ~azure.mgmt.security.models.Baseline + :param status: Possible values include: 'NonFinding', 'Finding', + 'InternalError' + :type status: str or ~azure.mgmt.security.models.RuleStatus + :param results_not_in_baseline: Results the are not in baseline. + :type results_not_in_baseline: list[list[str]] + :param results_only_in_baseline: Results the are in baseline. + :type results_only_in_baseline: list[list[str]] + """ + + _attribute_map = { + 'baseline': {'key': 'baseline', 'type': 'Baseline'}, + 'status': {'key': 'status', 'type': 'str'}, + 'results_not_in_baseline': {'key': 'resultsNotInBaseline', 'type': '[[str]]'}, + 'results_only_in_baseline': {'key': 'resultsOnlyInBaseline', 'type': '[[str]]'}, + } + + def __init__(self, *, baseline=None, status=None, results_not_in_baseline=None, results_only_in_baseline=None, **kwargs) -> None: + super(BaselineAdjustedResult, self).__init__(**kwargs) + self.baseline = baseline + self.status = status + self.results_not_in_baseline = results_not_in_baseline + self.results_only_in_baseline = results_only_in_baseline + + +class BenchmarkReference(Model): + """The benchmark references. + + :param benchmark: The benchmark name. + :type benchmark: str + :param reference: The benchmark reference. + :type reference: str + """ + + _attribute_map = { + 'benchmark': {'key': 'benchmark', 'type': 'str'}, + 'reference': {'key': 'reference', 'type': 'str'}, + } + + def __init__(self, *, benchmark: str=None, reference: str=None, **kwargs) -> None: + super(BenchmarkReference, self).__init__(**kwargs) + self.benchmark = benchmark + self.reference = reference + + class CefExternalSecuritySolution(ExternalSecuritySolution): """Represents a security solution which sends CEF logs to an OMS workspace. @@ -2571,8 +2640,8 @@ class ConnectorSetting(Resource): :vartype name: str :ivar type: Resource type :vartype type: str - :param hybrid_compute_settings: Settings for hybrid compute management, - these settings are relevant only Arc autoProvision (Hybrid Compute). + :param hybrid_compute_settings: Settings for hybrid compute management. + These settings are relevant only for Arc autoProvision (Hybrid Compute). :type hybrid_compute_settings: ~azure.mgmt.security.models.HybridComputeSettingsProperties :param authentication_details: Settings for authentication management, @@ -2969,13 +3038,10 @@ class Device(Resource): :vartype last_scan_time: datetime :ivar risk_score: risk score of the device. :vartype risk_score: int - :ivar sensor_name: When the device is unmanaged, the sensor that scanned - this device. - :vartype sensor_name: str - :ivar site_name: The sensor site name. - :vartype site_name: str - :ivar zone_name: The sensor zone name. - :vartype zone_name: str + :ivar sensors: List of sensors that scanned this device. + :vartype sensors: list[~azure.mgmt.security.models.Sensor] + :ivar site: + :vartype site: ~azure.mgmt.security.models.Site :ivar device_status: Device status. Possible values include: 'Active', 'Removed' :vartype device_status: str or ~azure.mgmt.security.models.DeviceStatus @@ -2999,9 +3065,8 @@ class Device(Resource): 'scanning_functionality': {'readonly': True}, 'last_scan_time': {'readonly': True}, 'risk_score': {'readonly': True, 'maximum': 100, 'minimum': 0}, - 'sensor_name': {'readonly': True}, - 'site_name': {'readonly': True}, - 'zone_name': {'readonly': True}, + 'sensors': {'readonly': True}, + 'site': {'readonly': True}, 'device_status': {'readonly': True}, } @@ -3030,9 +3095,8 @@ class Device(Resource): 'scanning_functionality': {'key': 'properties.scanningFunctionality', 'type': 'str'}, 'last_scan_time': {'key': 'properties.lastScanTime', 'type': 'iso-8601'}, 'risk_score': {'key': 'properties.riskScore', 'type': 'int'}, - 'sensor_name': {'key': 'properties.sensorName', 'type': 'str'}, - 'site_name': {'key': 'properties.siteName', 'type': 'str'}, - 'zone_name': {'key': 'properties.zoneName', 'type': 'str'}, + 'sensors': {'key': 'properties.sensors', 'type': '[Sensor]'}, + 'site': {'key': 'properties.site', 'type': 'Site'}, 'device_status': {'key': 'properties.deviceStatus', 'type': 'str'}, } @@ -3059,9 +3123,8 @@ def __init__(self, *, display_name: str=None, device_type: str=None, os_name: st self.scanning_functionality = None self.last_scan_time = None self.risk_score = None - self.sensor_name = None - self.site_name = None - self.zone_name = None + self.sensors = None + self.site = None self.device_status = None @@ -3437,8 +3500,8 @@ def __init__(self, **kwargs) -> None: class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): """GCP cloud account connector based service to service credentials, the - credentials is composed of organization id and json api key (write - only). + credentials are composed of the organization ID and a JSON API key (write + only). Variables are only populated by the server, and will be ignored when sending a request. @@ -3455,14 +3518,14 @@ class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): ~azure.mgmt.security.models.PermissionProperty] :param authentication_type: Required. Constant filled by server. :type authentication_type: str - :param organization_id: Required. The Organization ID of the GCP cloud + :param organization_id: Required. The organization ID of the GCP cloud account :type organization_id: str :param type: Required. Type field of the API key (write only) :type type: str - :param project_id: Required. Project Id field of the API key (write only) + :param project_id: Required. Project ID field of the API key (write only) :type project_id: str - :param private_key_id: Required. Private key Id field of the API key + :param private_key_id: Required. Private key ID field of the API key (write only) :type private_key_id: str :param private_key: Required. Private key field of the API key (write @@ -3471,16 +3534,16 @@ class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): :param client_email: Required. Client email field of the API key (write only) :type client_email: str - :param client_id: Required. Client Id field of the API key (write only) + :param client_id: Required. Client ID field of the API key (write only) :type client_id: str - :param auth_uri: Required. Auth Uri field of the API key (write only) + :param auth_uri: Required. Auth URI field of the API key (write only) :type auth_uri: str - :param token_uri: Required. Token Uri field of the API key (write only) + :param token_uri: Required. Token URI field of the API key (write only) :type token_uri: str :param auth_provider_x509_cert_url: Required. Auth provider x509 - certificate url field of the API key (write only) + certificate URL field of the API key (write only) :type auth_provider_x509_cert_url: str - :param client_x509_cert_url: Required. Client x509 certificate url field + :param client_x509_cert_url: Required. Client x509 certificate URL field of the API key (write only) :type client_x509_cert_url: str """ @@ -3702,7 +3765,7 @@ class HybridComputeSettingsProperties(Model): :param resource_group_name: The name of the resource group where Arc (Hybrid Compute) connectors are connected. :type resource_group_name: str - :param region: The location where the meta data of machines will be stored + :param region: The location where the metadata of machines will be stored :type region: str :param proxy_server: For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure @@ -6396,6 +6459,30 @@ def __init__(self, *, publisher_name: str=None, product_name: str=None, binary_n self.version = version +class QueryCheck(Model): + """The rule query details. + + :param query: The rule query. + :type query: str + :param expected_result: Expected result. + :type expected_result: list[list[str]] + :param column_names: Column names of expected result. + :type column_names: list[str] + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'expected_result': {'key': 'expectedResult', 'type': '[[str]]'}, + 'column_names': {'key': 'columnNames', 'type': '[str]'}, + } + + def __init__(self, *, query: str=None, expected_result=None, column_names=None, **kwargs) -> None: + super(QueryCheck, self).__init__(**kwargs) + self.query = query + self.expected_result = expected_result + self.column_names = column_names + + class QueuePurgesNotInAllowedRange(TimeWindowCustomAlertRule): """Number of device queue purges is not in allowed range. @@ -6688,6 +6775,34 @@ def __init__(self, *, state=None, **kwargs) -> None: self.unsupported_controls = None +class Remediation(Model): + """Remediation details. + + :param description: Remediation description. + :type description: str + :param scripts: Remediation script. + :type scripts: list[str] + :param automated: Is remediation automated. + :type automated: bool + :param portal_link: Optional link to remediate in Azure Portal. + :type portal_link: str + """ + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'scripts': {'key': 'scripts', 'type': '[str]'}, + 'automated': {'key': 'automated', 'type': 'bool'}, + 'portal_link': {'key': 'portalLink', 'type': 'str'}, + } + + def __init__(self, *, description: str=None, scripts=None, automated: bool=None, portal_link: str=None, **kwargs) -> None: + super(Remediation, self).__init__(**kwargs) + self.description = description + self.scripts = scripts + self.automated = automated + self.portal_link = portal_link + + class Rule(Model): """Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). All other remote @@ -6726,6 +6841,330 @@ def __init__(self, *, name: str=None, direction=None, destination_port: int=None self.ip_addresses = ip_addresses +class RuleResults(Resource): + """Rule results. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.RuleResultsProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'RuleResultsProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(RuleResults, self).__init__(**kwargs) + self.properties = properties + + +class RuleResultsInput(Model): + """Rule results input. + + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: list[list[str]] + """ + + _attribute_map = { + 'latest_scan': {'key': 'latestScan', 'type': 'bool'}, + 'results': {'key': 'results', 'type': '[[str]]'}, + } + + def __init__(self, *, latest_scan: bool=None, results=None, **kwargs) -> None: + super(RuleResultsInput, self).__init__(**kwargs) + self.latest_scan = latest_scan + self.results = results + + +class RuleResultsProperties(Model): + """Rule results properties. + + :param results: Expected results in the baseline. + :type results: list[list[str]] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[[str]]'}, + } + + def __init__(self, *, results=None, **kwargs) -> None: + super(RuleResultsProperties, self).__init__(**kwargs) + self.results = results + + +class RulesResults(Model): + """A list of rules results. + + :param value: List of rule results. + :type value: list[~azure.mgmt.security.models.RuleResults] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RuleResults]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(RulesResults, self).__init__(**kwargs) + self.value = value + + +class RulesResultsInput(Model): + """Rules results input. + + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: dict[str, list[list[str]]] + """ + + _attribute_map = { + 'latest_scan': {'key': 'latestScan', 'type': 'bool'}, + 'results': {'key': 'results', 'type': '{[[str]]}'}, + } + + def __init__(self, *, latest_scan: bool=None, results=None, **kwargs) -> None: + super(RulesResultsInput, self).__init__(**kwargs) + self.latest_scan = latest_scan + self.results = results + + +class Scan(Resource): + """A vulnerability assessment scan record. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.ScanProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ScanProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(Scan, self).__init__(**kwargs) + self.properties = properties + + +class ScanProperties(Model): + """A vulnerability assessment scan record properties. + + :param trigger_type: Possible values include: 'OnDemand', 'Recurring' + :type trigger_type: str or ~azure.mgmt.security.models.ScanTriggerType + :param state: Possible values include: 'Failed', 'FailedToRun', + 'InProgress', 'Passed' + :type state: str or ~azure.mgmt.security.models.ScanState + :param server: The server name. + :type server: str + :param database: The database name. + :type database: str + :param sql_version: The SQL version. + :type sql_version: str + :param start_time: The scan start time (UTC). + :type start_time: datetime + :param end_time: Scan results are valid until end time (UTC). + :type end_time: datetime + :param high_severity_failed_rules_count: The number of failed rules with + high severity. + :type high_severity_failed_rules_count: int + :param medium_severity_failed_rules_count: The number of failed rules with + medium severity. + :type medium_severity_failed_rules_count: int + :param low_severity_failed_rules_count: The number of failed rules with + low severity. + :type low_severity_failed_rules_count: int + :param total_passed_rules_count: The number of total passed rules. + :type total_passed_rules_count: int + :param total_failed_rules_count: The number of total failed rules. + :type total_failed_rules_count: int + :param total_rules_count: The number of total rules assessed. + :type total_rules_count: int + :param is_baseline_applied: Baseline created for this database, and has + one or more rules. + :type is_baseline_applied: bool + """ + + _attribute_map = { + 'trigger_type': {'key': 'triggerType', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'server': {'key': 'server', 'type': 'str'}, + 'database': {'key': 'database', 'type': 'str'}, + 'sql_version': {'key': 'sqlVersion', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'high_severity_failed_rules_count': {'key': 'highSeverityFailedRulesCount', 'type': 'int'}, + 'medium_severity_failed_rules_count': {'key': 'mediumSeverityFailedRulesCount', 'type': 'int'}, + 'low_severity_failed_rules_count': {'key': 'lowSeverityFailedRulesCount', 'type': 'int'}, + 'total_passed_rules_count': {'key': 'totalPassedRulesCount', 'type': 'int'}, + 'total_failed_rules_count': {'key': 'totalFailedRulesCount', 'type': 'int'}, + 'total_rules_count': {'key': 'totalRulesCount', 'type': 'int'}, + 'is_baseline_applied': {'key': 'isBaselineApplied', 'type': 'bool'}, + } + + def __init__(self, *, trigger_type=None, state=None, server: str=None, database: str=None, sql_version: str=None, start_time=None, end_time=None, high_severity_failed_rules_count: int=None, medium_severity_failed_rules_count: int=None, low_severity_failed_rules_count: int=None, total_passed_rules_count: int=None, total_failed_rules_count: int=None, total_rules_count: int=None, is_baseline_applied: bool=None, **kwargs) -> None: + super(ScanProperties, self).__init__(**kwargs) + self.trigger_type = trigger_type + self.state = state + self.server = server + self.database = database + self.sql_version = sql_version + self.start_time = start_time + self.end_time = end_time + self.high_severity_failed_rules_count = high_severity_failed_rules_count + self.medium_severity_failed_rules_count = medium_severity_failed_rules_count + self.low_severity_failed_rules_count = low_severity_failed_rules_count + self.total_passed_rules_count = total_passed_rules_count + self.total_failed_rules_count = total_failed_rules_count + self.total_rules_count = total_rules_count + self.is_baseline_applied = is_baseline_applied + + +class ScanResult(Resource): + """A vulnerability assessment scan result for a single rule. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param properties: + :type properties: ~azure.mgmt.security.models.ScanResultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'ScanResultProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(ScanResult, self).__init__(**kwargs) + self.properties = properties + + +class ScanResultProperties(Model): + """A vulnerability assessment scan result properties for a single rule. + + :param rule_id: The rule Id. + :type rule_id: str + :param status: Possible values include: 'NonFinding', 'Finding', + 'InternalError' + :type status: str or ~azure.mgmt.security.models.RuleStatus + :param is_trimmed: Indicated whether the results specified here are + trimmed. + :type is_trimmed: bool + :param query_results: The results of the query that was run. + :type query_results: list[list[str]] + :param remediation: + :type remediation: ~azure.mgmt.security.models.Remediation + :param baseline_adjusted_result: + :type baseline_adjusted_result: + ~azure.mgmt.security.models.BaselineAdjustedResult + :param rule_metadata: + :type rule_metadata: ~azure.mgmt.security.models.VaRule + """ + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'is_trimmed': {'key': 'isTrimmed', 'type': 'bool'}, + 'query_results': {'key': 'queryResults', 'type': '[[str]]'}, + 'remediation': {'key': 'remediation', 'type': 'Remediation'}, + 'baseline_adjusted_result': {'key': 'baselineAdjustedResult', 'type': 'BaselineAdjustedResult'}, + 'rule_metadata': {'key': 'ruleMetadata', 'type': 'VaRule'}, + } + + def __init__(self, *, rule_id: str=None, status=None, is_trimmed: bool=None, query_results=None, remediation=None, baseline_adjusted_result=None, rule_metadata=None, **kwargs) -> None: + super(ScanResultProperties, self).__init__(**kwargs) + self.rule_id = rule_id + self.status = status + self.is_trimmed = is_trimmed + self.query_results = query_results + self.remediation = remediation + self.baseline_adjusted_result = baseline_adjusted_result + self.rule_metadata = rule_metadata + + +class ScanResults(Model): + """A list of vulnerability assessment scan results. + + :param value: List of vulnerability assessment scan results. + :type value: list[~azure.mgmt.security.models.ScanResult] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScanResult]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(ScanResults, self).__init__(**kwargs) + self.value = value + + +class Scans(Model): + """A list of vulnerability assessment scan records. + + :param value: List of vulnerability assessment scan records. + :type value: list[~azure.mgmt.security.models.Scan] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Scan]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(Scans, self).__init__(**kwargs) + self.value = value + + class ScopeElement(Model): """A more specific scope used to identify the alerts to suppress. @@ -7708,6 +8147,34 @@ def __init__(self, *, display_name: str=None, description: str=None, rank=None, self.enabled = enabled +class Sensor(Model): + """Sensor data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Sensor name + :vartype name: str + :ivar zone: Zone Name. + :vartype zone: str + """ + + _validation = { + 'name': {'readonly': True}, + 'zone': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Sensor, self).__init__(**kwargs) + self.name = None + self.zone = None + + class ServerVulnerabilityAssessment(Resource): """Describes the server vulnerability assessment details on a resource. @@ -7827,7 +8294,7 @@ def __init__(self, **kwargs) -> None: class ServicePrincipalProperties(Model): """Details of the service principal. - :param application_id: Application id of service principal. + :param application_id: Application ID of service principal. :type application_id: str :param secret: A secret string that the application uses to prove its identity, also can be referred to as application password (write only). @@ -7845,6 +8312,29 @@ def __init__(self, *, application_id: str=None, secret: str=None, **kwargs) -> N self.secret = secret +class Site(Model): + """Site data. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar display_name: Site display name + :vartype display_name: str + """ + + _validation = { + 'display_name': {'readonly': True}, + } + + _attribute_map = { + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(Site, self).__init__(**kwargs) + self.display_name = None + + class SqlServerVulnerabilityProperties(AdditionalData): """Details of the resource that was assessed. @@ -8316,6 +8806,57 @@ def __init__(self, *, username: str=None, recommendation_action=None, **kwargs) self.recommendation_action = recommendation_action +class VaRule(Model): + """vulnerability assessment rule metadata details. + + :param rule_id: The rule Id. + :type rule_id: str + :param severity: Possible values include: 'High', 'Medium', 'Low', + 'Informational', 'Obsolete' + :type severity: str or ~azure.mgmt.security.models.RuleSeverity + :param category: The rule category. + :type category: str + :param rule_type: Possible values include: 'Binary', 'BaselineExpected', + 'PositiveList', 'NegativeList' + :type rule_type: str or ~azure.mgmt.security.models.RuleType + :param title: The rule title. + :type title: str + :param description: The rule description. + :type description: str + :param rationale: The rule rationale. + :type rationale: str + :param query_check: + :type query_check: ~azure.mgmt.security.models.QueryCheck + :param benchmark_references: The benchmark references. + :type benchmark_references: + list[~azure.mgmt.security.models.BenchmarkReference] + """ + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'rule_type': {'key': 'ruleType', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'rationale': {'key': 'rationale', 'type': 'str'}, + 'query_check': {'key': 'queryCheck', 'type': 'QueryCheck'}, + 'benchmark_references': {'key': 'benchmarkReferences', 'type': '[BenchmarkReference]'}, + } + + def __init__(self, *, rule_id: str=None, severity=None, category: str=None, rule_type=None, title: str=None, description: str=None, rationale: str=None, query_check=None, benchmark_references=None, **kwargs) -> None: + super(VaRule, self).__init__(**kwargs) + self.rule_id = rule_id + self.severity = severity + self.category = category + self.rule_type = rule_type + self.title = title + self.description = description + self.rationale = rationale + self.query_check = query_check + self.benchmark_references = benchmark_references + + class VendorReference(Model): """Vendor reference. 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 df4796d1eef2..b5124625f2f4 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 @@ -366,7 +366,7 @@ class AuthenticationProvisioningState(str, Enum): valid = "Valid" #: Valid connector invalid = "Invalid" #: Invalid connector - expired = "Expired" #: the connection is expired + expired = "Expired" #: the connection has expired incorrect_policy = "IncorrectPolicy" #: Incorrect policy of the connector @@ -440,6 +440,44 @@ class DeviceStatus(str, Enum): removed = "Removed" +class ScanTriggerType(str, Enum): + + on_demand = "OnDemand" #: OnDemand + recurring = "Recurring" #: Recurring + + +class ScanState(str, Enum): + + failed = "Failed" #: Failed + failed_to_run = "FailedToRun" #: FailedToRun + in_progress = "InProgress" #: InProgress + passed = "Passed" #: Passed + + +class RuleStatus(str, Enum): + + non_finding = "NonFinding" #: NonFinding + finding = "Finding" #: Finding + internal_error = "InternalError" #: InternalError + + +class RuleSeverity(str, Enum): + + high = "High" #: High + medium = "Medium" #: Medium + low = "Low" #: Low + informational = "Informational" #: Informational + obsolete = "Obsolete" #: Obsolete + + +class RuleType(str, Enum): + + binary = "Binary" #: Binary + baseline_expected = "BaselineExpected" #: BaselineExpected + positive_list = "PositiveList" #: PositiveList + negative_list = "NegativeList" #: NegativeList + + class ExpandEnum(str, Enum): links = "links" #: All links associated with an assessment 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 9a85de922f37..2b153e37e496 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 @@ -59,6 +59,9 @@ from ._devices_for_hub_operations import DevicesForHubOperations from ._device_operations import DeviceOperations from ._on_premise_iot_sensors_operations import OnPremiseIotSensorsOperations +from ._sql_vulnerability_assessment_scans_operations import SqlVulnerabilityAssessmentScansOperations +from ._sql_vulnerability_assessment_scan_results_operations import SqlVulnerabilityAssessmentScanResultsOperations +from ._sql_vulnerability_assessment_baseline_rules_operations import SqlVulnerabilityAssessmentBaselineRulesOperations __all__ = [ 'ComplianceResultsOperations', @@ -111,4 +114,7 @@ 'DevicesForHubOperations', 'DeviceOperations', 'OnPremiseIotSensorsOperations', + 'SqlVulnerabilityAssessmentScansOperations', + 'SqlVulnerabilityAssessmentScanResultsOperations', + 'SqlVulnerabilityAssessmentBaselineRulesOperations', ] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_connectors_operations.py index 3b41670485db..ff353c5f6da7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_connectors_operations.py @@ -166,14 +166,15 @@ def get( def create_or_update( self, connector_name, hybrid_compute_settings=None, authentication_details=None, custom_headers=None, raw=False, **operation_config): """Create a cloud account connector or update an existing one. Connect to - your AWS cloud account using either account credentials or role-based - authentication. + your cloud account. For AWS, use either account credentials or + role-based authentication. For GCP, use account organization + credentials. :param connector_name: Name of the cloud account connector :type connector_name: str :param hybrid_compute_settings: Settings for hybrid compute - management, these settings are relevant only Arc autoProvision (Hybrid - Compute). + management. These settings are relevant only for Arc autoProvision + (Hybrid Compute). :type hybrid_compute_settings: ~azure.mgmt.security.models.HybridComputeSettingsProperties :param authentication_details: Settings for authentication management, diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_baseline_rules_operations.py new file mode 100644 index 000000000000..14747a65e390 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -0,0 +1,383 @@ +# 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 SqlVulnerabilityAssessmentBaselineRulesOperations(object): + """SqlVulnerabilityAssessmentBaselineRulesOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def create_or_update( + self, rule_id, workspace_id, api_version, resource_id, latest_scan=None, results=None, custom_headers=None, raw=False, **operation_config): + """Creates a Baseline for a rule in a database. Will overwrite any + previously existing results. + + :param rule_id: The rule Id. + :type rule_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: list[list[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: RuleResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RuleResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + body = None + if latest_scan is not None or results is not None: + body = models.RuleResultsInput(latest_scan=latest_scan, results=results) + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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 + if body is not None: + body_content = self._serialize.body(body, 'RuleResultsInput') + else: + body_content = None + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RuleResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}'} + + def get( + self, rule_id, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the results for a given rule in the Baseline. + + :param rule_id: The rule Id. + :type rule_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RuleResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RuleResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('RuleResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}'} + + def delete( + self, rule_id, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Deletes a rule from the Baseline of a given database. + + :param rule_id: The rule Id. + :type rule_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}'} + + def list( + self, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the results for all rules in the Baseline. + + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: RulesResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RulesResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('RulesResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules'} + + def add( + self, workspace_id, api_version, resource_id, latest_scan=None, results=None, custom_headers=None, raw=False, **operation_config): + """Add a list of baseline rules. Will overwrite any previously existing + results (for all rules). + + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param latest_scan: Take results from latest scan. + :type latest_scan: bool + :param results: Expected results to be inserted into the baseline. + Leave this field empty it LatestScan == true. + :type results: dict[str, list[list[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: RulesResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.RulesResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + body = None + if latest_scan is not None or results is not None: + body = models.RulesResultsInput(latest_scan=latest_scan, results=results) + + # Construct URL + url = self.add.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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 + if body is not None: + body_content = self._serialize.body(body, 'RulesResultsInput') + else: + body_content = None + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RulesResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules'} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scan_results_operations.py new file mode 100644 index 000000000000..31acb40b53ba --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -0,0 +1,173 @@ +# 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 SqlVulnerabilityAssessmentScanResultsOperations(object): + """SqlVulnerabilityAssessmentScanResultsOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, scan_id, scan_result_id, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the scan results of a single rule in a scan record. + + :param scan_id: The scan Id. Type 'latest' to get the scan results for + the latest scan. + :type scan_id: str + :param scan_result_id: The rule Id of the results. + :type scan_result_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ScanResult or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.ScanResult or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scanId': self._serialize.url("scan_id", scan_id, 'str'), + 'scanResultId': self._serialize.url("scan_result_id", scan_result_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('ScanResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}'} + + def list( + self, scan_id, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets a list of scan results for a single scan record. + + :param scan_id: The scan Id. Type 'latest' to get the scan results for + the latest scan. + :type scan_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ScanResults or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.ScanResults or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'scanId': self._serialize.url("scan_id", scan_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('ScanResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults'} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scans_operations.py new file mode 100644 index 000000000000..0b6e34d106c3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_sql_vulnerability_assessment_scans_operations.py @@ -0,0 +1,166 @@ +# 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 SqlVulnerabilityAssessmentScansOperations(object): + """SqlVulnerabilityAssessmentScansOperations 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. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, scan_id, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets the scan details of a single scan record. + + :param scan_id: The scan Id. Type 'latest' to get the scan record for + the latest scan. + :type scan_id: str + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Scan or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.Scan or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'scanId': self._serialize.url("scan_id", scan_id, 'str'), + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('Scan', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}'} + + def list( + self, workspace_id, api_version, resource_id, custom_headers=None, raw=False, **operation_config): + """Gets a list of scan records. + + :param workspace_id: The workspace Id. + :type workspace_id: str + :param api_version: The api version. + :type api_version: str + :param resource_id: The identifier of the resource. + :type resource_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Scans or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.security.models.Scans or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'resourceId': self._serialize.url("resource_id", resource_id, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['workspaceId'] = self._serialize.query("workspace_id", workspace_id, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", 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('Scans', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans'}