Skip to content

Commit

Permalink
CodeGen from PR 18045 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
New API version to Microsoft.Security 2021-11-01 (Azure#18045)

* Adds base for updating Microsoft.Security from version stable/2021-01-01 to version 2021-11-01

* Updates readme

* Updates API version in new specs and examples

* New API version to Microsoft.Security

pick 5459ef18a7 New API version to Microsoft.Security
pick c8462f9c60 [Microsoft.Security alerts] fix examples/Alerts/SimulateAlerts_example.json
pick b5f4550d6b [Microsoft.Security alerts] add missing API to readme.md

* [Microsoft.Security alerts] fix examples/Alerts/SimulateAlerts_example.json

* [Microsoft.Security alerts] add missing API to readme.md

* Fix readme.md file after rebase

* Removing "x-ms-long-running-operation" header

* Setting target package back to package-composite-v3

* Updating securityContacts.json to the latest version

* Reverting securityContacts.json to equal main, should be updated by the relevant team

Co-authored-by: Nitsan Bracha <nibracha@microsoft.com>
  • Loading branch information
SDKAuto and Nitsan Bracha committed Mar 22, 2022
1 parent 005b707 commit ba973cd
Show file tree
Hide file tree
Showing 116 changed files with 23,938 additions and 22,553 deletions.
10 changes: 5 additions & 5 deletions sdk/security/azure-mgmt-security/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.4.5",
"autorest": "3.7.2",
"use": [
"@autorest/python@5.8.4",
"@autorest/modelerfour@4.19.2"
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "a8719243647b7c6d06ed287483d788808de7ecab",
"commit": "69e8e7f15c262df57417fd2b436ac1092b66c588",
"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",
"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 --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
"readme": "specification/security/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['SecurityCenter']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._patch.py` is used for handwritten extensions to the generated code
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
from ._patch import patch_sdk
patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


Expand All @@ -31,29 +29,22 @@ class SecurityCenterConfiguration(Configuration):
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Azure subscription ID.
:type subscription_id: str
:param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations.
:type asc_location: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
asc_location, # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(SecurityCenterConfiguration, self).__init__(**kwargs)
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.")
if asc_location is None:
raise ValueError("Parameter 'asc_location' must not be None.")
super(SecurityCenterConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.asc_location = asc_location
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-security/{}'.format(VERSION))
self._configure(**kwargs)
Expand All @@ -73,4 +64,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
43 changes: 17 additions & 26 deletions sdk/security/azure-mgmt-security/azure/mgmt/security/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"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", "2019-01-01", "2019-01-01-preview", "2019-08-01", "2020-01-01", "2020-01-01-preview", "2020-07-01-preview", "2021-01-15-preview", "2021-05-01-preview", "2021-06-01", "2021-07-01", "2021-07-01-preview", "2021-10-01-preview", "2021-11-01", "2022-03-01"],
"client": {
"name": "SecurityCenter",
"filename": "_security_center",
"description": "API spec for Microsoft.Security (Azure Security Center) resource provider.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
},
"global_parameters": {
"sync": {
Expand All @@ -26,12 +26,6 @@
"description": "Azure subscription ID.",
"docstring_type": "str",
"required": true
},
"asc_location": {
"signature": "asc_location, # type: str",
"description": "The location where ASC stores the data of the subscription. can be retrieved from Get locations.",
"docstring_type": "str",
"required": true
}
},
"async": {
Expand All @@ -46,17 +40,11 @@
"description": "Azure subscription ID.",
"docstring_type": "str",
"required": true
},
"asc_location": {
"signature": "asc_location: str,",
"description": "The location where ASC stores the data of the subscription. can be retrieved from Get locations.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id, asc_location",
"call": "credential, subscription_id",
"service_client_specific": {
"sync": {
"api_version": {
Expand All @@ -66,7 +54,7 @@
"required": false
},
"base_url": {
"signature": "base_url=None, # type: Optional[str]",
"signature": "base_url=\"https://management.azure.com\", # type: str",
"description": "Service URL",
"docstring_type": "str",
"required": false
Expand All @@ -86,7 +74,7 @@
"required": false
},
"base_url": {
"signature": "base_url: Optional[str] = None,",
"signature": "base_url: str = \"https://management.azure.com\",",
"description": "Service URL",
"docstring_type": "str",
"required": false
Expand All @@ -103,13 +91,15 @@
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null,
"sync_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\": [\"TokenCredential\"]}}}",
"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\"]}}}"
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"mde_onboardings": "MdeOnboardingsOperations",
"custom_assessment_automations": "CustomAssessmentAutomationsOperations",
"custom_entity_store_assignments": "CustomEntityStoreAssignmentsOperations",
"compliance_results": "ComplianceResultsOperations",
"pricings": "PricingsOperations",
"advanced_threat_protection": "AdvancedThreatProtectionOperations",
Expand Down Expand Up @@ -154,6 +144,7 @@
"alerts": "AlertsOperations",
"settings": "SettingsOperations",
"ingestion_settings": "IngestionSettingsOperations",
"software_inventories": "SoftwareInventoriesOperations"
"software_inventories": "SoftwareInventoriesOperations",
"security_connectors": "SecurityConnectorsOperations"
}
}
31 changes: 31 additions & 0 deletions sdk/security/azure-mgmt-security/azure/mgmt/security/_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# --------------------------------------------------------------------------

# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
pass
Loading

0 comments on commit ba973cd

Please sign in to comment.