From 53bcff4c6deaedf858faff17ee45229f01fe2900 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 4 Jul 2025 07:19:25 +0000 Subject: [PATCH] code and test --- sdk/monitor/azure-mgmt-monitor/CHANGELOG.md | 116 + sdk/monitor/azure-mgmt-monitor/_metadata.json | 2 +- .../monitor/_monitor_management_client.py | 20 + .../azure/mgmt/monitor/_version.py | 2 +- .../monitor/aio/_monitor_management_client.py | 20 + .../mgmt/monitor/aio/operations/__init__.py | 6 + .../_data_collection_endpoints_operations.py | 606 +++ ...collection_rule_associations_operations.py | 548 +++ .../_data_collection_rules_operations.py | 612 +++ .../azure/mgmt/monitor/models/__init__.py | 210 + .../azure/mgmt/monitor/models/_models_py3.py | 3427 ++++++++++++++++- .../_monitor_management_client_enums.py | 229 ++ .../azure/mgmt/monitor/operations/__init__.py | 6 + .../_data_collection_endpoints_operations.py | 803 ++++ ...collection_rule_associations_operations.py | 720 ++++ .../_data_collection_rules_operations.py | 806 ++++ .../data_collection_endpoints_create.py | 43 + .../data_collection_endpoints_delete.py | 42 + .../data_collection_endpoints_get.py | 43 + ...ection_endpoints_list_by_resource_group.py | 43 + ...llection_endpoints_list_by_subscription.py | 41 + .../data_collection_endpoints_patch.py | 43 + .../data_collection_endpoints_update.py | 43 + ...ata_collection_rule_associations_create.py | 43 + ...rule_associations_create_endpoint_assoc.py | 43 + ...ata_collection_rule_associations_delete.py | 42 + .../data_collection_rule_associations_get.py | 43 + ...ations_list_by_data_collection_endpoint.py | 44 + ...tion_rule_associations_list_by_resource.py | 43 + ...llection_rule_associations_list_by_rule.py | 44 + .../data_collection_rules_create.py | 43 + ..._collection_rules_create_agent_settings.py | 43 + ...ta_collection_rules_create_embedded_dce.py | 43 + ...data_collection_rules_create_enrichment.py | 43 + .../data_collection_rules_delete.py | 42 + .../data_collection_rules_get.py | 43 + ...collection_rules_list_by_resource_group.py | 43 + ...a_collection_rules_list_by_subscription.py | 41 + .../data_collection_rules_update.py | 43 + ...nt_data_collection_endpoints_operations.py | 88 + ...a_collection_endpoints_operations_async.py | 89 + ...collection_rule_associations_operations.py | 90 + ...tion_rule_associations_operations_async.py | 91 + ...gement_data_collection_rules_operations.py | 88 + ..._data_collection_rules_operations_async.py | 89 + 45 files changed, 9522 insertions(+), 130 deletions(-) create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_endpoints_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rule_associations_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_endpoints_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rule_associations_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_create.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_delete.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_get.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_resource_group.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_subscription.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_patch.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_update.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create_endpoint_assoc.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_delete.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_get.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_data_collection_endpoint.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_resource.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_rule.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_agent_settings.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_embedded_dce.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_enrichment.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_delete.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_get.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_resource_group.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_subscription.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_update.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations_async.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations.py create mode 100644 sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations_async.py diff --git a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md index cc596751b05d..0d61d242c0eb 100644 --- a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md +++ b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md @@ -1,5 +1,121 @@ # Release History +## 7.0.0b3 (2025-07-21) + +### Features Added + + - Client `MonitorManagementClient` added operation group `data_collection_endpoints` + - Client `MonitorManagementClient` added operation group `data_collection_rule_associations` + - Client `MonitorManagementClient` added operation group `data_collection_rules` + - Added model `AdxDestination` + - Added model `AgentSetting` + - Added model `AgentSettingsSpec` + - Added model `AzureMonitorMetricsDestination` + - Added model `ColumnDefinition` + - Added model `ConfigurationAccessEndpointSpec` + - Added model `DataCollectionEndpoint` + - Added model `DataCollectionEndpointConfigurationAccess` + - Added model `DataCollectionEndpointFailoverConfiguration` + - Added model `DataCollectionEndpointLogsIngestion` + - Added model `DataCollectionEndpointMetadata` + - Added model `DataCollectionEndpointMetricsIngestion` + - Added model `DataCollectionEndpointNetworkAcls` + - Added model `DataCollectionEndpointResource` + - Added model `DataCollectionEndpointResourceIdentity` + - Added model `DataCollectionEndpointResourceListResult` + - Added model `DataCollectionEndpointResourceProperties` + - Added model `DataCollectionEndpointResourceSystemData` + - Added model `DataCollectionRule` + - Added model `DataCollectionRuleAgentSettings` + - Added model `DataCollectionRuleAssociation` + - Added model `DataCollectionRuleAssociationMetadata` + - Added model `DataCollectionRuleAssociationProxyOnlyResource` + - Added model `DataCollectionRuleAssociationProxyOnlyResourceListResult` + - Added model `DataCollectionRuleAssociationProxyOnlyResourceProperties` + - Added model `DataCollectionRuleAssociationProxyOnlyResourceSystemData` + - Added model `DataCollectionRuleDataSources` + - Added model `DataCollectionRuleDestinations` + - Added model `DataCollectionRuleEndpoints` + - Added model `DataCollectionRuleMetadata` + - Added model `DataCollectionRuleReferences` + - Added model `DataCollectionRuleResource` + - Added model `DataCollectionRuleResourceIdentity` + - Added model `DataCollectionRuleResourceListResult` + - Added model `DataCollectionRuleResourceProperties` + - Added model `DataCollectionRuleResourceSystemData` + - Added model `DataFlow` + - Added model `DataImportSources` + - Added model `DataImportSourcesEventHub` + - Added model `DataSourcesSpec` + - Added model `DataSourcesSpecDataImports` + - Added model `DestinationsSpec` + - Added model `DestinationsSpecAzureMonitorMetrics` + - Added model `EndpointsSpec` + - Added model `EnrichmentData` + - Added model `ErrorDetailAutoGenerated2` + - Added model `ErrorResponseCommonV2` + - Added model `EventHubDataSource` + - Added model `EventHubDestination` + - Added model `EventHubDirectDestination` + - Added model `ExtensionDataSource` + - Added model `FailoverConfigurationSpec` + - Added model `IisLogsDataSource` + - Added enum `KnownAgentSettingName` + - Added enum `KnownColumnDefinitionType` + - Added enum `KnownDataCollectionEndpointProvisioningState` + - Added enum `KnownDataCollectionEndpointResourceKind` + - Added enum `KnownDataCollectionRuleAssociationProvisioningState` + - Added enum `KnownDataCollectionRuleProvisioningState` + - Added enum `KnownDataCollectionRuleResourceKind` + - Added enum `KnownDataFlowStreams` + - Added enum `KnownExtensionDataSourceStreams` + - Added enum `KnownLocationSpecProvisioningStatus` + - Added enum `KnownLogFileTextSettingsRecordStartTimestampFormat` + - Added enum `KnownLogFilesDataSourceFormat` + - Added enum `KnownPerfCounterDataSourceStreams` + - Added enum `KnownPrometheusForwarderDataSourceStreams` + - Added enum `KnownPublicNetworkAccessOptions` + - Added enum `KnownStorageBlobLookupType` + - Added enum `KnownSyslogDataSourceFacilityNames` + - Added enum `KnownSyslogDataSourceLogLevels` + - Added enum `KnownSyslogDataSourceStreams` + - Added enum `KnownWindowsEventLogDataSourceStreams` + - Added enum `KnownWindowsFirewallLogsDataSourceProfileFilter` + - Added model `LocationSpec` + - Added model `LogAnalyticsDestination` + - Added model `LogFileSettings` + - Added model `LogFileSettingsText` + - Added model `LogFileTextSettings` + - Added model `LogFilesDataSource` + - Added model `LogFilesDataSourceSettings` + - Added model `LogsIngestionEndpointSpec` + - Added model `ManagedServiceIdentity` + - Added enum `ManagedServiceIdentityType` + - Added model `Metadata` + - Added model `MetricsIngestionEndpointSpec` + - Added model `MicrosoftFabricDestination` + - Added model `MonitoringAccountDestination` + - Added model `NetworkRuleSet` + - Added model `PerfCounterDataSource` + - Added model `PlatformTelemetryDataSource` + - Added model `PrivateLinkScopedResource` + - Added model `PrometheusForwarderDataSource` + - Added model `ReferencesSpec` + - Added model `ReferencesSpecEnrichmentData` + - Added model `ResourceForUpdate` + - Added model `ResourceForUpdateIdentity` + - Added model `StorageBlob` + - Added model `StorageBlobDestination` + - Added model `StorageTableDestination` + - Added model `StreamDeclaration` + - Added model `SyslogDataSource` + - Added model `UserAssignedIdentity` + - Added model `WindowsEventLogDataSource` + - Added model `WindowsFirewallLogsDataSource` + - Added model `DataCollectionEndpointsOperations` + - Added model `DataCollectionRuleAssociationsOperations` + - Added model `DataCollectionRulesOperations` + ## 7.0.0b2 (2025-06-16) ### Features Added diff --git a/sdk/monitor/azure-mgmt-monitor/_metadata.json b/sdk/monitor/azure-mgmt-monitor/_metadata.json index 1fdec1123d46..a764cc0fd723 100644 --- a/sdk/monitor/azure-mgmt-monitor/_metadata.json +++ b/sdk/monitor/azure-mgmt-monitor/_metadata.json @@ -1,5 +1,5 @@ { - "commit": "292e6eee612b2a1b0bc558fec33bcbca9acb590e", + "commit": "8d43af473ac10b1ab56a89b49e87430059b58ae6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py index ae46f03b2a6d..8b61bf7a065c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py @@ -28,6 +28,9 @@ AutoscaleSettingsOperations, AzureMonitorWorkspacesOperations, BaselinesOperations, + DataCollectionEndpointsOperations, + DataCollectionRuleAssociationsOperations, + DataCollectionRulesOperations, DiagnosticSettingsCategoryOperations, DiagnosticSettingsOperations, EventCategoriesOperations, @@ -133,6 +136,14 @@ class MonitorManagementClient: # pylint: disable=client-accepts-api-version-key azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations :ivar monitor_operations: MonitorOperationsOperations operations :vartype monitor_operations: azure.mgmt.monitor.operations.MonitorOperationsOperations + :ivar data_collection_endpoints: DataCollectionEndpointsOperations operations + :vartype data_collection_endpoints: + azure.mgmt.monitor.operations.DataCollectionEndpointsOperations + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: + azure.mgmt.monitor.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: azure.mgmt.monitor.operations.DataCollectionRulesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. @@ -256,6 +267,15 @@ def __init__( self.monitor_operations = MonitorOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.data_collection_endpoints = DataCollectionEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py index b094b52a6bba..e5366921ebbc 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0b2" +VERSION = "7.0.0b3" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py index 85a9702d3d8c..5854df66e29c 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py @@ -28,6 +28,9 @@ AutoscaleSettingsOperations, AzureMonitorWorkspacesOperations, BaselinesOperations, + DataCollectionEndpointsOperations, + DataCollectionRuleAssociationsOperations, + DataCollectionRulesOperations, DiagnosticSettingsCategoryOperations, DiagnosticSettingsOperations, EventCategoriesOperations, @@ -134,6 +137,14 @@ class MonitorManagementClient: # pylint: disable=client-accepts-api-version-key azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations :ivar monitor_operations: MonitorOperationsOperations operations :vartype monitor_operations: azure.mgmt.monitor.aio.operations.MonitorOperationsOperations + :ivar data_collection_endpoints: DataCollectionEndpointsOperations operations + :vartype data_collection_endpoints: + azure.mgmt.monitor.aio.operations.DataCollectionEndpointsOperations + :ivar data_collection_rule_associations: DataCollectionRuleAssociationsOperations operations + :vartype data_collection_rule_associations: + azure.mgmt.monitor.aio.operations.DataCollectionRuleAssociationsOperations + :ivar data_collection_rules: DataCollectionRulesOperations operations + :vartype data_collection_rules: azure.mgmt.monitor.aio.operations.DataCollectionRulesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. @@ -259,6 +270,15 @@ def __init__( self.monitor_operations = MonitorOperationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.data_collection_endpoints = DataCollectionEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_collection_rule_associations = DataCollectionRuleAssociationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.data_collection_rules = DataCollectionRulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/__init__.py index d3dc13bad996..897333a93e51 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/__init__.py @@ -44,6 +44,9 @@ from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations # type: ignore from ._azure_monitor_workspaces_operations import AzureMonitorWorkspacesOperations # type: ignore from ._monitor_operations_operations import MonitorOperationsOperations # type: ignore +from ._data_collection_endpoints_operations import DataCollectionEndpointsOperations # type: ignore +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations # type: ignore +from ._data_collection_rules_operations import DataCollectionRulesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -81,6 +84,9 @@ "SubscriptionDiagnosticSettingsOperations", "AzureMonitorWorkspacesOperations", "MonitorOperationsOperations", + "DataCollectionEndpointsOperations", + "DataCollectionRuleAssociationsOperations", + "DataCollectionRulesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_endpoints_operations.py new file mode 100644 index 000000000000..ae43950b95b1 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_endpoints_operations.py @@ -0,0 +1,606 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._data_collection_endpoints_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._configuration import MonitorManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataCollectionEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s + :attr:`data_collection_endpoints` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCollectionEndpointResource"]: + """Lists all data collection endpoints in the specified resource group. + + Lists all data collection endpoints in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DataCollectionEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionEndpointResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DataCollectionEndpointResource"]: + """Lists all data collection endpoints in the specified subscription. + + Lists all data collection endpoints in the specified subscription. + + :return: An iterator like instance of either DataCollectionEndpointResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionEndpointResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Returns the specified data collection endpoint. + + Returns the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[_models.DataCollectionEndpointResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[Union[_models.DataCollectionEndpointResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Is either a DataCollectionEndpointResource type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionEndpointResource or IO[bytes] + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionEndpointResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[_models.ResourceForUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[Union[_models.ResourceForUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Is either a ResourceForUpdate type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate or IO[bytes] + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ResourceForUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any) -> None: + """Deletes a data collection endpoint. + + Deletes a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 000000000000..1e8308908a05 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,548 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._data_collection_rule_associations_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_data_collection_endpoint_request, + build_list_by_resource_request, + build_list_by_rule_request, +) +from .._configuration import MonitorManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataCollectionRuleAssociationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s + :attr:`data_collection_rule_associations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource( + self, resource_uri: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_rule( + self, resource_group_name: str, data_collection_rule_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_rule_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_data_collection_endpoint( + self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified data collection endpoint. + + Lists associations for the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_data_collection_endpoint_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_uri: str, association_name: str, **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_uri: str, + association_name: str, + body: Optional[_models.DataCollectionRuleAssociationProxyOnlyResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_uri: str, + association_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_uri: str, + association_name: str, + body: Optional[Union[_models.DataCollectionRuleAssociationProxyOnlyResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Is either a DataCollectionRuleAssociationProxyOnlyResource type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource or + IO[bytes] + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionRuleAssociationProxyOnlyResource") + else: + _json = None + + _request = build_create_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_uri: str, association_name: str, **kwargs: Any) -> None: + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rules_operations.py new file mode 100644 index 000000000000..3ba891475036 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_data_collection_rules_operations.py @@ -0,0 +1,612 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._data_collection_rules_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._configuration import MonitorManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataCollectionRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s + :attr:`data_collection_rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCollectionRuleResource"]: + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DataCollectionRuleResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionRuleResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.DataCollectionRuleResource"]: + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :return: An iterator like instance of either DataCollectionRuleResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionRuleResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, data_collection_rule_name: str, **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[_models.DataCollectionRuleResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[Union[_models.DataCollectionRuleResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Is either a DataCollectionRuleResource type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleResource or IO[bytes] + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionRuleResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[_models.ResourceForUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[Union[_models.ResourceForUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Is either a ResourceForUpdate type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate or IO[bytes] + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ResourceForUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, data_collection_rule_name: str, delete_associations: bool = False, **kwargs: Any + ) -> None: + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param delete_associations: If set to 'true' then all associations of this data collection rule + will also be deleted. Default value is False. + :type delete_associations: bool + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + delete_associations=delete_associations, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index ab140da0480e..6aae578066cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -26,6 +26,9 @@ ActivityLogAlertList, ActivityLogAlertPatchBody, ActivityLogAlertResource, + AdxDestination, + AgentSetting, + AgentSettingsSpec, AlertingAction, ArmRoleReceiver, AutomationRunbookReceiver, @@ -39,6 +42,7 @@ AzNsActionGroup, AzureAppPushReceiver, AzureFunctionReceiver, + AzureMonitorMetricsDestination, AzureMonitorPrivateLinkScope, AzureMonitorPrivateLinkScopeListResult, AzureMonitorWorkspace, @@ -50,11 +54,50 @@ AzureMonitorWorkspaceResourceProperties, AzureResource, BaselineMetadata, + ColumnDefinition, + ConfigurationAccessEndpointSpec, Context, Criteria, + DataCollectionEndpoint, + DataCollectionEndpointConfigurationAccess, + DataCollectionEndpointFailoverConfiguration, + DataCollectionEndpointLogsIngestion, + DataCollectionEndpointMetadata, + DataCollectionEndpointMetricsIngestion, + DataCollectionEndpointNetworkAcls, + DataCollectionEndpointResource, + DataCollectionEndpointResourceIdentity, + DataCollectionEndpointResourceListResult, + DataCollectionEndpointResourceProperties, + DataCollectionEndpointResourceSystemData, + DataCollectionRule, + DataCollectionRuleAgentSettings, + DataCollectionRuleAssociation, + DataCollectionRuleAssociationMetadata, + DataCollectionRuleAssociationProxyOnlyResource, + DataCollectionRuleAssociationProxyOnlyResourceListResult, + DataCollectionRuleAssociationProxyOnlyResourceProperties, + DataCollectionRuleAssociationProxyOnlyResourceSystemData, + DataCollectionRuleDataSources, + DataCollectionRuleDestinations, + DataCollectionRuleEndpoints, + DataCollectionRuleMetadata, + DataCollectionRuleReferences, + DataCollectionRuleResource, + DataCollectionRuleResourceIdentity, + DataCollectionRuleResourceListResult, + DataCollectionRuleResourceProperties, + DataCollectionRuleResourceSystemData, DataContainer, + DataFlow, + DataImportSources, + DataImportSourcesEventHub, DataSource, DataSourceConfiguration, + DataSourcesSpec, + DataSourcesSpecDataImports, + DestinationsSpec, + DestinationsSpecAzureMonitorMetrics, DiagnosticSettingsCategoryResource, DiagnosticSettingsCategoryResourceCollection, DiagnosticSettingsResource, @@ -65,17 +108,21 @@ EmailNotification, EmailReceiver, EnableRequest, + EndpointsSpec, + EnrichmentData, Error, ErrorAdditionalInfo, ErrorContract, ErrorDetail, ErrorDetailAdditionalInfoItem, ErrorDetailAutoGenerated, + ErrorDetailAutoGenerated2, ErrorResponse, ErrorResponseAutoGenerated, ErrorResponseAutoGenerated2, ErrorResponseAutoGenerated3, ErrorResponseCommon, + ErrorResponseCommonV2, ErrorResponseError, ErrorResponseErrorAdditionalInfoItem, EtwEventConfiguration, @@ -83,8 +130,13 @@ EventCategoryCollection, EventData, EventDataCollection, + EventHubDataSource, + EventHubDestination, + EventHubDirectDestination, EventHubReceiver, EventLogConfiguration, + ExtensionDataSource, + FailoverConfigurationSpec, GuestDiagnosticSettingsAssociationList, GuestDiagnosticSettingsAssociationResource, GuestDiagnosticSettingsAssociationResourcePatch, @@ -92,12 +144,20 @@ GuestDiagnosticSettingsPatchResource, GuestDiagnosticSettingsResource, HttpRequestInfo, + IisLogsDataSource, Incident, IncidentListResult, IngestionSettings, ItsmReceiver, LocalizableString, LocalizableStringAutoGenerated, + LocationSpec, + LogAnalyticsDestination, + LogFileSettings, + LogFileSettingsText, + LogFileTextSettings, + LogFilesDataSource, + LogFilesDataSourceSettings, LogMetricTrigger, LogProfileCollection, LogProfileResource, @@ -109,6 +169,9 @@ LogSettingsAutoGenerated, LogToMetricAction, LogicAppReceiver, + LogsIngestionEndpointSpec, + ManagedServiceIdentity, + Metadata, MetadataValue, Metric, MetricAlertAction, @@ -136,7 +199,11 @@ MetricTrigger, MetricValue, Metrics, + MetricsIngestionEndpointSpec, + MicrosoftFabricDestination, + MonitoringAccountDestination, MultiMetricCriteria, + NetworkRuleSet, NotificationRequestBody, Operation, OperationAutoGenerated, @@ -145,7 +212,9 @@ OperationListResult, OperationListResultAutoGenerated, OperationStatus, + PerfCounterDataSource, PerformanceCounterConfiguration, + PlatformTelemetryDataSource, PredictiveAutoscalePolicy, PredictiveResponse, PredictiveValue, @@ -156,19 +225,25 @@ PrivateEndpointProperty, PrivateLinkResource, PrivateLinkResourceListResult, + PrivateLinkScopedResource, PrivateLinkScopesResource, PrivateLinkServiceConnectionState, PrivateLinkServiceConnectionStateProperty, + PrometheusForwarderDataSource, ProxyOnlyResource, ProxyResource, Recurrence, RecurrentSchedule, + ReferencesSpec, + ReferencesSpecEnrichmentData, Resource, ResourceAutoGenerated, ResourceAutoGenerated2, ResourceAutoGenerated3, ResourceAutoGenerated4, ResourceAutoGenerated5, + ResourceForUpdate, + ResourceForUpdateIdentity, Response, ResponseWithError, RetentionPolicy, @@ -187,10 +262,15 @@ SinkConfiguration, SmsReceiver, Source, + StorageBlob, + StorageBlobDestination, + StorageTableDestination, + StreamDeclaration, SubscriptionDiagnosticSettingsResource, SubscriptionDiagnosticSettingsResourceCollection, SubscriptionLogSettings, SubscriptionProxyOnlyResource, + SyslogDataSource, SystemData, TagsResource, TestNotificationDetailsResponse, @@ -199,11 +279,14 @@ TimeWindow, TrackedResource, TriggerCondition, + UserAssignedIdentity, VMInsightsOnboardingStatus, VoiceReceiver, WebhookNotification, WebhookReceiver, WebtestLocationAvailabilityCriteria, + WindowsEventLogDataSource, + WindowsFirewallLogsDataSource, WorkspaceInfo, ) @@ -225,6 +308,28 @@ Enabled, EventLevel, GuestDiagnosticSettingsOsType, + KnownAgentSettingName, + KnownColumnDefinitionType, + KnownDataCollectionEndpointProvisioningState, + KnownDataCollectionEndpointResourceKind, + KnownDataCollectionRuleAssociationProvisioningState, + KnownDataCollectionRuleProvisioningState, + KnownDataCollectionRuleResourceKind, + KnownDataFlowStreams, + KnownExtensionDataSourceStreams, + KnownLocationSpecProvisioningStatus, + KnownLogFileTextSettingsRecordStartTimestampFormat, + KnownLogFilesDataSourceFormat, + KnownPerfCounterDataSourceStreams, + KnownPrometheusForwarderDataSourceStreams, + KnownPublicNetworkAccessOptions, + KnownStorageBlobLookupType, + KnownSyslogDataSourceFacilityNames, + KnownSyslogDataSourceLogLevels, + KnownSyslogDataSourceStreams, + KnownWindowsEventLogDataSourceStreams, + KnownWindowsFirewallLogsDataSourceProfileFilter, + ManagedServiceIdentityType, MetricClass, MetricStatisticType, MetricTriggerType, @@ -266,6 +371,9 @@ "ActivityLogAlertList", "ActivityLogAlertPatchBody", "ActivityLogAlertResource", + "AdxDestination", + "AgentSetting", + "AgentSettingsSpec", "AlertingAction", "ArmRoleReceiver", "AutomationRunbookReceiver", @@ -279,6 +387,7 @@ "AzNsActionGroup", "AzureAppPushReceiver", "AzureFunctionReceiver", + "AzureMonitorMetricsDestination", "AzureMonitorPrivateLinkScope", "AzureMonitorPrivateLinkScopeListResult", "AzureMonitorWorkspace", @@ -290,11 +399,50 @@ "AzureMonitorWorkspaceResourceProperties", "AzureResource", "BaselineMetadata", + "ColumnDefinition", + "ConfigurationAccessEndpointSpec", "Context", "Criteria", + "DataCollectionEndpoint", + "DataCollectionEndpointConfigurationAccess", + "DataCollectionEndpointFailoverConfiguration", + "DataCollectionEndpointLogsIngestion", + "DataCollectionEndpointMetadata", + "DataCollectionEndpointMetricsIngestion", + "DataCollectionEndpointNetworkAcls", + "DataCollectionEndpointResource", + "DataCollectionEndpointResourceIdentity", + "DataCollectionEndpointResourceListResult", + "DataCollectionEndpointResourceProperties", + "DataCollectionEndpointResourceSystemData", + "DataCollectionRule", + "DataCollectionRuleAgentSettings", + "DataCollectionRuleAssociation", + "DataCollectionRuleAssociationMetadata", + "DataCollectionRuleAssociationProxyOnlyResource", + "DataCollectionRuleAssociationProxyOnlyResourceListResult", + "DataCollectionRuleAssociationProxyOnlyResourceProperties", + "DataCollectionRuleAssociationProxyOnlyResourceSystemData", + "DataCollectionRuleDataSources", + "DataCollectionRuleDestinations", + "DataCollectionRuleEndpoints", + "DataCollectionRuleMetadata", + "DataCollectionRuleReferences", + "DataCollectionRuleResource", + "DataCollectionRuleResourceIdentity", + "DataCollectionRuleResourceListResult", + "DataCollectionRuleResourceProperties", + "DataCollectionRuleResourceSystemData", "DataContainer", + "DataFlow", + "DataImportSources", + "DataImportSourcesEventHub", "DataSource", "DataSourceConfiguration", + "DataSourcesSpec", + "DataSourcesSpecDataImports", + "DestinationsSpec", + "DestinationsSpecAzureMonitorMetrics", "DiagnosticSettingsCategoryResource", "DiagnosticSettingsCategoryResourceCollection", "DiagnosticSettingsResource", @@ -305,17 +453,21 @@ "EmailNotification", "EmailReceiver", "EnableRequest", + "EndpointsSpec", + "EnrichmentData", "Error", "ErrorAdditionalInfo", "ErrorContract", "ErrorDetail", "ErrorDetailAdditionalInfoItem", "ErrorDetailAutoGenerated", + "ErrorDetailAutoGenerated2", "ErrorResponse", "ErrorResponseAutoGenerated", "ErrorResponseAutoGenerated2", "ErrorResponseAutoGenerated3", "ErrorResponseCommon", + "ErrorResponseCommonV2", "ErrorResponseError", "ErrorResponseErrorAdditionalInfoItem", "EtwEventConfiguration", @@ -323,8 +475,13 @@ "EventCategoryCollection", "EventData", "EventDataCollection", + "EventHubDataSource", + "EventHubDestination", + "EventHubDirectDestination", "EventHubReceiver", "EventLogConfiguration", + "ExtensionDataSource", + "FailoverConfigurationSpec", "GuestDiagnosticSettingsAssociationList", "GuestDiagnosticSettingsAssociationResource", "GuestDiagnosticSettingsAssociationResourcePatch", @@ -332,12 +489,20 @@ "GuestDiagnosticSettingsPatchResource", "GuestDiagnosticSettingsResource", "HttpRequestInfo", + "IisLogsDataSource", "Incident", "IncidentListResult", "IngestionSettings", "ItsmReceiver", "LocalizableString", "LocalizableStringAutoGenerated", + "LocationSpec", + "LogAnalyticsDestination", + "LogFileSettings", + "LogFileSettingsText", + "LogFileTextSettings", + "LogFilesDataSource", + "LogFilesDataSourceSettings", "LogMetricTrigger", "LogProfileCollection", "LogProfileResource", @@ -349,6 +514,9 @@ "LogSettingsAutoGenerated", "LogToMetricAction", "LogicAppReceiver", + "LogsIngestionEndpointSpec", + "ManagedServiceIdentity", + "Metadata", "MetadataValue", "Metric", "MetricAlertAction", @@ -376,7 +544,11 @@ "MetricTrigger", "MetricValue", "Metrics", + "MetricsIngestionEndpointSpec", + "MicrosoftFabricDestination", + "MonitoringAccountDestination", "MultiMetricCriteria", + "NetworkRuleSet", "NotificationRequestBody", "Operation", "OperationAutoGenerated", @@ -385,7 +557,9 @@ "OperationListResult", "OperationListResultAutoGenerated", "OperationStatus", + "PerfCounterDataSource", "PerformanceCounterConfiguration", + "PlatformTelemetryDataSource", "PredictiveAutoscalePolicy", "PredictiveResponse", "PredictiveValue", @@ -396,19 +570,25 @@ "PrivateEndpointProperty", "PrivateLinkResource", "PrivateLinkResourceListResult", + "PrivateLinkScopedResource", "PrivateLinkScopesResource", "PrivateLinkServiceConnectionState", "PrivateLinkServiceConnectionStateProperty", + "PrometheusForwarderDataSource", "ProxyOnlyResource", "ProxyResource", "Recurrence", "RecurrentSchedule", + "ReferencesSpec", + "ReferencesSpecEnrichmentData", "Resource", "ResourceAutoGenerated", "ResourceAutoGenerated2", "ResourceAutoGenerated3", "ResourceAutoGenerated4", "ResourceAutoGenerated5", + "ResourceForUpdate", + "ResourceForUpdateIdentity", "Response", "ResponseWithError", "RetentionPolicy", @@ -427,10 +607,15 @@ "SinkConfiguration", "SmsReceiver", "Source", + "StorageBlob", + "StorageBlobDestination", + "StorageTableDestination", + "StreamDeclaration", "SubscriptionDiagnosticSettingsResource", "SubscriptionDiagnosticSettingsResourceCollection", "SubscriptionLogSettings", "SubscriptionProxyOnlyResource", + "SyslogDataSource", "SystemData", "TagsResource", "TestNotificationDetailsResponse", @@ -439,11 +624,14 @@ "TimeWindow", "TrackedResource", "TriggerCondition", + "UserAssignedIdentity", "VMInsightsOnboardingStatus", "VoiceReceiver", "WebhookNotification", "WebhookReceiver", "WebtestLocationAvailabilityCriteria", + "WindowsEventLogDataSource", + "WindowsFirewallLogsDataSource", "WorkspaceInfo", "ActionType", "AggregationType", @@ -462,6 +650,28 @@ "Enabled", "EventLevel", "GuestDiagnosticSettingsOsType", + "KnownAgentSettingName", + "KnownColumnDefinitionType", + "KnownDataCollectionEndpointProvisioningState", + "KnownDataCollectionEndpointResourceKind", + "KnownDataCollectionRuleAssociationProvisioningState", + "KnownDataCollectionRuleProvisioningState", + "KnownDataCollectionRuleResourceKind", + "KnownDataFlowStreams", + "KnownExtensionDataSourceStreams", + "KnownLocationSpecProvisioningStatus", + "KnownLogFileTextSettingsRecordStartTimestampFormat", + "KnownLogFilesDataSourceFormat", + "KnownPerfCounterDataSourceStreams", + "KnownPrometheusForwarderDataSourceStreams", + "KnownPublicNetworkAccessOptions", + "KnownStorageBlobLookupType", + "KnownSyslogDataSourceFacilityNames", + "KnownSyslogDataSourceLogLevels", + "KnownSyslogDataSourceStreams", + "KnownWindowsEventLogDataSourceStreams", + "KnownWindowsFirewallLogsDataSourceProfileFilter", + "ManagedServiceIdentityType", "MetricClass", "MetricStatisticType", "MetricTriggerType", diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py index 558f91089196..6eb62ec7adba 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py @@ -708,6 +708,115 @@ def __init__( self.description = description +class AdxDestination(_serialization.Model): + """Azure Data Explorer (Adx) destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_id: The ARM resource id of the Adx resource. + :vartype resource_id: str + :ivar database_name: The name of the database to which data will be ingested. + :vartype database_name: str + :ivar ingestion_uri: The ingestion uri of the Adx resource. + :vartype ingestion_uri: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "ingestion_uri": {"readonly": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "ingestion_uri": {"key": "ingestionUri", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + database_name: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: The ARM resource id of the Adx resource. + :paramtype resource_id: str + :keyword database_name: The name of the database to which data will be ingested. + :paramtype database_name: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.database_name = database_name + self.ingestion_uri: Optional[str] = None + self.name = name + + +class AgentSetting(_serialization.Model): + """A setting used to control an agent behavior on a host machine. + + :ivar name: The name of the setting. + Must be part of the list of supported settings. Known values are: "MaxDiskQuotaInMB" and + "UseTimeReceivedForForwardedEvents". + :vartype name: str or ~azure.mgmt.monitor.models.KnownAgentSettingName + :ivar value: The value of the setting. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.KnownAgentSettingName"]] = None, + value: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the setting. + Must be part of the list of supported settings. Known values are: "MaxDiskQuotaInMB" and + "UseTimeReceivedForForwardedEvents". + :paramtype name: str or ~azure.mgmt.monitor.models.KnownAgentSettingName + :keyword value: The value of the setting. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class AgentSettingsSpec(_serialization.Model): + """An agent setting. + + :ivar logs: All the settings that are applicable to the logs agent (AMA). + :vartype logs: list[~azure.mgmt.monitor.models.AgentSetting] + """ + + _attribute_map = { + "logs": {"key": "logs", "type": "[AgentSetting]"}, + } + + def __init__(self, *, logs: Optional[List["_models.AgentSetting"]] = None, **kwargs: Any) -> None: + """ + :keyword logs: All the settings that are applicable to the logs agent (AMA). + :paramtype logs: list[~azure.mgmt.monitor.models.AgentSetting] + """ + super().__init__(**kwargs) + self.logs = logs + + class AlertingAction(Action): """Specify action need to be taken when rule type is Alert. @@ -1523,6 +1632,30 @@ def __init__( self.use_common_alert_schema = use_common_alert_schema +class AzureMonitorMetricsDestination(_serialization.Model): + """Azure Monitor Metrics destination. + + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + + class PrivateLinkScopesResource(_serialization.Model): """An azure resource object. @@ -2101,125 +2234,1995 @@ class AzureMonitorWorkspaceResourceProperties(AzureMonitorWorkspace): """ -class BaselineMetadata(_serialization.Model): - """Represents a baseline metadata value. +class BaselineMetadata(_serialization.Model): + """Represents a baseline metadata value. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the baseline metadata. Required. + :vartype name: str + :ivar value: Value of the baseline metadata. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Name of the baseline metadata. Required. + :paramtype name: str + :keyword value: Value of the baseline metadata. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class ColumnDefinition(_serialization.Model): + """Definition of custom data column. + + :ivar name: The name of the column. + :vartype name: str + :ivar type: The type of the column data. Known values are: "string", "int", "long", "real", + "boolean", "datetime", "dynamic", and "int". + :vartype type: str or ~azure.mgmt.monitor.models.KnownColumnDefinitionType + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.KnownColumnDefinitionType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the column. + :paramtype name: str + :keyword type: The type of the column data. Known values are: "string", "int", "long", "real", + "boolean", "datetime", "dynamic", and "int". + :paramtype type: str or ~azure.mgmt.monitor.models.KnownColumnDefinitionType + """ + super().__init__(**kwargs) + self.name = name + self.type = type + + +class ConfigurationAccessEndpointSpec(_serialization.Model): + """Definition of the endpoint used for accessing configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + "endpoint": {"readonly": True}, + } + + _attribute_map = { + "endpoint": {"key": "endpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.endpoint: Optional[str] = None + + +class Context(_serialization.Model): + """The context info. + + :ivar notification_source: The source of the notification request. + :vartype notification_source: str + :ivar context_type: The context id type. + :vartype context_type: str + """ + + _attribute_map = { + "notification_source": {"key": "notificationSource", "type": "str"}, + "context_type": {"key": "contextType", "type": "str"}, + } + + def __init__( + self, *, notification_source: Optional[str] = None, context_type: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword notification_source: The source of the notification request. + :paramtype notification_source: str + :keyword context_type: The context id type. + :paramtype context_type: str + """ + super().__init__(**kwargs) + self.notification_source = notification_source + self.context_type = context_type + + +class Criteria(_serialization.Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to server. + + :ivar metric_name: Name of the metric. Required. + :vartype metric_name: str + :ivar dimensions: List of Dimensions for creating metric. + :vartype dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + + _validation = { + "metric_name": {"required": True}, + } + + _attribute_map = { + "metric_name": {"key": "metricName", "type": "str"}, + "dimensions": {"key": "dimensions", "type": "[Dimension]"}, + } + + def __init__( + self, *, metric_name: str, dimensions: Optional[List["_models.Dimension"]] = None, **kwargs: Any + ) -> None: + """ + :keyword metric_name: Name of the metric. Required. + :paramtype metric_name: str + :keyword dimensions: List of Dimensions for creating metric. + :paramtype dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + super().__init__(**kwargs) + self.metric_name = metric_name + self.dimensions = dimensions + + +class DataCollectionEndpoint(_serialization.Model): + """Definition of data collection endpoint. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the data collection endpoint. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :vartype immutable_id: str + :ivar configuration_access: The endpoint used by clients to access their configuration. + :vartype configuration_access: + ~azure.mgmt.monitor.models.DataCollectionEndpointConfigurationAccess + :ivar logs_ingestion: The endpoint used by clients to ingest logs. + :vartype logs_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointLogsIngestion + :ivar metrics_ingestion: The endpoint used by clients to ingest metrics. + :vartype metrics_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointMetricsIngestion + :ivar network_acls: Network access control rules for the endpoints. + :vartype network_acls: ~azure.mgmt.monitor.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionEndpointProvisioningState + :ivar private_link_scoped_resources: List of Azure Monitor Private Link Scope Resources to + which this data collection endpoint resource is associated. This property is READ-ONLY. + :vartype private_link_scoped_resources: + list[~azure.mgmt.monitor.models.PrivateLinkScopedResource] + :ivar failover_configuration: Failover configuration on this endpoint. This property is + READ-ONLY. + :vartype failover_configuration: + ~azure.mgmt.monitor.models.DataCollectionEndpointFailoverConfiguration + :ivar metadata: Metadata for the resource. This property is READ-ONLY. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionEndpointMetadata + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "private_link_scoped_resources": {"readonly": True}, + "failover_configuration": {"readonly": True}, + "metadata": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "immutable_id": {"key": "immutableId", "type": "str"}, + "configuration_access": {"key": "configurationAccess", "type": "DataCollectionEndpointConfigurationAccess"}, + "logs_ingestion": {"key": "logsIngestion", "type": "DataCollectionEndpointLogsIngestion"}, + "metrics_ingestion": {"key": "metricsIngestion", "type": "DataCollectionEndpointMetricsIngestion"}, + "network_acls": {"key": "networkAcls", "type": "DataCollectionEndpointNetworkAcls"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "private_link_scoped_resources": {"key": "privateLinkScopedResources", "type": "[PrivateLinkScopedResource]"}, + "failover_configuration": { + "key": "failoverConfiguration", + "type": "DataCollectionEndpointFailoverConfiguration", + }, + "metadata": {"key": "metadata", "type": "DataCollectionEndpointMetadata"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + immutable_id: Optional[str] = None, + configuration_access: Optional["_models.DataCollectionEndpointConfigurationAccess"] = None, + logs_ingestion: Optional["_models.DataCollectionEndpointLogsIngestion"] = None, + metrics_ingestion: Optional["_models.DataCollectionEndpointMetricsIngestion"] = None, + network_acls: Optional["_models.DataCollectionEndpointNetworkAcls"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the data collection endpoint. + :paramtype description: str + :keyword immutable_id: The immutable ID of this data collection endpoint resource. This + property is READ-ONLY. + :paramtype immutable_id: str + :keyword configuration_access: The endpoint used by clients to access their configuration. + :paramtype configuration_access: + ~azure.mgmt.monitor.models.DataCollectionEndpointConfigurationAccess + :keyword logs_ingestion: The endpoint used by clients to ingest logs. + :paramtype logs_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointLogsIngestion + :keyword metrics_ingestion: The endpoint used by clients to ingest metrics. + :paramtype metrics_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointMetricsIngestion + :keyword network_acls: Network access control rules for the endpoints. + :paramtype network_acls: ~azure.mgmt.monitor.models.DataCollectionEndpointNetworkAcls + """ + super().__init__(**kwargs) + self.description = description + self.immutable_id = immutable_id + self.configuration_access = configuration_access + self.logs_ingestion = logs_ingestion + self.metrics_ingestion = metrics_ingestion + self.network_acls = network_acls + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionEndpointProvisioningState"]] = None + self.private_link_scoped_resources: Optional[List["_models.PrivateLinkScopedResource"]] = None + self.failover_configuration: Optional["_models.DataCollectionEndpointFailoverConfiguration"] = None + self.metadata: Optional["_models.DataCollectionEndpointMetadata"] = None + + +class DataCollectionEndpointConfigurationAccess(ConfigurationAccessEndpointSpec): # pylint: disable=name-too-long + """The endpoint used by clients to access their configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + +class FailoverConfigurationSpec(_serialization.Model): + """FailoverConfigurationSpec. + + :ivar active_location: Active location where data flow will occur. + :vartype active_location: str + :ivar locations: Locations that are configured for failover. + :vartype locations: list[~azure.mgmt.monitor.models.LocationSpec] + """ + + _attribute_map = { + "active_location": {"key": "activeLocation", "type": "str"}, + "locations": {"key": "locations", "type": "[LocationSpec]"}, + } + + def __init__( + self, + *, + active_location: Optional[str] = None, + locations: Optional[List["_models.LocationSpec"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword active_location: Active location where data flow will occur. + :paramtype active_location: str + :keyword locations: Locations that are configured for failover. + :paramtype locations: list[~azure.mgmt.monitor.models.LocationSpec] + """ + super().__init__(**kwargs) + self.active_location = active_location + self.locations = locations + + +class DataCollectionEndpointFailoverConfiguration(FailoverConfigurationSpec): # pylint: disable=name-too-long + """Failover configuration on this endpoint. This property is READ-ONLY. + + :ivar active_location: Active location where data flow will occur. + :vartype active_location: str + :ivar locations: Locations that are configured for failover. + :vartype locations: list[~azure.mgmt.monitor.models.LocationSpec] + """ + + +class LogsIngestionEndpointSpec(_serialization.Model): + """Definition of the endpoint used for ingesting logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + "endpoint": {"readonly": True}, + } + + _attribute_map = { + "endpoint": {"key": "endpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.endpoint: Optional[str] = None + + +class DataCollectionEndpointLogsIngestion(LogsIngestionEndpointSpec): + """The endpoint used by clients to ingest logs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + +class Metadata(_serialization.Model): + """Metadata about the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioned_by: Azure offering managing this resource on-behalf-of customer. + :vartype provisioned_by: str + :ivar provisioned_by_resource_id: Resource Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_resource_id: str + :ivar provisioned_by_immutable_id: Immutable Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_immutable_id: str + """ + + _validation = { + "provisioned_by": {"readonly": True}, + "provisioned_by_resource_id": {"readonly": True}, + "provisioned_by_immutable_id": {"readonly": True}, + } + + _attribute_map = { + "provisioned_by": {"key": "provisionedBy", "type": "str"}, + "provisioned_by_resource_id": {"key": "provisionedByResourceId", "type": "str"}, + "provisioned_by_immutable_id": {"key": "provisionedByImmutableId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioned_by: Optional[str] = None + self.provisioned_by_resource_id: Optional[str] = None + self.provisioned_by_immutable_id: Optional[str] = None + + +class DataCollectionEndpointMetadata(Metadata): + """Metadata for the resource. This property is READ-ONLY. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioned_by: Azure offering managing this resource on-behalf-of customer. + :vartype provisioned_by: str + :ivar provisioned_by_resource_id: Resource Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_resource_id: str + :ivar provisioned_by_immutable_id: Immutable Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_immutable_id: str + """ + + +class MetricsIngestionEndpointSpec(_serialization.Model): + """Definition of the endpoint used for ingesting metrics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + _validation = { + "endpoint": {"readonly": True}, + } + + _attribute_map = { + "endpoint": {"key": "endpoint", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.endpoint: Optional[str] = None + + +class DataCollectionEndpointMetricsIngestion(MetricsIngestionEndpointSpec): + """The endpoint used by clients to ingest metrics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: The endpoint. This property is READ-ONLY. + :vartype endpoint: str + """ + + +class NetworkRuleSet(_serialization.Model): + """Definition of the network rules. + + :ivar public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Known values are: "Enabled", "Disabled", and + "SecuredByPerimeter". + :vartype public_network_access: str or + ~azure.mgmt.monitor.models.KnownPublicNetworkAccessOptions + """ + + _attribute_map = { + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + } + + def __init__( + self, + *, + public_network_access: Optional[Union[str, "_models.KnownPublicNetworkAccessOptions"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Known values are: "Enabled", "Disabled", and + "SecuredByPerimeter". + :paramtype public_network_access: str or + ~azure.mgmt.monitor.models.KnownPublicNetworkAccessOptions + """ + super().__init__(**kwargs) + self.public_network_access = public_network_access + + +class DataCollectionEndpointNetworkAcls(NetworkRuleSet): + """Network access control rules for the endpoints. + + :ivar public_network_access: The configuration to set whether network access from public + internet to the endpoints are allowed. Known values are: "Enabled", "Disabled", and + "SecuredByPerimeter". + :vartype public_network_access: str or + ~azure.mgmt.monitor.models.KnownPublicNetworkAccessOptions + """ + + +class DataCollectionEndpointResource(_serialization.Model): + """Definition of ARM tracked top level resource. + + 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 server. + + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of the resource. Known values are: "Linux" and "Windows". + :vartype kind: str or ~azure.mgmt.monitor.models.KnownDataCollectionEndpointResourceKind + :ivar identity: Managed service identity of the resource. + :vartype identity: ~azure.mgmt.monitor.models.DataCollectionEndpointResourceIdentity + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.monitor.models.DataCollectionEndpointResourceSystemData + :ivar description: Description of the data collection endpoint. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :vartype immutable_id: str + :ivar configuration_access: The endpoint used by clients to access their configuration. + :vartype configuration_access: + ~azure.mgmt.monitor.models.DataCollectionEndpointConfigurationAccess + :ivar logs_ingestion: The endpoint used by clients to ingest logs. + :vartype logs_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointLogsIngestion + :ivar metrics_ingestion: The endpoint used by clients to ingest metrics. + :vartype metrics_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointMetricsIngestion + :ivar network_acls: Network access control rules for the endpoints. + :vartype network_acls: ~azure.mgmt.monitor.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionEndpointProvisioningState + :ivar private_link_scoped_resources: List of Azure Monitor Private Link Scope Resources to + which this data collection endpoint resource is associated. This property is READ-ONLY. + :vartype private_link_scoped_resources: + list[~azure.mgmt.monitor.models.PrivateLinkScopedResource] + :ivar failover_configuration: Failover configuration on this endpoint. This property is + READ-ONLY. + :vartype failover_configuration: + ~azure.mgmt.monitor.models.DataCollectionEndpointFailoverConfiguration + :ivar metadata: Metadata for the resource. This property is READ-ONLY. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionEndpointMetadata + """ + + _validation = { + "location": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "private_link_scoped_resources": {"readonly": True}, + "failover_configuration": {"readonly": True}, + "metadata": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "DataCollectionEndpointResourceIdentity"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "DataCollectionEndpointResourceSystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "immutable_id": {"key": "properties.immutableId", "type": "str"}, + "configuration_access": { + "key": "properties.configurationAccess", + "type": "DataCollectionEndpointConfigurationAccess", + }, + "logs_ingestion": {"key": "properties.logsIngestion", "type": "DataCollectionEndpointLogsIngestion"}, + "metrics_ingestion": {"key": "properties.metricsIngestion", "type": "DataCollectionEndpointMetricsIngestion"}, + "network_acls": {"key": "properties.networkAcls", "type": "DataCollectionEndpointNetworkAcls"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "private_link_scoped_resources": { + "key": "properties.privateLinkScopedResources", + "type": "[PrivateLinkScopedResource]", + }, + "failover_configuration": { + "key": "properties.failoverConfiguration", + "type": "DataCollectionEndpointFailoverConfiguration", + }, + "metadata": {"key": "properties.metadata", "type": "DataCollectionEndpointMetadata"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "_models.KnownDataCollectionEndpointResourceKind"]] = None, + identity: Optional["_models.DataCollectionEndpointResourceIdentity"] = None, + description: Optional[str] = None, + immutable_id: Optional[str] = None, + configuration_access: Optional["_models.DataCollectionEndpointConfigurationAccess"] = None, + logs_ingestion: Optional["_models.DataCollectionEndpointLogsIngestion"] = None, + metrics_ingestion: Optional["_models.DataCollectionEndpointMetricsIngestion"] = None, + network_acls: Optional["_models.DataCollectionEndpointNetworkAcls"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of the resource. Known values are: "Linux" and "Windows". + :paramtype kind: str or ~azure.mgmt.monitor.models.KnownDataCollectionEndpointResourceKind + :keyword identity: Managed service identity of the resource. + :paramtype identity: ~azure.mgmt.monitor.models.DataCollectionEndpointResourceIdentity + :keyword description: Description of the data collection endpoint. + :paramtype description: str + :keyword immutable_id: The immutable ID of this data collection endpoint resource. This + property is READ-ONLY. + :paramtype immutable_id: str + :keyword configuration_access: The endpoint used by clients to access their configuration. + :paramtype configuration_access: + ~azure.mgmt.monitor.models.DataCollectionEndpointConfigurationAccess + :keyword logs_ingestion: The endpoint used by clients to ingest logs. + :paramtype logs_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointLogsIngestion + :keyword metrics_ingestion: The endpoint used by clients to ingest metrics. + :paramtype metrics_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointMetricsIngestion + :keyword network_acls: Network access control rules for the endpoints. + :paramtype network_acls: ~azure.mgmt.monitor.models.DataCollectionEndpointNetworkAcls + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.kind = kind + self.identity = identity + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.etag: Optional[str] = None + self.system_data: Optional["_models.DataCollectionEndpointResourceSystemData"] = None + self.description = description + self.immutable_id = immutable_id + self.configuration_access = configuration_access + self.logs_ingestion = logs_ingestion + self.metrics_ingestion = metrics_ingestion + self.network_acls = network_acls + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionEndpointProvisioningState"]] = None + self.private_link_scoped_resources: Optional[List["_models.PrivateLinkScopedResource"]] = None + self.failover_configuration: Optional["_models.DataCollectionEndpointFailoverConfiguration"] = None + self.metadata: Optional["_models.DataCollectionEndpointMetadata"] = None + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + 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 server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.monitor.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.monitor.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class DataCollectionEndpointResourceIdentity(ManagedServiceIdentity): + """Managed service identity of the resource. + + 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 server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.monitor.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserAssignedIdentity] + """ + + +class DataCollectionEndpointResourceListResult(_serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to server. + + :ivar value: A list of resources. Required. + :vartype value: list[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DataCollectionEndpointResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.DataCollectionEndpointResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of resources. Required. + :paramtype value: list[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionEndpointResourceProperties(DataCollectionEndpoint): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the data collection endpoint. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection endpoint resource. This property + is READ-ONLY. + :vartype immutable_id: str + :ivar configuration_access: The endpoint used by clients to access their configuration. + :vartype configuration_access: + ~azure.mgmt.monitor.models.DataCollectionEndpointConfigurationAccess + :ivar logs_ingestion: The endpoint used by clients to ingest logs. + :vartype logs_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointLogsIngestion + :ivar metrics_ingestion: The endpoint used by clients to ingest metrics. + :vartype metrics_ingestion: ~azure.mgmt.monitor.models.DataCollectionEndpointMetricsIngestion + :ivar network_acls: Network access control rules for the endpoints. + :vartype network_acls: ~azure.mgmt.monitor.models.DataCollectionEndpointNetworkAcls + :ivar provisioning_state: The resource provisioning state. This property is READ-ONLY. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionEndpointProvisioningState + :ivar private_link_scoped_resources: List of Azure Monitor Private Link Scope Resources to + which this data collection endpoint resource is associated. This property is READ-ONLY. + :vartype private_link_scoped_resources: + list[~azure.mgmt.monitor.models.PrivateLinkScopedResource] + :ivar failover_configuration: Failover configuration on this endpoint. This property is + READ-ONLY. + :vartype failover_configuration: + ~azure.mgmt.monitor.models.DataCollectionEndpointFailoverConfiguration + :ivar metadata: Metadata for the resource. This property is READ-ONLY. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionEndpointMetadata + """ + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :paramtype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", and "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class DataCollectionEndpointResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + +class DataCollectionRule(_serialization.Model): + """Definition of what monitoring data to collect and where that data should be sent. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the data collection rule. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that this + rule can be used with. + :vartype data_collection_endpoint_id: str + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleMetadata + :ivar endpoints: Defines the ingestion endpoints to send data to via this rule. + :vartype endpoints: ~azure.mgmt.monitor.models.DataCollectionRuleEndpoints + :ivar references: Defines all the references that may be used in other sections of the DCR. + :vartype references: ~azure.mgmt.monitor.models.DataCollectionRuleReferences + :ivar agent_settings: Agent settings used to modify agent behavior on a given host. + :vartype agent_settings: ~azure.mgmt.monitor.models.DataCollectionRuleAgentSettings + :ivar stream_declarations: Declaration of custom streams used in this rule. + :vartype stream_declarations: dict[str, ~azure.mgmt.monitor.models.StreamDeclaration] + :ivar data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :vartype data_sources: ~azure.mgmt.monitor.models.DataCollectionRuleDataSources + :ivar destinations: The specification of destinations. + :vartype destinations: ~azure.mgmt.monitor.models.DataCollectionRuleDestinations + :ivar data_flows: The specification of data flows. + :vartype data_flows: list[~azure.mgmt.monitor.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + "immutable_id": {"readonly": True}, + "metadata": {"readonly": True}, + "endpoints": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "immutable_id": {"key": "immutableId", "type": "str"}, + "data_collection_endpoint_id": {"key": "dataCollectionEndpointId", "type": "str"}, + "metadata": {"key": "metadata", "type": "DataCollectionRuleMetadata"}, + "endpoints": {"key": "endpoints", "type": "DataCollectionRuleEndpoints"}, + "references": {"key": "references", "type": "DataCollectionRuleReferences"}, + "agent_settings": {"key": "agentSettings", "type": "DataCollectionRuleAgentSettings"}, + "stream_declarations": {"key": "streamDeclarations", "type": "{StreamDeclaration}"}, + "data_sources": {"key": "dataSources", "type": "DataCollectionRuleDataSources"}, + "destinations": {"key": "destinations", "type": "DataCollectionRuleDestinations"}, + "data_flows": {"key": "dataFlows", "type": "[DataFlow]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + references: Optional["_models.DataCollectionRuleReferences"] = None, + agent_settings: Optional["_models.DataCollectionRuleAgentSettings"] = None, + stream_declarations: Optional[Dict[str, "_models.StreamDeclaration"]] = None, + data_sources: Optional["_models.DataCollectionRuleDataSources"] = None, + destinations: Optional["_models.DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["_models.DataFlow"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the data collection rule. + :paramtype description: str + :keyword data_collection_endpoint_id: The resource ID of the data collection endpoint that this + rule can be used with. + :paramtype data_collection_endpoint_id: str + :keyword references: Defines all the references that may be used in other sections of the DCR. + :paramtype references: ~azure.mgmt.monitor.models.DataCollectionRuleReferences + :keyword agent_settings: Agent settings used to modify agent behavior on a given host. + :paramtype agent_settings: ~azure.mgmt.monitor.models.DataCollectionRuleAgentSettings + :keyword stream_declarations: Declaration of custom streams used in this rule. + :paramtype stream_declarations: dict[str, ~azure.mgmt.monitor.models.StreamDeclaration] + :keyword data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :paramtype data_sources: ~azure.mgmt.monitor.models.DataCollectionRuleDataSources + :keyword destinations: The specification of destinations. + :paramtype destinations: ~azure.mgmt.monitor.models.DataCollectionRuleDestinations + :keyword data_flows: The specification of data flows. + :paramtype data_flows: list[~azure.mgmt.monitor.models.DataFlow] + """ + super().__init__(**kwargs) + self.description = description + self.immutable_id: Optional[str] = None + self.data_collection_endpoint_id = data_collection_endpoint_id + self.metadata: Optional["_models.DataCollectionRuleMetadata"] = None + self.endpoints: Optional["_models.DataCollectionRuleEndpoints"] = None + self.references = references + self.agent_settings = agent_settings + self.stream_declarations = stream_declarations + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionRuleProvisioningState"]] = None + + +class DataCollectionRuleAgentSettings(AgentSettingsSpec): + """Agent settings used to modify agent behavior on a given host. + + :ivar logs: All the settings that are applicable to the logs agent (AMA). + :vartype logs: list[~azure.mgmt.monitor.models.AgentSetting] + """ + + +class DataCollectionRuleAssociation(_serialization.Model): + """Definition of association of a data collection rule with a monitored Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the association. + :vartype description: str + :ivar data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :vartype data_collection_rule_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :vartype data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleAssociationProvisioningState + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationMetadata + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "metadata": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "data_collection_rule_id": {"key": "dataCollectionRuleId", "type": "str"}, + "data_collection_endpoint_id": {"key": "dataCollectionEndpointId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "metadata": {"key": "metadata", "type": "DataCollectionRuleAssociationMetadata"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the association. + :paramtype description: str + :keyword data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :paramtype data_collection_rule_id: str + :keyword data_collection_endpoint_id: The resource ID of the data collection endpoint that is + to be associated. + :paramtype data_collection_endpoint_id: str + """ + super().__init__(**kwargs) + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.data_collection_endpoint_id = data_collection_endpoint_id + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionRuleAssociationProvisioningState"]] = ( + None + ) + self.metadata: Optional["_models.DataCollectionRuleAssociationMetadata"] = None + + +class DataCollectionRuleAssociationMetadata(Metadata): + """Metadata about the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioned_by: Azure offering managing this resource on-behalf-of customer. + :vartype provisioned_by: str + :ivar provisioned_by_resource_id: Resource Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_resource_id: str + :ivar provisioned_by_immutable_id: Immutable Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_immutable_id: str + """ + + +class DataCollectionRuleAssociationProxyOnlyResource(_serialization.Model): # pylint: disable=name-too-long + """Definition of generic ARM proxy resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: + ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResourceSystemData + :ivar description: Description of the association. + :vartype description: str + :ivar data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :vartype data_collection_rule_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :vartype data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleAssociationProvisioningState + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationMetadata + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "metadata": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "DataCollectionRuleAssociationProxyOnlyResourceSystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "data_collection_rule_id": {"key": "properties.dataCollectionRuleId", "type": "str"}, + "data_collection_endpoint_id": {"key": "properties.dataCollectionEndpointId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "metadata": {"key": "properties.metadata", "type": "DataCollectionRuleAssociationMetadata"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + data_collection_rule_id: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the association. + :paramtype description: str + :keyword data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :paramtype data_collection_rule_id: str + :keyword data_collection_endpoint_id: The resource ID of the data collection endpoint that is + to be associated. + :paramtype data_collection_endpoint_id: str + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.etag: Optional[str] = None + self.system_data: Optional["_models.DataCollectionRuleAssociationProxyOnlyResourceSystemData"] = None + self.description = description + self.data_collection_rule_id = data_collection_rule_id + self.data_collection_endpoint_id = data_collection_endpoint_id + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionRuleAssociationProvisioningState"]] = ( + None + ) + self.metadata: Optional["_models.DataCollectionRuleAssociationMetadata"] = None + + +class DataCollectionRuleAssociationProxyOnlyResourceListResult(_serialization.Model): # pylint: disable=name-too-long + """A pageable list of resources. + + All required parameters must be populated in order to send to server. + + :ivar value: A list of resources. Required. + :vartype value: list[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DataCollectionRuleAssociationProxyOnlyResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: List["_models.DataCollectionRuleAssociationProxyOnlyResource"], + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: A list of resources. Required. + :paramtype value: + list[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleAssociationProxyOnlyResourceProperties( + DataCollectionRuleAssociation +): # pylint: disable=name-too-long + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the association. + :vartype description: str + :ivar data_collection_rule_id: The resource ID of the data collection rule that is to be + associated. + :vartype data_collection_rule_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that is to + be associated. + :vartype data_collection_endpoint_id: str + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleAssociationProvisioningState + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationMetadata + """ + + +class DataCollectionRuleAssociationProxyOnlyResourceSystemData(SystemData): # pylint: disable=name-too-long + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + +class DataSourcesSpec(_serialization.Model): + """Specification of data sources that will be collected. + + :ivar performance_counters: The list of performance counter data source configurations. + :vartype performance_counters: list[~azure.mgmt.monitor.models.PerfCounterDataSource] + :ivar windows_event_logs: The list of Windows Event Log data source configurations. + :vartype windows_event_logs: list[~azure.mgmt.monitor.models.WindowsEventLogDataSource] + :ivar syslog: The list of Syslog data source configurations. + :vartype syslog: list[~azure.mgmt.monitor.models.SyslogDataSource] + :ivar extensions: The list of Azure VM extension data source configurations. + :vartype extensions: list[~azure.mgmt.monitor.models.ExtensionDataSource] + :ivar log_files: The list of Log files source configurations. + :vartype log_files: list[~azure.mgmt.monitor.models.LogFilesDataSource] + :ivar iis_logs: The list of IIS logs source configurations. + :vartype iis_logs: list[~azure.mgmt.monitor.models.IisLogsDataSource] + :ivar windows_firewall_logs: The list of Windows Firewall logs source configurations. + :vartype windows_firewall_logs: list[~azure.mgmt.monitor.models.WindowsFirewallLogsDataSource] + :ivar prometheus_forwarder: The list of Prometheus forwarder data source configurations. + :vartype prometheus_forwarder: list[~azure.mgmt.monitor.models.PrometheusForwarderDataSource] + :ivar platform_telemetry: The list of platform telemetry configurations. + :vartype platform_telemetry: list[~azure.mgmt.monitor.models.PlatformTelemetryDataSource] + :ivar data_imports: Specifications of pull based data sources. + :vartype data_imports: ~azure.mgmt.monitor.models.DataSourcesSpecDataImports + """ + + _attribute_map = { + "performance_counters": {"key": "performanceCounters", "type": "[PerfCounterDataSource]"}, + "windows_event_logs": {"key": "windowsEventLogs", "type": "[WindowsEventLogDataSource]"}, + "syslog": {"key": "syslog", "type": "[SyslogDataSource]"}, + "extensions": {"key": "extensions", "type": "[ExtensionDataSource]"}, + "log_files": {"key": "logFiles", "type": "[LogFilesDataSource]"}, + "iis_logs": {"key": "iisLogs", "type": "[IisLogsDataSource]"}, + "windows_firewall_logs": {"key": "windowsFirewallLogs", "type": "[WindowsFirewallLogsDataSource]"}, + "prometheus_forwarder": {"key": "prometheusForwarder", "type": "[PrometheusForwarderDataSource]"}, + "platform_telemetry": {"key": "platformTelemetry", "type": "[PlatformTelemetryDataSource]"}, + "data_imports": {"key": "dataImports", "type": "DataSourcesSpecDataImports"}, + } + + def __init__( + self, + *, + performance_counters: Optional[List["_models.PerfCounterDataSource"]] = None, + windows_event_logs: Optional[List["_models.WindowsEventLogDataSource"]] = None, + syslog: Optional[List["_models.SyslogDataSource"]] = None, + extensions: Optional[List["_models.ExtensionDataSource"]] = None, + log_files: Optional[List["_models.LogFilesDataSource"]] = None, + iis_logs: Optional[List["_models.IisLogsDataSource"]] = None, + windows_firewall_logs: Optional[List["_models.WindowsFirewallLogsDataSource"]] = None, + prometheus_forwarder: Optional[List["_models.PrometheusForwarderDataSource"]] = None, + platform_telemetry: Optional[List["_models.PlatformTelemetryDataSource"]] = None, + data_imports: Optional["_models.DataSourcesSpecDataImports"] = None, + **kwargs: Any + ) -> None: + """ + :keyword performance_counters: The list of performance counter data source configurations. + :paramtype performance_counters: list[~azure.mgmt.monitor.models.PerfCounterDataSource] + :keyword windows_event_logs: The list of Windows Event Log data source configurations. + :paramtype windows_event_logs: list[~azure.mgmt.monitor.models.WindowsEventLogDataSource] + :keyword syslog: The list of Syslog data source configurations. + :paramtype syslog: list[~azure.mgmt.monitor.models.SyslogDataSource] + :keyword extensions: The list of Azure VM extension data source configurations. + :paramtype extensions: list[~azure.mgmt.monitor.models.ExtensionDataSource] + :keyword log_files: The list of Log files source configurations. + :paramtype log_files: list[~azure.mgmt.monitor.models.LogFilesDataSource] + :keyword iis_logs: The list of IIS logs source configurations. + :paramtype iis_logs: list[~azure.mgmt.monitor.models.IisLogsDataSource] + :keyword windows_firewall_logs: The list of Windows Firewall logs source configurations. + :paramtype windows_firewall_logs: + list[~azure.mgmt.monitor.models.WindowsFirewallLogsDataSource] + :keyword prometheus_forwarder: The list of Prometheus forwarder data source configurations. + :paramtype prometheus_forwarder: list[~azure.mgmt.monitor.models.PrometheusForwarderDataSource] + :keyword platform_telemetry: The list of platform telemetry configurations. + :paramtype platform_telemetry: list[~azure.mgmt.monitor.models.PlatformTelemetryDataSource] + :keyword data_imports: Specifications of pull based data sources. + :paramtype data_imports: ~azure.mgmt.monitor.models.DataSourcesSpecDataImports + """ + super().__init__(**kwargs) + self.performance_counters = performance_counters + self.windows_event_logs = windows_event_logs + self.syslog = syslog + self.extensions = extensions + self.log_files = log_files + self.iis_logs = iis_logs + self.windows_firewall_logs = windows_firewall_logs + self.prometheus_forwarder = prometheus_forwarder + self.platform_telemetry = platform_telemetry + self.data_imports = data_imports + + +class DataCollectionRuleDataSources(DataSourcesSpec): + """The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + + :ivar performance_counters: The list of performance counter data source configurations. + :vartype performance_counters: list[~azure.mgmt.monitor.models.PerfCounterDataSource] + :ivar windows_event_logs: The list of Windows Event Log data source configurations. + :vartype windows_event_logs: list[~azure.mgmt.monitor.models.WindowsEventLogDataSource] + :ivar syslog: The list of Syslog data source configurations. + :vartype syslog: list[~azure.mgmt.monitor.models.SyslogDataSource] + :ivar extensions: The list of Azure VM extension data source configurations. + :vartype extensions: list[~azure.mgmt.monitor.models.ExtensionDataSource] + :ivar log_files: The list of Log files source configurations. + :vartype log_files: list[~azure.mgmt.monitor.models.LogFilesDataSource] + :ivar iis_logs: The list of IIS logs source configurations. + :vartype iis_logs: list[~azure.mgmt.monitor.models.IisLogsDataSource] + :ivar windows_firewall_logs: The list of Windows Firewall logs source configurations. + :vartype windows_firewall_logs: list[~azure.mgmt.monitor.models.WindowsFirewallLogsDataSource] + :ivar prometheus_forwarder: The list of Prometheus forwarder data source configurations. + :vartype prometheus_forwarder: list[~azure.mgmt.monitor.models.PrometheusForwarderDataSource] + :ivar platform_telemetry: The list of platform telemetry configurations. + :vartype platform_telemetry: list[~azure.mgmt.monitor.models.PlatformTelemetryDataSource] + :ivar data_imports: Specifications of pull based data sources. + :vartype data_imports: ~azure.mgmt.monitor.models.DataSourcesSpecDataImports + """ + + +class DestinationsSpec(_serialization.Model): + """Specification of destinations that can be used in data flows. + + :ivar log_analytics: List of Log Analytics destinations. + :vartype log_analytics: list[~azure.mgmt.monitor.models.LogAnalyticsDestination] + :ivar monitoring_accounts: List of monitoring account destinations. + :vartype monitoring_accounts: list[~azure.mgmt.monitor.models.MonitoringAccountDestination] + :ivar azure_monitor_metrics: Azure Monitor Metrics destination. + :vartype azure_monitor_metrics: ~azure.mgmt.monitor.models.DestinationsSpecAzureMonitorMetrics + :ivar event_hubs: List of Event Hubs destinations. + :vartype event_hubs: list[~azure.mgmt.monitor.models.EventHubDestination] + :ivar event_hubs_direct: List of Event Hubs Direct destinations. + :vartype event_hubs_direct: list[~azure.mgmt.monitor.models.EventHubDirectDestination] + :ivar storage_blobs_direct: List of Storage Blob Direct destinations. To be used only for + sending data directly to store from the agent. + :vartype storage_blobs_direct: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :ivar storage_tables_direct: List of Storage Table Direct destinations. + :vartype storage_tables_direct: list[~azure.mgmt.monitor.models.StorageTableDestination] + :ivar storage_accounts: List of storage accounts destinations. + :vartype storage_accounts: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :ivar microsoft_fabric: List of Microsoft Fabric destinations. + :vartype microsoft_fabric: list[~azure.mgmt.monitor.models.MicrosoftFabricDestination] + :ivar azure_data_explorer: List of Azure Data Explorer destinations. + :vartype azure_data_explorer: list[~azure.mgmt.monitor.models.AdxDestination] + """ + + _attribute_map = { + "log_analytics": {"key": "logAnalytics", "type": "[LogAnalyticsDestination]"}, + "monitoring_accounts": {"key": "monitoringAccounts", "type": "[MonitoringAccountDestination]"}, + "azure_monitor_metrics": {"key": "azureMonitorMetrics", "type": "DestinationsSpecAzureMonitorMetrics"}, + "event_hubs": {"key": "eventHubs", "type": "[EventHubDestination]"}, + "event_hubs_direct": {"key": "eventHubsDirect", "type": "[EventHubDirectDestination]"}, + "storage_blobs_direct": {"key": "storageBlobsDirect", "type": "[StorageBlobDestination]"}, + "storage_tables_direct": {"key": "storageTablesDirect", "type": "[StorageTableDestination]"}, + "storage_accounts": {"key": "storageAccounts", "type": "[StorageBlobDestination]"}, + "microsoft_fabric": {"key": "microsoftFabric", "type": "[MicrosoftFabricDestination]"}, + "azure_data_explorer": {"key": "azureDataExplorer", "type": "[AdxDestination]"}, + } + + def __init__( + self, + *, + log_analytics: Optional[List["_models.LogAnalyticsDestination"]] = None, + monitoring_accounts: Optional[List["_models.MonitoringAccountDestination"]] = None, + azure_monitor_metrics: Optional["_models.DestinationsSpecAzureMonitorMetrics"] = None, + event_hubs: Optional[List["_models.EventHubDestination"]] = None, + event_hubs_direct: Optional[List["_models.EventHubDirectDestination"]] = None, + storage_blobs_direct: Optional[List["_models.StorageBlobDestination"]] = None, + storage_tables_direct: Optional[List["_models.StorageTableDestination"]] = None, + storage_accounts: Optional[List["_models.StorageBlobDestination"]] = None, + microsoft_fabric: Optional[List["_models.MicrosoftFabricDestination"]] = None, + azure_data_explorer: Optional[List["_models.AdxDestination"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_analytics: List of Log Analytics destinations. + :paramtype log_analytics: list[~azure.mgmt.monitor.models.LogAnalyticsDestination] + :keyword monitoring_accounts: List of monitoring account destinations. + :paramtype monitoring_accounts: list[~azure.mgmt.monitor.models.MonitoringAccountDestination] + :keyword azure_monitor_metrics: Azure Monitor Metrics destination. + :paramtype azure_monitor_metrics: + ~azure.mgmt.monitor.models.DestinationsSpecAzureMonitorMetrics + :keyword event_hubs: List of Event Hubs destinations. + :paramtype event_hubs: list[~azure.mgmt.monitor.models.EventHubDestination] + :keyword event_hubs_direct: List of Event Hubs Direct destinations. + :paramtype event_hubs_direct: list[~azure.mgmt.monitor.models.EventHubDirectDestination] + :keyword storage_blobs_direct: List of Storage Blob Direct destinations. To be used only for + sending data directly to store from the agent. + :paramtype storage_blobs_direct: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :keyword storage_tables_direct: List of Storage Table Direct destinations. + :paramtype storage_tables_direct: list[~azure.mgmt.monitor.models.StorageTableDestination] + :keyword storage_accounts: List of storage accounts destinations. + :paramtype storage_accounts: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :keyword microsoft_fabric: List of Microsoft Fabric destinations. + :paramtype microsoft_fabric: list[~azure.mgmt.monitor.models.MicrosoftFabricDestination] + :keyword azure_data_explorer: List of Azure Data Explorer destinations. + :paramtype azure_data_explorer: list[~azure.mgmt.monitor.models.AdxDestination] + """ + super().__init__(**kwargs) + self.log_analytics = log_analytics + self.monitoring_accounts = monitoring_accounts + self.azure_monitor_metrics = azure_monitor_metrics + self.event_hubs = event_hubs + self.event_hubs_direct = event_hubs_direct + self.storage_blobs_direct = storage_blobs_direct + self.storage_tables_direct = storage_tables_direct + self.storage_accounts = storage_accounts + self.microsoft_fabric = microsoft_fabric + self.azure_data_explorer = azure_data_explorer + + +class DataCollectionRuleDestinations(DestinationsSpec): + """The specification of destinations. + + :ivar log_analytics: List of Log Analytics destinations. + :vartype log_analytics: list[~azure.mgmt.monitor.models.LogAnalyticsDestination] + :ivar monitoring_accounts: List of monitoring account destinations. + :vartype monitoring_accounts: list[~azure.mgmt.monitor.models.MonitoringAccountDestination] + :ivar azure_monitor_metrics: Azure Monitor Metrics destination. + :vartype azure_monitor_metrics: ~azure.mgmt.monitor.models.DestinationsSpecAzureMonitorMetrics + :ivar event_hubs: List of Event Hubs destinations. + :vartype event_hubs: list[~azure.mgmt.monitor.models.EventHubDestination] + :ivar event_hubs_direct: List of Event Hubs Direct destinations. + :vartype event_hubs_direct: list[~azure.mgmt.monitor.models.EventHubDirectDestination] + :ivar storage_blobs_direct: List of Storage Blob Direct destinations. To be used only for + sending data directly to store from the agent. + :vartype storage_blobs_direct: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :ivar storage_tables_direct: List of Storage Table Direct destinations. + :vartype storage_tables_direct: list[~azure.mgmt.monitor.models.StorageTableDestination] + :ivar storage_accounts: List of storage accounts destinations. + :vartype storage_accounts: list[~azure.mgmt.monitor.models.StorageBlobDestination] + :ivar microsoft_fabric: List of Microsoft Fabric destinations. + :vartype microsoft_fabric: list[~azure.mgmt.monitor.models.MicrosoftFabricDestination] + :ivar azure_data_explorer: List of Azure Data Explorer destinations. + :vartype azure_data_explorer: list[~azure.mgmt.monitor.models.AdxDestination] + """ + + +class EndpointsSpec(_serialization.Model): + """This defines all the ingestion endpoints that can be used by this rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar logs_ingestion: The ingestion endpoint for logs. + :vartype logs_ingestion: str + :ivar metrics_ingestion: The ingestion endpoint for metrics. + :vartype metrics_ingestion: str + """ + + _validation = { + "logs_ingestion": {"readonly": True}, + "metrics_ingestion": {"readonly": True}, + } + + _attribute_map = { + "logs_ingestion": {"key": "logsIngestion", "type": "str"}, + "metrics_ingestion": {"key": "metricsIngestion", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.logs_ingestion: Optional[str] = None + self.metrics_ingestion: Optional[str] = None + + +class DataCollectionRuleEndpoints(EndpointsSpec): + """Defines the ingestion endpoints to send data to via this rule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar logs_ingestion: The ingestion endpoint for logs. + :vartype logs_ingestion: str + :ivar metrics_ingestion: The ingestion endpoint for metrics. + :vartype metrics_ingestion: str + """ + + +class DataCollectionRuleMetadata(Metadata): + """Metadata about the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioned_by: Azure offering managing this resource on-behalf-of customer. + :vartype provisioned_by: str + :ivar provisioned_by_resource_id: Resource Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_resource_id: str + :ivar provisioned_by_immutable_id: Immutable Id of azure offering managing this resource + on-behalf-of customer. + :vartype provisioned_by_immutable_id: str + """ + + +class ReferencesSpec(_serialization.Model): + """This section defines all the references that may be used in other sections of the DCR. + + :ivar enrichment_data: All the enrichment data sources referenced in data flows. + :vartype enrichment_data: ~azure.mgmt.monitor.models.ReferencesSpecEnrichmentData + """ + + _attribute_map = { + "enrichment_data": {"key": "enrichmentData", "type": "ReferencesSpecEnrichmentData"}, + } + + def __init__( + self, *, enrichment_data: Optional["_models.ReferencesSpecEnrichmentData"] = None, **kwargs: Any + ) -> None: + """ + :keyword enrichment_data: All the enrichment data sources referenced in data flows. + :paramtype enrichment_data: ~azure.mgmt.monitor.models.ReferencesSpecEnrichmentData + """ + super().__init__(**kwargs) + self.enrichment_data = enrichment_data + + +class DataCollectionRuleReferences(ReferencesSpec): + """Defines all the references that may be used in other sections of the DCR. + + :ivar enrichment_data: All the enrichment data sources referenced in data flows. + :vartype enrichment_data: ~azure.mgmt.monitor.models.ReferencesSpecEnrichmentData + """ + + +class DataCollectionRuleResource(_serialization.Model): + """Definition of ARM tracked top level resource. + + 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 server. + + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of the resource. Known values are: "Linux" and "Windows". + :vartype kind: str or ~azure.mgmt.monitor.models.KnownDataCollectionRuleResourceKind + :ivar identity: Managed service identity of the resource. + :vartype identity: ~azure.mgmt.monitor.models.DataCollectionRuleResourceIdentity + :ivar id: Fully qualified ID of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.monitor.models.DataCollectionRuleResourceSystemData + :ivar description: Description of the data collection rule. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that this + rule can be used with. + :vartype data_collection_endpoint_id: str + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleMetadata + :ivar endpoints: Defines the ingestion endpoints to send data to via this rule. + :vartype endpoints: ~azure.mgmt.monitor.models.DataCollectionRuleEndpoints + :ivar references: Defines all the references that may be used in other sections of the DCR. + :vartype references: ~azure.mgmt.monitor.models.DataCollectionRuleReferences + :ivar agent_settings: Agent settings used to modify agent behavior on a given host. + :vartype agent_settings: ~azure.mgmt.monitor.models.DataCollectionRuleAgentSettings + :ivar stream_declarations: Declaration of custom streams used in this rule. + :vartype stream_declarations: dict[str, ~azure.mgmt.monitor.models.StreamDeclaration] + :ivar data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :vartype data_sources: ~azure.mgmt.monitor.models.DataCollectionRuleDataSources + :ivar destinations: The specification of destinations. + :vartype destinations: ~azure.mgmt.monitor.models.DataCollectionRuleDestinations + :ivar data_flows: The specification of data flows. + :vartype data_flows: list[~azure.mgmt.monitor.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleProvisioningState + """ + + _validation = { + "location": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "immutable_id": {"readonly": True}, + "metadata": {"readonly": True}, + "endpoints": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "DataCollectionRuleResourceIdentity"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "DataCollectionRuleResourceSystemData"}, + "description": {"key": "properties.description", "type": "str"}, + "immutable_id": {"key": "properties.immutableId", "type": "str"}, + "data_collection_endpoint_id": {"key": "properties.dataCollectionEndpointId", "type": "str"}, + "metadata": {"key": "properties.metadata", "type": "DataCollectionRuleMetadata"}, + "endpoints": {"key": "properties.endpoints", "type": "DataCollectionRuleEndpoints"}, + "references": {"key": "properties.references", "type": "DataCollectionRuleReferences"}, + "agent_settings": {"key": "properties.agentSettings", "type": "DataCollectionRuleAgentSettings"}, + "stream_declarations": {"key": "properties.streamDeclarations", "type": "{StreamDeclaration}"}, + "data_sources": {"key": "properties.dataSources", "type": "DataCollectionRuleDataSources"}, + "destinations": {"key": "properties.destinations", "type": "DataCollectionRuleDestinations"}, + "data_flows": {"key": "properties.dataFlows", "type": "[DataFlow]"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "_models.KnownDataCollectionRuleResourceKind"]] = None, + identity: Optional["_models.DataCollectionRuleResourceIdentity"] = None, + description: Optional[str] = None, + data_collection_endpoint_id: Optional[str] = None, + references: Optional["_models.DataCollectionRuleReferences"] = None, + agent_settings: Optional["_models.DataCollectionRuleAgentSettings"] = None, + stream_declarations: Optional[Dict[str, "_models.StreamDeclaration"]] = None, + data_sources: Optional["_models.DataCollectionRuleDataSources"] = None, + destinations: Optional["_models.DataCollectionRuleDestinations"] = None, + data_flows: Optional[List["_models.DataFlow"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of the resource. Known values are: "Linux" and "Windows". + :paramtype kind: str or ~azure.mgmt.monitor.models.KnownDataCollectionRuleResourceKind + :keyword identity: Managed service identity of the resource. + :paramtype identity: ~azure.mgmt.monitor.models.DataCollectionRuleResourceIdentity + :keyword description: Description of the data collection rule. + :paramtype description: str + :keyword data_collection_endpoint_id: The resource ID of the data collection endpoint that this + rule can be used with. + :paramtype data_collection_endpoint_id: str + :keyword references: Defines all the references that may be used in other sections of the DCR. + :paramtype references: ~azure.mgmt.monitor.models.DataCollectionRuleReferences + :keyword agent_settings: Agent settings used to modify agent behavior on a given host. + :paramtype agent_settings: ~azure.mgmt.monitor.models.DataCollectionRuleAgentSettings + :keyword stream_declarations: Declaration of custom streams used in this rule. + :paramtype stream_declarations: dict[str, ~azure.mgmt.monitor.models.StreamDeclaration] + :keyword data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :paramtype data_sources: ~azure.mgmt.monitor.models.DataCollectionRuleDataSources + :keyword destinations: The specification of destinations. + :paramtype destinations: ~azure.mgmt.monitor.models.DataCollectionRuleDestinations + :keyword data_flows: The specification of data flows. + :paramtype data_flows: list[~azure.mgmt.monitor.models.DataFlow] + """ + super().__init__(**kwargs) + self.location = location + self.tags = tags + self.kind = kind + self.identity = identity + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.etag: Optional[str] = None + self.system_data: Optional["_models.DataCollectionRuleResourceSystemData"] = None + self.description = description + self.immutable_id: Optional[str] = None + self.data_collection_endpoint_id = data_collection_endpoint_id + self.metadata: Optional["_models.DataCollectionRuleMetadata"] = None + self.endpoints: Optional["_models.DataCollectionRuleEndpoints"] = None + self.references = references + self.agent_settings = agent_settings + self.stream_declarations = stream_declarations + self.data_sources = data_sources + self.destinations = destinations + self.data_flows = data_flows + self.provisioning_state: Optional[Union[str, "_models.KnownDataCollectionRuleProvisioningState"]] = None + + +class DataCollectionRuleResourceIdentity(ManagedServiceIdentity): + """Managed service identity of the resource. + + 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 server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.monitor.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserAssignedIdentity] + """ + + +class DataCollectionRuleResourceListResult(_serialization.Model): + """A pageable list of resources. + + All required parameters must be populated in order to send to server. + + :ivar value: A list of resources. Required. + :vartype value: list[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DataCollectionRuleResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.DataCollectionRuleResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A list of resources. Required. + :paramtype value: list[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DataCollectionRuleResourceProperties(DataCollectionRule): + """Resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the data collection rule. + :vartype description: str + :ivar immutable_id: The immutable ID of this data collection rule. This property is READ-ONLY. + :vartype immutable_id: str + :ivar data_collection_endpoint_id: The resource ID of the data collection endpoint that this + rule can be used with. + :vartype data_collection_endpoint_id: str + :ivar metadata: Metadata about the resource. + :vartype metadata: ~azure.mgmt.monitor.models.DataCollectionRuleMetadata + :ivar endpoints: Defines the ingestion endpoints to send data to via this rule. + :vartype endpoints: ~azure.mgmt.monitor.models.DataCollectionRuleEndpoints + :ivar references: Defines all the references that may be used in other sections of the DCR. + :vartype references: ~azure.mgmt.monitor.models.DataCollectionRuleReferences + :ivar agent_settings: Agent settings used to modify agent behavior on a given host. + :vartype agent_settings: ~azure.mgmt.monitor.models.DataCollectionRuleAgentSettings + :ivar stream_declarations: Declaration of custom streams used in this rule. + :vartype stream_declarations: dict[str, ~azure.mgmt.monitor.models.StreamDeclaration] + :ivar data_sources: The specification of data sources. + This property is optional and can be omitted if the rule is meant to be used via direct calls + to the provisioned endpoint. + :vartype data_sources: ~azure.mgmt.monitor.models.DataCollectionRuleDataSources + :ivar destinations: The specification of destinations. + :vartype destinations: ~azure.mgmt.monitor.models.DataCollectionRuleDestinations + :ivar data_flows: The specification of data flows. + :vartype data_flows: list[~azure.mgmt.monitor.models.DataFlow] + :ivar provisioning_state: The resource provisioning state. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.KnownDataCollectionRuleProvisioningState + """ + + +class DataCollectionRuleResourceSystemData(SystemData): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + +class DataContainer(_serialization.Model): + """Information about a container with data for a given resource. All required parameters must be populated in order to send to server. - :ivar name: Name of the baseline metadata. Required. - :vartype name: str - :ivar value: Value of the baseline metadata. Required. - :vartype value: str + :ivar workspace: Log Analytics workspace information. Required. + :vartype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo """ _validation = { - "name": {"required": True}, - "value": {"required": True}, + "workspace": {"required": True}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "workspace": {"key": "workspace", "type": "WorkspaceInfo"}, } - def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + def __init__(self, *, workspace: "_models.WorkspaceInfo", **kwargs: Any) -> None: """ - :keyword name: Name of the baseline metadata. Required. - :paramtype name: str - :keyword value: Value of the baseline metadata. Required. - :paramtype value: str + :keyword workspace: Log Analytics workspace information. Required. + :paramtype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo """ super().__init__(**kwargs) - self.name = name - self.value = value + self.workspace = workspace -class Context(_serialization.Model): - """The context info. +class DataFlow(_serialization.Model): + """Definition of which streams are sent to which destinations. - :ivar notification_source: The source of the notification request. - :vartype notification_source: str - :ivar context_type: The context id type. - :vartype context_type: str + :ivar streams: List of streams for this data flow. + :vartype streams: list[str or ~azure.mgmt.monitor.models.KnownDataFlowStreams] + :ivar destinations: List of destinations for this data flow. + :vartype destinations: list[str] + :ivar transform_kql: The KQL query to transform stream data. + :vartype transform_kql: str + :ivar output_stream: The output stream of the transform. Only required if the transform changes + data to a different stream. + :vartype output_stream: str + :ivar built_in_transform: The builtIn transform to transform stream data. + :vartype built_in_transform: str + :ivar capture_overflow: Flag to enable overflow column in LA destinations. + :vartype capture_overflow: bool """ _attribute_map = { - "notification_source": {"key": "notificationSource", "type": "str"}, - "context_type": {"key": "contextType", "type": "str"}, + "streams": {"key": "streams", "type": "[str]"}, + "destinations": {"key": "destinations", "type": "[str]"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "output_stream": {"key": "outputStream", "type": "str"}, + "built_in_transform": {"key": "builtInTransform", "type": "str"}, + "capture_overflow": {"key": "captureOverflow", "type": "bool"}, } def __init__( - self, *, notification_source: Optional[str] = None, context_type: Optional[str] = None, **kwargs: Any + self, + *, + streams: Optional[List[Union[str, "_models.KnownDataFlowStreams"]]] = None, + destinations: Optional[List[str]] = None, + transform_kql: Optional[str] = None, + output_stream: Optional[str] = None, + built_in_transform: Optional[str] = None, + capture_overflow: Optional[bool] = None, + **kwargs: Any ) -> None: """ - :keyword notification_source: The source of the notification request. - :paramtype notification_source: str - :keyword context_type: The context id type. - :paramtype context_type: str + :keyword streams: List of streams for this data flow. + :paramtype streams: list[str or ~azure.mgmt.monitor.models.KnownDataFlowStreams] + :keyword destinations: List of destinations for this data flow. + :paramtype destinations: list[str] + :keyword transform_kql: The KQL query to transform stream data. + :paramtype transform_kql: str + :keyword output_stream: The output stream of the transform. Only required if the transform + changes data to a different stream. + :paramtype output_stream: str + :keyword built_in_transform: The builtIn transform to transform stream data. + :paramtype built_in_transform: str + :keyword capture_overflow: Flag to enable overflow column in LA destinations. + :paramtype capture_overflow: bool """ super().__init__(**kwargs) - self.notification_source = notification_source - self.context_type = context_type - + self.streams = streams + self.destinations = destinations + self.transform_kql = transform_kql + self.output_stream = output_stream + self.built_in_transform = built_in_transform + self.capture_overflow = capture_overflow -class Criteria(_serialization.Model): - """Specifies the criteria for converting log to metric. - All required parameters must be populated in order to send to server. +class DataImportSources(_serialization.Model): + """DataImportSources. - :ivar metric_name: Name of the metric. Required. - :vartype metric_name: str - :ivar dimensions: List of Dimensions for creating metric. - :vartype dimensions: list[~azure.mgmt.monitor.models.Dimension] + :ivar event_hub: Definition of Event Hub configuration. + :vartype event_hub: ~azure.mgmt.monitor.models.DataImportSourcesEventHub """ - _validation = { - "metric_name": {"required": True}, - } - _attribute_map = { - "metric_name": {"key": "metricName", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[Dimension]"}, + "event_hub": {"key": "eventHub", "type": "DataImportSourcesEventHub"}, } - def __init__( - self, *, metric_name: str, dimensions: Optional[List["_models.Dimension"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, event_hub: Optional["_models.DataImportSourcesEventHub"] = None, **kwargs: Any) -> None: """ - :keyword metric_name: Name of the metric. Required. - :paramtype metric_name: str - :keyword dimensions: List of Dimensions for creating metric. - :paramtype dimensions: list[~azure.mgmt.monitor.models.Dimension] + :keyword event_hub: Definition of Event Hub configuration. + :paramtype event_hub: ~azure.mgmt.monitor.models.DataImportSourcesEventHub """ super().__init__(**kwargs) - self.metric_name = metric_name - self.dimensions = dimensions + self.event_hub = event_hub -class DataContainer(_serialization.Model): - """Information about a container with data for a given resource. - - All required parameters must be populated in order to send to server. +class EventHubDataSource(_serialization.Model): + """EventHubDataSource. - :ivar workspace: Log Analytics workspace information. Required. - :vartype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + :ivar consumer_group: Event Hub consumer group name. + :vartype consumer_group: str + :ivar stream: The stream to collect from EventHub. + :vartype stream: str """ - _validation = { - "workspace": {"required": True}, - } - _attribute_map = { - "workspace": {"key": "workspace", "type": "WorkspaceInfo"}, + "name": {"key": "name", "type": "str"}, + "consumer_group": {"key": "consumerGroup", "type": "str"}, + "stream": {"key": "stream", "type": "str"}, } - def __init__(self, *, workspace: "_models.WorkspaceInfo", **kwargs: Any) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + consumer_group: Optional[str] = None, + stream: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword workspace: Log Analytics workspace information. Required. - :paramtype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + :keyword consumer_group: Event Hub consumer group name. + :paramtype consumer_group: str + :keyword stream: The stream to collect from EventHub. + :paramtype stream: str """ super().__init__(**kwargs) - self.workspace = workspace + self.name = name + self.consumer_group = consumer_group + self.stream = stream + + +class DataImportSourcesEventHub(EventHubDataSource): + """Definition of Event Hub configuration. + + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + :ivar consumer_group: Event Hub consumer group name. + :vartype consumer_group: str + :ivar stream: The stream to collect from EventHub. + :vartype stream: str + """ class DataSource(_serialization.Model): @@ -2311,6 +4314,24 @@ def __init__( self.event_logs = event_logs +class DataSourcesSpecDataImports(DataImportSources): + """Specifications of pull based data sources. + + :ivar event_hub: Definition of Event Hub configuration. + :vartype event_hub: ~azure.mgmt.monitor.models.DataImportSourcesEventHub + """ + + +class DestinationsSpecAzureMonitorMetrics(AzureMonitorMetricsDestination): + """Azure Monitor Metrics destination. + + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + class ProxyOnlyResource(_serialization.Model): """A proxy only azure resource object. @@ -3016,6 +5037,26 @@ def __init__(self, *, receiver_name: str, **kwargs: Any) -> None: self.receiver_name = receiver_name +class EnrichmentData(_serialization.Model): + """All the enrichment data sources referenced in data flows. + + :ivar storage_blobs: All the storage blobs used as enrichment data sources. + :vartype storage_blobs: list[~azure.mgmt.monitor.models.StorageBlob] + """ + + _attribute_map = { + "storage_blobs": {"key": "storageBlobs", "type": "[StorageBlob]"}, + } + + def __init__(self, *, storage_blobs: Optional[List["_models.StorageBlob"]] = None, **kwargs: Any) -> None: + """ + :keyword storage_blobs: All the storage blobs used as enrichment data sources. + :paramtype storage_blobs: list[~azure.mgmt.monitor.models.StorageBlob] + """ + super().__init__(**kwargs) + self.storage_blobs = storage_blobs + + class Error(_serialization.Model): """Error details. @@ -3215,6 +5256,49 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None +class ErrorDetailAutoGenerated2(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.monitor.models.ErrorDetailAutoGenerated2] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetailAutoGenerated2]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetailAutoGenerated2"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None + + class ErrorResponse(_serialization.Model): """Describes the format of Error response. @@ -3341,6 +5425,27 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None +class ErrorResponseCommonV2(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.monitor.models.ErrorDetailAutoGenerated2 + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetailAutoGenerated2"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetailAutoGenerated2"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.monitor.models.ErrorDetailAutoGenerated2 + """ + super().__init__(**kwargs) + self.error = error + + class ErrorResponseError(_serialization.Model): """ErrorResponseError. @@ -3731,6 +5836,70 @@ def __init__(self, *, value: List["_models.EventData"], next_link: Optional[str] self.next_link = next_link +class EventHubDestination(_serialization.Model): + """EventHubDestination. + + :ivar event_hub_resource_id: The resource ID of the event hub. + :vartype event_hub_resource_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "event_hub_resource_id": {"key": "eventHubResourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, *, event_hub_resource_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword event_hub_resource_id: The resource ID of the event hub. + :paramtype event_hub_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.event_hub_resource_id = event_hub_resource_id + self.name = name + + +class EventHubDirectDestination(_serialization.Model): + """EventHubDirectDestination. + + :ivar event_hub_resource_id: The resource ID of the event hub. + :vartype event_hub_resource_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "event_hub_resource_id": {"key": "eventHubResourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, *, event_hub_resource_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword event_hub_resource_id: The resource ID of the event hub. + :paramtype event_hub_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.event_hub_resource_id = event_hub_resource_id + self.name = name + + class EventHubReceiver(_serialization.Model): """An Event hub receiver. @@ -3823,17 +5992,88 @@ class EventLogConfiguration(_serialization.Model): } def __init__( - self, *, log_name: str, filter: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + self, *, log_name: str, filter: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword log_name: Required. + :paramtype log_name: str + :keyword filter: + :paramtype filter: str + """ + super().__init__(**kwargs) + self.log_name = log_name + self.filter = filter + + +class ExtensionDataSource(_serialization.Model): + """Definition of which data will be collected from a separate VM extension that integrates with + the Azure Monitor Agent. + Collected from either Windows and Linux machines, depending on which extension is defined. + + All required parameters must be populated in order to send to server. + + :ivar streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :vartype streams: list[str or ~azure.mgmt.monitor.models.KnownExtensionDataSourceStreams] + :ivar extension_name: The name of the VM extension. Required. + :vartype extension_name: str + :ivar extension_settings: The extension settings. The format is specific for particular + extension. + :vartype extension_settings: JSON + :ivar input_data_sources: The list of data sources this extension needs data from. + :vartype input_data_sources: list[str] + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "extension_name": {"required": True}, + } + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "extension_name": {"key": "extensionName", "type": "str"}, + "extension_settings": {"key": "extensionSettings", "type": "object"}, + "input_data_sources": {"key": "inputDataSources", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + extension_name: str, + streams: Optional[List[Union[str, "_models.KnownExtensionDataSourceStreams"]]] = None, + extension_settings: Optional[JSON] = None, + input_data_sources: Optional[List[str]] = None, + name: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword log_name: Required. - :paramtype log_name: str - :keyword filter: - :paramtype filter: str + :keyword streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :paramtype streams: list[str or ~azure.mgmt.monitor.models.KnownExtensionDataSourceStreams] + :keyword extension_name: The name of the VM extension. Required. + :paramtype extension_name: str + :keyword extension_settings: The extension settings. The format is specific for particular + extension. + :paramtype extension_settings: JSON + :keyword input_data_sources: The list of data sources this extension needs data from. + :paramtype input_data_sources: list[str] + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str """ super().__init__(**kwargs) - self.log_name = log_name - self.filter = filter + self.streams = streams + self.extension_name = extension_name + self.extension_settings = extension_settings + self.input_data_sources = input_data_sources + self.name = name class GuestDiagnosticSettingsAssociationList(_serialization.Model): @@ -4161,6 +6401,62 @@ def __init__( self.uri = uri +class IisLogsDataSource(_serialization.Model): + """Enables IIS logs to be collected by this data collection rule. + + All required parameters must be populated in order to send to server. + + :ivar streams: IIS streams. Required. + :vartype streams: list[str] + :ivar log_directories: Absolute paths file location. + :vartype log_directories: list[str] + :ivar transform_kql: The KQL query to transform the data source. + :vartype transform_kql: str + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "streams": {"required": True}, + } + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "log_directories": {"key": "logDirectories", "type": "[str]"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: List[str], + log_directories: Optional[List[str]] = None, + transform_kql: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: IIS streams. Required. + :paramtype streams: list[str] + :keyword log_directories: Absolute paths file location. + :paramtype log_directories: list[str] + :keyword transform_kql: The KQL query to transform the data source. + :paramtype transform_kql: str + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.log_directories = log_directories + self.transform_kql = transform_kql + self.name = name + + class Incident(_serialization.Model): """An alert incident indicates the activation status of an alert rule. @@ -4355,6 +6651,240 @@ def __init__(self, *, value: str, localized_value: Optional[str] = None, **kwarg self.localized_value = localized_value +class LocationSpec(_serialization.Model): + """LocationSpec. + + :ivar location: Name of location. + :vartype location: str + :ivar provisioning_status: The resource provisioning state in this location. Known values are: + "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :vartype provisioning_status: str or + ~azure.mgmt.monitor.models.KnownLocationSpecProvisioningStatus + """ + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "provisioning_status": {"key": "provisioningStatus", "type": "str"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + provisioning_status: Optional[Union[str, "_models.KnownLocationSpecProvisioningStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Name of location. + :paramtype location: str + :keyword provisioning_status: The resource provisioning state in this location. Known values + are: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed". + :paramtype provisioning_status: str or + ~azure.mgmt.monitor.models.KnownLocationSpecProvisioningStatus + """ + super().__init__(**kwargs) + self.location = location + self.provisioning_status = provisioning_status + + +class LogAnalyticsDestination(_serialization.Model): + """Log Analytics destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar workspace_resource_id: The resource ID of the Log Analytics workspace. + :vartype workspace_resource_id: str + :ivar workspace_id: The Customer ID of the Log Analytics workspace. + :vartype workspace_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "workspace_id": {"readonly": True}, + } + + _attribute_map = { + "workspace_resource_id": {"key": "workspaceResourceId", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, *, workspace_resource_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword workspace_resource_id: The resource ID of the Log Analytics workspace. + :paramtype workspace_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.workspace_resource_id = workspace_resource_id + self.workspace_id: Optional[str] = None + self.name = name + + +class LogFilesDataSource(_serialization.Model): + """Definition of which custom log files will be collected by this data collection rule. + + All required parameters must be populated in order to send to server. + + :ivar streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data source. Required. + :vartype streams: list[str] + :ivar file_patterns: File Patterns where the log files are located. Required. + :vartype file_patterns: list[str] + :ivar format: The data format of the log files. Required. Known values are: "json" and "text". + :vartype format: str or ~azure.mgmt.monitor.models.KnownLogFilesDataSourceFormat + :ivar settings: The log files specific settings. + :vartype settings: ~azure.mgmt.monitor.models.LogFilesDataSourceSettings + :ivar transform_kql: The KQL query to transform the data source. + :vartype transform_kql: str + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "streams": {"required": True}, + "file_patterns": {"required": True}, + "format": {"required": True}, + } + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "file_patterns": {"key": "filePatterns", "type": "[str]"}, + "format": {"key": "format", "type": "str"}, + "settings": {"key": "settings", "type": "LogFilesDataSourceSettings"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: List[str], + file_patterns: List[str], + format: Union[str, "_models.KnownLogFilesDataSourceFormat"], + settings: Optional["_models.LogFilesDataSourceSettings"] = None, + transform_kql: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data source. Required. + :paramtype streams: list[str] + :keyword file_patterns: File Patterns where the log files are located. Required. + :paramtype file_patterns: list[str] + :keyword format: The data format of the log files. Required. Known values are: "json" and + "text". + :paramtype format: str or ~azure.mgmt.monitor.models.KnownLogFilesDataSourceFormat + :keyword settings: The log files specific settings. + :paramtype settings: ~azure.mgmt.monitor.models.LogFilesDataSourceSettings + :keyword transform_kql: The KQL query to transform the data source. + :paramtype transform_kql: str + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.file_patterns = file_patterns + self.format = format + self.settings = settings + self.transform_kql = transform_kql + self.name = name + + +class LogFileSettings(_serialization.Model): + """Settings for different log file formats. + + :ivar text: Text settings. + :vartype text: ~azure.mgmt.monitor.models.LogFileSettingsText + """ + + _attribute_map = { + "text": {"key": "text", "type": "LogFileSettingsText"}, + } + + def __init__(self, *, text: Optional["_models.LogFileSettingsText"] = None, **kwargs: Any) -> None: + """ + :keyword text: Text settings. + :paramtype text: ~azure.mgmt.monitor.models.LogFileSettingsText + """ + super().__init__(**kwargs) + self.text = text + + +class LogFilesDataSourceSettings(LogFileSettings): + """The log files specific settings. + + :ivar text: Text settings. + :vartype text: ~azure.mgmt.monitor.models.LogFileSettingsText + """ + + +class LogFileTextSettings(_serialization.Model): + """Settings for text log files. + + All required parameters must be populated in order to send to server. + + :ivar record_start_timestamp_format: One of the supported timestamp formats. Required. Known + values are: "ISO 8601", "YYYY-MM-DD HH:MM:SS", "M/D/YYYY HH:MM:SS AM/PM", "Mon DD, YYYY + HH:MM:SS", "yyMMdd HH:mm:ss", "ddMMyy HH:mm:ss", "MMM d hh:mm:ss", "dd/MMM/yyyy:HH:mm:ss zzz", + and "yyyy-MM-ddTHH:mm:ssK". + :vartype record_start_timestamp_format: str or + ~azure.mgmt.monitor.models.KnownLogFileTextSettingsRecordStartTimestampFormat + """ + + _validation = { + "record_start_timestamp_format": {"required": True}, + } + + _attribute_map = { + "record_start_timestamp_format": {"key": "recordStartTimestampFormat", "type": "str"}, + } + + def __init__( + self, + *, + record_start_timestamp_format: Union[str, "_models.KnownLogFileTextSettingsRecordStartTimestampFormat"], + **kwargs: Any + ) -> None: + """ + :keyword record_start_timestamp_format: One of the supported timestamp formats. Required. Known + values are: "ISO 8601", "YYYY-MM-DD HH:MM:SS", "M/D/YYYY HH:MM:SS AM/PM", "Mon DD, YYYY + HH:MM:SS", "yyMMdd HH:mm:ss", "ddMMyy HH:mm:ss", "MMM d hh:mm:ss", "dd/MMM/yyyy:HH:mm:ss zzz", + and "yyyy-MM-ddTHH:mm:ssK". + :paramtype record_start_timestamp_format: str or + ~azure.mgmt.monitor.models.KnownLogFileTextSettingsRecordStartTimestampFormat + """ + super().__init__(**kwargs) + self.record_start_timestamp_format = record_start_timestamp_format + + +class LogFileSettingsText(LogFileTextSettings): + """Text settings. + + All required parameters must be populated in order to send to server. + + :ivar record_start_timestamp_format: One of the supported timestamp formats. Required. Known + values are: "ISO 8601", "YYYY-MM-DD HH:MM:SS", "M/D/YYYY HH:MM:SS AM/PM", "Mon DD, YYYY + HH:MM:SS", "yyMMdd HH:mm:ss", "ddMMyy HH:mm:ss", "MMM d hh:mm:ss", "dd/MMM/yyyy:HH:mm:ss zzz", + and "yyyy-MM-ddTHH:mm:ssK". + :vartype record_start_timestamp_format: str or + ~azure.mgmt.monitor.models.KnownLogFileTextSettingsRecordStartTimestampFormat + """ + + class LogicAppReceiver(_serialization.Model): """A logic app receiver. @@ -6561,6 +9091,103 @@ def __init__( self.count = count +class MicrosoftFabricDestination(_serialization.Model): + """Microsoft Fabric destination (non-Azure). + + :ivar tenant_id: The tenant id of the Microsoft Fabric resource. + :vartype tenant_id: str + :ivar artifact_id: The artifact id of the Microsoft Fabric resource. + :vartype artifact_id: str + :ivar database_name: The name of the database to which data will be ingested. + :vartype database_name: str + :ivar ingestion_uri: The ingestion uri of the Microsoft Fabric resource. + :vartype ingestion_uri: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "tenant_id": {"key": "tenantId", "type": "str"}, + "artifact_id": {"key": "artifactId", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "ingestion_uri": {"key": "ingestionUri", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + artifact_id: Optional[str] = None, + database_name: Optional[str] = None, + ingestion_uri: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tenant_id: The tenant id of the Microsoft Fabric resource. + :paramtype tenant_id: str + :keyword artifact_id: The artifact id of the Microsoft Fabric resource. + :paramtype artifact_id: str + :keyword database_name: The name of the database to which data will be ingested. + :paramtype database_name: str + :keyword ingestion_uri: The ingestion uri of the Microsoft Fabric resource. + :paramtype ingestion_uri: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.tenant_id = tenant_id + self.artifact_id = artifact_id + self.database_name = database_name + self.ingestion_uri = ingestion_uri + self.name = name + + +class MonitoringAccountDestination(_serialization.Model): + """Monitoring account destination. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar account_resource_id: The resource ID of the monitoring account. + :vartype account_resource_id: str + :ivar account_id: The immutable ID of the account. + :vartype account_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "account_id": {"readonly": True}, + } + + _attribute_map = { + "account_resource_id": {"key": "accountResourceId", "type": "str"}, + "account_id": {"key": "accountId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, account_resource_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword account_resource_id: The resource ID of the monitoring account. + :paramtype account_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.account_resource_id = account_resource_id + self.account_id: Optional[str] = None + self.name = name + + class NotificationRequestBody(_serialization.Model): """The request body which contain contact detail metadata. @@ -6964,6 +9591,77 @@ def __init__( self.error = error +class PerfCounterDataSource(_serialization.Model): + """Definition of which performance counters will be collected and how they will be collected by + this data collection rule. + Collected from both Windows and Linux machines where the counter is present. + + :ivar streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :vartype streams: list[str or ~azure.mgmt.monitor.models.KnownPerfCounterDataSourceStreams] + :ivar sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). + :vartype sampling_frequency_in_seconds: int + :ivar counter_specifiers: A list of specifier names of the performance counters you want to + collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :vartype counter_specifiers: list[str] + :ivar transform_kql: The KQL query to transform the data source. + :vartype transform_kql: str + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "sampling_frequency_in_seconds": {"key": "samplingFrequencyInSeconds", "type": "int"}, + "counter_specifiers": {"key": "counterSpecifiers", "type": "[str]"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "_models.KnownPerfCounterDataSourceStreams"]]] = None, + sampling_frequency_in_seconds: Optional[int] = None, + counter_specifiers: Optional[List[str]] = None, + transform_kql: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :paramtype streams: list[str or ~azure.mgmt.monitor.models.KnownPerfCounterDataSourceStreams] + :keyword sampling_frequency_in_seconds: The number of seconds between consecutive counter + measurements (samples). + :paramtype sampling_frequency_in_seconds: int + :keyword counter_specifiers: A list of specifier names of the performance counters you want to + collect. + Use a wildcard (*) to collect a counter for all instances. + To get a list of performance counters on Windows, run the command 'typeperf'. + :paramtype counter_specifiers: list[str] + :keyword transform_kql: The KQL query to transform the data source. + :paramtype transform_kql: str + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.sampling_frequency_in_seconds = sampling_frequency_in_seconds + self.counter_specifiers = counter_specifiers + self.transform_kql = transform_kql + self.name = name + + class PerformanceCounterConfiguration(_serialization.Model): """PerformanceCounterConfiguration. @@ -7003,6 +9701,42 @@ def __init__(self, *, name: str, sampling_period: str, instance: Optional[str] = self.instance = instance +class PlatformTelemetryDataSource(_serialization.Model): + """Definition of platform telemetry data source configuration. + + All required parameters must be populated in order to send to server. + + :ivar streams: List of platform telemetry streams to collect. Required. + :vartype streams: list[str] + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "streams": {"required": True}, + } + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__(self, *, streams: List[str], name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword streams: List of platform telemetry streams to collect. Required. + :paramtype streams: list[str] + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.name = name + + class PredictiveAutoscalePolicy(_serialization.Model): """The parameters for enabling predictive autoscale. @@ -7484,8 +10218,38 @@ class PrivateLinkResourceListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateLinkResource"]] = None - self.next_link: Optional[str] = None + self.value: Optional[List["_models.PrivateLinkResource"]] = None + self.next_link: Optional[str] = None + + +class PrivateLinkScopedResource(_serialization.Model): + """PrivateLinkScopedResource. + + :ivar resource_id: The resourceId of the Azure Monitor Private Link Scope Scoped Resource + through which this DCE is associated with a Azure Monitor Private Link Scope. + :vartype resource_id: str + :ivar scope_id: The immutableId of the Azure Monitor Private Link Scope Resource to which the + association is. + :vartype scope_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "scope_id": {"key": "scopeId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resourceId of the Azure Monitor Private Link Scope Scoped Resource + through which this DCE is associated with a Azure Monitor Private Link Scope. + :paramtype resource_id: str + :keyword scope_id: The immutableId of the Azure Monitor Private Link Scope Resource to which + the association is. + :paramtype scope_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.scope_id = scope_id class PrivateLinkServiceConnectionState(_serialization.Model): @@ -7572,6 +10336,57 @@ def __init__(self, *, status: str, description: str, **kwargs: Any) -> None: self.actions_required: Optional[str] = None +class PrometheusForwarderDataSource(_serialization.Model): + """Definition of Prometheus metrics forwarding configuration. + + :ivar streams: List of streams that this data source will be sent to. + :vartype streams: list[str or + ~azure.mgmt.monitor.models.KnownPrometheusForwarderDataSourceStreams] + :ivar label_include_filter: The list of label inclusion filters in the form of label + "name-value" pairs. + Currently only one label is supported: 'microsoft_metrics_include_label'. + Label values are matched case-insensitively. + :vartype label_include_filter: dict[str, str] + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "label_include_filter": {"key": "labelIncludeFilter", "type": "{str}"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "_models.KnownPrometheusForwarderDataSourceStreams"]]] = None, + label_include_filter: Optional[Dict[str, str]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: List of streams that this data source will be sent to. + :paramtype streams: list[str or + ~azure.mgmt.monitor.models.KnownPrometheusForwarderDataSourceStreams] + :keyword label_include_filter: The list of label inclusion filters in the form of label + "name-value" pairs. + Currently only one label is supported: 'microsoft_metrics_include_label'. + Label values are matched case-insensitively. + :paramtype label_include_filter: dict[str, str] + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.label_include_filter = label_include_filter + self.name = name + + class Recurrence(_serialization.Model): """The repeating times at which this profile begins. This element is not used if the FixedDate element is used. @@ -7729,6 +10544,71 @@ def __init__(self, *, time_zone: str, days: List[str], hours: List[int], minutes self.minutes = minutes +class ReferencesSpecEnrichmentData(EnrichmentData): + """All the enrichment data sources referenced in data flows. + + :ivar storage_blobs: All the storage blobs used as enrichment data sources. + :vartype storage_blobs: list[~azure.mgmt.monitor.models.StorageBlob] + """ + + +class ResourceForUpdate(_serialization.Model): + """Definition of ARM tracked top level resource properties for update operation. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed Service Identity. + :vartype identity: ~azure.mgmt.monitor.models.ResourceForUpdateIdentity + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ResourceForUpdateIdentity"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ResourceForUpdateIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed Service Identity. + :paramtype identity: ~azure.mgmt.monitor.models.ResourceForUpdateIdentity + """ + super().__init__(**kwargs) + self.tags = tags + self.identity = identity + + +class ResourceForUpdateIdentity(ManagedServiceIdentity): + """Managed Service Identity. + + 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 server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.monitor.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserAssignedIdentity] + """ + + class Response(_serialization.Model): """The response to a metrics query. @@ -8654,6 +11534,162 @@ def __init__( self.query_type = query_type +class StorageBlob(_serialization.Model): + """StorageBlob. + + :ivar resource_id: Resource Id of the storage account that hosts the blob. + :vartype resource_id: str + :ivar blob_url: Url of the storage blob. + :vartype blob_url: str + :ivar lookup_type: The type of lookup to perform on the blob. Known values are: "String" and + "Cidr". + :vartype lookup_type: str or ~azure.mgmt.monitor.models.KnownStorageBlobLookupType + :ivar name: The name of the enrichment data source used as an alias when referencing this data + source in data flows. + :vartype name: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "blob_url": {"key": "blobUrl", "type": "str"}, + "lookup_type": {"key": "lookupType", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + blob_url: Optional[str] = None, + lookup_type: Optional[Union[str, "_models.KnownStorageBlobLookupType"]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: Resource Id of the storage account that hosts the blob. + :paramtype resource_id: str + :keyword blob_url: Url of the storage blob. + :paramtype blob_url: str + :keyword lookup_type: The type of lookup to perform on the blob. Known values are: "String" and + "Cidr". + :paramtype lookup_type: str or ~azure.mgmt.monitor.models.KnownStorageBlobLookupType + :keyword name: The name of the enrichment data source used as an alias when referencing this + data source in data flows. + :paramtype name: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.blob_url = blob_url + self.lookup_type = lookup_type + self.name = name + + +class StorageBlobDestination(_serialization.Model): + """StorageBlobDestination. + + :ivar container_name: The container name of the Storage Blob. + :vartype container_name: str + :ivar storage_account_resource_id: The resource ID of the storage account. + :vartype storage_account_resource_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "container_name": {"key": "containerName", "type": "str"}, + "storage_account_resource_id": {"key": "storageAccountResourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + container_name: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_name: The container name of the Storage Blob. + :paramtype container_name: str + :keyword storage_account_resource_id: The resource ID of the storage account. + :paramtype storage_account_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.container_name = container_name + self.storage_account_resource_id = storage_account_resource_id + self.name = name + + +class StorageTableDestination(_serialization.Model): + """StorageTableDestination. + + :ivar table_name: The name of the Storage Table. + :vartype table_name: str + :ivar storage_account_resource_id: The resource ID of the storage account. + :vartype storage_account_resource_id: str + :ivar name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "table_name": {"key": "tableName", "type": "str"}, + "storage_account_resource_id": {"key": "storageAccountResourceId", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + table_name: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword table_name: The name of the Storage Table. + :paramtype table_name: str + :keyword storage_account_resource_id: The resource ID of the storage account. + :paramtype storage_account_resource_id: str + :keyword name: A friendly name for the destination. + This name should be unique across all destinations (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.table_name = table_name + self.storage_account_resource_id = storage_account_resource_id + self.name = name + + +class StreamDeclaration(_serialization.Model): + """Declaration of a custom stream. + + :ivar columns: List of columns used by data in this stream. + :vartype columns: list[~azure.mgmt.monitor.models.ColumnDefinition] + """ + + _attribute_map = { + "columns": {"key": "columns", "type": "[ColumnDefinition]"}, + } + + def __init__(self, *, columns: Optional[List["_models.ColumnDefinition"]] = None, **kwargs: Any) -> None: + """ + :keyword columns: List of columns used by data in this stream. + :paramtype columns: list[~azure.mgmt.monitor.models.ColumnDefinition] + """ + super().__init__(**kwargs) + self.columns = columns + + class SubscriptionProxyOnlyResource(_serialization.Model): """A proxy only azure resource object. @@ -8843,68 +11879,68 @@ def __init__(self, *, enabled: bool, category: Optional[str] = None, **kwargs: A self.enabled = enabled -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime +class SyslogDataSource(_serialization.Model): + """Definition of which syslog data will be collected and how it will be collected. + Only collected from Linux machines. + + :ivar streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :vartype streams: list[str or ~azure.mgmt.monitor.models.KnownSyslogDataSourceStreams] + :ivar facility_names: The list of facility names. + :vartype facility_names: list[str or + ~azure.mgmt.monitor.models.KnownSyslogDataSourceFacilityNames] + :ivar log_levels: The log levels to collect. + :vartype log_levels: list[str or ~azure.mgmt.monitor.models.KnownSyslogDataSourceLogLevels] + :ivar transform_kql: The KQL query to transform the data source. + :vartype transform_kql: str + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str """ _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "streams": {"key": "streams", "type": "[str]"}, + "facility_names": {"key": "facilityNames", "type": "[str]"}, + "log_levels": {"key": "logLevels", "type": "[str]"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "name": {"key": "name", "type": "str"}, } def __init__( self, *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, + streams: Optional[List[Union[str, "_models.KnownSyslogDataSourceStreams"]]] = None, + facility_names: Optional[List[Union[str, "_models.KnownSyslogDataSourceFacilityNames"]]] = None, + log_levels: Optional[List[Union[str, "_models.KnownSyslogDataSourceLogLevels"]]] = None, + transform_kql: Optional[str] = None, + name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime + :keyword streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :paramtype streams: list[str or ~azure.mgmt.monitor.models.KnownSyslogDataSourceStreams] + :keyword facility_names: The list of facility names. + :paramtype facility_names: list[str or + ~azure.mgmt.monitor.models.KnownSyslogDataSourceFacilityNames] + :keyword log_levels: The log levels to collect. + :paramtype log_levels: list[str or ~azure.mgmt.monitor.models.KnownSyslogDataSourceLogLevels] + :keyword transform_kql: The KQL query to transform the data source. + :paramtype transform_kql: str + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str """ super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + self.streams = streams + self.facility_names = facility_names + self.log_levels = log_levels + self.transform_kql = transform_kql + self.name = name class TagsResource(_serialization.Model): @@ -9230,6 +12266,34 @@ def __init__( self.metric_trigger = metric_trigger +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + class VMInsightsOnboardingStatus(ProxyResource): """VM Insights onboarding status for a resource. @@ -9512,6 +12576,113 @@ def __init__( self.failed_location_count = failed_location_count +class WindowsEventLogDataSource(_serialization.Model): + """Definition of which Windows Event Log events will be collected and how they will be collected. + Only collected from Windows machines. + + :ivar streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :vartype streams: list[str or ~azure.mgmt.monitor.models.KnownWindowsEventLogDataSourceStreams] + :ivar x_path_queries: A list of Windows Event Log queries in XPATH format. + :vartype x_path_queries: list[str] + :ivar transform_kql: The KQL query to transform the data source. + :vartype transform_kql: str + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "x_path_queries": {"key": "xPathQueries", "type": "[str]"}, + "transform_kql": {"key": "transformKql", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: Optional[List[Union[str, "_models.KnownWindowsEventLogDataSourceStreams"]]] = None, + x_path_queries: Optional[List[str]] = None, + transform_kql: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: List of streams that this data source will be sent to. + A stream indicates what schema will be used for this data and usually what table in Log + Analytics the data will be sent to. + :paramtype streams: list[str or + ~azure.mgmt.monitor.models.KnownWindowsEventLogDataSourceStreams] + :keyword x_path_queries: A list of Windows Event Log queries in XPATH format. + :paramtype x_path_queries: list[str] + :keyword transform_kql: The KQL query to transform the data source. + :paramtype transform_kql: str + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.x_path_queries = x_path_queries + self.transform_kql = transform_kql + self.name = name + + +class WindowsFirewallLogsDataSource(_serialization.Model): + """Enables Firewall logs to be collected by this data collection rule. + + All required parameters must be populated in order to send to server. + + :ivar streams: Firewall logs streams. Required. + :vartype streams: list[str] + :ivar profile_filter: Firewall logs profile filter. + :vartype profile_filter: list[str or + ~azure.mgmt.monitor.models.KnownWindowsFirewallLogsDataSourceProfileFilter] + :ivar name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :vartype name: str + """ + + _validation = { + "streams": {"required": True}, + } + + _attribute_map = { + "streams": {"key": "streams", "type": "[str]"}, + "profile_filter": {"key": "profileFilter", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + streams: List[str], + profile_filter: Optional[List[Union[str, "_models.KnownWindowsFirewallLogsDataSourceProfileFilter"]]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword streams: Firewall logs streams. Required. + :paramtype streams: list[str] + :keyword profile_filter: Firewall logs profile filter. + :paramtype profile_filter: list[str or + ~azure.mgmt.monitor.models.KnownWindowsFirewallLogsDataSourceProfileFilter] + :keyword name: A friendly name for the data source. + This name should be unique across all data sources (regardless of type) within the data + collection rule. + :paramtype name: str + """ + super().__init__(**kwargs) + self.streams = streams + self.profile_filter = profile_filter + self.name = name + + class WorkspaceInfo(_serialization.Model): """Information about a Log Analytics Workspace. diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_monitor_management_client_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_monitor_management_client_enums.py index 49c6884fd56a..7569306b3608 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_monitor_management_client_enums.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_monitor_management_client_enums.py @@ -159,6 +159,235 @@ class GuestDiagnosticSettingsOsType(str, Enum, metaclass=CaseInsensitiveEnumMeta LINUX = "Linux" +class KnownAgentSettingName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the setting. + Must be part of the list of supported settings. + """ + + MAX_DISK_QUOTA_IN_MB = "MaxDiskQuotaInMB" + USE_TIME_RECEIVED_FOR_FORWARDED_EVENTS = "UseTimeReceivedForForwardedEvents" + + +class KnownColumnDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the column data.""" + + STRING = "string" + INT = "int" + LONG = "long" + REAL = "real" + BOOLEAN = "boolean" + DATETIME = "datetime" + DYNAMIC = "dynamic" + INT_ENUM = "int" + + +class KnownDataCollectionEndpointProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource provisioning state. This property is READ-ONLY.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + +class KnownDataCollectionEndpointResourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of the resource.""" + + LINUX = "Linux" + WINDOWS = "Windows" + + +class KnownDataCollectionRuleAssociationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource provisioning state.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + +class KnownDataCollectionRuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource provisioning state.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + +class KnownDataCollectionRuleResourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of the resource.""" + + LINUX = "Linux" + WINDOWS = "Windows" + + +class KnownDataFlowStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownDataFlowStreams.""" + + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + + +class KnownExtensionDataSourceStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownExtensionDataSourceStreams.""" + + MICROSOFT_EVENT = "Microsoft-Event" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_SYSLOG = "Microsoft-Syslog" + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + + +class KnownLocationSpecProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource provisioning state in this location.""" + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + +class KnownLogFilesDataSourceFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The data format of the log files.""" + + JSON = "json" + TEXT = "text" + + +class KnownLogFileTextSettingsRecordStartTimestampFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """One of the supported timestamp formats.""" + + ISO8601 = "ISO 8601" + YYYY_MM_DD_HH_MM_SS = "YYYY-MM-DD HH:MM:SS" + M_D_YYYY_HH_MM_SS_AM_PM = "M/D/YYYY HH:MM:SS AM/PM" + MON_DD_YYYY_HH_MM_SS = "Mon DD, YYYY HH:MM:SS" + YY_M_MDD_HH_MM_SS = "yyMMdd HH:mm:ss" + DD_M_MYY_HH_MM_SS = "ddMMyy HH:mm:ss" + MMM_D_HH_MM_SS = "MMM d hh:mm:ss" + DD_MMM_YYYY_HH_MM_SS_ZZZ = "dd/MMM/yyyy:HH:mm:ss zzz" + YYYY_MM_DD_THH_MM_SS_K = "yyyy-MM-ddTHH:mm:ssK" + + +class KnownPerfCounterDataSourceStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownPerfCounterDataSourceStreams.""" + + MICROSOFT_PERF = "Microsoft-Perf" + MICROSOFT_INSIGHTS_METRICS = "Microsoft-InsightsMetrics" + + +class KnownPrometheusForwarderDataSourceStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownPrometheusForwarderDataSourceStreams.""" + + MICROSOFT_PROMETHEUS_METRICS = "Microsoft-PrometheusMetrics" + + +class KnownPublicNetworkAccessOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The configuration to set whether network access from public internet to the endpoints are + allowed. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + SECURED_BY_PERIMETER = "SecuredByPerimeter" + + +class KnownStorageBlobLookupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of lookup to perform on the blob.""" + + STRING = "String" + CIDR = "Cidr" + + +class KnownSyslogDataSourceFacilityNames(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownSyslogDataSourceFacilityNames.""" + + ASTERISK = "*" + ALERT = "alert" + AUDIT = "audit" + AUTH = "auth" + AUTHPRIV = "authpriv" + CLOCK = "clock" + CRON = "cron" + DAEMON = "daemon" + FTP = "ftp" + KERN = "kern" + LOCAL0 = "local0" + LOCAL1 = "local1" + LOCAL2 = "local2" + LOCAL3 = "local3" + LOCAL4 = "local4" + LOCAL5 = "local5" + LOCAL6 = "local6" + LOCAL7 = "local7" + LPR = "lpr" + MAIL = "mail" + MARK = "mark" + NEWS = "news" + NOPRI = "nopri" + NTP = "ntp" + SYSLOG = "syslog" + USER = "user" + UUCP = "uucp" + + +class KnownSyslogDataSourceLogLevels(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownSyslogDataSourceLogLevels.""" + + DEBUG = "Debug" + INFO = "Info" + NOTICE = "Notice" + WARNING = "Warning" + ERROR = "Error" + CRITICAL = "Critical" + ALERT = "Alert" + EMERGENCY = "Emergency" + ASTERISK = "*" + + +class KnownSyslogDataSourceStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownSyslogDataSourceStreams.""" + + MICROSOFT_SYSLOG = "Microsoft-Syslog" + + +class KnownWindowsEventLogDataSourceStreams(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownWindowsEventLogDataSourceStreams.""" + + MICROSOFT_WINDOWS_EVENT = "Microsoft-WindowsEvent" + MICROSOFT_EVENT = "Microsoft-Event" + + +class KnownWindowsFirewallLogsDataSourceProfileFilter(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """KnownWindowsFirewallLogsDataSourceProfileFilter.""" + + DOMAIN = "Domain" + PRIVATE = "Private" + PUBLIC = "Public" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + class MetricClass(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The class of the metric.""" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py index d3dc13bad996..897333a93e51 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py @@ -44,6 +44,9 @@ from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations # type: ignore from ._azure_monitor_workspaces_operations import AzureMonitorWorkspacesOperations # type: ignore from ._monitor_operations_operations import MonitorOperationsOperations # type: ignore +from ._data_collection_endpoints_operations import DataCollectionEndpointsOperations # type: ignore +from ._data_collection_rule_associations_operations import DataCollectionRuleAssociationsOperations # type: ignore +from ._data_collection_rules_operations import DataCollectionRulesOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -81,6 +84,9 @@ "SubscriptionDiagnosticSettingsOperations", "AzureMonitorWorkspacesOperations", "MonitorOperationsOperations", + "DataCollectionEndpointsOperations", + "DataCollectionRuleAssociationsOperations", + "DataCollectionRulesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_endpoints_operations.py new file mode 100644 index 000000000000..5a206975e890 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_endpoints_operations.py @@ -0,0 +1,803 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import MonitorManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, data_collection_endpoint_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionEndpointName": _SERIALIZER.url( + "data_collection_endpoint_name", data_collection_endpoint_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, data_collection_endpoint_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionEndpointName": _SERIALIZER.url( + "data_collection_endpoint_name", data_collection_endpoint_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, data_collection_endpoint_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionEndpointName": _SERIALIZER.url( + "data_collection_endpoint_name", data_collection_endpoint_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, data_collection_endpoint_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionEndpointName": _SERIALIZER.url( + "data_collection_endpoint_name", data_collection_endpoint_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataCollectionEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.MonitorManagementClient`'s + :attr:`data_collection_endpoints` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DataCollectionEndpointResource"]: + """Lists all data collection endpoints in the specified resource group. + + Lists all data collection endpoints in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DataCollectionEndpointResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionEndpointResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DataCollectionEndpointResource"]: + """Lists all data collection endpoints in the specified subscription. + + Lists all data collection endpoints in the specified subscription. + + :return: An iterator like instance of either DataCollectionEndpointResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionEndpointResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionEndpointResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Returns the specified data collection endpoint. + + Returns the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[_models.DataCollectionEndpointResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[Union[_models.DataCollectionEndpointResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Creates or updates a data collection endpoint. + + Creates or updates a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Is either a DataCollectionEndpointResource type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionEndpointResource or IO[bytes] + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionEndpointResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[_models.ResourceForUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + data_collection_endpoint_name: str, + body: Optional[Union[_models.ResourceForUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionEndpointResource: + """Updates part of a data collection endpoint. + + Updates part of a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :param body: The payload. Is either a ResourceForUpdate type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate or IO[bytes] + :return: DataCollectionEndpointResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionEndpointResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionEndpointResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ResourceForUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionEndpointResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any + ) -> None: + """Deletes a data collection endpoint. + + Deletes a data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rule_associations_operations.py new file mode 100644 index 000000000000..fad3e2345b6e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rule_associations_operations.py @@ -0,0 +1,720 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import MonitorManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations") + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_rule_request( + resource_group_name: str, data_collection_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_data_collection_endpoint_request( # pylint: disable=name-too-long + resource_group_name: str, data_collection_endpoint_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionEndpointName": _SERIALIZER.url( + "data_collection_endpoint_name", data_collection_endpoint_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_uri: str, association_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True, min_length=1), + "associationName": _SERIALIZER.url("association_name", association_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request(resource_uri: str, association_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True, min_length=1), + "associationName": _SERIALIZER.url("association_name", association_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request(resource_uri: str, association_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True, min_length=1), + "associationName": _SERIALIZER.url("association_name", association_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataCollectionRuleAssociationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.MonitorManagementClient`'s + :attr:`data_collection_rule_associations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource( + self, resource_uri: str, **kwargs: Any + ) -> ItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified resource. + + Lists associations for the specified resource. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_rule( + self, resource_group_name: str, data_collection_rule_name: str, **kwargs: Any + ) -> ItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified data collection rule. + + Lists associations for the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_rule_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_data_collection_endpoint( + self, resource_group_name: str, data_collection_endpoint_name: str, **kwargs: Any + ) -> ItemPaged["_models.DataCollectionRuleAssociationProxyOnlyResource"]: + """Lists associations for the specified data collection endpoint. + + Lists associations for the specified data collection endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_endpoint_name: The name of the data collection endpoint. The name is + case insensitive. Required. + :type data_collection_endpoint_name: str + :return: An iterator like instance of either DataCollectionRuleAssociationProxyOnlyResource or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_data_collection_endpoint_request( + resource_group_name=resource_group_name, + data_collection_endpoint_name=data_collection_endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResourceListResult", pipeline_response + ) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_uri: str, association_name: str, **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Returns the specified association. + + Returns the specified association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_uri: str, + association_name: str, + body: Optional[_models.DataCollectionRuleAssociationProxyOnlyResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_uri: str, + association_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_uri: str, + association_name: str, + body: Optional[Union[_models.DataCollectionRuleAssociationProxyOnlyResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleAssociationProxyOnlyResource: + """Creates or updates an association. + + Creates or updates an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :param body: The payload. Is either a DataCollectionRuleAssociationProxyOnlyResource type or a + IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource or + IO[bytes] + :return: DataCollectionRuleAssociationProxyOnlyResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleAssociationProxyOnlyResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleAssociationProxyOnlyResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionRuleAssociationProxyOnlyResource") + else: + _json = None + + _request = build_create_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "DataCollectionRuleAssociationProxyOnlyResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, association_name: str, **kwargs: Any + ) -> None: + """Deletes an association. + + Deletes an association. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :param association_name: The name of the association. The name is case insensitive. Required. + :type association_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_uri=resource_uri, + association_name=association_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rules_operations.py new file mode 100644 index 000000000000..ea3f5d822a81 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_data_collection_rules_operations.py @@ -0,0 +1,806 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import MonitorManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, data_collection_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, data_collection_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, data_collection_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + data_collection_rule_name: str, + subscription_id: str, + *, + delete_associations: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "dataCollectionRuleName": _SERIALIZER.url("data_collection_rule_name", data_collection_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if delete_associations is not None: + _params["deleteAssociations"] = _SERIALIZER.query("delete_associations", delete_associations, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataCollectionRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.MonitorManagementClient`'s + :attr:`data_collection_rules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.DataCollectionRuleResource"]: + """Lists all data collection rules in the specified resource group. + + Lists all data collection rules in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either DataCollectionRuleResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionRuleResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.DataCollectionRuleResource"]: + """Lists all data collection rules in the specified subscription. + + Lists all data collection rules in the specified subscription. + + :return: An iterator like instance of either DataCollectionRuleResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DataCollectionRuleResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + _request = HttpRequest("GET", next_link) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DataCollectionRuleResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, data_collection_rule_name: str, **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Returns the specified data collection rule. + + Returns the specified data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[_models.DataCollectionRuleResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[Union[_models.DataCollectionRuleResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Creates or updates a data collection rule. + + Creates or updates a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Is either a DataCollectionRuleResource type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.monitor.models.DataCollectionRuleResource or IO[bytes] + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "DataCollectionRuleResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[_models.ResourceForUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + data_collection_rule_name: str, + body: Optional[Union[_models.ResourceForUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.DataCollectionRuleResource: + """Updates part of a data collection rule. + + Updates part of a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param body: The payload. Is either a ResourceForUpdate type or a IO[bytes] type. Default value + is None. + :type body: ~azure.mgmt.monitor.models.ResourceForUpdate or IO[bytes] + :return: DataCollectionRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.DataCollectionRuleResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCollectionRuleResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ResourceForUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DataCollectionRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, data_collection_rule_name: str, delete_associations: bool = False, **kwargs: Any + ) -> None: + """Deletes a data collection rule. + + Deletes a data collection rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param data_collection_rule_name: The name of the data collection rule. The name is case + insensitive. Required. + :type data_collection_rule_name: str + :param delete_associations: If set to 'true' then all associations of this data collection rule + will also be deleted. Default value is False. + :type delete_associations: bool + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-11")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + data_collection_rule_name=data_collection_rule_name, + subscription_id=self._config.subscription_id, + delete_associations=delete_associations, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseCommonV2, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_create.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_create.py new file mode 100644 index 000000000000..b86e1f50bde7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_create.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.create( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpoint", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_delete.py new file mode 100644 index 000000000000..ce9043639f33 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + client.data_collection_endpoints.delete( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpoint", + ) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_get.py new file mode 100644 index 000000000000..5dc100f2e279 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.get( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpoint", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_resource_group.py new file mode 100644 index 000000000000..7e7ccfc0710a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_subscription.py new file mode 100644 index 000000000000..ec52bdcba882 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_list_by_subscription.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_patch.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_patch.py new file mode 100644 index 000000000000..b72fd0852a57 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_patch.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.update( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpoint", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsPatch.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_update.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_update.py new file mode 100644 index 000000000000..0940dc47dbf3 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_endpoints_update.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_endpoints_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_endpoints.create( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpoint", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionEndpointsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create.py new file mode 100644 index 000000000000..7e8bb12e68d7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.data_collection_rule_associations.create( + resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + association_name="myAssociation", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create_endpoint_assoc.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create_endpoint_assoc.py new file mode 100644 index 000000000000..bf99e0a339b0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_create_endpoint_assoc.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_create_endpoint_assoc.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.data_collection_rule_associations.create( + resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + association_name="configurationAccessEndpoint", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsCreateEndpointAssoc.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_delete.py new file mode 100644 index 000000000000..79a75c495746 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.data_collection_rule_associations.delete( + resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + association_name="myAssociation", + ) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_get.py new file mode 100644 index 000000000000..a49172794e85 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.data_collection_rule_associations.get( + resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + association_name="myAssociation", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_data_collection_endpoint.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_data_collection_endpoint.py new file mode 100644 index 000000000000..c0afbe3f8ad7 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_data_collection_endpoint.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_list_by_data_collection_endpoint.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rule_associations.list_by_data_collection_endpoint( + resource_group_name="myResourceGroup", + data_collection_endpoint_name="myDataCollectionEndpointName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_resource.py new file mode 100644 index 000000000000..077d688c1a31 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_resource.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_list_by_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.data_collection_rule_associations.list_by_resource( + resource_uri="subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsListByResource.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_rule.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_rule.py new file mode 100644 index 000000000000..539a8e486c6f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rule_associations_list_by_rule.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rule_associations_list_by_rule.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rule_associations.list_by_rule( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRuleAssociationsListByRule.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create.py new file mode 100644 index 000000000000..220ccf768b47 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.create( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_agent_settings.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_agent_settings.py new file mode 100644 index 000000000000..a1491455458e --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_agent_settings.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_create_agent_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.create( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesCreateAgentSettings.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_embedded_dce.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_embedded_dce.py new file mode 100644 index 000000000000..b3963b490223 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_embedded_dce.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_create_embedded_dce.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.create( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesCreateEmbeddedDCE.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_enrichment.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_enrichment.py new file mode 100644 index 000000000000..11e7c29d1a30 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_create_enrichment.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_create_enrichment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.create( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesCreateEnrichment.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_delete.py new file mode 100644 index 000000000000..4bd4642daabc --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + client.data_collection_rules.delete( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_get.py new file mode 100644 index 000000000000..4dee8b01ac3a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.get( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesGet.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_resource_group.py new file mode 100644 index 000000000000..9ebd3d74dc7f --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_subscription.py new file mode 100644 index 000000000000..092f97c7ccb2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_list_by_subscription.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_update.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_update.py new file mode 100644 index 000000000000..8ad84b7b61d5 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/data_collection_rules_update.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.monitor import MonitorManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-monitor +# USAGE + python data_collection_rules_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="703362b3-f278-4e4b-9179-c76eaf41ffc2", + ) + + response = client.data_collection_rules.update( + resource_group_name="myResourceGroup", + data_collection_rule_name="myCollectionRule", + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2023-03-11/examples/DataCollectionRulesUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations.py new file mode 100644 index 000000000000..fa7cbf84d2bb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations.py @@ -0,0 +1,88 @@ +# 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 pytest +from azure.mgmt.monitor import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_list_by_resource_group(self, resource_group): + response = self.client.data_collection_endpoints.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_list_by_subscription(self, resource_group): + response = self.client.data_collection_endpoints.list_by_subscription( + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_get(self, resource_group): + response = self.client.data_collection_endpoints.get( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_create(self, resource_group): + response = self.client.data_collection_endpoints.create( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_update(self, resource_group): + response = self.client.data_collection_endpoints.update( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_endpoints_delete(self, resource_group): + response = self.client.data_collection_endpoints.delete( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations_async.py new file mode 100644 index 000000000000..f278d8990703 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_endpoints_operations_async.py @@ -0,0 +1,89 @@ +# 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 pytest +from azure.mgmt.monitor.aio import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_list_by_resource_group(self, resource_group): + response = self.client.data_collection_endpoints.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_list_by_subscription(self, resource_group): + response = self.client.data_collection_endpoints.list_by_subscription( + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_get(self, resource_group): + response = await self.client.data_collection_endpoints.get( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_create(self, resource_group): + response = await self.client.data_collection_endpoints.create( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_update(self, resource_group): + response = await self.client.data_collection_endpoints.update( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_endpoints_delete(self, resource_group): + response = await self.client.data_collection_endpoints.delete( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations.py new file mode 100644 index 000000000000..31f19a6bd849 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations.py @@ -0,0 +1,90 @@ +# 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 pytest +from azure.mgmt.monitor import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionRuleAssociationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_list_by_resource(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_resource( + resource_uri="str", + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_list_by_rule(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_rule( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_list_by_data_collection_endpoint(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_data_collection_endpoint( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_get(self, resource_group): + response = self.client.data_collection_rule_associations.get( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_create(self, resource_group): + response = self.client.data_collection_rule_associations.create( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rule_associations_delete(self, resource_group): + response = self.client.data_collection_rule_associations.delete( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations_async.py new file mode 100644 index 000000000000..3e09fdb78dac --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rule_associations_operations_async.py @@ -0,0 +1,91 @@ +# 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 pytest +from azure.mgmt.monitor.aio import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionRuleAssociationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_list_by_resource(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_resource( + resource_uri="str", + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_list_by_rule(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_rule( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_list_by_data_collection_endpoint(self, resource_group): + response = self.client.data_collection_rule_associations.list_by_data_collection_endpoint( + resource_group_name=resource_group.name, + data_collection_endpoint_name="str", + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_get(self, resource_group): + response = await self.client.data_collection_rule_associations.get( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_create(self, resource_group): + response = await self.client.data_collection_rule_associations.create( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rule_associations_delete(self, resource_group): + response = await self.client.data_collection_rule_associations.delete( + resource_uri="str", + association_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations.py new file mode 100644 index 000000000000..062ee15ff8f0 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations.py @@ -0,0 +1,88 @@ +# 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 pytest +from azure.mgmt.monitor import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionRulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_list_by_resource_group(self, resource_group): + response = self.client.data_collection_rules.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_list_by_subscription(self, resource_group): + response = self.client.data_collection_rules.list_by_subscription( + api_version="2023-03-11", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_get(self, resource_group): + response = self.client.data_collection_rules.get( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_create(self, resource_group): + response = self.client.data_collection_rules.create( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_update(self, resource_group): + response = self.client.data_collection_rules.update( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_data_collection_rules_delete(self, resource_group): + response = self.client.data_collection_rules.delete( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations_async.py new file mode 100644 index 000000000000..cb2d94197ace --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_data_collection_rules_operations_async.py @@ -0,0 +1,89 @@ +# 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 pytest +from azure.mgmt.monitor.aio import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementDataCollectionRulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_list_by_resource_group(self, resource_group): + response = self.client.data_collection_rules.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_list_by_subscription(self, resource_group): + response = self.client.data_collection_rules.list_by_subscription( + api_version="2023-03-11", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_get(self, resource_group): + response = await self.client.data_collection_rules.get( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_create(self, resource_group): + response = await self.client.data_collection_rules.create( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_update(self, resource_group): + response = await self.client.data_collection_rules.update( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_data_collection_rules_delete(self, resource_group): + response = await self.client.data_collection_rules.delete( + resource_group_name=resource_group.name, + data_collection_rule_name="str", + api_version="2023-03-11", + ) + + # please add some check logic here by yourself + # ...