Skip to content

Commit

Permalink
[AutoRelease] t2-securityinsight-2022-12-27-12951(can only be merged …
Browse files Browse the repository at this point in the history
…by SDK owner) (#28070)

* code and test

* fix readme

Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) <[email protected]>
  • Loading branch information
azure-sdk and Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) authored Dec 28, 2022
1 parent 88cf04d commit 98c6e39
Show file tree
Hide file tree
Showing 265 changed files with 16,206 additions and 2,327 deletions.
20 changes: 20 additions & 0 deletions sdk/securityinsight/azure-mgmt-securityinsight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Release History

## 2.0.0b2 (2022-12-27)

### Features Added

- Added operation group GetOperations
- Added operation group GetRecommendationsOperations
- Added operation group IncidentTasksOperations
- Added operation group UpdateOperations
- Model AlertDetailsOverride has a new parameter alert_dynamic_properties
- Model NrtAlertRule has a new parameter sentinel_entities_mappings
- Model NrtAlertRuleTemplate has a new parameter sentinel_entities_mappings
- Model NrtAlertRuleTemplateProperties has a new parameter sentinel_entities_mappings
- Model QueryBasedAlertRuleTemplateProperties has a new parameter sentinel_entities_mappings
- Model ScheduledAlertRule has a new parameter sentinel_entities_mappings
- Model ScheduledAlertRuleCommonProperties has a new parameter sentinel_entities_mappings
- Model ScheduledAlertRuleProperties has a new parameter sentinel_entities_mappings
- Model ScheduledAlertRuleTemplate has a new parameter sentinel_entities_mappings
- Model SecurityAlertTimelineItem has a new parameter intent
- Model SecurityAlertTimelineItem has a new parameter techniques

## 2.0.0b1 (2022-09-29)

### Features Added
Expand Down
49 changes: 42 additions & 7 deletions sdk/securityinsight/azure-mgmt-securityinsight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release](

_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

# Usage
## Getting started

### Prerequisites

To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)

For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Security Insight Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
- Python 3.7+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

# Provide Feedback
```bash
pip install azure-mgmt-securityinsight
pip install azure-identity
```

### Authentication

By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.

With above configuration, client can be authenticated by following code:

```python
from azure.identity import DefaultAzureCredential
from azure.mgmt.securityinsight import SecurityInsights
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = SecurityInsights(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Examples


Code samples for this package can be found at [Security Insight Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


## Troubleshooting

## Next steps

## Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
Expand Down
12 changes: 6 additions & 6 deletions sdk/securityinsight/azure-mgmt-securityinsight/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.8.4",
"commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.1.6",
"@autorest/modelerfour@4.23.5"
"@autorest/python@6.2.7",
"@autorest/modelerfour@4.24.3"
],
"commit": "e24bbf6a66cb0a19c072c6f15cee163acbd7acf7",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/securityinsights/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.8.4 --version-tolerant=False",
"autorest_command": "autorest specification/securityinsights/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/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/securityinsights/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["SecurityInsights"]
__all__ = [
"SecurityInsights",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,6 +15,11 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -29,14 +35,14 @@ class SecurityInsightsConfiguration(Configuration): # pylint: disable=too-many-
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(SecurityInsightsConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str
api_version: Literal["2022-12-01-preview"] = kwargs.pop("api_version", "2022-12-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand All @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
kwargs.setdefault("sdk_moniker", "mgmt-securityinsight/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from . import models
from . import models as _models
from ._configuration import SecurityInsightsConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
Expand All @@ -33,9 +33,12 @@
EntityQueryTemplatesOperations,
EntityRelationsOperations,
FileImportsOperations,
GetOperations,
GetRecommendationsOperations,
IPGeodataOperations,
IncidentCommentsOperations,
IncidentRelationsOperations,
IncidentTasksOperations,
IncidentsOperations,
MetadataOperations,
OfficeConsentsOperations,
Expand All @@ -48,6 +51,7 @@
ThreatIntelligenceIndicatorMetricsOperations,
ThreatIntelligenceIndicatorOperations,
ThreatIntelligenceIndicatorsOperations,
UpdateOperations,
WatchlistItemsOperations,
WatchlistsOperations,
)
Expand Down Expand Up @@ -101,13 +105,22 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to
:vartype incident_comments: azure.mgmt.securityinsight.operations.IncidentCommentsOperations
:ivar incident_relations: IncidentRelationsOperations operations
:vartype incident_relations: azure.mgmt.securityinsight.operations.IncidentRelationsOperations
:ivar incident_tasks: IncidentTasksOperations operations
:vartype incident_tasks: azure.mgmt.securityinsight.operations.IncidentTasksOperations
:ivar metadata: MetadataOperations operations
:vartype metadata: azure.mgmt.securityinsight.operations.MetadataOperations
:ivar office_consents: OfficeConsentsOperations operations
:vartype office_consents: azure.mgmt.securityinsight.operations.OfficeConsentsOperations
:ivar sentinel_onboarding_states: SentinelOnboardingStatesOperations operations
:vartype sentinel_onboarding_states:
azure.mgmt.securityinsight.operations.SentinelOnboardingStatesOperations
:ivar get_recommendations: GetRecommendationsOperations operations
:vartype get_recommendations:
azure.mgmt.securityinsight.operations.GetRecommendationsOperations
:ivar get: GetOperations operations
:vartype get: azure.mgmt.securityinsight.operations.GetOperations
:ivar update: UpdateOperations operations
:vartype update: azure.mgmt.securityinsight.operations.UpdateOperations
:ivar security_ml_analytics_settings: SecurityMLAnalyticsSettingsOperations operations
:vartype security_ml_analytics_settings:
azure.mgmt.securityinsight.operations.SecurityMLAnalyticsSettingsOperations
Expand Down Expand Up @@ -144,7 +157,7 @@ class SecurityInsights: # pylint: disable=client-accepts-api-version-keyword,to
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand All @@ -161,7 +174,7 @@ def __init__(
self._config = SecurityInsightsConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
Expand Down Expand Up @@ -202,11 +215,17 @@ def __init__(
self.incident_relations = IncidentRelationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.incident_tasks = IncidentTasksOperations(self._client, self._config, self._serialize, self._deserialize)
self.metadata = MetadataOperations(self._client, self._config, self._serialize, self._deserialize)
self.office_consents = OfficeConsentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.sentinel_onboarding_states = SentinelOnboardingStatesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.get_recommendations = GetRecommendationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize)
self.update = UpdateOperations(self._client, self._config, self._serialize, self._deserialize)
self.security_ml_analytics_settings = SecurityMLAnalyticsSettingsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down Expand Up @@ -254,15 +273,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> SecurityInsights
def __enter__(self) -> "SecurityInsights":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)
Loading

0 comments on commit 98c6e39

Please sign in to comment.