Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[AutoPR azure-mgmt-security] Add Swagger for Defender for Storage new on-demand malware scan API #8901

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 8 additions & 7 deletions sdk/security/azure-mgmt-security/_meta.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"commit": "5485fc4eb11debd9cc8d92ec156b573998aae977",
"commit": "68dcaa865d447f78c7b881d2b0a22bb490912be8",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
"@autorest/python@6.13.16",
"@autorest/python@6.19.0",
"@autorest/modelerfour@4.27.0"
],
"autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/security/resource-manager/readme.md",
"package-2023-11-15": "2023-09-12 12:04:57 -0700 32c178f2467f792a322f56174be244135d2c907f Microsoft.Security/stable/2023-11-15/apiCollections.json",
"package-preview-2023-03-only": "2023-03-23 11:34:42 +0200 2db2beee2fed67b08d273fdac7a51aba02ac2f80 Microsoft.Security/preview/2023-03-01-preview/securityConnectors.json",
"package-preview-2023-02-only": "2023-03-10 09:31:28 +0200 a2e2617050e68ae1c445db565076c5a7f42ebad4 Microsoft.Security/preview/2023-02-01-preview/healthReports.json",
"package-preview-2023-01-only": "2023-03-28 11:35:29 +0300 0e2c3d175e126284c5db1d3099b61e46e462fb74 Microsoft.Security/preview/2023-01-01-preview/securityOperators.json",
"package-2023-01": "2023-03-27 17:16:35 +0300 efd2b52bcf2b06e174f7008b2728f70ee7f972bd Microsoft.Security/stable/2023-01-01/pricings.json",
"package-preview-2022-12": "2023-09-12 22:01:54 +0300 b09b155f738b4178bcfe820f54f8702a94eb9d90 Microsoft.Security/preview/2022-12-01-preview/defenderForStorageSettings.json",
"package-preview-2022-12": "2024-07-01 22:47:55 +0300 be978e57137bfd799e350575c0fdd53511f0e4a8 Microsoft.Security/preview/2022-12-01-preview/defenderForStorageSettings.json",
"package-preview-2022-08": "2022-09-20 03:45:43 +0300 9000eea3aa90071c2814f663dd763d7fc1668bed Microsoft.Security/preview/2022-08-01-preview/securityConnectors.json",
"package-preview-2022-07": "2022-11-01 04:47:16 +0200 312544c27464f61bf9639924099d4238bdfa1d71 Microsoft.Security/preview/2022-07-01-preview/applications.json",
"package-2022-05": "2022-06-09 12:47:24 +0300 d006e1d15d8fe19a6c558861dd5bba6b7baa8dd8 Microsoft.Security/stable/2022-05-01/settings.json",
Expand All @@ -38,11 +38,12 @@
"package-2017-08-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2017-08-01/complianceResults.json",
"package-2017-08-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2017-08-01-preview/securityContacts.json",
"package-2015-06-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2015-06-01-preview/tasks.json",
"package-2024-04": "fatal: invalid object name 'from'. from: securityConnectorsDevOps.json",
"package-2024-04": "2024-04-03 19:34:30 -0700 378a5fdb7e92454442ab647a856bee4f717f526b Microsoft.Security/stable/2024-04-01/securityConnectorsDevOps.json",
"package-2024-01": "2023-12-13 05:43:47 +0200 b52464f520b77222ac8b0bdeb80a030c0fdf5b1b Microsoft.Security/stable/2024-01-01/pricings.json",
"package-preview-2023-10": "2023-10-27 04:43:14 +0300 2eb036ae2fcf0dab9bbc49f3aeadb7847c953f9a Microsoft.Security/preview/2023-10-01-preview/securityConnectors.json",
"package-preview-2023-09": "fatal: invalid object name 'from'. from: securityConnectorsDevOps.json",
"package-preview-2023-09": "2023-08-21 20:02:49 -0700 64ffad1a3042017e07f8a47df17d6acaa2c1e609 Microsoft.Security/preview/2023-09-01-preview/securityConnectorsDevOps.json",
"package-2023-05": "2023-06-07 22:07:01 -0700 483cdd30332340a14e3d09eafdc1a18f3ba4324c Microsoft.Security/stable/2023-05-01/ServerVulnerabilityAssessmentsSettings.json",
"package-preview-2023-05": "2023-05-29 05:03:56 +0300 be02493774ad6450166fa3383c109027658567b4 Microsoft.Security/preview/2023-05-01-preview/healthReports.json",
"package-preview-2023-02-15-only": "2024-03-29 06:00:35 +0300 7fa04c618c9a280dba63303b0034fa9f0aabab1f Microsoft.Security/preview/2023-02-15-preview/sensitivitySettings.json"
"package-preview-2023-02-15-only": "2024-03-29 06:00:35 +0300 7fa04c618c9a280dba63303b0034fa9f0aabab1f Microsoft.Security/preview/2023-02-15-preview/sensitivitySettings.json",
"package-2024-08": "2024-09-12 11:55:45 +0300 317b99705871df3a32c68889ab7858a0c88d89f0 Microsoft.Security/stable/2024-08-01/standardAssignments.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ class SecurityCenterConfiguration:

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
"""

def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
):
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-security/{}'.format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# --------------------------------------------------------------------------

from typing import Any, Optional, TYPE_CHECKING
from typing_extensions import Self

from azure.core.pipeline import policies
from azure.mgmt.core import ARMPipelineClient
Expand Down Expand Up @@ -44,8 +45,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient):

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
:param base_url: Service URL
Expand All @@ -55,13 +54,11 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient):
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2024-04-01'
DEFAULT_API_VERSION = '2024-08-01'
_PROFILE_TAG = "azure.mgmt.security.SecurityCenter"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'adaptive_application_controls': '2020-01-01',
'adaptive_network_hardenings': '2020-01-01',
'advanced_threat_protection': '2019-01-01',
'alerts': '2022-01-01',
'alerts_suppression_rules': '2019-01-01-preview',
Expand All @@ -76,15 +73,25 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient):
'assessments_metadata': '2021-06-01',
'auto_provisioning_settings': '2017-08-01-preview',
'automations': '2019-01-01-preview',
'azure_dev_ops_orgs': '2024-04-01',
'azure_dev_ops_projects': '2024-04-01',
'azure_dev_ops_repos': '2024-04-01',
'compliance_results': '2017-08-01',
'compliances': '2017-08-01-preview',
'connectors': '2020-01-01-preview',
'custom_assessment_automations': '2021-07-01-preview',
'custom_entity_store_assignments': '2021-07-01-preview',
'defender_for_storage': '2022-12-01-preview',
'dev_ops_configurations': '2024-04-01',
'dev_ops_operation_results': '2024-04-01',
'device_security_groups': '2019-08-01',
'discovered_security_solutions': '2020-01-01',
'external_security_solutions': '2020-01-01',
'git_hub_owners': '2024-04-01',
'git_hub_repos': '2024-04-01',
'git_lab_groups': '2024-04-01',
'git_lab_projects': '2024-04-01',
'git_lab_subgroups': '2024-04-01',
'governance_assignments': '2022-01-01-preview',
'governance_rules': '2022-01-01-preview',
'health_report': '2023-02-01-preview',
Expand Down Expand Up @@ -131,15 +138,14 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient):
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
api_version: Optional[str]=None,
base_url: str = "https://management.azure.com",
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
if api_version:
kwargs.setdefault('api_version', api_version)
self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs)
self._config = SecurityCenterConfiguration(credential, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand Down Expand Up @@ -209,6 +215,7 @@ def models(cls, api_version=DEFAULT_API_VERSION):
* 2023-11-15: :mod:`v2023_11_15.models<azure.mgmt.security.v2023_11_15.models>`
* 2024-01-01: :mod:`v2024_01_01.models<azure.mgmt.security.v2024_01_01.models>`
* 2024-04-01: :mod:`v2024_04_01.models<azure.mgmt.security.v2024_04_01.models>`
* 2024-08-01: :mod:`v2024_08_01.models<azure.mgmt.security.v2024_08_01.models>`
"""
if api_version == '2015-06-01-preview':
from .v2015_06_01_preview import models
Expand Down Expand Up @@ -321,36 +328,11 @@ def models(cls, api_version=DEFAULT_API_VERSION):
elif api_version == '2024-04-01':
from .v2024_04_01 import models
return models
elif api_version == '2024-08-01':
from .v2024_08_01 import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def adaptive_application_controls(self):
"""Instance depends on the API version:

* 2020-01-01: :class:`AdaptiveApplicationControlsOperations<azure.mgmt.security.v2020_01_01.operations.AdaptiveApplicationControlsOperations>`
"""
api_version = self._get_api_version('adaptive_application_controls')
if api_version == '2020-01-01':
from .v2020_01_01.operations import AdaptiveApplicationControlsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'adaptive_application_controls'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def adaptive_network_hardenings(self):
"""Instance depends on the API version:

* 2020-01-01: :class:`AdaptiveNetworkHardeningsOperations<azure.mgmt.security.v2020_01_01.operations.AdaptiveNetworkHardeningsOperations>`
"""
api_version = self._get_api_version('adaptive_network_hardenings')
if api_version == '2020-01-01':
from .v2020_01_01.operations import AdaptiveNetworkHardeningsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'adaptive_network_hardenings'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def advanced_threat_protection(self):
"""Instance depends on the API version:
Expand Down Expand Up @@ -677,6 +659,20 @@ def custom_entity_store_assignments(self):
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def custom_recommendations(self):
"""Instance depends on the API version:

