Skip to content

Commit

Permalink
CodeGen from PR 18228 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 67d8fc190612ba99f13ace9b8fc867dd947c6c86 into 2abe647120f14bb145968a5543ead8ed51394498
  • Loading branch information
SDKAuto committed Mar 15, 2022
1 parent 14ff5a8 commit daca791
Show file tree
Hide file tree
Showing 108 changed files with 516 additions and 46,659 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/[email protected].2"
"@autorest/python@5.12.0",
"@autorest/[email protected].3"
],
"commit": "a8719243647b7c6d06ed287483d788808de7ecab",
"commit": "0a9b12ca87d14718c0f569503b99592d22d74cbe",
"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/[email protected].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/[email protected].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,23 @@ 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.api_version = "2022-03-01"
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 +65,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)
87 changes: 15 additions & 72 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"],
"chosen_version": "2022-03-01",
"total_api_version_list": ["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,
"has_lro_operations": false,
"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,57 +91,12 @@
"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": {
"compliance_results": "ComplianceResultsOperations",
"pricings": "PricingsOperations",
"advanced_threat_protection": "AdvancedThreatProtectionOperations",
"device_security_groups": "DeviceSecurityGroupsOperations",
"iot_security_solution": "IotSecuritySolutionOperations",
"iot_security_solution_analytics": "IotSecuritySolutionAnalyticsOperations",
"iot_security_solutions_analytics_aggregated_alert": "IotSecuritySolutionsAnalyticsAggregatedAlertOperations",
"iot_security_solutions_analytics_recommendation": "IotSecuritySolutionsAnalyticsRecommendationOperations",
"locations": "LocationsOperations",
"operations": "Operations",
"tasks": "TasksOperations",
"auto_provisioning_settings": "AutoProvisioningSettingsOperations",
"compliances": "CompliancesOperations",
"information_protection_policies": "InformationProtectionPoliciesOperations",
"security_contacts": "SecurityContactsOperations",
"workspace_settings": "WorkspaceSettingsOperations",
"regulatory_compliance_standards": "RegulatoryComplianceStandardsOperations",
"regulatory_compliance_controls": "RegulatoryComplianceControlsOperations",
"regulatory_compliance_assessments": "RegulatoryComplianceAssessmentsOperations",
"sub_assessments": "SubAssessmentsOperations",
"automations": "AutomationsOperations",
"alerts_suppression_rules": "AlertsSuppressionRulesOperations",
"server_vulnerability_assessment": "ServerVulnerabilityAssessmentOperations",
"assessments_metadata": "AssessmentsMetadataOperations",
"assessments": "AssessmentsOperations",
"adaptive_application_controls": "AdaptiveApplicationControlsOperations",
"adaptive_network_hardenings": "AdaptiveNetworkHardeningsOperations",
"allowed_connections": "AllowedConnectionsOperations",
"topology": "TopologyOperations",
"jit_network_access_policies": "JitNetworkAccessPoliciesOperations",
"discovered_security_solutions": "DiscoveredSecuritySolutionsOperations",
"security_solutions_reference_data": "SecuritySolutionsReferenceDataOperations",
"external_security_solutions": "ExternalSecuritySolutionsOperations",
"secure_scores": "SecureScoresOperations",
"secure_score_controls": "SecureScoreControlsOperations",
"secure_score_control_definitions": "SecureScoreControlDefinitionsOperations",
"security_solutions": "SecuritySolutionsOperations",
"connectors": "ConnectorsOperations",
"sql_vulnerability_assessment_scans": "SqlVulnerabilityAssessmentScansOperations",
"sql_vulnerability_assessment_scan_results": "SqlVulnerabilityAssessmentScanResultsOperations",
"sql_vulnerability_assessment_baseline_rules": "SqlVulnerabilityAssessmentBaselineRulesOperations",
"alerts": "AlertsOperations",
"settings": "SettingsOperations",
"ingestion_settings": "IngestionSettingsOperations",
"software_inventories": "SoftwareInventoriesOperations"
"pricings": "PricingsOperations"
}
}
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 daca791

Please sign in to comment.