Skip to content

Commit f78ab13

Browse files
authored
[T2] security (#14953)
1 parent 16225f8 commit f78ab13

File tree

125 files changed

+43875
-10008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+43875
-10008
lines changed

sdk/security/azure-mgmt-security/CHANGELOG.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,142 @@
11
# Release History
22

3+
## 1.0.0b1 (2020-11-02)
4+
5+
This is beta preview version.
6+
7+
This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming).
8+
9+
**General breaking changes**
10+
11+
- Credential system has been completly revamped:
12+
13+
- `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/
14+
- `credentials` parameter has been renamed `credential`
15+
16+
- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of
17+
supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)
18+
- You can't import a `version` module anymore, use `__version__` instead
19+
- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`.
20+
- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed).
21+
- Most of the operation kwarg have changed. Some of the most noticeable:
22+
23+
- `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user
24+
- For a complete set of
25+
supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies)
26+
27+
**General new features**
28+
29+
- Type annotations support using `typing`. SDKs are mypy ready.
30+
- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client.
31+
- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview.
32+
33+
## 0.5.0 (2020-10-29)
34+
35+
**Features**
36+
37+
- Model SecureScoreControlDetails has a new parameter weight
38+
- Model SecureScoreControlDetails has a new parameter percentage
39+
- Model SecureScoreItem has a new parameter weight
40+
- Model SecureScoreItem has a new parameter percentage
41+
- Model SecureScoreControlScore has a new parameter percentage
42+
- Added operation AlertsOperations.get_resource_group_level
43+
- Added operation AlertsOperations.get_subscription_level
44+
- Added operation AlertsOperations.update_resource_group_level_state_to_resolve
45+
- Added operation AlertsOperations.list_subscription_level_by_region
46+
- Added operation AlertsOperations.list_resource_group_level_by_region
47+
- Added operation AlertsOperations.update_subscription_level_state_to_resolve
48+
- Added operation AlertsOperations.update_subscription_level_state_to_dismiss
49+
- Added operation AlertsOperations.update_resource_group_level_state_to_dismiss
50+
- Added operation AlertsOperations.update_subscription_level_state_to_activate
51+
- Added operation AlertsOperations.update_resource_group_level_state_to_activate
52+
- Added operation group IotRecommendationTypesOperations
53+
- Added operation group ConnectorsOperations
54+
- Added operation group DeviceOperations
55+
- Added operation group DevicesForSubscriptionOperations
56+
- Added operation group IotDefenderSettingsOperations
57+
- Added operation group IotAlertsOperations
58+
- Added operation group DevicesForHubOperations
59+
- Added operation group IotSensorsOperations
60+
- Added operation group IotRecommendationsOperations
61+
- Added operation group SecuritySolutionsOperations
62+
- Added operation group SecuritySolutionsReferenceDataOperations
63+
- Added operation group OnPremiseIotSensorsOperations
64+
- Added operation group IotAlertTypesOperations
65+
66+
**Breaking changes**
67+
68+
- Model Alert has a new signature
69+
- Removed operation AlertsOperations.list_subscription_level_alerts_by_region
70+
- Removed operation AlertsOperations.update_resource_group_level_alert_state_to_dismiss
71+
- Removed operation AlertsOperations.get_resource_group_level_alerts
72+
- Removed operation AlertsOperations.update_subscription_level_alert_state_to_reactivate
73+
- Removed operation AlertsOperations.get_subscription_level_alert
74+
- Removed operation AlertsOperations.list_resource_group_level_alerts_by_region
75+
- Removed operation AlertsOperations.update_resource_group_level_alert_state_to_reactivate
76+
- Removed operation AlertsOperations.update_subscription_level_alert_state_to_dismiss
77+
78+
## 0.4.1 (2020-06-12)
79+
80+
**Bugfixes**
81+
82+
- skip url-encoding for resource id
83+
84+
## 0.4.0 (2020-06-05)
85+
86+
**Features**
87+
88+
- Model IoTSecuritySolutionModel has a new parameter unmasked_ip_logging_status
89+
- Model InformationProtectionPolicy has a new parameter version
90+
- Model JitNetworkAccessRequest has a new parameter justification
91+
- Model SensitivityLabel has a new parameter description
92+
- Model SensitivityLabel has a new parameter rank
93+
- Model InformationType has a new parameter description
94+
- Model AppWhitelistingGroup has a new parameter protection_mode
95+
- Model JitNetworkAccessPolicyInitiateRequest has a new parameter justification
96+
- Model VmRecommendation has a new parameter enforcement_support
97+
- Model IoTSecurityAggregatedAlert has a new parameter top_devices_list
98+
- Added operation AdaptiveApplicationControlsOperations.delete
99+
- Added operation AlertsOperations.update_resource_group_level_alert_state_to_dismiss
100+
- Added operation AlertsOperations.update_subscription_level_alert_state_to_dismiss
101+
- Added operation AlertsOperations.update_subscription_level_alert_state_to_reactivate
102+
- Added operation AlertsOperations.update_resource_group_level_alert_state_to_reactivate
103+
- Added operation IotSecuritySolutionOperations.list_by_subscription
104+
- Added operation IotSecuritySolutionOperations.list_by_resource_group
105+
- Added operation IotSecuritySolutionOperations.create_or_update
106+
- Added operation group SecureScoreControlDefinitionsOperations
107+
- Added operation group AssessmentsMetadataOperations
108+
- Added operation group SecureScoreControlsOperations
109+
- Added operation group AlertsSuppressionRulesOperations
110+
- Added operation group IotSecuritySolutionsAnalyticsAggregatedAlertOperations
111+
- Added operation group SubAssessmentsOperations
112+
- Added operation group AutomationsOperations
113+
- Added operation group IotSecuritySolutionsAnalyticsRecommendationOperations
114+
- Added operation group SecureScoresOperations
115+
- Added operation group IotSecuritySolutionAnalyticsOperations
116+
- Added operation group AdaptiveNetworkHardeningsOperations
117+
- Added operation group AssessmentsOperations
118+
- Added operation group DeviceSecurityGroupsOperations
119+
120+
**Breaking changes**
121+
122+
- Operation SettingsOperations.update has a new signature
123+
- Operation AlertsOperations.list has a new signature
124+
- Operation AlertsOperations.list_by_resource_group has a new signature
125+
- Operation AlertsOperations.list_resource_group_level_alerts_by_region has a new signature
126+
- Operation AlertsOperations.list_subscription_level_alerts_by_region has a new signature
127+
- Operation JitNetworkAccessPoliciesOperations.initiate has a new signature
128+
- Operation InformationProtectionPoliciesOperations.create_or_update has a new signature
129+
- Removed operation AlertsOperations.update_resource_group_level_alert_state
130+
- Removed operation AlertsOperations.update_subscription_level_alert_state
131+
- Removed operation IotSecuritySolutionOperations.create
132+
- Removed operation group IoTSecuritySolutionsResourceGroupOperations
133+
- Removed operation group IoTSecuritySolutionsAnalyticsRecommendationsOperations
134+
- Removed operation group IoTSecuritySolutionsAnalyticsRecommendationOperations
135+
- Removed operation group IoTSecuritySolutionsOperations
136+
- Removed operation group IoTSecuritySolutionsAnalyticsAggregatedAlertsOperations
137+
- Removed operation group IoTSecuritySolutionsAnalyticsAggregatedAlertOperations
138+
- Removed operation group IoTSecuritySolutionsAnalyticsOperations
139+
3140
## 0.3.0 (2019-08-01)
4141

5142
**Features**

sdk/security/azure-mgmt-security/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ For a more complete set of Azure libraries, see the
1616

1717
## Usage
1818

19-
For code examples, see [Security Center
20-
Management](https://docs.microsoft.com/python/api/overview/azure/) on
21-
docs.microsoft.com.
19+
20+
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
21+
22+
23+
24+
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
25+
Code samples for this package can be found at [Security Center Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
26+
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
27+
2228

2329
## Provide Feedback
2430

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._configuration import SecurityCenterConfiguration
139
from ._security_center import SecurityCenter
14-
__all__ = ['SecurityCenter', 'SecurityCenterConfiguration']
15-
16-
from .version import VERSION
10+
from ._version import VERSION
1711

1812
__version__ = VERSION
13+
__all__ = ['SecurityCenter']
1914

15+
try:
16+
from ._patch import patch_sdk # type: ignore
17+
patch_sdk()
18+
except ImportError:
19+
pass
Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,76 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
11-
from msrestazure import AzureConfiguration
128

13-
from .version import VERSION
9+
from typing import TYPE_CHECKING
1410

11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
15+
from ._version import VERSION
16+
17+
if TYPE_CHECKING:
18+
# pylint: disable=unused-import,ungrouped-imports
19+
from typing import Any
20+
21+
from azure.core.credentials import TokenCredential
22+
23+
24+
class SecurityCenterConfiguration(Configuration):
25+
"""Configuration for SecurityCenter.
1526
16-
class SecurityCenterConfiguration(AzureConfiguration):
17-
"""Configuration for SecurityCenter
1827
Note that all parameters used to create this instance are saved as instance
1928
attributes.
2029
21-
:param credentials: Credentials needed for the client to connect to Azure.
22-
:type credentials: :mod:`A msrestazure Credentials
23-
object<msrestazure.azure_active_directory>`
24-
:param subscription_id: Azure subscription ID
30+
:param credential: Credential needed for the client to connect to Azure.
31+
:type credential: ~azure.core.credentials.TokenCredential
32+
:param subscription_id: Azure subscription ID.
2533
:type subscription_id: str
26-
:param asc_location: The location where ASC stores the data of the
27-
subscription. can be retrieved from Get locations
34+
:param asc_location: The location where ASC stores the data of the subscription. can be retrieved from Get locations.
2835
:type asc_location: str
29-
:param str base_url: Service URL
3036
"""
3137

3238
def __init__(
33-
self, credentials, subscription_id, asc_location, base_url=None):
34-
35-
if credentials is None:
36-
raise ValueError("Parameter 'credentials' must not be None.")
39+
self,
40+
credential, # type: "TokenCredential"
41+
subscription_id, # type: str
42+
asc_location, # type: str
43+
**kwargs # type: Any
44+
):
45+
# type: (...) -> None
46+
if credential is None:
47+
raise ValueError("Parameter 'credential' must not be None.")
3748
if subscription_id is None:
3849
raise ValueError("Parameter 'subscription_id' must not be None.")
3950
if asc_location is None:
4051
raise ValueError("Parameter 'asc_location' must not be None.")
41-
if not base_url:
42-
base_url = 'https://management.azure.com'
43-
44-
super(SecurityCenterConfiguration, self).__init__(base_url)
45-
46-
# Starting Autorest.Python 4.0.64, make connection pool activated by default
47-
self.keep_alive = True
52+
super(SecurityCenterConfiguration, self).__init__(**kwargs)
4853

49-
self.add_user_agent('azure-mgmt-security/{}'.format(VERSION))
50-
self.add_user_agent('Azure-SDK-For-Python')
51-
52-
self.credentials = credentials
54+
self.credential = credential
5355
self.subscription_id = subscription_id
5456
self.asc_location = asc_location
57+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
58+
kwargs.setdefault('sdk_moniker', 'mgmt-security/{}'.format(VERSION))
59+
self._configure(**kwargs)
60+
61+
def _configure(
62+
self,
63+
**kwargs # type: Any
64+
):
65+
# type: (...) -> None
66+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
67+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
68+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
69+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
70+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
71+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
72+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
73+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
74+
self.authentication_policy = kwargs.get('authentication_policy')
75+
if self.credential and not self.authentication_policy:
76+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)