* 2024-08-01: :class:`CustomRecommendationsOperations<azure.mgmt.security.v2024_08_01.operations.CustomRecommendationsOperations>`
"""
api_version = self._get_api_version('custom_recommendations')
if api_version == '2024-08-01':
from .v2024_08_01.operations import CustomRecommendationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'custom_recommendations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def defender_for_storage(self):
"""Instance depends on the API version:
Expand Down Expand Up @@ -1257,6 +1253,20 @@ def security_solutions_reference_data(self):
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def security_standards(self):
"""Instance depends on the API version:

* 2024-08-01: :class:`SecurityStandardsOperations<azure.mgmt.security.v2024_08_01.operations.SecurityStandardsOperations>`
"""
api_version = self._get_api_version('security_standards')
if api_version == '2024-08-01':
from .v2024_08_01.operations import SecurityStandardsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'security_standards'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def sensitivity_settings(self):
"""Instance depends on the API version:
Expand Down Expand Up @@ -1384,6 +1394,20 @@ def sql_vulnerability_assessment_scans(self):
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def standard_assignments(self):
"""Instance depends on the API version:

* 2024-08-01: :class:`StandardAssignmentsOperations<azure.mgmt.security.v2024_08_01.operations.StandardAssignmentsOperations>`
"""
api_version = self._get_api_version('standard_assignments')
if api_version == '2024-08-01':
from .v2024_08_01.operations import StandardAssignmentsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'standard_assignments'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version)

@property
def sub_assessments(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def _json_attemp(data):
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise DeserializationError("XML is invalid") from err
elif content_type.startswith("text/"):
return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))

@classmethod
Expand Down Expand Up @@ -1447,7 +1449,7 @@ def _deserialize(self, target_obj, data):
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)

if data is None:
if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@ class SecurityCenterConfiguration:

:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
"""

def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-security/{}'.format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
Expand Down
Loading