diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index 4fcd76c66d92..0f582267277f 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "a8719243647b7c6d06ed287483d788808de7ecab", + "commit": "70c30c8ff069d6aad8888531fe281e4f7c044591", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/security/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/security/resource-manager/readme.md" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/_metadata.json index 57c07b73f3a8..917ff7f14258 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_metadata.json @@ -1,6 +1,6 @@ { "chosen_version": "", - "total_api_version_list": ["2015-06-01-preview", "2017-08-01", "2017-08-01-preview", "2018-06-01", "2019-01-01", "2019-01-01-preview", "2019-08-01", "2020-01-01", "2020-01-01-preview", "2020-07-01-preview", "2021-01-01", "2021-01-15-preview", "2021-05-01-preview", "2021-07-01"], + "total_api_version_list": ["2015-06-01-preview", "2017-08-01", "2017-08-01-preview", "2018-06-01", "2019-01-01", "2019-01-01-preview", "2019-08-01", "2020-01-01", "2020-01-01-preview", "2020-07-01-preview", "2021-01-01", "2021-01-15-preview", "2021-05-01-preview", "2021-06-01", "2021-07-01", "2021-07-01-preview"], "client": { "name": "SecurityCenter", "filename": "_security_center", @@ -110,6 +110,8 @@ "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { + "custom_assessment_automations": "CustomAssessmentAutomationsOperations", + "custom_entity_store_assignments": "CustomEntityStoreAssignmentsOperations", "compliance_results": "ComplianceResultsOperations", "pricings": "PricingsOperations", "advanced_threat_protection": "AdvancedThreatProtectionOperations", 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 0c411e391bbb..05365667d9ea 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 @@ -19,6 +19,8 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import SecurityCenterConfiguration +from .operations import CustomAssessmentAutomationsOperations +from .operations import CustomEntityStoreAssignmentsOperations from .operations import ComplianceResultsOperations from .operations import PricingsOperations from .operations import AdvancedThreatProtectionOperations @@ -70,6 +72,10 @@ class SecurityCenter(object): """API spec for Microsoft.Security (Azure Security Center) resource provider. + :ivar custom_assessment_automations: CustomAssessmentAutomationsOperations operations + :vartype custom_assessment_automations: azure.mgmt.security.operations.CustomAssessmentAutomationsOperations + :ivar custom_entity_store_assignments: CustomEntityStoreAssignmentsOperations operations + :vartype custom_entity_store_assignments: azure.mgmt.security.operations.CustomEntityStoreAssignmentsOperations :ivar compliance_results: ComplianceResultsOperations operations :vartype compliance_results: azure.mgmt.security.operations.ComplianceResultsOperations :ivar pricings: PricingsOperations operations @@ -189,6 +195,10 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self.custom_assessment_automations = CustomAssessmentAutomationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) self.compliance_results = ComplianceResultsOperations( self._client, self._config, self._serialize, self._deserialize) self.pricings = PricingsOperations( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py index b238b910a8bb..ddb72167ee74 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py @@ -17,6 +17,8 @@ from azure.core.credentials_async import AsyncTokenCredential from ._configuration import SecurityCenterConfiguration +from .operations import CustomAssessmentAutomationsOperations +from .operations import CustomEntityStoreAssignmentsOperations from .operations import ComplianceResultsOperations from .operations import PricingsOperations from .operations import AdvancedThreatProtectionOperations @@ -68,6 +70,10 @@ class SecurityCenter(object): """API spec for Microsoft.Security (Azure Security Center) resource provider. + :ivar custom_assessment_automations: CustomAssessmentAutomationsOperations operations + :vartype custom_assessment_automations: azure.mgmt.security.aio.operations.CustomAssessmentAutomationsOperations + :ivar custom_entity_store_assignments: CustomEntityStoreAssignmentsOperations operations + :vartype custom_entity_store_assignments: azure.mgmt.security.aio.operations.CustomEntityStoreAssignmentsOperations :ivar compliance_results: ComplianceResultsOperations operations :vartype compliance_results: azure.mgmt.security.aio.operations.ComplianceResultsOperations :ivar pricings: PricingsOperations operations @@ -186,6 +192,10 @@ def __init__( self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self.custom_assessment_automations = CustomAssessmentAutomationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) self.compliance_results = ComplianceResultsOperations( self._client, self._config, self._serialize, self._deserialize) self.pricings = PricingsOperations( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/__init__.py index 65df4fa5ef35..ef6b74899ccc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/__init__.py @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._custom_assessment_automations_operations import CustomAssessmentAutomationsOperations +from ._custom_entity_store_assignments_operations import CustomEntityStoreAssignmentsOperations from ._compliance_results_operations import ComplianceResultsOperations from ._pricings_operations import PricingsOperations from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations @@ -53,6 +55,8 @@ from ._software_inventories_operations import SoftwareInventoriesOperations __all__ = [ + 'CustomAssessmentAutomationsOperations', + 'CustomEntityStoreAssignmentsOperations', 'ComplianceResultsOperations', 'PricingsOperations', 'AdvancedThreatProtectionOperations', diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_metadata_operations.py index df9555e68ef3..718a664d6cd4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_metadata_operations.py @@ -44,20 +44,20 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SecurityAssessmentMetadataList"]: + ) -> AsyncIterable["_models.SecurityAssessmentMetadataResponseList"]: """Get metadata information on all assessment types. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityAssessmentMetadataList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataList] + :return: An iterator like instance of either SecurityAssessmentMetadataResponseList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -80,7 +80,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityAssessmentMetadataList', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponseList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,22 +107,22 @@ async def get( self, assessment_metadata_name: str, **kwargs: Any - ) -> "_models.SecurityAssessmentMetadata": + ) -> "_models.SecurityAssessmentMetadataResponse": """Get metadata information on an assessment type. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -148,7 +148,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -159,20 +159,20 @@ async def get( def list_by_subscription( self, **kwargs: Any - ) -> AsyncIterable["_models.SecurityAssessmentMetadataList"]: + ) -> AsyncIterable["_models.SecurityAssessmentMetadataResponseList"]: """Get metadata information on all assessment types in a specific subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityAssessmentMetadataList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataList] + :return: An iterator like instance of either SecurityAssessmentMetadataResponseList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -199,7 +199,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityAssessmentMetadataList', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponseList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -226,22 +226,22 @@ async def get_in_subscription( self, assessment_metadata_name: str, **kwargs: Any - ) -> "_models.SecurityAssessmentMetadata": + ) -> "_models.SecurityAssessmentMetadataResponse": """Get metadata information on an assessment type in a specific subscription. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -268,7 +268,7 @@ async def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -279,26 +279,26 @@ async def get_in_subscription( async def create_in_subscription( self, assessment_metadata_name: str, - assessment_metadata: "_models.SecurityAssessmentMetadata", + assessment_metadata: "_models.SecurityAssessmentMetadataResponse", **kwargs: Any - ) -> "_models.SecurityAssessmentMetadata": + ) -> "_models.SecurityAssessmentMetadataResponse": """Create metadata information on an assessment type in a specific subscription. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :param assessment_metadata: AssessmentMetadata object. - :type assessment_metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :type assessment_metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -320,7 +320,7 @@ async def create_in_subscription( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(assessment_metadata, 'SecurityAssessmentMetadata') + body_content = self._serialize.body(assessment_metadata, 'SecurityAssessmentMetadataResponse') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -330,7 +330,7 @@ async def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -358,7 +358,7 @@ async def delete_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_operations.py index 306648b7d29e..460dce53bce5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_assessments_operations.py @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -118,7 +118,7 @@ async def get( assessment_name: str, expand: Optional[Union[str, "_models.ExpandEnum"]] = None, **kwargs: Any - ) -> "_models.SecurityAssessment": + ) -> "_models.SecurityAssessmentResponse": """Get a security assessment on your scanned resource. :param resource_id: The identifier of the resource. @@ -128,16 +128,16 @@ async def get( :param expand: OData expand. Optional. :type expand: str or ~azure.mgmt.security.models.ExpandEnum :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessment, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessment + :return: SecurityAssessmentResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -166,7 +166,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -180,7 +180,7 @@ async def create_or_update( assessment_name: str, assessment: "_models.SecurityAssessment", **kwargs: Any - ) -> "_models.SecurityAssessment": + ) -> "_models.SecurityAssessmentResponse": """Create a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same name before inserting the assessment result. @@ -191,16 +191,16 @@ async def create_or_update( :param assessment: Calculated assessment on a pre-defined assessment metadata. :type assessment: ~azure.mgmt.security.models.SecurityAssessment :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessment, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessment + :return: SecurityAssessmentResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -233,10 +233,10 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -267,7 +267,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_assessment_automations_operations.py new file mode 100644 index 000000000000..ac42e495f64e --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_assessment_automations_operations.py @@ -0,0 +1,377 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomAssessmentAutomationsOperations: + """CustomAssessmentAutomationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.security.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + custom_assessment_automation_name: str, + **kwargs: Any + ) -> "_models.CustomAssessmentAutomation": + """Gets a custom assessment automation. + + Gets a single custom assessment automation by name for the provided subscription and resource + group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomAssessmentAutomation, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomAssessmentAutomation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + custom_assessment_automation_name: str, + custom_assessment_automation_body: "_models.CustomAssessmentAutomation", + **kwargs: Any + ) -> "_models.CustomAssessmentAutomation": + """Creates a custom assessment automation. + + Creates or updates a custom assessment automation for the provided subscription. Please note + that providing an existing custom assessment automation will replace the existing record. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :param custom_assessment_automation_body: Custom Assessment Automation body. + :type custom_assessment_automation_body: ~azure.mgmt.security.models.CustomAssessmentAutomation + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomAssessmentAutomation, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomAssessmentAutomation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(custom_assessment_automation_body, 'CustomAssessmentAutomation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + custom_assessment_automation_name: str, + **kwargs: Any + ) -> None: + """Deletes a custom assessment automation. + + Deletes a custom assessment automation by name for a provided subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomAssessmentAutomationsListResult"]: + """List custom assessment automations in a subscription and a resource group. + + List custom assessment automations by provided subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomAssessmentAutomationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.CustomAssessmentAutomationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomAssessmentAutomationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.CustomAssessmentAutomationsListResult"]: + """List custom assessment automations in a subscription. + + List custom assessment automations by provided subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomAssessmentAutomationsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.CustomAssessmentAutomationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomAssessmentAutomationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations'} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_entity_store_assignments_operations.py new file mode 100644 index 000000000000..9acb28ad4558 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_custom_entity_store_assignments_operations.py @@ -0,0 +1,379 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomEntityStoreAssignmentsOperations: + """CustomEntityStoreAssignmentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.security.models + :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) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + custom_entity_store_assignment_name: str, + **kwargs: Any + ) -> "_models.CustomEntityStoreAssignment": + """Gets a custom entity store assignment. + + Gets a single custom entity store assignment by name for the provided subscription and resource + group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomEntityStoreAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomEntityStoreAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + custom_entity_store_assignment_name: str, + custom_entity_store_assignment_request_body: "_models.CustomEntityStoreAssignmentRequest", + **kwargs: Any + ) -> "_models.CustomEntityStoreAssignment": + """Creates a custom entity store assignment. + + Creates a custom entity store assignment for the provided subscription, if not already exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :param custom_entity_store_assignment_request_body: Custom entity store assignment body. + :type custom_entity_store_assignment_request_body: ~azure.mgmt.security.models.CustomEntityStoreAssignmentRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomEntityStoreAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomEntityStoreAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(custom_entity_store_assignment_request_body, 'CustomEntityStoreAssignmentRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + custom_entity_store_assignment_name: str, + **kwargs: Any + ) -> None: + """Deleted a custom entity store assignment. + + Delete a custom entity store assignment by name for a provided subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomEntityStoreAssignmentsListResult"]: + """List custom entity store assignments in a subscription and a resource group. + + List custom entity store assignments by a provided subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomEntityStoreAssignmentsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.CustomEntityStoreAssignmentsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignmentsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomEntityStoreAssignmentsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.CustomEntityStoreAssignmentsListResult"]: + """List custom entity store assignments in a subscription. + + List custom entity store assignments by provided subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomEntityStoreAssignmentsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.models.CustomEntityStoreAssignmentsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignmentsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomEntityStoreAssignmentsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments'} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_information_protection_policies_operations.py index 821084dba221..4d6ebdd00891 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_information_protection_policies_operations.py @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get( self, scope: str, - information_protection_policy_name: Union[str, "_models.Enum15"], + information_protection_policy_name: Union[str, "_models.Enum19"], **kwargs: Any ) -> "_models.InformationProtectionPolicy": """Details of the information protection policy. @@ -54,7 +54,7 @@ async def get( (/providers/Microsoft.Management/managementGroups/mgName). :type scope: str :param information_protection_policy_name: Name of the information protection policy. - :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum15 + :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum19 :keyword callable cls: A custom type or function that will be passed the direct response :return: InformationProtectionPolicy, or the result of cls(response) :rtype: ~azure.mgmt.security.models.InformationProtectionPolicy @@ -103,7 +103,7 @@ async def get( async def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.Enum15"], + information_protection_policy_name: Union[str, "_models.Enum19"], information_protection_policy: "_models.InformationProtectionPolicy", **kwargs: Any ) -> "_models.InformationProtectionPolicy": @@ -114,7 +114,7 @@ async def create_or_update( (/providers/Microsoft.Management/managementGroups/mgName). :type scope: str :param information_protection_policy_name: Name of the information protection policy. - :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum15 + :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum19 :param information_protection_policy: Information protection policy. :type information_protection_policy: ~azure.mgmt.security.models.InformationProtectionPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_settings_operations.py index bd641d4d7e72..276b64e641e9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_settings_operations.py @@ -109,13 +109,13 @@ async def get_next(next_link=None): async def get( self, - setting_name: Union[str, "_models.Enum69"], + setting_name: Union[str, "_models.Enum75"], **kwargs: Any ) -> "_models.Setting": """Settings of different configurations in security center. :param setting_name: The name of the setting. - :type setting_name: str or ~azure.mgmt.security.models.Enum69 + :type setting_name: str or ~azure.mgmt.security.models.Enum75 :keyword callable cls: A custom type or function that will be passed the direct response :return: Setting, or the result of cls(response) :rtype: ~azure.mgmt.security.models.Setting @@ -163,14 +163,14 @@ async def get( async def update( self, - setting_name: Union[str, "_models.Enum69"], + setting_name: Union[str, "_models.Enum75"], setting: "_models.Setting", **kwargs: Any ) -> "_models.Setting": """updating settings about different configurations in security center. :param setting_name: The name of the setting. - :type setting_name: str or ~azure.mgmt.security.models.Enum69 + :type setting_name: str or ~azure.mgmt.security.models.Enum75 :param setting: Setting object. :type setting: ~azure.mgmt.security.models.Setting :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_tasks_operations.py index db7bbd5d59af..ec424a645486 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/operations/_tasks_operations.py @@ -242,7 +242,7 @@ async def get_subscription_level_task( async def update_subscription_level_task_state( self, task_name: str, - task_update_action_type: Union[str, "_models.Enum13"], + task_update_action_type: Union[str, "_models.Enum17"], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -250,7 +250,7 @@ async def update_subscription_level_task_state( :param task_name: Name of the task object, will be a GUID. :type task_name: str :param task_update_action_type: Type of the action to do on the task. - :type task_update_action_type: str or ~azure.mgmt.security.models.Enum13 + :type task_update_action_type: str or ~azure.mgmt.security.models.Enum17 :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -436,7 +436,7 @@ async def update_resource_group_level_task_state( self, resource_group_name: str, task_name: str, - task_update_action_type: Union[str, "_models.Enum13"], + task_update_action_type: Union[str, "_models.Enum17"], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -447,7 +447,7 @@ async def update_resource_group_level_task_state( :param task_name: Name of the task object, will be a GUID. :type task_name: str :param task_update_action_type: Type of the action to do on the task. - :type task_update_action_type: str or ~azure.mgmt.security.models.Enum13 + :type task_update_action_type: str or ~azure.mgmt.security.models.Enum17 :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None 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 f841b789d1e3..e30acc57d2c8 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 @@ -39,6 +39,7 @@ from ._models_py3 import AscLocationList from ._models_py3 import AssessmentLinks from ._models_py3 import AssessmentStatus + from ._models_py3 import AssessmentStatusResponse from ._models_py3 import AtaExternalSecuritySolution from ._models_py3 import AtaSolutionProperties from ._models_py3 import AuthenticationDetailsProperties @@ -84,6 +85,11 @@ from ._models_py3 import ConnectorSettingList from ._models_py3 import ContainerRegistryVulnerabilityProperties from ._models_py3 import CustomAlertRule + from ._models_py3 import CustomAssessmentAutomation + from ._models_py3 import CustomAssessmentAutomationsListResult + from ._models_py3 import CustomEntityStoreAssignment + from ._models_py3 import CustomEntityStoreAssignmentRequest + from ._models_py3 import CustomEntityStoreAssignmentsListResult from ._models_py3 import DataExportSettings from ._models_py3 import DenylistCustomAlertRule from ._models_py3 import DeviceSecurityGroup @@ -194,10 +200,17 @@ from ._models_py3 import SecurityAssessment from ._models_py3 import SecurityAssessmentList from ._models_py3 import SecurityAssessmentMetadata - from ._models_py3 import SecurityAssessmentMetadataList from ._models_py3 import SecurityAssessmentMetadataPartnerData from ._models_py3 import SecurityAssessmentMetadataProperties + from ._models_py3 import SecurityAssessmentMetadataPropertiesResponse + from ._models_py3 import SecurityAssessmentMetadataPropertiesResponsePublishDates + from ._models_py3 import SecurityAssessmentMetadataResponse + from ._models_py3 import SecurityAssessmentMetadataResponseList from ._models_py3 import SecurityAssessmentPartnerData + from ._models_py3 import SecurityAssessmentProperties + from ._models_py3 import SecurityAssessmentPropertiesBase + from ._models_py3 import SecurityAssessmentPropertiesResponse + from ._models_py3 import SecurityAssessmentResponse from ._models_py3 import SecurityContact from ._models_py3 import SecurityContactList from ._models_py3 import SecuritySolution @@ -275,6 +288,7 @@ from ._models import AscLocationList # type: ignore from ._models import AssessmentLinks # type: ignore from ._models import AssessmentStatus # type: ignore + from ._models import AssessmentStatusResponse # type: ignore from ._models import AtaExternalSecuritySolution # type: ignore from ._models import AtaSolutionProperties # type: ignore from ._models import AuthenticationDetailsProperties # type: ignore @@ -320,6 +334,11 @@ from ._models import ConnectorSettingList # type: ignore from ._models import ContainerRegistryVulnerabilityProperties # type: ignore from ._models import CustomAlertRule # type: ignore + from ._models import CustomAssessmentAutomation # type: ignore + from ._models import CustomAssessmentAutomationsListResult # type: ignore + from ._models import CustomEntityStoreAssignment # type: ignore + from ._models import CustomEntityStoreAssignmentRequest # type: ignore + from ._models import CustomEntityStoreAssignmentsListResult # type: ignore from ._models import DataExportSettings # type: ignore from ._models import DenylistCustomAlertRule # type: ignore from ._models import DeviceSecurityGroup # type: ignore @@ -430,10 +449,17 @@ from ._models import SecurityAssessment # type: ignore from ._models import SecurityAssessmentList # type: ignore from ._models import SecurityAssessmentMetadata # type: ignore - from ._models import SecurityAssessmentMetadataList # type: ignore from ._models import SecurityAssessmentMetadataPartnerData # type: ignore from ._models import SecurityAssessmentMetadataProperties # type: ignore + from ._models import SecurityAssessmentMetadataPropertiesResponse # type: ignore + from ._models import SecurityAssessmentMetadataPropertiesResponsePublishDates # type: ignore + from ._models import SecurityAssessmentMetadataResponse # type: ignore + from ._models import SecurityAssessmentMetadataResponseList # type: ignore from ._models import SecurityAssessmentPartnerData # type: ignore + from ._models import SecurityAssessmentProperties # type: ignore + from ._models import SecurityAssessmentPropertiesBase # type: ignore + from ._models import SecurityAssessmentPropertiesResponse # type: ignore + from ._models import SecurityAssessmentResponse # type: ignore from ._models import SecurityContact # type: ignore from ._models import SecurityContactList # type: ignore from ._models import SecuritySolution # type: ignore @@ -506,9 +532,9 @@ EndOfSupportStatus, EnforcementMode, EnforcementSupport, - Enum13, - Enum15, - Enum69, + Enum17, + Enum19, + Enum75, EventSource, ExpandControlsEnum, ExpandEnum, @@ -517,6 +543,7 @@ FileType, HybridComputeProvisioningState, ImplementationEffort, + ImplementationEffortEnum, Intent, KindEnum, Operator, @@ -544,16 +571,21 @@ ServerVulnerabilityAssessmentPropertiesProvisioningState, SettingKind, Severity, + SeverityEnum, Source, SourceSystem, State, Status, StatusReason, SubAssessmentStatusCode, + SupportedCloudEnum, + Tactics, + Techniques, Threats, TransportProtocol, UnmaskedIpLoggingStatus, UserImpact, + UserImpactEnum, ValueType, ) @@ -590,6 +622,7 @@ 'AscLocationList', 'AssessmentLinks', 'AssessmentStatus', + 'AssessmentStatusResponse', 'AtaExternalSecuritySolution', 'AtaSolutionProperties', 'AuthenticationDetailsProperties', @@ -635,6 +668,11 @@ 'ConnectorSettingList', 'ContainerRegistryVulnerabilityProperties', 'CustomAlertRule', + 'CustomAssessmentAutomation', + 'CustomAssessmentAutomationsListResult', + 'CustomEntityStoreAssignment', + 'CustomEntityStoreAssignmentRequest', + 'CustomEntityStoreAssignmentsListResult', 'DataExportSettings', 'DenylistCustomAlertRule', 'DeviceSecurityGroup', @@ -745,10 +783,17 @@ 'SecurityAssessment', 'SecurityAssessmentList', 'SecurityAssessmentMetadata', - 'SecurityAssessmentMetadataList', 'SecurityAssessmentMetadataPartnerData', 'SecurityAssessmentMetadataProperties', + 'SecurityAssessmentMetadataPropertiesResponse', + 'SecurityAssessmentMetadataPropertiesResponsePublishDates', + 'SecurityAssessmentMetadataResponse', + 'SecurityAssessmentMetadataResponseList', 'SecurityAssessmentPartnerData', + 'SecurityAssessmentProperties', + 'SecurityAssessmentPropertiesBase', + 'SecurityAssessmentPropertiesResponse', + 'SecurityAssessmentResponse', 'SecurityContact', 'SecurityContactList', 'SecuritySolution', @@ -819,9 +864,9 @@ 'EndOfSupportStatus', 'EnforcementMode', 'EnforcementSupport', - 'Enum13', - 'Enum15', - 'Enum69', + 'Enum17', + 'Enum19', + 'Enum75', 'EventSource', 'ExpandControlsEnum', 'ExpandEnum', @@ -830,6 +875,7 @@ 'FileType', 'HybridComputeProvisioningState', 'ImplementationEffort', + 'ImplementationEffortEnum', 'Intent', 'KindEnum', 'Operator', @@ -857,15 +903,20 @@ 'ServerVulnerabilityAssessmentPropertiesProvisioningState', 'SettingKind', 'Severity', + 'SeverityEnum', 'Source', 'SourceSystem', 'State', 'Status', 'StatusReason', 'SubAssessmentStatusCode', + 'SupportedCloudEnum', + 'Tactics', + 'Techniques', 'Threats', 'TransportProtocol', 'UnmaskedIpLoggingStatus', 'UserImpact', + 'UserImpactEnum', 'ValueType', ] 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 13b2d159b9d3..89ae031c9a06 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 @@ -1784,6 +1784,51 @@ def __init__( self.description = kwargs.get('description', None) +class AssessmentStatusResponse(AssessmentStatus): + """The result of the assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Programmatic code for the status of the assessment. Possible values + include: "Healthy", "Unhealthy", "NotApplicable". + :type code: str or ~azure.mgmt.security.models.AssessmentStatusCode + :param cause: Programmatic code for the cause of the assessment status. + :type cause: str + :param description: Human readable description of the assessment status. + :type description: str + :ivar first_evaluation_date: The time that the assessment was created and first evaluated. + Returned as UTC time in ISO 8601 format. + :vartype first_evaluation_date: ~datetime.datetime + :ivar status_change_date: The time that the status of the assessment last changed. Returned as + UTC time in ISO 8601 format. + :vartype status_change_date: ~datetime.datetime + """ + + _validation = { + 'code': {'required': True}, + 'first_evaluation_date': {'readonly': True}, + 'status_change_date': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'cause': {'key': 'cause', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'first_evaluation_date': {'key': 'firstEvaluationDate', 'type': 'iso-8601'}, + 'status_change_date': {'key': 'statusChangeDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(AssessmentStatusResponse, self).__init__(**kwargs) + self.first_evaluation_date = None + self.status_change_date = None + + class AtaExternalSecuritySolution(ExternalSecuritySolution): """Represents an ATA security solution which sends logs to an OMS workspace. @@ -3508,6 +3553,192 @@ def __init__( self.image_digest = None +class CustomAssessmentAutomation(Resource): + """Custom Assessment Automation. + + 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 compressed_query: GZip encoded KQL query representing the assessment automation results + required. + :type compressed_query: str + :param supported_cloud: Relevant cloud for the custom assessment automation. Possible values + include: "AWS". + :type supported_cloud: str or ~azure.mgmt.security.models.SupportedCloudEnum + :param severity: The severity to relate to the assessments generated by this assessment + automation. Possible values include: "High", "Medium", "Low". + :type severity: str or ~azure.mgmt.security.models.SeverityEnum + :param user_impact: The user impact to relate to the assessments generated by this assessment + automation. Possible values include: "High", "Moderate", "Low". + :type user_impact: str or ~azure.mgmt.security.models.UserImpactEnum + :param implementation_effort: The implementation effort to relate to the assessments generated + by this assessment automation. Possible values include: "High", "Moderate", "Low". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffortEnum + :param description: The description to relate to the assessments generated by this assessment + automation. + :type description: str + :param remediation_description: The remediation description to relate to the assessments + generated by this assessment automation. + :type remediation_description: str + """ + + _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'}, + 'compressed_query': {'key': 'properties.compressedQuery', 'type': 'str'}, + 'supported_cloud': {'key': 'properties.supportedCloud', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'user_impact': {'key': 'properties.userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'properties.implementationEffort', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'remediation_description': {'key': 'properties.remediationDescription', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomAssessmentAutomation, self).__init__(**kwargs) + self.compressed_query = kwargs.get('compressed_query', None) + self.supported_cloud = kwargs.get('supported_cloud', "AWS") + self.severity = kwargs.get('severity', "Low") + self.user_impact = kwargs.get('user_impact', "Low") + self.implementation_effort = kwargs.get('implementation_effort', "Low") + self.description = kwargs.get('description', None) + self.remediation_description = kwargs.get('remediation_description', None) + + +class CustomAssessmentAutomationsListResult(msrest.serialization.Model): + """A list of Custom Assessment Automations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of Custom Assessment Automations. + :vartype value: list[~azure.mgmt.security.models.CustomAssessmentAutomation] + :param next_link: The link used to get the next page of operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomAssessmentAutomation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomAssessmentAutomationsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + +class CustomEntityStoreAssignment(Resource): + """Custom entity store assignment. + + 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 principal: The principal assigned with entity store. Format of principal is: [AAD + type]=[PrincipalObjectId];[TenantId]. + :type principal: str + :param entity_store_database_link: The link to entity store database. + :type entity_store_database_link: str + """ + + _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'}, + 'principal': {'key': 'properties.principal', 'type': 'str'}, + 'entity_store_database_link': {'key': 'properties.entityStoreDatabaseLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomEntityStoreAssignment, self).__init__(**kwargs) + self.principal = kwargs.get('principal', None) + self.entity_store_database_link = kwargs.get('entity_store_database_link', None) + + +class CustomEntityStoreAssignmentRequest(msrest.serialization.Model): + """describes the custom entity store assignment request. + + :param principal: The principal assigned with entity store. If not provided, will use caller + principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + :type principal: str + """ + + _attribute_map = { + 'principal': {'key': 'properties.principal', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomEntityStoreAssignmentRequest, self).__init__(**kwargs) + self.principal = kwargs.get('principal', None) + + +class CustomEntityStoreAssignmentsListResult(msrest.serialization.Model): + """A list of custom entity store assignments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of custom entity store assignments. + :vartype value: list[~azure.mgmt.security.models.CustomEntityStoreAssignment] + :param next_link: The link used to get the next page of operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomEntityStoreAssignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomEntityStoreAssignmentsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + class CVE(msrest.serialization.Model): """CVE details. @@ -7725,8 +7956,6 @@ class SecurityAssessment(Resource): :type resource_details: ~azure.mgmt.security.models.ResourceDetails :ivar display_name: User friendly display name of the assessment. :vartype display_name: str - :param status: The result of the assessment. - :type status: ~azure.mgmt.security.models.AssessmentStatus :param additional_data: Additional data regarding the assessment. :type additional_data: dict[str, str] :ivar links: Links relevant to the assessment. @@ -7735,6 +7964,8 @@ class SecurityAssessment(Resource): :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties :param partners_data: Data regarding 3rd party partner integration. :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatus """ _validation = { @@ -7751,11 +7982,11 @@ class SecurityAssessment(Resource): 'type': {'key': 'type', 'type': 'str'}, 'resource_details': {'key': 'properties.resourceDetails', 'type': 'ResourceDetails'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'AssessmentStatus'}, 'additional_data': {'key': 'properties.additionalData', 'type': '{str}'}, 'links': {'key': 'properties.links', 'type': 'AssessmentLinks'}, 'metadata': {'key': 'properties.metadata', 'type': 'SecurityAssessmentMetadataProperties'}, 'partners_data': {'key': 'properties.partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'properties.status', 'type': 'AssessmentStatus'}, } def __init__( @@ -7765,11 +7996,11 @@ def __init__( super(SecurityAssessment, self).__init__(**kwargs) self.resource_details = kwargs.get('resource_details', None) self.display_name = None - self.status = kwargs.get('status', None) self.additional_data = kwargs.get('additional_data', None) self.links = None self.metadata = kwargs.get('metadata', None) self.partners_data = kwargs.get('partners_data', None) + self.status = kwargs.get('status', None) class SecurityAssessmentList(msrest.serialization.Model): @@ -7778,7 +8009,7 @@ class SecurityAssessmentList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Collection of security assessments in this page. - :vartype value: list[~azure.mgmt.security.models.SecurityAssessment] + :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentResponse] :ivar next_link: The URI to fetch the next page. :vartype next_link: str """ @@ -7789,7 +8020,7 @@ class SecurityAssessmentList(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityAssessment]'}, + 'value': {'key': 'value', 'type': '[SecurityAssessmentResponse]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -7890,36 +8121,6 @@ def __init__( self.partner_data = kwargs.get('partner_data', None) -class SecurityAssessmentMetadataList(msrest.serialization.Model): - """List of security assessment metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentMetadata] - :ivar next_link: The URI to fetch the next page. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityAssessmentMetadata]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityAssessmentMetadataList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class SecurityAssessmentMetadataPartnerData(msrest.serialization.Model): """Describes the partner that created the assessment. @@ -8036,34 +8237,494 @@ def __init__( self.partner_data = kwargs.get('partner_data', None) -class SecurityAssessmentPartnerData(msrest.serialization.Model): - """Data regarding 3rd party partner integration. +class SecurityAssessmentMetadataPropertiesResponse(SecurityAssessmentMetadataProperties): + """Describes properties of an assessment metadata response. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param partner_name: Required. Name of the company of the partner. - :type partner_name: str - :param secret: Required. secret to authenticate the partner - write only. - :type secret: str + :param display_name: Required. User friendly display name of the assessment. + :type display_name: str + :ivar policy_definition_id: Azure resource ID of the policy definition that turns this + assessment calculation on. + :vartype policy_definition_id: str + :param description: Human readable description of the assessment. + :type description: str + :param remediation_description: Human readable description of what you should do to mitigate + this security issue. + :type remediation_description: str + :param categories: + :type categories: list[str or ~azure.mgmt.security.models.Categories] + :param severity: Required. The severity level of the assessment. Possible values include: + "Low", "Medium", "High". + :type severity: str or ~azure.mgmt.security.models.Severity + :param user_impact: The user impact of the assessment. Possible values include: "Low", + "Moderate", "High". + :type user_impact: str or ~azure.mgmt.security.models.UserImpact + :param implementation_effort: The implementation effort required to remediate this assessment. + Possible values include: "Low", "Moderate", "High". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffort + :param threats: + :type threats: list[str or ~azure.mgmt.security.models.Threats] + :param preview: True if this assessment is in preview release status. + :type preview: bool + :param assessment_type: Required. BuiltIn if the assessment based on built-in Azure Policy + definition, Custom if the assessment based on custom Azure Policy definition. Possible values + include: "BuiltIn", "CustomPolicy", "CustomerManaged", "VerifiedPartner". + :type assessment_type: str or ~azure.mgmt.security.models.AssessmentType + :param partner_data: Describes the partner that created the assessment. + :type partner_data: ~azure.mgmt.security.models.SecurityAssessmentMetadataPartnerData + :param publish_dates: + :type publish_dates: + ~azure.mgmt.security.models.SecurityAssessmentMetadataPropertiesResponsePublishDates + :param planned_deprecation_date: + :type planned_deprecation_date: str + :param tactics: + :type tactics: list[str or ~azure.mgmt.security.models.Tactics] + :param techniques: + :type techniques: list[str or ~azure.mgmt.security.models.Techniques] """ _validation = { - 'partner_name': {'required': True}, - 'secret': {'required': True}, + 'display_name': {'required': True}, + 'policy_definition_id': {'readonly': True}, + 'severity': {'required': True}, + 'assessment_type': {'required': True}, + 'planned_deprecation_date': {'pattern': r'^[0-9]{2}/[0-9]{4}$'}, } _attribute_map = { - 'partner_name': {'key': 'partnerName', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'remediation_description': {'key': 'remediationDescription', 'type': 'str'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'user_impact': {'key': 'userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'implementationEffort', 'type': 'str'}, + 'threats': {'key': 'threats', 'type': '[str]'}, + 'preview': {'key': 'preview', 'type': 'bool'}, + 'assessment_type': {'key': 'assessmentType', 'type': 'str'}, + 'partner_data': {'key': 'partnerData', 'type': 'SecurityAssessmentMetadataPartnerData'}, + 'publish_dates': {'key': 'publishDates', 'type': 'SecurityAssessmentMetadataPropertiesResponsePublishDates'}, + 'planned_deprecation_date': {'key': 'plannedDeprecationDate', 'type': 'str'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + 'techniques': {'key': 'techniques', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(SecurityAssessmentPartnerData, self).__init__(**kwargs) - self.partner_name = kwargs['partner_name'] - self.secret = kwargs['secret'] + super(SecurityAssessmentMetadataPropertiesResponse, self).__init__(**kwargs) + self.publish_dates = kwargs.get('publish_dates', None) + self.planned_deprecation_date = kwargs.get('planned_deprecation_date', None) + self.tactics = kwargs.get('tactics', None) + self.techniques = kwargs.get('techniques', None) + + +class SecurityAssessmentMetadataPropertiesResponsePublishDates(msrest.serialization.Model): + """SecurityAssessmentMetadataPropertiesResponsePublishDates. + + All required parameters must be populated in order to send to Azure. + + :param ga: + :type ga: str + :param public: Required. + :type public: str + """ + + _validation = { + 'ga': {'pattern': r'^([0-9]{2}/){2}[0-9]{4}$'}, + 'public': {'required': True, 'pattern': r'^([0-9]{2}/){2}[0-9]{4}$'}, + } + + _attribute_map = { + 'ga': {'key': 'GA', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentMetadataPropertiesResponsePublishDates, self).__init__(**kwargs) + self.ga = kwargs.get('ga', None) + self.public = kwargs['public'] + + +class SecurityAssessmentMetadataResponse(Resource): + """Security assessment metadata response. + + 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 display_name: User friendly display name of the assessment. + :type display_name: str + :ivar policy_definition_id: Azure resource ID of the policy definition that turns this + assessment calculation on. + :vartype policy_definition_id: str + :param description: Human readable description of the assessment. + :type description: str + :param remediation_description: Human readable description of what you should do to mitigate + this security issue. + :type remediation_description: str + :param categories: + :type categories: list[str or ~azure.mgmt.security.models.Categories] + :param severity: The severity level of the assessment. Possible values include: "Low", + "Medium", "High". + :type severity: str or ~azure.mgmt.security.models.Severity + :param user_impact: The user impact of the assessment. Possible values include: "Low", + "Moderate", "High". + :type user_impact: str or ~azure.mgmt.security.models.UserImpact + :param implementation_effort: The implementation effort required to remediate this assessment. + Possible values include: "Low", "Moderate", "High". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffort + :param threats: + :type threats: list[str or ~azure.mgmt.security.models.Threats] + :param preview: True if this assessment is in preview release status. + :type preview: bool + :param assessment_type: BuiltIn if the assessment based on built-in Azure Policy definition, + Custom if the assessment based on custom Azure Policy definition. Possible values include: + "BuiltIn", "CustomPolicy", "CustomerManaged", "VerifiedPartner". + :type assessment_type: str or ~azure.mgmt.security.models.AssessmentType + :param partner_data: Describes the partner that created the assessment. + :type partner_data: ~azure.mgmt.security.models.SecurityAssessmentMetadataPartnerData + :param publish_dates: + :type publish_dates: + ~azure.mgmt.security.models.SecurityAssessmentMetadataPropertiesResponsePublishDates + :param planned_deprecation_date: + :type planned_deprecation_date: str + :param tactics: + :type tactics: list[str or ~azure.mgmt.security.models.Tactics] + :param techniques: + :type techniques: list[str or ~azure.mgmt.security.models.Techniques] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_definition_id': {'readonly': True}, + 'planned_deprecation_date': {'pattern': r'^[0-9]{2}/[0-9]{4}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'remediation_description': {'key': 'properties.remediationDescription', 'type': 'str'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'user_impact': {'key': 'properties.userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'properties.implementationEffort', 'type': 'str'}, + 'threats': {'key': 'properties.threats', 'type': '[str]'}, + 'preview': {'key': 'properties.preview', 'type': 'bool'}, + 'assessment_type': {'key': 'properties.assessmentType', 'type': 'str'}, + 'partner_data': {'key': 'properties.partnerData', 'type': 'SecurityAssessmentMetadataPartnerData'}, + 'publish_dates': {'key': 'properties.publishDates', 'type': 'SecurityAssessmentMetadataPropertiesResponsePublishDates'}, + 'planned_deprecation_date': {'key': 'properties.plannedDeprecationDate', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + 'techniques': {'key': 'properties.techniques', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentMetadataResponse, self).__init__(**kwargs) + self.display_name = kwargs.get('display_name', None) + self.policy_definition_id = None + self.description = kwargs.get('description', None) + self.remediation_description = kwargs.get('remediation_description', None) + self.categories = kwargs.get('categories', None) + self.severity = kwargs.get('severity', None) + self.user_impact = kwargs.get('user_impact', None) + self.implementation_effort = kwargs.get('implementation_effort', None) + self.threats = kwargs.get('threats', None) + self.preview = kwargs.get('preview', None) + self.assessment_type = kwargs.get('assessment_type', None) + self.partner_data = kwargs.get('partner_data', None) + self.publish_dates = kwargs.get('publish_dates', None) + self.planned_deprecation_date = kwargs.get('planned_deprecation_date', None) + self.tactics = kwargs.get('tactics', None) + self.techniques = kwargs.get('techniques', None) + + +class SecurityAssessmentMetadataResponseList(msrest.serialization.Model): + """List of security assessment metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: + :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentMetadataResponse] + :ivar next_link: The URI to fetch the next page. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityAssessmentMetadataResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentMetadataResponseList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SecurityAssessmentPartnerData(msrest.serialization.Model): + """Data regarding 3rd party partner integration. + + All required parameters must be populated in order to send to Azure. + + :param partner_name: Required. Name of the company of the partner. + :type partner_name: str + :param secret: Required. secret to authenticate the partner - write only. + :type secret: str + """ + + _validation = { + 'partner_name': {'required': True}, + 'secret': {'required': True}, + } + + _attribute_map = { + 'partner_name': {'key': 'partnerName', 'type': 'str'}, + 'secret': {'key': 'secret', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentPartnerData, self).__init__(**kwargs) + self.partner_name = kwargs['partner_name'] + self.secret = kwargs['secret'] + + +class SecurityAssessmentPropertiesBase(msrest.serialization.Model): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentPropertiesBase, self).__init__(**kwargs) + self.resource_details = kwargs['resource_details'] + self.display_name = None + self.additional_data = kwargs.get('additional_data', None) + self.links = None + self.metadata = kwargs.get('metadata', None) + self.partners_data = kwargs.get('partners_data', None) + + +class SecurityAssessmentProperties(SecurityAssessmentPropertiesBase): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: Required. The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatus + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'status', 'type': 'AssessmentStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentProperties, self).__init__(**kwargs) + self.status = kwargs['status'] + + +class SecurityAssessmentPropertiesResponse(SecurityAssessmentPropertiesBase): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: Required. The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatusResponse + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'status', 'type': 'AssessmentStatusResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentPropertiesResponse, self).__init__(**kwargs) + self.status = kwargs['status'] + + +class SecurityAssessmentResponse(Resource): + """Security assessment on a resource - response format. + + 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 resource_details: Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatusResponse + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'resource_details': {'key': 'properties.resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': '{str}'}, + 'links': {'key': 'properties.links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'properties.metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'properties.partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'properties.status', 'type': 'AssessmentStatusResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentResponse, self).__init__(**kwargs) + self.resource_details = kwargs.get('resource_details', None) + self.display_name = None + self.additional_data = kwargs.get('additional_data', None) + self.links = None + self.metadata = kwargs.get('metadata', None) + self.partners_data = kwargs.get('partners_data', None) + self.status = kwargs.get('status', None) class SecurityContact(Resource): 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 cc336c5b2ea0..af2b9d26e486 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 @@ -1901,6 +1901,55 @@ def __init__( self.description = description +class AssessmentStatusResponse(AssessmentStatus): + """The result of the assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. Programmatic code for the status of the assessment. Possible values + include: "Healthy", "Unhealthy", "NotApplicable". + :type code: str or ~azure.mgmt.security.models.AssessmentStatusCode + :param cause: Programmatic code for the cause of the assessment status. + :type cause: str + :param description: Human readable description of the assessment status. + :type description: str + :ivar first_evaluation_date: The time that the assessment was created and first evaluated. + Returned as UTC time in ISO 8601 format. + :vartype first_evaluation_date: ~datetime.datetime + :ivar status_change_date: The time that the status of the assessment last changed. Returned as + UTC time in ISO 8601 format. + :vartype status_change_date: ~datetime.datetime + """ + + _validation = { + 'code': {'required': True}, + 'first_evaluation_date': {'readonly': True}, + 'status_change_date': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'cause': {'key': 'cause', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'first_evaluation_date': {'key': 'firstEvaluationDate', 'type': 'iso-8601'}, + 'status_change_date': {'key': 'statusChangeDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + code: Union[str, "AssessmentStatusCode"], + cause: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(AssessmentStatusResponse, self).__init__(code=code, cause=cause, description=description, **kwargs) + self.first_evaluation_date = None + self.status_change_date = None + + class AtaExternalSecuritySolution(ExternalSecuritySolution): """Represents an ATA security solution which sends logs to an OMS workspace. @@ -3734,6 +3783,209 @@ def __init__( self.image_digest = None +class CustomAssessmentAutomation(Resource): + """Custom Assessment Automation. + + 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 compressed_query: GZip encoded KQL query representing the assessment automation results + required. + :type compressed_query: str + :param supported_cloud: Relevant cloud for the custom assessment automation. Possible values + include: "AWS". + :type supported_cloud: str or ~azure.mgmt.security.models.SupportedCloudEnum + :param severity: The severity to relate to the assessments generated by this assessment + automation. Possible values include: "High", "Medium", "Low". + :type severity: str or ~azure.mgmt.security.models.SeverityEnum + :param user_impact: The user impact to relate to the assessments generated by this assessment + automation. Possible values include: "High", "Moderate", "Low". + :type user_impact: str or ~azure.mgmt.security.models.UserImpactEnum + :param implementation_effort: The implementation effort to relate to the assessments generated + by this assessment automation. Possible values include: "High", "Moderate", "Low". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffortEnum + :param description: The description to relate to the assessments generated by this assessment + automation. + :type description: str + :param remediation_description: The remediation description to relate to the assessments + generated by this assessment automation. + :type remediation_description: str + """ + + _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'}, + 'compressed_query': {'key': 'properties.compressedQuery', 'type': 'str'}, + 'supported_cloud': {'key': 'properties.supportedCloud', 'type': 'str'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'user_impact': {'key': 'properties.userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'properties.implementationEffort', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'remediation_description': {'key': 'properties.remediationDescription', 'type': 'str'}, + } + + def __init__( + self, + *, + compressed_query: Optional[str] = None, + supported_cloud: Optional[Union[str, "SupportedCloudEnum"]] = "AWS", + severity: Optional[Union[str, "SeverityEnum"]] = "Low", + user_impact: Optional[Union[str, "UserImpactEnum"]] = "Low", + implementation_effort: Optional[Union[str, "ImplementationEffortEnum"]] = "Low", + description: Optional[str] = None, + remediation_description: Optional[str] = None, + **kwargs + ): + super(CustomAssessmentAutomation, self).__init__(**kwargs) + self.compressed_query = compressed_query + self.supported_cloud = supported_cloud + self.severity = severity + self.user_impact = user_impact + self.implementation_effort = implementation_effort + self.description = description + self.remediation_description = remediation_description + + +class CustomAssessmentAutomationsListResult(msrest.serialization.Model): + """A list of Custom Assessment Automations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of Custom Assessment Automations. + :vartype value: list[~azure.mgmt.security.models.CustomAssessmentAutomation] + :param next_link: The link used to get the next page of operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomAssessmentAutomation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomAssessmentAutomationsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class CustomEntityStoreAssignment(Resource): + """Custom entity store assignment. + + 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 principal: The principal assigned with entity store. Format of principal is: [AAD + type]=[PrincipalObjectId];[TenantId]. + :type principal: str + :param entity_store_database_link: The link to entity store database. + :type entity_store_database_link: str + """ + + _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'}, + 'principal': {'key': 'properties.principal', 'type': 'str'}, + 'entity_store_database_link': {'key': 'properties.entityStoreDatabaseLink', 'type': 'str'}, + } + + def __init__( + self, + *, + principal: Optional[str] = None, + entity_store_database_link: Optional[str] = None, + **kwargs + ): + super(CustomEntityStoreAssignment, self).__init__(**kwargs) + self.principal = principal + self.entity_store_database_link = entity_store_database_link + + +class CustomEntityStoreAssignmentRequest(msrest.serialization.Model): + """describes the custom entity store assignment request. + + :param principal: The principal assigned with entity store. If not provided, will use caller + principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. + :type principal: str + """ + + _attribute_map = { + 'principal': {'key': 'properties.principal', 'type': 'str'}, + } + + def __init__( + self, + *, + principal: Optional[str] = None, + **kwargs + ): + super(CustomEntityStoreAssignmentRequest, self).__init__(**kwargs) + self.principal = principal + + +class CustomEntityStoreAssignmentsListResult(msrest.serialization.Model): + """A list of custom entity store assignments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Collection of custom entity store assignments. + :vartype value: list[~azure.mgmt.security.models.CustomEntityStoreAssignment] + :param next_link: The link used to get the next page of operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomEntityStoreAssignment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomEntityStoreAssignmentsListResult, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + class CVE(msrest.serialization.Model): """CVE details. @@ -8273,8 +8525,6 @@ class SecurityAssessment(Resource): :type resource_details: ~azure.mgmt.security.models.ResourceDetails :ivar display_name: User friendly display name of the assessment. :vartype display_name: str - :param status: The result of the assessment. - :type status: ~azure.mgmt.security.models.AssessmentStatus :param additional_data: Additional data regarding the assessment. :type additional_data: dict[str, str] :ivar links: Links relevant to the assessment. @@ -8283,6 +8533,8 @@ class SecurityAssessment(Resource): :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties :param partners_data: Data regarding 3rd party partner integration. :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatus """ _validation = { @@ -8299,31 +8551,31 @@ class SecurityAssessment(Resource): 'type': {'key': 'type', 'type': 'str'}, 'resource_details': {'key': 'properties.resourceDetails', 'type': 'ResourceDetails'}, 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'AssessmentStatus'}, 'additional_data': {'key': 'properties.additionalData', 'type': '{str}'}, 'links': {'key': 'properties.links', 'type': 'AssessmentLinks'}, 'metadata': {'key': 'properties.metadata', 'type': 'SecurityAssessmentMetadataProperties'}, 'partners_data': {'key': 'properties.partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'properties.status', 'type': 'AssessmentStatus'}, } def __init__( self, *, resource_details: Optional["ResourceDetails"] = None, - status: Optional["AssessmentStatus"] = None, additional_data: Optional[Dict[str, str]] = None, metadata: Optional["SecurityAssessmentMetadataProperties"] = None, partners_data: Optional["SecurityAssessmentPartnerData"] = None, + status: Optional["AssessmentStatus"] = None, **kwargs ): super(SecurityAssessment, self).__init__(**kwargs) self.resource_details = resource_details self.display_name = None - self.status = status self.additional_data = additional_data self.links = None self.metadata = metadata self.partners_data = partners_data + self.status = status class SecurityAssessmentList(msrest.serialization.Model): @@ -8332,7 +8584,7 @@ class SecurityAssessmentList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Collection of security assessments in this page. - :vartype value: list[~azure.mgmt.security.models.SecurityAssessment] + :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentResponse] :ivar next_link: The URI to fetch the next page. :vartype next_link: str """ @@ -8343,7 +8595,7 @@ class SecurityAssessmentList(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityAssessment]'}, + 'value': {'key': 'value', 'type': '[SecurityAssessmentResponse]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -8456,36 +8708,6 @@ def __init__( self.partner_data = partner_data -class SecurityAssessmentMetadataList(msrest.serialization.Model): - """List of security assessment metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentMetadata] - :ivar next_link: The URI to fetch the next page. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecurityAssessmentMetadata]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityAssessmentMetadataList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class SecurityAssessmentMetadataPartnerData(msrest.serialization.Model): """Describes the partner that created the assessment. @@ -8618,28 +8840,316 @@ def __init__( self.partner_data = partner_data -class SecurityAssessmentPartnerData(msrest.serialization.Model): - """Data regarding 3rd party partner integration. +class SecurityAssessmentMetadataPropertiesResponse(SecurityAssessmentMetadataProperties): + """Describes properties of an assessment metadata response. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param partner_name: Required. Name of the company of the partner. - :type partner_name: str - :param secret: Required. secret to authenticate the partner - write only. - :type secret: str + :param display_name: Required. User friendly display name of the assessment. + :type display_name: str + :ivar policy_definition_id: Azure resource ID of the policy definition that turns this + assessment calculation on. + :vartype policy_definition_id: str + :param description: Human readable description of the assessment. + :type description: str + :param remediation_description: Human readable description of what you should do to mitigate + this security issue. + :type remediation_description: str + :param categories: + :type categories: list[str or ~azure.mgmt.security.models.Categories] + :param severity: Required. The severity level of the assessment. Possible values include: + "Low", "Medium", "High". + :type severity: str or ~azure.mgmt.security.models.Severity + :param user_impact: The user impact of the assessment. Possible values include: "Low", + "Moderate", "High". + :type user_impact: str or ~azure.mgmt.security.models.UserImpact + :param implementation_effort: The implementation effort required to remediate this assessment. + Possible values include: "Low", "Moderate", "High". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffort + :param threats: + :type threats: list[str or ~azure.mgmt.security.models.Threats] + :param preview: True if this assessment is in preview release status. + :type preview: bool + :param assessment_type: Required. BuiltIn if the assessment based on built-in Azure Policy + definition, Custom if the assessment based on custom Azure Policy definition. Possible values + include: "BuiltIn", "CustomPolicy", "CustomerManaged", "VerifiedPartner". + :type assessment_type: str or ~azure.mgmt.security.models.AssessmentType + :param partner_data: Describes the partner that created the assessment. + :type partner_data: ~azure.mgmt.security.models.SecurityAssessmentMetadataPartnerData + :param publish_dates: + :type publish_dates: + ~azure.mgmt.security.models.SecurityAssessmentMetadataPropertiesResponsePublishDates + :param planned_deprecation_date: + :type planned_deprecation_date: str + :param tactics: + :type tactics: list[str or ~azure.mgmt.security.models.Tactics] + :param techniques: + :type techniques: list[str or ~azure.mgmt.security.models.Techniques] """ _validation = { - 'partner_name': {'required': True}, - 'secret': {'required': True}, + 'display_name': {'required': True}, + 'policy_definition_id': {'readonly': True}, + 'severity': {'required': True}, + 'assessment_type': {'required': True}, + 'planned_deprecation_date': {'pattern': r'^[0-9]{2}/[0-9]{4}$'}, } _attribute_map = { - 'partner_name': {'key': 'partnerName', 'type': 'str'}, - 'secret': {'key': 'secret', 'type': 'str'}, - } - - def __init__( + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'policyDefinitionId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'remediation_description': {'key': 'remediationDescription', 'type': 'str'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'user_impact': {'key': 'userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'implementationEffort', 'type': 'str'}, + 'threats': {'key': 'threats', 'type': '[str]'}, + 'preview': {'key': 'preview', 'type': 'bool'}, + 'assessment_type': {'key': 'assessmentType', 'type': 'str'}, + 'partner_data': {'key': 'partnerData', 'type': 'SecurityAssessmentMetadataPartnerData'}, + 'publish_dates': {'key': 'publishDates', 'type': 'SecurityAssessmentMetadataPropertiesResponsePublishDates'}, + 'planned_deprecation_date': {'key': 'plannedDeprecationDate', 'type': 'str'}, + 'tactics': {'key': 'tactics', 'type': '[str]'}, + 'techniques': {'key': 'techniques', 'type': '[str]'}, + } + + def __init__( + self, + *, + display_name: str, + severity: Union[str, "Severity"], + assessment_type: Union[str, "AssessmentType"], + description: Optional[str] = None, + remediation_description: Optional[str] = None, + categories: Optional[List[Union[str, "Categories"]]] = None, + user_impact: Optional[Union[str, "UserImpact"]] = None, + implementation_effort: Optional[Union[str, "ImplementationEffort"]] = None, + threats: Optional[List[Union[str, "Threats"]]] = None, + preview: Optional[bool] = None, + partner_data: Optional["SecurityAssessmentMetadataPartnerData"] = None, + publish_dates: Optional["SecurityAssessmentMetadataPropertiesResponsePublishDates"] = None, + planned_deprecation_date: Optional[str] = None, + tactics: Optional[List[Union[str, "Tactics"]]] = None, + techniques: Optional[List[Union[str, "Techniques"]]] = None, + **kwargs + ): + super(SecurityAssessmentMetadataPropertiesResponse, self).__init__(display_name=display_name, description=description, remediation_description=remediation_description, categories=categories, severity=severity, user_impact=user_impact, implementation_effort=implementation_effort, threats=threats, preview=preview, assessment_type=assessment_type, partner_data=partner_data, **kwargs) + self.publish_dates = publish_dates + self.planned_deprecation_date = planned_deprecation_date + self.tactics = tactics + self.techniques = techniques + + +class SecurityAssessmentMetadataPropertiesResponsePublishDates(msrest.serialization.Model): + """SecurityAssessmentMetadataPropertiesResponsePublishDates. + + All required parameters must be populated in order to send to Azure. + + :param ga: + :type ga: str + :param public: Required. + :type public: str + """ + + _validation = { + 'ga': {'pattern': r'^([0-9]{2}/){2}[0-9]{4}$'}, + 'public': {'required': True, 'pattern': r'^([0-9]{2}/){2}[0-9]{4}$'}, + } + + _attribute_map = { + 'ga': {'key': 'GA', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'str'}, + } + + def __init__( + self, + *, + public: str, + ga: Optional[str] = None, + **kwargs + ): + super(SecurityAssessmentMetadataPropertiesResponsePublishDates, self).__init__(**kwargs) + self.ga = ga + self.public = public + + +class SecurityAssessmentMetadataResponse(Resource): + """Security assessment metadata response. + + 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 display_name: User friendly display name of the assessment. + :type display_name: str + :ivar policy_definition_id: Azure resource ID of the policy definition that turns this + assessment calculation on. + :vartype policy_definition_id: str + :param description: Human readable description of the assessment. + :type description: str + :param remediation_description: Human readable description of what you should do to mitigate + this security issue. + :type remediation_description: str + :param categories: + :type categories: list[str or ~azure.mgmt.security.models.Categories] + :param severity: The severity level of the assessment. Possible values include: "Low", + "Medium", "High". + :type severity: str or ~azure.mgmt.security.models.Severity + :param user_impact: The user impact of the assessment. Possible values include: "Low", + "Moderate", "High". + :type user_impact: str or ~azure.mgmt.security.models.UserImpact + :param implementation_effort: The implementation effort required to remediate this assessment. + Possible values include: "Low", "Moderate", "High". + :type implementation_effort: str or ~azure.mgmt.security.models.ImplementationEffort + :param threats: + :type threats: list[str or ~azure.mgmt.security.models.Threats] + :param preview: True if this assessment is in preview release status. + :type preview: bool + :param assessment_type: BuiltIn if the assessment based on built-in Azure Policy definition, + Custom if the assessment based on custom Azure Policy definition. Possible values include: + "BuiltIn", "CustomPolicy", "CustomerManaged", "VerifiedPartner". + :type assessment_type: str or ~azure.mgmt.security.models.AssessmentType + :param partner_data: Describes the partner that created the assessment. + :type partner_data: ~azure.mgmt.security.models.SecurityAssessmentMetadataPartnerData + :param publish_dates: + :type publish_dates: + ~azure.mgmt.security.models.SecurityAssessmentMetadataPropertiesResponsePublishDates + :param planned_deprecation_date: + :type planned_deprecation_date: str + :param tactics: + :type tactics: list[str or ~azure.mgmt.security.models.Tactics] + :param techniques: + :type techniques: list[str or ~azure.mgmt.security.models.Techniques] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_definition_id': {'readonly': True}, + 'planned_deprecation_date': {'pattern': r'^[0-9]{2}/[0-9]{4}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'policy_definition_id': {'key': 'properties.policyDefinitionId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'remediation_description': {'key': 'properties.remediationDescription', 'type': 'str'}, + 'categories': {'key': 'properties.categories', 'type': '[str]'}, + 'severity': {'key': 'properties.severity', 'type': 'str'}, + 'user_impact': {'key': 'properties.userImpact', 'type': 'str'}, + 'implementation_effort': {'key': 'properties.implementationEffort', 'type': 'str'}, + 'threats': {'key': 'properties.threats', 'type': '[str]'}, + 'preview': {'key': 'properties.preview', 'type': 'bool'}, + 'assessment_type': {'key': 'properties.assessmentType', 'type': 'str'}, + 'partner_data': {'key': 'properties.partnerData', 'type': 'SecurityAssessmentMetadataPartnerData'}, + 'publish_dates': {'key': 'properties.publishDates', 'type': 'SecurityAssessmentMetadataPropertiesResponsePublishDates'}, + 'planned_deprecation_date': {'key': 'properties.plannedDeprecationDate', 'type': 'str'}, + 'tactics': {'key': 'properties.tactics', 'type': '[str]'}, + 'techniques': {'key': 'properties.techniques', 'type': '[str]'}, + } + + def __init__( + self, + *, + display_name: Optional[str] = None, + description: Optional[str] = None, + remediation_description: Optional[str] = None, + categories: Optional[List[Union[str, "Categories"]]] = None, + severity: Optional[Union[str, "Severity"]] = None, + user_impact: Optional[Union[str, "UserImpact"]] = None, + implementation_effort: Optional[Union[str, "ImplementationEffort"]] = None, + threats: Optional[List[Union[str, "Threats"]]] = None, + preview: Optional[bool] = None, + assessment_type: Optional[Union[str, "AssessmentType"]] = None, + partner_data: Optional["SecurityAssessmentMetadataPartnerData"] = None, + publish_dates: Optional["SecurityAssessmentMetadataPropertiesResponsePublishDates"] = None, + planned_deprecation_date: Optional[str] = None, + tactics: Optional[List[Union[str, "Tactics"]]] = None, + techniques: Optional[List[Union[str, "Techniques"]]] = None, + **kwargs + ): + super(SecurityAssessmentMetadataResponse, self).__init__(**kwargs) + self.display_name = display_name + self.policy_definition_id = None + self.description = description + self.remediation_description = remediation_description + self.categories = categories + self.severity = severity + self.user_impact = user_impact + self.implementation_effort = implementation_effort + self.threats = threats + self.preview = preview + self.assessment_type = assessment_type + self.partner_data = partner_data + self.publish_dates = publish_dates + self.planned_deprecation_date = planned_deprecation_date + self.tactics = tactics + self.techniques = techniques + + +class SecurityAssessmentMetadataResponseList(msrest.serialization.Model): + """List of security assessment metadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: + :vartype value: list[~azure.mgmt.security.models.SecurityAssessmentMetadataResponse] + :ivar next_link: The URI to fetch the next page. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecurityAssessmentMetadataResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecurityAssessmentMetadataResponseList, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SecurityAssessmentPartnerData(msrest.serialization.Model): + """Data regarding 3rd party partner integration. + + All required parameters must be populated in order to send to Azure. + + :param partner_name: Required. Name of the company of the partner. + :type partner_name: str + :param secret: Required. secret to authenticate the partner - write only. + :type secret: str + """ + + _validation = { + 'partner_name': {'required': True}, + 'secret': {'required': True}, + } + + _attribute_map = { + 'partner_name': {'key': 'partnerName', 'type': 'str'}, + 'secret': {'key': 'secret', 'type': 'str'}, + } + + def __init__( self, *, partner_name: str, @@ -8651,6 +9161,236 @@ def __init__( self.secret = secret +class SecurityAssessmentPropertiesBase(msrest.serialization.Model): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + } + + def __init__( + self, + *, + resource_details: "ResourceDetails", + additional_data: Optional[Dict[str, str]] = None, + metadata: Optional["SecurityAssessmentMetadataProperties"] = None, + partners_data: Optional["SecurityAssessmentPartnerData"] = None, + **kwargs + ): + super(SecurityAssessmentPropertiesBase, self).__init__(**kwargs) + self.resource_details = resource_details + self.display_name = None + self.additional_data = additional_data + self.links = None + self.metadata = metadata + self.partners_data = partners_data + + +class SecurityAssessmentProperties(SecurityAssessmentPropertiesBase): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: Required. The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatus + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'status', 'type': 'AssessmentStatus'}, + } + + def __init__( + self, + *, + resource_details: "ResourceDetails", + status: "AssessmentStatus", + additional_data: Optional[Dict[str, str]] = None, + metadata: Optional["SecurityAssessmentMetadataProperties"] = None, + partners_data: Optional["SecurityAssessmentPartnerData"] = None, + **kwargs + ): + super(SecurityAssessmentProperties, self).__init__(resource_details=resource_details, additional_data=additional_data, metadata=metadata, partners_data=partners_data, **kwargs) + self.status = status + + +class SecurityAssessmentPropertiesResponse(SecurityAssessmentPropertiesBase): + """Describes properties of an assessment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param resource_details: Required. Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: Required. The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatusResponse + """ + + _validation = { + 'resource_details': {'required': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'resource_details': {'key': 'resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'additional_data': {'key': 'additionalData', 'type': '{str}'}, + 'links': {'key': 'links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'status', 'type': 'AssessmentStatusResponse'}, + } + + def __init__( + self, + *, + resource_details: "ResourceDetails", + status: "AssessmentStatusResponse", + additional_data: Optional[Dict[str, str]] = None, + metadata: Optional["SecurityAssessmentMetadataProperties"] = None, + partners_data: Optional["SecurityAssessmentPartnerData"] = None, + **kwargs + ): + super(SecurityAssessmentPropertiesResponse, self).__init__(resource_details=resource_details, additional_data=additional_data, metadata=metadata, partners_data=partners_data, **kwargs) + self.status = status + + +class SecurityAssessmentResponse(Resource): + """Security assessment on a resource - response format. + + 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 resource_details: Details of the resource that was assessed. + :type resource_details: ~azure.mgmt.security.models.ResourceDetails + :ivar display_name: User friendly display name of the assessment. + :vartype display_name: str + :param additional_data: Additional data regarding the assessment. + :type additional_data: dict[str, str] + :ivar links: Links relevant to the assessment. + :vartype links: ~azure.mgmt.security.models.AssessmentLinks + :param metadata: Describes properties of an assessment metadata. + :type metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataProperties + :param partners_data: Data regarding 3rd party partner integration. + :type partners_data: ~azure.mgmt.security.models.SecurityAssessmentPartnerData + :param status: The result of the assessment. + :type status: ~azure.mgmt.security.models.AssessmentStatusResponse + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'display_name': {'readonly': True}, + 'links': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'resource_details': {'key': 'properties.resourceDetails', 'type': 'ResourceDetails'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'additional_data': {'key': 'properties.additionalData', 'type': '{str}'}, + 'links': {'key': 'properties.links', 'type': 'AssessmentLinks'}, + 'metadata': {'key': 'properties.metadata', 'type': 'SecurityAssessmentMetadataProperties'}, + 'partners_data': {'key': 'properties.partnersData', 'type': 'SecurityAssessmentPartnerData'}, + 'status': {'key': 'properties.status', 'type': 'AssessmentStatusResponse'}, + } + + def __init__( + self, + *, + resource_details: Optional["ResourceDetails"] = None, + additional_data: Optional[Dict[str, str]] = None, + metadata: Optional["SecurityAssessmentMetadataProperties"] = None, + partners_data: Optional["SecurityAssessmentPartnerData"] = None, + status: Optional["AssessmentStatusResponse"] = None, + **kwargs + ): + super(SecurityAssessmentResponse, self).__init__(**kwargs) + self.resource_details = resource_details + self.display_name = None + self.additional_data = additional_data + self.links = None + self.metadata = metadata + self.partners_data = partners_data + self.status = status + + class SecurityContact(Resource): """Contact details for security issues. 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 5a8510226b69..c531f3cf8240 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 @@ -271,7 +271,7 @@ class EnforcementSupport(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NOT_SUPPORTED = "NotSupported" UNKNOWN = "Unknown" -class Enum13(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum17(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACTIVATE = "Activate" DISMISS = "Dismiss" @@ -279,12 +279,12 @@ class Enum13(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESOLVE = "Resolve" CLOSE = "Close" -class Enum15(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum19(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EFFECTIVE = "effective" CUSTOM = "custom" -class Enum69(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum75(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MCAS = "MCAS" WDATP = "WDATP" @@ -360,6 +360,14 @@ class ImplementationEffort(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MODERATE = "Moderate" HIGH = "High" +class ImplementationEffortEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The implementation effort to relate to the assessments generated by this assessment automation. + """ + + HIGH = "High" + MODERATE = "Moderate" + LOW = "Low" + class Intent(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The kill chain related intent behind the alert. For list of supported values, and explanations of Azure Security Center's supported kill chain intents. @@ -723,6 +731,14 @@ class Severity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MEDIUM = "Medium" HIGH = "High" +class SeverityEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The severity to relate to the assessments generated by this assessment automation. + """ + + HIGH = "High" + MEDIUM = "Medium" + LOW = "Low" + class Source(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform where the assessed resource resides """ @@ -784,6 +800,140 @@ class SubAssessmentStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Assessment for this resource did not happen. NOT_APPLICABLE = "NotApplicable" +class SupportedCloudEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Relevant cloud for the custom assessment automation. + """ + + AWS = "AWS" + +class Tactics(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Tactic of the assessment + """ + + RECONNAISSANCE = "Reconnaissance" + RESOURCE_DEVELOPMENT = "Resource Development" + INITIAL_ACCESS = "Initial Access" + EXECUTION = "Execution" + PERSISTENCE = "Persistence" + PRIVILEGE_ESCALATION = "Privilege Escalation" + DEFENSE_EVASION = "Defense Evasion" + CREDENTIAL_ACCESS = "Credential Access" + DISCOVERY = "Discovery" + LATERAL_MOVEMENT = "Lateral Movement" + COLLECTION = "Collection" + COMMAND_AND_CONTROL = "Command and Control" + EXFILTRATION = "Exfiltration" + IMPACT = "Impact" + +class Techniques(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Techniques of the assessment + """ + + ABUSE_ELEVATION_CONTROL_MECHANISM = "Abuse Elevation Control Mechanism" + ACCESS_TOKEN_MANIPULATION = "Access Token Manipulation" + ACCOUNT_DISCOVERY = "Account Discovery" + ACCOUNT_MANIPULATION = "Account Manipulation" + ACTIVE_SCANNING = "Active Scanning" + APPLICATION_LAYER_PROTOCOL = "Application Layer Protocol" + AUDIO_CAPTURE = "Audio Capture" + BOOT_OR_LOGON_AUTOSTART_EXECUTION = "Boot or Logon Autostart Execution" + BOOT_OR_LOGON_INITIALIZATION_SCRIPTS = "Boot or Logon Initialization Scripts" + BRUTE_FORCE = "Brute Force" + CLOUD_INFRASTRUCTURE_DISCOVERY = "Cloud Infrastructure Discovery" + CLOUD_SERVICE_DASHBOARD = "Cloud Service Dashboard" + CLOUD_SERVICE_DISCOVERY = "Cloud Service Discovery" + COMMAND_AND_SCRIPTING_INTERPRETER = "Command and Scripting Interpreter" + COMPROMISE_CLIENT_SOFTWARE_BINARY = "Compromise Client Software Binary" + COMPROMISE_INFRASTRUCTURE = "Compromise Infrastructure" + CONTAINER_AND_RESOURCE_DISCOVERY = "Container and Resource Discovery" + CREATE_ACCOUNT = "Create Account" + CREATE_OR_MODIFY_SYSTEM_PROCESS = "Create or Modify System Process" + CREDENTIALS_FROM_PASSWORD_STORES = "Credentials from Password Stores" + DATA_DESTRUCTION = "Data Destruction" + DATA_ENCRYPTED_FOR_IMPACT = "Data Encrypted for Impact" + DATA_FROM_CLOUD_STORAGE_OBJECT = "Data from Cloud Storage Object" + DATA_FROM_CONFIGURATION_REPOSITORY = "Data from Configuration Repository" + DATA_FROM_INFORMATION_REPOSITORIES = "Data from Information Repositories" + DATA_FROM_LOCAL_SYSTEM = "Data from Local System" + DATA_MANIPULATION = "Data Manipulation" + DATA_STAGED = "Data Staged" + DEFACEMENT = "Defacement" + DEOBFUSCATE_DECODE_FILES_OR_INFORMATION = "Deobfuscate/Decode Files or Information" + DISK_WIPE = "Disk Wipe" + DOMAIN_TRUST_DISCOVERY = "Domain Trust Discovery" + DRIVE_BY_COMPROMISE = "Drive-by Compromise" + DYNAMIC_RESOLUTION = "Dynamic Resolution" + ENDPOINT_DENIAL_OF_SERVICE = "Endpoint Denial of Service" + EVENT_TRIGGERED_EXECUTION = "Event Triggered Execution" + EXFILTRATION_OVER_ALTERNATIVE_PROTOCOL = "Exfiltration Over Alternative Protocol" + EXPLOIT_PUBLIC_FACING_APPLICATION = "Exploit Public-Facing Application" + EXPLOITATION_FOR_CLIENT_EXECUTION = "Exploitation for Client Execution" + EXPLOITATION_FOR_CREDENTIAL_ACCESS = "Exploitation for Credential Access" + EXPLOITATION_FOR_DEFENSE_EVASION = "Exploitation for Defense Evasion" + EXPLOITATION_FOR_PRIVILEGE_ESCALATION = "Exploitation for Privilege Escalation" + EXPLOITATION_OF_REMOTE_SERVICES = "Exploitation of Remote Services" + EXTERNAL_REMOTE_SERVICES = "External Remote Services" + FALLBACK_CHANNELS = "Fallback Channels" + FILE_AND_DIRECTORY_DISCOVERY = "File and Directory Discovery" + GATHER_VICTIM_NETWORK_INFORMATION = "Gather Victim Network Information" + HIDE_ARTIFACTS = "Hide Artifacts" + HIJACK_EXECUTION_FLOW = "Hijack Execution Flow" + IMPAIR_DEFENSES = "Impair Defenses" + IMPLANT_CONTAINER_IMAGE = "Implant Container Image" + INDICATOR_REMOVAL_ON_HOST = "Indicator Removal on Host" + INDIRECT_COMMAND_EXECUTION = "Indirect Command Execution" + INGRESS_TOOL_TRANSFER = "Ingress Tool Transfer" + INPUT_CAPTURE = "Input Capture" + INTER_PROCESS_COMMUNICATION = "Inter-Process Communication" + LATERAL_TOOL_TRANSFER = "Lateral Tool Transfer" + MAN_IN_THE_MIDDLE = "Man-in-the-Middle" + MASQUERADING = "Masquerading" + MODIFY_AUTHENTICATION_PROCESS = "Modify Authentication Process" + MODIFY_REGISTRY = "Modify Registry" + NETWORK_DENIAL_OF_SERVICE = "Network Denial of Service" + NETWORK_SERVICE_SCANNING = "Network Service Scanning" + NETWORK_SNIFFING = "Network Sniffing" + NON_APPLICATION_LAYER_PROTOCOL = "Non-Application Layer Protocol" + NON_STANDARD_PORT = "Non-Standard Port" + OBTAIN_CAPABILITIES = "Obtain Capabilities" + OBFUSCATED_FILES_OR_INFORMATION = "Obfuscated Files or Information" + OFFICE_APPLICATION_STARTUP = "Office Application Startup" + OS_CREDENTIAL_DUMPING = "OS Credential Dumping" + PERMISSION_GROUPS_DISCOVERY = "Permission Groups Discovery" + PHISHING = "Phishing" + PRE_OS_BOOT = "Pre-OS Boot" + PROCESS_DISCOVERY = "Process Discovery" + PROCESS_INJECTION = "Process Injection" + PROTOCOL_TUNNELING = "Protocol Tunneling" + PROXY = "Proxy" + QUERY_REGISTRY = "Query Registry" + REMOTE_ACCESS_SOFTWARE = "Remote Access Software" + REMOTE_SERVICE_SESSION_HIJACKING = "Remote Service Session Hijacking" + REMOTE_SERVICES = "Remote Services" + REMOTE_SYSTEM_DISCOVERY = "Remote System Discovery" + RESOURCE_HIJACKING = "Resource Hijacking" + SCHEDULED_TASK_JOB = "Scheduled Task/Job" + SCREEN_CAPTURE = "Screen Capture" + SEARCH_VICTIM_OWNED_WEBSITES = "Search Victim-Owned Websites" + SERVER_SOFTWARE_COMPONENT = "Server Software Component" + SERVICE_STOP = "Service Stop" + SIGNED_BINARY_PROXY_EXECUTION = "Signed Binary Proxy Execution" + SOFTWARE_DEPLOYMENT_TOOLS = "Software Deployment Tools" + SQL_STORED_PROCEDURES = "SQL Stored Procedures" + STEAL_OR_FORGE_KERBEROS_TICKETS = "Steal or Forge Kerberos Tickets" + SUBVERT_TRUST_CONTROLS = "Subvert Trust Controls" + SUPPLY_CHAIN_COMPROMISE = "Supply Chain Compromise" + SYSTEM_INFORMATION_DISCOVERY = "System Information Discovery" + TAINT_SHARED_CONTENT = "Taint Shared Content" + TRAFFIC_SIGNALING = "Traffic Signaling" + TRANSFER_DATA_TO_CLOUD_ACCOUNT = "Transfer Data to Cloud Account" + TRUSTED_RELATIONSHIP = "Trusted Relationship" + UNSECURED_CREDENTIALS = "Unsecured Credentials" + USER_EXECUTION = "User Execution" + VALID_ACCOUNTS = "Valid Accounts" + WINDOWS_MANAGEMENT_INSTRUMENTATION = "Windows Management Instrumentation" + FILE_AND_DIRECTORY_PERMISSIONS_MODIFICATION = "File and Directory Permissions Modification" + class Threats(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Threats impact of the assessment """ @@ -819,6 +969,14 @@ class UserImpact(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MODERATE = "Moderate" HIGH = "High" +class UserImpactEnum(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The user impact to relate to the assessments generated by this assessment automation. + """ + + HIGH = "High" + MODERATE = "Moderate" + LOW = "Low" + class ValueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The value type of the items in the list. """ 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 65df4fa5ef35..ef6b74899ccc 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 @@ -6,6 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._custom_assessment_automations_operations import CustomAssessmentAutomationsOperations +from ._custom_entity_store_assignments_operations import CustomEntityStoreAssignmentsOperations from ._compliance_results_operations import ComplianceResultsOperations from ._pricings_operations import PricingsOperations from ._advanced_threat_protection_operations import AdvancedThreatProtectionOperations @@ -53,6 +55,8 @@ from ._software_inventories_operations import SoftwareInventoriesOperations __all__ = [ + 'CustomAssessmentAutomationsOperations', + 'CustomEntityStoreAssignmentsOperations', 'ComplianceResultsOperations', 'PricingsOperations', 'AdvancedThreatProtectionOperations', diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_metadata_operations.py index df24fe791662..5275fc883a14 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_metadata_operations.py @@ -49,20 +49,20 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.SecurityAssessmentMetadataList"] + # type: (...) -> Iterable["_models.SecurityAssessmentMetadataResponseList"] """Get metadata information on all assessment types. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityAssessmentMetadataList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataList] + :return: An iterator like instance of either SecurityAssessmentMetadataResponseList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -85,7 +85,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityAssessmentMetadataList', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponseList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,22 +113,22 @@ def get( assessment_metadata_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.SecurityAssessmentMetadata" + # type: (...) -> "_models.SecurityAssessmentMetadataResponse" """Get metadata information on an assessment type. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -154,7 +154,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -166,20 +166,20 @@ def list_by_subscription( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.SecurityAssessmentMetadataList"] + # type: (...) -> Iterable["_models.SecurityAssessmentMetadataResponseList"] """Get metadata information on all assessment types in a specific subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SecurityAssessmentMetadataList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataList] + :return: An iterator like instance of either SecurityAssessmentMetadataResponseList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.SecurityAssessmentMetadataResponseList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataList"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponseList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -206,7 +206,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecurityAssessmentMetadataList', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponseList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -234,22 +234,22 @@ def get_in_subscription( assessment_metadata_name, # type: str **kwargs # type: Any ): - # type: (...) -> "_models.SecurityAssessmentMetadata" + # type: (...) -> "_models.SecurityAssessmentMetadataResponse" """Get metadata information on an assessment type in a specific subscription. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -276,7 +276,7 @@ def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -287,27 +287,27 @@ def get_in_subscription( def create_in_subscription( self, assessment_metadata_name, # type: str - assessment_metadata, # type: "_models.SecurityAssessmentMetadata" + assessment_metadata, # type: "_models.SecurityAssessmentMetadataResponse" **kwargs # type: Any ): - # type: (...) -> "_models.SecurityAssessmentMetadata" + # type: (...) -> "_models.SecurityAssessmentMetadataResponse" """Create metadata information on an assessment type in a specific subscription. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. :type assessment_metadata_name: str :param assessment_metadata: AssessmentMetadata object. - :type assessment_metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :type assessment_metadata: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessmentMetadata, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadata + :return: SecurityAssessmentMetadataResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentMetadataResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadata"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentMetadataResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -329,7 +329,7 @@ def create_in_subscription( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(assessment_metadata, 'SecurityAssessmentMetadata') + body_content = self._serialize.body(assessment_metadata, 'SecurityAssessmentMetadataResponse') body_content_kwargs['content'] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -339,7 +339,7 @@ def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentMetadataResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -368,7 +368,7 @@ def delete_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_operations.py index 0b7b28c2f6a3..52997d7f4836 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_assessments_operations.py @@ -67,7 +67,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" def prepare_request(next_link=None): @@ -124,7 +124,7 @@ def get( expand=None, # type: Optional[Union[str, "_models.ExpandEnum"]] **kwargs # type: Any ): - # type: (...) -> "_models.SecurityAssessment" + # type: (...) -> "_models.SecurityAssessmentResponse" """Get a security assessment on your scanned resource. :param resource_id: The identifier of the resource. @@ -134,16 +134,16 @@ def get( :param expand: OData expand. Optional. :type expand: str or ~azure.mgmt.security.models.ExpandEnum :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessment, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessment + :return: SecurityAssessmentResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL @@ -172,7 +172,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -187,7 +187,7 @@ def create_or_update( assessment, # type: "_models.SecurityAssessment" **kwargs # type: Any ): - # type: (...) -> "_models.SecurityAssessment" + # type: (...) -> "_models.SecurityAssessmentResponse" """Create a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same name before inserting the assessment result. @@ -198,16 +198,16 @@ def create_or_update( :param assessment: Calculated assessment on a pre-defined assessment metadata. :type assessment: ~azure.mgmt.security.models.SecurityAssessment :keyword callable cls: A custom type or function that will be passed the direct response - :return: SecurityAssessment, or the result of cls(response) - :rtype: ~azure.mgmt.security.models.SecurityAssessment + :return: SecurityAssessmentResponse, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.SecurityAssessmentResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessment"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecurityAssessmentResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -240,10 +240,10 @@ def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize('SecurityAssessmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -275,7 +275,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-01-01" + api_version = "2021-06-01" accept = "application/json" # Construct URL diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_assessment_automations_operations.py new file mode 100644 index 000000000000..c9cf63890fcc --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_assessment_automations_operations.py @@ -0,0 +1,386 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CustomAssessmentAutomationsOperations(object): + """CustomAssessmentAutomationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.security.models + :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, + resource_group_name, # type: str + custom_assessment_automation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomAssessmentAutomation" + """Gets a custom assessment automation. + + Gets a single custom assessment automation by name for the provided subscription and resource + group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomAssessmentAutomation, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomAssessmentAutomation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + custom_assessment_automation_name, # type: str + custom_assessment_automation_body, # type: "_models.CustomAssessmentAutomation" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomAssessmentAutomation" + """Creates a custom assessment automation. + + Creates or updates a custom assessment automation for the provided subscription. Please note + that providing an existing custom assessment automation will replace the existing record. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :param custom_assessment_automation_body: Custom Assessment Automation body. + :type custom_assessment_automation_body: ~azure.mgmt.security.models.CustomAssessmentAutomation + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomAssessmentAutomation, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomAssessmentAutomation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(custom_assessment_automation_body, 'CustomAssessmentAutomation') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomAssessmentAutomation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + custom_assessment_automation_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a custom assessment automation. + + Deletes a custom assessment automation by name for a provided subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_assessment_automation_name: Name of the Custom Assessment Automation. + :type custom_assessment_automation_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customAssessmentAutomationName': self._serialize.url("custom_assessment_automation_name", custom_assessment_automation_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomAssessmentAutomationsListResult"] + """List custom assessment automations in a subscription and a resource group. + + List custom assessment automations by provided subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomAssessmentAutomationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.CustomAssessmentAutomationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomAssessmentAutomationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomAssessmentAutomationsListResult"] + """List custom assessment automations in a subscription. + + List custom assessment automations by provided subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomAssessmentAutomationsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.CustomAssessmentAutomationsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomAssessmentAutomationsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomAssessmentAutomationsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations'} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_entity_store_assignments_operations.py new file mode 100644 index 000000000000..65889df2118e --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_custom_entity_store_assignments_operations.py @@ -0,0 +1,388 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CustomEntityStoreAssignmentsOperations(object): + """CustomEntityStoreAssignmentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.security.models + :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, + resource_group_name, # type: str + custom_entity_store_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomEntityStoreAssignment" + """Gets a custom entity store assignment. + + Gets a single custom entity store assignment by name for the provided subscription and resource + group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomEntityStoreAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomEntityStoreAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + custom_entity_store_assignment_name, # type: str + custom_entity_store_assignment_request_body, # type: "_models.CustomEntityStoreAssignmentRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomEntityStoreAssignment" + """Creates a custom entity store assignment. + + Creates a custom entity store assignment for the provided subscription, if not already exists. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :param custom_entity_store_assignment_request_body: Custom entity store assignment body. + :type custom_entity_store_assignment_request_body: ~azure.mgmt.security.models.CustomEntityStoreAssignmentRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomEntityStoreAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.security.models.CustomEntityStoreAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(custom_entity_store_assignment_request_body, 'CustomEntityStoreAssignmentRequest') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomEntityStoreAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + custom_entity_store_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deleted a custom entity store assignment. + + Delete a custom entity store assignment by name for a provided subscription. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :param custom_entity_store_assignment_name: Name of the custom entity store assignment. + Generated name is GUID. + :type custom_entity_store_assignment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'customEntityStoreAssignmentName': self._serialize.url("custom_entity_store_assignment_name", custom_entity_store_assignment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomEntityStoreAssignmentsListResult"] + """List custom entity store assignments in a subscription and a resource group. + + List custom entity store assignments by a provided subscription and resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomEntityStoreAssignmentsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.CustomEntityStoreAssignmentsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignmentsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomEntityStoreAssignmentsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomEntityStoreAssignmentsListResult"] + """List custom entity store assignments in a subscription. + + List custom entity store assignments by provided subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomEntityStoreAssignmentsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.security.models.CustomEntityStoreAssignmentsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomEntityStoreAssignmentsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomEntityStoreAssignmentsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments'} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_information_protection_policies_operations.py index 891af46bac01..0fe614a507ab 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_information_protection_policies_operations.py @@ -48,7 +48,7 @@ def __init__(self, client, config, serializer, deserializer): def get( self, scope, # type: str - information_protection_policy_name, # type: Union[str, "_models.Enum15"] + information_protection_policy_name, # type: Union[str, "_models.Enum19"] **kwargs # type: Any ): # type: (...) -> "_models.InformationProtectionPolicy" @@ -59,7 +59,7 @@ def get( (/providers/Microsoft.Management/managementGroups/mgName). :type scope: str :param information_protection_policy_name: Name of the information protection policy. - :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum15 + :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum19 :keyword callable cls: A custom type or function that will be passed the direct response :return: InformationProtectionPolicy, or the result of cls(response) :rtype: ~azure.mgmt.security.models.InformationProtectionPolicy @@ -108,7 +108,7 @@ def get( def create_or_update( self, scope, # type: str - information_protection_policy_name, # type: Union[str, "_models.Enum15"] + information_protection_policy_name, # type: Union[str, "_models.Enum19"] information_protection_policy, # type: "_models.InformationProtectionPolicy" **kwargs # type: Any ): @@ -120,7 +120,7 @@ def create_or_update( (/providers/Microsoft.Management/managementGroups/mgName). :type scope: str :param information_protection_policy_name: Name of the information protection policy. - :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum15 + :type information_protection_policy_name: str or ~azure.mgmt.security.models.Enum19 :param information_protection_policy: Information protection policy. :type information_protection_policy: ~azure.mgmt.security.models.InformationProtectionPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_settings_operations.py index 6d8ccf6bd044..a23bdcac7ec0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_settings_operations.py @@ -114,14 +114,14 @@ def get_next(next_link=None): def get( self, - setting_name, # type: Union[str, "_models.Enum69"] + setting_name, # type: Union[str, "_models.Enum75"] **kwargs # type: Any ): # type: (...) -> "_models.Setting" """Settings of different configurations in security center. :param setting_name: The name of the setting. - :type setting_name: str or ~azure.mgmt.security.models.Enum69 + :type setting_name: str or ~azure.mgmt.security.models.Enum75 :keyword callable cls: A custom type or function that will be passed the direct response :return: Setting, or the result of cls(response) :rtype: ~azure.mgmt.security.models.Setting @@ -169,7 +169,7 @@ def get( def update( self, - setting_name, # type: Union[str, "_models.Enum69"] + setting_name, # type: Union[str, "_models.Enum75"] setting, # type: "_models.Setting" **kwargs # type: Any ): @@ -177,7 +177,7 @@ def update( """updating settings about different configurations in security center. :param setting_name: The name of the setting. - :type setting_name: str or ~azure.mgmt.security.models.Enum69 + :type setting_name: str or ~azure.mgmt.security.models.Enum75 :param setting: Setting object. :type setting: ~azure.mgmt.security.models.Setting :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_tasks_operations.py index 387baf6aafbd..96ad0bfa1899 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_tasks_operations.py @@ -249,7 +249,7 @@ def get_subscription_level_task( def update_subscription_level_task_state( self, task_name, # type: str - task_update_action_type, # type: Union[str, "_models.Enum13"] + task_update_action_type, # type: Union[str, "_models.Enum17"] **kwargs # type: Any ): # type: (...) -> None @@ -258,7 +258,7 @@ def update_subscription_level_task_state( :param task_name: Name of the task object, will be a GUID. :type task_name: str :param task_update_action_type: Type of the action to do on the task. - :type task_update_action_type: str or ~azure.mgmt.security.models.Enum13 + :type task_update_action_type: str or ~azure.mgmt.security.models.Enum17 :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -446,7 +446,7 @@ def update_resource_group_level_task_state( self, resource_group_name, # type: str task_name, # type: str - task_update_action_type, # type: Union[str, "_models.Enum13"] + task_update_action_type, # type: Union[str, "_models.Enum17"] **kwargs # type: Any ): # type: (...) -> None @@ -458,7 +458,7 @@ def update_resource_group_level_task_state( :param task_name: Name of the task object, will be a GUID. :type task_name: str :param task_update_action_type: Type of the action to do on the task. - :type task_update_action_type: str or ~azure.mgmt.security.models.Enum13 + :type task_update_action_type: str or ~azure.mgmt.security.models.Enum17 :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None