Skip to content

[AutoPR securityinsights/resource-manager] Add cases aggregation endpoint to SecurityInsights RP swagger spec #4742

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

Merged
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-mgmt-securityinsight/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
3 changes: 3 additions & 0 deletions azure-mgmt-securityinsight/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ 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>`__
section of the project.


.. image:: https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-securityinsight%2FREADME.png
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
from .settings_kind_py3 import SettingsKind
from .ueba_settings_py3 import UebaSettings
from .toggle_settings_py3 import ToggleSettings
from .aggregations_py3 import Aggregations
from .aggregations_kind1_py3 import AggregationsKind1
except (SyntaxError, ImportError):
from .operation_display import OperationDisplay
from .operation import Operation
Expand Down Expand Up @@ -85,6 +87,8 @@
from .settings_kind import SettingsKind
from .ueba_settings import UebaSettings
from .toggle_settings import ToggleSettings
from .aggregations import Aggregations
from .aggregations_kind1 import AggregationsKind1
from .operation_paged import OperationPaged
from .alert_rule_paged import AlertRulePaged
from .action_paged import ActionPaged
Expand All @@ -106,6 +110,7 @@
OSFamily,
SettingKind,
StatusInMcas,
AggregationsKind,
)

__all__ = [
Expand Down Expand Up @@ -146,6 +151,8 @@
'SettingsKind',
'UebaSettings',
'ToggleSettings',
'Aggregations',
'AggregationsKind1',
'OperationPaged',
'AlertRulePaged',
'ActionPaged',
Expand All @@ -166,4 +173,5 @@
'OSFamily',
'SettingKind',
'StatusInMcas',
'AggregationsKind',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Aggregations(Model):
"""The aggregation.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Azure resource Id
:vartype id: str
:ivar type: Azure resource type
:vartype type: str
:ivar name: Azure resource name
:vartype name: str
:param kind: Required. Constant filled by server.
:type kind: str
"""

_validation = {
'id': {'readonly': True},
'type': {'readonly': True},
'name': {'readonly': True},
'kind': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'kind': {'key': 'kind', 'type': 'str'},
}

def __init__(self, **kwargs):
super(Aggregations, self).__init__(**kwargs)
self.id = None
self.type = None
self.name = None
self.kind = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class AggregationsKind1(Model):
"""Describes an Azure resource with kind.

:param kind: The kind of the setting. Possible values include:
'CasesAggregation'
:type kind: str or ~azure.mgmt.securityinsight.models.AggregationsKind
"""

_attribute_map = {
'kind': {'key': 'kind', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AggregationsKind1, self).__init__(**kwargs)
self.kind = kwargs.get('kind', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class AggregationsKind1(Model):
"""Describes an Azure resource with kind.

:param kind: The kind of the setting. Possible values include:
'CasesAggregation'
:type kind: str or ~azure.mgmt.securityinsight.models.AggregationsKind
"""

_attribute_map = {
'kind': {'key': 'kind', 'type': 'str'},
}

def __init__(self, *, kind=None, **kwargs) -> None:
super(AggregationsKind1, self).__init__(**kwargs)
self.kind = kind
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class Aggregations(Model):
"""The aggregation.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Azure resource Id
:vartype id: str
:ivar type: Azure resource type
:vartype type: str
:ivar name: Azure resource name
:vartype name: str
:param kind: Required. Constant filled by server.
:type kind: str
"""

_validation = {
'id': {'readonly': True},
'type': {'readonly': True},
'name': {'readonly': True},
'kind': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'kind': {'key': 'kind', 'type': 'str'},
}

def __init__(self, **kwargs) -> None:
super(Aggregations, self).__init__(**kwargs)
self.id = None
self.type = None
self.name = None
self.kind = None
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ class StatusInMcas(str, Enum):

enabled = "Enabled"
disabled = "Disabled"


class AggregationsKind(str, Enum):

cases_aggregation = "CasesAggregation"
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .entities_operations import EntitiesOperations
from .office_consents_operations import OfficeConsentsOperations
from .product_settings_operations import ProductSettingsOperations
from .cases_aggregations_operations import CasesAggregationsOperations

__all__ = [
'Operations',
Expand All @@ -29,4 +30,5 @@
'EntitiesOperations',
'OfficeConsentsOperations',
'ProductSettingsOperations',
'CasesAggregationsOperations',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError

from .. import models


class CasesAggregationsOperations(object):
"""CasesAggregationsOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: API version for the operation. Constant value: "2019-01-01-preview".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-01-01-preview"

self.config = config

def get(
self, resource_group_name, operational_insights_resource_provider, workspace_name, aggregations_name, custom_headers=None, raw=False, **operation_config):
"""Get aggregative result for the given resources under the defined
workspace.

:param resource_group_name: The name of the resource group within the
user's subscription. The name is case insensitive.
:type resource_group_name: str
:param operational_insights_resource_provider: The namespace of
workspaces resource provider- Microsoft.OperationalInsights.
:type operational_insights_resource_provider: str
:param workspace_name: The name of the workspace.
:type workspace_name: str
:param aggregations_name: The aggregation name. Supports - Cases
:type aggregations_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: Aggregations or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.securityinsight.models.Aggregations or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'operationalInsightsResourceProvider': self._serialize.url("operational_insights_resource_provider", operational_insights_resource_provider, 'str'),
'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=90, min_length=1),
'aggregationsName': self._serialize.url("aggregations_name", aggregations_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)

if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp

deserialized = None

if response.status_code == 200:
deserialized = self._deserialize('Aggregations', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/aggregations/{aggregationsName}'}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .operations.entities_operations import EntitiesOperations
from .operations.office_consents_operations import OfficeConsentsOperations
from .operations.product_settings_operations import ProductSettingsOperations
from .operations.cases_aggregations_operations import CasesAggregationsOperations
from . import models


Expand Down Expand Up @@ -81,6 +82,8 @@ class SecurityInsights(SDKClient):
:vartype office_consents: azure.mgmt.securityinsight.operations.OfficeConsentsOperations
:ivar product_settings: ProductSettings operations
:vartype product_settings: azure.mgmt.securityinsight.operations.ProductSettingsOperations
:ivar cases_aggregations: CasesAggregations operations
:vartype cases_aggregations: azure.mgmt.securityinsight.operations.CasesAggregationsOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -119,3 +122,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.product_settings = ProductSettingsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.cases_aggregations = CasesAggregationsOperations(
self._client, self.config, self._serialize, self._deserialize)