diff --git a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md index 7138c4721b61..68ce931bab47 100644 --- a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md +++ b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md @@ -1,5 +1,282 @@ # Release History +## 7.0.0b2 (2025-04-24) + +### Features Added + + - Model `ActionGroupPatchBody` added property `identity` + - Model `ActionGroupResource` added property `incident_receivers` + - Model `ActionGroupResource` added property `identity` + - Model `AutomationRunbookReceiver` added property `managed_identity` + - Model `AzureFunctionReceiver` added property `managed_identity` + - Model `AzureResource` added property `identity` + - Model `ErrorResponseAutoGenerated` added property `code` + - Model `ErrorResponseAutoGenerated` added property `message` + - Model `ErrorResponseAutoGenerated` added property `target` + - Model `ErrorResponseAutoGenerated` added property `details` + - Model `ErrorResponseAutoGenerated` added property `additional_info` + - Model `EventHubReceiver` added property `managed_identity` + - Model `LogicAppReceiver` added property `managed_identity` + - Model `NotificationRequestBody` added property `incident_receivers` + - Model `WebhookReceiver` added property `managed_identity` + - Added model `Actions` + - Added model `Condition` + - Added model `ConditionFailingPeriods` + - Added enum `ConditionOperator` + - Added enum `DimensionOperator` + - Added model `Identity` + - Added enum `IdentityType` + - Added enum `IncidentManagementService` + - Added model `IncidentReceiver` + - Added model `IncidentServiceConnection` + - Added enum `Kind` + - Added model `ManagedServiceIdentity` + - Added enum `ManagedServiceIdentityType` + - Added model `RuleResolveConfiguration` + - Added model `ScheduledQueryRuleCriteria` + - Added model `ScheduledQueryRuleResource` + - Added model `ScheduledQueryRuleResourceCollection` + - Added model `ScheduledQueryRuleResourcePatch` + - Added enum `TimeAggregation` + - Added model `UserAssignedIdentity` + - Added model `UserIdentityProperties` + - Method `ScheduledQueryRulesOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, rule_name: str, parameters: ScheduledQueryRuleResource, content_type: str)` + - Method `ScheduledQueryRulesOperations.update` has a new overload `def update(self: None, resource_group_name: str, rule_name: str, parameters: ScheduledQueryRuleResourcePatch, content_type: str)` + +### Breaking Changes + + - Deleted or renamed client operation group `MonitorManagementClient.activity_log_alerts` + - Deleted or renamed client operation group `MonitorManagementClient.activity_logs` + - Deleted or renamed client operation group `MonitorManagementClient.tenant_activity_logs` + - Deleted or renamed client operation group `MonitorManagementClient.alert_rule_incidents` + - Deleted or renamed client operation group `MonitorManagementClient.autoscale_settings` + - Deleted or renamed client operation group `MonitorManagementClient.predictive_metric` + - Deleted or renamed client operation group `MonitorManagementClient.baselines` + - Deleted or renamed client operation group `MonitorManagementClient.diagnostic_settings` + - Deleted or renamed client operation group `MonitorManagementClient.diagnostic_settings_category` + - Deleted or renamed client operation group `MonitorManagementClient.event_categories` + - Deleted or renamed client operation group `MonitorManagementClient.guest_diagnostics_settings` + - Deleted or renamed client operation group `MonitorManagementClient.guest_diagnostics_settings_association` + - Deleted or renamed client operation group `MonitorManagementClient.log_profiles` + - Deleted or renamed client operation group `MonitorManagementClient.metric_alerts` + - Deleted or renamed client operation group `MonitorManagementClient.metric_alerts_status` + - Deleted or renamed client operation group `MonitorManagementClient.metric_definitions` + - Deleted or renamed client operation group `MonitorManagementClient.metric_namespaces` + - Deleted or renamed client operation group `MonitorManagementClient.metrics` + - Deleted or renamed client operation group `MonitorManagementClient.operations` + - Deleted or renamed client operation group `MonitorManagementClient.service_diagnostic_settings` + - Deleted or renamed client operation group `MonitorManagementClient.vm_insights` + - Deleted or renamed client operation group `MonitorManagementClient.private_link_scopes` + - Deleted or renamed client operation group `MonitorManagementClient.private_link_scope_operation_status` + - Deleted or renamed client operation group `MonitorManagementClient.private_link_resources` + - Deleted or renamed client operation group `MonitorManagementClient.private_endpoint_connections` + - Deleted or renamed client operation group `MonitorManagementClient.private_link_scoped_resources` + - Deleted or renamed client operation group `MonitorManagementClient.subscription_diagnostic_settings` + - Model `ErrorResponseAutoGenerated` deleted or renamed its instance variable `error` + - Deleted or renamed model `Action` + - Deleted or renamed model `ActivityLogAlertActionGroup` + - Deleted or renamed model `ActivityLogAlertActionList` + - Deleted or renamed model `ActivityLogAlertAllOfCondition` + - Deleted or renamed model `ActivityLogAlertLeafCondition` + - Deleted or renamed model `ActivityLogAlertList` + - Deleted or renamed model `ActivityLogAlertPatchBody` + - Deleted or renamed model `ActivityLogAlertResource` + - Deleted or renamed model `AggregationType` + - Deleted or renamed model `AggregationTypeEnum` + - Deleted or renamed model `AlertingAction` + - Deleted or renamed model `AutoscaleErrorResponse` + - Deleted or renamed model `AutoscaleErrorResponseError` + - Deleted or renamed model `AutoscaleNotification` + - Deleted or renamed model `AutoscaleProfile` + - Deleted or renamed model `AutoscaleSettingResource` + - Deleted or renamed model `AutoscaleSettingResourceCollection` + - Deleted or renamed model `AutoscaleSettingResourcePatch` + - Deleted or renamed model `AzNsActionGroup` + - Deleted or renamed model `AzureMonitorPrivateLinkScope` + - Deleted or renamed model `BaselineMetadata` + - Deleted or renamed model `BaselineSensitivity` + - Deleted or renamed model `CategoryType` + - Deleted or renamed model `ComparisonOperationType` + - Deleted or renamed model `ConditionalOperator` + - Deleted or renamed model `Criteria` + - Deleted or renamed model `DataContainer` + - Deleted or renamed model `DataSource` + - Deleted or renamed model `DataSourceConfiguration` + - Deleted or renamed model `DataSourceKind` + - Deleted or renamed model `DataStatus` + - Deleted or renamed model `DiagnosticSettingsCategoryResource` + - Deleted or renamed model `DiagnosticSettingsCategoryResourceCollection` + - Deleted or renamed model `DiagnosticSettingsResource` + - Deleted or renamed model `DiagnosticSettingsResourceCollection` + - Deleted or renamed model `DynamicMetricCriteria` + - Deleted or renamed model `DynamicThresholdFailingPeriods` + - Deleted or renamed model `DynamicThresholdOperator` + - Deleted or renamed model `DynamicThresholdSensitivity` + - Deleted or renamed model `EmailNotification` + - Deleted or renamed model `Enabled` + - Deleted or renamed model `Error` + - Deleted or renamed model `ErrorDetail` + - Deleted or renamed model `ErrorDetailAdditionalInfoItem` + - Deleted or renamed model `ErrorResponseAutoGenerated2` + - Deleted or renamed model `ErrorResponseCommon` + - Deleted or renamed model `ErrorResponseError` + - Deleted or renamed model `ErrorResponseErrorAdditionalInfoItem` + - Deleted or renamed model `EtwEventConfiguration` + - Deleted or renamed model `EtwProviderConfiguration` + - Deleted or renamed model `EventCategoryCollection` + - Deleted or renamed model `EventData` + - Deleted or renamed model `EventDataCollection` + - Deleted or renamed model `EventLevel` + - Deleted or renamed model `EventLogConfiguration` + - Deleted or renamed model `GuestDiagnosticSettingsAssociationList` + - Deleted or renamed model `GuestDiagnosticSettingsAssociationResource` + - Deleted or renamed model `GuestDiagnosticSettingsAssociationResourcePatch` + - Deleted or renamed model `GuestDiagnosticSettingsList` + - Deleted or renamed model `GuestDiagnosticSettingsOsType` + - Deleted or renamed model `GuestDiagnosticSettingsPatchResource` + - Deleted or renamed model `GuestDiagnosticSettingsResource` + - Deleted or renamed model `HttpRequestInfo` + - Deleted or renamed model `Incident` + - Deleted or renamed model `LocalizableString` + - Deleted or renamed model `LocalizableStringAutoGenerated` + - Deleted or renamed model `LogMetricTrigger` + - Deleted or renamed model `LogProfileCollection` + - Deleted or renamed model `LogProfileResource` + - Deleted or renamed model `LogProfileResourcePatch` + - Deleted or renamed model `LogSearchRuleResource` + - Deleted or renamed model `LogSearchRuleResourceCollection` + - Deleted or renamed model `LogSearchRuleResourcePatch` + - Deleted or renamed model `LogSettings` + - Deleted or renamed model `LogSettingsAutoGenerated` + - Deleted or renamed model `LogToMetricAction` + - Deleted or renamed model `MetadataValue` + - Deleted or renamed model `Metric` + - Deleted or renamed model `MetricAlertAction` + - Deleted or renamed model `MetricAlertCriteria` + - Deleted or renamed model `MetricAlertMultipleResourceMultipleMetricCriteria` + - Deleted or renamed model `MetricAlertResource` + - Deleted or renamed model `MetricAlertResourceCollection` + - Deleted or renamed model `MetricAlertResourcePatch` + - Deleted or renamed model `MetricAlertSingleResourceMultipleMetricCriteria` + - Deleted or renamed model `MetricAlertStatus` + - Deleted or renamed model `MetricAlertStatusCollection` + - Deleted or renamed model `MetricAlertStatusProperties` + - Deleted or renamed model `MetricAvailability` + - Deleted or renamed model `MetricBaselinesResponse` + - Deleted or renamed model `MetricClass` + - Deleted or renamed model `MetricCriteria` + - Deleted or renamed model `MetricDefinition` + - Deleted or renamed model `MetricDefinitionCollection` + - Deleted or renamed model `MetricDimension` + - Deleted or renamed model `MetricNamespace` + - Deleted or renamed model `MetricNamespaceCollection` + - Deleted or renamed model `MetricNamespaceName` + - Deleted or renamed model `MetricSettings` + - Deleted or renamed model `MetricSettingsAutoGenerated` + - Deleted or renamed model `MetricSingleDimension` + - Deleted or renamed model `MetricStatisticType` + - Deleted or renamed model `MetricTrigger` + - Deleted or renamed model `MetricTriggerType` + - Deleted or renamed model `MetricUnit` + - Deleted or renamed model `MetricValue` + - Deleted or renamed model `MultiMetricCriteria` + - Deleted or renamed model `NamespaceClassification` + - Deleted or renamed model `Odatatype` + - Deleted or renamed model `OnboardingStatus` + - Deleted or renamed model `Operation` + - Deleted or renamed model `OperationDisplay` + - Deleted or renamed model `OperationStatus` + - Deleted or renamed model `Operator` + - Deleted or renamed model `PerformanceCounterConfiguration` + - Deleted or renamed model `PredictiveAutoscalePolicy` + - Deleted or renamed model `PredictiveAutoscalePolicyScaleMode` + - Deleted or renamed model `PredictiveResponse` + - Deleted or renamed model `PredictiveValue` + - Deleted or renamed model `PrivateEndpointConnection` + - Deleted or renamed model `PrivateEndpointProperty` + - Deleted or renamed model `PrivateLinkResource` + - Deleted or renamed model `PrivateLinkScopesResource` + - Deleted or renamed model `PrivateLinkServiceConnectionStateProperty` + - Deleted or renamed model `ProvisioningState` + - Deleted or renamed model `ProxyOnlyResource` + - Deleted or renamed model `ProxyResource` + - Deleted or renamed model `QueryType` + - Deleted or renamed model `Recurrence` + - Deleted or renamed model `RecurrenceFrequency` + - Deleted or renamed model `RecurrentSchedule` + - Deleted or renamed model `Resource` + - Deleted or renamed model `ResourceAutoGenerated` + - Deleted or renamed model `ResourceAutoGenerated2` + - Deleted or renamed model `ResourceAutoGenerated3` + - Deleted or renamed model `Response` + - Deleted or renamed model `ResponseWithError` + - Deleted or renamed model `ResultType` + - Deleted or renamed model `RetentionPolicy` + - Deleted or renamed model `ScaleAction` + - Deleted or renamed model `ScaleCapacity` + - Deleted or renamed model `ScaleDirection` + - Deleted or renamed model `ScaleRule` + - Deleted or renamed model `ScaleRuleMetricDimension` + - Deleted or renamed model `ScaleRuleMetricDimensionOperationType` + - Deleted or renamed model `ScaleType` + - Deleted or renamed model `Schedule` + - Deleted or renamed model `ScopedResource` + - Deleted or renamed model `SenderAuthorization` + - Deleted or renamed model `ServiceDiagnosticSettingsResource` + - Deleted or renamed model `ServiceDiagnosticSettingsResourcePatch` + - Deleted or renamed model `SingleBaseline` + - Deleted or renamed model `SingleMetricBaseline` + - Deleted or renamed model `SinkConfiguration` + - Deleted or renamed model `SinkConfigurationKind` + - Deleted or renamed model `Source` + - Deleted or renamed model `SubscriptionDiagnosticSettingsResource` + - Deleted or renamed model `SubscriptionDiagnosticSettingsResourceCollection` + - Deleted or renamed model `SubscriptionLogSettings` + - Deleted or renamed model `SubscriptionProxyOnlyResource` + - Deleted or renamed model `TagsResource` + - Deleted or renamed model `TimeAggregationType` + - Deleted or renamed model `TimeSeriesBaseline` + - Deleted or renamed model `TimeSeriesElement` + - Deleted or renamed model `TimeWindow` + - Deleted or renamed model `TriggerCondition` + - Deleted or renamed model `VMInsightsOnboardingStatus` + - Deleted or renamed model `WebhookNotification` + - Deleted or renamed model `WebtestLocationAvailabilityCriteria` + - Deleted or renamed model `WorkspaceInfo` + - Deleted or renamed method `ActionGroupsOperations.begin_create_notifications_at_resource_group_level` + - Deleted or renamed method `ActionGroupsOperations.begin_post_test_notifications` + - Deleted or renamed method `ActionGroupsOperations.get_test_notifications` + - Deleted or renamed method `ActionGroupsOperations.get_test_notifications_at_resource_group_level` + - Method `ScheduledQueryRulesOperations.list_by_resource_group` deleted or renamed its parameter `filter` of kind `positional_or_keyword` + - Method `ScheduledQueryRulesOperations.list_by_subscription` deleted or renamed its parameter `filter` of kind `positional_or_keyword` + - Deleted or renamed model `ActivityLogAlertsOperations` + - Deleted or renamed model `ActivityLogsOperations` + - Deleted or renamed model `AlertRuleIncidentsOperations` + - Deleted or renamed model `AutoscaleSettingsOperations` + - Deleted or renamed model `BaselinesOperations` + - Deleted or renamed model `DiagnosticSettingsCategoryOperations` + - Deleted or renamed model `DiagnosticSettingsOperations` + - Deleted or renamed model `EventCategoriesOperations` + - Deleted or renamed model `GuestDiagnosticsSettingsAssociationOperations` + - Deleted or renamed model `GuestDiagnosticsSettingsOperations` + - Deleted or renamed model `LogProfilesOperations` + - Deleted or renamed model `MetricAlertsOperations` + - Deleted or renamed model `MetricAlertsStatusOperations` + - Deleted or renamed model `MetricDefinitionsOperations` + - Deleted or renamed model `MetricNamespacesOperations` + - Deleted or renamed model `MetricsOperations` + - Deleted or renamed model `Operations` + - Deleted or renamed model `PredictiveMetricOperations` + - Deleted or renamed model `PrivateEndpointConnectionsOperations` + - Deleted or renamed model `PrivateLinkResourcesOperations` + - Deleted or renamed model `PrivateLinkScopeOperationStatusOperations` + - Deleted or renamed model `PrivateLinkScopedResourcesOperations` + - Deleted or renamed model `PrivateLinkScopesOperations` + - Deleted or renamed model `ServiceDiagnosticSettingsOperations` + - Deleted or renamed model `SubscriptionDiagnosticSettingsOperations` + - Deleted or renamed model `TenantActivityLogsOperations` + - Deleted or renamed model `VMInsightsOperations` + ## 7.0.0b1 (2025-02-08) ### Features Added diff --git a/sdk/monitor/azure-mgmt-monitor/README.md b/sdk/monitor/azure-mgmt-monitor/README.md index 1599538f3bac..b068eb6ea003 100644 --- a/sdk/monitor/azure-mgmt-monitor/README.md +++ b/sdk/monitor/azure-mgmt-monitor/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Monitor Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/monitor/azure-mgmt-monitor/_meta.json b/sdk/monitor/azure-mgmt-monitor/_meta.json index 34d587abb9bc..f141678fd3d6 100644 --- a/sdk/monitor/azure-mgmt-monitor/_meta.json +++ b/sdk/monitor/azure-mgmt-monitor/_meta.json @@ -1,11 +1,11 @@ { - "commit": "a86a97dd03e0b9e692b5583e369feec3a579ef55", + "commit": "05c1ae0f933cbd7adb98fbfd45dfe97bf524ba15", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.4", + "@autorest/python@6.34.1", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/monitor/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-python-sdk-for-cli-only --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/monitor/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/monitor/resource-manager/readme.md" } \ No newline at end of file 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 df9319e1ae77..1e5f71d8f352 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 @@ -7,143 +7,54 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import MonitorManagementClientConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ( - ActionGroupsOperations, - ActivityLogAlertsOperations, - ActivityLogsOperations, - AlertRuleIncidentsOperations, - AutoscaleSettingsOperations, - BaselinesOperations, - DiagnosticSettingsCategoryOperations, - DiagnosticSettingsOperations, - EventCategoriesOperations, - GuestDiagnosticsSettingsAssociationOperations, - GuestDiagnosticsSettingsOperations, - LogProfilesOperations, - MetricAlertsOperations, - MetricAlertsStatusOperations, - MetricDefinitionsOperations, - MetricNamespacesOperations, - MetricsOperations, - Operations, - PredictiveMetricOperations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - PrivateLinkScopeOperationStatusOperations, - PrivateLinkScopedResourcesOperations, - PrivateLinkScopesOperations, - ScheduledQueryRulesOperations, - ServiceDiagnosticSettingsOperations, - SubscriptionDiagnosticSettingsOperations, - TenantActivityLogsOperations, - VMInsightsOperations, -) +from ._utils.serialization import Deserializer, Serializer +from .operations import ActionGroupsOperations, ScheduledQueryRulesOperations if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations :vartype action_groups: azure.mgmt.monitor.operations.ActionGroupsOperations - :ivar activity_log_alerts: ActivityLogAlertsOperations operations - :vartype activity_log_alerts: azure.mgmt.monitor.operations.ActivityLogAlertsOperations - :ivar activity_logs: ActivityLogsOperations operations - :vartype activity_logs: azure.mgmt.monitor.operations.ActivityLogsOperations - :ivar tenant_activity_logs: TenantActivityLogsOperations operations - :vartype tenant_activity_logs: azure.mgmt.monitor.operations.TenantActivityLogsOperations - :ivar alert_rule_incidents: AlertRuleIncidentsOperations operations - :vartype alert_rule_incidents: azure.mgmt.monitor.operations.AlertRuleIncidentsOperations - :ivar autoscale_settings: AutoscaleSettingsOperations operations - :vartype autoscale_settings: azure.mgmt.monitor.operations.AutoscaleSettingsOperations - :ivar predictive_metric: PredictiveMetricOperations operations - :vartype predictive_metric: azure.mgmt.monitor.operations.PredictiveMetricOperations - :ivar baselines: BaselinesOperations operations - :vartype baselines: azure.mgmt.monitor.operations.BaselinesOperations - :ivar diagnostic_settings: DiagnosticSettingsOperations operations - :vartype diagnostic_settings: azure.mgmt.monitor.operations.DiagnosticSettingsOperations - :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations - :vartype diagnostic_settings_category: - azure.mgmt.monitor.operations.DiagnosticSettingsCategoryOperations - :ivar event_categories: EventCategoriesOperations operations - :vartype event_categories: azure.mgmt.monitor.operations.EventCategoriesOperations - :ivar guest_diagnostics_settings: GuestDiagnosticsSettingsOperations operations - :vartype guest_diagnostics_settings: - azure.mgmt.monitor.operations.GuestDiagnosticsSettingsOperations - :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociationOperations - operations - :vartype guest_diagnostics_settings_association: - azure.mgmt.monitor.operations.GuestDiagnosticsSettingsAssociationOperations - :ivar log_profiles: LogProfilesOperations operations - :vartype log_profiles: azure.mgmt.monitor.operations.LogProfilesOperations - :ivar metric_alerts: MetricAlertsOperations operations - :vartype metric_alerts: azure.mgmt.monitor.operations.MetricAlertsOperations - :ivar metric_alerts_status: MetricAlertsStatusOperations operations - :vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations - :ivar metric_definitions: MetricDefinitionsOperations operations - :vartype metric_definitions: azure.mgmt.monitor.operations.MetricDefinitionsOperations - :ivar metric_namespaces: MetricNamespacesOperations operations - :vartype metric_namespaces: azure.mgmt.monitor.operations.MetricNamespacesOperations - :ivar metrics: MetricsOperations operations - :vartype metrics: azure.mgmt.monitor.operations.MetricsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.monitor.operations.Operations :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations - :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations - :vartype service_diagnostic_settings: - azure.mgmt.monitor.operations.ServiceDiagnosticSettingsOperations - :ivar vm_insights: VMInsightsOperations operations - :vartype vm_insights: azure.mgmt.monitor.operations.VMInsightsOperations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: azure.mgmt.monitor.operations.PrivateLinkScopesOperations - :ivar private_link_scope_operation_status: PrivateLinkScopeOperationStatusOperations operations - :vartype private_link_scope_operation_status: - azure.mgmt.monitor.operations.PrivateLinkScopeOperationStatusOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.monitor.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.monitor.operations.PrivateEndpointConnectionsOperations - :ivar private_link_scoped_resources: PrivateLinkScopedResourcesOperations operations - :vartype private_link_scoped_resources: - azure.mgmt.monitor.operations.PrivateLinkScopedResourcesOperations - :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations - :vartype subscription_diagnostic_settings: - azure.mgmt.monitor.operations.SubscriptionDiagnosticSettingsOperations :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. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = MonitorManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -162,83 +73,16 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.action_groups = ActionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.activity_log_alerts = ActivityLogAlertsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.activity_logs = ActivityLogsOperations(self._client, self._config, self._serialize, self._deserialize) - self.tenant_activity_logs = TenantActivityLogsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.alert_rule_incidents = AlertRuleIncidentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.autoscale_settings = AutoscaleSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.predictive_metric = PredictiveMetricOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.baselines = BaselinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.event_categories = EventCategoriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.guest_diagnostics_settings = GuestDiagnosticsSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.log_profiles = LogProfilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_alerts = MetricAlertsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_alerts_status = MetricAlertsStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metric_definitions = MetricDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metric_namespaces = MetricNamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metrics = MetricsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.vm_insights = VMInsightsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_scopes = PrivateLinkScopesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_scope_operation_status = PrivateLinkScopeOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_scoped_resources = PrivateLinkScopedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( - 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/_utils/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_serialization.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/serialization.py similarity index 94% rename from sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_serialization.py rename to sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/serialization.py index b24ab2885450..f5187701d7be 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_serialization.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1717,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1799,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1845,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1936,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1949,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1964,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1982,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1995,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2013,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2029,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2044,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2067,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2105,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore 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 efe7276fe05f..b094b52a6bba 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.0b1" +VERSION = "7.0.0b2" 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 a03ff245f565..724cb0b6b957 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 @@ -7,144 +7,54 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import MonitorManagementClientConfiguration -from .operations import ( - ActionGroupsOperations, - ActivityLogAlertsOperations, - ActivityLogsOperations, - AlertRuleIncidentsOperations, - AutoscaleSettingsOperations, - BaselinesOperations, - DiagnosticSettingsCategoryOperations, - DiagnosticSettingsOperations, - EventCategoriesOperations, - GuestDiagnosticsSettingsAssociationOperations, - GuestDiagnosticsSettingsOperations, - LogProfilesOperations, - MetricAlertsOperations, - MetricAlertsStatusOperations, - MetricDefinitionsOperations, - MetricNamespacesOperations, - MetricsOperations, - Operations, - PredictiveMetricOperations, - PrivateEndpointConnectionsOperations, - PrivateLinkResourcesOperations, - PrivateLinkScopeOperationStatusOperations, - PrivateLinkScopedResourcesOperations, - PrivateLinkScopesOperations, - ScheduledQueryRulesOperations, - ServiceDiagnosticSettingsOperations, - SubscriptionDiagnosticSettingsOperations, - TenantActivityLogsOperations, - VMInsightsOperations, -) +from .operations import ActionGroupsOperations, ScheduledQueryRulesOperations if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword """Monitor Management Client. :ivar action_groups: ActionGroupsOperations operations :vartype action_groups: azure.mgmt.monitor.aio.operations.ActionGroupsOperations - :ivar activity_log_alerts: ActivityLogAlertsOperations operations - :vartype activity_log_alerts: azure.mgmt.monitor.aio.operations.ActivityLogAlertsOperations - :ivar activity_logs: ActivityLogsOperations operations - :vartype activity_logs: azure.mgmt.monitor.aio.operations.ActivityLogsOperations - :ivar tenant_activity_logs: TenantActivityLogsOperations operations - :vartype tenant_activity_logs: azure.mgmt.monitor.aio.operations.TenantActivityLogsOperations - :ivar alert_rule_incidents: AlertRuleIncidentsOperations operations - :vartype alert_rule_incidents: azure.mgmt.monitor.aio.operations.AlertRuleIncidentsOperations - :ivar autoscale_settings: AutoscaleSettingsOperations operations - :vartype autoscale_settings: azure.mgmt.monitor.aio.operations.AutoscaleSettingsOperations - :ivar predictive_metric: PredictiveMetricOperations operations - :vartype predictive_metric: azure.mgmt.monitor.aio.operations.PredictiveMetricOperations - :ivar baselines: BaselinesOperations operations - :vartype baselines: azure.mgmt.monitor.aio.operations.BaselinesOperations - :ivar diagnostic_settings: DiagnosticSettingsOperations operations - :vartype diagnostic_settings: azure.mgmt.monitor.aio.operations.DiagnosticSettingsOperations - :ivar diagnostic_settings_category: DiagnosticSettingsCategoryOperations operations - :vartype diagnostic_settings_category: - azure.mgmt.monitor.aio.operations.DiagnosticSettingsCategoryOperations - :ivar event_categories: EventCategoriesOperations operations - :vartype event_categories: azure.mgmt.monitor.aio.operations.EventCategoriesOperations - :ivar guest_diagnostics_settings: GuestDiagnosticsSettingsOperations operations - :vartype guest_diagnostics_settings: - azure.mgmt.monitor.aio.operations.GuestDiagnosticsSettingsOperations - :ivar guest_diagnostics_settings_association: GuestDiagnosticsSettingsAssociationOperations - operations - :vartype guest_diagnostics_settings_association: - azure.mgmt.monitor.aio.operations.GuestDiagnosticsSettingsAssociationOperations - :ivar log_profiles: LogProfilesOperations operations - :vartype log_profiles: azure.mgmt.monitor.aio.operations.LogProfilesOperations - :ivar metric_alerts: MetricAlertsOperations operations - :vartype metric_alerts: azure.mgmt.monitor.aio.operations.MetricAlertsOperations - :ivar metric_alerts_status: MetricAlertsStatusOperations operations - :vartype metric_alerts_status: azure.mgmt.monitor.aio.operations.MetricAlertsStatusOperations - :ivar metric_definitions: MetricDefinitionsOperations operations - :vartype metric_definitions: azure.mgmt.monitor.aio.operations.MetricDefinitionsOperations - :ivar metric_namespaces: MetricNamespacesOperations operations - :vartype metric_namespaces: azure.mgmt.monitor.aio.operations.MetricNamespacesOperations - :ivar metrics: MetricsOperations operations - :vartype metrics: azure.mgmt.monitor.aio.operations.MetricsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.monitor.aio.operations.Operations :ivar scheduled_query_rules: ScheduledQueryRulesOperations operations :vartype scheduled_query_rules: azure.mgmt.monitor.aio.operations.ScheduledQueryRulesOperations - :ivar service_diagnostic_settings: ServiceDiagnosticSettingsOperations operations - :vartype service_diagnostic_settings: - azure.mgmt.monitor.aio.operations.ServiceDiagnosticSettingsOperations - :ivar vm_insights: VMInsightsOperations operations - :vartype vm_insights: azure.mgmt.monitor.aio.operations.VMInsightsOperations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: azure.mgmt.monitor.aio.operations.PrivateLinkScopesOperations - :ivar private_link_scope_operation_status: PrivateLinkScopeOperationStatusOperations operations - :vartype private_link_scope_operation_status: - azure.mgmt.monitor.aio.operations.PrivateLinkScopeOperationStatusOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.monitor.aio.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.monitor.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_scoped_resources: PrivateLinkScopedResourcesOperations operations - :vartype private_link_scoped_resources: - azure.mgmt.monitor.aio.operations.PrivateLinkScopedResourcesOperations - :ivar subscription_diagnostic_settings: SubscriptionDiagnosticSettingsOperations operations - :vartype subscription_diagnostic_settings: - azure.mgmt.monitor.aio.operations.SubscriptionDiagnosticSettingsOperations :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. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = MonitorManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -163,83 +73,18 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.action_groups = ActionGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.activity_log_alerts = ActivityLogAlertsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.activity_logs = ActivityLogsOperations(self._client, self._config, self._serialize, self._deserialize) - self.tenant_activity_logs = TenantActivityLogsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.alert_rule_incidents = AlertRuleIncidentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.autoscale_settings = AutoscaleSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.predictive_metric = PredictiveMetricOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.baselines = BaselinesOperations(self._client, self._config, self._serialize, self._deserialize) - self.diagnostic_settings = DiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.diagnostic_settings_category = DiagnosticSettingsCategoryOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.event_categories = EventCategoriesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.guest_diagnostics_settings = GuestDiagnosticsSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.guest_diagnostics_settings_association = GuestDiagnosticsSettingsAssociationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.log_profiles = LogProfilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_alerts = MetricAlertsOperations(self._client, self._config, self._serialize, self._deserialize) - self.metric_alerts_status = MetricAlertsStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metric_definitions = MetricDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metric_namespaces = MetricNamespacesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.metrics = MetricsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.scheduled_query_rules = ScheduledQueryRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.service_diagnostic_settings = ServiceDiagnosticSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.vm_insights = VMInsightsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_scopes = PrivateLinkScopesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_scope_operation_status = PrivateLinkScopeOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_scoped_resources = PrivateLinkScopedResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.subscription_diagnostic_settings = SubscriptionDiagnosticSettingsOperations( - 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 11574f0dde87..d88087652e75 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 @@ -13,34 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._action_groups_operations import ActionGroupsOperations # type: ignore -from ._activity_log_alerts_operations import ActivityLogAlertsOperations # type: ignore -from ._activity_logs_operations import ActivityLogsOperations # type: ignore -from ._tenant_activity_logs_operations import TenantActivityLogsOperations # type: ignore -from ._alert_rule_incidents_operations import AlertRuleIncidentsOperations # type: ignore -from ._autoscale_settings_operations import AutoscaleSettingsOperations # type: ignore -from ._predictive_metric_operations import PredictiveMetricOperations # type: ignore -from ._baselines_operations import BaselinesOperations # type: ignore -from ._diagnostic_settings_operations import DiagnosticSettingsOperations # type: ignore -from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations # type: ignore -from ._event_categories_operations import EventCategoriesOperations # type: ignore -from ._guest_diagnostics_settings_operations import GuestDiagnosticsSettingsOperations # type: ignore -from ._guest_diagnostics_settings_association_operations import GuestDiagnosticsSettingsAssociationOperations # type: ignore -from ._log_profiles_operations import LogProfilesOperations # type: ignore -from ._metric_alerts_operations import MetricAlertsOperations # type: ignore -from ._metric_alerts_status_operations import MetricAlertsStatusOperations # type: ignore -from ._metric_definitions_operations import MetricDefinitionsOperations # type: ignore -from ._metric_namespaces_operations import MetricNamespacesOperations # type: ignore -from ._metrics_operations import MetricsOperations # type: ignore -from ._operations import Operations # type: ignore from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations # type: ignore -from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations # type: ignore -from ._vm_insights_operations import VMInsightsOperations # type: ignore -from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore -from ._private_link_scope_operation_status_operations import PrivateLinkScopeOperationStatusOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_scoped_resources_operations import PrivateLinkScopedResourcesOperations # type: ignore -from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -48,34 +21,7 @@ __all__ = [ "ActionGroupsOperations", - "ActivityLogAlertsOperations", - "ActivityLogsOperations", - "TenantActivityLogsOperations", - "AlertRuleIncidentsOperations", - "AutoscaleSettingsOperations", - "PredictiveMetricOperations", - "BaselinesOperations", - "DiagnosticSettingsOperations", - "DiagnosticSettingsCategoryOperations", - "EventCategoriesOperations", - "GuestDiagnosticsSettingsOperations", - "GuestDiagnosticsSettingsAssociationOperations", - "LogProfilesOperations", - "MetricAlertsOperations", - "MetricAlertsStatusOperations", - "MetricDefinitionsOperations", - "MetricNamespacesOperations", - "MetricsOperations", - "Operations", "ScheduledQueryRulesOperations", - "ServiceDiagnosticSettingsOperations", - "VMInsightsOperations", - "PrivateLinkScopesOperations", - "PrivateLinkScopeOperationStatusOperations", - "PrivateLinkResourcesOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkScopedResourcesOperations", - "SubscriptionDiagnosticSettingsOperations", ] __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/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_action_groups_operations.py index 060906ae0798..a487a79b69f2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_action_groups_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # 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 -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,26 +31,20 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._action_groups_operations import ( build_create_notifications_at_action_group_resource_level_request, - build_create_notifications_at_resource_group_level_request, build_create_or_update_request, build_delete_request, build_enable_receiver_request, build_get_request, build_get_test_notifications_at_action_group_resource_level_request, - build_get_test_notifications_at_resource_group_level_request, - build_get_test_notifications_request, build_list_by_resource_group_request, build_list_by_subscription_id_request, - build_post_test_notifications_request, build_update_request, ) +from .._configuration import MonitorManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +63,10 @@ class ActionGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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") @overload async def create_or_update( @@ -161,7 +155,7 @@ async def create_or_update( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) @@ -229,7 +223,7 @@ async def get(self, resource_group_name: str, action_group_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) _request = build_get_request( @@ -285,7 +279,7 @@ async def delete(self, resource_group_name: str, action_group_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -400,7 +394,7 @@ async def update( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) @@ -444,367 +438,6 @@ async def update( return deserialized # type: ignore - async def _post_test_notifications_initial( - self, notification_request: Union[_models.NotificationRequestBody, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(notification_request, (IOBase, bytes)): - _content = notification_request - else: - _json = self._serialize.body(notification_request, "NotificationRequestBody") - - _request = build_post_test_notifications_request( - 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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_post_test_notifications( - self, - notification_request: _models.NotificationRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_post_test_notifications( - self, notification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: 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: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_post_test_notifications( - self, notification_request: Union[_models.NotificationRequestBody, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param notification_request: The notification request body which includes the contact details. - Is either a NotificationRequestBody type or a IO[bytes] type. Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody or IO[bytes] - :return: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._post_test_notifications_initial( - notification_request=notification_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.TestNotificationDetailsResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.TestNotificationDetailsResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _create_notifications_at_resource_group_level_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(notification_request, (IOBase, bytes)): - _content = notification_request - else: - _json = self._serialize.body(notification_request, "NotificationRequestBody") - - _request = build_create_notifications_at_resource_group_level_request( - resource_group_name=resource_group_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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: _models.NotificationRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: 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: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Is either a NotificationRequestBody type or a IO[bytes] type. Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody or IO[bytes] - :return: An instance of AsyncLROPoller that returns either TestNotificationDetailsResponse or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_notifications_at_resource_group_level_initial( - resource_group_name=resource_group_name, - notification_request=notification_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.TestNotificationDetailsResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.TestNotificationDetailsResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - async def _create_notifications_at_action_group_resource_level_initial( # pylint: disable=name-too-long self, resource_group_name: str, @@ -823,7 +456,7 @@ async def _create_notifications_at_action_group_resource_level_initial( # pylin _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -963,7 +596,7 @@ async def begin_create_notifications_at_action_group_resource_level( # pylint: _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1009,118 +642,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get_test_notifications( - self, notification_id: str, **kwargs: Any - ) -> _models.TestNotificationDetailsResponse: - """Get the test notifications by the notification id. - - :param notification_id: The notification id. Required. - :type notification_id: str - :return: TestNotificationDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.TestNotificationDetailsResponse - :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", "2022-06-01")) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - - _request = build_get_test_notifications_request( - notification_id=notification_id, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_test_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, resource_group_name: str, notification_id: str, **kwargs: Any - ) -> _models.TestNotificationDetailsResponse: - """Get the test notifications by the notification id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_id: The notification id. Required. - :type notification_id: str - :return: TestNotificationDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.TestNotificationDetailsResponse - :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", "2022-06-01")) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - - _request = build_get_test_notifications_at_resource_group_level_request( - resource_group_name=resource_group_name, - notification_id=notification_id, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace_async async def get_test_notifications_at_action_group_resource_level( # pylint: disable=name-too-long self, resource_group_name: str, action_group_name: str, notification_id: str, **kwargs: Any @@ -1149,7 +670,7 @@ async def get_test_notifications_at_action_group_resource_level( # pylint: disa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) _request = build_get_test_notifications_at_action_group_resource_level_request( @@ -1193,7 +714,7 @@ def list_by_subscription_id(self, **kwargs: Any) -> AsyncIterable["_models.Actio _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupList] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1262,7 +783,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupList] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1406,7 +927,7 @@ async def enable_receiver( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_log_alerts_operations.py deleted file mode 100644 index d989a4ec6636..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_log_alerts_operations.py +++ /dev/null @@ -1,577 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._activity_log_alerts_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_id_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ActivityLogAlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`activity_log_alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: _models.ActivityLogAlertResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Required. - :type activity_log_alert: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Required. - :type activity_log_alert: 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: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: Union[_models.ActivityLogAlertResource, IO[bytes]], - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Is either a - ActivityLogAlertResource type or a IO[bytes] type. Required. - :type activity_log_alert: ~azure.mgmt.monitor.models.ActivityLogAlertResource or IO[bytes] - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(activity_log_alert, (IOBase, bytes)): - _content = activity_log_alert - else: - _json = self._serialize.body(activity_log_alert, "ActivityLogAlertResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, activity_log_alert_name: str, **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Get an activity log alert. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", 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, activity_log_alert_name: str, **kwargs: Any) -> None: - """Delete an activity log alert. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_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", "2017-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: _models.ActivityLogAlertPatchBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Required. - :type activity_log_alert_patch: ~azure.mgmt.monitor.models.ActivityLogAlertPatchBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Required. - :type activity_log_alert_patch: 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: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: Union[_models.ActivityLogAlertPatchBody, IO[bytes]], - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Is either a - ActivityLogAlertPatchBody type or a IO[bytes] type. Required. - :type activity_log_alert_patch: ~azure.mgmt.monitor.models.ActivityLogAlertPatchBody or - IO[bytes] - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(activity_log_alert_patch, (IOBase, bytes)): - _content = activity_log_alert_patch - else: - _json = self._serialize.body(activity_log_alert_patch, "ActivityLogAlertPatchBody") - - _request = build_update_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription_id(self, **kwargs: Any) -> AsyncIterable["_models.ActivityLogAlertResource"]: - """Get a list of all activity log alerts in a subscription. - - :return: An iterator like instance of either ActivityLogAlertResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertList] = 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_id_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("ActivityLogAlertList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ActivityLogAlertResource"]: - """Get a list of all activity log alerts in a 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 ActivityLogAlertResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertList] = 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("ActivityLogAlertList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_logs_operations.py deleted file mode 100644 index 5ab66b909233..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_activity_logs_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._activity_logs_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ActivityLogsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`activity_logs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, filter: str, select: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.EventData"]: - """Provides the list of records from the activity logs. - - :param filter: Reduces the set of data collected.\\ :code:`
`This argument is required and - it also requires at least the start date/time.\\ :code:`
`The **$filter** argument is very - restricted and allows only the following patterns.\\ :code:`
`- *List events for a resource - group*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.\\ :code:`
`- - *List events for resource*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.\\ - :code:`
`- *List events for a subscription in a time range*\\ : $filter=eventTimestamp ge - '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.\\ - :code:`
`- *List events for a resource provider*\\ : $filter=eventTimestamp ge - '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and - resourceProvider eq 'resourceProviderName'.\\ :code:`
`- *List events for a correlation - Id*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.\\ :code:`
`\\ - :code:`
`\\ **NOTE**\\ : No other syntax is allowed. Required. - :type filter: str - :param select: Used to fetch events with only the given properties.\\ :code:`
`The - **$select** argument is a comma separated list of property names to be returned. Possible - values are: *authorization*\\ , *claims*\\ , *correlationId*\\ , *description*\\ , - *eventDataId*\\ , *eventName*\\ , *eventTimestamp*\\ , *httpRequest*\\ , *level*\\ , - *operationId*\\ , *operationName*\\ , *properties*\\ , *resourceGroupName*\\ , - *resourceProviderName*\\ , *resourceId*\\ , *status*\\ , *submissionTimestamp*\\ , - *subStatus*\\ , *subscriptionId*. Default value is None. - :type select: str - :return: An iterator like instance of either EventData or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.EventData] - :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", "2015-04-01")) - cls: ClsType[_models.EventDataCollection] = 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_request( - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - 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("EventDataCollection", 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_alert_rule_incidents_operations.py deleted file mode 100644 index 265a8c1c9538..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_alert_rule_incidents_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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 ...operations._alert_rule_incidents_operations import build_get_request, build_list_by_alert_rule_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AlertRuleIncidentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`alert_rule_incidents` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, rule_name: str, incident_name: str, **kwargs: Any - ) -> _models.Incident: - """Gets an incident associated to an alert rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param incident_name: The name of the incident to retrieve. Required. - :type incident_name: str - :return: Incident or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.Incident - :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", "2016-03-01")) - cls: ClsType[_models.Incident] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=rule_name, - incident_name=incident_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Incident", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_alert_rule( - self, resource_group_name: str, rule_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Incident"]: - """Gets a list of incidents associated to an alert rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: An iterator like instance of either Incident or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.Incident] - :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", "2016-03-01")) - cls: ClsType[_models.IncidentListResult] = 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_alert_rule_request( - resource_group_name=resource_group_name, - rule_name=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("IncidentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_autoscale_settings_operations.py deleted file mode 100644 index 65f9048e2d48..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_autoscale_settings_operations.py +++ /dev/null @@ -1,577 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._autoscale_settings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AutoscaleSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`autoscale_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = 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 - ) -> AsyncIterable["_models.AutoscaleSettingResource"]: - """Lists the autoscale settings for a 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 AutoscaleSettingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResourceCollection] = 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("AutoscaleSettingResourceCollection", 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: _models.AutoscaleSettingResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: Union[_models.AutoscaleSettingResource, IO[bytes]], - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Is either a AutoscaleSettingResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.AutoscaleSettingResource or IO[bytes] - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutoscaleSettingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", 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, autoscale_setting_name: str, **kwargs: Any) -> None: - """Deletes and autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_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", "2022-10-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, autoscale_setting_name: str, **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Gets an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", 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, - autoscale_setting_name: str, - autoscale_setting_resource: _models.AutoscaleSettingResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Required. - :type autoscale_setting_resource: ~azure.mgmt.monitor.models.AutoscaleSettingResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - autoscale_setting_name: str, - autoscale_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Required. - :type autoscale_setting_resource: 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: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - autoscale_setting_name: str, - autoscale_setting_resource: Union[_models.AutoscaleSettingResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Is either a - AutoscaleSettingResourcePatch type or a IO[bytes] type. Required. - :type autoscale_setting_resource: ~azure.mgmt.monitor.models.AutoscaleSettingResourcePatch or - IO[bytes] - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(autoscale_setting_resource, (IOBase, bytes)): - _content = autoscale_setting_resource - else: - _json = self._serialize.body(autoscale_setting_resource, "AutoscaleSettingResourcePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AutoscaleSettingResource"]: - """Lists the autoscale settings for a subscription. - - :return: An iterator like instance of either AutoscaleSettingResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResourceCollection] = 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("AutoscaleSettingResourceCollection", 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_baselines_operations.py deleted file mode 100644 index 8eb076171b95..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_baselines_operations.py +++ /dev/null @@ -1,177 +0,0 @@ -# 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 datetime -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._baselines_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BaselinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`baselines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_uri: str, - metricnames: Optional[str] = None, - metricnamespace: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SingleMetricBaseline"]: - """**Lists the metric baseline values for a resource**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. Default value is None. - :type metricnames: str - :param metricnamespace: Metric namespace that contains the requested metric names. Default - value is None. - :type metricnamespace: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Default value is None. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. Default value is None. - :type interval: ~datetime.timedelta - :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value - is None. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. Default value is - None. - :type sensitivities: str - :param filter: The **$filter** is used to reduce the set of metric data returned. Example: - Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or - b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A - eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or - operator cannot separate two different metadata names. - Return all time series where A = a1, B - = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series - where A = a1 **$filter=A eq 'a1' and B eq '\\ *' and C eq '*\\ '**. Special case: When - dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) - 1** Instead of using $filter= "dim (test) 1 eq '\\ *' " use **$filter= "dim %2528test%2529 1 eq - '*\\ ' "\\ ** When dimension name is **\\ dim (test) 3\\ ** and dimension value is **\\ dim3 - (test) val\\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\\ - $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. - :type filter: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. Known values are: "Data" and "Metadata". Default value is None. - :type result_type: str or ~azure.mgmt.monitor.models.ResultType - :return: An iterator like instance of either SingleMetricBaseline or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.SingleMetricBaseline] - :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", "2019-03-01")) - cls: ClsType[_models.MetricBaselinesResponse] = 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_request( - resource_uri=resource_uri, - metricnames=metricnames, - metricnamespace=metricnamespace, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - filter=filter, - result_type=result_type, - 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("MetricBaselinesResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_category_operations.py deleted file mode 100644 index c65e439b66f6..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_category_operations.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._diagnostic_settings_category_operations import build_get_request, build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DiagnosticSettingsCategoryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`diagnostic_settings_category` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_uri: str, name: str, **kwargs: Any) -> _models.DiagnosticSettingsCategoryResource: - """Gets the diagnostic settings category for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: DiagnosticSettingsCategoryResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResource - :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", "2017-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsCategoryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsCategoryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list(self, resource_uri: str, **kwargs: Any) -> _models.DiagnosticSettingsCategoryResourceCollection: - """Lists the diagnostic settings categories for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: DiagnosticSettingsCategoryResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResourceCollection - :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", "2017-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsCategoryResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "DiagnosticSettingsCategoryResourceCollection", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_operations.py deleted file mode 100644 index 01ff1f60c4da..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_diagnostic_settings_operations.py +++ /dev/null @@ -1,360 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._diagnostic_settings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_uri: str, name: str, **kwargs: Any) -> _models.DiagnosticSettingsResource: - """Gets the active diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :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", "2021-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_uri: str, - name: str, - parameters: _models.DiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_uri: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_uri: str, - name: str, - parameters: Union[_models.DiagnosticSettingsResource, IO[bytes]], - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Is either a DiagnosticSettingsResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.DiagnosticSettingsResource or IO[bytes] - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :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", "2021-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_uri=resource_uri, - name=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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsResource", 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, name: str, **kwargs: Any) -> None: - """Deletes existing diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type 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", "2021-05-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.DiagnosticSettingsResource"]: - """Gets the active diagnostic settings list for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: An iterator like instance of either DiagnosticSettingsResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.DiagnosticSettingsResource] - :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", "2021-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsResourceCollection] = 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_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("DiagnosticSettingsResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_event_categories_operations.py deleted file mode 100644 index 418414420b1c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_event_categories_operations.py +++ /dev/null @@ -1,119 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._event_categories_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class EventCategoriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`event_categories` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.LocalizableString"]: - """Get the list of available event categories supported in the Activity Logs Service.\\ - :code:`
`The current list includes the following: Administrative, Security, ServiceHealth, - Alert, Recommendation, Policy. - - :return: An iterator like instance of either LocalizableString or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.LocalizableString] - :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", "2015-04-01")) - cls: ClsType[_models.EventCategoryCollection] = 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_request( - 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("EventCategoryCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_association_operations.py deleted file mode 100644 index c58b14e41c4c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_association_operations.py +++ /dev/null @@ -1,578 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._guest_diagnostics_settings_association_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GuestDiagnosticsSettingsAssociationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`guest_diagnostics_settings_association` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: _models.GuestDiagnosticSettingsAssociationResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Required. - :type diagnostic_settings_association: - ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Required. - :type diagnostic_settings_association: 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: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: Union[_models.GuestDiagnosticSettingsAssociationResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Is either a GuestDiagnosticSettingsAssociationResource type or a IO[bytes] type. - Required. - :type diagnostic_settings_association: - ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource or IO[bytes] - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_settings_association, (IOBase, bytes)): - _content = diagnostic_settings_association - else: - _json = self._serialize.body(diagnostic_settings_association, "GuestDiagnosticSettingsAssociationResource") - - _request = build_create_or_update_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_uri: str, association_name: str, **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Gets guest diagnostics association settings. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", 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: - """Delete guest diagnostics association settings. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. 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", "2018-06-01-preview")) - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def update( - self, - resource_uri: str, - association_name: str, - parameters: _models.GuestDiagnosticSettingsAssociationResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_uri: str, - association_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_uri: str, - association_name: str, - parameters: Union[_models.GuestDiagnosticSettingsAssociationResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Is either a - GuestDiagnosticSettingsAssociationResourcePatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResourcePatch or - IO[bytes] - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GuestDiagnosticSettingsAssociationResourcePatch") - - _request = build_update_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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationResource"]: - """Get a list of all guest diagnostic settings association in a subscription. - - :return: An iterator like instance of either GuestDiagnosticSettingsAssociationResource or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationList] = 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_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("GuestDiagnosticSettingsAssociationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GuestDiagnosticSettingsAssociationResource"]: - """Get a list of all guest diagnostic settings association in a 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 GuestDiagnosticSettingsAssociationResource or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationList] = 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("GuestDiagnosticSettingsAssociationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_operations.py deleted file mode 100644 index ae40d8788369..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_guest_diagnostics_settings_operations.py +++ /dev/null @@ -1,574 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._guest_diagnostics_settings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GuestDiagnosticsSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`guest_diagnostics_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: _models.GuestDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Required. - :type diagnostic_settings: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Required. - :type diagnostic_settings: 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: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: Union[_models.GuestDiagnosticSettingsResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Is either a - GuestDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type diagnostic_settings: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource or - IO[bytes] - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_settings, (IOBase, bytes)): - _content = diagnostic_settings - else: - _json = self._serialize.body(diagnostic_settings, "GuestDiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, diagnostic_settings_name: str, **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Gets guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", 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, - diagnostic_settings_name: str, - parameters: _models.GuestDiagnosticSettingsPatchResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsPatchResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Required. - :type parameters: 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: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - parameters: Union[_models.GuestDiagnosticSettingsPatchResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Is either a GuestDiagnosticSettingsPatchResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsPatchResource or IO[bytes] - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GuestDiagnosticSettingsPatchResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", 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, diagnostic_settings_name: str, **kwargs: Any) -> None: - """Delete guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_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", "2018-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.GuestDiagnosticSettingsResource"]: - """Get a list of all guest diagnostic settings in a subscription. - - :return: An iterator like instance of either GuestDiagnosticSettingsResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsList] = 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_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("GuestDiagnosticSettingsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GuestDiagnosticSettingsResource"]: - """Get a list of all guest diagnostic settings in a 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 GuestDiagnosticSettingsResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsList] = 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("GuestDiagnosticSettingsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_log_profiles_operations.py deleted file mode 100644 index fe7c3a40a881..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_log_profiles_operations.py +++ /dev/null @@ -1,451 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._log_profiles_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LogProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`log_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def delete(self, log_profile_name: str, **kwargs: Any) -> None: - """Deletes the log profile. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_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", "2016-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - log_profile_name=log_profile_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get(self, log_profile_name: str, **kwargs: Any) -> _models.LogProfileResource: - """Gets the log profile. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - _request = build_get_request( - log_profile_name=log_profile_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - log_profile_name: str, - parameters: _models.LogProfileResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.LogProfileResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, log_profile_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, log_profile_name: str, parameters: Union[_models.LogProfileResource, IO[bytes]], **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Is either a LogProfileResource type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogProfileResource or IO[bytes] - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LogProfileResource") - - _request = build_create_or_update_request( - log_profile_name=log_profile_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - log_profile_name: str, - log_profiles_resource: _models.LogProfileResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Required. - :type log_profiles_resource: ~azure.mgmt.monitor.models.LogProfileResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - log_profile_name: str, - log_profiles_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Required. - :type log_profiles_resource: 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: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - log_profile_name: str, - log_profiles_resource: Union[_models.LogProfileResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Is either a - LogProfileResourcePatch type or a IO[bytes] type. Required. - :type log_profiles_resource: ~azure.mgmt.monitor.models.LogProfileResourcePatch or IO[bytes] - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(log_profiles_resource, (IOBase, bytes)): - _content = log_profiles_resource - else: - _json = self._serialize.body(log_profiles_resource, "LogProfileResourcePatch") - - _request = build_update_request( - log_profile_name=log_profile_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.LogProfileResource"]: - """List the log profiles. - - :return: An iterator like instance of either LogProfileResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.LogProfileResource] - :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", "2016-03-01")) - cls: ClsType[_models.LogProfileCollection] = 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_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("LogProfileCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_alerts_operations.py deleted file mode 100644 index f319f4fa29f8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_alerts_operations.py +++ /dev/null @@ -1,567 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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 ...operations._metric_alerts_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetricAlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`metric_alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.MetricAlertResource"]: - """Retrieve alert rule definitions in a subscription. - - :return: An iterator like instance of either MetricAlertResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.MetricAlertResource] - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResourceCollection] = 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("MetricAlertResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated2, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MetricAlertResource"]: - """Retrieve alert rule definitions in a 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 MetricAlertResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.MetricAlertResource] - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResourceCollection] = 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("MetricAlertResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated2, 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, rule_name: str, **kwargs: Any) -> _models.MetricAlertResource: - """Retrieve an alert rule definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: _models.MetricAlertResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: 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: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.MetricAlertResource, IO[bytes]], - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Is either a - MetricAlertResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResource or IO[bytes] - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MetricAlertResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", 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, - rule_name: str, - parameters: _models.MetricAlertResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - rule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Required. - :type parameters: 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: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.MetricAlertResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Is either a MetricAlertResourcePatch - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResourcePatch or IO[bytes] - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MetricAlertResourcePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", 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, rule_name: str, **kwargs: Any) -> None: - """Delete an alert rule definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_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", "2018-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - rule_name=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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, 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/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_alerts_status_operations.py deleted file mode 100644 index c50a0d27dd10..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_alerts_status_operations.py +++ /dev/null @@ -1,172 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._metric_alerts_status_operations import build_list_by_name_request, build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetricAlertsStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`metric_alerts_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, rule_name: str, **kwargs: Any - ) -> _models.MetricAlertStatusCollection: - """Retrieve an alert rule status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: MetricAlertStatusCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertStatusCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertStatusCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_by_name( - self, resource_group_name: str, rule_name: str, status_name: str, **kwargs: Any - ) -> _models.MetricAlertStatusCollection: - """Retrieve an alert rule status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param status_name: The name of the status. Required. - :type status_name: str - :return: MetricAlertStatusCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertStatusCollection] = kwargs.pop("cls", None) - - _request = build_list_by_name_request( - resource_group_name=resource_group_name, - rule_name=rule_name, - status_name=status_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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertStatusCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_definitions_operations.py deleted file mode 100644 index 440e3e5ffd3b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_definitions_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._metric_definitions_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetricDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`metric_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_uri: str, metricnamespace: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MetricDefinition"]: - """Lists the metric definitions for the resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param metricnamespace: Metric namespace to query metric definitions for. Default value is - None. - :type metricnamespace: str - :return: An iterator like instance of either MetricDefinition or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.MetricDefinition] - :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", "2018-01-01")) - cls: ClsType[_models.MetricDefinitionCollection] = 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_request( - resource_uri=resource_uri, - metricnamespace=metricnamespace, - 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("MetricDefinitionCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_namespaces_operations.py deleted file mode 100644 index c05042a34855..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metric_namespaces_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._metric_namespaces_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetricNamespacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`metric_namespaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_uri: str, start_time: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MetricNamespace"]: - """Lists the metric namespaces for the resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. Default value is None. - :type start_time: str - :return: An iterator like instance of either MetricNamespace or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.MetricNamespace] - :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", "2017-12-01-preview")) - cls: ClsType[_models.MetricNamespaceCollection] = 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_request( - resource_uri=resource_uri, - start_time=start_time, - 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("MetricNamespaceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metrics_operations.py deleted file mode 100644 index 7f0e3942aeb0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_metrics_operations.py +++ /dev/null @@ -1,170 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -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_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 ...operations._metrics_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MetricsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`metrics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, - resource_uri: str, - timespan: Optional[str] = None, - interval: Optional[str] = None, - metricnames: Optional[str] = None, - aggregation: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - metricnamespace: Optional[str] = None, - **kwargs: Any - ) -> _models.Response: - """**Lists the metric values for a resource**. This API uses the `default ARM throttling limits - `_. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Default value is None. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query in ISO 8601 duration format. - Defaults to PT1M. Special case for 'FULL' value that returns single datapoint for entire time - span requested. - *Examples: PT15M, PT1H, P1D, FULL*. Default value is None. - :type interval: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Limit 20 metrics. - Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: - 'Metric,Name1' should be **'Metric%2Name1'**. Default value is None. - :type metricnames: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value - is None. - :type aggregation: str - :param top: The maximum number of records to retrieve. - Valid only if $filter is specified. - Defaults to 10. Default value is None. - :type top: int - :param orderby: The aggregation to use for sorting results and the direction of the sort. - Only one order can be specified. - Examples: sum asc. Default value is None. - :type orderby: str - :param filter: The **$filter** is used to reduce the set of metric data returned. Example: - Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or - b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A - eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or - operator cannot separate two different metadata names. - Return all time series where A = a1, B - = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series - where A = a1 **$filter=A eq 'a1' and B eq '\\ *' and C eq '*\\ '**. Special case: When - dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) - 1** Instead of using $filter= "dim (test) 1 eq '\\ *' " use **$filter= "dim %2528test%2529 1 eq - '*\\ ' "\\ ** When dimension name is **\\ dim (test) 3\\ ** and dimension value is **\\ dim3 - (test) val\\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\\ - $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. - :type filter: str - :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. Known values are: "Data" and - "Metadata". Default value is None. - :type result_type: str or ~azure.mgmt.monitor.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. Default value is - None. - :type metricnamespace: str - :return: Response or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.Response - :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", "2018-01-01")) - cls: ClsType[_models.Response] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_uri=resource_uri, - timespan=timespan, - interval=interval, - metricnames=metricnames, - aggregation=aggregation, - top=top, - orderby=orderby, - filter=filter, - result_type=result_type, - metricnamespace=metricnamespace, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Response", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_operations.py deleted file mode 100644 index bcc82c3a97c9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_operations.py +++ /dev/null @@ -1,100 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists all of the available operations from Microsoft.Insights provider. - - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationListResult - :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", "2015-04-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_predictive_metric_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_predictive_metric_operations.py deleted file mode 100644 index a0f924d38008..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_predictive_metric_operations.py +++ /dev/null @@ -1,138 +0,0 @@ -# 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 datetime -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._predictive_metric_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PredictiveMetricOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`predictive_metric` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - autoscale_setting_name: str, - timespan: str, - interval: datetime.timedelta, - metric_namespace: str, - metric_name: str, - aggregation: str, - **kwargs: Any - ) -> _models.PredictiveResponse: - """get predictive autoscale metric future data. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Required. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. Required. - :type interval: ~datetime.timedelta - :param metric_namespace: Metric namespace to query metric definitions for. Required. - :type metric_namespace: str - :param metric_name: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. Required. - :type metric_name: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. Required. - :type aggregation: str - :return: PredictiveResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PredictiveResponse - :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", "2022-10-01")) - cls: ClsType[_models.PredictiveResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_name, - subscription_id=self._config.subscription_id, - timespan=timespan, - interval=interval, - metric_namespace=metric_namespace, - metric_name=metric_name, - aggregation=aggregation, - 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PredictiveResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 6c0a25377d14..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,514 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._private_endpoint_connections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_private_link_scope_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PrivateEndpointConnection - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.monitor.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: 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: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("PrivateEndpointConnectionListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index 3024893be6aa..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,187 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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 ...operations._private_link_resources_operations import build_get_request, build_list_by_private_link_scope_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.PrivateLinkResource] - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateLinkResourceListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("PrivateLinkResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, scope_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PrivateLinkResource - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - group_name=group_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scope_operation_status_operations.py deleted file mode 100644 index d1e5f848f41c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scope_operation_status_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._private_link_scope_operation_status_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkScopeOperationStatusOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`private_link_scope_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, async_operation_id: str, resource_group_name: str, **kwargs: Any) -> _models.OperationStatus: - """Get the status of an azure asynchronous operation associated with a private link scope - operation. - - :param async_operation_id: The operation Id. Required. - :type async_operation_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationStatus - :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", "2019-10-17-preview")) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - async_operation_id=async_operation_id, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scoped_resources_operations.py deleted file mode 100644 index 5a280004f546..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scoped_resources_operations.py +++ /dev/null @@ -1,507 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._private_link_scoped_resources_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_private_link_scope_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkScopedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`private_link_scoped_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any) -> _models.ScopedResource: - """Gets a scoped resource in a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :return: ScopedResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ScopedResource - :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", "2019-10-17-preview")) - cls: ClsType[_models.ScopedResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ScopedResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: Union[_models.ScopedResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScopedResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: _models.ScopedResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.monitor.models.ScopedResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Required. - :type parameters: 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: An instance of AsyncLROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: Union[_models.ScopedResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Is either a ScopedResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.ScopedResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopedResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopedResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ScopedResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ScopedResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ScopedResource"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either ScopedResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ScopedResource] - :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", "2019-10-17-preview")) - cls: ClsType[_models.ScopedResourceListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("ScopedResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scopes_operations.py deleted file mode 100644 index de96c064e415..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,634 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._private_link_scopes_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_tags_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkScopesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`private_link_scopes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.AzureMonitorPrivateLinkScope"]: - """Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - - :return: An iterator like instance of either AzureMonitorPrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScopeListResult] = 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_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("AzureMonitorPrivateLinkScopeListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AzureMonitorPrivateLinkScope"]: - """Gets a list of Azure Monitor PrivateLinkScopes within a 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 AzureMonitorPrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScopeListResult] = 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("AzureMonitorPrivateLinkScopeListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _delete_initial(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Returns a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: _models.AzureMonitorPrivateLinkScope, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Required. - :type azure_monitor_private_link_scope_payload: - ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Required. - :type azure_monitor_private_link_scope_payload: 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: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: Union[_models.AzureMonitorPrivateLinkScope, IO[bytes]], - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Is either a AzureMonitorPrivateLinkScope type or a - IO[bytes] type. Required. - :type azure_monitor_private_link_scope_payload: - ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope or IO[bytes] - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(azure_monitor_private_link_scope_payload, (IOBase, bytes)): - _content = azure_monitor_private_link_scope_payload - else: - _json = self._serialize.body(azure_monitor_private_link_scope_payload, "AzureMonitorPrivateLinkScope") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: ~azure.mgmt.monitor.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: 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: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type private_link_scope_tags: ~azure.mgmt.monitor.models.TagsResource or IO[bytes] - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_link_scope_tags, (IOBase, bytes)): - _content = private_link_scope_tags - else: - _json = self._serialize.body(private_link_scope_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_scheduled_query_rules_operations.py index 6cf7788cbd27..04b92dd9e5fb 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_scheduled_query_rules_operations.py @@ -5,10 +5,11 @@ # 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 -import sys from typing import Any, AsyncIterable, 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, @@ -26,6 +27,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._scheduled_query_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -34,11 +36,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import MonitorManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,22 +56,216 @@ class ScheduledQueryRulesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ScheduledQueryRuleResource"]: + """Retrieve a scheduled query rule definitions in a subscription. + + :return: An iterator like instance of either ScheduledQueryRuleResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResourceCollection] = 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("ScheduledQueryRuleResourceCollection", 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.ErrorContract, 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_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ScheduledQueryRuleResource"]: + """Retrieve scheduled query rule definitions in a 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 ScheduledQueryRuleResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResourceCollection] = 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("ScheduledQueryRuleResourceCollection", 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.ErrorContract, 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, rule_name: str, **kwargs: Any) -> _models.ScheduledQueryRuleResource: + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + rule_name=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.ErrorContract, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: _models.LogSearchRuleResource, + parameters: _models.ScheduledQueryRuleResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -80,12 +273,12 @@ async def create_or_update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -98,8 +291,8 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -111,8 +304,8 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -121,10 +314,10 @@ async def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: Union[_models.LogSearchRuleResource, IO[bytes]], + parameters: Union[_models.ScheduledQueryRuleResource, IO[bytes]], **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -132,10 +325,10 @@ async def create_or_update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to create or update. Is either a - LogSearchRuleResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource or IO[bytes] - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + ScheduledQueryRuleResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource or IO[bytes] + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -149,9 +342,9 @@ async def create_or_update( _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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -159,7 +352,7 @@ async def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LogSearchRuleResource") + _json = self._serialize.body(parameters, "ScheduledQueryRuleResource") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -186,63 +379,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorContract, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, rule_name: str, **kwargs: Any) -> _models.LogSearchRuleResource: - """Gets an Log Search rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -254,12 +391,12 @@ async def update( self, resource_group_name: str, rule_name: str, - parameters: _models.LogSearchRuleResourcePatch, + parameters: _models.ScheduledQueryRuleResourcePatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -267,12 +404,12 @@ async def update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -285,8 +422,8 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -298,8 +435,8 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -308,21 +445,21 @@ async def update( self, resource_group_name: str, rule_name: str, - parameters: Union[_models.LogSearchRuleResourcePatch, IO[bytes]], + parameters: Union[_models.ScheduledQueryRuleResourcePatch, IO[bytes]], **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param rule_name: The name of the rule. Required. :type rule_name: str - :param parameters: The parameters of the rule to update. Is either a LogSearchRuleResourcePatch - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch or IO[bytes] - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :param parameters: The parameters of the rule to update. Is either a + ScheduledQueryRuleResourcePatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResourcePatch or IO[bytes] + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -336,9 +473,9 @@ async def update( _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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -346,7 +483,7 @@ async def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LogSearchRuleResourcePatch") + _json = self._serialize.body(parameters, "ScheduledQueryRuleResourcePatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -373,7 +510,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorContract, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,7 +519,7 @@ async def update( @distributed_trace_async async def delete(self, resource_group_name: str, rule_name: str, **kwargs: Any) -> None: - """Deletes a Log Search rule. + """Deletes a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -404,7 +541,7 @@ async def delete(self, resource_group_name: str, rule_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -431,151 +568,3 @@ async def delete(self, resource_group_name: str, rule_name: str, **kwargs: Any) if cls: return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_subscription( - self, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.LogSearchRuleResource"]: - """List the Log Search rules within a subscription group. - - :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. - :type filter: str - :return: An iterator like instance of either LogSearchRuleResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.LogSearchRuleResource] - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResourceCollection] = 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, - filter=filter, - 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("LogSearchRuleResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorContract, 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_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.LogSearchRuleResource"]: - """List the Log Search rules within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. - :type filter: str - :return: An iterator like instance of either LogSearchRuleResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.LogSearchRuleResource] - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResourceCollection] = 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, - filter=filter, - 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("LogSearchRuleResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_service_diagnostic_settings_operations.py deleted file mode 100644 index 5a465edfd910..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_service_diagnostic_settings_operations.py +++ /dev/null @@ -1,343 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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_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 ...operations._service_diagnostic_settings_operations import ( - build_create_or_update_request, - build_get_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServiceDiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`service_diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_uri: str, **kwargs: Any) -> _models.ServiceDiagnosticSettingsResource: - """Gets the active diagnostic settings for the specified resource. **WARNING**\\ : This method - will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_uri: str, - parameters: _models.ServiceDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, resource_uri: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, resource_uri: str, parameters: Union[_models.ServiceDiagnosticSettingsResource, IO[bytes]], **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Is either a - ServiceDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource or IO[bytes] - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ServiceDiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_uri=resource_uri, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: _models.ServiceDiagnosticSettingsResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Required. - :type service_diagnostic_settings_resource: - ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Required. - :type service_diagnostic_settings_resource: 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: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: Union[_models.ServiceDiagnosticSettingsResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Is either a - ServiceDiagnosticSettingsResourcePatch type or a IO[bytes] type. Required. - :type service_diagnostic_settings_resource: - ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResourcePatch or IO[bytes] - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service_diagnostic_settings_resource, (IOBase, bytes)): - _content = service_diagnostic_settings_resource - else: - _json = self._serialize.body(service_diagnostic_settings_resource, "ServiceDiagnosticSettingsResourcePatch") - - _request = build_update_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_subscription_diagnostic_settings_operations.py deleted file mode 100644 index 59939234d3fa..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_subscription_diagnostic_settings_operations.py +++ /dev/null @@ -1,321 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -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_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 ...operations._subscription_diagnostic_settings_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SubscriptionDiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`subscription_diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, name: str, **kwargs: Any) -> _models.SubscriptionDiagnosticSettingsResource: - """Gets the active subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :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", "2017-05-01-preview")) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SubscriptionDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - name: str, - parameters: _models.SubscriptionDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, name: str, parameters: Union[_models.SubscriptionDiagnosticSettingsResource, IO[bytes]], **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Is either a - SubscriptionDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource or - IO[bytes] - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :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", "2017-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SubscriptionDiagnosticSettingsResource") - - _request = build_create_or_update_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SubscriptionDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, name: str, **kwargs: Any) -> None: - """Deletes existing subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type 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", "2017-05-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def list(self, **kwargs: Any) -> _models.SubscriptionDiagnosticSettingsResourceCollection: - """Gets the active subscription diagnostic settings list for the specified subscriptionId. - - :return: SubscriptionDiagnosticSettingsResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResourceCollection - :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", "2017-05-01-preview")) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "SubscriptionDiagnosticSettingsResourceCollection", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_tenant_activity_logs_operations.py deleted file mode 100644 index 73807ff61209..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_tenant_activity_logs_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -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.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._tenant_activity_logs_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class TenantActivityLogsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`tenant_activity_logs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, select: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.EventData"]: - """Gets the Activity Logs for the Tenant.\\ :code:`
`Everything that is applicable to the API - to get the Activity Logs for the subscription is applicable to this API (the parameters, - $filter, etc.).\\ :code:`
`One thing to point out here is that this API does *not* retrieve - the logs at the individual subscription of the tenant but only surfaces the logs that were - generated at the tenant level. - - :param filter: Reduces the set of data collected. :code:`
`The **$filter** is very - restricted and allows only the following patterns.\\ :code:`
`- List events for a resource - group: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp le '\\ - :code:``' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '\\ - :code:``'.\\ :code:`
`- List events for resource: $filter=eventTimestamp - ge '\\ :code:``' and eventTimestamp le '\\ :code:``' and eventChannels eq - 'Admin, Operation' and resourceUri eq '\\ :code:``'.\\ :code:`
`- List events - for a subscription: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp le - '\\ :code:``' and eventChannels eq 'Admin, Operation'.\\ :code:`
`- List events - for a resource provider: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp - le '\\ :code:``' and eventChannels eq 'Admin, Operation' and resourceProvider eq '\\ - :code:``'.\\ :code:`
`- List events for a correlation Id: - api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - correlationId eq '\\ :code:``'.\\ :code:`
`\\ **NOTE**\\ : No other syntax is - allowed. Default value is None. - :type filter: str - :param select: Used to fetch events with only the given properties.\\ :code:`
`The - **$select** argument is a comma separated list of property names to be returned. Possible - values are: *authorization*\\ , *claims*\\ , *correlationId*\\ , *description*\\ , - *eventDataId*\\ , *eventName*\\ , *eventTimestamp*\\ , *httpRequest*\\ , *level*\\ , - *operationId*\\ , *operationName*\\ , *properties*\\ , *resourceGroupName*\\ , - *resourceProviderName*\\ , *resourceId*\\ , *status*\\ , *submissionTimestamp*\\ , - *subStatus*\\ , *subscriptionId*. Default value is None. - :type select: str - :return: An iterator like instance of either EventData or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.EventData] - :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", "2015-04-01")) - cls: ClsType[_models.EventDataCollection] = 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_request( - filter=filter, - select=select, - 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("EventDataCollection", 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_vm_insights_operations.py deleted file mode 100644 index a29bca166356..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_vm_insights_operations.py +++ /dev/null @@ -1,105 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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_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 ...operations._vm_insights_operations import build_get_onboarding_status_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class VMInsightsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`vm_insights` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get_onboarding_status(self, resource_uri: str, **kwargs: Any) -> _models.VMInsightsOnboardingStatus: - """Retrieves the VM Insights onboarding status for the specified resource or resource scope. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource, or - scope, whose status to retrieve. Required. - :type resource_uri: str - :return: VMInsightsOnboardingStatus or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.VMInsightsOnboardingStatus - :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", "2018-11-27-preview")) - cls: ClsType[_models.VMInsightsOnboardingStatus] = kwargs.pop("cls", None) - - _request = build_get_onboarding_status_request( - resource_uri=resource_uri, - 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.ResponseWithError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMInsightsOnboardingStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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 2dee3ec988de..eaecfcc4cf24 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 @@ -14,427 +14,117 @@ from ._models_py3 import ( # type: ignore - Action, ActionDetail, ActionGroupList, ActionGroupPatchBody, ActionGroupResource, - ActivityLogAlertActionGroup, - ActivityLogAlertActionList, - ActivityLogAlertAllOfCondition, - ActivityLogAlertLeafCondition, - ActivityLogAlertList, - ActivityLogAlertPatchBody, - ActivityLogAlertResource, - AlertingAction, + Actions, ArmRoleReceiver, AutomationRunbookReceiver, - AutoscaleErrorResponse, - AutoscaleErrorResponseError, - AutoscaleNotification, - AutoscaleProfile, - AutoscaleSettingResource, - AutoscaleSettingResourceCollection, - AutoscaleSettingResourcePatch, - AzNsActionGroup, AzureAppPushReceiver, AzureFunctionReceiver, - AzureMonitorPrivateLinkScope, - AzureMonitorPrivateLinkScopeListResult, AzureResource, - BaselineMetadata, + Condition, + ConditionFailingPeriods, Context, - Criteria, - DataContainer, - DataSource, - DataSourceConfiguration, - DiagnosticSettingsCategoryResource, - DiagnosticSettingsCategoryResourceCollection, - DiagnosticSettingsResource, - DiagnosticSettingsResourceCollection, Dimension, - DynamicMetricCriteria, - DynamicThresholdFailingPeriods, - EmailNotification, EmailReceiver, EnableRequest, - Error, ErrorAdditionalInfo, ErrorContract, - ErrorDetail, - ErrorDetailAdditionalInfoItem, ErrorResponse, ErrorResponseAutoGenerated, - ErrorResponseAutoGenerated2, - ErrorResponseCommon, - ErrorResponseError, - ErrorResponseErrorAdditionalInfoItem, - EtwEventConfiguration, - EtwProviderConfiguration, - EventCategoryCollection, - EventData, - EventDataCollection, EventHubReceiver, - EventLogConfiguration, - GuestDiagnosticSettingsAssociationList, - GuestDiagnosticSettingsAssociationResource, - GuestDiagnosticSettingsAssociationResourcePatch, - GuestDiagnosticSettingsList, - GuestDiagnosticSettingsPatchResource, - GuestDiagnosticSettingsResource, - HttpRequestInfo, - Incident, - IncidentListResult, + Identity, + IncidentReceiver, + IncidentServiceConnection, ItsmReceiver, - LocalizableString, - LocalizableStringAutoGenerated, - LogMetricTrigger, - LogProfileCollection, - LogProfileResource, - LogProfileResourcePatch, - LogSearchRuleResource, - LogSearchRuleResourceCollection, - LogSearchRuleResourcePatch, - LogSettings, - LogSettingsAutoGenerated, - LogToMetricAction, LogicAppReceiver, - MetadataValue, - Metric, - MetricAlertAction, - MetricAlertCriteria, - MetricAlertMultipleResourceMultipleMetricCriteria, - MetricAlertResource, - MetricAlertResourceCollection, - MetricAlertResourcePatch, - MetricAlertSingleResourceMultipleMetricCriteria, - MetricAlertStatus, - MetricAlertStatusCollection, - MetricAlertStatusProperties, - MetricAvailability, - MetricBaselinesResponse, - MetricCriteria, - MetricDefinition, - MetricDefinitionCollection, - MetricDimension, - MetricNamespace, - MetricNamespaceCollection, - MetricNamespaceName, - MetricSettings, - MetricSettingsAutoGenerated, - MetricSingleDimension, - MetricTrigger, - MetricValue, - MultiMetricCriteria, + ManagedServiceIdentity, NotificationRequestBody, - Operation, - OperationDisplay, - OperationListResult, - OperationStatus, - PerformanceCounterConfiguration, - PredictiveAutoscalePolicy, - PredictiveResponse, - PredictiveValue, - PrivateEndpointConnection, - PrivateEndpointConnectionListResult, - PrivateEndpointProperty, - PrivateLinkResource, - PrivateLinkResourceListResult, - PrivateLinkScopesResource, - PrivateLinkServiceConnectionStateProperty, - ProxyOnlyResource, - ProxyResource, - Recurrence, - RecurrentSchedule, - Resource, - ResourceAutoGenerated, - ResourceAutoGenerated2, - ResourceAutoGenerated3, - Response, - ResponseWithError, - RetentionPolicy, - ScaleAction, - ScaleCapacity, - ScaleRule, - ScaleRuleMetricDimension, - Schedule, - ScopedResource, - ScopedResourceListResult, - SenderAuthorization, - ServiceDiagnosticSettingsResource, - ServiceDiagnosticSettingsResourcePatch, - SingleBaseline, - SingleMetricBaseline, - SinkConfiguration, + RuleResolveConfiguration, + ScheduledQueryRuleCriteria, + ScheduledQueryRuleResource, + ScheduledQueryRuleResourceCollection, + ScheduledQueryRuleResourcePatch, SmsReceiver, - Source, - SubscriptionDiagnosticSettingsResource, - SubscriptionDiagnosticSettingsResourceCollection, - SubscriptionLogSettings, - SubscriptionProxyOnlyResource, SystemData, - TagsResource, TestNotificationDetailsResponse, - TimeSeriesBaseline, - TimeSeriesElement, - TimeWindow, - TriggerCondition, - VMInsightsOnboardingStatus, + UserAssignedIdentity, + UserIdentityProperties, VoiceReceiver, - WebhookNotification, WebhookReceiver, - WebtestLocationAvailabilityCriteria, - WorkspaceInfo, ) from ._monitor_management_client_enums import ( # type: ignore - AggregationType, - AggregationTypeEnum, AlertSeverity, - BaselineSensitivity, - CategoryType, - ComparisonOperationType, - ConditionalOperator, + ConditionOperator, CreatedByType, CriterionType, - DataSourceKind, - DataStatus, - DynamicThresholdOperator, - DynamicThresholdSensitivity, - Enabled, - EventLevel, - GuestDiagnosticSettingsOsType, - MetricClass, - MetricStatisticType, - MetricTriggerType, - MetricUnit, - NamespaceClassification, - Odatatype, - OnboardingStatus, - Operator, - PredictiveAutoscalePolicyScaleMode, - ProvisioningState, - QueryType, + DimensionOperator, + IdentityType, + IncidentManagementService, + Kind, + ManagedServiceIdentityType, ReceiverStatus, - RecurrenceFrequency, - ResultType, - ScaleDirection, - ScaleRuleMetricDimensionOperationType, - ScaleType, - SinkConfigurationKind, - TimeAggregationType, + TimeAggregation, ) from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Action", "ActionDetail", "ActionGroupList", "ActionGroupPatchBody", "ActionGroupResource", - "ActivityLogAlertActionGroup", - "ActivityLogAlertActionList", - "ActivityLogAlertAllOfCondition", - "ActivityLogAlertLeafCondition", - "ActivityLogAlertList", - "ActivityLogAlertPatchBody", - "ActivityLogAlertResource", - "AlertingAction", + "Actions", "ArmRoleReceiver", "AutomationRunbookReceiver", - "AutoscaleErrorResponse", - "AutoscaleErrorResponseError", - "AutoscaleNotification", - "AutoscaleProfile", - "AutoscaleSettingResource", - "AutoscaleSettingResourceCollection", - "AutoscaleSettingResourcePatch", - "AzNsActionGroup", "AzureAppPushReceiver", "AzureFunctionReceiver", - "AzureMonitorPrivateLinkScope", - "AzureMonitorPrivateLinkScopeListResult", "AzureResource", - "BaselineMetadata", + "Condition", + "ConditionFailingPeriods", "Context", - "Criteria", - "DataContainer", - "DataSource", - "DataSourceConfiguration", - "DiagnosticSettingsCategoryResource", - "DiagnosticSettingsCategoryResourceCollection", - "DiagnosticSettingsResource", - "DiagnosticSettingsResourceCollection", "Dimension", - "DynamicMetricCriteria", - "DynamicThresholdFailingPeriods", - "EmailNotification", "EmailReceiver", "EnableRequest", - "Error", "ErrorAdditionalInfo", "ErrorContract", - "ErrorDetail", - "ErrorDetailAdditionalInfoItem", "ErrorResponse", "ErrorResponseAutoGenerated", - "ErrorResponseAutoGenerated2", - "ErrorResponseCommon", - "ErrorResponseError", - "ErrorResponseErrorAdditionalInfoItem", - "EtwEventConfiguration", - "EtwProviderConfiguration", - "EventCategoryCollection", - "EventData", - "EventDataCollection", "EventHubReceiver", - "EventLogConfiguration", - "GuestDiagnosticSettingsAssociationList", - "GuestDiagnosticSettingsAssociationResource", - "GuestDiagnosticSettingsAssociationResourcePatch", - "GuestDiagnosticSettingsList", - "GuestDiagnosticSettingsPatchResource", - "GuestDiagnosticSettingsResource", - "HttpRequestInfo", - "Incident", - "IncidentListResult", + "Identity", + "IncidentReceiver", + "IncidentServiceConnection", "ItsmReceiver", - "LocalizableString", - "LocalizableStringAutoGenerated", - "LogMetricTrigger", - "LogProfileCollection", - "LogProfileResource", - "LogProfileResourcePatch", - "LogSearchRuleResource", - "LogSearchRuleResourceCollection", - "LogSearchRuleResourcePatch", - "LogSettings", - "LogSettingsAutoGenerated", - "LogToMetricAction", "LogicAppReceiver", - "MetadataValue", - "Metric", - "MetricAlertAction", - "MetricAlertCriteria", - "MetricAlertMultipleResourceMultipleMetricCriteria", - "MetricAlertResource", - "MetricAlertResourceCollection", - "MetricAlertResourcePatch", - "MetricAlertSingleResourceMultipleMetricCriteria", - "MetricAlertStatus", - "MetricAlertStatusCollection", - "MetricAlertStatusProperties", - "MetricAvailability", - "MetricBaselinesResponse", - "MetricCriteria", - "MetricDefinition", - "MetricDefinitionCollection", - "MetricDimension", - "MetricNamespace", - "MetricNamespaceCollection", - "MetricNamespaceName", - "MetricSettings", - "MetricSettingsAutoGenerated", - "MetricSingleDimension", - "MetricTrigger", - "MetricValue", - "MultiMetricCriteria", + "ManagedServiceIdentity", "NotificationRequestBody", - "Operation", - "OperationDisplay", - "OperationListResult", - "OperationStatus", - "PerformanceCounterConfiguration", - "PredictiveAutoscalePolicy", - "PredictiveResponse", - "PredictiveValue", - "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", - "PrivateEndpointProperty", - "PrivateLinkResource", - "PrivateLinkResourceListResult", - "PrivateLinkScopesResource", - "PrivateLinkServiceConnectionStateProperty", - "ProxyOnlyResource", - "ProxyResource", - "Recurrence", - "RecurrentSchedule", - "Resource", - "ResourceAutoGenerated", - "ResourceAutoGenerated2", - "ResourceAutoGenerated3", - "Response", - "ResponseWithError", - "RetentionPolicy", - "ScaleAction", - "ScaleCapacity", - "ScaleRule", - "ScaleRuleMetricDimension", - "Schedule", - "ScopedResource", - "ScopedResourceListResult", - "SenderAuthorization", - "ServiceDiagnosticSettingsResource", - "ServiceDiagnosticSettingsResourcePatch", - "SingleBaseline", - "SingleMetricBaseline", - "SinkConfiguration", + "RuleResolveConfiguration", + "ScheduledQueryRuleCriteria", + "ScheduledQueryRuleResource", + "ScheduledQueryRuleResourceCollection", + "ScheduledQueryRuleResourcePatch", "SmsReceiver", - "Source", - "SubscriptionDiagnosticSettingsResource", - "SubscriptionDiagnosticSettingsResourceCollection", - "SubscriptionLogSettings", - "SubscriptionProxyOnlyResource", "SystemData", - "TagsResource", "TestNotificationDetailsResponse", - "TimeSeriesBaseline", - "TimeSeriesElement", - "TimeWindow", - "TriggerCondition", - "VMInsightsOnboardingStatus", + "UserAssignedIdentity", + "UserIdentityProperties", "VoiceReceiver", - "WebhookNotification", "WebhookReceiver", - "WebtestLocationAvailabilityCriteria", - "WorkspaceInfo", - "AggregationType", - "AggregationTypeEnum", "AlertSeverity", - "BaselineSensitivity", - "CategoryType", - "ComparisonOperationType", - "ConditionalOperator", + "ConditionOperator", "CreatedByType", "CriterionType", - "DataSourceKind", - "DataStatus", - "DynamicThresholdOperator", - "DynamicThresholdSensitivity", - "Enabled", - "EventLevel", - "GuestDiagnosticSettingsOsType", - "MetricClass", - "MetricStatisticType", - "MetricTriggerType", - "MetricUnit", - "NamespaceClassification", - "Odatatype", - "OnboardingStatus", - "Operator", - "PredictiveAutoscalePolicyScaleMode", - "ProvisioningState", - "QueryType", + "DimensionOperator", + "IdentityType", + "IncidentManagementService", + "Kind", + "ManagedServiceIdentityType", "ReceiverStatus", - "RecurrenceFrequency", - "ResultType", - "ScaleDirection", - "ScaleRuleMetricDimensionOperationType", - "ScaleType", - "SinkConfigurationKind", - "TimeAggregationType", + "TimeAggregation", ] __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/models/_models_py3.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py index 5b3309160199..449acdf2e1c5 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,53 +8,12 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from .. import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore +from .._utils import serialization as _serialization if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class Action(_serialization.Model): - """Action descriptor. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AlertingAction, LogToMetricAction - - All required parameters must be populated in order to send to server. - - :ivar odata_type: Specifies the action. Supported values - AlertingAction, LogToMetricAction. - Required. - :vartype odata_type: str - """ - - _validation = { - "odata_type": {"required": True}, - } - - _attribute_map = { - "odata_type": {"key": "odata\\.type", "type": "str"}, - } - - _subtype_map = { - "odata_type": { - "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction": "AlertingAction", - "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction": "LogToMetricAction", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.odata_type: Optional[str] = None class ActionDetail(_serialization.Model): @@ -154,6 +113,8 @@ class ActionGroupPatchBody(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity :ivar enabled: Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. :vartype enabled: bool @@ -161,19 +122,30 @@ class ActionGroupPatchBody(_serialization.Model): _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, enabled: bool = True, **kwargs: Any) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + enabled: bool = True, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity :keyword enabled: Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. :paramtype enabled: bool """ super().__init__(**kwargs) self.tags = tags + self.identity = identity self.enabled = enabled @@ -194,6 +166,8 @@ class AzureResource(_serialization.Model): :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity """ _validation = { @@ -209,21 +183,32 @@ class AzureResource(_serialization.Model): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: """ :keyword location: Resource location. Required. :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags + self.identity = identity class ActionGroupResource(AzureResource): @@ -243,6 +228,8 @@ class ActionGroupResource(AzureResource): :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity :ivar group_short_name: The short name of the action group. This will be used in SMS messages. :vartype group_short_name: str :ivar enabled: Indicates whether this action group is enabled. If an action group is not @@ -275,6 +262,8 @@ class ActionGroupResource(AzureResource): :vartype arm_role_receivers: list[~azure.mgmt.monitor.models.ArmRoleReceiver] :ivar event_hub_receivers: The list of event hub receivers that are part of this action group. :vartype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] + :ivar incident_receivers: The list of incident receivers that are part of this action group. + :vartype incident_receivers: list[~azure.mgmt.monitor.models.IncidentReceiver] """ _validation = { @@ -291,6 +280,7 @@ class ActionGroupResource(AzureResource): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "group_short_name": {"key": "properties.groupShortName", "type": "str"}, "enabled": {"key": "properties.enabled", "type": "bool"}, "email_receivers": {"key": "properties.emailReceivers", "type": "[EmailReceiver]"}, @@ -307,6 +297,7 @@ class ActionGroupResource(AzureResource): "azure_function_receivers": {"key": "properties.azureFunctionReceivers", "type": "[AzureFunctionReceiver]"}, "arm_role_receivers": {"key": "properties.armRoleReceivers", "type": "[ArmRoleReceiver]"}, "event_hub_receivers": {"key": "properties.eventHubReceivers", "type": "[EventHubReceiver]"}, + "incident_receivers": {"key": "properties.incidentReceivers", "type": "[IncidentReceiver]"}, } def __init__( @@ -314,6 +305,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, group_short_name: Optional[str] = None, enabled: bool = True, email_receivers: Optional[List["_models.EmailReceiver"]] = None, @@ -327,6 +319,7 @@ def __init__( azure_function_receivers: Optional[List["_models.AzureFunctionReceiver"]] = None, arm_role_receivers: Optional[List["_models.ArmRoleReceiver"]] = None, event_hub_receivers: Optional[List["_models.EventHubReceiver"]] = None, + incident_receivers: Optional[List["_models.IncidentReceiver"]] = None, **kwargs: Any ) -> None: """ @@ -334,6 +327,8 @@ def __init__( :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.monitor.models.ManagedServiceIdentity :keyword group_short_name: The short name of the action group. This will be used in SMS messages. :paramtype group_short_name: str @@ -369,8 +364,10 @@ def __init__( :keyword event_hub_receivers: The list of event hub receivers that are part of this action group. :paramtype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] + :keyword incident_receivers: The list of incident receivers that are part of this action group. + :paramtype incident_receivers: list[~azure.mgmt.monitor.models.IncidentReceiver] """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.group_short_name = group_short_name self.enabled = enabled self.email_receivers = email_receivers @@ -384,7665 +381,1869 @@ def __init__( self.azure_function_receivers = azure_function_receivers self.arm_role_receivers = arm_role_receivers self.event_hub_receivers = event_hub_receivers + self.incident_receivers = incident_receivers -class ActivityLogAlertActionGroup(_serialization.Model): - """A pointer to an Azure Action Group. - - All required parameters must be populated in order to send to server. +class Actions(_serialization.Model): + """Actions to invoke when the alert fires. - :ivar action_group_id: The resourceId of the action group. This cannot be null or empty. - Required. - :vartype action_group_id: str - :ivar webhook_properties: the dictionary of custom properties to include with the post - operation. These data are appended to the webhook payload. - :vartype webhook_properties: dict[str, str] + :ivar action_groups: Action Group resource Ids to invoke when the alert fires. + :vartype action_groups: list[str] + :ivar custom_properties: The properties of an alert payload. + :vartype custom_properties: dict[str, str] + :ivar action_properties: The properties of an action properties. + :vartype action_properties: dict[str, str] """ - _validation = { - "action_group_id": {"required": True}, - } - _attribute_map = { - "action_group_id": {"key": "actionGroupId", "type": "str"}, - "webhook_properties": {"key": "webhookProperties", "type": "{str}"}, + "action_groups": {"key": "actionGroups", "type": "[str]"}, + "custom_properties": {"key": "customProperties", "type": "{str}"}, + "action_properties": {"key": "actionProperties", "type": "{str}"}, } def __init__( - self, *, action_group_id: str, webhook_properties: Optional[Dict[str, str]] = None, **kwargs: Any + self, + *, + action_groups: Optional[List[str]] = None, + custom_properties: Optional[Dict[str, str]] = None, + action_properties: Optional[Dict[str, str]] = None, + **kwargs: Any ) -> None: """ - :keyword action_group_id: The resourceId of the action group. This cannot be null or empty. - Required. - :paramtype action_group_id: str - :keyword webhook_properties: the dictionary of custom properties to include with the post - operation. These data are appended to the webhook payload. - :paramtype webhook_properties: dict[str, str] + :keyword action_groups: Action Group resource Ids to invoke when the alert fires. + :paramtype action_groups: list[str] + :keyword custom_properties: The properties of an alert payload. + :paramtype custom_properties: dict[str, str] + :keyword action_properties: The properties of an action properties. + :paramtype action_properties: dict[str, str] """ super().__init__(**kwargs) - self.action_group_id = action_group_id - self.webhook_properties = webhook_properties + self.action_groups = action_groups + self.custom_properties = custom_properties + self.action_properties = action_properties -class ActivityLogAlertActionList(_serialization.Model): - """A list of activity log alert actions. +class ArmRoleReceiver(_serialization.Model): + """An arm role receiver. + + All required parameters must be populated in order to send to server. - :ivar action_groups: The list of activity log alerts. - :vartype action_groups: list[~azure.mgmt.monitor.models.ActivityLogAlertActionGroup] + :ivar name: The name of the arm role receiver. Names must be unique across all receivers within + an action group. Required. + :vartype name: str + :ivar role_id: The arm role id. Required. + :vartype role_id: str + :ivar use_common_alert_schema: Indicates whether to use common alert schema. + :vartype use_common_alert_schema: bool """ + _validation = { + "name": {"required": True}, + "role_id": {"required": True}, + } + _attribute_map = { - "action_groups": {"key": "actionGroups", "type": "[ActivityLogAlertActionGroup]"}, + "name": {"key": "name", "type": "str"}, + "role_id": {"key": "roleId", "type": "str"}, + "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, } - def __init__( - self, *, action_groups: Optional[List["_models.ActivityLogAlertActionGroup"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, name: str, role_id: str, use_common_alert_schema: bool = False, **kwargs: Any) -> None: """ - :keyword action_groups: The list of activity log alerts. - :paramtype action_groups: list[~azure.mgmt.monitor.models.ActivityLogAlertActionGroup] + :keyword name: The name of the arm role receiver. Names must be unique across all receivers + within an action group. Required. + :paramtype name: str + :keyword role_id: The arm role id. Required. + :paramtype role_id: str + :keyword use_common_alert_schema: Indicates whether to use common alert schema. + :paramtype use_common_alert_schema: bool """ super().__init__(**kwargs) - self.action_groups = action_groups + self.name = name + self.role_id = role_id + self.use_common_alert_schema = use_common_alert_schema -class ActivityLogAlertAllOfCondition(_serialization.Model): - """An Activity Log alert condition that is met when all its member conditions are met. +class AutomationRunbookReceiver(_serialization.Model): + """The Azure Automation Runbook notification receiver. All required parameters must be populated in order to send to server. - :ivar all_of: The list of activity log alert conditions. Required. - :vartype all_of: list[~azure.mgmt.monitor.models.ActivityLogAlertLeafCondition] + :ivar automation_account_id: The Azure automation account Id which holds this runbook and + authenticate to Azure resource. Required. + :vartype automation_account_id: str + :ivar runbook_name: The name for this runbook. Required. + :vartype runbook_name: str + :ivar webhook_resource_id: The resource id for webhook linked to this runbook. Required. + :vartype webhook_resource_id: str + :ivar is_global_runbook: Indicates whether this instance is global runbook. Required. + :vartype is_global_runbook: bool + :ivar name: Indicates name of the webhook. + :vartype name: str + :ivar service_uri: The URI where webhooks should be sent. + :vartype service_uri: str + :ivar use_common_alert_schema: Indicates whether to use common alert schema. + :vartype use_common_alert_schema: bool + :ivar managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :vartype managed_identity: str """ _validation = { - "all_of": {"required": True}, + "automation_account_id": {"required": True}, + "runbook_name": {"required": True}, + "webhook_resource_id": {"required": True}, + "is_global_runbook": {"required": True}, } _attribute_map = { - "all_of": {"key": "allOf", "type": "[ActivityLogAlertLeafCondition]"}, + "automation_account_id": {"key": "automationAccountId", "type": "str"}, + "runbook_name": {"key": "runbookName", "type": "str"}, + "webhook_resource_id": {"key": "webhookResourceId", "type": "str"}, + "is_global_runbook": {"key": "isGlobalRunbook", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "service_uri": {"key": "serviceUri", "type": "str"}, + "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "managed_identity": {"key": "managedIdentity", "type": "str"}, } - def __init__(self, *, all_of: List["_models.ActivityLogAlertLeafCondition"], **kwargs: Any) -> None: + def __init__( + self, + *, + automation_account_id: str, + runbook_name: str, + webhook_resource_id: str, + is_global_runbook: bool, + name: Optional[str] = None, + service_uri: Optional[str] = None, + use_common_alert_schema: bool = False, + managed_identity: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword all_of: The list of activity log alert conditions. Required. - :paramtype all_of: list[~azure.mgmt.monitor.models.ActivityLogAlertLeafCondition] + :keyword automation_account_id: The Azure automation account Id which holds this runbook and + authenticate to Azure resource. Required. + :paramtype automation_account_id: str + :keyword runbook_name: The name for this runbook. Required. + :paramtype runbook_name: str + :keyword webhook_resource_id: The resource id for webhook linked to this runbook. Required. + :paramtype webhook_resource_id: str + :keyword is_global_runbook: Indicates whether this instance is global runbook. Required. + :paramtype is_global_runbook: bool + :keyword name: Indicates name of the webhook. + :paramtype name: str + :keyword service_uri: The URI where webhooks should be sent. + :paramtype service_uri: str + :keyword use_common_alert_schema: Indicates whether to use common alert schema. + :paramtype use_common_alert_schema: bool + :keyword managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :paramtype managed_identity: str """ super().__init__(**kwargs) - self.all_of = all_of + self.automation_account_id = automation_account_id + self.runbook_name = runbook_name + self.webhook_resource_id = webhook_resource_id + self.is_global_runbook = is_global_runbook + self.name = name + self.service_uri = service_uri + self.use_common_alert_schema = use_common_alert_schema + self.managed_identity = managed_identity -class ActivityLogAlertLeafCondition(_serialization.Model): - """An Activity Log alert condition that is met by comparing an activity log field and value. +class AzureAppPushReceiver(_serialization.Model): + """The Azure mobile App push notification receiver. All required parameters must be populated in order to send to server. - :ivar field: The name of the field that this condition will examine. The possible values for - this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', - 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or - anything beginning with 'properties.'. Required. - :vartype field: str - :ivar equals: The field value will be compared to this value (case-insensitive) to determine if - the condition is met. Required. - :vartype equals: str + :ivar name: The name of the Azure mobile app push receiver. Names must be unique across all + receivers within an action group. Required. + :vartype name: str + :ivar email_address: The email address registered for the Azure mobile app. Required. + :vartype email_address: str """ _validation = { - "field": {"required": True}, - "equals": {"required": True}, + "name": {"required": True}, + "email_address": {"required": True}, } _attribute_map = { - "field": {"key": "field", "type": "str"}, - "equals": {"key": "equals", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "email_address": {"key": "emailAddress", "type": "str"}, } - def __init__(self, *, field: str, equals: str, **kwargs: Any) -> None: + def __init__(self, *, name: str, email_address: str, **kwargs: Any) -> None: """ - :keyword field: The name of the field that this condition will examine. The possible values for - this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', - 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or - anything beginning with 'properties.'. Required. - :paramtype field: str - :keyword equals: The field value will be compared to this value (case-insensitive) to determine - if the condition is met. Required. - :paramtype equals: str + :keyword name: The name of the Azure mobile app push receiver. Names must be unique across all + receivers within an action group. Required. + :paramtype name: str + :keyword email_address: The email address registered for the Azure mobile app. Required. + :paramtype email_address: str """ super().__init__(**kwargs) - self.field = field - self.equals = equals + self.name = name + self.email_address = email_address -class ActivityLogAlertList(_serialization.Model): - """A list of activity log alerts. +class AzureFunctionReceiver(_serialization.Model): + """An azure function receiver. - :ivar value: The list of activity log alerts. - :vartype value: list[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :ivar next_link: Provides the link to retrieve the next set of elements. - :vartype next_link: str + All required parameters must be populated in order to send to server. + + :ivar name: The name of the azure function receiver. Names must be unique across all receivers + within an action group. Required. + :vartype name: str + :ivar function_app_resource_id: The azure resource id of the function app. Required. + :vartype function_app_resource_id: str + :ivar function_name: The function name in the function app. Required. + :vartype function_name: str + :ivar http_trigger_url: The http trigger url where http request sent to. Required. + :vartype http_trigger_url: str + :ivar use_common_alert_schema: Indicates whether to use common alert schema. + :vartype use_common_alert_schema: bool + :ivar managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :vartype managed_identity: str """ + _validation = { + "name": {"required": True}, + "function_app_resource_id": {"required": True}, + "function_name": {"required": True}, + "http_trigger_url": {"required": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[ActivityLogAlertResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "function_app_resource_id": {"key": "functionAppResourceId", "type": "str"}, + "function_name": {"key": "functionName", "type": "str"}, + "http_trigger_url": {"key": "httpTriggerUrl", "type": "str"}, + "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "managed_identity": {"key": "managedIdentity", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.ActivityLogAlertResource"]] = None, - next_link: Optional[str] = None, + name: str, + function_app_resource_id: str, + function_name: str, + http_trigger_url: str, + use_common_alert_schema: bool = False, + managed_identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of activity log alerts. - :paramtype value: list[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :keyword next_link: Provides the link to retrieve the next set of elements. - :paramtype next_link: str + :keyword name: The name of the azure function receiver. Names must be unique across all + receivers within an action group. Required. + :paramtype name: str + :keyword function_app_resource_id: The azure resource id of the function app. Required. + :paramtype function_app_resource_id: str + :keyword function_name: The function name in the function app. Required. + :paramtype function_name: str + :keyword http_trigger_url: The http trigger url where http request sent to. Required. + :paramtype http_trigger_url: str + :keyword use_common_alert_schema: Indicates whether to use common alert schema. + :paramtype use_common_alert_schema: bool + :keyword managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :paramtype managed_identity: str """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.name = name + self.function_app_resource_id = function_app_resource_id + self.function_name = function_name + self.http_trigger_url = http_trigger_url + self.use_common_alert_schema = use_common_alert_schema + self.managed_identity = managed_identity -class ActivityLogAlertPatchBody(_serialization.Model): - """An activity log alert object for the body of patch operations. +class Condition(_serialization.Model): + """A condition of the scheduled query rule. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar enabled: Indicates whether this activity log alert is enabled. If an activity log alert - is not enabled, then none of its actions will be activated. - :vartype enabled: bool + :ivar criterion_type: Specifies the type of threshold criteria. Known values are: + "StaticThresholdCriterion" and "DynamicThresholdCriterion". + :vartype criterion_type: str or ~azure.mgmt.monitor.models.CriterionType + :ivar query: Log query alert. + :vartype query: str + :ivar time_aggregation: Aggregation type. Relevant and required only for rules of the kind + LogAlert. Known values are: "Count", "Average", "Minimum", "Maximum", and "Total". + :vartype time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregation + :ivar metric_measure_column: The column containing the metric measure number. Relevant only for + rules of the kind LogAlert. + :vartype metric_measure_column: str + :ivar resource_id_column: The column containing the resource id. The content of the column must + be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. + :vartype resource_id_column: str + :ivar dimensions: List of Dimensions conditions. + :vartype dimensions: list[~azure.mgmt.monitor.models.Dimension] + :ivar operator: The criteria operator. Relevant and required only for rules of the kind + LogAlert. Known values are: "Equals", "GreaterThan", "GreaterThanOrEqual", "LessThan", + "LessThanOrEqual", and "GreaterOrLessThan". + :vartype operator: str or ~azure.mgmt.monitor.models.ConditionOperator + :ivar threshold: the criteria threshold value that activates the alert. Relevant and required + only for static threshold rules of the kind LogAlert. + :vartype threshold: float + :ivar alert_sensitivity: The extent of deviation required to trigger an alert. Allowed values + are 'Low', 'Medium' and 'High'. This will affect how tight the threshold is to the metric + series pattern. Relevant only for dynamic threshold rules of the kind LogAlert. + :vartype alert_sensitivity: str + :ivar ignore_data_before: Use this option to set the date from which to start learning the + metric historical data and calculate the dynamic thresholds (in ISO8601 format). Relevant only + for dynamic threshold rules of the kind LogAlert. + :vartype ignore_data_before: ~datetime.datetime + :ivar failing_periods: The minimum number of violations required within the selected lookback + time window required to raise an alert. Relevant only for rules of the kind LogAlert. + :vartype failing_periods: ~azure.mgmt.monitor.models.ConditionFailingPeriods + :ivar metric_name: The name of the metric to be sent. Relevant and required only for rules of + the kind LogToMetric. + :vartype metric_name: str + :ivar min_recurrence_count: The minimum results count that should be found for triggering an + alert. Relevant only for rules of the kind SimpleLogAlert. + :vartype min_recurrence_count: int """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, + "criterion_type": {"key": "criterionType", "type": "str"}, + "query": {"key": "query", "type": "str"}, + "time_aggregation": {"key": "timeAggregation", "type": "str"}, + "metric_measure_column": {"key": "metricMeasureColumn", "type": "str"}, + "resource_id_column": {"key": "resourceIdColumn", "type": "str"}, + "dimensions": {"key": "dimensions", "type": "[Dimension]"}, + "operator": {"key": "operator", "type": "str"}, + "threshold": {"key": "threshold", "type": "float"}, + "alert_sensitivity": {"key": "alertSensitivity", "type": "str"}, + "ignore_data_before": {"key": "ignoreDataBefore", "type": "iso-8601"}, + "failing_periods": {"key": "failingPeriods", "type": "ConditionFailingPeriods"}, + "metric_name": {"key": "metricName", "type": "str"}, + "min_recurrence_count": {"key": "minRecurrenceCount", "type": "int"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, enabled: bool = True, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword enabled: Indicates whether this activity log alert is enabled. If an activity log - alert is not enabled, then none of its actions will be activated. - :paramtype enabled: bool + def __init__( + self, + *, + criterion_type: Optional[Union[str, "_models.CriterionType"]] = None, + query: Optional[str] = None, + time_aggregation: Optional[Union[str, "_models.TimeAggregation"]] = None, + metric_measure_column: Optional[str] = None, + resource_id_column: Optional[str] = None, + dimensions: Optional[List["_models.Dimension"]] = None, + operator: Optional[Union[str, "_models.ConditionOperator"]] = None, + threshold: Optional[float] = None, + alert_sensitivity: Optional[str] = None, + ignore_data_before: Optional[datetime.datetime] = None, + failing_periods: Optional["_models.ConditionFailingPeriods"] = None, + metric_name: Optional[str] = None, + min_recurrence_count: Optional[int] = None, + **kwargs: Any + ) -> None: """ - super().__init__(**kwargs) - self.tags = tags - self.enabled = enabled - - -class Resource(_serialization.Model): - """An azure resource object. + :keyword criterion_type: Specifies the type of threshold criteria. Known values are: + "StaticThresholdCriterion" and "DynamicThresholdCriterion". + :paramtype criterion_type: str or ~azure.mgmt.monitor.models.CriterionType + :keyword query: Log query alert. + :paramtype query: str + :keyword time_aggregation: Aggregation type. Relevant and required only for rules of the kind + LogAlert. Known values are: "Count", "Average", "Minimum", "Maximum", and "Total". + :paramtype time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregation + :keyword metric_measure_column: The column containing the metric measure number. Relevant only + for rules of the kind LogAlert. + :paramtype metric_measure_column: str + :keyword resource_id_column: The column containing the resource id. The content of the column + must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. + :paramtype resource_id_column: str + :keyword dimensions: List of Dimensions conditions. + :paramtype dimensions: list[~azure.mgmt.monitor.models.Dimension] + :keyword operator: The criteria operator. Relevant and required only for rules of the kind + LogAlert. Known values are: "Equals", "GreaterThan", "GreaterThanOrEqual", "LessThan", + "LessThanOrEqual", and "GreaterOrLessThan". + :paramtype operator: str or ~azure.mgmt.monitor.models.ConditionOperator + :keyword threshold: the criteria threshold value that activates the alert. Relevant and + required only for static threshold rules of the kind LogAlert. + :paramtype threshold: float + :keyword alert_sensitivity: The extent of deviation required to trigger an alert. Allowed + values are 'Low', 'Medium' and 'High'. This will affect how tight the threshold is to the + metric series pattern. Relevant only for dynamic threshold rules of the kind LogAlert. + :paramtype alert_sensitivity: str + :keyword ignore_data_before: Use this option to set the date from which to start learning the + metric historical data and calculate the dynamic thresholds (in ISO8601 format). Relevant only + for dynamic threshold rules of the kind LogAlert. + :paramtype ignore_data_before: ~datetime.datetime + :keyword failing_periods: The minimum number of violations required within the selected + lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. + :paramtype failing_periods: ~azure.mgmt.monitor.models.ConditionFailingPeriods + :keyword metric_name: The name of the metric to be sent. Relevant and required only for rules + of the kind LogToMetric. + :paramtype metric_name: str + :keyword min_recurrence_count: The minimum results count that should be found for triggering an + alert. Relevant only for rules of the kind SimpleLogAlert. + :paramtype min_recurrence_count: int + """ + super().__init__(**kwargs) + self.criterion_type = criterion_type + self.query = query + self.time_aggregation = time_aggregation + self.metric_measure_column = metric_measure_column + self.resource_id_column = resource_id_column + self.dimensions = dimensions + self.operator = operator + self.threshold = threshold + self.alert_sensitivity = alert_sensitivity + self.ignore_data_before = ignore_data_before + self.failing_periods = failing_periods + self.metric_name = metric_name + self.min_recurrence_count = min_recurrence_count - 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. +class ConditionFailingPeriods(_serialization.Model): + """The minimum number of violations required within the selected lookback time window required to + raise an alert. Relevant only for rules of the kind LogAlert. - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :ivar number_of_evaluation_periods: The number of aggregated lookback points. The lookback time + window is calculated based on the aggregation granularity (windowSize) and the selected number + of aggregated points. Default value is 1. + :vartype number_of_evaluation_periods: int + :ivar min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :vartype min_failing_periods_to_alert: int """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, + "number_of_evaluation_periods": {"key": "numberOfEvaluationPeriods", "type": "int"}, + "min_failing_periods_to_alert": {"key": "minFailingPeriodsToAlert", "type": "int"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, *, number_of_evaluation_periods: int = 1, min_failing_periods_to_alert: int = 1, **kwargs: Any + ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + :keyword number_of_evaluation_periods: The number of aggregated lookback points. The lookback + time window is calculated based on the aggregation granularity (windowSize) and the selected + number of aggregated points. Default value is 1. + :paramtype number_of_evaluation_periods: int + :keyword min_failing_periods_to_alert: The number of violations to trigger an alert. Should be + smaller or equal to numberOfEvaluationPeriods. Default value is 1. + :paramtype min_failing_periods_to_alert: int """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class ActivityLogAlertResource(Resource): - """An activity log alert resource. + self.number_of_evaluation_periods = number_of_evaluation_periods + self.min_failing_periods_to_alert = min_failing_periods_to_alert - 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. +class Context(_serialization.Model): + """The context info. - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar scopes: A list of resourceIds that will be used as prefixes. The alert will only apply to - activityLogs with resourceIds that fall under one of these prefixes. This list must include at - least one item. - :vartype scopes: list[str] - :ivar enabled: Indicates whether this activity log alert is enabled. If an activity log alert - is not enabled, then none of its actions will be activated. - :vartype enabled: bool - :ivar condition: The condition that will cause this alert to activate. - :vartype condition: ~azure.mgmt.monitor.models.ActivityLogAlertAllOfCondition - :ivar actions: The actions that will activate when the condition is met. - :vartype actions: ~azure.mgmt.monitor.models.ActivityLogAlertActionList - :ivar description: A description of this activity log alert. - :vartype description: str + :ivar notification_source: The source of the notification request. + :vartype notification_source: str + :ivar context_type: The context id type. + :vartype context_type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "scopes": {"key": "properties.scopes", "type": "[str]"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "condition": {"key": "properties.condition", "type": "ActivityLogAlertAllOfCondition"}, - "actions": {"key": "properties.actions", "type": "ActivityLogAlertActionList"}, - "description": {"key": "properties.description", "type": "str"}, + "notification_source": {"key": "notificationSource", "type": "str"}, + "context_type": {"key": "contextType", "type": "str"}, } def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - scopes: Optional[List[str]] = None, - enabled: bool = True, - condition: Optional["_models.ActivityLogAlertAllOfCondition"] = None, - actions: Optional["_models.ActivityLogAlertActionList"] = None, - description: Optional[str] = None, - **kwargs: Any + self, *, notification_source: Optional[str] = None, context_type: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword scopes: A list of resourceIds that will be used as prefixes. The alert will only apply - to activityLogs with resourceIds that fall under one of these prefixes. This list must include - at least one item. - :paramtype scopes: list[str] - :keyword enabled: Indicates whether this activity log alert is enabled. If an activity log - alert is not enabled, then none of its actions will be activated. - :paramtype enabled: bool - :keyword condition: The condition that will cause this alert to activate. - :paramtype condition: ~azure.mgmt.monitor.models.ActivityLogAlertAllOfCondition - :keyword actions: The actions that will activate when the condition is met. - :paramtype actions: ~azure.mgmt.monitor.models.ActivityLogAlertActionList - :keyword description: A description of this activity log alert. - :paramtype description: str + :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__(location=location, tags=tags, **kwargs) - self.scopes = scopes - self.enabled = enabled - self.condition = condition - self.actions = actions - self.description = description + super().__init__(**kwargs) + self.notification_source = notification_source + self.context_type = context_type -class AlertingAction(Action): - """Specify action need to be taken when rule type is Alert. +class Dimension(_serialization.Model): + """Dimension splitting and filtering definition. All required parameters must be populated in order to send to server. - :ivar odata_type: Specifies the action. Supported values - AlertingAction, LogToMetricAction. - Required. - :vartype odata_type: str - :ivar severity: Severity of the alert. Required. Known values are: "0", "1", "2", "3", and "4". - :vartype severity: str or ~azure.mgmt.monitor.models.AlertSeverity - :ivar azns_action: Azure action group reference. - :vartype azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup - :ivar throttling_in_min: time (in minutes) for which Alerts should be throttled or suppressed. - :vartype throttling_in_min: int - :ivar trigger: The trigger condition that results in the alert rule being. Required. - :vartype trigger: ~azure.mgmt.monitor.models.TriggerCondition + :ivar name: Name of the dimension. Required. + :vartype name: str + :ivar operator: Operator for dimension values. Required. Known values are: "Include" and + "Exclude". + :vartype operator: str or ~azure.mgmt.monitor.models.DimensionOperator + :ivar values: List of dimension values. Required. + :vartype values: list[str] """ _validation = { - "odata_type": {"required": True}, - "severity": {"required": True}, - "trigger": {"required": True}, + "name": {"required": True}, + "operator": {"required": True}, + "values": {"required": True}, } _attribute_map = { - "odata_type": {"key": "odata\\.type", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "azns_action": {"key": "aznsAction", "type": "AzNsActionGroup"}, - "throttling_in_min": {"key": "throttlingInMin", "type": "int"}, - "trigger": {"key": "trigger", "type": "TriggerCondition"}, + "name": {"key": "name", "type": "str"}, + "operator": {"key": "operator", "type": "str"}, + "values": {"key": "values", "type": "[str]"}, } def __init__( - self, - *, - severity: Union[str, "_models.AlertSeverity"], - trigger: "_models.TriggerCondition", - azns_action: Optional["_models.AzNsActionGroup"] = None, - throttling_in_min: Optional[int] = None, - **kwargs: Any + self, *, name: str, operator: Union[str, "_models.DimensionOperator"], values: List[str], **kwargs: Any ) -> None: """ - :keyword severity: Severity of the alert. Required. Known values are: "0", "1", "2", "3", and - "4". - :paramtype severity: str or ~azure.mgmt.monitor.models.AlertSeverity - :keyword azns_action: Azure action group reference. - :paramtype azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup - :keyword throttling_in_min: time (in minutes) for which Alerts should be throttled or - suppressed. - :paramtype throttling_in_min: int - :keyword trigger: The trigger condition that results in the alert rule being. Required. - :paramtype trigger: ~azure.mgmt.monitor.models.TriggerCondition + :keyword name: Name of the dimension. Required. + :paramtype name: str + :keyword operator: Operator for dimension values. Required. Known values are: "Include" and + "Exclude". + :paramtype operator: str or ~azure.mgmt.monitor.models.DimensionOperator + :keyword values: List of dimension values. Required. + :paramtype values: list[str] """ super().__init__(**kwargs) - self.odata_type: str = ( - "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" - ) - self.severity = severity - self.azns_action = azns_action - self.throttling_in_min = throttling_in_min - self.trigger = trigger + self.name = name + self.operator = operator + self.values = values -class ArmRoleReceiver(_serialization.Model): - """An arm role receiver. +class EmailReceiver(_serialization.Model): + """An email receiver. + + 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 name: The name of the arm role receiver. Names must be unique across all receivers within - an action group. Required. + :ivar name: The name of the email receiver. Names must be unique across all receivers within an + action group. Required. :vartype name: str - :ivar role_id: The arm role id. Required. - :vartype role_id: str + :ivar email_address: The email address of this receiver. Required. + :vartype email_address: str :ivar use_common_alert_schema: Indicates whether to use common alert schema. :vartype use_common_alert_schema: bool + :ivar status: The receiver status of the e-mail. Known values are: "NotSpecified", "Enabled", + and "Disabled". + :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus """ _validation = { "name": {"required": True}, - "role_id": {"required": True}, + "email_address": {"required": True}, + "status": {"readonly": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, - "role_id": {"key": "roleId", "type": "str"}, + "email_address": {"key": "emailAddress", "type": "str"}, "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "status": {"key": "status", "type": "str"}, } - def __init__(self, *, name: str, role_id: str, use_common_alert_schema: bool = False, **kwargs: Any) -> None: + def __init__(self, *, name: str, email_address: str, use_common_alert_schema: bool = False, **kwargs: Any) -> None: """ - :keyword name: The name of the arm role receiver. Names must be unique across all receivers - within an action group. Required. + :keyword name: The name of the email receiver. Names must be unique across all receivers within + an action group. Required. :paramtype name: str - :keyword role_id: The arm role id. Required. - :paramtype role_id: str + :keyword email_address: The email address of this receiver. Required. + :paramtype email_address: str :keyword use_common_alert_schema: Indicates whether to use common alert schema. :paramtype use_common_alert_schema: bool """ super().__init__(**kwargs) self.name = name - self.role_id = role_id + self.email_address = email_address self.use_common_alert_schema = use_common_alert_schema + self.status: Optional[Union[str, "_models.ReceiverStatus"]] = None -class AutomationRunbookReceiver(_serialization.Model): - """The Azure Automation Runbook notification receiver. +class EnableRequest(_serialization.Model): + """Describes a receiver that should be resubscribed. All required parameters must be populated in order to send to server. - :ivar automation_account_id: The Azure automation account Id which holds this runbook and - authenticate to Azure resource. Required. - :vartype automation_account_id: str - :ivar runbook_name: The name for this runbook. Required. - :vartype runbook_name: str - :ivar webhook_resource_id: The resource id for webhook linked to this runbook. Required. - :vartype webhook_resource_id: str - :ivar is_global_runbook: Indicates whether this instance is global runbook. Required. - :vartype is_global_runbook: bool - :ivar name: Indicates name of the webhook. - :vartype name: str - :ivar service_uri: The URI where webhooks should be sent. - :vartype service_uri: str - :ivar use_common_alert_schema: Indicates whether to use common alert schema. - :vartype use_common_alert_schema: bool + :ivar receiver_name: The name of the receiver to resubscribe. Required. + :vartype receiver_name: str """ _validation = { - "automation_account_id": {"required": True}, - "runbook_name": {"required": True}, - "webhook_resource_id": {"required": True}, - "is_global_runbook": {"required": True}, + "receiver_name": {"required": True}, } _attribute_map = { - "automation_account_id": {"key": "automationAccountId", "type": "str"}, - "runbook_name": {"key": "runbookName", "type": "str"}, - "webhook_resource_id": {"key": "webhookResourceId", "type": "str"}, - "is_global_runbook": {"key": "isGlobalRunbook", "type": "bool"}, - "name": {"key": "name", "type": "str"}, - "service_uri": {"key": "serviceUri", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "receiver_name": {"key": "receiverName", "type": "str"}, } - def __init__( - self, - *, - automation_account_id: str, - runbook_name: str, - webhook_resource_id: str, - is_global_runbook: bool, - name: Optional[str] = None, - service_uri: Optional[str] = None, - use_common_alert_schema: bool = False, - **kwargs: Any - ) -> None: + def __init__(self, *, receiver_name: str, **kwargs: Any) -> None: """ - :keyword automation_account_id: The Azure automation account Id which holds this runbook and - authenticate to Azure resource. Required. - :paramtype automation_account_id: str - :keyword runbook_name: The name for this runbook. Required. - :paramtype runbook_name: str - :keyword webhook_resource_id: The resource id for webhook linked to this runbook. Required. - :paramtype webhook_resource_id: str - :keyword is_global_runbook: Indicates whether this instance is global runbook. Required. - :paramtype is_global_runbook: bool - :keyword name: Indicates name of the webhook. - :paramtype name: str - :keyword service_uri: The URI where webhooks should be sent. - :paramtype service_uri: str - :keyword use_common_alert_schema: Indicates whether to use common alert schema. - :paramtype use_common_alert_schema: bool + :keyword receiver_name: The name of the receiver to resubscribe. Required. + :paramtype receiver_name: str """ super().__init__(**kwargs) - self.automation_account_id = automation_account_id - self.runbook_name = runbook_name - self.webhook_resource_id = webhook_resource_id - self.is_global_runbook = is_global_runbook - self.name = name - self.service_uri = service_uri - self.use_common_alert_schema = use_common_alert_schema + self.receiver_name = receiver_name -class AutoscaleErrorResponse(_serialization.Model): - """Describes the format of Error response. +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. Variables are only populated by the server, and will be ignored when sending a request. - :ivar error: The error object. - :vartype error: ~azure.mgmt.monitor.models.AutoscaleErrorResponseError - :ivar system_data: The system metadata related to the response. - :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON """ _validation = { - "system_data": {"readonly": True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { - "error": {"key": "error", "type": "AutoscaleErrorResponseError"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.info: Optional[JSON] = None + + +class ErrorContract(_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.ErrorResponseAutoGenerated + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseAutoGenerated"}, } - def __init__(self, *, error: Optional["_models.AutoscaleErrorResponseError"] = None, **kwargs: Any) -> None: + def __init__(self, *, error: Optional["_models.ErrorResponseAutoGenerated"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. - :paramtype error: ~azure.mgmt.monitor.models.AutoscaleErrorResponseError + :paramtype error: ~azure.mgmt.monitor.models.ErrorResponseAutoGenerated """ super().__init__(**kwargs) self.error = error - self.system_data = None -class AutoscaleErrorResponseError(_serialization.Model): - """The error object. +class ErrorResponse(_serialization.Model): + """Describes the format of Error response. - :ivar code: One of a server-defined set of error codes. + :ivar code: Error code. :vartype code: str - :ivar message: A human-readable representation of the error. + :ivar message: Error message indicating why the operation failed. :vartype message: str - :ivar target: The target of the particular error. - :vartype target: str - :ivar details: A human-readable representation of the error's details. - :vartype details: str """ _attribute_map = { "code": {"key": "code", "type": "str"}, "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "str"}, } - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword code: One of a server-defined set of error codes. + :keyword code: Error code. :paramtype code: str - :keyword message: A human-readable representation of the error. + :keyword message: Error message indicating why the operation failed. :paramtype message: str - :keyword target: The target of the particular error. - :paramtype target: str - :keyword details: A human-readable representation of the error's details. - :paramtype details: str """ super().__init__(**kwargs) self.code = code self.message = message - self.target = target - self.details = details -class AutoscaleNotification(_serialization.Model): - """Autoscale notification. +class ErrorResponseAutoGenerated(_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.). 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 operation: the operation associated with the notification and its value must be "scale". - Required. Default value is "Scale". - :vartype operation: str - :ivar email: the email notification. - :vartype email: ~azure.mgmt.monitor.models.EmailNotification - :ivar webhooks: the collection of webhook notifications. - :vartype webhooks: list[~azure.mgmt.monitor.models.WebhookNotification] + :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.ErrorResponseAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorAdditionalInfo] """ _validation = { - "operation": {"required": True, "constant": True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - "operation": {"key": "operation", "type": "str"}, - "email": {"key": "email", "type": "EmailNotification"}, - "webhooks": {"key": "webhooks", "type": "[WebhookNotification]"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponseAutoGenerated]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - operation = "Scale" - - def __init__( - self, - *, - email: Optional["_models.EmailNotification"] = None, - webhooks: Optional[List["_models.WebhookNotification"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword email: the email notification. - :paramtype email: ~azure.mgmt.monitor.models.EmailNotification - :keyword webhooks: the collection of webhook notifications. - :paramtype webhooks: list[~azure.mgmt.monitor.models.WebhookNotification] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.email = email - self.webhooks = webhooks + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponseAutoGenerated"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None -class AutoscaleProfile(_serialization.Model): - """Autoscale profile. +class EventHubReceiver(_serialization.Model): + """An Event hub receiver. All required parameters must be populated in order to send to server. - :ivar name: the name of the profile. Required. + :ivar name: The name of the Event hub receiver. Names must be unique across all receivers + within an action group. Required. :vartype name: str - :ivar capacity: the number of instances that can be used during this profile. Required. - :vartype capacity: ~azure.mgmt.monitor.models.ScaleCapacity - :ivar rules: the collection of rules that provide the triggers and parameters for the scaling - action. A maximum of 10 rules can be specified. Required. - :vartype rules: list[~azure.mgmt.monitor.models.ScaleRule] - :ivar fixed_date: the specific date-time for the profile. This element is not used if the - Recurrence element is used. - :vartype fixed_date: ~azure.mgmt.monitor.models.TimeWindow - :ivar recurrence: the repeating times at which this profile begins. This element is not used if - the FixedDate element is used. - :vartype recurrence: ~azure.mgmt.monitor.models.Recurrence + :ivar event_hub_name_space: The Event Hub namespace. Required. + :vartype event_hub_name_space: str + :ivar event_hub_name: The name of the specific Event Hub queue. Required. + :vartype event_hub_name: str + :ivar use_common_alert_schema: Indicates whether to use common alert schema. + :vartype use_common_alert_schema: bool + :ivar tenant_id: The tenant Id for the subscription containing this event hub. + :vartype tenant_id: str + :ivar subscription_id: The Id for the subscription containing this event hub. Required. + :vartype subscription_id: str + :ivar managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :vartype managed_identity: str """ _validation = { "name": {"required": True}, - "capacity": {"required": True}, - "rules": {"required": True}, + "event_hub_name_space": {"required": True}, + "event_hub_name": {"required": True}, + "subscription_id": {"required": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, - "capacity": {"key": "capacity", "type": "ScaleCapacity"}, - "rules": {"key": "rules", "type": "[ScaleRule]"}, - "fixed_date": {"key": "fixedDate", "type": "TimeWindow"}, - "recurrence": {"key": "recurrence", "type": "Recurrence"}, + "event_hub_name_space": {"key": "eventHubNameSpace", "type": "str"}, + "event_hub_name": {"key": "eventHubName", "type": "str"}, + "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + "managed_identity": {"key": "managedIdentity", "type": "str"}, } def __init__( self, *, name: str, - capacity: "_models.ScaleCapacity", - rules: List["_models.ScaleRule"], - fixed_date: Optional["_models.TimeWindow"] = None, - recurrence: Optional["_models.Recurrence"] = None, + event_hub_name_space: str, + event_hub_name: str, + subscription_id: str, + use_common_alert_schema: bool = False, + tenant_id: Optional[str] = None, + managed_identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: the name of the profile. Required. + :keyword name: The name of the Event hub receiver. Names must be unique across all receivers + within an action group. Required. :paramtype name: str - :keyword capacity: the number of instances that can be used during this profile. Required. - :paramtype capacity: ~azure.mgmt.monitor.models.ScaleCapacity - :keyword rules: the collection of rules that provide the triggers and parameters for the - scaling action. A maximum of 10 rules can be specified. Required. - :paramtype rules: list[~azure.mgmt.monitor.models.ScaleRule] - :keyword fixed_date: the specific date-time for the profile. This element is not used if the - Recurrence element is used. - :paramtype fixed_date: ~azure.mgmt.monitor.models.TimeWindow - :keyword recurrence: the repeating times at which this profile begins. This element is not used - if the FixedDate element is used. - :paramtype recurrence: ~azure.mgmt.monitor.models.Recurrence + :keyword event_hub_name_space: The Event Hub namespace. Required. + :paramtype event_hub_name_space: str + :keyword event_hub_name: The name of the specific Event Hub queue. Required. + :paramtype event_hub_name: str + :keyword use_common_alert_schema: Indicates whether to use common alert schema. + :paramtype use_common_alert_schema: bool + :keyword tenant_id: The tenant Id for the subscription containing this event hub. + :paramtype tenant_id: str + :keyword subscription_id: The Id for the subscription containing this event hub. Required. + :paramtype subscription_id: str + :keyword managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :paramtype managed_identity: str """ super().__init__(**kwargs) self.name = name - self.capacity = capacity - self.rules = rules - self.fixed_date = fixed_date - self.recurrence = recurrence + self.event_hub_name_space = event_hub_name_space + self.event_hub_name = event_hub_name + self.use_common_alert_schema = use_common_alert_schema + self.tenant_id = tenant_id + self.subscription_id = subscription_id + self.managed_identity = managed_identity -class ResourceAutoGenerated(_serialization.Model): - """The autoscale setting resource. +class Identity(_serialization.Model): + """Identity for 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Gets or sets a list of key value pairs that describe the resource. These tags can - be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags - can be provided for a resource. Each tag must have a key no greater in length than 128 - characters and a value no greater in length than 256 characters. - :vartype tags: dict[str, str] - :ivar system_data: The system metadata related to the response. - :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: Type of managed service identity. Required. Known values are: "SystemAssigned", + "UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.monitor.models.IdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.monitor.models.UserIdentityProperties] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentityProperties}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + type: Union[str, "_models.IdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserIdentityProperties"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Gets or sets a list of key value pairs that describe the resource. These tags - can be used in viewing and grouping this resource (across resource groups). A maximum of 15 - tags can be provided for a resource. Each tag must have a key no greater in length than 128 - characters and a value no greater in length than 256 characters. - :paramtype tags: dict[str, str] + :keyword type: Type of managed service identity. Required. Known values are: "SystemAssigned", + "UserAssigned", and "None". + :paramtype type: str or ~azure.mgmt.monitor.models.IdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.monitor.models.UserIdentityProperties] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities -class AutoscaleSettingResource(ResourceAutoGenerated): - """The autoscale setting resource. - Variables are only populated by the server, and will be ignored when sending a request. +class IncidentReceiver(_serialization.Model): + """An Incident receiver. All required parameters must be populated in order to send to server. - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the Incident receiver. Names must be unique across all receivers within + an action group. Required. :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Gets or sets a list of key value pairs that describe the resource. These tags can - be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags - can be provided for a resource. Each tag must have a key no greater in length than 128 - characters and a value no greater in length than 256 characters. - :vartype tags: dict[str, str] - :ivar system_data: The system metadata related to the response. - :vartype system_data: ~azure.mgmt.monitor.models.SystemData - :ivar profiles: the collection of automatic scaling profiles that specify different scaling - parameters for different time periods. A maximum of 20 profiles can be specified. Required. - :vartype profiles: list[~azure.mgmt.monitor.models.AutoscaleProfile] - :ivar notifications: the collection of notifications. - :vartype notifications: list[~azure.mgmt.monitor.models.AutoscaleNotification] - :ivar enabled: the enabled flag. Specifies whether automatic scaling is enabled for the - resource. The default value is 'false'. - :vartype enabled: bool - :ivar predictive_autoscale_policy: the predictive autoscale policy mode. - :vartype predictive_autoscale_policy: ~azure.mgmt.monitor.models.PredictiveAutoscalePolicy - :ivar name_properties_name: the name of the autoscale setting. - :vartype name_properties_name: str - :ivar target_resource_uri: the resource identifier of the resource that the autoscale setting - should be added to. - :vartype target_resource_uri: str - :ivar target_resource_location: the location of the resource that the autoscale setting should - be added to. - :vartype target_resource_location: str + :ivar connection: The incident service connection. Required. + :vartype connection: ~azure.mgmt.monitor.models.IncidentServiceConnection + :ivar incident_management_service: The incident management service type. Required. "Icm" + :vartype incident_management_service: str or + ~azure.mgmt.monitor.models.IncidentManagementService + :ivar mappings: Field mappings for the incident service. Required. + :vartype mappings: dict[str, str] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "profiles": {"required": True, "max_items": 20, "min_items": 0}, + "name": {"required": True}, + "connection": {"required": True}, + "incident_management_service": {"required": True}, + "mappings": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "profiles": {"key": "properties.profiles", "type": "[AutoscaleProfile]"}, - "notifications": {"key": "properties.notifications", "type": "[AutoscaleNotification]"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "predictive_autoscale_policy": { - "key": "properties.predictiveAutoscalePolicy", - "type": "PredictiveAutoscalePolicy", - }, - "name_properties_name": {"key": "properties.name", "type": "str"}, - "target_resource_uri": {"key": "properties.targetResourceUri", "type": "str"}, - "target_resource_location": {"key": "properties.targetResourceLocation", "type": "str"}, + "connection": {"key": "connection", "type": "IncidentServiceConnection"}, + "incident_management_service": {"key": "incidentManagementService", "type": "str"}, + "mappings": {"key": "mappings", "type": "{str}"}, } def __init__( self, *, - location: str, - profiles: List["_models.AutoscaleProfile"], - tags: Optional[Dict[str, str]] = None, - notifications: Optional[List["_models.AutoscaleNotification"]] = None, - enabled: bool = False, - predictive_autoscale_policy: Optional["_models.PredictiveAutoscalePolicy"] = None, - name_properties_name: Optional[str] = None, - target_resource_uri: Optional[str] = None, - target_resource_location: Optional[str] = None, + name: str, + connection: "_models.IncidentServiceConnection", + incident_management_service: Union[str, "_models.IncidentManagementService"], + mappings: Dict[str, str], **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Gets or sets a list of key value pairs that describe the resource. These tags - can be used in viewing and grouping this resource (across resource groups). A maximum of 15 - tags can be provided for a resource. Each tag must have a key no greater in length than 128 - characters and a value no greater in length than 256 characters. - :paramtype tags: dict[str, str] - :keyword profiles: the collection of automatic scaling profiles that specify different scaling - parameters for different time periods. A maximum of 20 profiles can be specified. Required. - :paramtype profiles: list[~azure.mgmt.monitor.models.AutoscaleProfile] - :keyword notifications: the collection of notifications. - :paramtype notifications: list[~azure.mgmt.monitor.models.AutoscaleNotification] - :keyword enabled: the enabled flag. Specifies whether automatic scaling is enabled for the - resource. The default value is 'false'. - :paramtype enabled: bool - :keyword predictive_autoscale_policy: the predictive autoscale policy mode. - :paramtype predictive_autoscale_policy: ~azure.mgmt.monitor.models.PredictiveAutoscalePolicy - :keyword name_properties_name: the name of the autoscale setting. - :paramtype name_properties_name: str - :keyword target_resource_uri: the resource identifier of the resource that the autoscale - setting should be added to. - :paramtype target_resource_uri: str - :keyword target_resource_location: the location of the resource that the autoscale setting - should be added to. - :paramtype target_resource_location: str + :keyword name: The name of the Incident receiver. Names must be unique across all receivers + within an action group. Required. + :paramtype name: str + :keyword connection: The incident service connection. Required. + :paramtype connection: ~azure.mgmt.monitor.models.IncidentServiceConnection + :keyword incident_management_service: The incident management service type. Required. "Icm" + :paramtype incident_management_service: str or + ~azure.mgmt.monitor.models.IncidentManagementService + :keyword mappings: Field mappings for the incident service. Required. + :paramtype mappings: dict[str, str] """ - super().__init__(location=location, tags=tags, **kwargs) - self.profiles = profiles - self.notifications = notifications - self.enabled = enabled - self.predictive_autoscale_policy = predictive_autoscale_policy - self.name_properties_name = name_properties_name - self.target_resource_uri = target_resource_uri - self.target_resource_location = target_resource_location + super().__init__(**kwargs) + self.name = name + self.connection = connection + self.incident_management_service = incident_management_service + self.mappings = mappings -class AutoscaleSettingResourceCollection(_serialization.Model): - """Represents a collection of autoscale setting resources. +class IncidentServiceConnection(_serialization.Model): + """The connection info for Incident Receiver. All required parameters must be populated in order to send to server. - :ivar value: the values for the autoscale setting resources. Required. - :vartype value: list[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :ivar next_link: URL to get the next set of results. - :vartype next_link: str + :ivar name: The name of the connection. Required. + :vartype name: str + :ivar id: GUID value representing the connection ID for the incident management service. + Required. + :vartype id: str """ _validation = { - "value": {"required": True}, + "name": {"required": True}, + "id": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[AutoscaleSettingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, *, value: List["_models.AutoscaleSettingResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, name: str, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword value: the values for the autoscale setting resources. Required. - :paramtype value: list[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :keyword next_link: URL to get the next set of results. - :paramtype next_link: str + :keyword name: The name of the connection. Required. + :paramtype name: str + :keyword id: GUID value representing the connection ID for the incident management service. + Required. + :paramtype id: str """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.name = name + self.id = id -class AutoscaleSettingResourcePatch(_serialization.Model): - """The autoscale setting object for patch operations. +class ItsmReceiver(_serialization.Model): + """An Itsm receiver. + + All required parameters must be populated in order to send to server. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar profiles: the collection of automatic scaling profiles that specify different scaling - parameters for different time periods. A maximum of 20 profiles can be specified. - :vartype profiles: list[~azure.mgmt.monitor.models.AutoscaleProfile] - :ivar notifications: the collection of notifications. - :vartype notifications: list[~azure.mgmt.monitor.models.AutoscaleNotification] - :ivar enabled: the enabled flag. Specifies whether automatic scaling is enabled for the - resource. The default value is 'false'. - :vartype enabled: bool - :ivar predictive_autoscale_policy: the predictive autoscale policy mode. - :vartype predictive_autoscale_policy: ~azure.mgmt.monitor.models.PredictiveAutoscalePolicy - :ivar name: the name of the autoscale setting. + :ivar name: The name of the Itsm receiver. Names must be unique across all receivers within an + action group. Required. :vartype name: str - :ivar target_resource_uri: the resource identifier of the resource that the autoscale setting - should be added to. - :vartype target_resource_uri: str - :ivar target_resource_location: the location of the resource that the autoscale setting should - be added to. - :vartype target_resource_location: str + :ivar workspace_id: OMS LA instance identifier. Required. + :vartype workspace_id: str + :ivar connection_id: Unique identification of ITSM connection among multiple defined in above + workspace. Required. + :vartype connection_id: str + :ivar ticket_configuration: JSON blob for the configurations of the ITSM action. + CreateMultipleWorkItems option will be part of this blob as well. Required. + :vartype ticket_configuration: str + :ivar region: Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + Required. + :vartype region: str """ _validation = { - "profiles": {"max_items": 20, "min_items": 0}, + "name": {"required": True}, + "workspace_id": {"required": True}, + "connection_id": {"required": True}, + "ticket_configuration": {"required": True}, + "region": {"required": True}, } _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "profiles": {"key": "properties.profiles", "type": "[AutoscaleProfile]"}, - "notifications": {"key": "properties.notifications", "type": "[AutoscaleNotification]"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "predictive_autoscale_policy": { - "key": "properties.predictiveAutoscalePolicy", - "type": "PredictiveAutoscalePolicy", - }, - "name": {"key": "properties.name", "type": "str"}, - "target_resource_uri": {"key": "properties.targetResourceUri", "type": "str"}, - "target_resource_location": {"key": "properties.targetResourceLocation", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "workspace_id": {"key": "workspaceId", "type": "str"}, + "connection_id": {"key": "connectionId", "type": "str"}, + "ticket_configuration": {"key": "ticketConfiguration", "type": "str"}, + "region": {"key": "region", "type": "str"}, } def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - profiles: Optional[List["_models.AutoscaleProfile"]] = None, - notifications: Optional[List["_models.AutoscaleNotification"]] = None, - enabled: bool = False, - predictive_autoscale_policy: Optional["_models.PredictiveAutoscalePolicy"] = None, - name: Optional[str] = None, - target_resource_uri: Optional[str] = None, - target_resource_location: Optional[str] = None, - **kwargs: Any + self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword profiles: the collection of automatic scaling profiles that specify different scaling - parameters for different time periods. A maximum of 20 profiles can be specified. - :paramtype profiles: list[~azure.mgmt.monitor.models.AutoscaleProfile] - :keyword notifications: the collection of notifications. - :paramtype notifications: list[~azure.mgmt.monitor.models.AutoscaleNotification] - :keyword enabled: the enabled flag. Specifies whether automatic scaling is enabled for the - resource. The default value is 'false'. - :paramtype enabled: bool - :keyword predictive_autoscale_policy: the predictive autoscale policy mode. - :paramtype predictive_autoscale_policy: ~azure.mgmt.monitor.models.PredictiveAutoscalePolicy - :keyword name: the name of the autoscale setting. + :keyword name: The name of the Itsm receiver. Names must be unique across all receivers within + an action group. Required. :paramtype name: str - :keyword target_resource_uri: the resource identifier of the resource that the autoscale - setting should be added to. - :paramtype target_resource_uri: str - :keyword target_resource_location: the location of the resource that the autoscale setting - should be added to. - :paramtype target_resource_location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.profiles = profiles - self.notifications = notifications - self.enabled = enabled - self.predictive_autoscale_policy = predictive_autoscale_policy - self.name = name - self.target_resource_uri = target_resource_uri - self.target_resource_location = target_resource_location - - -class AzNsActionGroup(_serialization.Model): - """Azure action group. - - :ivar action_group: Azure Action Group reference. - :vartype action_group: list[str] - :ivar email_subject: Custom subject override for all email ids in Azure action group. - :vartype email_subject: str - :ivar custom_webhook_payload: Custom payload to be sent for all webhook URI in Azure action - group. - :vartype custom_webhook_payload: str - """ - - _attribute_map = { - "action_group": {"key": "actionGroup", "type": "[str]"}, - "email_subject": {"key": "emailSubject", "type": "str"}, - "custom_webhook_payload": {"key": "customWebhookPayload", "type": "str"}, - } - - def __init__( - self, - *, - action_group: Optional[List[str]] = None, - email_subject: Optional[str] = None, - custom_webhook_payload: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword action_group: Azure Action Group reference. - :paramtype action_group: list[str] - :keyword email_subject: Custom subject override for all email ids in Azure action group. - :paramtype email_subject: str - :keyword custom_webhook_payload: Custom payload to be sent for all webhook URI in Azure action - group. - :paramtype custom_webhook_payload: str - """ - super().__init__(**kwargs) - self.action_group = action_group - self.email_subject = email_subject - self.custom_webhook_payload = custom_webhook_payload - - -class AzureAppPushReceiver(_serialization.Model): - """The Azure mobile App push notification receiver. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the Azure mobile app push receiver. Names must be unique across all - receivers within an action group. Required. - :vartype name: str - :ivar email_address: The email address registered for the Azure mobile app. Required. - :vartype email_address: str - """ - - _validation = { - "name": {"required": True}, - "email_address": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "email_address": {"key": "emailAddress", "type": "str"}, - } - - def __init__(self, *, name: str, email_address: str, **kwargs: Any) -> None: - """ - :keyword name: The name of the Azure mobile app push receiver. Names must be unique across all - receivers within an action group. Required. - :paramtype name: str - :keyword email_address: The email address registered for the Azure mobile app. Required. - :paramtype email_address: str + :keyword workspace_id: OMS LA instance identifier. Required. + :paramtype workspace_id: str + :keyword connection_id: Unique identification of ITSM connection among multiple defined in + above workspace. Required. + :paramtype connection_id: str + :keyword ticket_configuration: JSON blob for the configurations of the ITSM action. + CreateMultipleWorkItems option will be part of this blob as well. Required. + :paramtype ticket_configuration: str + :keyword region: Region in which workspace resides. Supported + values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + Required. + :paramtype region: str """ super().__init__(**kwargs) self.name = name - self.email_address = email_address + self.workspace_id = workspace_id + self.connection_id = connection_id + self.ticket_configuration = ticket_configuration + self.region = region -class AzureFunctionReceiver(_serialization.Model): - """An azure function receiver. +class LogicAppReceiver(_serialization.Model): + """A logic app receiver. All required parameters must be populated in order to send to server. - :ivar name: The name of the azure function receiver. Names must be unique across all receivers + :ivar name: The name of the logic app receiver. Names must be unique across all receivers within an action group. Required. :vartype name: str - :ivar function_app_resource_id: The azure resource id of the function app. Required. - :vartype function_app_resource_id: str - :ivar function_name: The function name in the function app. Required. - :vartype function_name: str - :ivar http_trigger_url: The http trigger url where http request sent to. Required. - :vartype http_trigger_url: str + :ivar resource_id: The azure resource id of the logic app receiver. Required. + :vartype resource_id: str + :ivar callback_url: The callback url where http request sent to. Required. + :vartype callback_url: str :ivar use_common_alert_schema: Indicates whether to use common alert schema. :vartype use_common_alert_schema: bool + :ivar managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :vartype managed_identity: str """ _validation = { "name": {"required": True}, - "function_app_resource_id": {"required": True}, - "function_name": {"required": True}, - "http_trigger_url": {"required": True}, + "resource_id": {"required": True}, + "callback_url": {"required": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, - "function_app_resource_id": {"key": "functionAppResourceId", "type": "str"}, - "function_name": {"key": "functionName", "type": "str"}, - "http_trigger_url": {"key": "httpTriggerUrl", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "callback_url": {"key": "callbackUrl", "type": "str"}, "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, + "managed_identity": {"key": "managedIdentity", "type": "str"}, } def __init__( self, *, name: str, - function_app_resource_id: str, - function_name: str, - http_trigger_url: str, + resource_id: str, + callback_url: str, use_common_alert_schema: bool = False, + managed_identity: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: The name of the azure function receiver. Names must be unique across all - receivers within an action group. Required. + :keyword name: The name of the logic app receiver. Names must be unique across all receivers + within an action group. Required. :paramtype name: str - :keyword function_app_resource_id: The azure resource id of the function app. Required. - :paramtype function_app_resource_id: str - :keyword function_name: The function name in the function app. Required. - :paramtype function_name: str - :keyword http_trigger_url: The http trigger url where http request sent to. Required. - :paramtype http_trigger_url: str + :keyword resource_id: The azure resource id of the logic app receiver. Required. + :paramtype resource_id: str + :keyword callback_url: The callback url where http request sent to. Required. + :paramtype callback_url: str :keyword use_common_alert_schema: Indicates whether to use common alert schema. :paramtype use_common_alert_schema: bool + :keyword managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :paramtype managed_identity: str """ super().__init__(**kwargs) self.name = name - self.function_app_resource_id = function_app_resource_id - self.function_name = function_name - self.http_trigger_url = http_trigger_url + self.resource_id = resource_id + self.callback_url = callback_url self.use_common_alert_schema = use_common_alert_schema + self.managed_identity = managed_identity -class PrivateLinkScopesResource(_serialization.Model): - """An azure resource object. +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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + :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.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class AzureMonitorPrivateLinkScope(PrivateLinkScopesResource): - """An Azure Monitor PrivateLinkScope definition. - - 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar provisioning_state: Current state of this PrivateLinkScope: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - :vartype provisioning_state: str - :ivar private_endpoint_connections: List of private endpoint connections. - :vartype private_endpoint_connections: - list[~azure.mgmt.monitor.models.PrivateEndpointConnection] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnection]", - }, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.private_endpoint_connections = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities -class AzureMonitorPrivateLinkScopeListResult(_serialization.Model): - """Describes the list of Azure Monitor PrivateLinkScope resources. +class NotificationRequestBody(_serialization.Model): + """The request body which contain contact detail metadata. All required parameters must be populated in order to send to server. - :ivar value: List of Azure Monitor PrivateLinkScope definitions. Required. - :vartype value: list[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :ivar next_link: The URI to get the next set of Azure Monitor PrivateLinkScope definitions if - too many PrivateLinkScopes where returned in the result set. - :vartype next_link: str + :ivar alert_type: The value of the supported alert type. Supported alert type values are: + servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, + webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, + actualcostbudget, forecastedbudget. Required. + :vartype alert_type: str + :ivar email_receivers: The list of email receivers that are part of this action group. + :vartype email_receivers: list[~azure.mgmt.monitor.models.EmailReceiver] + :ivar sms_receivers: The list of SMS receivers that are part of this action group. + :vartype sms_receivers: list[~azure.mgmt.monitor.models.SmsReceiver] + :ivar webhook_receivers: The list of webhook receivers that are part of this action group. + :vartype webhook_receivers: list[~azure.mgmt.monitor.models.WebhookReceiver] + :ivar itsm_receivers: The list of ITSM receivers that are part of this action group. + :vartype itsm_receivers: list[~azure.mgmt.monitor.models.ItsmReceiver] + :ivar azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action + group. + :vartype azure_app_push_receivers: list[~azure.mgmt.monitor.models.AzureAppPushReceiver] + :ivar automation_runbook_receivers: The list of AutomationRunbook receivers that are part of + this action group. + :vartype automation_runbook_receivers: + list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] + :ivar voice_receivers: The list of voice receivers that are part of this action group. + :vartype voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] + :ivar logic_app_receivers: The list of logic app receivers that are part of this action group. + :vartype logic_app_receivers: list[~azure.mgmt.monitor.models.LogicAppReceiver] + :ivar azure_function_receivers: The list of azure function receivers that are part of this + action group. + :vartype azure_function_receivers: list[~azure.mgmt.monitor.models.AzureFunctionReceiver] + :ivar arm_role_receivers: The list of ARM role receivers that are part of this action group. + Roles are Azure RBAC roles and only built-in roles are supported. + :vartype arm_role_receivers: list[~azure.mgmt.monitor.models.ArmRoleReceiver] + :ivar event_hub_receivers: The list of event hub receivers that are part of this action group. + :vartype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] + :ivar incident_receivers: The list of incident receivers that are part of this action group. + :vartype incident_receivers: list[~azure.mgmt.monitor.models.IncidentReceiver] """ _validation = { - "value": {"required": True}, + "alert_type": {"required": True, "max_length": 30}, } _attribute_map = { - "value": {"key": "value", "type": "[AzureMonitorPrivateLinkScope]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "alert_type": {"key": "alertType", "type": "str"}, + "email_receivers": {"key": "emailReceivers", "type": "[EmailReceiver]"}, + "sms_receivers": {"key": "smsReceivers", "type": "[SmsReceiver]"}, + "webhook_receivers": {"key": "webhookReceivers", "type": "[WebhookReceiver]"}, + "itsm_receivers": {"key": "itsmReceivers", "type": "[ItsmReceiver]"}, + "azure_app_push_receivers": {"key": "azureAppPushReceivers", "type": "[AzureAppPushReceiver]"}, + "automation_runbook_receivers": {"key": "automationRunbookReceivers", "type": "[AutomationRunbookReceiver]"}, + "voice_receivers": {"key": "voiceReceivers", "type": "[VoiceReceiver]"}, + "logic_app_receivers": {"key": "logicAppReceivers", "type": "[LogicAppReceiver]"}, + "azure_function_receivers": {"key": "azureFunctionReceivers", "type": "[AzureFunctionReceiver]"}, + "arm_role_receivers": {"key": "armRoleReceivers", "type": "[ArmRoleReceiver]"}, + "event_hub_receivers": {"key": "eventHubReceivers", "type": "[EventHubReceiver]"}, + "incident_receivers": {"key": "incidentReceivers", "type": "[IncidentReceiver]"}, } def __init__( - self, *, value: List["_models.AzureMonitorPrivateLinkScope"], next_link: Optional[str] = None, **kwargs: Any + self, + *, + alert_type: str, + email_receivers: Optional[List["_models.EmailReceiver"]] = None, + sms_receivers: Optional[List["_models.SmsReceiver"]] = None, + webhook_receivers: Optional[List["_models.WebhookReceiver"]] = None, + itsm_receivers: Optional[List["_models.ItsmReceiver"]] = None, + azure_app_push_receivers: Optional[List["_models.AzureAppPushReceiver"]] = None, + automation_runbook_receivers: Optional[List["_models.AutomationRunbookReceiver"]] = None, + voice_receivers: Optional[List["_models.VoiceReceiver"]] = None, + logic_app_receivers: Optional[List["_models.LogicAppReceiver"]] = None, + azure_function_receivers: Optional[List["_models.AzureFunctionReceiver"]] = None, + arm_role_receivers: Optional[List["_models.ArmRoleReceiver"]] = None, + event_hub_receivers: Optional[List["_models.EventHubReceiver"]] = None, + incident_receivers: Optional[List["_models.IncidentReceiver"]] = None, + **kwargs: Any ) -> None: """ - :keyword value: List of Azure Monitor PrivateLinkScope definitions. Required. - :paramtype value: list[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :keyword next_link: The URI to get the next set of Azure Monitor PrivateLinkScope definitions - if too many PrivateLinkScopes where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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 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 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 workspace: Log Analytics workspace information. Required. - :vartype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo - """ - - _validation = { - "workspace": {"required": True}, - } - - _attribute_map = { - "workspace": {"key": "workspace", "type": "WorkspaceInfo"}, - } - - def __init__(self, *, workspace: "_models.WorkspaceInfo", **kwargs: Any) -> None: - """ - :keyword workspace: Log Analytics workspace information. Required. - :paramtype workspace: ~azure.mgmt.monitor.models.WorkspaceInfo - """ - super().__init__(**kwargs) - self.workspace = workspace - - -class DataSource(_serialization.Model): - """Data source object contains configuration to collect telemetry and one or more sinks to send - that telemetry data to. - - All required parameters must be populated in order to send to server. - - :ivar kind: Datasource kind. Required. Known values are: "PerformanceCounter", "ETWProviders", - and "WindowsEventLogs". - :vartype kind: str or ~azure.mgmt.monitor.models.DataSourceKind - :ivar configuration: Required. - :vartype configuration: ~azure.mgmt.monitor.models.DataSourceConfiguration - :ivar sinks: Required. - :vartype sinks: list[~azure.mgmt.monitor.models.SinkConfiguration] - """ - - _validation = { - "kind": {"required": True}, - "configuration": {"required": True}, - "sinks": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "configuration": {"key": "configuration", "type": "DataSourceConfiguration"}, - "sinks": {"key": "sinks", "type": "[SinkConfiguration]"}, - } - - def __init__( - self, - *, - kind: Union[str, "_models.DataSourceKind"], - configuration: "_models.DataSourceConfiguration", - sinks: List["_models.SinkConfiguration"], - **kwargs: Any - ) -> None: - """ - :keyword kind: Datasource kind. Required. Known values are: "PerformanceCounter", - "ETWProviders", and "WindowsEventLogs". - :paramtype kind: str or ~azure.mgmt.monitor.models.DataSourceKind - :keyword configuration: Required. - :paramtype configuration: ~azure.mgmt.monitor.models.DataSourceConfiguration - :keyword sinks: Required. - :paramtype sinks: list[~azure.mgmt.monitor.models.SinkConfiguration] - """ - super().__init__(**kwargs) - self.kind = kind - self.configuration = configuration - self.sinks = sinks - - -class DataSourceConfiguration(_serialization.Model): - """DataSourceConfiguration. - - :ivar providers: ETW providers configuration. - :vartype providers: list[~azure.mgmt.monitor.models.EtwProviderConfiguration] - :ivar perf_counters: Performance counter configuration. - :vartype perf_counters: list[~azure.mgmt.monitor.models.PerformanceCounterConfiguration] - :ivar event_logs: Windows event logs configuration. - :vartype event_logs: list[~azure.mgmt.monitor.models.EventLogConfiguration] - """ - - _attribute_map = { - "providers": {"key": "providers", "type": "[EtwProviderConfiguration]"}, - "perf_counters": {"key": "perfCounters", "type": "[PerformanceCounterConfiguration]"}, - "event_logs": {"key": "eventLogs", "type": "[EventLogConfiguration]"}, - } - - def __init__( - self, - *, - providers: Optional[List["_models.EtwProviderConfiguration"]] = None, - perf_counters: Optional[List["_models.PerformanceCounterConfiguration"]] = None, - event_logs: Optional[List["_models.EventLogConfiguration"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword providers: ETW providers configuration. - :paramtype providers: list[~azure.mgmt.monitor.models.EtwProviderConfiguration] - :keyword perf_counters: Performance counter configuration. - :paramtype perf_counters: list[~azure.mgmt.monitor.models.PerformanceCounterConfiguration] - :keyword event_logs: Windows event logs configuration. - :paramtype event_logs: list[~azure.mgmt.monitor.models.EventLogConfiguration] - """ - super().__init__(**kwargs) - self.providers = providers - self.perf_counters = perf_counters - self.event_logs = event_logs - - -class ProxyOnlyResource(_serialization.Model): - """A proxy only azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DiagnosticSettingsCategoryResource(ProxyOnlyResource): - """The diagnostic settings category resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar category_type: The type of the diagnostic settings category. Known values are: "Metrics" - and "Logs". - :vartype category_type: str or ~azure.mgmt.monitor.models.CategoryType - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "category_type": {"key": "properties.categoryType", "type": "str"}, - } - - def __init__(self, *, category_type: Optional[Union[str, "_models.CategoryType"]] = None, **kwargs: Any) -> None: - """ - :keyword category_type: The type of the diagnostic settings category. Known values are: - "Metrics" and "Logs". - :paramtype category_type: str or ~azure.mgmt.monitor.models.CategoryType - """ - super().__init__(**kwargs) - self.category_type = category_type - - -class DiagnosticSettingsCategoryResourceCollection(_serialization.Model): # pylint: disable=name-too-long - """Represents a collection of diagnostic setting category resources. - - :ivar value: The collection of diagnostic settings category resources. - :vartype value: list[~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DiagnosticSettingsCategoryResource]"}, - } - - def __init__( - self, *, value: Optional[List["_models.DiagnosticSettingsCategoryResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection of diagnostic settings category resources. - :paramtype value: list[~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResource] - """ - super().__init__(**kwargs) - self.value = value - - -class ResourceAutoGenerated2(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class DiagnosticSettingsResource(ResourceAutoGenerated2): - """The diagnostic setting resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata related to this resource. - :vartype system_data: ~azure.mgmt.monitor.models.SystemData - :ivar storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to - maintain backwards compatibility. - :vartype service_bus_rule_id: str - :ivar event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. - :vartype event_hub_authorization_rule_id: str - :ivar event_hub_name: The name of the event hub. If none is specified, the default event hub - will be selected. - :vartype event_hub_name: str - :ivar metrics: The list of metric settings. - :vartype metrics: list[~azure.mgmt.monitor.models.MetricSettings] - :ivar logs: The list of logs settings. - :vartype logs: list[~azure.mgmt.monitor.models.LogSettings] - :ivar workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would - like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :vartype workspace_id: str - :ivar marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which you - would like to send Diagnostic Logs. - :vartype marketplace_partner_id: str - :ivar log_analytics_destination_type: A string indicating whether the export to Log Analytics - should use the default destination type, i.e. AzureDiagnostics, or use a destination type - constructed as follows: :code:``_\\ :code:``. Possible values are: Dedicated and null (null is default.). - :vartype log_analytics_destination_type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "event_hub_authorization_rule_id": {"key": "properties.eventHubAuthorizationRuleId", "type": "str"}, - "event_hub_name": {"key": "properties.eventHubName", "type": "str"}, - "metrics": {"key": "properties.metrics", "type": "[MetricSettings]"}, - "logs": {"key": "properties.logs", "type": "[LogSettings]"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, - "marketplace_partner_id": {"key": "properties.marketplacePartnerId", "type": "str"}, - "log_analytics_destination_type": {"key": "properties.logAnalyticsDestinationType", "type": "str"}, - } - - def __init__( - self, - *, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - event_hub_authorization_rule_id: Optional[str] = None, - event_hub_name: Optional[str] = None, - metrics: Optional[List["_models.MetricSettings"]] = None, - logs: Optional[List["_models.LogSettings"]] = None, - workspace_id: Optional[str] = None, - marketplace_partner_id: Optional[str] = None, - log_analytics_destination_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here - to maintain backwards compatibility. - :paramtype service_bus_rule_id: str - :keyword event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. - :paramtype event_hub_authorization_rule_id: str - :keyword event_hub_name: The name of the event hub. If none is specified, the default event hub - will be selected. - :paramtype event_hub_name: str - :keyword metrics: The list of metric settings. - :paramtype metrics: list[~azure.mgmt.monitor.models.MetricSettings] - :keyword logs: The list of logs settings. - :paramtype logs: list[~azure.mgmt.monitor.models.LogSettings] - :keyword workspace_id: The full ARM resource ID of the Log Analytics workspace to which you - would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :paramtype workspace_id: str - :keyword marketplace_partner_id: The full ARM resource ID of the Marketplace resource to which - you would like to send Diagnostic Logs. - :paramtype marketplace_partner_id: str - :keyword log_analytics_destination_type: A string indicating whether the export to Log - Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination - type constructed as follows: :code:``_\\ :code:``. Possible values are: Dedicated and null (null is default.). - :paramtype log_analytics_destination_type: str - """ - super().__init__(**kwargs) - self.system_data = None - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.event_hub_authorization_rule_id = event_hub_authorization_rule_id - self.event_hub_name = event_hub_name - self.metrics = metrics - self.logs = logs - self.workspace_id = workspace_id - self.marketplace_partner_id = marketplace_partner_id - self.log_analytics_destination_type = log_analytics_destination_type - - -class DiagnosticSettingsResourceCollection(_serialization.Model): - """Represents a collection of alert rule resources. - - :ivar value: The collection of diagnostic settings resources;. - :vartype value: list[~azure.mgmt.monitor.models.DiagnosticSettingsResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[DiagnosticSettingsResource]"}, - } - - def __init__(self, *, value: Optional[List["_models.DiagnosticSettingsResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The collection of diagnostic settings resources;. - :paramtype value: list[~azure.mgmt.monitor.models.DiagnosticSettingsResource] - """ - super().__init__(**kwargs) - self.value = value - - -class Dimension(_serialization.Model): - """Specifies the criteria for converting log to metric. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the dimension. Required. - :vartype name: str - :ivar operator: Operator for dimension values. Required. Known values are: "Equals", - "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual", and "Include". - :vartype operator: str or ~azure.mgmt.monitor.models.Operator - :ivar values: List of dimension values. Required. - :vartype values: list[str] - """ - - _validation = { - "name": {"required": True}, - "operator": {"required": True}, - "values": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "values": {"key": "values", "type": "[str]"}, - } - - def __init__( - self, *, name: str, operator: Union[str, "_models.Operator"], values: List[str], **kwargs: Any - ) -> None: - """ - :keyword name: Name of the dimension. Required. - :paramtype name: str - :keyword operator: Operator for dimension values. Required. Known values are: "Equals", - "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual", and "Include". - :paramtype operator: str or ~azure.mgmt.monitor.models.Operator - :keyword values: List of dimension values. Required. - :paramtype values: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.operator = operator - self.values = values - - -class MultiMetricCriteria(_serialization.Model): - """The types of conditions for a multi resource alert. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DynamicMetricCriteria, MetricCriteria - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar criterion_type: Specifies the type of threshold criteria. Required. Known values are: - "StaticThresholdCriterion" and "DynamicThresholdCriterion". - :vartype criterion_type: str or ~azure.mgmt.monitor.models.CriterionType - :ivar name: Name of the criteria. Required. - :vartype name: str - :ivar metric_name: Name of the metric. Required. - :vartype metric_name: str - :ivar metric_namespace: Namespace of the metric. - :vartype metric_namespace: str - :ivar time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :vartype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :ivar dimensions: List of dimension conditions. - :vartype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :ivar skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet - emitted, by causing the metric validation to be skipped. - :vartype skip_metric_validation: bool - """ - - _validation = { - "criterion_type": {"required": True}, - "name": {"required": True}, - "metric_name": {"required": True}, - "time_aggregation": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "criterion_type": {"key": "criterionType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "metric_namespace": {"key": "metricNamespace", "type": "str"}, - "time_aggregation": {"key": "timeAggregation", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "skip_metric_validation": {"key": "skipMetricValidation", "type": "bool"}, - } - - _subtype_map = { - "criterion_type": { - "DynamicThresholdCriterion": "DynamicMetricCriteria", - "StaticThresholdCriterion": "MetricCriteria", - } - } - - def __init__( - self, - *, - name: str, - metric_name: str, - time_aggregation: Union[str, "_models.AggregationTypeEnum"], - additional_properties: Optional[Dict[str, JSON]] = None, - metric_namespace: Optional[str] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - skip_metric_validation: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword name: Name of the criteria. Required. - :paramtype name: str - :keyword metric_name: Name of the metric. Required. - :paramtype metric_name: str - :keyword metric_namespace: Namespace of the metric. - :paramtype metric_namespace: str - :keyword time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :paramtype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :keyword dimensions: List of dimension conditions. - :paramtype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :keyword skip_metric_validation: Allows creating an alert rule on a custom metric that isn't - yet emitted, by causing the metric validation to be skipped. - :paramtype skip_metric_validation: bool - """ - super().__init__(**kwargs) - self.additional_properties = additional_properties - self.criterion_type: Optional[str] = None - self.name = name - self.metric_name = metric_name - self.metric_namespace = metric_namespace - self.time_aggregation = time_aggregation - self.dimensions = dimensions - self.skip_metric_validation = skip_metric_validation - - -class DynamicMetricCriteria(MultiMetricCriteria): - """Criterion for dynamic threshold. - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar criterion_type: Specifies the type of threshold criteria. Required. Known values are: - "StaticThresholdCriterion" and "DynamicThresholdCriterion". - :vartype criterion_type: str or ~azure.mgmt.monitor.models.CriterionType - :ivar name: Name of the criteria. Required. - :vartype name: str - :ivar metric_name: Name of the metric. Required. - :vartype metric_name: str - :ivar metric_namespace: Namespace of the metric. - :vartype metric_namespace: str - :ivar time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :vartype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :ivar dimensions: List of dimension conditions. - :vartype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :ivar skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet - emitted, by causing the metric validation to be skipped. - :vartype skip_metric_validation: bool - :ivar operator: The operator used to compare the metric value against the threshold. Required. - Known values are: "GreaterThan", "LessThan", and "GreaterOrLessThan". - :vartype operator: str or ~azure.mgmt.monitor.models.DynamicThresholdOperator - :ivar alert_sensitivity: The extent of deviation required to trigger an alert. This will affect - how tight the threshold is to the metric series pattern. Required. Known values are: "Low", - "Medium", and "High". - :vartype alert_sensitivity: str or ~azure.mgmt.monitor.models.DynamicThresholdSensitivity - :ivar failing_periods: The minimum number of violations required within the selected lookback - time window required to raise an alert. Required. - :vartype failing_periods: ~azure.mgmt.monitor.models.DynamicThresholdFailingPeriods - :ivar ignore_data_before: Use this option to set the date from which to start learning the - metric historical data and calculate the dynamic thresholds (in ISO8601 format). - :vartype ignore_data_before: ~datetime.datetime - """ - - _validation = { - "criterion_type": {"required": True}, - "name": {"required": True}, - "metric_name": {"required": True}, - "time_aggregation": {"required": True}, - "operator": {"required": True}, - "alert_sensitivity": {"required": True}, - "failing_periods": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "criterion_type": {"key": "criterionType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "metric_namespace": {"key": "metricNamespace", "type": "str"}, - "time_aggregation": {"key": "timeAggregation", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "skip_metric_validation": {"key": "skipMetricValidation", "type": "bool"}, - "operator": {"key": "operator", "type": "str"}, - "alert_sensitivity": {"key": "alertSensitivity", "type": "str"}, - "failing_periods": {"key": "failingPeriods", "type": "DynamicThresholdFailingPeriods"}, - "ignore_data_before": {"key": "ignoreDataBefore", "type": "iso-8601"}, - } - - def __init__( - self, - *, - name: str, - metric_name: str, - time_aggregation: Union[str, "_models.AggregationTypeEnum"], - operator: Union[str, "_models.DynamicThresholdOperator"], - alert_sensitivity: Union[str, "_models.DynamicThresholdSensitivity"], - failing_periods: "_models.DynamicThresholdFailingPeriods", - additional_properties: Optional[Dict[str, JSON]] = None, - metric_namespace: Optional[str] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - skip_metric_validation: Optional[bool] = None, - ignore_data_before: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword name: Name of the criteria. Required. - :paramtype name: str - :keyword metric_name: Name of the metric. Required. - :paramtype metric_name: str - :keyword metric_namespace: Namespace of the metric. - :paramtype metric_namespace: str - :keyword time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :paramtype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :keyword dimensions: List of dimension conditions. - :paramtype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :keyword skip_metric_validation: Allows creating an alert rule on a custom metric that isn't - yet emitted, by causing the metric validation to be skipped. - :paramtype skip_metric_validation: bool - :keyword operator: The operator used to compare the metric value against the threshold. - Required. Known values are: "GreaterThan", "LessThan", and "GreaterOrLessThan". - :paramtype operator: str or ~azure.mgmt.monitor.models.DynamicThresholdOperator - :keyword alert_sensitivity: The extent of deviation required to trigger an alert. This will - affect how tight the threshold is to the metric series pattern. Required. Known values are: - "Low", "Medium", and "High". - :paramtype alert_sensitivity: str or ~azure.mgmt.monitor.models.DynamicThresholdSensitivity - :keyword failing_periods: The minimum number of violations required within the selected - lookback time window required to raise an alert. Required. - :paramtype failing_periods: ~azure.mgmt.monitor.models.DynamicThresholdFailingPeriods - :keyword ignore_data_before: Use this option to set the date from which to start learning the - metric historical data and calculate the dynamic thresholds (in ISO8601 format). - :paramtype ignore_data_before: ~datetime.datetime - """ - super().__init__( - additional_properties=additional_properties, - name=name, - metric_name=metric_name, - metric_namespace=metric_namespace, - time_aggregation=time_aggregation, - dimensions=dimensions, - skip_metric_validation=skip_metric_validation, - **kwargs - ) - self.criterion_type: str = "DynamicThresholdCriterion" - self.operator = operator - self.alert_sensitivity = alert_sensitivity - self.failing_periods = failing_periods - self.ignore_data_before = ignore_data_before - - -class DynamicThresholdFailingPeriods(_serialization.Model): - """The minimum number of violations required within the selected lookback time window required to - raise an alert. - - All required parameters must be populated in order to send to server. - - :ivar number_of_evaluation_periods: The number of aggregated lookback points. The lookback time - window is calculated based on the aggregation granularity (windowSize) and the selected number - of aggregated points. Required. - :vartype number_of_evaluation_periods: float - :ivar min_failing_periods_to_alert: The number of violations to trigger an alert. Should be - smaller or equal to numberOfEvaluationPeriods. Required. - :vartype min_failing_periods_to_alert: float - """ - - _validation = { - "number_of_evaluation_periods": {"required": True}, - "min_failing_periods_to_alert": {"required": True}, - } - - _attribute_map = { - "number_of_evaluation_periods": {"key": "numberOfEvaluationPeriods", "type": "float"}, - "min_failing_periods_to_alert": {"key": "minFailingPeriodsToAlert", "type": "float"}, - } - - def __init__( - self, *, number_of_evaluation_periods: float, min_failing_periods_to_alert: float, **kwargs: Any - ) -> None: - """ - :keyword number_of_evaluation_periods: The number of aggregated lookback points. The lookback - time window is calculated based on the aggregation granularity (windowSize) and the selected - number of aggregated points. Required. - :paramtype number_of_evaluation_periods: float - :keyword min_failing_periods_to_alert: The number of violations to trigger an alert. Should be - smaller or equal to numberOfEvaluationPeriods. Required. - :paramtype min_failing_periods_to_alert: float - """ - super().__init__(**kwargs) - self.number_of_evaluation_periods = number_of_evaluation_periods - self.min_failing_periods_to_alert = min_failing_periods_to_alert - - -class EmailNotification(_serialization.Model): - """Email notification of an autoscale event. - - :ivar send_to_subscription_administrator: a value indicating whether to send email to - subscription administrator. - :vartype send_to_subscription_administrator: bool - :ivar send_to_subscription_co_administrators: a value indicating whether to send email to - subscription co-administrators. - :vartype send_to_subscription_co_administrators: bool - :ivar custom_emails: the custom e-mails list. This value can be null or empty, in which case - this attribute will be ignored. - :vartype custom_emails: list[str] - """ - - _attribute_map = { - "send_to_subscription_administrator": {"key": "sendToSubscriptionAdministrator", "type": "bool"}, - "send_to_subscription_co_administrators": {"key": "sendToSubscriptionCoAdministrators", "type": "bool"}, - "custom_emails": {"key": "customEmails", "type": "[str]"}, - } - - def __init__( - self, - *, - send_to_subscription_administrator: bool = False, - send_to_subscription_co_administrators: bool = False, - custom_emails: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword send_to_subscription_administrator: a value indicating whether to send email to - subscription administrator. - :paramtype send_to_subscription_administrator: bool - :keyword send_to_subscription_co_administrators: a value indicating whether to send email to - subscription co-administrators. - :paramtype send_to_subscription_co_administrators: bool - :keyword custom_emails: the custom e-mails list. This value can be null or empty, in which case - this attribute will be ignored. - :paramtype custom_emails: list[str] - """ - super().__init__(**kwargs) - self.send_to_subscription_administrator = send_to_subscription_administrator - self.send_to_subscription_co_administrators = send_to_subscription_co_administrators - self.custom_emails = custom_emails - - -class EmailReceiver(_serialization.Model): - """An email receiver. - - 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 name: The name of the email receiver. Names must be unique across all receivers within an - action group. Required. - :vartype name: str - :ivar email_address: The email address of this receiver. Required. - :vartype email_address: str - :ivar use_common_alert_schema: Indicates whether to use common alert schema. - :vartype use_common_alert_schema: bool - :ivar status: The receiver status of the e-mail. Known values are: "NotSpecified", "Enabled", - and "Disabled". - :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus - """ - - _validation = { - "name": {"required": True}, - "email_address": {"required": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "email_address": {"key": "emailAddress", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, name: str, email_address: str, use_common_alert_schema: bool = False, **kwargs: Any) -> None: - """ - :keyword name: The name of the email receiver. Names must be unique across all receivers within - an action group. Required. - :paramtype name: str - :keyword email_address: The email address of this receiver. Required. - :paramtype email_address: str - :keyword use_common_alert_schema: Indicates whether to use common alert schema. - :paramtype use_common_alert_schema: bool - """ - super().__init__(**kwargs) - self.name = name - self.email_address = email_address - self.use_common_alert_schema = use_common_alert_schema - self.status = None - - -class EnableRequest(_serialization.Model): - """Describes a receiver that should be resubscribed. - - All required parameters must be populated in order to send to server. - - :ivar receiver_name: The name of the receiver to resubscribe. Required. - :vartype receiver_name: str - """ - - _validation = { - "receiver_name": {"required": True}, - } - - _attribute_map = { - "receiver_name": {"key": "receiverName", "type": "str"}, - } - - def __init__(self, *, receiver_name: str, **kwargs: Any) -> None: - """ - :keyword receiver_name: The name of the receiver to resubscribe. Required. - :paramtype receiver_name: str - """ - super().__init__(**kwargs) - self.receiver_name = receiver_name - - -class Error(_serialization.Model): - """Error details. - - All required parameters must be populated in order to send to server. - - :ivar code: Error code identifying the specific error. Required. - :vartype code: str - :ivar message: Error message in the caller's locale. - :vartype message: str - """ - - _validation = { - "code": {"required": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: str, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code identifying the specific error. Required. - :paramtype code: str - :keyword message: Error message in the caller's locale. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorContract(_serialization.Model): - """Describes the format of Error response. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.monitor.models.ErrorResponse - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponse"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.monitor.models.ErrorResponse - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorDetail(_serialization.Model): - """Describes details of an error response. - - :ivar code: Unlocalized string which can be used to programmatically identify the error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar additional_info: An array of objects with 'type' and 'info' properties. The schema of - 'info' is service-specific and dependent on the 'type' string. - :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorDetailAdditionalInfoItem] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorDetailAdditionalInfoItem]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - additional_info: Optional[List["_models.ErrorDetailAdditionalInfoItem"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Unlocalized string which can be used to programmatically identify the error. - :paramtype code: str - :keyword message: Describes the error in detail and provides debugging information. - :paramtype message: str - :keyword target: The target of the particular error (for example, the name of the property in - error). - :paramtype target: str - :keyword additional_info: An array of objects with 'type' and 'info' properties. The schema of - 'info' is service-specific and dependent on the 'type' string. - :paramtype additional_info: list[~azure.mgmt.monitor.models.ErrorDetailAdditionalInfoItem] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.additional_info = additional_info - - -class ErrorDetailAdditionalInfoItem(_serialization.Model): - """ErrorDetailAdditionalInfoItem. - - :ivar type: The type of additional information. - :vartype type: str - :ivar info: The additional information specific to the type. - :vartype info: dict[str, any] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "{object}"}, - } - - def __init__(self, *, type: Optional[str] = None, info: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: - """ - :keyword type: The type of additional information. - :paramtype type: str - :keyword info: The additional information specific to the type. - :paramtype info: dict[str, any] - """ - super().__init__(**kwargs) - self.type = type - self.info = info - - -class ErrorResponse(_serialization.Model): - """Describes the format of Error response. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class ErrorResponseAutoGenerated(_serialization.Model): - """Describes the format of Error response. - - :ivar error: - :vartype error: ~azure.mgmt.monitor.models.ErrorResponseError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: - """ - :keyword error: - :paramtype error: ~azure.mgmt.monitor.models.ErrorResponseError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseAutoGenerated2(_serialization.Model): - """Describes the format of Error response. - - :ivar error: - :vartype error: ~azure.mgmt.monitor.models.ErrorResponseError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseError"] = None, **kwargs: Any) -> None: - """ - :keyword error: - :paramtype error: ~azure.mgmt.monitor.models.ErrorResponseError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseCommon(ErrorResponse): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.monitor.models.ErrorResponseCommon] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorAdditionalInfo] - """ - - _validation = { - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorResponseCommon]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super().__init__(code=code, message=message, **kwargs) - self.details = None - self.additional_info = None - - -class ErrorResponseError(_serialization.Model): - """ErrorResponseError. - - :ivar code: Unlocalized string which can be used to programmatically identify the error. - :vartype code: str - :ivar message: Describes the error in detail and provides debugging information. If - Accept-Language is set in the request, it must be localized to that language. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: An array of additional nested error response info objects, as described by this - contract. - :vartype details: list[~azure.mgmt.monitor.models.ErrorDetail] - :ivar additional_info: An array of objects with 'type' and 'info' properties. The schema of - 'info' is service-specific and dependent on the 'type' string. - :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorResponseErrorAdditionalInfoItem] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorResponseErrorAdditionalInfoItem]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.ErrorDetail"]] = None, - additional_info: Optional[List["_models.ErrorResponseErrorAdditionalInfoItem"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Unlocalized string which can be used to programmatically identify the error. - :paramtype code: str - :keyword message: Describes the error in detail and provides debugging information. If - Accept-Language is set in the request, it must be localized to that language. - :paramtype message: str - :keyword target: The target of the particular error (for example, the name of the property in - error). - :paramtype target: str - :keyword details: An array of additional nested error response info objects, as described by - this contract. - :paramtype details: list[~azure.mgmt.monitor.models.ErrorDetail] - :keyword additional_info: An array of objects with 'type' and 'info' properties. The schema of - 'info' is service-specific and dependent on the 'type' string. - :paramtype additional_info: - list[~azure.mgmt.monitor.models.ErrorResponseErrorAdditionalInfoItem] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - self.additional_info = additional_info - - -class ErrorResponseErrorAdditionalInfoItem(_serialization.Model): - """ErrorResponseErrorAdditionalInfoItem. - - :ivar type: The type of additional information. - :vartype type: str - :ivar info: The additional information specific to the type. - :vartype info: dict[str, any] - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "{object}"}, - } - - def __init__(self, *, type: Optional[str] = None, info: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None: - """ - :keyword type: The type of additional information. - :paramtype type: str - :keyword info: The additional information specific to the type. - :paramtype info: dict[str, any] - """ - super().__init__(**kwargs) - self.type = type - self.info = info - - -class EtwEventConfiguration(_serialization.Model): - """EtwEventConfiguration. - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar id: Required. - :vartype id: int - :ivar filter: - :vartype filter: str - """ - - _validation = { - "name": {"required": True}, - "id": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "int"}, - "filter": {"key": "filter", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - id: int, # pylint: disable=redefined-builtin - filter: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword id: Required. - :paramtype id: int - :keyword filter: - :paramtype filter: str - """ - super().__init__(**kwargs) - self.name = name - self.id = id - self.filter = filter - - -class EtwProviderConfiguration(_serialization.Model): - """EtwProviderConfiguration. - - All required parameters must be populated in order to send to server. - - :ivar id: Required. - :vartype id: str - :ivar events: Required. - :vartype events: list[~azure.mgmt.monitor.models.EtwEventConfiguration] - """ - - _validation = { - "id": {"required": True}, - "events": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "events": {"key": "events", "type": "[EtwEventConfiguration]"}, - } - - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - events: List["_models.EtwEventConfiguration"], - **kwargs: Any - ) -> None: - """ - :keyword id: Required. - :paramtype id: str - :keyword events: Required. - :paramtype events: list[~azure.mgmt.monitor.models.EtwEventConfiguration] - """ - super().__init__(**kwargs) - self.id = id - self.events = events - - -class EventCategoryCollection(_serialization.Model): - """A collection of event categories. Currently possible values are: Administrative, Security, - ServiceHealth, Alert, Recommendation, Policy. - - All required parameters must be populated in order to send to server. - - :ivar value: the list that includes the Azure event categories. Required. - :vartype value: list[~azure.mgmt.monitor.models.LocalizableString] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[LocalizableString]"}, - } - - def __init__(self, *, value: List["_models.LocalizableString"], **kwargs: Any) -> None: - """ - :keyword value: the list that includes the Azure event categories. Required. - :paramtype value: list[~azure.mgmt.monitor.models.LocalizableString] - """ - super().__init__(**kwargs) - self.value = value - - -class EventData(_serialization.Model): - """The Azure event log entries are of type EventData. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar authorization: The sender authorization information. - :vartype authorization: ~azure.mgmt.monitor.models.SenderAuthorization - :ivar claims: key value pairs to identify ARM permissions. - :vartype claims: dict[str, str] - :ivar caller: the email address of the user who has performed the operation, the UPN claim or - SPN claim based on availability. - :vartype caller: str - :ivar description: the description of the event. - :vartype description: str - :ivar id: the Id of this event as required by ARM for RBAC. It contains the EventDataID and a - timestamp information. - :vartype id: str - :ivar event_data_id: the event data Id. This is a unique identifier for an event. - :vartype event_data_id: str - :ivar correlation_id: the correlation Id, usually a GUID in the string format. The correlation - Id is shared among the events that belong to the same uber operation. - :vartype correlation_id: str - :ivar event_name: the event name. This value should not be confused with OperationName. For - practical purposes, OperationName might be more appealing to end users. - :vartype event_name: ~azure.mgmt.monitor.models.LocalizableString - :ivar category: the event category. - :vartype category: ~azure.mgmt.monitor.models.LocalizableString - :ivar http_request: the HTTP request info. Usually includes the 'clientRequestId', - 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method - e.g. PUT). - :vartype http_request: ~azure.mgmt.monitor.models.HttpRequestInfo - :ivar level: the event level. Known values are: "Critical", "Error", "Warning", - "Informational", and "Verbose". - :vartype level: str or ~azure.mgmt.monitor.models.EventLevel - :ivar resource_group_name: the resource group name of the impacted resource. - :vartype resource_group_name: str - :ivar resource_provider_name: the resource provider name of the impacted resource. - :vartype resource_provider_name: ~azure.mgmt.monitor.models.LocalizableString - :ivar resource_id: the resource uri that uniquely identifies the resource that caused this - event. - :vartype resource_id: str - :ivar resource_type: the resource type. - :vartype resource_type: ~azure.mgmt.monitor.models.LocalizableString - :ivar operation_id: It is usually a GUID shared among the events corresponding to single - operation. This value should not be confused with EventName. - :vartype operation_id: str - :ivar operation_name: the operation name. - :vartype operation_name: ~azure.mgmt.monitor.models.LocalizableString - :ivar properties: the set of pairs (usually a Dictionary) that - includes details about the event. - :vartype properties: dict[str, str] - :ivar status: a string describing the status of the operation. Some typical values are: - Started, In progress, Succeeded, Failed, Resolved. - :vartype status: ~azure.mgmt.monitor.models.LocalizableString - :ivar sub_status: the event sub status. Most of the time, when included, this captures the HTTP - status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP - Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad - Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: - 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status - Code:503), Gateway Timeout (HTTP Status Code: 504). - :vartype sub_status: ~azure.mgmt.monitor.models.LocalizableString - :ivar event_timestamp: the timestamp of when the event was generated by the Azure service - processing the request corresponding the event. It in ISO 8601 format. - :vartype event_timestamp: ~datetime.datetime - :ivar submission_timestamp: the timestamp of when the event became available for querying via - this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there - might be a delay between the occurrence time of the event, and the time that the event is - submitted to the Azure logging infrastructure. - :vartype submission_timestamp: ~datetime.datetime - :ivar subscription_id: the Azure subscription Id usually a GUID. - :vartype subscription_id: str - :ivar tenant_id: the Azure tenant Id. - :vartype tenant_id: str - """ - - _validation = { - "authorization": {"readonly": True}, - "claims": {"readonly": True}, - "caller": {"readonly": True}, - "description": {"readonly": True}, - "id": {"readonly": True}, - "event_data_id": {"readonly": True}, - "correlation_id": {"readonly": True}, - "event_name": {"readonly": True}, - "category": {"readonly": True}, - "http_request": {"readonly": True}, - "level": {"readonly": True}, - "resource_group_name": {"readonly": True}, - "resource_provider_name": {"readonly": True}, - "resource_id": {"readonly": True}, - "resource_type": {"readonly": True}, - "operation_id": {"readonly": True}, - "operation_name": {"readonly": True}, - "properties": {"readonly": True}, - "status": {"readonly": True}, - "sub_status": {"readonly": True}, - "event_timestamp": {"readonly": True}, - "submission_timestamp": {"readonly": True}, - "subscription_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "authorization": {"key": "authorization", "type": "SenderAuthorization"}, - "claims": {"key": "claims", "type": "{str}"}, - "caller": {"key": "caller", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "event_data_id": {"key": "eventDataId", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "event_name": {"key": "eventName", "type": "LocalizableString"}, - "category": {"key": "category", "type": "LocalizableString"}, - "http_request": {"key": "httpRequest", "type": "HttpRequestInfo"}, - "level": {"key": "level", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "resource_provider_name": {"key": "resourceProviderName", "type": "LocalizableString"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "LocalizableString"}, - "operation_id": {"key": "operationId", "type": "str"}, - "operation_name": {"key": "operationName", "type": "LocalizableString"}, - "properties": {"key": "properties", "type": "{str}"}, - "status": {"key": "status", "type": "LocalizableString"}, - "sub_status": {"key": "subStatus", "type": "LocalizableString"}, - "event_timestamp": {"key": "eventTimestamp", "type": "iso-8601"}, - "submission_timestamp": {"key": "submissionTimestamp", "type": "iso-8601"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-locals - """ """ - super().__init__(**kwargs) - self.authorization = None - self.claims = None - self.caller = None - self.description = None - self.id = None - self.event_data_id = None - self.correlation_id = None - self.event_name = None - self.category = None - self.http_request = None - self.level = None - self.resource_group_name = None - self.resource_provider_name = None - self.resource_id = None - self.resource_type = None - self.operation_id = None - self.operation_name = None - self.properties = None - self.status = None - self.sub_status = None - self.event_timestamp = None - self.submission_timestamp = None - self.subscription_id = None - self.tenant_id = None - - -class EventDataCollection(_serialization.Model): - """Represents collection of events. - - All required parameters must be populated in order to send to server. - - :ivar value: this list that includes the Azure audit logs. Required. - :vartype value: list[~azure.mgmt.monitor.models.EventData] - :ivar next_link: Provides the link to retrieve the next set of events. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[EventData]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.EventData"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: this list that includes the Azure audit logs. Required. - :paramtype value: list[~azure.mgmt.monitor.models.EventData] - :keyword next_link: Provides the link to retrieve the next set of events. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EventHubReceiver(_serialization.Model): - """An Event hub receiver. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the Event hub receiver. Names must be unique across all receivers - within an action group. Required. - :vartype name: str - :ivar event_hub_name_space: The Event Hub namespace. Required. - :vartype event_hub_name_space: str - :ivar event_hub_name: The name of the specific Event Hub queue. Required. - :vartype event_hub_name: str - :ivar use_common_alert_schema: Indicates whether to use common alert schema. - :vartype use_common_alert_schema: bool - :ivar tenant_id: The tenant Id for the subscription containing this event hub. - :vartype tenant_id: str - :ivar subscription_id: The Id for the subscription containing this event hub. Required. - :vartype subscription_id: str - """ - - _validation = { - "name": {"required": True}, - "event_hub_name_space": {"required": True}, - "event_hub_name": {"required": True}, - "subscription_id": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "event_hub_name_space": {"key": "eventHubNameSpace", "type": "str"}, - "event_hub_name": {"key": "eventHubName", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "subscription_id": {"key": "subscriptionId", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - event_hub_name_space: str, - event_hub_name: str, - subscription_id: str, - use_common_alert_schema: bool = False, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the Event hub receiver. Names must be unique across all receivers - within an action group. Required. - :paramtype name: str - :keyword event_hub_name_space: The Event Hub namespace. Required. - :paramtype event_hub_name_space: str - :keyword event_hub_name: The name of the specific Event Hub queue. Required. - :paramtype event_hub_name: str - :keyword use_common_alert_schema: Indicates whether to use common alert schema. - :paramtype use_common_alert_schema: bool - :keyword tenant_id: The tenant Id for the subscription containing this event hub. - :paramtype tenant_id: str - :keyword subscription_id: The Id for the subscription containing this event hub. Required. - :paramtype subscription_id: str - """ - super().__init__(**kwargs) - self.name = name - self.event_hub_name_space = event_hub_name_space - self.event_hub_name = event_hub_name - self.use_common_alert_schema = use_common_alert_schema - self.tenant_id = tenant_id - self.subscription_id = subscription_id - - -class EventLogConfiguration(_serialization.Model): - """EventLogConfiguration. - - All required parameters must be populated in order to send to server. - - :ivar log_name: Required. - :vartype log_name: str - :ivar filter: - :vartype filter: str - """ - - _validation = { - "log_name": {"required": True}, - } - - _attribute_map = { - "log_name": {"key": "logName", "type": "str"}, - "filter": {"key": "filter", "type": "str"}, - } - - def __init__( - 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 GuestDiagnosticSettingsAssociationList(_serialization.Model): - """A list of guest diagnostic settings association. - - :ivar value: The list of guest diagnostic settings association. - :vartype value: list[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :ivar next_link: Provides the link to retrieve the next set of elements. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[GuestDiagnosticSettingsAssociationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.GuestDiagnosticSettingsAssociationResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of guest diagnostic settings association. - :paramtype value: list[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :keyword next_link: Provides the link to retrieve the next set of elements. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GuestDiagnosticSettingsAssociationResource(Resource): # pylint: disable=name-too-long - """Virtual machine guest diagnostic settings 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar guest_diagnostic_settings_name: The guest diagnostic settings name. Required. - :vartype guest_diagnostic_settings_name: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "guest_diagnostic_settings_name": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "guest_diagnostic_settings_name": {"key": "properties.guestDiagnosticSettingsName", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - guest_diagnostic_settings_name: str, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword guest_diagnostic_settings_name: The guest diagnostic settings name. Required. - :paramtype guest_diagnostic_settings_name: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.guest_diagnostic_settings_name = guest_diagnostic_settings_name - - -class GuestDiagnosticSettingsAssociationResourcePatch(_serialization.Model): # pylint: disable=name-too-long - """Guest diagnostic setting resource for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar guest_diagnostic_settings_name: The guest diagnostic settings name. - :vartype guest_diagnostic_settings_name: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "guest_diagnostic_settings_name": {"key": "properties.guestDiagnosticSettingsName", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - guest_diagnostic_settings_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword guest_diagnostic_settings_name: The guest diagnostic settings name. - :paramtype guest_diagnostic_settings_name: str - """ - super().__init__(**kwargs) - self.tags = tags - self.guest_diagnostic_settings_name = guest_diagnostic_settings_name - - -class GuestDiagnosticSettingsList(_serialization.Model): - """A list of guest diagnostic settings. - - :ivar value: The list of guest diagnostic settings. - :vartype value: list[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :ivar next_link: Provides the link to retrieve the next set of elements. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[GuestDiagnosticSettingsResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.GuestDiagnosticSettingsResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of guest diagnostic settings. - :paramtype value: list[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :keyword next_link: Provides the link to retrieve the next set of elements. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GuestDiagnosticSettingsPatchResource(_serialization.Model): - """An diagnostic settings object for the body of patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar os_type: Operating system type for the configuration. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.monitor.models.GuestDiagnosticSettingsOsType - :ivar data_sources: the array of data source object which are configured to collect and send - data. - :vartype data_sources: list[~azure.mgmt.monitor.models.DataSource] - :ivar proxy_setting: - :vartype proxy_setting: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "data_sources": {"key": "properties.dataSources", "type": "[DataSource]"}, - "proxy_setting": {"key": "properties.proxySetting", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - os_type: Optional[Union[str, "_models.GuestDiagnosticSettingsOsType"]] = None, - data_sources: Optional[List["_models.DataSource"]] = None, - proxy_setting: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword os_type: Operating system type for the configuration. Known values are: "Windows" and - "Linux". - :paramtype os_type: str or ~azure.mgmt.monitor.models.GuestDiagnosticSettingsOsType - :keyword data_sources: the array of data source object which are configured to collect and send - data. - :paramtype data_sources: list[~azure.mgmt.monitor.models.DataSource] - :keyword proxy_setting: - :paramtype proxy_setting: str - """ - super().__init__(**kwargs) - self.tags = tags - self.os_type = os_type - self.data_sources = data_sources - self.proxy_setting = proxy_setting - - -class GuestDiagnosticSettingsResource(Resource): - """Virtual machine guest diagnostics settings 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar os_type: Operating system type for the configuration. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.monitor.models.GuestDiagnosticSettingsOsType - :ivar data_sources: the array of data source object which are configured to collect and send - data. - :vartype data_sources: list[~azure.mgmt.monitor.models.DataSource] - :ivar proxy_setting: - :vartype proxy_setting: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "data_sources": {"key": "properties.dataSources", "type": "[DataSource]"}, - "proxy_setting": {"key": "properties.proxySetting", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - os_type: Optional[Union[str, "_models.GuestDiagnosticSettingsOsType"]] = None, - data_sources: Optional[List["_models.DataSource"]] = None, - proxy_setting: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword os_type: Operating system type for the configuration. Known values are: "Windows" and - "Linux". - :paramtype os_type: str or ~azure.mgmt.monitor.models.GuestDiagnosticSettingsOsType - :keyword data_sources: the array of data source object which are configured to collect and send - data. - :paramtype data_sources: list[~azure.mgmt.monitor.models.DataSource] - :keyword proxy_setting: - :paramtype proxy_setting: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.os_type = os_type - self.data_sources = data_sources - self.proxy_setting = proxy_setting - - -class HttpRequestInfo(_serialization.Model): - """The Http request info. - - :ivar client_request_id: the client request id. - :vartype client_request_id: str - :ivar client_ip_address: the client Ip Address. - :vartype client_ip_address: str - :ivar method: the Http request method. - :vartype method: str - :ivar uri: the Uri. - :vartype uri: str - """ - - _attribute_map = { - "client_request_id": {"key": "clientRequestId", "type": "str"}, - "client_ip_address": {"key": "clientIpAddress", "type": "str"}, - "method": {"key": "method", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, - } - - def __init__( - self, - *, - client_request_id: Optional[str] = None, - client_ip_address: Optional[str] = None, - method: Optional[str] = None, - uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword client_request_id: the client request id. - :paramtype client_request_id: str - :keyword client_ip_address: the client Ip Address. - :paramtype client_ip_address: str - :keyword method: the Http request method. - :paramtype method: str - :keyword uri: the Uri. - :paramtype uri: str - """ - super().__init__(**kwargs) - self.client_request_id = client_request_id - self.client_ip_address = client_ip_address - self.method = method - self.uri = uri - - -class Incident(_serialization.Model): - """An alert incident indicates the activation status of an alert rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Incident name. - :vartype name: str - :ivar rule_name: Rule name that is associated with the incident. - :vartype rule_name: str - :ivar is_active: A boolean to indicate whether the incident is active or resolved. - :vartype is_active: bool - :ivar activated_time: The time at which the incident was activated in ISO8601 format. - :vartype activated_time: ~datetime.datetime - :ivar resolved_time: The time at which the incident was resolved in ISO8601 format. If null, it - means the incident is still active. - :vartype resolved_time: ~datetime.datetime - """ - - _validation = { - "name": {"readonly": True}, - "rule_name": {"readonly": True}, - "is_active": {"readonly": True}, - "activated_time": {"readonly": True}, - "resolved_time": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "rule_name": {"key": "ruleName", "type": "str"}, - "is_active": {"key": "isActive", "type": "bool"}, - "activated_time": {"key": "activatedTime", "type": "iso-8601"}, - "resolved_time": {"key": "resolvedTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.rule_name = None - self.is_active = None - self.activated_time = None - self.resolved_time = None - - -class IncidentListResult(_serialization.Model): - """The List incidents operation response. - - :ivar value: the incident collection. - :vartype value: list[~azure.mgmt.monitor.models.Incident] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Incident]"}, - } - - def __init__(self, *, value: Optional[List["_models.Incident"]] = None, **kwargs: Any) -> None: - """ - :keyword value: the incident collection. - :paramtype value: list[~azure.mgmt.monitor.models.Incident] - """ - super().__init__(**kwargs) - self.value = value - - -class ItsmReceiver(_serialization.Model): - """An Itsm receiver. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the Itsm receiver. Names must be unique across all receivers within an - action group. Required. - :vartype name: str - :ivar workspace_id: OMS LA instance identifier. Required. - :vartype workspace_id: str - :ivar connection_id: Unique identification of ITSM connection among multiple defined in above - workspace. Required. - :vartype connection_id: str - :ivar ticket_configuration: JSON blob for the configurations of the ITSM action. - CreateMultipleWorkItems option will be part of this blob as well. Required. - :vartype ticket_configuration: str - :ivar region: Region in which workspace resides. Supported - values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. # pylint: disable=line-too-long - Required. - :vartype region: str - """ - - _validation = { - "name": {"required": True}, - "workspace_id": {"required": True}, - "connection_id": {"required": True}, - "ticket_configuration": {"required": True}, - "region": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "workspace_id": {"key": "workspaceId", "type": "str"}, - "connection_id": {"key": "connectionId", "type": "str"}, - "ticket_configuration": {"key": "ticketConfiguration", "type": "str"}, - "region": {"key": "region", "type": "str"}, - } - - def __init__( - self, *, name: str, workspace_id: str, connection_id: str, ticket_configuration: str, region: str, **kwargs: Any - ) -> None: - """ - :keyword name: The name of the Itsm receiver. Names must be unique across all receivers within - an action group. Required. - :paramtype name: str - :keyword workspace_id: OMS LA instance identifier. Required. - :paramtype workspace_id: str - :keyword connection_id: Unique identification of ITSM connection among multiple defined in - above workspace. Required. - :paramtype connection_id: str - :keyword ticket_configuration: JSON blob for the configurations of the ITSM action. - CreateMultipleWorkItems option will be part of this blob as well. Required. - :paramtype ticket_configuration: str - :keyword region: Region in which workspace resides. Supported - values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. # pylint: disable=line-too-long - Required. - :paramtype region: str - """ - super().__init__(**kwargs) - self.name = name - self.workspace_id = workspace_id - self.connection_id = connection_id - self.ticket_configuration = ticket_configuration - self.region = region - - -class LocalizableString(_serialization.Model): - """The localizable string class. - - All required parameters must be populated in order to send to server. - - :ivar value: the invariant value. Required. - :vartype value: str - :ivar localized_value: the locale specific value. - :vartype localized_value: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: str, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: the invariant value. Required. - :paramtype value: str - :keyword localized_value: the locale specific value. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class LocalizableStringAutoGenerated(_serialization.Model): - """The localizable string class. - - All required parameters must be populated in order to send to server. - - :ivar value: The invariant value. Required. - :vartype value: str - :ivar localized_value: The display name. - :vartype localized_value: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: str, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The invariant value. Required. - :paramtype value: str - :keyword localized_value: The display name. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class LogicAppReceiver(_serialization.Model): - """A logic app receiver. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the logic app receiver. Names must be unique across all receivers - within an action group. Required. - :vartype name: str - :ivar resource_id: The azure resource id of the logic app receiver. Required. - :vartype resource_id: str - :ivar callback_url: The callback url where http request sent to. Required. - :vartype callback_url: str - :ivar use_common_alert_schema: Indicates whether to use common alert schema. - :vartype use_common_alert_schema: bool - """ - - _validation = { - "name": {"required": True}, - "resource_id": {"required": True}, - "callback_url": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "callback_url": {"key": "callbackUrl", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - } - - def __init__( - self, *, name: str, resource_id: str, callback_url: str, use_common_alert_schema: bool = False, **kwargs: Any - ) -> None: - """ - :keyword name: The name of the logic app receiver. Names must be unique across all receivers - within an action group. Required. - :paramtype name: str - :keyword resource_id: The azure resource id of the logic app receiver. Required. - :paramtype resource_id: str - :keyword callback_url: The callback url where http request sent to. Required. - :paramtype callback_url: str - :keyword use_common_alert_schema: Indicates whether to use common alert schema. - :paramtype use_common_alert_schema: bool - """ - super().__init__(**kwargs) - self.name = name - self.resource_id = resource_id - self.callback_url = callback_url - self.use_common_alert_schema = use_common_alert_schema - - -class LogMetricTrigger(_serialization.Model): - """A log metrics trigger descriptor. - - :ivar threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or - 'Equal'. Known values are: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", "LessThan", - and "Equal". - :vartype threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :ivar threshold: The threshold of the metric trigger. - :vartype threshold: float - :ivar metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Known values are: - "Consecutive" and "Total". - :vartype metric_trigger_type: str or ~azure.mgmt.monitor.models.MetricTriggerType - :ivar metric_column: Evaluation of metric on a particular column. - :vartype metric_column: str - """ - - _attribute_map = { - "threshold_operator": {"key": "thresholdOperator", "type": "str"}, - "threshold": {"key": "threshold", "type": "float"}, - "metric_trigger_type": {"key": "metricTriggerType", "type": "str"}, - "metric_column": {"key": "metricColumn", "type": "str"}, - } - - def __init__( - self, - *, - threshold_operator: Union[str, "_models.ConditionalOperator"] = "GreaterThanOrEqual", - threshold: Optional[float] = None, - metric_trigger_type: Union[str, "_models.MetricTriggerType"] = "Consecutive", - metric_column: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword threshold_operator: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or - 'Equal'. Known values are: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", "LessThan", - and "Equal". - :paramtype threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :keyword threshold: The threshold of the metric trigger. - :paramtype threshold: float - :keyword metric_trigger_type: Metric Trigger Type - 'Consecutive' or 'Total'. Known values are: - "Consecutive" and "Total". - :paramtype metric_trigger_type: str or ~azure.mgmt.monitor.models.MetricTriggerType - :keyword metric_column: Evaluation of metric on a particular column. - :paramtype metric_column: str - """ - super().__init__(**kwargs) - self.threshold_operator = threshold_operator - self.threshold = threshold - self.metric_trigger_type = metric_trigger_type - self.metric_column = metric_column - - -class LogProfileCollection(_serialization.Model): - """Represents a collection of log profiles. - - All required parameters must be populated in order to send to server. - - :ivar value: the values of the log profiles. Required. - :vartype value: list[~azure.mgmt.monitor.models.LogProfileResource] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[LogProfileResource]"}, - } - - def __init__(self, *, value: List["_models.LogProfileResource"], **kwargs: Any) -> None: - """ - :keyword value: the values of the log profiles. Required. - :paramtype value: list[~azure.mgmt.monitor.models.LogProfileResource] - """ - super().__init__(**kwargs) - self.value = value - - -class LogProfileResource(Resource): - """The log profile 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar storage_account_id: the resource id of the storage account to which you would like to - send the Activity Log. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :vartype service_bus_rule_id: str - :ivar locations: List of regions for which Activity Log events should be stored or streamed. It - is a comma separated list of valid ARM locations including the 'global' location. Required. - :vartype locations: list[str] - :ivar categories: the categories of the logs. These categories are created as is convenient to - the user. Some values are: 'Write', 'Delete', and/or 'Action.'. Required. - :vartype categories: list[str] - :ivar retention_policy: the retention policy for the events in the log. Required. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "locations": {"required": True}, - "categories": {"required": True}, - "retention_policy": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "locations": {"key": "properties.locations", "type": "[str]"}, - "categories": {"key": "properties.categories", "type": "[str]"}, - "retention_policy": {"key": "properties.retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - location: str, - locations: List[str], - categories: List[str], - retention_policy: "_models.RetentionPolicy", - tags: Optional[Dict[str, str]] = None, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword storage_account_id: the resource id of the storage account to which you would like to - send the Activity Log. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :paramtype service_bus_rule_id: str - :keyword locations: List of regions for which Activity Log events should be stored or streamed. - It is a comma separated list of valid ARM locations including the 'global' location. Required. - :paramtype locations: list[str] - :keyword categories: the categories of the logs. These categories are created as is convenient - to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. Required. - :paramtype categories: list[str] - :keyword retention_policy: the retention policy for the events in the log. Required. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(location=location, tags=tags, **kwargs) - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.locations = locations - self.categories = categories - self.retention_policy = retention_policy - - -class LogProfileResourcePatch(_serialization.Model): - """The log profile resource for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar storage_account_id: the resource id of the storage account to which you would like to - send the Activity Log. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :vartype service_bus_rule_id: str - :ivar locations: List of regions for which Activity Log events should be stored or streamed. It - is a comma separated list of valid ARM locations including the 'global' location. - :vartype locations: list[str] - :ivar categories: the categories of the logs. These categories are created as is convenient to - the user. Some values are: 'Write', 'Delete', and/or 'Action.'. - :vartype categories: list[str] - :ivar retention_policy: the retention policy for the events in the log. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "locations": {"key": "properties.locations", "type": "[str]"}, - "categories": {"key": "properties.categories", "type": "[str]"}, - "retention_policy": {"key": "properties.retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - locations: Optional[List[str]] = None, - categories: Optional[List[str]] = None, - retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword storage_account_id: the resource id of the storage account to which you would like to - send the Activity Log. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :paramtype service_bus_rule_id: str - :keyword locations: List of regions for which Activity Log events should be stored or streamed. - It is a comma separated list of valid ARM locations including the 'global' location. - :paramtype locations: list[str] - :keyword categories: the categories of the logs. These categories are created as is convenient - to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. - :paramtype categories: list[str] - :keyword retention_policy: the retention policy for the events in the log. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(**kwargs) - self.tags = tags - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.locations = locations - self.categories = categories - self.retention_policy = retention_policy - - -class ResourceAutoGenerated3(_serialization.Model): - """An azure resource object. - - 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :vartype kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"readonly": True}, - "etag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.kind = None - self.etag = None - - -class LogSearchRuleResource(ResourceAutoGenerated3): - """The Log Search Rule 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :vartype kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :ivar created_with_api_version: The api-version used when creating this alert rule. - :vartype created_with_api_version: str - :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. - :vartype is_legacy_log_analytics_rule: bool - :ivar description: The description of the Log Search rule. - :vartype description: str - :ivar display_name: The display name of the alert rule. - :vartype display_name: str - :ivar auto_mitigate: The flag that indicates whether the alert should be automatically resolved - or not. The default is false. - :vartype auto_mitigate: bool - :ivar enabled: The flag which indicates whether the Log Search rule is enabled. Value should be - true or false. Known values are: "true" and "false". - :vartype enabled: str or ~azure.mgmt.monitor.models.Enabled - :ivar last_updated_time: Last time the rule was updated in IS08601 format. - :vartype last_updated_time: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the scheduled query rule. Known values are: - "Succeeded", "Deploying", "Canceled", and "Failed". - :vartype provisioning_state: str or ~azure.mgmt.monitor.models.ProvisioningState - :ivar source: Data Source against which rule will Query Data. Required. - :vartype source: ~azure.mgmt.monitor.models.Source - :ivar schedule: Schedule (Frequency, Time Window) for rule. Required for action type - - AlertingAction. - :vartype schedule: ~azure.mgmt.monitor.models.Schedule - :ivar action: Action needs to be taken on rule execution. Required. - :vartype action: ~azure.mgmt.monitor.models.Action - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"readonly": True}, - "etag": {"readonly": True}, - "created_with_api_version": {"readonly": True}, - "is_legacy_log_analytics_rule": {"readonly": True}, - "last_updated_time": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "source": {"required": True}, - "action": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "created_with_api_version": {"key": "properties.createdWithApiVersion", "type": "str"}, - "is_legacy_log_analytics_rule": {"key": "properties.isLegacyLogAnalyticsRule", "type": "bool"}, - "description": {"key": "properties.description", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "auto_mitigate": {"key": "properties.autoMitigate", "type": "bool"}, - "enabled": {"key": "properties.enabled", "type": "str"}, - "last_updated_time": {"key": "properties.lastUpdatedTime", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "source": {"key": "properties.source", "type": "Source"}, - "schedule": {"key": "properties.schedule", "type": "Schedule"}, - "action": {"key": "properties.action", "type": "Action"}, - } - - def __init__( - self, - *, - location: str, - source: "_models.Source", - action: "_models.Action", - tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - display_name: Optional[str] = None, - auto_mitigate: bool = False, - enabled: Optional[Union[str, "_models.Enabled"]] = None, - schedule: Optional["_models.Schedule"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword description: The description of the Log Search rule. - :paramtype description: str - :keyword display_name: The display name of the alert rule. - :paramtype display_name: str - :keyword auto_mitigate: The flag that indicates whether the alert should be automatically - resolved or not. The default is false. - :paramtype auto_mitigate: bool - :keyword enabled: The flag which indicates whether the Log Search rule is enabled. Value should - be true or false. Known values are: "true" and "false". - :paramtype enabled: str or ~azure.mgmt.monitor.models.Enabled - :keyword source: Data Source against which rule will Query Data. Required. - :paramtype source: ~azure.mgmt.monitor.models.Source - :keyword schedule: Schedule (Frequency, Time Window) for rule. Required for action type - - AlertingAction. - :paramtype schedule: ~azure.mgmt.monitor.models.Schedule - :keyword action: Action needs to be taken on rule execution. Required. - :paramtype action: ~azure.mgmt.monitor.models.Action - """ - super().__init__(location=location, tags=tags, **kwargs) - self.created_with_api_version = None - self.is_legacy_log_analytics_rule = None - self.description = description - self.display_name = display_name - self.auto_mitigate = auto_mitigate - self.enabled = enabled - self.last_updated_time = None - self.provisioning_state = None - self.source = source - self.schedule = schedule - self.action = action - - -class LogSearchRuleResourceCollection(_serialization.Model): - """Represents a collection of Log Search rule resources. - - :ivar value: The values for the Log Search Rule resources. - :vartype value: list[~azure.mgmt.monitor.models.LogSearchRuleResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[LogSearchRuleResource]"}, - } - - def __init__(self, *, value: Optional[List["_models.LogSearchRuleResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The values for the Log Search Rule resources. - :paramtype value: list[~azure.mgmt.monitor.models.LogSearchRuleResource] - """ - super().__init__(**kwargs) - self.value = value - - -class LogSearchRuleResourcePatch(_serialization.Model): - """The log search rule resource for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar enabled: The flag which indicates whether the Log Search rule is enabled. Value should be - true or false. Known values are: "true" and "false". - :vartype enabled: str or ~azure.mgmt.monitor.models.Enabled - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "enabled": {"key": "properties.enabled", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - enabled: Optional[Union[str, "_models.Enabled"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword enabled: The flag which indicates whether the Log Search rule is enabled. Value should - be true or false. Known values are: "true" and "false". - :paramtype enabled: str or ~azure.mgmt.monitor.models.Enabled - """ - super().__init__(**kwargs) - self.tags = tags - self.enabled = enabled - - -class LogSettings(_serialization.Model): - """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. - - All required parameters must be populated in order to send to server. - - :ivar category: Name of a Diagnostic Log category for a resource type this setting is applied - to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET - diagnostic settings operation. - :vartype category: str - :ivar category_group: Name of a Diagnostic Log category group for a resource type this setting - is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a - GET diagnostic settings operation. - :vartype category_group: str - :ivar enabled: a value indicating whether this log is enabled. Required. - :vartype enabled: bool - :ivar retention_policy: the retention policy for this log. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _validation = { - "enabled": {"required": True}, - } - - _attribute_map = { - "category": {"key": "category", "type": "str"}, - "category_group": {"key": "categoryGroup", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - enabled: bool, - category: Optional[str] = None, - category_group: Optional[str] = None, - retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword category: Name of a Diagnostic Log category for a resource type this setting is - applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET - diagnostic settings operation. - :paramtype category: str - :keyword category_group: Name of a Diagnostic Log category group for a resource type this - setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first - perform a GET diagnostic settings operation. - :paramtype category_group: str - :keyword enabled: a value indicating whether this log is enabled. Required. - :paramtype enabled: bool - :keyword retention_policy: the retention policy for this log. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(**kwargs) - self.category = category - self.category_group = category_group - self.enabled = enabled - self.retention_policy = retention_policy - - -class LogSettingsAutoGenerated(_serialization.Model): - """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. - - All required parameters must be populated in order to send to server. - - :ivar category: Name of a Diagnostic Log category for a resource type this setting is applied - to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET - diagnostic settings operation. - :vartype category: str - :ivar enabled: a value indicating whether this log is enabled. Required. - :vartype enabled: bool - :ivar retention_policy: the retention policy for this log. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _validation = { - "enabled": {"required": True}, - } - - _attribute_map = { - "category": {"key": "category", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - enabled: bool, - category: Optional[str] = None, - retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword category: Name of a Diagnostic Log category for a resource type this setting is - applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET - diagnostic settings operation. - :paramtype category: str - :keyword enabled: a value indicating whether this log is enabled. Required. - :paramtype enabled: bool - :keyword retention_policy: the retention policy for this log. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(**kwargs) - self.category = category - self.enabled = enabled - self.retention_policy = retention_policy - - -class LogToMetricAction(Action): - """Specify action need to be taken when rule type is converting log to metric. - - All required parameters must be populated in order to send to server. - - :ivar odata_type: Specifies the action. Supported values - AlertingAction, LogToMetricAction. - Required. - :vartype odata_type: str - :ivar criteria: Criteria of Metric. Required. - :vartype criteria: list[~azure.mgmt.monitor.models.Criteria] - """ - - _validation = { - "odata_type": {"required": True}, - "criteria": {"required": True}, - } - - _attribute_map = { - "odata_type": {"key": "odata\\.type", "type": "str"}, - "criteria": {"key": "criteria", "type": "[Criteria]"}, - } - - def __init__(self, *, criteria: List["_models.Criteria"], **kwargs: Any) -> None: - """ - :keyword criteria: Criteria of Metric. Required. - :paramtype criteria: list[~azure.mgmt.monitor.models.Criteria] - """ - super().__init__(**kwargs) - self.odata_type: str = ( - "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" - ) - self.criteria = criteria - - -class MetadataValue(_serialization.Model): - """Represents a metric metadata value. - - :ivar name: The name of the metadata. - :vartype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :ivar value: The value of the metadata. - :vartype value: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "LocalizableStringAutoGenerated"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional["_models.LocalizableStringAutoGenerated"] = None, - value: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the metadata. - :paramtype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :keyword value: The value of the metadata. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class Metric(_serialization.Model): - """The result data of a query. - - All required parameters must be populated in order to send to server. - - :ivar id: The metric Id. Required. - :vartype id: str - :ivar type: The resource type of the metric resource. Required. - :vartype type: str - :ivar name: The name and the display name of the metric, i.e. it is localizable string. - Required. - :vartype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :ivar display_description: Detailed description of this metric. - :vartype display_description: str - :ivar error_code: 'Success' or the error details on query failures for this metric. - :vartype error_code: str - :ivar error_message: Error message encountered querying this specific metric. - :vartype error_message: str - :ivar unit: The unit of the metric. Required. Known values are: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", - "Cores", "MilliCores", "NanoCores", and "BitsPerSecond". - :vartype unit: str or ~azure.mgmt.monitor.models.MetricUnit - :ivar timeseries: The time series returned when a data query is performed. Required. - :vartype timeseries: list[~azure.mgmt.monitor.models.TimeSeriesElement] - """ - - _validation = { - "id": {"required": True}, - "type": {"required": True}, - "name": {"required": True}, - "unit": {"required": True}, - "timeseries": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "LocalizableStringAutoGenerated"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "timeseries": {"key": "timeseries", "type": "[TimeSeriesElement]"}, - } - - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - type: str, - name: "_models.LocalizableStringAutoGenerated", - unit: Union[str, "_models.MetricUnit"], - timeseries: List["_models.TimeSeriesElement"], - display_description: Optional[str] = None, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The metric Id. Required. - :paramtype id: str - :keyword type: The resource type of the metric resource. Required. - :paramtype type: str - :keyword name: The name and the display name of the metric, i.e. it is localizable string. - Required. - :paramtype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :keyword display_description: Detailed description of this metric. - :paramtype display_description: str - :keyword error_code: 'Success' or the error details on query failures for this metric. - :paramtype error_code: str - :keyword error_message: Error message encountered querying this specific metric. - :paramtype error_message: str - :keyword unit: The unit of the metric. Required. Known values are: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", - "Cores", "MilliCores", "NanoCores", and "BitsPerSecond". - :paramtype unit: str or ~azure.mgmt.monitor.models.MetricUnit - :keyword timeseries: The time series returned when a data query is performed. Required. - :paramtype timeseries: list[~azure.mgmt.monitor.models.TimeSeriesElement] - """ - super().__init__(**kwargs) - self.id = id - self.type = type - self.name = name - self.display_description = display_description - self.error_code = error_code - self.error_message = error_message - self.unit = unit - self.timeseries = timeseries - - -class MetricAlertAction(_serialization.Model): - """An alert action. - - :ivar action_group_id: the id of the action group to use. - :vartype action_group_id: str - :ivar web_hook_properties: This field allows specifying custom properties, which would be - appended to the alert payload sent as input to the webhook. - :vartype web_hook_properties: dict[str, str] - """ - - _attribute_map = { - "action_group_id": {"key": "actionGroupId", "type": "str"}, - "web_hook_properties": {"key": "webHookProperties", "type": "{str}"}, - } - - def __init__( - self, - *, - action_group_id: Optional[str] = None, - web_hook_properties: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword action_group_id: the id of the action group to use. - :paramtype action_group_id: str - :keyword web_hook_properties: This field allows specifying custom properties, which would be - appended to the alert payload sent as input to the webhook. - :paramtype web_hook_properties: dict[str, str] - """ - super().__init__(**kwargs) - self.action_group_id = action_group_id - self.web_hook_properties = web_hook_properties - - -class MetricAlertCriteria(_serialization.Model): - """The rule criteria that defines the conditions of the alert rule. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - MetricAlertMultipleResourceMultipleMetricCriteria, - MetricAlertSingleResourceMultipleMetricCriteria, WebtestLocationAvailabilityCriteria - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar odata_type: specifies the type of the alert criteria. Required. Known values are: - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", and - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria". - :vartype odata_type: str or ~azure.mgmt.monitor.models.Odatatype - """ - - _validation = { - "odata_type": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "odata_type": {"key": "odata\\.type", "type": "str"}, - } - - _subtype_map = { - "odata_type": { - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria": "MetricAlertMultipleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria": "MetricAlertSingleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria": "WebtestLocationAvailabilityCriteria", - } - } - - def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - """ - super().__init__(**kwargs) - self.additional_properties = additional_properties - self.odata_type: Optional[str] = None - - -class MetricAlertMultipleResourceMultipleMetricCriteria(MetricAlertCriteria): # pylint: disable=name-too-long - """Specifies the metric alert criteria for multiple resource that has multiple metric criteria. - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar odata_type: specifies the type of the alert criteria. Required. Known values are: - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", and - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria". - :vartype odata_type: str or ~azure.mgmt.monitor.models.Odatatype - :ivar all_of: the list of multiple metric criteria for this 'all of' operation. - :vartype all_of: list[~azure.mgmt.monitor.models.MultiMetricCriteria] - """ - - _validation = { - "odata_type": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "odata_type": {"key": "odata\\.type", "type": "str"}, - "all_of": {"key": "allOf", "type": "[MultiMetricCriteria]"}, - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, JSON]] = None, - all_of: Optional[List["_models.MultiMetricCriteria"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword all_of: the list of multiple metric criteria for this 'all of' operation. - :paramtype all_of: list[~azure.mgmt.monitor.models.MultiMetricCriteria] - """ - super().__init__(additional_properties=additional_properties, **kwargs) - self.odata_type: str = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - self.all_of = all_of - - -class MetricAlertResource(Resource): - """The metric alert 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar description: the description of the metric alert that will be included in the alert - email. - :vartype description: str - :ivar severity: Alert severity {0, 1, 2, 3, 4}. Required. - :vartype severity: int - :ivar enabled: the flag that indicates whether the metric alert is enabled. Required. - :vartype enabled: bool - :ivar scopes: the list of resource id's that this metric alert is scoped to. Required. - :vartype scopes: list[str] - :ivar evaluation_frequency: how often the metric alert is evaluated represented in ISO 8601 - duration format. Required. - :vartype evaluation_frequency: ~datetime.timedelta - :ivar window_size: the period of time (in ISO 8601 duration format) that is used to monitor - alert activity based on the threshold. Required. - :vartype window_size: ~datetime.timedelta - :ivar target_resource_type: the resource type of the target resource(s) on which the alert is - created/updated. Mandatory if the scope contains a subscription, resource group, or more than - one resource. - :vartype target_resource_type: str - :ivar target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory if the scope contains a subscription, resource group, or more than - one resource. - :vartype target_resource_region: str - :ivar criteria: defines the specific alert criteria information. Required. - :vartype criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :ivar auto_mitigate: the flag that indicates whether the alert should be auto resolved or not. - The default is true. - :vartype auto_mitigate: bool - :ivar actions: the array of actions that are performed when the alert rule becomes active, and - when an alert condition is resolved. - :vartype actions: list[~azure.mgmt.monitor.models.MetricAlertAction] - :ivar last_updated_time: Last time the rule was updated in ISO8601 format. - :vartype last_updated_time: ~datetime.datetime - :ivar is_migrated: the value indicating whether this alert rule is migrated. - :vartype is_migrated: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "severity": {"required": True}, - "enabled": {"required": True}, - "scopes": {"required": True}, - "evaluation_frequency": {"required": True}, - "window_size": {"required": True}, - "criteria": {"required": True}, - "last_updated_time": {"readonly": True}, - "is_migrated": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "severity": {"key": "properties.severity", "type": "int"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "scopes": {"key": "properties.scopes", "type": "[str]"}, - "evaluation_frequency": {"key": "properties.evaluationFrequency", "type": "duration"}, - "window_size": {"key": "properties.windowSize", "type": "duration"}, - "target_resource_type": {"key": "properties.targetResourceType", "type": "str"}, - "target_resource_region": {"key": "properties.targetResourceRegion", "type": "str"}, - "criteria": {"key": "properties.criteria", "type": "MetricAlertCriteria"}, - "auto_mitigate": {"key": "properties.autoMitigate", "type": "bool"}, - "actions": {"key": "properties.actions", "type": "[MetricAlertAction]"}, - "last_updated_time": {"key": "properties.lastUpdatedTime", "type": "iso-8601"}, - "is_migrated": {"key": "properties.isMigrated", "type": "bool"}, - } - - def __init__( - self, - *, - location: str, - severity: int, - enabled: bool, - scopes: List[str], - evaluation_frequency: datetime.timedelta, - window_size: datetime.timedelta, - criteria: "_models.MetricAlertCriteria", - tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - target_resource_type: Optional[str] = None, - target_resource_region: Optional[str] = None, - auto_mitigate: Optional[bool] = None, - actions: Optional[List["_models.MetricAlertAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword description: the description of the metric alert that will be included in the alert - email. - :paramtype description: str - :keyword severity: Alert severity {0, 1, 2, 3, 4}. Required. - :paramtype severity: int - :keyword enabled: the flag that indicates whether the metric alert is enabled. Required. - :paramtype enabled: bool - :keyword scopes: the list of resource id's that this metric alert is scoped to. Required. - :paramtype scopes: list[str] - :keyword evaluation_frequency: how often the metric alert is evaluated represented in ISO 8601 - duration format. Required. - :paramtype evaluation_frequency: ~datetime.timedelta - :keyword window_size: the period of time (in ISO 8601 duration format) that is used to monitor - alert activity based on the threshold. Required. - :paramtype window_size: ~datetime.timedelta - :keyword target_resource_type: the resource type of the target resource(s) on which the alert - is created/updated. Mandatory if the scope contains a subscription, resource group, or more - than one resource. - :paramtype target_resource_type: str - :keyword target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory if the scope contains a subscription, resource group, or more than - one resource. - :paramtype target_resource_region: str - :keyword criteria: defines the specific alert criteria information. Required. - :paramtype criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :keyword auto_mitigate: the flag that indicates whether the alert should be auto resolved or - not. The default is true. - :paramtype auto_mitigate: bool - :keyword actions: the array of actions that are performed when the alert rule becomes active, - and when an alert condition is resolved. - :paramtype actions: list[~azure.mgmt.monitor.models.MetricAlertAction] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.description = description - self.severity = severity - self.enabled = enabled - self.scopes = scopes - self.evaluation_frequency = evaluation_frequency - self.window_size = window_size - self.target_resource_type = target_resource_type - self.target_resource_region = target_resource_region - self.criteria = criteria - self.auto_mitigate = auto_mitigate - self.actions = actions - self.last_updated_time = None - self.is_migrated = None - - -class MetricAlertResourceCollection(_serialization.Model): - """Represents a collection of alert rule resources. - - :ivar value: the values for the alert rule resources. - :vartype value: list[~azure.mgmt.monitor.models.MetricAlertResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MetricAlertResource]"}, - } - - def __init__(self, *, value: Optional[List["_models.MetricAlertResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: the values for the alert rule resources. - :paramtype value: list[~azure.mgmt.monitor.models.MetricAlertResource] - """ - super().__init__(**kwargs) - self.value = value - - -class MetricAlertResourcePatch(_serialization.Model): - """The metric alert resource for patch operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar description: the description of the metric alert that will be included in the alert - email. - :vartype description: str - :ivar severity: Alert severity {0, 1, 2, 3, 4}. - :vartype severity: int - :ivar enabled: the flag that indicates whether the metric alert is enabled. - :vartype enabled: bool - :ivar scopes: the list of resource id's that this metric alert is scoped to. - :vartype scopes: list[str] - :ivar evaluation_frequency: how often the metric alert is evaluated represented in ISO 8601 - duration format. - :vartype evaluation_frequency: ~datetime.timedelta - :ivar window_size: the period of time (in ISO 8601 duration format) that is used to monitor - alert activity based on the threshold. - :vartype window_size: ~datetime.timedelta - :ivar target_resource_type: the resource type of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - :vartype target_resource_type: str - :ivar target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - :vartype target_resource_region: str - :ivar criteria: defines the specific alert criteria information. - :vartype criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :ivar auto_mitigate: the flag that indicates whether the alert should be auto resolved or not. - The default is true. - :vartype auto_mitigate: bool - :ivar actions: the array of actions that are performed when the alert rule becomes active, and - when an alert condition is resolved. - :vartype actions: list[~azure.mgmt.monitor.models.MetricAlertAction] - :ivar last_updated_time: Last time the rule was updated in ISO8601 format. - :vartype last_updated_time: ~datetime.datetime - :ivar is_migrated: the value indicating whether this alert rule is migrated. - :vartype is_migrated: bool - """ - - _validation = { - "last_updated_time": {"readonly": True}, - "is_migrated": {"readonly": True}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "description": {"key": "properties.description", "type": "str"}, - "severity": {"key": "properties.severity", "type": "int"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "scopes": {"key": "properties.scopes", "type": "[str]"}, - "evaluation_frequency": {"key": "properties.evaluationFrequency", "type": "duration"}, - "window_size": {"key": "properties.windowSize", "type": "duration"}, - "target_resource_type": {"key": "properties.targetResourceType", "type": "str"}, - "target_resource_region": {"key": "properties.targetResourceRegion", "type": "str"}, - "criteria": {"key": "properties.criteria", "type": "MetricAlertCriteria"}, - "auto_mitigate": {"key": "properties.autoMitigate", "type": "bool"}, - "actions": {"key": "properties.actions", "type": "[MetricAlertAction]"}, - "last_updated_time": {"key": "properties.lastUpdatedTime", "type": "iso-8601"}, - "is_migrated": {"key": "properties.isMigrated", "type": "bool"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - description: Optional[str] = None, - severity: Optional[int] = None, - enabled: Optional[bool] = None, - scopes: Optional[List[str]] = None, - evaluation_frequency: Optional[datetime.timedelta] = None, - window_size: Optional[datetime.timedelta] = None, - target_resource_type: Optional[str] = None, - target_resource_region: Optional[str] = None, - criteria: Optional["_models.MetricAlertCriteria"] = None, - auto_mitigate: Optional[bool] = None, - actions: Optional[List["_models.MetricAlertAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword description: the description of the metric alert that will be included in the alert - email. - :paramtype description: str - :keyword severity: Alert severity {0, 1, 2, 3, 4}. - :paramtype severity: int - :keyword enabled: the flag that indicates whether the metric alert is enabled. - :paramtype enabled: bool - :keyword scopes: the list of resource id's that this metric alert is scoped to. - :paramtype scopes: list[str] - :keyword evaluation_frequency: how often the metric alert is evaluated represented in ISO 8601 - duration format. - :paramtype evaluation_frequency: ~datetime.timedelta - :keyword window_size: the period of time (in ISO 8601 duration format) that is used to monitor - alert activity based on the threshold. - :paramtype window_size: ~datetime.timedelta - :keyword target_resource_type: the resource type of the target resource(s) on which the alert - is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - :paramtype target_resource_type: str - :keyword target_resource_region: the region of the target resource(s) on which the alert is - created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - :paramtype target_resource_region: str - :keyword criteria: defines the specific alert criteria information. - :paramtype criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :keyword auto_mitigate: the flag that indicates whether the alert should be auto resolved or - not. The default is true. - :paramtype auto_mitigate: bool - :keyword actions: the array of actions that are performed when the alert rule becomes active, - and when an alert condition is resolved. - :paramtype actions: list[~azure.mgmt.monitor.models.MetricAlertAction] - """ - super().__init__(**kwargs) - self.tags = tags - self.description = description - self.severity = severity - self.enabled = enabled - self.scopes = scopes - self.evaluation_frequency = evaluation_frequency - self.window_size = window_size - self.target_resource_type = target_resource_type - self.target_resource_region = target_resource_region - self.criteria = criteria - self.auto_mitigate = auto_mitigate - self.actions = actions - self.last_updated_time = None - self.is_migrated = None - - -class MetricAlertSingleResourceMultipleMetricCriteria(MetricAlertCriteria): # pylint: disable=name-too-long - """Specifies the metric alert criteria for a single resource that has multiple metric criteria. - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar odata_type: specifies the type of the alert criteria. Required. Known values are: - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", and - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria". - :vartype odata_type: str or ~azure.mgmt.monitor.models.Odatatype - :ivar all_of: The list of metric criteria for this 'all of' operation. - :vartype all_of: list[~azure.mgmt.monitor.models.MetricCriteria] - """ - - _validation = { - "odata_type": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "odata_type": {"key": "odata\\.type", "type": "str"}, - "all_of": {"key": "allOf", "type": "[MetricCriteria]"}, - } - - def __init__( - self, - *, - additional_properties: Optional[Dict[str, JSON]] = None, - all_of: Optional[List["_models.MetricCriteria"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword all_of: The list of metric criteria for this 'all of' operation. - :paramtype all_of: list[~azure.mgmt.monitor.models.MetricCriteria] - """ - super().__init__(additional_properties=additional_properties, **kwargs) - self.odata_type: str = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - self.all_of = all_of - - -class MetricAlertStatus(_serialization.Model): - """An alert status. - - :ivar name: The status name. - :vartype name: str - :ivar id: The alert rule arm id. - :vartype id: str - :ivar type: The extended resource type name. - :vartype type: str - :ivar properties: The alert status properties of the metric alert status. - :vartype properties: ~azure.mgmt.monitor.models.MetricAlertStatusProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "MetricAlertStatusProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - properties: Optional["_models.MetricAlertStatusProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The status name. - :paramtype name: str - :keyword id: The alert rule arm id. - :paramtype id: str - :keyword type: The extended resource type name. - :paramtype type: str - :keyword properties: The alert status properties of the metric alert status. - :paramtype properties: ~azure.mgmt.monitor.models.MetricAlertStatusProperties - """ - super().__init__(**kwargs) - self.name = name - self.id = id - self.type = type - self.properties = properties - - -class MetricAlertStatusCollection(_serialization.Model): - """Represents a collection of alert rule resources. - - :ivar value: the values for the alert rule resources. - :vartype value: list[~azure.mgmt.monitor.models.MetricAlertStatus] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MetricAlertStatus]"}, - } - - def __init__(self, *, value: Optional[List["_models.MetricAlertStatus"]] = None, **kwargs: Any) -> None: - """ - :keyword value: the values for the alert rule resources. - :paramtype value: list[~azure.mgmt.monitor.models.MetricAlertStatus] - """ - super().__init__(**kwargs) - self.value = value - - -class MetricAlertStatusProperties(_serialization.Model): - """An alert status properties. - - :ivar dimensions: An object describing the type of the dimensions. - :vartype dimensions: dict[str, str] - :ivar status: status value. - :vartype status: str - :ivar timestamp: UTC time when the status was checked. - :vartype timestamp: ~datetime.datetime - """ - - _attribute_map = { - "dimensions": {"key": "dimensions", "type": "{str}"}, - "status": {"key": "status", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - } - - def __init__( - self, - *, - dimensions: Optional[Dict[str, str]] = None, - status: Optional[str] = None, - timestamp: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword dimensions: An object describing the type of the dimensions. - :paramtype dimensions: dict[str, str] - :keyword status: status value. - :paramtype status: str - :keyword timestamp: UTC time when the status was checked. - :paramtype timestamp: ~datetime.datetime - """ - super().__init__(**kwargs) - self.dimensions = dimensions - self.status = status - self.timestamp = timestamp - - -class MetricAvailability(_serialization.Model): - """Metric availability specifies the time grain (aggregation interval or frequency) and the - retention period for that time grain. - - :ivar time_grain: the time grain specifies the aggregation interval for the metric. Expressed - as a duration 'PT1M', 'P1D', etc. - :vartype time_grain: ~datetime.timedelta - :ivar retention: the retention period for the metric at the specified timegrain. Expressed as - a duration 'PT1M', 'P1D', etc. - :vartype retention: ~datetime.timedelta - """ - - _attribute_map = { - "time_grain": {"key": "timeGrain", "type": "duration"}, - "retention": {"key": "retention", "type": "duration"}, - } - - def __init__( - self, - *, - time_grain: Optional[datetime.timedelta] = None, - retention: Optional[datetime.timedelta] = None, - **kwargs: Any - ) -> None: - """ - :keyword time_grain: the time grain specifies the aggregation interval for the metric. - Expressed as a duration 'PT1M', 'P1D', etc. - :paramtype time_grain: ~datetime.timedelta - :keyword retention: the retention period for the metric at the specified timegrain. Expressed - as a duration 'PT1M', 'P1D', etc. - :paramtype retention: ~datetime.timedelta - """ - super().__init__(**kwargs) - self.time_grain = time_grain - self.retention = retention - - -class MetricBaselinesResponse(_serialization.Model): - """A list of metric baselines. - - :ivar value: The list of metric baselines. - :vartype value: list[~azure.mgmt.monitor.models.SingleMetricBaseline] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SingleMetricBaseline]"}, - } - - def __init__(self, *, value: Optional[List["_models.SingleMetricBaseline"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of metric baselines. - :paramtype value: list[~azure.mgmt.monitor.models.SingleMetricBaseline] - """ - super().__init__(**kwargs) - self.value = value - - -class MetricCriteria(MultiMetricCriteria): - """Criterion to filter metrics. - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar criterion_type: Specifies the type of threshold criteria. Required. Known values are: - "StaticThresholdCriterion" and "DynamicThresholdCriterion". - :vartype criterion_type: str or ~azure.mgmt.monitor.models.CriterionType - :ivar name: Name of the criteria. Required. - :vartype name: str - :ivar metric_name: Name of the metric. Required. - :vartype metric_name: str - :ivar metric_namespace: Namespace of the metric. - :vartype metric_namespace: str - :ivar time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :vartype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :ivar dimensions: List of dimension conditions. - :vartype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :ivar skip_metric_validation: Allows creating an alert rule on a custom metric that isn't yet - emitted, by causing the metric validation to be skipped. - :vartype skip_metric_validation: bool - :ivar operator: the criteria operator. Required. Known values are: "Equals", "GreaterThan", - "GreaterThanOrEqual", "LessThan", "LessThanOrEqual", and "Include". - :vartype operator: str or ~azure.mgmt.monitor.models.Operator - :ivar threshold: the criteria threshold value that activates the alert. Required. - :vartype threshold: float - """ - - _validation = { - "criterion_type": {"required": True}, - "name": {"required": True}, - "metric_name": {"required": True}, - "time_aggregation": {"required": True}, - "operator": {"required": True}, - "threshold": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "criterion_type": {"key": "criterionType", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "metric_namespace": {"key": "metricNamespace", "type": "str"}, - "time_aggregation": {"key": "timeAggregation", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricDimension]"}, - "skip_metric_validation": {"key": "skipMetricValidation", "type": "bool"}, - "operator": {"key": "operator", "type": "str"}, - "threshold": {"key": "threshold", "type": "float"}, - } - - def __init__( - self, - *, - name: str, - metric_name: str, - time_aggregation: Union[str, "_models.AggregationTypeEnum"], - operator: Union[str, "_models.Operator"], - threshold: float, - additional_properties: Optional[Dict[str, JSON]] = None, - metric_namespace: Optional[str] = None, - dimensions: Optional[List["_models.MetricDimension"]] = None, - skip_metric_validation: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword name: Name of the criteria. Required. - :paramtype name: str - :keyword metric_name: Name of the metric. Required. - :paramtype metric_name: str - :keyword metric_namespace: Namespace of the metric. - :paramtype metric_namespace: str - :keyword time_aggregation: the criteria time aggregation types. Required. Known values are: - "Average", "Count", "Minimum", "Maximum", and "Total". - :paramtype time_aggregation: str or ~azure.mgmt.monitor.models.AggregationTypeEnum - :keyword dimensions: List of dimension conditions. - :paramtype dimensions: list[~azure.mgmt.monitor.models.MetricDimension] - :keyword skip_metric_validation: Allows creating an alert rule on a custom metric that isn't - yet emitted, by causing the metric validation to be skipped. - :paramtype skip_metric_validation: bool - :keyword operator: the criteria operator. Required. Known values are: "Equals", "GreaterThan", - "GreaterThanOrEqual", "LessThan", "LessThanOrEqual", and "Include". - :paramtype operator: str or ~azure.mgmt.monitor.models.Operator - :keyword threshold: the criteria threshold value that activates the alert. Required. - :paramtype threshold: float - """ - super().__init__( - additional_properties=additional_properties, - name=name, - metric_name=metric_name, - metric_namespace=metric_namespace, - time_aggregation=time_aggregation, - dimensions=dimensions, - skip_metric_validation=skip_metric_validation, - **kwargs - ) - self.criterion_type: str = "StaticThresholdCriterion" - self.operator = operator - self.threshold = threshold - - -class MetricDefinition(_serialization.Model): - """Metric definition class specifies the metadata for a metric. - - :ivar is_dimension_required: Flag to indicate whether the dimension is required. - :vartype is_dimension_required: bool - :ivar resource_id: the resource identifier of the resource that emitted the metric. - :vartype resource_id: str - :ivar namespace: the namespace the metric belongs to. - :vartype namespace: str - :ivar name: the name and the display name of the metric, i.e. it is a localizable string. - :vartype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :ivar display_description: Detailed description of this metric. - :vartype display_description: str - :ivar category: Custom category name for this metric. - :vartype category: str - :ivar metric_class: The class of the metric. Known values are: "Availability", "Transactions", - "Errors", "Latency", and "Saturation". - :vartype metric_class: str or ~azure.mgmt.monitor.models.MetricClass - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", - "Cores", "MilliCores", "NanoCores", and "BitsPerSecond". - :vartype unit: str or ~azure.mgmt.monitor.models.MetricUnit - :ivar primary_aggregation_type: the primary aggregation type value defining how to use the - values for display. Known values are: "None", "Average", "Count", "Minimum", "Maximum", and - "Total". - :vartype primary_aggregation_type: str or ~azure.mgmt.monitor.models.AggregationType - :ivar supported_aggregation_types: the collection of what aggregation types are supported. - :vartype supported_aggregation_types: list[str or ~azure.mgmt.monitor.models.AggregationType] - :ivar metric_availabilities: the collection of what aggregation intervals are available to be - queried. - :vartype metric_availabilities: list[~azure.mgmt.monitor.models.MetricAvailability] - :ivar id: the resource identifier of the metric definition. - :vartype id: str - :ivar dimensions: the name and the display name of the dimension, i.e. it is a localizable - string. - :vartype dimensions: list[~azure.mgmt.monitor.models.LocalizableStringAutoGenerated] - """ - - _attribute_map = { - "is_dimension_required": {"key": "isDimensionRequired", "type": "bool"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "namespace": {"key": "namespace", "type": "str"}, - "name": {"key": "name", "type": "LocalizableStringAutoGenerated"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "metric_class": {"key": "metricClass", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "primary_aggregation_type": {"key": "primaryAggregationType", "type": "str"}, - "supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"}, - "metric_availabilities": {"key": "metricAvailabilities", "type": "[MetricAvailability]"}, - "id": {"key": "id", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[LocalizableStringAutoGenerated]"}, - } - - def __init__( - self, - *, - is_dimension_required: Optional[bool] = None, - resource_id: Optional[str] = None, - namespace: Optional[str] = None, - name: Optional["_models.LocalizableStringAutoGenerated"] = None, - display_description: Optional[str] = None, - category: Optional[str] = None, - metric_class: Optional[Union[str, "_models.MetricClass"]] = None, - unit: Optional[Union[str, "_models.MetricUnit"]] = None, - primary_aggregation_type: Optional[Union[str, "_models.AggregationType"]] = None, - supported_aggregation_types: Optional[List[Union[str, "_models.AggregationType"]]] = None, - metric_availabilities: Optional[List["_models.MetricAvailability"]] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - dimensions: Optional[List["_models.LocalizableStringAutoGenerated"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_dimension_required: Flag to indicate whether the dimension is required. - :paramtype is_dimension_required: bool - :keyword resource_id: the resource identifier of the resource that emitted the metric. - :paramtype resource_id: str - :keyword namespace: the namespace the metric belongs to. - :paramtype namespace: str - :keyword name: the name and the display name of the metric, i.e. it is a localizable string. - :paramtype name: ~azure.mgmt.monitor.models.LocalizableStringAutoGenerated - :keyword display_description: Detailed description of this metric. - :paramtype display_description: str - :keyword category: Custom category name for this metric. - :paramtype category: str - :keyword metric_class: The class of the metric. Known values are: "Availability", - "Transactions", "Errors", "Latency", and "Saturation". - :paramtype metric_class: str or ~azure.mgmt.monitor.models.MetricClass - :keyword unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", - "CountPerSecond", "BytesPerSecond", "Percent", "MilliSeconds", "ByteSeconds", "Unspecified", - "Cores", "MilliCores", "NanoCores", and "BitsPerSecond". - :paramtype unit: str or ~azure.mgmt.monitor.models.MetricUnit - :keyword primary_aggregation_type: the primary aggregation type value defining how to use the - values for display. Known values are: "None", "Average", "Count", "Minimum", "Maximum", and - "Total". - :paramtype primary_aggregation_type: str or ~azure.mgmt.monitor.models.AggregationType - :keyword supported_aggregation_types: the collection of what aggregation types are supported. - :paramtype supported_aggregation_types: list[str or ~azure.mgmt.monitor.models.AggregationType] - :keyword metric_availabilities: the collection of what aggregation intervals are available to - be queried. - :paramtype metric_availabilities: list[~azure.mgmt.monitor.models.MetricAvailability] - :keyword id: the resource identifier of the metric definition. - :paramtype id: str - :keyword dimensions: the name and the display name of the dimension, i.e. it is a localizable - string. - :paramtype dimensions: list[~azure.mgmt.monitor.models.LocalizableStringAutoGenerated] - """ - super().__init__(**kwargs) - self.is_dimension_required = is_dimension_required - self.resource_id = resource_id - self.namespace = namespace - self.name = name - self.display_description = display_description - self.category = category - self.metric_class = metric_class - self.unit = unit - self.primary_aggregation_type = primary_aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.metric_availabilities = metric_availabilities - self.id = id - self.dimensions = dimensions - - -class MetricDefinitionCollection(_serialization.Model): - """Represents collection of metric definitions. - - All required parameters must be populated in order to send to server. - - :ivar value: the values for the metric definitions. Required. - :vartype value: list[~azure.mgmt.monitor.models.MetricDefinition] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[MetricDefinition]"}, - } - - def __init__(self, *, value: List["_models.MetricDefinition"], **kwargs: Any) -> None: - """ - :keyword value: the values for the metric definitions. Required. - :paramtype value: list[~azure.mgmt.monitor.models.MetricDefinition] - """ - super().__init__(**kwargs) - self.value = value - - -class MetricDimension(_serialization.Model): - """Specifies a metric dimension. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the dimension. Required. - :vartype name: str - :ivar operator: the dimension operator. Only 'Include' and 'Exclude' are supported. Required. - :vartype operator: str - :ivar values: list of dimension values. Required. - :vartype values: list[str] - """ - - _validation = { - "name": {"required": True}, - "operator": {"required": True}, - "values": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "values": {"key": "values", "type": "[str]"}, - } - - def __init__(self, *, name: str, operator: str, values: List[str], **kwargs: Any) -> None: - """ - :keyword name: Name of the dimension. Required. - :paramtype name: str - :keyword operator: the dimension operator. Only 'Include' and 'Exclude' are supported. - Required. - :paramtype operator: str - :keyword values: list of dimension values. Required. - :paramtype values: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.operator = operator - self.values = values - - -class MetricNamespace(_serialization.Model): - """Metric namespace class specifies the metadata for a metric namespace. - - :ivar id: The ID of the metric namespace. - :vartype id: str - :ivar type: The type of the namespace. - :vartype type: str - :ivar name: The escaped name of the namespace. - :vartype name: str - :ivar classification: Kind of namespace. Known values are: "Platform", "Custom", and "Qos". - :vartype classification: str or ~azure.mgmt.monitor.models.NamespaceClassification - :ivar properties: Properties which include the fully qualified namespace name. - :vartype properties: ~azure.mgmt.monitor.models.MetricNamespaceName - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "classification": {"key": "classification", "type": "str"}, - "properties": {"key": "properties", "type": "MetricNamespaceName"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - name: Optional[str] = None, - classification: Optional[Union[str, "_models.NamespaceClassification"]] = None, - properties: Optional["_models.MetricNamespaceName"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ID of the metric namespace. - :paramtype id: str - :keyword type: The type of the namespace. - :paramtype type: str - :keyword name: The escaped name of the namespace. - :paramtype name: str - :keyword classification: Kind of namespace. Known values are: "Platform", "Custom", and "Qos". - :paramtype classification: str or ~azure.mgmt.monitor.models.NamespaceClassification - :keyword properties: Properties which include the fully qualified namespace name. - :paramtype properties: ~azure.mgmt.monitor.models.MetricNamespaceName - """ - super().__init__(**kwargs) - self.id = id - self.type = type - self.name = name - self.classification = classification - self.properties = properties - - -class MetricNamespaceCollection(_serialization.Model): - """Represents collection of metric namespaces. - - All required parameters must be populated in order to send to server. - - :ivar value: The values for the metric namespaces. Required. - :vartype value: list[~azure.mgmt.monitor.models.MetricNamespace] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[MetricNamespace]"}, - } - - def __init__(self, *, value: List["_models.MetricNamespace"], **kwargs: Any) -> None: - """ - :keyword value: The values for the metric namespaces. Required. - :paramtype value: list[~azure.mgmt.monitor.models.MetricNamespace] - """ - super().__init__(**kwargs) - self.value = value - - -class MetricNamespaceName(_serialization.Model): - """The fully qualified metric namespace name. - - :ivar metric_namespace_name: The metric namespace name. - :vartype metric_namespace_name: str - """ - - _attribute_map = { - "metric_namespace_name": {"key": "metricNamespaceName", "type": "str"}, - } - - def __init__(self, *, metric_namespace_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword metric_namespace_name: The metric namespace name. - :paramtype metric_namespace_name: str - """ - super().__init__(**kwargs) - self.metric_namespace_name = metric_namespace_name - - -class MetricSettings(_serialization.Model): - """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. - - All required parameters must be populated in order to send to server. - - :ivar time_grain: the timegrain of the metric in ISO8601 format. - :vartype time_grain: ~datetime.timedelta - :ivar category: Name of a Diagnostic Metric category for a resource type this setting is - applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a - GET diagnostic settings operation. - :vartype category: str - :ivar enabled: a value indicating whether this category is enabled. Required. - :vartype enabled: bool - :ivar retention_policy: the retention policy for this category. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _validation = { - "enabled": {"required": True}, - } - - _attribute_map = { - "time_grain": {"key": "timeGrain", "type": "duration"}, - "category": {"key": "category", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - enabled: bool, - time_grain: Optional[datetime.timedelta] = None, - category: Optional[str] = None, - retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword time_grain: the timegrain of the metric in ISO8601 format. - :paramtype time_grain: ~datetime.timedelta - :keyword category: Name of a Diagnostic Metric category for a resource type this setting is - applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a - GET diagnostic settings operation. - :paramtype category: str - :keyword enabled: a value indicating whether this category is enabled. Required. - :paramtype enabled: bool - :keyword retention_policy: the retention policy for this category. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(**kwargs) - self.time_grain = time_grain - self.category = category - self.enabled = enabled - self.retention_policy = retention_policy - - -class MetricSettingsAutoGenerated(_serialization.Model): - """Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. - - All required parameters must be populated in order to send to server. - - :ivar time_grain: the timegrain of the metric in ISO8601 format. Required. - :vartype time_grain: ~datetime.timedelta - :ivar enabled: a value indicating whether this timegrain is enabled. Required. - :vartype enabled: bool - :ivar retention_policy: the retention policy for this timegrain. - :vartype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - - _validation = { - "time_grain": {"required": True}, - "enabled": {"required": True}, - } - - _attribute_map = { - "time_grain": {"key": "timeGrain", "type": "duration"}, - "enabled": {"key": "enabled", "type": "bool"}, - "retention_policy": {"key": "retentionPolicy", "type": "RetentionPolicy"}, - } - - def __init__( - self, - *, - time_grain: datetime.timedelta, - enabled: bool, - retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword time_grain: the timegrain of the metric in ISO8601 format. Required. - :paramtype time_grain: ~datetime.timedelta - :keyword enabled: a value indicating whether this timegrain is enabled. Required. - :paramtype enabled: bool - :keyword retention_policy: the retention policy for this timegrain. - :paramtype retention_policy: ~azure.mgmt.monitor.models.RetentionPolicy - """ - super().__init__(**kwargs) - self.time_grain = time_grain - self.enabled = enabled - self.retention_policy = retention_policy - - -class MetricSingleDimension(_serialization.Model): - """The metric dimension name and value. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the dimension. Required. - :vartype name: str - :ivar value: Value of the dimension. 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 dimension. Required. - :paramtype name: str - :keyword value: Value of the dimension. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class MetricTrigger(_serialization.Model): - """The trigger that results in a scaling action. - - All required parameters must be populated in order to send to server. - - :ivar metric_name: the name of the metric that defines what the rule monitors. Required. - :vartype metric_name: str - :ivar metric_namespace: the namespace of the metric that defines what the rule monitors. - :vartype metric_namespace: str - :ivar metric_resource_uri: the resource identifier of the resource the rule monitors. Required. - :vartype metric_resource_uri: str - :ivar metric_resource_location: the location of the resource the rule monitors. - :vartype metric_resource_location: str - :ivar time_grain: the granularity of metrics the rule monitors. Must be one of the predefined - values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. - Required. - :vartype time_grain: ~datetime.timedelta - :ivar statistic: the metric statistic type. How the metrics from multiple instances are - combined. Required. Known values are: "Average", "Min", "Max", "Sum", and "Count". - :vartype statistic: str or ~azure.mgmt.monitor.models.MetricStatisticType - :ivar time_window: the range of time in which instance data is collected. This value must be - greater than the delay in metric collection, which can vary from resource-to-resource. Must be - between 12 hours and 5 minutes. Required. - :vartype time_window: ~datetime.timedelta - :ivar time_aggregation: time aggregation type. How the data that is collected should be - combined over time. The default value is Average. Required. Known values are: "Average", - "Minimum", "Maximum", "Total", "Count", and "Last". - :vartype time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregationType - :ivar operator: the operator that is used to compare the metric data and the threshold. - Required. Known values are: "Equals", "NotEquals", "GreaterThan", "GreaterThanOrEqual", - "LessThan", and "LessThanOrEqual". - :vartype operator: str or ~azure.mgmt.monitor.models.ComparisonOperationType - :ivar threshold: the threshold of the metric that triggers the scale action. Required. - :vartype threshold: float - :ivar dimensions: List of dimension conditions. For example: - [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. # pylint: disable=line-too-long - :vartype dimensions: list[~azure.mgmt.monitor.models.ScaleRuleMetricDimension] - :ivar divide_per_instance: a value indicating whether metric should divide per instance. - :vartype divide_per_instance: bool - """ - - _validation = { - "metric_name": {"required": True}, - "metric_resource_uri": {"required": True}, - "time_grain": {"required": True}, - "statistic": {"required": True}, - "time_window": {"required": True}, - "time_aggregation": {"required": True}, - "operator": {"required": True}, - "threshold": {"required": True}, - } - - _attribute_map = { - "metric_name": {"key": "metricName", "type": "str"}, - "metric_namespace": {"key": "metricNamespace", "type": "str"}, - "metric_resource_uri": {"key": "metricResourceUri", "type": "str"}, - "metric_resource_location": {"key": "metricResourceLocation", "type": "str"}, - "time_grain": {"key": "timeGrain", "type": "duration"}, - "statistic": {"key": "statistic", "type": "str"}, - "time_window": {"key": "timeWindow", "type": "duration"}, - "time_aggregation": {"key": "timeAggregation", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "threshold": {"key": "threshold", "type": "float"}, - "dimensions": {"key": "dimensions", "type": "[ScaleRuleMetricDimension]"}, - "divide_per_instance": {"key": "dividePerInstance", "type": "bool"}, - } - - def __init__( - self, - *, - metric_name: str, - metric_resource_uri: str, - time_grain: datetime.timedelta, - statistic: Union[str, "_models.MetricStatisticType"], - time_window: datetime.timedelta, - time_aggregation: Union[str, "_models.TimeAggregationType"], - operator: Union[str, "_models.ComparisonOperationType"], - threshold: float, - metric_namespace: Optional[str] = None, - metric_resource_location: Optional[str] = None, - dimensions: Optional[List["_models.ScaleRuleMetricDimension"]] = None, - divide_per_instance: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword metric_name: the name of the metric that defines what the rule monitors. Required. - :paramtype metric_name: str - :keyword metric_namespace: the namespace of the metric that defines what the rule monitors. - :paramtype metric_namespace: str - :keyword metric_resource_uri: the resource identifier of the resource the rule monitors. - Required. - :paramtype metric_resource_uri: str - :keyword metric_resource_location: the location of the resource the rule monitors. - :paramtype metric_resource_location: str - :keyword time_grain: the granularity of metrics the rule monitors. Must be one of the - predefined values returned from metric definitions for the metric. Must be between 12 hours and - 1 minute. Required. - :paramtype time_grain: ~datetime.timedelta - :keyword statistic: the metric statistic type. How the metrics from multiple instances are - combined. Required. Known values are: "Average", "Min", "Max", "Sum", and "Count". - :paramtype statistic: str or ~azure.mgmt.monitor.models.MetricStatisticType - :keyword time_window: the range of time in which instance data is collected. This value must be - greater than the delay in metric collection, which can vary from resource-to-resource. Must be - between 12 hours and 5 minutes. Required. - :paramtype time_window: ~datetime.timedelta - :keyword time_aggregation: time aggregation type. How the data that is collected should be - combined over time. The default value is Average. Required. Known values are: "Average", - "Minimum", "Maximum", "Total", "Count", and "Last". - :paramtype time_aggregation: str or ~azure.mgmt.monitor.models.TimeAggregationType - :keyword operator: the operator that is used to compare the metric data and the threshold. - Required. Known values are: "Equals", "NotEquals", "GreaterThan", "GreaterThanOrEqual", - "LessThan", and "LessThanOrEqual". - :paramtype operator: str or ~azure.mgmt.monitor.models.ComparisonOperationType - :keyword threshold: the threshold of the metric that triggers the scale action. Required. - :paramtype threshold: float - :keyword dimensions: List of dimension conditions. For example: - [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. # pylint: disable=line-too-long - :paramtype dimensions: list[~azure.mgmt.monitor.models.ScaleRuleMetricDimension] - :keyword divide_per_instance: a value indicating whether metric should divide per instance. - :paramtype divide_per_instance: bool - """ - super().__init__(**kwargs) - self.metric_name = metric_name - self.metric_namespace = metric_namespace - self.metric_resource_uri = metric_resource_uri - self.metric_resource_location = metric_resource_location - self.time_grain = time_grain - self.statistic = statistic - self.time_window = time_window - self.time_aggregation = time_aggregation - self.operator = operator - self.threshold = threshold - self.dimensions = dimensions - self.divide_per_instance = divide_per_instance - - -class MetricValue(_serialization.Model): - """Represents a metric value. - - All required parameters must be populated in order to send to server. - - :ivar time_stamp: The timestamp for the metric value in ISO 8601 format. Required. - :vartype time_stamp: ~datetime.datetime - :ivar average: The average value in the time range. - :vartype average: float - :ivar minimum: The least value in the time range. - :vartype minimum: float - :ivar maximum: The greatest value in the time range. - :vartype maximum: float - :ivar total: The sum of all of the values in the time range. - :vartype total: float - :ivar count: The number of samples in the time range. Can be used to determine the number of - values that contributed to the average value. - :vartype count: float - """ - - _validation = { - "time_stamp": {"required": True}, - } - - _attribute_map = { - "time_stamp": {"key": "timeStamp", "type": "iso-8601"}, - "average": {"key": "average", "type": "float"}, - "minimum": {"key": "minimum", "type": "float"}, - "maximum": {"key": "maximum", "type": "float"}, - "total": {"key": "total", "type": "float"}, - "count": {"key": "count", "type": "float"}, - } - - def __init__( - self, - *, - time_stamp: datetime.datetime, - average: Optional[float] = None, - minimum: Optional[float] = None, - maximum: Optional[float] = None, - total: Optional[float] = None, - count: Optional[float] = None, - **kwargs: Any - ) -> None: - """ - :keyword time_stamp: The timestamp for the metric value in ISO 8601 format. Required. - :paramtype time_stamp: ~datetime.datetime - :keyword average: The average value in the time range. - :paramtype average: float - :keyword minimum: The least value in the time range. - :paramtype minimum: float - :keyword maximum: The greatest value in the time range. - :paramtype maximum: float - :keyword total: The sum of all of the values in the time range. - :paramtype total: float - :keyword count: The number of samples in the time range. Can be used to determine the number of - values that contributed to the average value. - :paramtype count: float - """ - super().__init__(**kwargs) - self.time_stamp = time_stamp - self.average = average - self.minimum = minimum - self.maximum = maximum - self.total = total - self.count = count - - -class NotificationRequestBody(_serialization.Model): - """The request body which contain contact detail metadata. - - All required parameters must be populated in order to send to server. - - :ivar alert_type: The value of the supported alert type. Supported alert type values are: - servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, - webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, - actualcostbudget, forecastedbudget. Required. - :vartype alert_type: str - :ivar email_receivers: The list of email receivers that are part of this action group. - :vartype email_receivers: list[~azure.mgmt.monitor.models.EmailReceiver] - :ivar sms_receivers: The list of SMS receivers that are part of this action group. - :vartype sms_receivers: list[~azure.mgmt.monitor.models.SmsReceiver] - :ivar webhook_receivers: The list of webhook receivers that are part of this action group. - :vartype webhook_receivers: list[~azure.mgmt.monitor.models.WebhookReceiver] - :ivar itsm_receivers: The list of ITSM receivers that are part of this action group. - :vartype itsm_receivers: list[~azure.mgmt.monitor.models.ItsmReceiver] - :ivar azure_app_push_receivers: The list of AzureAppPush receivers that are part of this action - group. - :vartype azure_app_push_receivers: list[~azure.mgmt.monitor.models.AzureAppPushReceiver] - :ivar automation_runbook_receivers: The list of AutomationRunbook receivers that are part of - this action group. - :vartype automation_runbook_receivers: - list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] - :ivar voice_receivers: The list of voice receivers that are part of this action group. - :vartype voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] - :ivar logic_app_receivers: The list of logic app receivers that are part of this action group. - :vartype logic_app_receivers: list[~azure.mgmt.monitor.models.LogicAppReceiver] - :ivar azure_function_receivers: The list of azure function receivers that are part of this - action group. - :vartype azure_function_receivers: list[~azure.mgmt.monitor.models.AzureFunctionReceiver] - :ivar arm_role_receivers: The list of ARM role receivers that are part of this action group. - Roles are Azure RBAC roles and only built-in roles are supported. - :vartype arm_role_receivers: list[~azure.mgmt.monitor.models.ArmRoleReceiver] - :ivar event_hub_receivers: The list of event hub receivers that are part of this action group. - :vartype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] - """ - - _validation = { - "alert_type": {"required": True, "max_length": 30}, - } - - _attribute_map = { - "alert_type": {"key": "alertType", "type": "str"}, - "email_receivers": {"key": "emailReceivers", "type": "[EmailReceiver]"}, - "sms_receivers": {"key": "smsReceivers", "type": "[SmsReceiver]"}, - "webhook_receivers": {"key": "webhookReceivers", "type": "[WebhookReceiver]"}, - "itsm_receivers": {"key": "itsmReceivers", "type": "[ItsmReceiver]"}, - "azure_app_push_receivers": {"key": "azureAppPushReceivers", "type": "[AzureAppPushReceiver]"}, - "automation_runbook_receivers": {"key": "automationRunbookReceivers", "type": "[AutomationRunbookReceiver]"}, - "voice_receivers": {"key": "voiceReceivers", "type": "[VoiceReceiver]"}, - "logic_app_receivers": {"key": "logicAppReceivers", "type": "[LogicAppReceiver]"}, - "azure_function_receivers": {"key": "azureFunctionReceivers", "type": "[AzureFunctionReceiver]"}, - "arm_role_receivers": {"key": "armRoleReceivers", "type": "[ArmRoleReceiver]"}, - "event_hub_receivers": {"key": "eventHubReceivers", "type": "[EventHubReceiver]"}, - } - - def __init__( - self, - *, - alert_type: str, - email_receivers: Optional[List["_models.EmailReceiver"]] = None, - sms_receivers: Optional[List["_models.SmsReceiver"]] = None, - webhook_receivers: Optional[List["_models.WebhookReceiver"]] = None, - itsm_receivers: Optional[List["_models.ItsmReceiver"]] = None, - azure_app_push_receivers: Optional[List["_models.AzureAppPushReceiver"]] = None, - automation_runbook_receivers: Optional[List["_models.AutomationRunbookReceiver"]] = None, - voice_receivers: Optional[List["_models.VoiceReceiver"]] = None, - logic_app_receivers: Optional[List["_models.LogicAppReceiver"]] = None, - azure_function_receivers: Optional[List["_models.AzureFunctionReceiver"]] = None, - arm_role_receivers: Optional[List["_models.ArmRoleReceiver"]] = None, - event_hub_receivers: Optional[List["_models.EventHubReceiver"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword alert_type: The value of the supported alert type. Supported alert type values are: - servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, - webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, - actualcostbudget, forecastedbudget. Required. - :paramtype alert_type: str - :keyword email_receivers: The list of email receivers that are part of this action group. - :paramtype email_receivers: list[~azure.mgmt.monitor.models.EmailReceiver] - :keyword sms_receivers: The list of SMS receivers that are part of this action group. - :paramtype sms_receivers: list[~azure.mgmt.monitor.models.SmsReceiver] - :keyword webhook_receivers: The list of webhook receivers that are part of this action group. - :paramtype webhook_receivers: list[~azure.mgmt.monitor.models.WebhookReceiver] - :keyword itsm_receivers: The list of ITSM receivers that are part of this action group. - :paramtype itsm_receivers: list[~azure.mgmt.monitor.models.ItsmReceiver] - :keyword azure_app_push_receivers: The list of AzureAppPush receivers that are part of this - action group. - :paramtype azure_app_push_receivers: list[~azure.mgmt.monitor.models.AzureAppPushReceiver] - :keyword automation_runbook_receivers: The list of AutomationRunbook receivers that are part of - this action group. - :paramtype automation_runbook_receivers: - list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] - :keyword voice_receivers: The list of voice receivers that are part of this action group. - :paramtype voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] - :keyword logic_app_receivers: The list of logic app receivers that are part of this action - group. - :paramtype logic_app_receivers: list[~azure.mgmt.monitor.models.LogicAppReceiver] - :keyword azure_function_receivers: The list of azure function receivers that are part of this - action group. - :paramtype azure_function_receivers: list[~azure.mgmt.monitor.models.AzureFunctionReceiver] - :keyword arm_role_receivers: The list of ARM role receivers that are part of this action group. - Roles are Azure RBAC roles and only built-in roles are supported. - :paramtype arm_role_receivers: list[~azure.mgmt.monitor.models.ArmRoleReceiver] - :keyword event_hub_receivers: The list of event hub receivers that are part of this action - group. - :paramtype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] - """ - super().__init__(**kwargs) - self.alert_type = alert_type - self.email_receivers = email_receivers - self.sms_receivers = sms_receivers - self.webhook_receivers = webhook_receivers - self.itsm_receivers = itsm_receivers - self.azure_app_push_receivers = azure_app_push_receivers - self.automation_runbook_receivers = automation_runbook_receivers - self.voice_receivers = voice_receivers - self.logic_app_receivers = logic_app_receivers - self.azure_function_receivers = azure_function_receivers - self.arm_role_receivers = arm_role_receivers - self.event_hub_receivers = event_hub_receivers - - -class Operation(_serialization.Model): - """Microsoft Insights API operation definition. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Display metadata associated with the operation. - :vartype display: ~azure.mgmt.monitor.models.OperationDisplay - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__( - self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display metadata associated with the operation. - :paramtype display: ~azure.mgmt.monitor.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """Display metadata associated with the operation. - - :ivar provider: Service provider: Microsoft.Insights. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: AlertRules, Autoscale, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Microsoft.Insights. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: AlertRules, Autoscale, etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - - -class OperationListResult(_serialization.Model): - """Result of the request to list Microsoft.Insights operations. It contains a list of operations - and a URL link to get the next set of results. - - :ivar value: List of operations supported by the Microsoft.Insights provider. - :vartype value: list[~azure.mgmt.monitor.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of operations supported by the Microsoft.Insights provider. - :paramtype value: list[~azure.mgmt.monitor.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationStatus(_serialization.Model): - """The status of operation. - - :ivar id: The operation Id. - :vartype id: str - :ivar name: The operation name. - :vartype name: str - :ivar start_time: Start time of the job in standard ISO8601 format. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the job in standard ISO8601 format. - :vartype end_time: ~datetime.datetime - :ivar status: The status of the operation. - :vartype status: str - :ivar error: The error detail of the operation if any. - :vartype error: ~azure.mgmt.monitor.models.ErrorResponseCommon - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "status": {"key": "status", "type": "str"}, - "error": {"key": "error", "type": "ErrorResponseCommon"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - status: Optional[str] = None, - error: Optional["_models.ErrorResponseCommon"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The operation Id. - :paramtype id: str - :keyword name: The operation name. - :paramtype name: str - :keyword start_time: Start time of the job in standard ISO8601 format. - :paramtype start_time: ~datetime.datetime - :keyword end_time: End time of the job in standard ISO8601 format. - :paramtype end_time: ~datetime.datetime - :keyword status: The status of the operation. - :paramtype status: str - :keyword error: The error detail of the operation if any. - :paramtype error: ~azure.mgmt.monitor.models.ErrorResponseCommon - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.start_time = start_time - self.end_time = end_time - self.status = status - self.error = error - - -class PerformanceCounterConfiguration(_serialization.Model): - """PerformanceCounterConfiguration. - - All required parameters must be populated in order to send to server. - - :ivar name: Required. - :vartype name: str - :ivar sampling_period: Required. - :vartype sampling_period: str - :ivar instance: - :vartype instance: str - """ - - _validation = { - "name": {"required": True}, - "sampling_period": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "sampling_period": {"key": "samplingPeriod", "type": "str"}, - "instance": {"key": "instance", "type": "str"}, - } - - def __init__(self, *, name: str, sampling_period: str, instance: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Required. - :paramtype name: str - :keyword sampling_period: Required. - :paramtype sampling_period: str - :keyword instance: - :paramtype instance: str - """ - super().__init__(**kwargs) - self.name = name - self.sampling_period = sampling_period - self.instance = instance - - -class PredictiveAutoscalePolicy(_serialization.Model): - """The parameters for enabling predictive autoscale. - - All required parameters must be populated in order to send to server. - - :ivar scale_mode: the predictive autoscale mode. Required. Known values are: "Disabled", - "ForecastOnly", and "Enabled". - :vartype scale_mode: str or ~azure.mgmt.monitor.models.PredictiveAutoscalePolicyScaleMode - :ivar scale_look_ahead_time: the amount of time to specify by which instances are launched in - advance. It must be between 1 minute and 60 minutes in ISO 8601 format. - :vartype scale_look_ahead_time: ~datetime.timedelta - """ - - _validation = { - "scale_mode": {"required": True}, - } - - _attribute_map = { - "scale_mode": {"key": "scaleMode", "type": "str"}, - "scale_look_ahead_time": {"key": "scaleLookAheadTime", "type": "duration"}, - } - - def __init__( - self, - *, - scale_mode: Union[str, "_models.PredictiveAutoscalePolicyScaleMode"], - scale_look_ahead_time: Optional[datetime.timedelta] = None, - **kwargs: Any - ) -> None: - """ - :keyword scale_mode: the predictive autoscale mode. Required. Known values are: "Disabled", - "ForecastOnly", and "Enabled". - :paramtype scale_mode: str or ~azure.mgmt.monitor.models.PredictiveAutoscalePolicyScaleMode - :keyword scale_look_ahead_time: the amount of time to specify by which instances are launched - in advance. It must be between 1 minute and 60 minutes in ISO 8601 format. - :paramtype scale_look_ahead_time: ~datetime.timedelta - """ - super().__init__(**kwargs) - self.scale_mode = scale_mode - self.scale_look_ahead_time = scale_look_ahead_time - - -class PredictiveResponse(_serialization.Model): - """The response to a metrics query. - - :ivar timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :vartype timespan: str - :ivar interval: The interval (window size) for which the metric data was returned in. This may - be adjusted in the future and returned back from what was originally requested. This is not - present if a metadata request was made. - :vartype interval: ~datetime.timedelta - :ivar metric_name: The metrics being queried. - :vartype metric_name: str - :ivar target_resource_id: resource of the predictive metric. - :vartype target_resource_id: str - :ivar data: the value of the collection. - :vartype data: list[~azure.mgmt.monitor.models.PredictiveValue] - """ - - _attribute_map = { - "timespan": {"key": "timespan", "type": "str"}, - "interval": {"key": "interval", "type": "duration"}, - "metric_name": {"key": "metricName", "type": "str"}, - "target_resource_id": {"key": "targetResourceId", "type": "str"}, - "data": {"key": "data", "type": "[PredictiveValue]"}, - } - - def __init__( - self, - *, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - metric_name: Optional[str] = None, - target_resource_id: Optional[str] = None, - data: Optional[List["_models.PredictiveValue"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. - :paramtype timespan: str - :keyword interval: The interval (window size) for which the metric data was returned in. This - may be adjusted in the future and returned back from what was originally requested. This is - not present if a metadata request was made. - :paramtype interval: ~datetime.timedelta - :keyword metric_name: The metrics being queried. - :paramtype metric_name: str - :keyword target_resource_id: resource of the predictive metric. - :paramtype target_resource_id: str - :keyword data: the value of the collection. - :paramtype data: list[~azure.mgmt.monitor.models.PredictiveValue] - """ - super().__init__(**kwargs) - self.timespan = timespan - self.interval = interval - self.metric_name = metric_name - self.target_resource_id = target_resource_id - self.data = data - - -class PredictiveValue(_serialization.Model): - """Represents a predictive metric value in the given bucket. - - All required parameters must be populated in order to send to server. - - :ivar time_stamp: the timestamp for the metric value in ISO 8601 format. Required. - :vartype time_stamp: ~datetime.datetime - :ivar value: Predictive value in this time bucket. Required. - :vartype value: float - """ - - _validation = { - "time_stamp": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "time_stamp": {"key": "timeStamp", "type": "iso-8601"}, - "value": {"key": "value", "type": "float"}, - } - - def __init__(self, *, time_stamp: datetime.datetime, value: float, **kwargs: Any) -> None: - """ - :keyword time_stamp: the timestamp for the metric value in ISO 8601 format. Required. - :paramtype time_stamp: ~datetime.datetime - :keyword value: Predictive value in this time bucket. Required. - :paramtype value: float - """ - super().__init__(**kwargs) - self.time_stamp = time_stamp - self.value = value - - -class ProxyResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~azure.mgmt.monitor.models.PrivateEndpointProperty - :ivar private_link_service_connection_state: Connection state of the private endpoint - connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.monitor.models.PrivateLinkServiceConnectionStateProperty - :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointProperty"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionStateProperty", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: Private endpoint which the connection belongs to. - :paramtype private_endpoint: ~azure.mgmt.monitor.models.PrivateEndpointProperty - :keyword private_link_service_connection_state: Connection state of the private endpoint - connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.monitor.models.PrivateLinkServiceConnectionStateProperty - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateEndpointProperty(_serialization.Model): - """Private endpoint which the connection belongs to. - - :ivar id: Resource id of the private endpoint. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource id of the private endpoint. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PrivateLinkResource(ProxyResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.group_id = None - self.required_members = None - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.monitor.models.PrivateLinkResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long - """State of the private endpoint connection. - - 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 status: The private link service connection status. Required. - :vartype status: str - :ivar description: The private link service connection description. Required. - :vartype description: str - :ivar actions_required: The actions required for private link service connection. - :vartype actions_required: str - """ - - _validation = { - "status": {"required": True}, - "description": {"required": True}, - "actions_required": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__(self, *, status: str, description: str, **kwargs: Any) -> None: - """ - :keyword status: The private link service connection status. Required. - :paramtype status: str - :keyword description: The private link service connection description. Required. - :paramtype description: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = None - - -class Recurrence(_serialization.Model): - """The repeating times at which this profile begins. This element is not used if the FixedDate - element is used. - - All required parameters must be populated in order to send to server. - - :ivar frequency: the recurrence frequency. How often the schedule profile should take effect. - This value must be Week, meaning each week will have the same set of profiles. For example, to - set a daily schedule, set **schedule** to every day of the week. The frequency property - specifies that the schedule is repeated weekly. Required. Known values are: "None", "Second", - "Minute", "Hour", "Day", "Week", "Month", and "Year". - :vartype frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency - :ivar schedule: the scheduling constraints for when the profile begins. Required. - :vartype schedule: ~azure.mgmt.monitor.models.RecurrentSchedule - """ - - _validation = { - "frequency": {"required": True}, - "schedule": {"required": True}, - } - - _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "schedule": {"key": "schedule", "type": "RecurrentSchedule"}, - } - - def __init__( - self, - *, - frequency: Union[str, "_models.RecurrenceFrequency"], - schedule: "_models.RecurrentSchedule", - **kwargs: Any - ) -> None: - """ - :keyword frequency: the recurrence frequency. How often the schedule profile should take - effect. This value must be Week, meaning each week will have the same set of profiles. For - example, to set a daily schedule, set **schedule** to every day of the week. The frequency - property specifies that the schedule is repeated weekly. Required. Known values are: "None", - "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year". - :paramtype frequency: str or ~azure.mgmt.monitor.models.RecurrenceFrequency - :keyword schedule: the scheduling constraints for when the profile begins. Required. - :paramtype schedule: ~azure.mgmt.monitor.models.RecurrentSchedule - """ - super().__init__(**kwargs) - self.frequency = frequency - self.schedule = schedule - - -class RecurrentSchedule(_serialization.Model): - """The scheduling constraints for when the profile begins. - - All required parameters must be populated in order to send to server. - - :ivar time_zone: the timezone for the hours of the profile. Some examples of valid time zones - are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard - Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, - Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern - Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, - Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA - Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard - Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia - Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard - Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe - Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard - Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB - Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe - Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel - Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab - Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West - Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard - Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia - Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, - Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, - Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji - Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands - Standard Time. Required. - :vartype time_zone: str - :ivar days: the collection of days that the profile takes effect on. Possible values are Sunday - through Saturday. Required. - :vartype days: list[str] - :ivar hours: A collection of hours that the profile takes effect on. Values supported are 0 to - 23 on the 24-hour clock (AM/PM times are not supported). Required. - :vartype hours: list[int] - :ivar minutes: A collection of minutes at which the profile takes effect at. Required. - :vartype minutes: list[int] - """ - - _validation = { - "time_zone": {"required": True}, - "days": {"required": True}, - "hours": {"required": True}, - "minutes": {"required": True}, - } - - _attribute_map = { - "time_zone": {"key": "timeZone", "type": "str"}, - "days": {"key": "days", "type": "[str]"}, - "hours": {"key": "hours", "type": "[int]"}, - "minutes": {"key": "minutes", "type": "[int]"}, - } - - def __init__(self, *, time_zone: str, days: List[str], hours: List[int], minutes: List[int], **kwargs: Any) -> None: - """ - :keyword time_zone: the timezone for the hours of the profile. Some examples of valid time - zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain - Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard - Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, - Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard - Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, - Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina - Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, - Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde - Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European - Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, - GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. - Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, - Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, - Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West - Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard - Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia - Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, - Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, - Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji - Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands - Standard Time. Required. - :paramtype time_zone: str - :keyword days: the collection of days that the profile takes effect on. Possible values are - Sunday through Saturday. Required. - :paramtype days: list[str] - :keyword hours: A collection of hours that the profile takes effect on. Values supported are 0 - to 23 on the 24-hour clock (AM/PM times are not supported). Required. - :paramtype hours: list[int] - :keyword minutes: A collection of minutes at which the profile takes effect at. Required. - :paramtype minutes: list[int] - """ - super().__init__(**kwargs) - self.time_zone = time_zone - self.days = days - self.hours = hours - self.minutes = minutes - - -class Response(_serialization.Model): - """The response to a metrics query. - - All required parameters must be populated in order to send to server. - - :ivar cost: The integer value representing the relative cost of the query. - :vartype cost: int - :ivar timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. Required. - :vartype timespan: str - :ivar interval: The interval (window size) for which the metric data was returned in ISO 8601 - duration format with a special case for 'FULL' value that returns single datapoint for entire - time span requested (\\ *Examples: PT15M, PT1H, P1D, FULL*\\ ). - This may be adjusted and different from what was originally requested if - AutoAdjustTimegrain=true is specified. This is not present if a metadata request was made. - :vartype interval: str - :ivar namespace: The namespace of the metrics being queried. - :vartype namespace: str - :ivar resourceregion: The region of the resource being queried for metrics. - :vartype resourceregion: str - :ivar value: the value of the collection. Required. - :vartype value: list[~azure.mgmt.monitor.models.Metric] - """ - - _validation = { - "cost": {"minimum": 0}, - "timespan": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "cost": {"key": "cost", "type": "int"}, - "timespan": {"key": "timespan", "type": "str"}, - "interval": {"key": "interval", "type": "str"}, - "namespace": {"key": "namespace", "type": "str"}, - "resourceregion": {"key": "resourceregion", "type": "str"}, - "value": {"key": "value", "type": "[Metric]"}, - } - - def __init__( - self, - *, - timespan: str, - value: List["_models.Metric"], - cost: Optional[int] = None, - interval: Optional[str] = None, - namespace: Optional[str] = None, - resourceregion: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword cost: The integer value representing the relative cost of the query. - :paramtype cost: int - :keyword timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. Required. - :paramtype timespan: str - :keyword interval: The interval (window size) for which the metric data was returned in ISO - 8601 duration format with a special case for 'FULL' value that returns single datapoint for - entire time span requested (\\ *Examples: PT15M, PT1H, P1D, FULL*\\ ). - This may be adjusted and different from what was originally requested if - AutoAdjustTimegrain=true is specified. This is not present if a metadata request was made. - :paramtype interval: str - :keyword namespace: The namespace of the metrics being queried. - :paramtype namespace: str - :keyword resourceregion: The region of the resource being queried for metrics. - :paramtype resourceregion: str - :keyword value: the value of the collection. Required. - :paramtype value: list[~azure.mgmt.monitor.models.Metric] - """ - super().__init__(**kwargs) - self.cost = cost - self.timespan = timespan - self.interval = interval - self.namespace = namespace - self.resourceregion = resourceregion - self.value = value - - -class ResponseWithError(_serialization.Model): - """An error response from the API. - - All required parameters must be populated in order to send to server. - - :ivar error: Error information. Required. - :vartype error: ~azure.mgmt.monitor.models.Error - """ - - _validation = { - "error": {"required": True}, - } - - _attribute_map = { - "error": {"key": "error", "type": "Error"}, - } - - def __init__(self, *, error: "_models.Error", **kwargs: Any) -> None: - """ - :keyword error: Error information. Required. - :paramtype error: ~azure.mgmt.monitor.models.Error - """ - super().__init__(**kwargs) - self.error = error - - -class RetentionPolicy(_serialization.Model): - """Specifies the retention policy for the log. - - All required parameters must be populated in order to send to server. - - :ivar enabled: a value indicating whether the retention policy is enabled. Required. - :vartype enabled: bool - :ivar days: the number of days for the retention in days. A value of 0 will retain the events - indefinitely. Required. - :vartype days: int - """ - - _validation = { - "enabled": {"required": True}, - "days": {"required": True, "minimum": 0}, - } - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "days": {"key": "days", "type": "int"}, - } - - def __init__(self, *, enabled: bool, days: int, **kwargs: Any) -> None: - """ - :keyword enabled: a value indicating whether the retention policy is enabled. Required. - :paramtype enabled: bool - :keyword days: the number of days for the retention in days. A value of 0 will retain the - events indefinitely. Required. - :paramtype days: int - """ - super().__init__(**kwargs) - self.enabled = enabled - self.days = days - - -class ScaleAction(_serialization.Model): - """The parameters for the scaling action. - - All required parameters must be populated in order to send to server. - - :ivar direction: the scale direction. Whether the scaling action increases or decreases the - number of instances. Required. Known values are: "None", "Increase", and "Decrease". - :vartype direction: str or ~azure.mgmt.monitor.models.ScaleDirection - :ivar type: the type of action that should occur when the scale rule fires. Required. Known - values are: "ChangeCount", "PercentChangeCount", "ExactCount", and "ServiceAllowedNextValue". - :vartype type: str or ~azure.mgmt.monitor.models.ScaleType - :ivar value: the number of instances that are involved in the scaling action. This value must - be 1 or greater. The default value is 1. - :vartype value: str - :ivar cooldown: the amount of time to wait since the last scaling action before this action - occurs. It must be between 1 week and 1 minute in ISO 8601 format. Required. - :vartype cooldown: ~datetime.timedelta - """ - - _validation = { - "direction": {"required": True}, - "type": {"required": True}, - "cooldown": {"required": True}, - } - - _attribute_map = { - "direction": {"key": "direction", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "cooldown": {"key": "cooldown", "type": "duration"}, - } - - def __init__( - self, - *, - direction: Union[str, "_models.ScaleDirection"], - type: Union[str, "_models.ScaleType"], - cooldown: datetime.timedelta, - value: str = "1", - **kwargs: Any - ) -> None: - """ - :keyword direction: the scale direction. Whether the scaling action increases or decreases the - number of instances. Required. Known values are: "None", "Increase", and "Decrease". - :paramtype direction: str or ~azure.mgmt.monitor.models.ScaleDirection - :keyword type: the type of action that should occur when the scale rule fires. Required. Known - values are: "ChangeCount", "PercentChangeCount", "ExactCount", and "ServiceAllowedNextValue". - :paramtype type: str or ~azure.mgmt.monitor.models.ScaleType - :keyword value: the number of instances that are involved in the scaling action. This value - must be 1 or greater. The default value is 1. - :paramtype value: str - :keyword cooldown: the amount of time to wait since the last scaling action before this action - occurs. It must be between 1 week and 1 minute in ISO 8601 format. Required. - :paramtype cooldown: ~datetime.timedelta - """ - super().__init__(**kwargs) - self.direction = direction - self.type = type - self.value = value - self.cooldown = cooldown - - -class ScaleCapacity(_serialization.Model): - """The number of instances that can be used during this profile. - - All required parameters must be populated in order to send to server. - - :ivar minimum: the minimum number of instances for the resource. Required. - :vartype minimum: str - :ivar maximum: the maximum number of instances for the resource. The actual maximum number of - instances is limited by the cores that are available in the subscription. Required. - :vartype maximum: str - :ivar default: the number of instances that will be set if metrics are not available for - evaluation. The default is only used if the current instance count is lower than the default. - Required. - :vartype default: str - """ - - _validation = { - "minimum": {"required": True}, - "maximum": {"required": True}, - "default": {"required": True}, - } - - _attribute_map = { - "minimum": {"key": "minimum", "type": "str"}, - "maximum": {"key": "maximum", "type": "str"}, - "default": {"key": "default", "type": "str"}, - } - - def __init__(self, *, minimum: str, maximum: str, default: str, **kwargs: Any) -> None: - """ - :keyword minimum: the minimum number of instances for the resource. Required. - :paramtype minimum: str - :keyword maximum: the maximum number of instances for the resource. The actual maximum number - of instances is limited by the cores that are available in the subscription. Required. - :paramtype maximum: str - :keyword default: the number of instances that will be set if metrics are not available for - evaluation. The default is only used if the current instance count is lower than the default. - Required. - :paramtype default: str - """ - super().__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - - -class ScaleRule(_serialization.Model): - """A rule that provide the triggers and parameters for the scaling action. - - All required parameters must be populated in order to send to server. - - :ivar metric_trigger: the trigger that results in a scaling action. Required. - :vartype metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger - :ivar scale_action: the parameters for the scaling action. Required. - :vartype scale_action: ~azure.mgmt.monitor.models.ScaleAction - """ - - _validation = { - "metric_trigger": {"required": True}, - "scale_action": {"required": True}, - } - - _attribute_map = { - "metric_trigger": {"key": "metricTrigger", "type": "MetricTrigger"}, - "scale_action": {"key": "scaleAction", "type": "ScaleAction"}, - } - - def __init__( - self, *, metric_trigger: "_models.MetricTrigger", scale_action: "_models.ScaleAction", **kwargs: Any - ) -> None: - """ - :keyword metric_trigger: the trigger that results in a scaling action. Required. - :paramtype metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger - :keyword scale_action: the parameters for the scaling action. Required. - :paramtype scale_action: ~azure.mgmt.monitor.models.ScaleAction - """ - super().__init__(**kwargs) - self.metric_trigger = metric_trigger - self.scale_action = scale_action - - -class ScaleRuleMetricDimension(_serialization.Model): - """Specifies an auto scale rule metric dimension. - - All required parameters must be populated in order to send to server. - - :ivar dimension_name: Name of the dimension. Required. - :vartype dimension_name: str - :ivar operator: the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' - being equal to any of the values. 'NotEquals' being not equal to all of the values. Required. - Known values are: "Equals" and "NotEquals". - :vartype operator: str or ~azure.mgmt.monitor.models.ScaleRuleMetricDimensionOperationType - :ivar values: list of dimension values. For example: ["App1","App2"]. Required. - :vartype values: list[str] - """ - - _validation = { - "dimension_name": {"required": True}, - "operator": {"required": True}, - "values": {"required": True}, - } - - _attribute_map = { - "dimension_name": {"key": "DimensionName", "type": "str"}, - "operator": {"key": "Operator", "type": "str"}, - "values": {"key": "Values", "type": "[str]"}, - } - - def __init__( - self, - *, - dimension_name: str, - operator: Union[str, "_models.ScaleRuleMetricDimensionOperationType"], - values: List[str], - **kwargs: Any - ) -> None: - """ - :keyword dimension_name: Name of the dimension. Required. - :paramtype dimension_name: str - :keyword operator: the dimension operator. Only 'Equals' and 'NotEquals' are supported. - 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. - Required. Known values are: "Equals" and "NotEquals". - :paramtype operator: str or ~azure.mgmt.monitor.models.ScaleRuleMetricDimensionOperationType - :keyword values: list of dimension values. For example: ["App1","App2"]. Required. - :paramtype values: list[str] - """ - super().__init__(**kwargs) - self.dimension_name = dimension_name - self.operator = operator - self.values = values - - -class Schedule(_serialization.Model): - """Defines how often to run the search and the time interval. - - All required parameters must be populated in order to send to server. - - :ivar frequency_in_minutes: frequency (in minutes) at which rule condition should be evaluated. - Required. - :vartype frequency_in_minutes: int - :ivar time_window_in_minutes: Time window for which data needs to be fetched for query (should - be greater than or equal to frequencyInMinutes). Required. - :vartype time_window_in_minutes: int - """ - - _validation = { - "frequency_in_minutes": {"required": True}, - "time_window_in_minutes": {"required": True}, - } - - _attribute_map = { - "frequency_in_minutes": {"key": "frequencyInMinutes", "type": "int"}, - "time_window_in_minutes": {"key": "timeWindowInMinutes", "type": "int"}, - } - - def __init__(self, *, frequency_in_minutes: int, time_window_in_minutes: int, **kwargs: Any) -> None: - """ - :keyword frequency_in_minutes: frequency (in minutes) at which rule condition should be - evaluated. Required. - :paramtype frequency_in_minutes: int - :keyword time_window_in_minutes: Time window for which data needs to be fetched for query - (should be greater than or equal to frequencyInMinutes). Required. - :paramtype time_window_in_minutes: int - """ - super().__init__(**kwargs) - self.frequency_in_minutes = frequency_in_minutes - self.time_window_in_minutes = time_window_in_minutes - - -class ScopedResource(ProxyResource): - """A private link scoped resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar linked_resource_id: The resource id of the scoped Azure monitor resource. - :vartype linked_resource_id: str - :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "linked_resource_id": {"key": "properties.linkedResourceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, linked_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword linked_resource_id: The resource id of the scoped Azure monitor resource. - :paramtype linked_resource_id: str - """ - super().__init__(**kwargs) - self.linked_resource_id = linked_resource_id - self.provisioning_state = None - - -class ScopedResourceListResult(_serialization.Model): - """A list of scoped resources in a private link scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.monitor.models.ScopedResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ScopedResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SenderAuthorization(_serialization.Model): - """the authorization used by the user who has performed the operation that led to this event. This - captures the RBAC properties of the event. These usually include the 'action', 'role' and the - 'scope'. - - :ivar action: the permissible actions. For instance: microsoft.support/supporttickets/write. - :vartype action: str - :ivar role: the role of the user. For instance: Subscription Admin. - :vartype role: str - :ivar scope: the scope. - :vartype scope: str - """ - - _attribute_map = { - "action": {"key": "action", "type": "str"}, - "role": {"key": "role", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - } - - def __init__( - self, *, action: Optional[str] = None, role: Optional[str] = None, scope: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword action: the permissible actions. For instance: microsoft.support/supporttickets/write. - :paramtype action: str - :keyword role: the role of the user. For instance: Subscription Admin. - :paramtype role: str - :keyword scope: the scope. - :paramtype scope: str - """ - super().__init__(**kwargs) - self.action = action - self.role = role - self.scope = scope - - -class ServiceDiagnosticSettingsResource(Resource): - """Description of a service diagnostic setting. - - 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 id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :vartype service_bus_rule_id: str - :ivar event_hub_authorization_rule_id: The resource Id for the event hub namespace - authorization rule. - :vartype event_hub_authorization_rule_id: str - :ivar metrics: the list of metric settings. - :vartype metrics: list[~azure.mgmt.monitor.models.MetricSettingsAutoGenerated] - :ivar logs: the list of logs settings. - :vartype logs: list[~azure.mgmt.monitor.models.LogSettingsAutoGenerated] - :ivar workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log - Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :vartype workspace_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "event_hub_authorization_rule_id": {"key": "properties.eventHubAuthorizationRuleId", "type": "str"}, - "metrics": {"key": "properties.metrics", "type": "[MetricSettingsAutoGenerated]"}, - "logs": {"key": "properties.logs", "type": "[LogSettingsAutoGenerated]"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - event_hub_authorization_rule_id: Optional[str] = None, - metrics: Optional[List["_models.MetricSettingsAutoGenerated"]] = None, - logs: Optional[List["_models.LogSettingsAutoGenerated"]] = None, - workspace_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :paramtype service_bus_rule_id: str - :keyword event_hub_authorization_rule_id: The resource Id for the event hub namespace - authorization rule. - :paramtype event_hub_authorization_rule_id: str - :keyword metrics: the list of metric settings. - :paramtype metrics: list[~azure.mgmt.monitor.models.MetricSettingsAutoGenerated] - :keyword logs: the list of logs settings. - :paramtype logs: list[~azure.mgmt.monitor.models.LogSettingsAutoGenerated] - :keyword workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log - Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :paramtype workspace_id: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.event_hub_authorization_rule_id = event_hub_authorization_rule_id - self.metrics = metrics - self.logs = logs - self.workspace_id = workspace_id - - -class ServiceDiagnosticSettingsResourcePatch(_serialization.Model): - """Service diagnostic setting resource for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :vartype service_bus_rule_id: str - :ivar event_hub_authorization_rule_id: The resource Id for the event hub namespace - authorization rule. - :vartype event_hub_authorization_rule_id: str - :ivar metrics: the list of metric settings. - :vartype metrics: list[~azure.mgmt.monitor.models.MetricSettingsAutoGenerated] - :ivar logs: the list of logs settings. - :vartype logs: list[~azure.mgmt.monitor.models.LogSettingsAutoGenerated] - :ivar workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log - Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :vartype workspace_id: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "event_hub_authorization_rule_id": {"key": "properties.eventHubAuthorizationRuleId", "type": "str"}, - "metrics": {"key": "properties.metrics", "type": "[MetricSettingsAutoGenerated]"}, - "logs": {"key": "properties.logs", "type": "[LogSettingsAutoGenerated]"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - event_hub_authorization_rule_id: Optional[str] = None, - metrics: Optional[List["_models.MetricSettingsAutoGenerated"]] = None, - logs: Optional[List["_models.LogSettingsAutoGenerated"]] = None, - workspace_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule ID of the service bus namespace in which you - would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the - format: '{service bus resource ID}/authorizationrules/{key name}'. - :paramtype service_bus_rule_id: str - :keyword event_hub_authorization_rule_id: The resource Id for the event hub namespace - authorization rule. - :paramtype event_hub_authorization_rule_id: str - :keyword metrics: the list of metric settings. - :paramtype metrics: list[~azure.mgmt.monitor.models.MetricSettingsAutoGenerated] - :keyword logs: the list of logs settings. - :paramtype logs: list[~azure.mgmt.monitor.models.LogSettingsAutoGenerated] - :keyword workspace_id: The workspace ID (resource ID of a Log Analytics workspace) for a Log - Analytics workspace to which you would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :paramtype workspace_id: str - """ - super().__init__(**kwargs) - self.tags = tags - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.event_hub_authorization_rule_id = event_hub_authorization_rule_id - self.metrics = metrics - self.logs = logs - self.workspace_id = workspace_id - - -class SingleBaseline(_serialization.Model): - """The baseline values for a single sensitivity value. - - All required parameters must be populated in order to send to server. - - :ivar sensitivity: the sensitivity of the baseline. Required. Known values are: "Low", - "Medium", and "High". - :vartype sensitivity: str or ~azure.mgmt.monitor.models.BaselineSensitivity - :ivar low_thresholds: The low thresholds of the baseline. Required. - :vartype low_thresholds: list[float] - :ivar high_thresholds: The high thresholds of the baseline. Required. - :vartype high_thresholds: list[float] - """ - - _validation = { - "sensitivity": {"required": True}, - "low_thresholds": {"required": True}, - "high_thresholds": {"required": True}, - } - - _attribute_map = { - "sensitivity": {"key": "sensitivity", "type": "str"}, - "low_thresholds": {"key": "lowThresholds", "type": "[float]"}, - "high_thresholds": {"key": "highThresholds", "type": "[float]"}, - } - - def __init__( - self, - *, - sensitivity: Union[str, "_models.BaselineSensitivity"], - low_thresholds: List[float], - high_thresholds: List[float], - **kwargs: Any - ) -> None: - """ - :keyword sensitivity: the sensitivity of the baseline. Required. Known values are: "Low", - "Medium", and "High". - :paramtype sensitivity: str or ~azure.mgmt.monitor.models.BaselineSensitivity - :keyword low_thresholds: The low thresholds of the baseline. Required. - :paramtype low_thresholds: list[float] - :keyword high_thresholds: The high thresholds of the baseline. Required. - :paramtype high_thresholds: list[float] + :keyword alert_type: The value of the supported alert type. Supported alert type values are: + servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, + webtestalert, logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, + actualcostbudget, forecastedbudget. Required. + :paramtype alert_type: str + :keyword email_receivers: The list of email receivers that are part of this action group. + :paramtype email_receivers: list[~azure.mgmt.monitor.models.EmailReceiver] + :keyword sms_receivers: The list of SMS receivers that are part of this action group. + :paramtype sms_receivers: list[~azure.mgmt.monitor.models.SmsReceiver] + :keyword webhook_receivers: The list of webhook receivers that are part of this action group. + :paramtype webhook_receivers: list[~azure.mgmt.monitor.models.WebhookReceiver] + :keyword itsm_receivers: The list of ITSM receivers that are part of this action group. + :paramtype itsm_receivers: list[~azure.mgmt.monitor.models.ItsmReceiver] + :keyword azure_app_push_receivers: The list of AzureAppPush receivers that are part of this + action group. + :paramtype azure_app_push_receivers: list[~azure.mgmt.monitor.models.AzureAppPushReceiver] + :keyword automation_runbook_receivers: The list of AutomationRunbook receivers that are part of + this action group. + :paramtype automation_runbook_receivers: + list[~azure.mgmt.monitor.models.AutomationRunbookReceiver] + :keyword voice_receivers: The list of voice receivers that are part of this action group. + :paramtype voice_receivers: list[~azure.mgmt.monitor.models.VoiceReceiver] + :keyword logic_app_receivers: The list of logic app receivers that are part of this action + group. + :paramtype logic_app_receivers: list[~azure.mgmt.monitor.models.LogicAppReceiver] + :keyword azure_function_receivers: The list of azure function receivers that are part of this + action group. + :paramtype azure_function_receivers: list[~azure.mgmt.monitor.models.AzureFunctionReceiver] + :keyword arm_role_receivers: The list of ARM role receivers that are part of this action group. + Roles are Azure RBAC roles and only built-in roles are supported. + :paramtype arm_role_receivers: list[~azure.mgmt.monitor.models.ArmRoleReceiver] + :keyword event_hub_receivers: The list of event hub receivers that are part of this action + group. + :paramtype event_hub_receivers: list[~azure.mgmt.monitor.models.EventHubReceiver] + :keyword incident_receivers: The list of incident receivers that are part of this action group. + :paramtype incident_receivers: list[~azure.mgmt.monitor.models.IncidentReceiver] """ super().__init__(**kwargs) - self.sensitivity = sensitivity - self.low_thresholds = low_thresholds - self.high_thresholds = high_thresholds - + self.alert_type = alert_type + self.email_receivers = email_receivers + self.sms_receivers = sms_receivers + self.webhook_receivers = webhook_receivers + self.itsm_receivers = itsm_receivers + self.azure_app_push_receivers = azure_app_push_receivers + self.automation_runbook_receivers = automation_runbook_receivers + self.voice_receivers = voice_receivers + self.logic_app_receivers = logic_app_receivers + self.azure_function_receivers = azure_function_receivers + self.arm_role_receivers = arm_role_receivers + self.event_hub_receivers = event_hub_receivers + self.incident_receivers = incident_receivers -class SingleMetricBaseline(_serialization.Model): - """The baseline results of a single metric. - All required parameters must be populated in order to send to server. +class RuleResolveConfiguration(_serialization.Model): + """TBD. Relevant only for rules of the kind LogAlert. - :ivar id: The metric baseline Id. Required. - :vartype id: str - :ivar type: The resource type of the metric baseline resource. Required. - :vartype type: str - :ivar name: The name of the metric for which the baselines were retrieved. Required. - :vartype name: str - :ivar timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. Required. - :vartype timespan: str - :ivar interval: The interval (window size) for which the metric data was returned in. This may - be adjusted in the future and returned back from what was originally requested. This is not - present if a metadata request was made. Required. - :vartype interval: ~datetime.timedelta - :ivar namespace: The namespace of the metrics been queried. - :vartype namespace: str - :ivar baselines: The baseline for each time series that was queried. Required. - :vartype baselines: list[~azure.mgmt.monitor.models.TimeSeriesBaseline] + :ivar auto_resolved: The flag that indicates whether or not to auto resolve a fired alert. + :vartype auto_resolved: bool + :ivar time_to_resolve: The duration a rule must evaluate as healthy before the fired alert is + automatically resolved represented in ISO 8601 duration format. + :vartype time_to_resolve: ~datetime.timedelta """ - _validation = { - "id": {"required": True}, - "type": {"required": True}, - "name": {"required": True}, - "timespan": {"required": True}, - "interval": {"required": True}, - "baselines": {"required": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "timespan": {"key": "properties.timespan", "type": "str"}, - "interval": {"key": "properties.interval", "type": "duration"}, - "namespace": {"key": "properties.namespace", "type": "str"}, - "baselines": {"key": "properties.baselines", "type": "[TimeSeriesBaseline]"}, + "auto_resolved": {"key": "autoResolved", "type": "bool"}, + "time_to_resolve": {"key": "timeToResolve", "type": "duration"}, } def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - type: str, - name: str, - timespan: str, - interval: datetime.timedelta, - baselines: List["_models.TimeSeriesBaseline"], - namespace: Optional[str] = None, + auto_resolved: Optional[bool] = None, + time_to_resolve: Optional[datetime.timedelta] = None, **kwargs: Any ) -> None: """ - :keyword id: The metric baseline Id. Required. - :paramtype id: str - :keyword type: The resource type of the metric baseline resource. Required. - :paramtype type: str - :keyword name: The name of the metric for which the baselines were retrieved. Required. - :paramtype name: str - :keyword timespan: The timespan for which the data was retrieved. Its value consists of two - datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back - from what was originally requested. Required. - :paramtype timespan: str - :keyword interval: The interval (window size) for which the metric data was returned in. This - may be adjusted in the future and returned back from what was originally requested. This is - not present if a metadata request was made. Required. - :paramtype interval: ~datetime.timedelta - :keyword namespace: The namespace of the metrics been queried. - :paramtype namespace: str - :keyword baselines: The baseline for each time series that was queried. Required. - :paramtype baselines: list[~azure.mgmt.monitor.models.TimeSeriesBaseline] + :keyword auto_resolved: The flag that indicates whether or not to auto resolve a fired alert. + :paramtype auto_resolved: bool + :keyword time_to_resolve: The duration a rule must evaluate as healthy before the fired alert + is automatically resolved represented in ISO 8601 duration format. + :paramtype time_to_resolve: ~datetime.timedelta """ super().__init__(**kwargs) - self.id = id - self.type = type - self.name = name - self.timespan = timespan - self.interval = interval - self.namespace = namespace - self.baselines = baselines + self.auto_resolved = auto_resolved + self.time_to_resolve = time_to_resolve -class SinkConfiguration(_serialization.Model): - """SinkConfiguration. - - All required parameters must be populated in order to send to server. +class ScheduledQueryRuleCriteria(_serialization.Model): + """The rule criteria that defines the conditions of the scheduled query rule. - :ivar kind: Required. Known values are: "EventHub", "ApplicationInsights", and "LogAnalytics". - :vartype kind: str or ~azure.mgmt.monitor.models.SinkConfigurationKind + :ivar all_of: A list of conditions to evaluate against the specified scopes. + :vartype all_of: list[~azure.mgmt.monitor.models.Condition] """ - _validation = { - "kind": {"required": True}, - } - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, + "all_of": {"key": "allOf", "type": "[Condition]"}, } - def __init__(self, *, kind: Union[str, "_models.SinkConfigurationKind"], **kwargs: Any) -> None: + def __init__(self, *, all_of: Optional[List["_models.Condition"]] = None, **kwargs: Any) -> None: """ - :keyword kind: Required. Known values are: "EventHub", "ApplicationInsights", and - "LogAnalytics". - :paramtype kind: str or ~azure.mgmt.monitor.models.SinkConfigurationKind + :keyword all_of: A list of conditions to evaluate against the specified scopes. + :paramtype all_of: list[~azure.mgmt.monitor.models.Condition] """ super().__init__(**kwargs) - self.kind = kind + self.all_of = all_of -class SmsReceiver(_serialization.Model): - """An SMS receiver. +class ScheduledQueryRuleResource(_serialization.Model): + """The scheduled query rule 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 name: The name of the SMS receiver. Names must be unique across all receivers within an - action group. Required. - :vartype name: str - :ivar country_code: The country code of the SMS receiver. Required. - :vartype country_code: str - :ivar phone_number: The phone number of the SMS receiver. Required. - :vartype phone_number: str - :ivar status: The status of the receiver. Known values are: "NotSpecified", "Enabled", and - "Disabled". - :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus - """ - - _validation = { - "name": {"required": True}, - "country_code": {"required": True}, - "phone_number": {"required": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "country_code": {"key": "countryCode", "type": "str"}, - "phone_number": {"key": "phoneNumber", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs: Any) -> None: - """ - :keyword name: The name of the SMS receiver. Names must be unique across all receivers within - an action group. Required. - :paramtype name: str - :keyword country_code: The country code of the SMS receiver. Required. - :paramtype country_code: str - :keyword phone_number: The phone number of the SMS receiver. Required. - :paramtype phone_number: str - """ - super().__init__(**kwargs) - self.name = name - self.country_code = country_code - self.phone_number = phone_number - self.status = None - - -class Source(_serialization.Model): - """Specifies the log search query. - - All required parameters must be populated in order to send to server. - - :ivar query: Log search query. Required for action type - AlertingAction. - :vartype query: str - :ivar authorized_resources: List of Resource referred into query. - :vartype authorized_resources: list[str] - :ivar data_source_id: The resource uri over which log search query is to be run. Required. - :vartype data_source_id: str - :ivar query_type: Set value to 'ResultCount' . "ResultCount" - :vartype query_type: str or ~azure.mgmt.monitor.models.QueryType - """ - - _validation = { - "data_source_id": {"required": True}, - } - - _attribute_map = { - "query": {"key": "query", "type": "str"}, - "authorized_resources": {"key": "authorizedResources", "type": "[str]"}, - "data_source_id": {"key": "dataSourceId", "type": "str"}, - "query_type": {"key": "queryType", "type": "str"}, - } - - def __init__( - self, - *, - data_source_id: str, - query: Optional[str] = None, - authorized_resources: Optional[List[str]] = None, - query_type: Optional[Union[str, "_models.QueryType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword query: Log search query. Required for action type - AlertingAction. - :paramtype query: str - :keyword authorized_resources: List of Resource referred into query. - :paramtype authorized_resources: list[str] - :keyword data_source_id: The resource uri over which log search query is to be run. Required. - :paramtype data_source_id: str - :keyword query_type: Set value to 'ResultCount' . "ResultCount" - :paramtype query_type: str or ~azure.mgmt.monitor.models.QueryType - """ - super().__init__(**kwargs) - self.query = query - self.authorized_resources = authorized_resources - self.data_source_id = data_source_id - self.query_type = query_type - - -class SubscriptionProxyOnlyResource(_serialization.Model): - """A proxy only azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: Location of the resource. + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.monitor.models.Identity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar kind: Indicates the type of scheduled query rule. The default is LogAlert. Known values + are: "LogAlert", "SimpleLogAlert", and "LogToMetric". + :vartype kind: str or ~azure.mgmt.monitor.models.Kind + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :ivar system_data: SystemData of ScheduledQueryRule. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool + :ivar description: The description of the scheduled query rule. + :vartype description: str + :ivar display_name: The display name of the alert rule. + :vartype display_name: str + :ivar severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Known values are: 0, 1, 2, + 3, and 4. + :vartype severity: int or ~azure.mgmt.monitor.models.AlertSeverity + :ivar enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :vartype enabled: bool + :ivar scopes: The list of resource id's that this scheduled query rule is scoped to. + :vartype scopes: list[str] + :ivar evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :vartype evaluation_frequency: ~datetime.timedelta + :ivar window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :vartype window_size: ~datetime.timedelta + :ivar override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :vartype override_query_time_range: ~datetime.timedelta + :ivar target_resource_types: List of resource type of the target resource(s) on which the alert + is created/updated. For example if the scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. + :vartype target_resource_types: list[str] + :ivar criteria: The rule criteria that defines the conditions of the scheduled query rule. + :vartype criteria: ~azure.mgmt.monitor.models.ScheduledQueryRuleCriteria + :ivar mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :vartype mute_actions_duration: ~datetime.timedelta + :ivar actions: Actions to invoke when the alert fires. + :vartype actions: ~azure.mgmt.monitor.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :ivar check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :vartype check_workspace_alerts_storage_configured: bool + :ivar skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :vartype skip_query_validation: bool + :ivar auto_mitigate: The flag that indicates whether the alert should be automatically resolved + or not. The default is true. Relevant only for rules of kinds LogAlert and SimpleLogAlert. + :vartype auto_mitigate: bool + :ivar resolve_configuration: Defines the configuration for resolving fired alerts. Relevant + only for rules of kinds LogAlert and SimpleLogAlert. + :vartype resolve_configuration: ~azure.mgmt.monitor.models.RuleResolveConfiguration """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + "created_with_api_version": {"readonly": True}, + "is_legacy_log_analytics_rule": {"readonly": True}, + "is_workspace_alerts_storage_configured": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "identity": {"key": "identity", "type": "Identity"}, + "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "created_with_api_version": {"key": "properties.createdWithApiVersion", "type": "str"}, + "is_legacy_log_analytics_rule": {"key": "properties.isLegacyLogAnalyticsRule", "type": "bool"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "severity": {"key": "properties.severity", "type": "int"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "evaluation_frequency": {"key": "properties.evaluationFrequency", "type": "duration"}, + "window_size": {"key": "properties.windowSize", "type": "duration"}, + "override_query_time_range": {"key": "properties.overrideQueryTimeRange", "type": "duration"}, + "target_resource_types": {"key": "properties.targetResourceTypes", "type": "[str]"}, + "criteria": {"key": "properties.criteria", "type": "ScheduledQueryRuleCriteria"}, + "mute_actions_duration": {"key": "properties.muteActionsDuration", "type": "duration"}, + "actions": {"key": "properties.actions", "type": "Actions"}, + "is_workspace_alerts_storage_configured": { + "key": "properties.isWorkspaceAlertsStorageConfigured", + "type": "bool", + }, + "check_workspace_alerts_storage_configured": { + "key": "properties.checkWorkspaceAlertsStorageConfigured", + "type": "bool", + }, + "skip_query_validation": {"key": "properties.skipQueryValidation", "type": "bool"}, + "auto_mitigate": {"key": "properties.autoMitigate", "type": "bool"}, + "resolve_configuration": {"key": "properties.resolveConfiguration", "type": "RuleResolveConfiguration"}, } - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + identity: Optional["_models.Identity"] = None, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + severity: Optional[Union[int, "_models.AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["_models.ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional["_models.Actions"] = None, + check_workspace_alerts_storage_configured: Optional[bool] = None, + skip_query_validation: Optional[bool] = None, + auto_mitigate: Optional[bool] = None, + resolve_configuration: Optional["_models.RuleResolveConfiguration"] = None, + **kwargs: Any + ) -> None: """ - :keyword location: Location of the resource. + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.monitor.models.Identity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword kind: Indicates the type of scheduled query rule. The default is LogAlert. Known + values are: "LogAlert", "SimpleLogAlert", and "LogToMetric". + :paramtype kind: str or ~azure.mgmt.monitor.models.Kind + :keyword description: The description of the scheduled query rule. + :paramtype description: str + :keyword display_name: The display name of the alert rule. + :paramtype display_name: str + :keyword severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Known values are: 0, 1, 2, + 3, and 4. + :paramtype severity: int or ~azure.mgmt.monitor.models.AlertSeverity + :keyword enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :paramtype enabled: bool + :keyword scopes: The list of resource id's that this scheduled query rule is scoped to. + :paramtype scopes: list[str] + :keyword evaluation_frequency: How often the scheduled query rule is evaluated represented in + ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :paramtype evaluation_frequency: ~datetime.timedelta + :keyword window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :paramtype window_size: ~datetime.timedelta + :keyword override_query_time_range: If specified then overrides the query time range (default + is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :paramtype override_query_time_range: ~datetime.timedelta + :keyword target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. + :paramtype target_resource_types: list[str] + :keyword criteria: The rule criteria that defines the conditions of the scheduled query rule. + :paramtype criteria: ~azure.mgmt.monitor.models.ScheduledQueryRuleCriteria + :keyword mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 + duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :paramtype mute_actions_duration: ~datetime.timedelta + :keyword actions: Actions to invoke when the alert fires. + :paramtype actions: ~azure.mgmt.monitor.models.Actions + :keyword check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :paramtype check_workspace_alerts_storage_configured: bool + :keyword skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :paramtype skip_query_validation: bool + :keyword auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of kinds LogAlert and + SimpleLogAlert. + :paramtype auto_mitigate: bool + :keyword resolve_configuration: Defines the configuration for resolving fired alerts. Relevant + only for rules of kinds LogAlert and SimpleLogAlert. + :paramtype resolve_configuration: ~azure.mgmt.monitor.models.RuleResolveConfiguration """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.identity = identity + self.tags = tags self.location = location + self.kind = kind + self.etag: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None + self.created_with_api_version: Optional[str] = None + self.is_legacy_log_analytics_rule: Optional[bool] = None + self.description = description + self.display_name = display_name + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.override_query_time_range = override_query_time_range + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions + self.is_workspace_alerts_storage_configured: Optional[bool] = None + self.check_workspace_alerts_storage_configured = check_workspace_alerts_storage_configured + self.skip_query_validation = skip_query_validation + self.auto_mitigate = auto_mitigate + self.resolve_configuration = resolve_configuration -class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): - """The subscription diagnostic setting resource. +class ScheduledQueryRuleResourceCollection(_serialization.Model): + """Represents a collection of scheduled query rule resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Location of the resource. - :vartype location: str - :ivar storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :vartype storage_account_id: str - :ivar service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here to - maintain backwards compatibility. - :vartype service_bus_rule_id: str - :ivar event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. - :vartype event_hub_authorization_rule_id: str - :ivar event_hub_name: The name of the event hub. If none is specified, the default event hub - will be selected. - :vartype event_hub_name: str - :ivar logs: The list of logs settings. - :vartype logs: list[~azure.mgmt.monitor.models.SubscriptionLogSettings] - :ivar workspace_id: The full ARM resource ID of the Log Analytics workspace to which you would - like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :vartype workspace_id: str + :ivar value: The values for the scheduled query rule resources. + :vartype value: list[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] + :ivar next_link: Provides the link to retrieve the next set of elements. + :vartype next_link: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "storage_account_id": {"key": "properties.storageAccountId", "type": "str"}, - "service_bus_rule_id": {"key": "properties.serviceBusRuleId", "type": "str"}, - "event_hub_authorization_rule_id": {"key": "properties.eventHubAuthorizationRuleId", "type": "str"}, - "event_hub_name": {"key": "properties.eventHubName", "type": "str"}, - "logs": {"key": "properties.logs", "type": "[SubscriptionLogSettings]"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, + "value": {"key": "value", "type": "[ScheduledQueryRuleResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - location: Optional[str] = None, - storage_account_id: Optional[str] = None, - service_bus_rule_id: Optional[str] = None, - event_hub_authorization_rule_id: Optional[str] = None, - event_hub_name: Optional[str] = None, - logs: Optional[List["_models.SubscriptionLogSettings"]] = None, - workspace_id: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, value: Optional[List["_models.ScheduledQueryRuleResource"]] = None, **kwargs: Any) -> None: """ - :keyword location: Location of the resource. - :paramtype location: str - :keyword storage_account_id: The resource ID of the storage account to which you would like to - send Diagnostic Logs. - :paramtype storage_account_id: str - :keyword service_bus_rule_id: The service bus rule Id of the diagnostic setting. This is here - to maintain backwards compatibility. - :paramtype service_bus_rule_id: str - :keyword event_hub_authorization_rule_id: The resource Id for the event hub authorization rule. - :paramtype event_hub_authorization_rule_id: str - :keyword event_hub_name: The name of the event hub. If none is specified, the default event hub - will be selected. - :paramtype event_hub_name: str - :keyword logs: The list of logs settings. - :paramtype logs: list[~azure.mgmt.monitor.models.SubscriptionLogSettings] - :keyword workspace_id: The full ARM resource ID of the Log Analytics workspace to which you - would like to send Diagnostic Logs. Example: - /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. # pylint: disable=line-too-long - :paramtype workspace_id: str + :keyword value: The values for the scheduled query rule resources. + :paramtype value: list[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] """ - super().__init__(location=location, **kwargs) - self.storage_account_id = storage_account_id - self.service_bus_rule_id = service_bus_rule_id - self.event_hub_authorization_rule_id = event_hub_authorization_rule_id - self.event_hub_name = event_hub_name - self.logs = logs - self.workspace_id = workspace_id + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + +class ScheduledQueryRuleResourcePatch(_serialization.Model): + """The scheduled query rule resource for patch operations. -class SubscriptionDiagnosticSettingsResourceCollection(_serialization.Model): # pylint: disable=name-too-long - """Represents a collection of subscription diagnostic settings resources. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The collection of subscription diagnostic settings resources. - :vartype value: list[~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource] + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.monitor.models.Identity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar created_with_api_version: The api-version used when creating this alert rule. + :vartype created_with_api_version: str + :ivar is_legacy_log_analytics_rule: True if alert rule is legacy Log Analytic rule. + :vartype is_legacy_log_analytics_rule: bool + :ivar description: The description of the scheduled query rule. + :vartype description: str + :ivar display_name: The display name of the alert rule. + :vartype display_name: str + :ivar severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Known values are: 0, 1, 2, + 3, and 4. + :vartype severity: int or ~azure.mgmt.monitor.models.AlertSeverity + :ivar enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :vartype enabled: bool + :ivar scopes: The list of resource id's that this scheduled query rule is scoped to. + :vartype scopes: list[str] + :ivar evaluation_frequency: How often the scheduled query rule is evaluated represented in ISO + 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :vartype evaluation_frequency: ~datetime.timedelta + :ivar window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :vartype window_size: ~datetime.timedelta + :ivar override_query_time_range: If specified then overrides the query time range (default is + WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :vartype override_query_time_range: ~datetime.timedelta + :ivar target_resource_types: List of resource type of the target resource(s) on which the alert + is created/updated. For example if the scope is a resource group and targetResourceTypes is + Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. + :vartype target_resource_types: list[str] + :ivar criteria: The rule criteria that defines the conditions of the scheduled query rule. + :vartype criteria: ~azure.mgmt.monitor.models.ScheduledQueryRuleCriteria + :ivar mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 duration + format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :vartype mute_actions_duration: ~datetime.timedelta + :ivar actions: Actions to invoke when the alert fires. + :vartype actions: ~azure.mgmt.monitor.models.Actions + :ivar is_workspace_alerts_storage_configured: The flag which indicates whether this scheduled + query rule has been configured to be stored in the customer's storage. The default is false. + :vartype is_workspace_alerts_storage_configured: bool + :ivar check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :vartype check_workspace_alerts_storage_configured: bool + :ivar skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :vartype skip_query_validation: bool + :ivar auto_mitigate: The flag that indicates whether the alert should be automatically resolved + or not. The default is true. Relevant only for rules of kinds LogAlert and SimpleLogAlert. + :vartype auto_mitigate: bool + :ivar resolve_configuration: Defines the configuration for resolving fired alerts. Relevant + only for rules of kinds LogAlert and SimpleLogAlert. + :vartype resolve_configuration: ~azure.mgmt.monitor.models.RuleResolveConfiguration """ + _validation = { + "created_with_api_version": {"readonly": True}, + "is_legacy_log_analytics_rule": {"readonly": True}, + "is_workspace_alerts_storage_configured": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[SubscriptionDiagnosticSettingsResource]"}, + "identity": {"key": "identity", "type": "Identity"}, + "tags": {"key": "tags", "type": "{str}"}, + "created_with_api_version": {"key": "properties.createdWithApiVersion", "type": "str"}, + "is_legacy_log_analytics_rule": {"key": "properties.isLegacyLogAnalyticsRule", "type": "bool"}, + "description": {"key": "properties.description", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "severity": {"key": "properties.severity", "type": "int"}, + "enabled": {"key": "properties.enabled", "type": "bool"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "evaluation_frequency": {"key": "properties.evaluationFrequency", "type": "duration"}, + "window_size": {"key": "properties.windowSize", "type": "duration"}, + "override_query_time_range": {"key": "properties.overrideQueryTimeRange", "type": "duration"}, + "target_resource_types": {"key": "properties.targetResourceTypes", "type": "[str]"}, + "criteria": {"key": "properties.criteria", "type": "ScheduledQueryRuleCriteria"}, + "mute_actions_duration": {"key": "properties.muteActionsDuration", "type": "duration"}, + "actions": {"key": "properties.actions", "type": "Actions"}, + "is_workspace_alerts_storage_configured": { + "key": "properties.isWorkspaceAlertsStorageConfigured", + "type": "bool", + }, + "check_workspace_alerts_storage_configured": { + "key": "properties.checkWorkspaceAlertsStorageConfigured", + "type": "bool", + }, + "skip_query_validation": {"key": "properties.skipQueryValidation", "type": "bool"}, + "auto_mitigate": {"key": "properties.autoMitigate", "type": "bool"}, + "resolve_configuration": {"key": "properties.resolveConfiguration", "type": "RuleResolveConfiguration"}, } def __init__( - self, *, value: Optional[List["_models.SubscriptionDiagnosticSettingsResource"]] = None, **kwargs: Any + self, + *, + identity: Optional["_models.Identity"] = None, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + severity: Optional[Union[int, "_models.AlertSeverity"]] = None, + enabled: Optional[bool] = None, + scopes: Optional[List[str]] = None, + evaluation_frequency: Optional[datetime.timedelta] = None, + window_size: Optional[datetime.timedelta] = None, + override_query_time_range: Optional[datetime.timedelta] = None, + target_resource_types: Optional[List[str]] = None, + criteria: Optional["_models.ScheduledQueryRuleCriteria"] = None, + mute_actions_duration: Optional[datetime.timedelta] = None, + actions: Optional["_models.Actions"] = None, + check_workspace_alerts_storage_configured: Optional[bool] = None, + skip_query_validation: Optional[bool] = None, + auto_mitigate: Optional[bool] = None, + resolve_configuration: Optional["_models.RuleResolveConfiguration"] = None, + **kwargs: Any ) -> None: """ - :keyword value: The collection of subscription diagnostic settings resources. - :paramtype value: list[~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource] + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.monitor.models.Identity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword description: The description of the scheduled query rule. + :paramtype description: str + :keyword display_name: The display name of the alert rule. + :paramtype display_name: str + :keyword severity: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + severest. Relevant and required only for rules of the kind LogAlert. Known values are: 0, 1, 2, + 3, and 4. + :paramtype severity: int or ~azure.mgmt.monitor.models.AlertSeverity + :keyword enabled: The flag which indicates whether this scheduled query rule is enabled. Value + should be true or false. + :paramtype enabled: bool + :keyword scopes: The list of resource id's that this scheduled query rule is scoped to. + :paramtype scopes: list[str] + :keyword evaluation_frequency: How often the scheduled query rule is evaluated represented in + ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + :paramtype evaluation_frequency: ~datetime.timedelta + :keyword window_size: The period of time (in ISO 8601 duration format) on which the Alert query + will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + :paramtype window_size: ~datetime.timedelta + :keyword override_query_time_range: If specified then overrides the query time range (default + is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + :paramtype override_query_time_range: ~datetime.timedelta + :keyword target_resource_types: List of resource type of the target resource(s) on which the + alert is created/updated. For example if the scope is a resource group and targetResourceTypes + is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual + machine in the resource group which meet the alert criteria. Relevant only for rules of the + kind LogAlert. + :paramtype target_resource_types: list[str] + :keyword criteria: The rule criteria that defines the conditions of the scheduled query rule. + :paramtype criteria: ~azure.mgmt.monitor.models.ScheduledQueryRuleCriteria + :keyword mute_actions_duration: Mute actions for the chosen period of time (in ISO 8601 + duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + :paramtype mute_actions_duration: ~datetime.timedelta + :keyword actions: Actions to invoke when the alert fires. + :paramtype actions: ~azure.mgmt.monitor.models.Actions + :keyword check_workspace_alerts_storage_configured: The flag which indicates whether this + scheduled query rule should be stored in the customer's storage. The default is false. Relevant + only for rules of the kind LogAlert. + :paramtype check_workspace_alerts_storage_configured: bool + :keyword skip_query_validation: The flag which indicates whether the provided query should be + validated or not. The default is false. Relevant only for rules of the kind LogAlert. + :paramtype skip_query_validation: bool + :keyword auto_mitigate: The flag that indicates whether the alert should be automatically + resolved or not. The default is true. Relevant only for rules of kinds LogAlert and + SimpleLogAlert. + :paramtype auto_mitigate: bool + :keyword resolve_configuration: Defines the configuration for resolving fired alerts. Relevant + only for rules of kinds LogAlert and SimpleLogAlert. + :paramtype resolve_configuration: ~azure.mgmt.monitor.models.RuleResolveConfiguration """ super().__init__(**kwargs) - self.value = value + self.identity = identity + self.tags = tags + self.created_with_api_version: Optional[str] = None + self.is_legacy_log_analytics_rule: Optional[bool] = None + self.description = description + self.display_name = display_name + self.severity = severity + self.enabled = enabled + self.scopes = scopes + self.evaluation_frequency = evaluation_frequency + self.window_size = window_size + self.override_query_time_range = override_query_time_range + self.target_resource_types = target_resource_types + self.criteria = criteria + self.mute_actions_duration = mute_actions_duration + self.actions = actions + self.is_workspace_alerts_storage_configured: Optional[bool] = None + self.check_workspace_alerts_storage_configured = check_workspace_alerts_storage_configured + self.skip_query_validation = skip_query_validation + self.auto_mitigate = auto_mitigate + self.resolve_configuration = resolve_configuration -class SubscriptionLogSettings(_serialization.Model): - """Part of Subscription diagnostic setting. Specifies the settings for a particular log. +class SmsReceiver(_serialization.Model): + """An SMS receiver. + + 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 category: Name of a Subscription Diagnostic Log category for a resource type this setting - is applied to. - :vartype category: str - :ivar enabled: a value indicating whether this log is enabled. Required. - :vartype enabled: bool + :ivar name: The name of the SMS receiver. Names must be unique across all receivers within an + action group. Required. + :vartype name: str + :ivar country_code: The country code of the SMS receiver. Required. + :vartype country_code: str + :ivar phone_number: The phone number of the SMS receiver. Required. + :vartype phone_number: str + :ivar status: The status of the receiver. Known values are: "NotSpecified", "Enabled", and + "Disabled". + :vartype status: str or ~azure.mgmt.monitor.models.ReceiverStatus """ _validation = { - "enabled": {"required": True}, + "name": {"required": True}, + "country_code": {"required": True}, + "phone_number": {"required": True}, + "status": {"readonly": True}, } _attribute_map = { - "category": {"key": "category", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "country_code": {"key": "countryCode", "type": "str"}, + "phone_number": {"key": "phoneNumber", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__(self, *, enabled: bool, category: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs: Any) -> None: """ - :keyword category: Name of a Subscription Diagnostic Log category for a resource type this - setting is applied to. - :paramtype category: str - :keyword enabled: a value indicating whether this log is enabled. Required. - :paramtype enabled: bool + :keyword name: The name of the SMS receiver. Names must be unique across all receivers within + an action group. Required. + :paramtype name: str + :keyword country_code: The country code of the SMS receiver. Required. + :paramtype country_code: str + :keyword phone_number: The phone number of the SMS receiver. Required. + :paramtype phone_number: str """ super().__init__(**kwargs) - self.category = category - self.enabled = enabled + self.name = name + self.country_code = country_code + self.phone_number = phone_number + self.status: Optional[Union[str, "_models.ReceiverStatus"]] = None class SystemData(_serialization.Model): @@ -8109,27 +2310,6 @@ def __init__( self.last_modified_at = last_modified_at -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - PrivateLinkScope instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - class TestNotificationDetailsResponse(_serialization.Model): """The details of the test notification results. @@ -8189,320 +2369,60 @@ def __init__( self.action_details = action_details -class TimeSeriesBaseline(_serialization.Model): - """The baseline values for a single time series. - - All required parameters must be populated in order to send to server. - - :ivar aggregation: The aggregation type of the metric. Required. - :vartype aggregation: str - :ivar dimensions: The dimensions of this time series. - :vartype dimensions: list[~azure.mgmt.monitor.models.MetricSingleDimension] - :ivar timestamps: The list of timestamps of the baselines. Required. - :vartype timestamps: list[~datetime.datetime] - :ivar data: The baseline values for each sensitivity. Required. - :vartype data: list[~azure.mgmt.monitor.models.SingleBaseline] - :ivar metadata_values: The baseline metadata values. - :vartype metadata_values: list[~azure.mgmt.monitor.models.BaselineMetadata] - """ - - _validation = { - "aggregation": {"required": True}, - "timestamps": {"required": True}, - "data": {"required": True}, - } - - _attribute_map = { - "aggregation": {"key": "aggregation", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[MetricSingleDimension]"}, - "timestamps": {"key": "timestamps", "type": "[iso-8601]"}, - "data": {"key": "data", "type": "[SingleBaseline]"}, - "metadata_values": {"key": "metadataValues", "type": "[BaselineMetadata]"}, - } - - def __init__( - self, - *, - aggregation: str, - timestamps: List[datetime.datetime], - data: List["_models.SingleBaseline"], - dimensions: Optional[List["_models.MetricSingleDimension"]] = None, - metadata_values: Optional[List["_models.BaselineMetadata"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword aggregation: The aggregation type of the metric. Required. - :paramtype aggregation: str - :keyword dimensions: The dimensions of this time series. - :paramtype dimensions: list[~azure.mgmt.monitor.models.MetricSingleDimension] - :keyword timestamps: The list of timestamps of the baselines. Required. - :paramtype timestamps: list[~datetime.datetime] - :keyword data: The baseline values for each sensitivity. Required. - :paramtype data: list[~azure.mgmt.monitor.models.SingleBaseline] - :keyword metadata_values: The baseline metadata values. - :paramtype metadata_values: list[~azure.mgmt.monitor.models.BaselineMetadata] - """ - super().__init__(**kwargs) - self.aggregation = aggregation - self.dimensions = dimensions - self.timestamps = timestamps - self.data = data - self.metadata_values = metadata_values - - -class TimeSeriesElement(_serialization.Model): - """A time series result type. The discriminator value is always TimeSeries in this case. - - :ivar metadatavalues: The metadata values returned if $filter was specified in the call. - :vartype metadatavalues: list[~azure.mgmt.monitor.models.MetadataValue] - :ivar data: An array of data points representing the metric values. This is only returned if a - result type of data is specified. - :vartype data: list[~azure.mgmt.monitor.models.MetricValue] - """ - - _attribute_map = { - "metadatavalues": {"key": "metadatavalues", "type": "[MetadataValue]"}, - "data": {"key": "data", "type": "[MetricValue]"}, - } - - def __init__( - self, - *, - metadatavalues: Optional[List["_models.MetadataValue"]] = None, - data: Optional[List["_models.MetricValue"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metadatavalues: The metadata values returned if $filter was specified in the call. - :paramtype metadatavalues: list[~azure.mgmt.monitor.models.MetadataValue] - :keyword data: An array of data points representing the metric values. This is only returned - if a result type of data is specified. - :paramtype data: list[~azure.mgmt.monitor.models.MetricValue] - """ - super().__init__(**kwargs) - self.metadatavalues = metadatavalues - self.data = data - - -class TimeWindow(_serialization.Model): - """A specific date-time for the profile. - - All required parameters must be populated in order to send to server. - - :ivar time_zone: the timezone of the start and end times for the profile. Some examples of - valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard - Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central - Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific - Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, - Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western - Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard - Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo - Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, - Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard - Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central - European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard - Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, - Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, - Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West - Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard - Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia - Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, - Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, - Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji - Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands - Standard Time. - :vartype time_zone: str - :ivar start: the start time for the profile in ISO 8601 format. Required. - :vartype start: ~datetime.datetime - :ivar end: the end time for the profile in ISO 8601 format. Required. - :vartype end: ~datetime.datetime - """ - - _validation = { - "start": {"required": True}, - "end": {"required": True}, - } - - _attribute_map = { - "time_zone": {"key": "timeZone", "type": "str"}, - "start": {"key": "start", "type": "iso-8601"}, - "end": {"key": "end", "type": "iso-8601"}, - } - - def __init__( - self, *, start: datetime.datetime, end: datetime.datetime, time_zone: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword time_zone: the timezone of the start and end times for the profile. Some examples of - valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard - Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central - Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific - Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, - Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western - Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard - Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo - Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, - Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard - Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central - European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard - Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, - E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, - Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, - Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran - Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West - Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, - Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard - Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia - Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. - Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, - Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard - Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, - Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, - Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji - Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands - Standard Time. - :paramtype time_zone: str - :keyword start: the start time for the profile in ISO 8601 format. Required. - :paramtype start: ~datetime.datetime - :keyword end: the end time for the profile in ISO 8601 format. Required. - :paramtype end: ~datetime.datetime - """ - super().__init__(**kwargs) - self.time_zone = time_zone - self.start = start - self.end = end - - -class TriggerCondition(_serialization.Model): - """The condition that results in the Log Search rule. +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar threshold_operator: Evaluation operation for rule - 'GreaterThan' or 'LessThan. Known - values are: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", "LessThan", and "Equal". - :vartype threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :ivar threshold: Result or count threshold based on which rule should be triggered. Required. - :vartype threshold: float - :ivar metric_trigger: Trigger condition for metric query rule. - :vartype metric_trigger: ~azure.mgmt.monitor.models.LogMetricTrigger + :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 = { - "threshold_operator": {"required": True}, - "threshold": {"required": True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - "threshold_operator": {"key": "thresholdOperator", "type": "str"}, - "threshold": {"key": "threshold", "type": "float"}, - "metric_trigger": {"key": "metricTrigger", "type": "LogMetricTrigger"}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - *, - threshold_operator: Union[str, "_models.ConditionalOperator"] = "GreaterThanOrEqual", - threshold: float, - metric_trigger: Optional["_models.LogMetricTrigger"] = None, - **kwargs: Any - ) -> None: - """ - :keyword threshold_operator: Evaluation operation for rule - 'GreaterThan' or 'LessThan. Known - values are: "GreaterThanOrEqual", "LessThanOrEqual", "GreaterThan", "LessThan", and "Equal". - :paramtype threshold_operator: str or ~azure.mgmt.monitor.models.ConditionalOperator - :keyword threshold: Result or count threshold based on which rule should be triggered. - Required. - :paramtype threshold: float - :keyword metric_trigger: Trigger condition for metric query rule. - :paramtype metric_trigger: ~azure.mgmt.monitor.models.LogMetricTrigger - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.threshold_operator = threshold_operator - self.threshold = threshold - self.metric_trigger = metric_trigger + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None -class VMInsightsOnboardingStatus(ProxyResource): - """VM Insights onboarding status for a resource. +class UserIdentityProperties(_serialization.Model): + """User assigned identity properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar resource_id: Azure Resource Manager identifier of the resource whose onboarding status is - being represented. - :vartype resource_id: str - :ivar onboarding_status: The onboarding status for the resource. Note that, a higher level - scope, e.g., resource group or subscription, is considered onboarded if at least one resource - under it is onboarded. Known values are: "onboarded", "notOnboarded", and "unknown". - :vartype onboarding_status: str or ~azure.mgmt.monitor.models.OnboardingStatus - :ivar data_status: The status of VM Insights data from the resource. When reported as - ``present`` the data array will contain information about the data containers to which data for - the specified resource is being routed. Known values are: "present" and "notPresent". - :vartype data_status: str or ~azure.mgmt.monitor.models.DataStatus - :ivar data: Containers that currently store VM Insights data for the specified resource. - :vartype data: list[~azure.mgmt.monitor.models.DataContainer] + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "resource_id": {"key": "properties.resourceId", "type": "str"}, - "onboarding_status": {"key": "properties.onboardingStatus", "type": "str"}, - "data_status": {"key": "properties.dataStatus", "type": "str"}, - "data": {"key": "properties.data", "type": "[DataContainer]"}, + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, } - def __init__( - self, - *, - resource_id: Optional[str] = None, - onboarding_status: Optional[Union[str, "_models.OnboardingStatus"]] = None, - data_status: Optional[Union[str, "_models.DataStatus"]] = None, - data: Optional[List["_models.DataContainer"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword resource_id: Azure Resource Manager identifier of the resource whose onboarding status - is being represented. - :paramtype resource_id: str - :keyword onboarding_status: The onboarding status for the resource. Note that, a higher level - scope, e.g., resource group or subscription, is considered onboarded if at least one resource - under it is onboarded. Known values are: "onboarded", "notOnboarded", and "unknown". - :paramtype onboarding_status: str or ~azure.mgmt.monitor.models.OnboardingStatus - :keyword data_status: The status of VM Insights data from the resource. When reported as - ``present`` the data array will contain information about the data containers to which data for - the specified resource is being routed. Known values are: "present" and "notPresent". - :paramtype data_status: str or ~azure.mgmt.monitor.models.DataStatus - :keyword data: Containers that currently store VM Insights data for the specified resource. - :paramtype data: list[~azure.mgmt.monitor.models.DataContainer] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.resource_id = resource_id - self.onboarding_status = onboarding_status - self.data_status = data_status - self.data = data + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class VoiceReceiver(_serialization.Model): @@ -8547,34 +2467,6 @@ def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs: self.phone_number = phone_number -class WebhookNotification(_serialization.Model): - """Webhook notification of an autoscale event. - - :ivar service_uri: the service address to receive the notification. - :vartype service_uri: str - :ivar properties: a property bag of settings. This value can be empty. - :vartype properties: dict[str, str] - """ - - _attribute_map = { - "service_uri": {"key": "serviceUri", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - } - - def __init__( - self, *, service_uri: Optional[str] = None, properties: Optional[Dict[str, str]] = None, **kwargs: Any - ) -> None: - """ - :keyword service_uri: the service address to receive the notification. - :paramtype service_uri: str - :keyword properties: a property bag of settings. This value can be empty. - :paramtype properties: dict[str, str] - """ - super().__init__(**kwargs) - self.service_uri = service_uri - self.properties = properties - - class WebhookReceiver(_serialization.Model): """A webhook receiver. @@ -8595,6 +2487,9 @@ class WebhookReceiver(_serialization.Model): :vartype identifier_uri: str :ivar tenant_id: Indicates the tenant id for aad auth. :vartype tenant_id: str + :ivar managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :vartype managed_identity: str """ _validation = { @@ -8610,6 +2505,7 @@ class WebhookReceiver(_serialization.Model): "object_id": {"key": "objectId", "type": "str"}, "identifier_uri": {"key": "identifierUri", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, + "managed_identity": {"key": "managedIdentity", "type": "str"}, } def __init__( @@ -8622,6 +2518,7 @@ def __init__( object_id: Optional[str] = None, identifier_uri: Optional[str] = None, tenant_id: Optional[str] = None, + managed_identity: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -8640,6 +2537,9 @@ def __init__( :paramtype identifier_uri: str :keyword tenant_id: Indicates the tenant id for aad auth. :paramtype tenant_id: str + :keyword managed_identity: The principal id of the managed identity. The value can be "None", + "SystemAssigned". + :paramtype managed_identity: str """ super().__init__(**kwargs) self.name = name @@ -8649,108 +2549,4 @@ def __init__( self.object_id = object_id self.identifier_uri = identifier_uri self.tenant_id = tenant_id - - -class WebtestLocationAvailabilityCriteria(MetricAlertCriteria): - """Specifies the metric alert rule criteria for a web test resource. - - All required parameters must be populated in order to send to server. - - :ivar additional_properties: Unmatched properties from the message are deserialized to this - collection. - :vartype additional_properties: dict[str, JSON] - :ivar odata_type: specifies the type of the alert criteria. Required. Known values are: - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", and - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria". - :vartype odata_type: str or ~azure.mgmt.monitor.models.Odatatype - :ivar web_test_id: The Application Insights web test Id. Required. - :vartype web_test_id: str - :ivar component_id: The Application Insights resource Id. Required. - :vartype component_id: str - :ivar failed_location_count: The number of failed locations. Required. - :vartype failed_location_count: float - """ - - _validation = { - "odata_type": {"required": True}, - "web_test_id": {"required": True}, - "component_id": {"required": True}, - "failed_location_count": {"required": True}, - } - - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "odata_type": {"key": "odata\\.type", "type": "str"}, - "web_test_id": {"key": "webTestId", "type": "str"}, - "component_id": {"key": "componentId", "type": "str"}, - "failed_location_count": {"key": "failedLocationCount", "type": "float"}, - } - - def __init__( - self, - *, - web_test_id: str, - component_id: str, - failed_location_count: float, - additional_properties: Optional[Dict[str, JSON]] = None, - **kwargs: Any - ) -> None: - """ - :keyword additional_properties: Unmatched properties from the message are deserialized to this - collection. - :paramtype additional_properties: dict[str, JSON] - :keyword web_test_id: The Application Insights web test Id. Required. - :paramtype web_test_id: str - :keyword component_id: The Application Insights resource Id. Required. - :paramtype component_id: str - :keyword failed_location_count: The number of failed locations. Required. - :paramtype failed_location_count: float - """ - super().__init__(additional_properties=additional_properties, **kwargs) - self.odata_type: str = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" - self.web_test_id = web_test_id - self.component_id = component_id - self.failed_location_count = failed_location_count - - -class WorkspaceInfo(_serialization.Model): - """Information about a Log Analytics Workspace. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure Resource Manager identifier of the Log Analytics Workspace. Required. - :vartype id: str - :ivar location: Location of the Log Analytics workspace. Required. - :vartype location: str - :ivar customer_id: Log Analytics workspace identifier. Required. - :vartype customer_id: str - """ - - _validation = { - "id": {"required": True}, - "location": {"required": True}, - "customer_id": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "customer_id": {"key": "properties.customerId", "type": "str"}, - } - - def __init__( - self, *, id: str, location: str, customer_id: str, **kwargs: Any # pylint: disable=redefined-builtin - ) -> None: - """ - :keyword id: Azure Resource Manager identifier of the Log Analytics Workspace. Required. - :paramtype id: str - :keyword location: Location of the Log Analytics workspace. Required. - :paramtype location: str - :keyword customer_id: Log Analytics workspace identifier. Required. - :paramtype customer_id: str - """ - super().__init__(**kwargs) - self.id = id - self.location = location - self.customer_id = customer_id + self.managed_identity = managed_identity 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 2593cb152f7d..3433d7fff7ec 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 @@ -10,71 +10,27 @@ from azure.core import CaseInsensitiveEnumMeta -class AggregationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the aggregation type of the metric.""" - - NONE = "None" - AVERAGE = "Average" - COUNT = "Count" - MINIMUM = "Minimum" - MAXIMUM = "Maximum" - TOTAL = "Total" - - -class AggregationTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the criteria time aggregation types.""" - - AVERAGE = "Average" - COUNT = "Count" - MINIMUM = "Minimum" - MAXIMUM = "Maximum" - TOTAL = "Total" - - -class AlertSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Severity Level of Alert.""" - - ZERO = "0" - ONE = "1" - TWO = "2" - THREE = "3" - FOUR = "4" - - -class BaselineSensitivity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the sensitivity of the baseline.""" - - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" - - -class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the diagnostic settings category.""" +class AlertSeverity(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and + required only for rules of the kind LogAlert. + """ - METRICS = "Metrics" - LOGS = "Logs" + ZERO = 0 + ONE = 1 + TWO = 2 + THREE = 3 + FOUR = 4 -class ComparisonOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the operator that is used to compare the metric data and the threshold.""" +class ConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The criteria operator. Relevant and required only for rules of the kind LogAlert.""" EQUALS = "Equals" - NOT_EQUALS = "NotEquals" GREATER_THAN = "GreaterThan" GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" LESS_THAN = "LessThan" LESS_THAN_OR_EQUAL = "LessThanOrEqual" - - -class ConditionalOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Result Condition Evaluation criteria.""" - - GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" - LESS_THAN_OR_EQUAL = "LessThanOrEqual" - GREATER_THAN = "GreaterThan" - LESS_THAN = "LessThan" - EQUAL = "Equal" + GREATER_OR_LESS_THAN = "GreaterOrLessThan" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -93,175 +49,44 @@ class CriterionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DYNAMIC_THRESHOLD_CRITERION = "DynamicThresholdCriterion" -class DataSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Datasource kind.""" - - PERFORMANCE_COUNTER = "PerformanceCounter" - ETW_PROVIDERS = "ETWProviders" - WINDOWS_EVENT_LOGS = "WindowsEventLogs" - - -class DataStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of VM Insights data from the resource. When reported as ``present`` the data array - will contain information about the data containers to which data for the specified resource is - being routed. - """ - - PRESENT = "present" - NOT_PRESENT = "notPresent" - - -class DynamicThresholdOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operator used to compare the metric value against the threshold.""" - - GREATER_THAN = "GreaterThan" - LESS_THAN = "LessThan" - GREATER_OR_LESS_THAN = "GreaterOrLessThan" - - -class DynamicThresholdSensitivity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The extent of deviation required to trigger an alert. This will affect how tight the threshold - is to the metric series pattern. - """ - - LOW = "Low" - MEDIUM = "Medium" - HIGH = "High" - - -class Enabled(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The flag which indicates whether the Log Search rule is enabled. Value should be true or false.""" - - TRUE = "true" - FALSE = "false" - - -class EventLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the event level.""" - - CRITICAL = "Critical" - ERROR = "Error" - WARNING = "Warning" - INFORMATIONAL = "Informational" - VERBOSE = "Verbose" - - -class GuestDiagnosticSettingsOsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Operating system type for the configuration.""" +class DimensionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Operator for dimension values.""" - WINDOWS = "Windows" - LINUX = "Linux" + INCLUDE = "Include" + EXCLUDE = "Exclude" -class MetricClass(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The class of the metric.""" +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity.""" - AVAILABILITY = "Availability" - TRANSACTIONS = "Transactions" - ERRORS = "Errors" - LATENCY = "Latency" - SATURATION = "Saturation" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + NONE = "None" -class MetricStatisticType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the metric statistic type. How the metrics from multiple instances are combined.""" +class IncidentManagementService(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The incident management service type.""" - AVERAGE = "Average" - MIN = "Min" - MAX = "Max" - SUM = "Sum" - COUNT = "Count" + ICM = "Icm" -class MetricTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Metric Trigger Evaluation Type.""" - - CONSECUTIVE = "Consecutive" - TOTAL = "Total" +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the type of scheduled query rule. The default is LogAlert.""" + LOG_ALERT = "LogAlert" + SIMPLE_LOG_ALERT = "SimpleLogAlert" + LOG_TO_METRIC = "LogToMetric" -class MetricUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The unit of the metric.""" - COUNT = "Count" - BYTES = "Bytes" - SECONDS = "Seconds" - COUNT_PER_SECOND = "CountPerSecond" - BYTES_PER_SECOND = "BytesPerSecond" - PERCENT = "Percent" - MILLI_SECONDS = "MilliSeconds" - BYTE_SECONDS = "ByteSeconds" - UNSPECIFIED = "Unspecified" - CORES = "Cores" - MILLI_CORES = "MilliCores" - NANO_CORES = "NanoCores" - BITS_PER_SECOND = "BitsPerSecond" - - -class NamespaceClassification(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Kind of namespace.""" - - PLATFORM = "Platform" - CUSTOM = "Custom" - QOS = "Qos" - - -class Odatatype(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """specifies the type of the alert criteria.""" - - MICROSOFT_AZURE_MONITOR_SINGLE_RESOURCE_MULTIPLE_METRIC_CRITERIA = ( - "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - ) - MICROSOFT_AZURE_MONITOR_MULTIPLE_RESOURCE_MULTIPLE_METRIC_CRITERIA = ( - "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - ) - MICROSOFT_AZURE_MONITOR_WEBTEST_LOCATION_AVAILABILITY_CRITERIA = ( - "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" - ) - - -class OnboardingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The onboarding status for the resource. Note that, a higher level scope, e.g., resource group - or subscription, is considered onboarded if at least one resource under it is onboarded. +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). """ - ONBOARDED = "onboarded" - NOT_ONBOARDED = "notOnboarded" - UNKNOWN = "unknown" - - -class Operator(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the criteria operator.""" - - EQUALS = "Equals" - GREATER_THAN = "GreaterThan" - GREATER_THAN_OR_EQUAL = "GreaterThanOrEqual" - LESS_THAN = "LessThan" - LESS_THAN_OR_EQUAL = "LessThanOrEqual" - INCLUDE = "Include" - - -class PredictiveAutoscalePolicyScaleMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the predictive autoscale mode.""" - - DISABLED = "Disabled" - FORECAST_ONLY = "ForecastOnly" - ENABLED = "Enabled" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the scheduled query rule.""" - - SUCCEEDED = "Succeeded" - DEPLOYING = "Deploying" - CANCELED = "Canceled" - FAILED = "Failed" - - -class QueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Set value to 'ResultAccount'.""" - - RESULT_COUNT = "ResultCount" + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" class ReceiverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -274,72 +99,11 @@ class ReceiverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" -class RecurrenceFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the recurrence frequency. How often the schedule profile should take effect. This value must be - Week, meaning each week will have the same set of profiles. For example, to set a daily - schedule, set **schedule** to every day of the week. The frequency property specifies that the - schedule is repeated weekly. - """ - - NONE = "None" - SECOND = "Second" - MINUTE = "Minute" - HOUR = "Hour" - DAY = "Day" - WEEK = "Week" - MONTH = "Month" - YEAR = "Year" - - -class ResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ResultType.""" - - DATA = "Data" - METADATA = "Metadata" - - -class ScaleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the scale direction. Whether the scaling action increases or decreases the number of instances.""" - - NONE = "None" - INCREASE = "Increase" - DECREASE = "Decrease" - - -class ScaleRuleMetricDimensionOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to - any of the values. 'NotEquals' being not equal to all of the values. - """ - - EQUALS = "Equals" - NOT_EQUALS = "NotEquals" - - -class ScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the type of action that should occur when the scale rule fires.""" - - CHANGE_COUNT = "ChangeCount" - PERCENT_CHANGE_COUNT = "PercentChangeCount" - EXACT_COUNT = "ExactCount" - SERVICE_ALLOWED_NEXT_VALUE = "ServiceAllowedNextValue" - - -class SinkConfigurationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SinkConfigurationKind.""" - - EVENT_HUB = "EventHub" - APPLICATION_INSIGHTS = "ApplicationInsights" - LOG_ANALYTICS = "LogAnalytics" - - -class TimeAggregationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """time aggregation type. How the data that is collected should be combined over time. The default - value is Average. - """ +class TimeAggregation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Aggregation type. Relevant and required only for rules of the kind LogAlert.""" + COUNT = "Count" AVERAGE = "Average" MINIMUM = "Minimum" MAXIMUM = "Maximum" TOTAL = "Total" - COUNT = "Count" - LAST = "Last" 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 11574f0dde87..d88087652e75 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 @@ -13,34 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._action_groups_operations import ActionGroupsOperations # type: ignore -from ._activity_log_alerts_operations import ActivityLogAlertsOperations # type: ignore -from ._activity_logs_operations import ActivityLogsOperations # type: ignore -from ._tenant_activity_logs_operations import TenantActivityLogsOperations # type: ignore -from ._alert_rule_incidents_operations import AlertRuleIncidentsOperations # type: ignore -from ._autoscale_settings_operations import AutoscaleSettingsOperations # type: ignore -from ._predictive_metric_operations import PredictiveMetricOperations # type: ignore -from ._baselines_operations import BaselinesOperations # type: ignore -from ._diagnostic_settings_operations import DiagnosticSettingsOperations # type: ignore -from ._diagnostic_settings_category_operations import DiagnosticSettingsCategoryOperations # type: ignore -from ._event_categories_operations import EventCategoriesOperations # type: ignore -from ._guest_diagnostics_settings_operations import GuestDiagnosticsSettingsOperations # type: ignore -from ._guest_diagnostics_settings_association_operations import GuestDiagnosticsSettingsAssociationOperations # type: ignore -from ._log_profiles_operations import LogProfilesOperations # type: ignore -from ._metric_alerts_operations import MetricAlertsOperations # type: ignore -from ._metric_alerts_status_operations import MetricAlertsStatusOperations # type: ignore -from ._metric_definitions_operations import MetricDefinitionsOperations # type: ignore -from ._metric_namespaces_operations import MetricNamespacesOperations # type: ignore -from ._metrics_operations import MetricsOperations # type: ignore -from ._operations import Operations # type: ignore from ._scheduled_query_rules_operations import ScheduledQueryRulesOperations # type: ignore -from ._service_diagnostic_settings_operations import ServiceDiagnosticSettingsOperations # type: ignore -from ._vm_insights_operations import VMInsightsOperations # type: ignore -from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore -from ._private_link_scope_operation_status_operations import PrivateLinkScopeOperationStatusOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_link_scoped_resources_operations import PrivateLinkScopedResourcesOperations # type: ignore -from ._subscription_diagnostic_settings_operations import SubscriptionDiagnosticSettingsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -48,34 +21,7 @@ __all__ = [ "ActionGroupsOperations", - "ActivityLogAlertsOperations", - "ActivityLogsOperations", - "TenantActivityLogsOperations", - "AlertRuleIncidentsOperations", - "AutoscaleSettingsOperations", - "PredictiveMetricOperations", - "BaselinesOperations", - "DiagnosticSettingsOperations", - "DiagnosticSettingsCategoryOperations", - "EventCategoriesOperations", - "GuestDiagnosticsSettingsOperations", - "GuestDiagnosticsSettingsAssociationOperations", - "LogProfilesOperations", - "MetricAlertsOperations", - "MetricAlertsStatusOperations", - "MetricDefinitionsOperations", - "MetricNamespacesOperations", - "MetricsOperations", - "Operations", "ScheduledQueryRulesOperations", - "ServiceDiagnosticSettingsOperations", - "VMInsightsOperations", - "PrivateLinkScopesOperations", - "PrivateLinkScopeOperationStatusOperations", - "PrivateLinkResourcesOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkScopedResourcesOperations", - "SubscriptionDiagnosticSettingsOperations", ] __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/_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_action_groups_operations.py index 761c87138142..c7f0987f81a9 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_action_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # 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 -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +31,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import MonitorManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +47,7 @@ def build_create_or_update_request( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -57,7 +55,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -85,14 +83,14 @@ def build_get_request( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -118,14 +116,14 @@ def build_delete_request( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -151,7 +149,7 @@ def build_update_request( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -159,7 +157,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -181,77 +179,13 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_post_test_notifications_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", "2022-06-01")) - 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}/providers/Microsoft.Insights/createNotifications" - ) - 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 - 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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_notifications_at_resource_group_level_request( # pylint: disable=name-too-long - 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", "2022-06-01")) - 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/createNotifications", - ) # pylint: disable=line-too-long - 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 - 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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_create_notifications_at_action_group_resource_level_request( # pylint: disable=name-too-long resource_group_name: str, action_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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -259,7 +193,7 @@ def build_create_notifications_at_action_group_resource_level_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/createNotifications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -281,81 +215,20 @@ def build_create_notifications_at_action_group_resource_level_request( # pylint return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_test_notifications_request(notification_id: 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", "2022-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "notificationId": _SERIALIZER.url("notification_id", notification_id, "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_test_notifications_at_resource_group_level_request( # pylint: disable=name-too-long - resource_group_name: str, notification_id: 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", "2022-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/notificationStatus/{notificationId}", - ) # pylint: disable=line-too-long - 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 - ), - "notificationId": _SERIALIZER.url("notification_id", notification_id, "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_test_notifications_at_action_group_resource_level_request( # pylint: disable=name-too-long resource_group_name: str, action_group_name: str, notification_id: 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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/notificationStatus/{notificationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -380,7 +253,7 @@ def build_list_by_subscription_id_request(subscription_id: str, **kwargs: Any) - _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -404,14 +277,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -436,7 +309,7 @@ def build_enable_receiver_request( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -444,7 +317,7 @@ def build_enable_receiver_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -480,10 +353,10 @@ class ActionGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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") @overload def create_or_update( @@ -572,7 +445,7 @@ def create_or_update( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) @@ -640,7 +513,7 @@ def get(self, resource_group_name: str, action_group_name: str, **kwargs: Any) - _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) _request = build_get_request( @@ -698,7 +571,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -813,7 +686,7 @@ def update( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) @@ -857,8 +730,12 @@ def update( return deserialized # type: ignore - def _post_test_notifications_initial( - self, notification_request: Union[_models.NotificationRequestBody, IO[bytes]], **kwargs: Any + def _create_notifications_at_action_group_resource_level_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + action_group_name: str, + notification_request: Union[_models.NotificationRequestBody, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -871,7 +748,7 @@ def _post_test_notifications_initial( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -883,7 +760,9 @@ def _post_test_notifications_initial( else: _json = self._serialize.body(notification_request, "NotificationRequestBody") - _request = build_post_test_notifications_request( + _request = build_create_notifications_at_action_group_resource_level_request( + resource_group_name=resource_group_name, + action_group_name=action_group_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -923,8 +802,10 @@ def _post_test_notifications_initial( return deserialized # type: ignore @overload - def begin_post_test_notifications( + def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long self, + resource_group_name: str, + action_group_name: str, notification_request: _models.NotificationRequestBody, *, content_type: str = "application/json", @@ -932,6 +813,11 @@ def begin_post_test_notifications( ) -> LROPoller[_models.TestNotificationDetailsResponse]: """Send test notifications to a set of provided receivers. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param action_group_name: The name of the action group. Required. + :type action_group_name: str :param notification_request: The notification request body which includes the contact details. Required. :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody @@ -946,11 +832,22 @@ def begin_post_test_notifications( """ @overload - def begin_post_test_notifications( - self, notification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long + self, + resource_group_name: str, + action_group_name: str, + notification_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> LROPoller[_models.TestNotificationDetailsResponse]: """Send test notifications to a set of provided receivers. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param action_group_name: The name of the action group. Required. + :type action_group_name: str :param notification_request: The notification request body which includes the contact details. Required. :type notification_request: IO[bytes] @@ -965,11 +862,20 @@ def begin_post_test_notifications( """ @distributed_trace - def begin_post_test_notifications( - self, notification_request: Union[_models.NotificationRequestBody, IO[bytes]], **kwargs: Any + def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long + self, + resource_group_name: str, + action_group_name: str, + notification_request: Union[_models.NotificationRequestBody, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.TestNotificationDetailsResponse]: """Send test notifications to a set of provided receivers. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param action_group_name: The name of the action group. Required. + :type action_group_name: str :param notification_request: The notification request body which includes the contact details. Is either a NotificationRequestBody type or a IO[bytes] type. Required. :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody or IO[bytes] @@ -982,14 +888,16 @@ def begin_post_test_notifications( _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._post_test_notifications_initial( + raw_result = self._create_notifications_at_action_group_resource_level_initial( + resource_group_name=resource_group_name, + action_group_name=action_group_name, notification_request=notification_request, api_version=api_version, content_type=content_type, @@ -1026,512 +934,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _create_notifications_at_resource_group_level_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - 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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(notification_request, (IOBase, bytes)): - _content = notification_request - else: - _json = self._serialize.body(notification_request, "NotificationRequestBody") - - _request = build_create_notifications_at_resource_group_level_request( - resource_group_name=resource_group_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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: _models.NotificationRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: 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: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_request: The notification request body which includes the contact details. - Is either a NotificationRequestBody type or a IO[bytes] type. Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody or IO[bytes] - :return: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_notifications_at_resource_group_level_initial( - resource_group_name=resource_group_name, - notification_request=notification_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.TestNotificationDetailsResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.TestNotificationDetailsResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _create_notifications_at_action_group_resource_level_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - action_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - 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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(notification_request, (IOBase, bytes)): - _content = notification_request - else: - _json = self._serialize.body(notification_request, "NotificationRequestBody") - - _request = build_create_notifications_at_action_group_resource_level_request( - resource_group_name=resource_group_name, - action_group_name=action_group_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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - action_group_name: str, - notification_request: _models.NotificationRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param action_group_name: The name of the action group. Required. - :type action_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - action_group_name: str, - notification_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param action_group_name: The name of the action group. Required. - :type action_group_name: str - :param notification_request: The notification request body which includes the contact details. - Required. - :type notification_request: 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: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_notifications_at_action_group_resource_level( # pylint: disable=name-too-long - self, - resource_group_name: str, - action_group_name: str, - notification_request: Union[_models.NotificationRequestBody, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.TestNotificationDetailsResponse]: - """Send test notifications to a set of provided receivers. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param action_group_name: The name of the action group. Required. - :type action_group_name: str - :param notification_request: The notification request body which includes the contact details. - Is either a NotificationRequestBody type or a IO[bytes] type. Required. - :type notification_request: ~azure.mgmt.monitor.models.NotificationRequestBody or IO[bytes] - :return: An instance of LROPoller that returns either TestNotificationDetailsResponse or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.TestNotificationDetailsResponse] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2022-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_notifications_at_action_group_resource_level_initial( - resource_group_name=resource_group_name, - action_group_name=action_group_name, - notification_request=notification_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.TestNotificationDetailsResponse].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.TestNotificationDetailsResponse]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get_test_notifications(self, notification_id: str, **kwargs: Any) -> _models.TestNotificationDetailsResponse: - """Get the test notifications by the notification id. - - :param notification_id: The notification id. Required. - :type notification_id: str - :return: TestNotificationDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.TestNotificationDetailsResponse - :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", "2022-06-01")) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - - _request = build_get_test_notifications_request( - notification_id=notification_id, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_test_notifications_at_resource_group_level( # pylint: disable=name-too-long - self, resource_group_name: str, notification_id: str, **kwargs: Any - ) -> _models.TestNotificationDetailsResponse: - """Get the test notifications by the notification id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param notification_id: The notification id. Required. - :type notification_id: str - :return: TestNotificationDetailsResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.TestNotificationDetailsResponse - :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", "2022-06-01")) - cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) - - _request = build_get_test_notifications_at_resource_group_level_request( - resource_group_name=resource_group_name, - notification_id=notification_id, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TestNotificationDetailsResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def get_test_notifications_at_action_group_resource_level( # pylint: disable=name-too-long self, resource_group_name: str, action_group_name: str, notification_id: str, **kwargs: Any @@ -1560,7 +962,7 @@ def get_test_notifications_at_action_group_resource_level( # pylint: disable=na _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.TestNotificationDetailsResponse] = kwargs.pop("cls", None) _request = build_get_test_notifications_at_action_group_resource_level_request( @@ -1604,7 +1006,7 @@ def list_by_subscription_id(self, **kwargs: Any) -> Iterable["_models.ActionGrou _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupList] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1673,7 +1075,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) cls: ClsType[_models.ActionGroupList] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1817,7 +1219,7 @@ def enable_receiver( # pylint: disable=inconsistent-return-statements _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", "2022-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_log_alerts_operations.py deleted file mode 100644 index b4f0101b02d9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_log_alerts_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, activity_log_alert_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", "2017-04-01")) - 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/activityLogAlerts/{activityLogAlertName}", - ) # pylint: disable=line-too-long - 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 - ), - "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_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_get_request( - resource_group_name: str, activity_log_alert_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", "2017-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", - ) # pylint: disable=line-too-long - 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 - ), - "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_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_delete_request( - resource_group_name: str, activity_log_alert_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", "2017-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", - ) # pylint: disable=line-too-long - 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 - ), - "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_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) - - -def build_update_request( - resource_group_name: str, activity_log_alert_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", "2017-04-01")) - 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/activityLogAlerts/{activityLogAlertName}", - ) # pylint: disable=line-too-long - 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 - ), - "activityLogAlertName": _SERIALIZER.url("activity_log_alert_name", activity_log_alert_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_list_by_subscription_id_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", "2017-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") - 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_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", "2017-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts", - ) # pylint: disable=line-too-long - 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) - - -class ActivityLogAlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`activity_log_alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: _models.ActivityLogAlertResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Required. - :type activity_log_alert: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Required. - :type activity_log_alert: 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: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert: Union[_models.ActivityLogAlertResource, IO[bytes]], - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Create a new activity log alert or update an existing one. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert: The activity log alert to create or use for the update. Is either a - ActivityLogAlertResource type or a IO[bytes] type. Required. - :type activity_log_alert: ~azure.mgmt.monitor.models.ActivityLogAlertResource or IO[bytes] - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(activity_log_alert, (IOBase, bytes)): - _content = activity_log_alert - else: - _json = self._serialize.body(activity_log_alert, "ActivityLogAlertResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, activity_log_alert_name: str, **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Get an activity log alert. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", 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, activity_log_alert_name: str, **kwargs: Any - ) -> None: - """Delete an activity log alert. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_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", "2017-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: _models.ActivityLogAlertPatchBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Required. - :type activity_log_alert_patch: ~azure.mgmt.monitor.models.ActivityLogAlertPatchBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Required. - :type activity_log_alert_patch: 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: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - activity_log_alert_name: str, - activity_log_alert_patch: Union[_models.ActivityLogAlertPatchBody, IO[bytes]], - **kwargs: Any - ) -> _models.ActivityLogAlertResource: - """Updates an existing ActivityLogAlertResource's tags. To update other fields use the - CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param activity_log_alert_name: The name of the activity log alert. Required. - :type activity_log_alert_name: str - :param activity_log_alert_patch: Parameters supplied to the operation. Is either a - ActivityLogAlertPatchBody type or a IO[bytes] type. Required. - :type activity_log_alert_patch: ~azure.mgmt.monitor.models.ActivityLogAlertPatchBody or - IO[bytes] - :return: ActivityLogAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActivityLogAlertResource - :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", "2017-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActivityLogAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(activity_log_alert_patch, (IOBase, bytes)): - _content = activity_log_alert_patch - else: - _json = self._serialize.body(activity_log_alert_patch, "ActivityLogAlertPatchBody") - - _request = build_update_request( - resource_group_name=resource_group_name, - activity_log_alert_name=activity_log_alert_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActivityLogAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription_id(self, **kwargs: Any) -> Iterable["_models.ActivityLogAlertResource"]: - """Get a list of all activity log alerts in a subscription. - - :return: An iterator like instance of either ActivityLogAlertResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertList] = 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_id_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("ActivityLogAlertList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ActivityLogAlertResource"]: - """Get a list of all activity log alerts in a 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 ActivityLogAlertResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ActivityLogAlertResource] - :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", "2017-04-01")) - cls: ClsType[_models.ActivityLogAlertList] = 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("ActivityLogAlertList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_logs_operations.py deleted file mode 100644 index da1047a8866d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_activity_logs_operations.py +++ /dev/null @@ -1,178 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - subscription_id: str, *, filter: str, select: Optional[str] = None, **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", "2015-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values" - ) # pylint: disable=line-too-long - 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") - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ActivityLogsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`activity_logs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, filter: str, select: Optional[str] = None, **kwargs: Any) -> Iterable["_models.EventData"]: - """Provides the list of records from the activity logs. - - :param filter: Reduces the set of data collected.\\ :code:`
`This argument is required and - it also requires at least the start date/time.\\ :code:`
`The **$filter** argument is very - restricted and allows only the following patterns.\\ :code:`
`- *List events for a resource - group*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.\\ :code:`
`- - *List events for resource*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.\\ - :code:`
`- *List events for a subscription in a time range*\\ : $filter=eventTimestamp ge - '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.\\ - :code:`
`- *List events for a resource provider*\\ : $filter=eventTimestamp ge - '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and - resourceProvider eq 'resourceProviderName'.\\ :code:`
`- *List events for a correlation - Id*\\ : $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le - '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.\\ :code:`
`\\ - :code:`
`\\ **NOTE**\\ : No other syntax is allowed. Required. - :type filter: str - :param select: Used to fetch events with only the given properties.\\ :code:`
`The - **$select** argument is a comma separated list of property names to be returned. Possible - values are: *authorization*\\ , *claims*\\ , *correlationId*\\ , *description*\\ , - *eventDataId*\\ , *eventName*\\ , *eventTimestamp*\\ , *httpRequest*\\ , *level*\\ , - *operationId*\\ , *operationName*\\ , *properties*\\ , *resourceGroupName*\\ , - *resourceProviderName*\\ , *resourceId*\\ , *status*\\ , *submissionTimestamp*\\ , - *subStatus*\\ , *subscriptionId*. Default value is None. - :type select: str - :return: An iterator like instance of either EventData or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.EventData] - :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", "2015-04-01")) - cls: ClsType[_models.EventDataCollection] = 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_request( - subscription_id=self._config.subscription_id, - filter=filter, - select=select, - 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("EventDataCollection", 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_alert_rule_incidents_operations.py deleted file mode 100644 index 9bb3b51c0c13..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_alert_rule_incidents_operations.py +++ /dev/null @@ -1,255 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, rule_name: str, incident_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", "2016-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), - "incidentName": _SERIALIZER.url("incident_name", incident_name, "str"), - "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_list_by_alert_rule_request( - resource_group_name: str, 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", "2016-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), - "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) - - -class AlertRuleIncidentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`alert_rule_incidents` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, rule_name: str, incident_name: str, **kwargs: Any) -> _models.Incident: - """Gets an incident associated to an alert rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param incident_name: The name of the incident to retrieve. Required. - :type incident_name: str - :return: Incident or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.Incident - :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", "2016-03-01")) - cls: ClsType[_models.Incident] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=rule_name, - incident_name=incident_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Incident", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_alert_rule( - self, resource_group_name: str, rule_name: str, **kwargs: Any - ) -> Iterable["_models.Incident"]: - """Gets a list of incidents associated to an alert rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: An iterator like instance of either Incident or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.Incident] - :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", "2016-03-01")) - cls: ClsType[_models.IncidentListResult] = 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_alert_rule_request( - resource_group_name=resource_group_name, - rule_name=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("IncidentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_autoscale_settings_operations.py deleted file mode 100644 index 0c7046d0e4c5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_autoscale_settings_operations.py +++ /dev/null @@ -1,764 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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_create_or_update_request( - resource_group_name: str, autoscale_setting_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", "2022-10-01")) - 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/autoscalesettings/{autoscaleSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, "str"), - "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 - 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_group_name: str, autoscale_setting_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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, "str"), - "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, autoscale_setting_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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, "str"), - "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_update_request( - resource_group_name: str, autoscale_setting_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", "2022-10-01")) - 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/autoscalesettings/{autoscaleSettingName}", - ) # pylint: disable=line-too-long - 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 - ), - "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_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_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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings") - 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) - - -class AutoscaleSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`autoscale_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = 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 - ) -> Iterable["_models.AutoscaleSettingResource"]: - """Lists the autoscale settings for a 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 AutoscaleSettingResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResourceCollection] = 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("AutoscaleSettingResourceCollection", 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: _models.AutoscaleSettingResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - autoscale_setting_name: str, - parameters: Union[_models.AutoscaleSettingResource, IO[bytes]], - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Creates or updates an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param parameters: Parameters supplied to the operation. Is either a AutoscaleSettingResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.AutoscaleSettingResource or IO[bytes] - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AutoscaleSettingResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", 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, autoscale_setting_name: str, **kwargs: Any - ) -> None: - """Deletes and autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_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", "2022-10-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, autoscale_setting_name: str, **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Gets an autoscale setting. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", 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, - autoscale_setting_name: str, - autoscale_setting_resource: _models.AutoscaleSettingResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Required. - :type autoscale_setting_resource: ~azure.mgmt.monitor.models.AutoscaleSettingResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - autoscale_setting_name: str, - autoscale_setting_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Required. - :type autoscale_setting_resource: 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: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - autoscale_setting_name: str, - autoscale_setting_resource: Union[_models.AutoscaleSettingResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.AutoscaleSettingResource: - """Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param autoscale_setting_resource: Parameters supplied to the operation. Is either a - AutoscaleSettingResourcePatch type or a IO[bytes] type. Required. - :type autoscale_setting_resource: ~azure.mgmt.monitor.models.AutoscaleSettingResourcePatch or - IO[bytes] - :return: AutoscaleSettingResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AutoscaleSettingResource - :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", "2022-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoscaleSettingResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(autoscale_setting_resource, (IOBase, bytes)): - _content = autoscale_setting_resource - else: - _json = self._serialize.body(autoscale_setting_resource, "AutoscaleSettingResourcePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoscaleSettingResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AutoscaleSettingResource"]: - """Lists the autoscale settings for a subscription. - - :return: An iterator like instance of either AutoscaleSettingResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AutoscaleSettingResource] - :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", "2022-10-01")) - cls: ClsType[_models.AutoscaleSettingResourceCollection] = 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("AutoscaleSettingResourceCollection", 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_baselines_operations.py deleted file mode 100644 index 90581a8a31fc..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_baselines_operations.py +++ /dev/null @@ -1,231 +0,0 @@ -# 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 datetime -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_uri: str, - *, - metricnames: Optional[str] = None, - metricnamespace: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - **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", "2019-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metricBaselines") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if metricnames is not None: - _params["metricnames"] = _SERIALIZER.query("metricnames", metricnames, "str") - if metricnamespace is not None: - _params["metricnamespace"] = _SERIALIZER.query("metricnamespace", metricnamespace, "str") - if timespan is not None: - _params["timespan"] = _SERIALIZER.query("timespan", timespan, "str") - if interval is not None: - _params["interval"] = _SERIALIZER.query("interval", interval, "duration") - if aggregation is not None: - _params["aggregation"] = _SERIALIZER.query("aggregation", aggregation, "str") - if sensitivities is not None: - _params["sensitivities"] = _SERIALIZER.query("sensitivities", sensitivities, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if result_type is not None: - _params["resultType"] = _SERIALIZER.query("result_type", result_type, "str") - _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) - - -class BaselinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`baselines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_uri: str, - metricnames: Optional[str] = None, - metricnamespace: Optional[str] = None, - timespan: Optional[str] = None, - interval: Optional[datetime.timedelta] = None, - aggregation: Optional[str] = None, - sensitivities: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - **kwargs: Any - ) -> Iterable["_models.SingleMetricBaseline"]: - """**Lists the metric baseline values for a resource**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. Default value is None. - :type metricnames: str - :param metricnamespace: Metric namespace that contains the requested metric names. Default - value is None. - :type metricnamespace: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Default value is None. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. Default value is None. - :type interval: ~datetime.timedelta - :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value - is None. - :type aggregation: str - :param sensitivities: The list of sensitivities (comma separated) to retrieve. Default value is - None. - :type sensitivities: str - :param filter: The **$filter** is used to reduce the set of metric data returned. Example: - Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or - b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A - eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or - operator cannot separate two different metadata names. - Return all time series where A = a1, B - = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series - where A = a1 **$filter=A eq 'a1' and B eq '\\ *' and C eq '*\\ '**. Special case: When - dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) - 1** Instead of using $filter= "dim (test) 1 eq '\\ *' " use **$filter= "dim %2528test%2529 1 eq - '*\\ ' "\\ ** When dimension name is **\\ dim (test) 3\\ ** and dimension value is **\\ dim3 - (test) val\\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\\ - $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. - :type filter: str - :param result_type: Allows retrieving only metadata of the baseline. On data request all - information is retrieved. Known values are: "Data" and "Metadata". Default value is None. - :type result_type: str or ~azure.mgmt.monitor.models.ResultType - :return: An iterator like instance of either SingleMetricBaseline or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.SingleMetricBaseline] - :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", "2019-03-01")) - cls: ClsType[_models.MetricBaselinesResponse] = 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_request( - resource_uri=resource_uri, - metricnames=metricnames, - metricnamespace=metricnamespace, - timespan=timespan, - interval=interval, - aggregation=aggregation, - sensitivities=sensitivities, - filter=filter, - result_type=result_type, - 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("MetricBaselinesResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_category_operations.py deleted file mode 100644 index 9a15ed4b6967..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_category_operations.py +++ /dev/null @@ -1,212 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_uri: str, 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", "2017-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "name": _SERIALIZER.url("name", 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_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", "2017-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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) - - -class DiagnosticSettingsCategoryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`diagnostic_settings_category` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_uri: str, name: str, **kwargs: Any) -> _models.DiagnosticSettingsCategoryResource: - """Gets the diagnostic settings category for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: DiagnosticSettingsCategoryResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResource - :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", "2017-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsCategoryResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsCategoryResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, resource_uri: str, **kwargs: Any) -> _models.DiagnosticSettingsCategoryResourceCollection: - """Lists the diagnostic settings categories for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: DiagnosticSettingsCategoryResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsCategoryResourceCollection - :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", "2017-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsCategoryResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "DiagnosticSettingsCategoryResourceCollection", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_operations.py deleted file mode 100644 index 356321ca281c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_diagnostic_settings_operations.py +++ /dev/null @@ -1,460 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_uri: str, 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", "2021-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "name": _SERIALIZER.url("name", 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_or_update_request(resource_uri: str, 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", "2021-05-01-preview")) - 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/diagnosticSettings/{name}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "name": _SERIALIZER.url("name", 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, 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", "2021-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "name": _SERIALIZER.url("name", 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) - - -def build_list_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", "2021-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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) - - -class DiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_uri: str, name: str, **kwargs: Any) -> _models.DiagnosticSettingsResource: - """Gets the active diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :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", "2021-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_uri: str, - name: str, - parameters: _models.DiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_uri: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_uri: str, - name: str, - parameters: Union[_models.DiagnosticSettingsResource, IO[bytes]], - **kwargs: Any - ) -> _models.DiagnosticSettingsResource: - """Creates or updates diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Is either a DiagnosticSettingsResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.DiagnosticSettingsResource or IO[bytes] - :return: DiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.DiagnosticSettingsResource - :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", "2021-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_uri=resource_uri, - name=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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DiagnosticSettingsResource", 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, name: str, **kwargs: Any - ) -> None: - """Deletes existing diagnostic settings for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param name: The name of the diagnostic setting. Required. - :type 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", "2021-05-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_uri=resource_uri, - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.DiagnosticSettingsResource"]: - """Gets the active diagnostic settings list for the specified resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: An iterator like instance of either DiagnosticSettingsResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.DiagnosticSettingsResource] - :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", "2021-05-01-preview")) - cls: ClsType[_models.DiagnosticSettingsResourceCollection] = 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_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("DiagnosticSettingsResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_event_categories_operations.py deleted file mode 100644 index 5bef421d35d7..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_event_categories_operations.py +++ /dev/null @@ -1,141 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**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", "2015-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/eventcategories") - - # 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) - - -class EventCategoriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`event_categories` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.LocalizableString"]: - """Get the list of available event categories supported in the Activity Logs Service.\\ - :code:`
`The current list includes the following: Administrative, Security, ServiceHealth, - Alert, Recommendation, Policy. - - :return: An iterator like instance of either LocalizableString or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.LocalizableString] - :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", "2015-04-01")) - cls: ClsType[_models.EventCategoryCollection] = 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_request( - 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("EventCategoryCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_association_operations.py deleted file mode 100644 index 45c9a27c07b5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_association_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_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", "2018-06-01-preview")) - 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/guestDiagnosticSettingsAssociation/{associationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "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_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "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_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/{resourceUri}/providers/microsoft.insights/guestDiagnosticSettingsAssociation/{associationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "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) - - -def build_update_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", "2018-06-01-preview")) - 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/guestDiagnosticSettingsAssociation/{associationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettingsAssociations", - ) # pylint: disable=line-too-long - 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_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettingsAssociations", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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) - - -class GuestDiagnosticsSettingsAssociationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`guest_diagnostics_settings_association` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: _models.GuestDiagnosticSettingsAssociationResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Required. - :type diagnostic_settings_association: - ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Required. - :type diagnostic_settings_association: 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: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_uri: str, - association_name: str, - diagnostic_settings_association: Union[_models.GuestDiagnosticSettingsAssociationResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Creates or updates guest diagnostics settings association. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param diagnostic_settings_association: The diagnostic settings association to create or - update. Is either a GuestDiagnosticSettingsAssociationResource type or a IO[bytes] type. - Required. - :type diagnostic_settings_association: - ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource or IO[bytes] - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_settings_association, (IOBase, bytes)): - _content = diagnostic_settings_association - else: - _json = self._serialize.body(diagnostic_settings_association, "GuestDiagnosticSettingsAssociationResource") - - _request = build_create_or_update_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_uri: str, association_name: str, **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Gets guest diagnostics association settings. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", 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: - """Delete guest diagnostics association settings. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. 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", "2018-06-01-preview")) - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def update( - self, - resource_uri: str, - association_name: str, - parameters: _models.GuestDiagnosticSettingsAssociationResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_uri: str, - association_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_uri: str, - association_name: str, - parameters: Union[_models.GuestDiagnosticSettingsAssociationResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsAssociationResource: - """Updates an existing guestDiagnosticsSettingsAssociation Resource. To update other fields use - the CreateOrUpdate method. - - :param resource_uri: The fully qualified ID of the resource, including the resource name and - resource type. Required. - :type resource_uri: str - :param association_name: The name of the diagnostic settings association. Required. - :type association_name: str - :param parameters: Parameters supplied to the operation. Is either a - GuestDiagnosticSettingsAssociationResourcePatch type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResourcePatch or - IO[bytes] - :return: GuestDiagnosticSettingsAssociationResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GuestDiagnosticSettingsAssociationResourcePatch") - - _request = build_update_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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsAssociationResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.GuestDiagnosticSettingsAssociationResource"]: - """Get a list of all guest diagnostic settings association in a subscription. - - :return: An iterator like instance of either GuestDiagnosticSettingsAssociationResource or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationList] = 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_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("GuestDiagnosticSettingsAssociationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.GuestDiagnosticSettingsAssociationResource"]: - """Get a list of all guest diagnostic settings association in a 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 GuestDiagnosticSettingsAssociationResource or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsAssociationResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsAssociationList] = 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("GuestDiagnosticSettingsAssociationList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_operations.py deleted file mode 100644 index 747e968ecdba..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_guest_diagnostics_settings_operations.py +++ /dev/null @@ -1,765 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, diagnostic_settings_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", "2018-06-01-preview")) - 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/guestDiagnosticSettings/{diagnosticSettingsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, "str"), - "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 - 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_get_request( - resource_group_name: str, diagnostic_settings_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, "str"), - "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_update_request( - resource_group_name: str, diagnostic_settings_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", "2018-06-01-preview")) - 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/guestDiagnosticSettings/{diagnosticSettingsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, "str"), - "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 - 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, diagnostic_settings_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings/{diagnosticSettingsName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "diagnosticSettingsName": _SERIALIZER.url("diagnostic_settings_name", diagnostic_settings_name, "str"), - "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/guestDiagnosticSettings" - ) - 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_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", "2018-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/guestDiagnosticSettings", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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) - - -class GuestDiagnosticsSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`guest_diagnostics_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: _models.GuestDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Required. - :type diagnostic_settings: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Required. - :type diagnostic_settings: 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: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - diagnostic_settings: Union[_models.GuestDiagnosticSettingsResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Creates or updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param diagnostic_settings: The configuration to create or update. Is either a - GuestDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type diagnostic_settings: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource or - IO[bytes] - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(diagnostic_settings, (IOBase, bytes)): - _content = diagnostic_settings - else: - _json = self._serialize.body(diagnostic_settings, "GuestDiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, diagnostic_settings_name: str, **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Gets guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", 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, - diagnostic_settings_name: str, - parameters: _models.GuestDiagnosticSettingsPatchResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsPatchResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Required. - :type parameters: 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: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - diagnostic_settings_name: str, - parameters: Union[_models.GuestDiagnosticSettingsPatchResource, IO[bytes]], - **kwargs: Any - ) -> _models.GuestDiagnosticSettingsResource: - """Updates guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_name: str - :param parameters: The configuration to patch. Is either a GuestDiagnosticSettingsPatchResource - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsPatchResource or IO[bytes] - :return: GuestDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource - :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", "2018-06-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GuestDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "GuestDiagnosticSettingsPatchResource") - - _request = build_update_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("GuestDiagnosticSettingsResource", 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, diagnostic_settings_name: str, **kwargs: Any - ) -> None: - """Delete guest diagnostics settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param diagnostic_settings_name: The name of the diagnostic setting. Required. - :type diagnostic_settings_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", "2018-06-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - diagnostic_settings_name=diagnostic_settings_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.GuestDiagnosticSettingsResource"]: - """Get a list of all guest diagnostic settings in a subscription. - - :return: An iterator like instance of either GuestDiagnosticSettingsResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsList] = 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_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("GuestDiagnosticSettingsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.GuestDiagnosticSettingsResource"]: - """Get a list of all guest diagnostic settings in a 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 GuestDiagnosticSettingsResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.GuestDiagnosticSettingsResource] - :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", "2018-06-01-preview")) - cls: ClsType[_models.GuestDiagnosticSettingsList] = 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("GuestDiagnosticSettingsList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_log_profiles_operations.py deleted file mode 100644 index d7da72c22103..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_log_profiles_operations.py +++ /dev/null @@ -1,579 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request(log_profile_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-03-01")) - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, "str"), - "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") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_request(log_profile_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", "2016-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, "str"), - "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_create_or_update_request(log_profile_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", "2016-03-01")) - 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}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_name, "str"), - "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 - 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(log_profile_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", "2016-03-01")) - 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}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "logProfileName": _SERIALIZER.url("log_profile_name", log_profile_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_list_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", "2016-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles") - 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) - - -class LogProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`log_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def delete(self, log_profile_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Deletes the log profile. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_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", "2016-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - log_profile_name=log_profile_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, log_profile_name: str, **kwargs: Any) -> _models.LogProfileResource: - """Gets the log profile. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - _request = build_get_request( - log_profile_name=log_profile_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - log_profile_name: str, - parameters: _models.LogProfileResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.LogProfileResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, log_profile_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, log_profile_name: str, parameters: Union[_models.LogProfileResource, IO[bytes]], **kwargs: Any - ) -> _models.LogProfileResource: - """Create or update a log profile in Azure Monitoring REST API. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param parameters: Parameters supplied to the operation. Is either a LogProfileResource type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogProfileResource or IO[bytes] - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LogProfileResource") - - _request = build_create_or_update_request( - log_profile_name=log_profile_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - log_profile_name: str, - log_profiles_resource: _models.LogProfileResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Required. - :type log_profiles_resource: ~azure.mgmt.monitor.models.LogProfileResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - log_profile_name: str, - log_profiles_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Required. - :type log_profiles_resource: 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: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - log_profile_name: str, - log_profiles_resource: Union[_models.LogProfileResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.LogProfileResource: - """Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. - - :param log_profile_name: The name of the log profile. Required. - :type log_profile_name: str - :param log_profiles_resource: Parameters supplied to the operation. Is either a - LogProfileResourcePatch type or a IO[bytes] type. Required. - :type log_profiles_resource: ~azure.mgmt.monitor.models.LogProfileResourcePatch or IO[bytes] - :return: LogProfileResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogProfileResource - :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", "2016-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogProfileResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(log_profiles_resource, (IOBase, bytes)): - _content = log_profiles_resource - else: - _json = self._serialize.body(log_profiles_resource, "LogProfileResourcePatch") - - _request = build_update_request( - log_profile_name=log_profile_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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogProfileResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.LogProfileResource"]: - """List the log profiles. - - :return: An iterator like instance of either LogProfileResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.LogProfileResource] - :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", "2016-03-01")) - cls: ClsType[_models.LogProfileCollection] = 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_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("LogProfileCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_alerts_operations.py deleted file mode 100644 index f0bc1a0a1457..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_alerts_operations.py +++ /dev/null @@ -1,750 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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_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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") - 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_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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts", - ) # pylint: disable=line-too-long - 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_get_request(resource_group_name: str, 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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", 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_or_update_request( - resource_group_name: str, 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", "2018-03-01")) - 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/metricAlerts/{ruleName}", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", 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, 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", "2018-03-01")) - 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/metricAlerts/{ruleName}", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", 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, 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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class MetricAlertsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`metric_alerts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.MetricAlertResource"]: - """Retrieve alert rule definitions in a subscription. - - :return: An iterator like instance of either MetricAlertResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.MetricAlertResource] - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResourceCollection] = 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("MetricAlertResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated2, 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_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.MetricAlertResource"]: - """Retrieve alert rule definitions in a 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 MetricAlertResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.MetricAlertResource] - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResourceCollection] = 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("MetricAlertResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponseAutoGenerated2, 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, rule_name: str, **kwargs: Any) -> _models.MetricAlertResource: - """Retrieve an alert rule definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: _models.MetricAlertResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: 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: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.MetricAlertResource, IO[bytes]], - **kwargs: Any - ) -> _models.MetricAlertResource: - """Create or update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to create or update. Is either a - MetricAlertResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResource or IO[bytes] - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MetricAlertResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", 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, - rule_name: str, - parameters: _models.MetricAlertResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - rule_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Required. - :type parameters: 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: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.MetricAlertResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.MetricAlertResource: - """Update an metric alert definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param parameters: The parameters of the rule to update. Is either a MetricAlertResourcePatch - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.MetricAlertResourcePatch or IO[bytes] - :return: MetricAlertResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertResource - :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", "2018-03-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MetricAlertResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MetricAlertResourcePatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertResource", 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, rule_name: str, **kwargs: Any - ) -> None: - """Delete an alert rule definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_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", "2018-03-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - rule_name=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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated2, 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/_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_alerts_status_operations.py deleted file mode 100644 index 623bf307d86c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_alerts_status_operations.py +++ /dev/null @@ -1,238 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, 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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", 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_name_request( - resource_group_name: str, rule_name: str, status_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", "2018-03-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}", - ) # pylint: disable=line-too-long - 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 - ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), - "statusName": _SERIALIZER.url("status_name", status_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) - - -class MetricAlertsStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`metric_alerts_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, rule_name: str, **kwargs: Any) -> _models.MetricAlertStatusCollection: - """Retrieve an alert rule status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: MetricAlertStatusCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertStatusCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertStatusCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_name( - self, resource_group_name: str, rule_name: str, status_name: str, **kwargs: Any - ) -> _models.MetricAlertStatusCollection: - """Retrieve an alert rule status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :param status_name: The name of the status. Required. - :type status_name: str - :return: MetricAlertStatusCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.MetricAlertStatusCollection - :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", "2018-03-01")) - cls: ClsType[_models.MetricAlertStatusCollection] = kwargs.pop("cls", None) - - _request = build_list_by_name_request( - resource_group_name=resource_group_name, - rule_name=rule_name, - status_name=status_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.ErrorResponseAutoGenerated2, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MetricAlertStatusCollection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_definitions_operations.py deleted file mode 100644 index d6fbeb0b748f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_definitions_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_uri: str, *, metricnamespace: Optional[str] = None, **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", "2018-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if metricnamespace is not None: - _params["metricnamespace"] = _SERIALIZER.query("metricnamespace", metricnamespace, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MetricDefinitionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`metric_definitions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_uri: str, metricnamespace: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.MetricDefinition"]: - """Lists the metric definitions for the resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param metricnamespace: Metric namespace to query metric definitions for. Default value is - None. - :type metricnamespace: str - :return: An iterator like instance of either MetricDefinition or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.MetricDefinition] - :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", "2018-01-01")) - cls: ClsType[_models.MetricDefinitionCollection] = 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_request( - resource_uri=resource_uri, - metricnamespace=metricnamespace, - 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("MetricDefinitionCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_namespaces_operations.py deleted file mode 100644 index 4620933afcfe..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metric_namespaces_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_uri: str, *, start_time: Optional[str] = None, **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", "2017-12-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/metricNamespaces") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if start_time is not None: - _params["startTime"] = _SERIALIZER.query("start_time", start_time, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MetricNamespacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`metric_namespaces` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_uri: str, start_time: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.MetricNamespace"]: - """Lists the metric namespaces for the resource. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param start_time: The ISO 8601 conform Date start time from which to query for metric - namespaces. Default value is None. - :type start_time: str - :return: An iterator like instance of either MetricNamespace or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.MetricNamespace] - :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", "2017-12-01-preview")) - cls: ClsType[_models.MetricNamespaceCollection] = 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_request( - resource_uri=resource_uri, - start_time=start_time, - 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("MetricNamespaceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metrics_operations.py deleted file mode 100644 index 13c7d6e4cefd..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_metrics_operations.py +++ /dev/null @@ -1,228 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_uri: str, - *, - timespan: Optional[str] = None, - interval: Optional[str] = None, - metricnames: Optional[str] = None, - aggregation: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - metricnamespace: Optional[str] = None, - **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", "2018-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/metrics") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if timespan is not None: - _params["timespan"] = _SERIALIZER.query("timespan", timespan, "str") - if interval is not None: - _params["interval"] = _SERIALIZER.query("interval", interval, "str") - if metricnames is not None: - _params["metricnames"] = _SERIALIZER.query("metricnames", metricnames, "str") - if aggregation is not None: - _params["aggregation"] = _SERIALIZER.query("aggregation", aggregation, "str") - if top is not None: - _params["top"] = _SERIALIZER.query("top", top, "int") - if orderby is not None: - _params["orderby"] = _SERIALIZER.query("orderby", orderby, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if result_type is not None: - _params["resultType"] = _SERIALIZER.query("result_type", result_type, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if metricnamespace is not None: - _params["metricnamespace"] = _SERIALIZER.query("metricnamespace", metricnamespace, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MetricsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`metrics` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_uri: str, - timespan: Optional[str] = None, - interval: Optional[str] = None, - metricnames: Optional[str] = None, - aggregation: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - filter: Optional[str] = None, - result_type: Optional[Union[str, _models.ResultType]] = None, - metricnamespace: Optional[str] = None, - **kwargs: Any - ) -> _models.Response: - """**Lists the metric values for a resource**. This API uses the `default ARM throttling limits - `_. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Default value is None. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query in ISO 8601 duration format. - Defaults to PT1M. Special case for 'FULL' value that returns single datapoint for entire time - span requested. - *Examples: PT15M, PT1H, P1D, FULL*. Default value is None. - :type interval: str - :param metricnames: The names of the metrics (comma separated) to retrieve. Limit 20 metrics. - Special case: If a metricname itself has a comma in it then use %2 to indicate it. Eg: - 'Metric,Name1' should be **'Metric%2Name1'**. Default value is None. - :type metricnames: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. Default value - is None. - :type aggregation: str - :param top: The maximum number of records to retrieve. - Valid only if $filter is specified. - Defaults to 10. Default value is None. - :type top: int - :param orderby: The aggregation to use for sorting results and the direction of the sort. - Only one order can be specified. - Examples: sum asc. Default value is None. - :type orderby: str - :param filter: The **$filter** is used to reduce the set of metric data returned. Example: - Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or - b2 **$filter=A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A - eq 'a1' and B eq 'b1' and C eq '*' or B = 'b2'** This is invalid because the logical or - operator cannot separate two different metadata names. - Return all time series where A = a1, B - = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - Return all time series - where A = a1 **$filter=A eq 'a1' and B eq '\\ *' and C eq '*\\ '**. Special case: When - dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) - 1** Instead of using $filter= "dim (test) 1 eq '\\ *' " use **$filter= "dim %2528test%2529 1 eq - '*\\ ' "\\ ** When dimension name is **\\ dim (test) 3\\ ** and dimension value is **\\ dim3 - (test) val\\ ** Instead of using $filter= "dim (test) 3 eq 'dim3 (test) val' " use **\\ - $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "**. Default value is None. - :type filter: str - :param result_type: Reduces the set of data collected. The syntax allowed depends on the - operation. See the operation's description for details. Known values are: "Data" and - "Metadata". Default value is None. - :type result_type: str or ~azure.mgmt.monitor.models.ResultType - :param metricnamespace: Metric namespace to query metric definitions for. Default value is - None. - :type metricnamespace: str - :return: Response or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.Response - :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", "2018-01-01")) - cls: ClsType[_models.Response] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_uri=resource_uri, - timespan=timespan, - interval=interval, - metricnames=metricnames, - aggregation=aggregation, - top=top, - orderby=orderby, - filter=filter, - result_type=result_type, - metricnamespace=metricnamespace, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Response", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_operations.py deleted file mode 100644 index e9472e6fc565..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**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", "2015-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/operations") - - # 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) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists all of the available operations from Microsoft.Insights provider. - - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationListResult - :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", "2015-04-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - _request = build_list_request( - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_predictive_metric_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_predictive_metric_operations.py deleted file mode 100644 index acacab0e09ff..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_predictive_metric_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# 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 datetime -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - autoscale_setting_name: str, - subscription_id: str, - *, - timespan: str, - interval: datetime.timedelta, - metric_namespace: str, - metric_name: str, - aggregation: 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", "2022-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics", - ) # pylint: disable=line-too-long - 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 - ), - "autoscaleSettingName": _SERIALIZER.url("autoscale_setting_name", autoscale_setting_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["timespan"] = _SERIALIZER.query("timespan", timespan, "str") - _params["interval"] = _SERIALIZER.query("interval", interval, "duration") - _params["metricNamespace"] = _SERIALIZER.query("metric_namespace", metric_namespace, "str") - _params["metricName"] = _SERIALIZER.query("metric_name", metric_name, "str") - _params["aggregation"] = _SERIALIZER.query("aggregation", aggregation, "str") - _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) - - -class PredictiveMetricOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`predictive_metric` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - autoscale_setting_name: str, - timespan: str, - interval: datetime.timedelta, - metric_namespace: str, - metric_name: str, - aggregation: str, - **kwargs: Any - ) -> _models.PredictiveResponse: - """get predictive autoscale metric future data. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param autoscale_setting_name: The autoscale setting name. Required. - :type autoscale_setting_name: str - :param timespan: The timespan of the query. It is a string with the following format - 'startDateTime_ISO/endDateTime_ISO'. Required. - :type timespan: str - :param interval: The interval (i.e. timegrain) of the query. Required. - :type interval: ~datetime.timedelta - :param metric_namespace: Metric namespace to query metric definitions for. Required. - :type metric_namespace: str - :param metric_name: The names of the metrics (comma separated) to retrieve. Special case: If a - metricname itself has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be - **'Metric%2Name1'**. Required. - :type metric_name: str - :param aggregation: The list of aggregation types (comma separated) to retrieve. Required. - :type aggregation: str - :return: PredictiveResponse or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PredictiveResponse - :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", "2022-10-01")) - cls: ClsType[_models.PredictiveResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - autoscale_setting_name=autoscale_setting_name, - subscription_id=self._config.subscription_id, - timespan=timespan, - interval=interval, - metric_namespace=metric_namespace, - metric_name=metric_name, - aggregation=aggregation, - 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.AutoscaleErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PredictiveResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 26eaacb2f0e5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,657 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - scope_name: str, - private_endpoint_connection_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_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_or_update_request( - resource_group_name: str, - scope_name: str, - private_endpoint_connection_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", "2019-10-17-preview")) - 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/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_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_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-10-17-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_list_by_private_link_scope_request( - resource_group_name: str, scope_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_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) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PrivateEndpointConnection - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.monitor.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: 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: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.PrivateEndpointConnection] - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("PrivateEndpointConnectionListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_resources_operations.py deleted file mode 100644 index 5b3a84abcd80..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,256 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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_private_link_scope_request( - resource_group_name: str, scope_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_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_group_name: str, scope_name: str, 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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "groupName": _SERIALIZER.url("group_name", group_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) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.PrivateLinkResource] - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateLinkResourceListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("PrivateLinkResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, scope_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.PrivateLinkResource - :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", "2019-10-17-preview")) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - group_name=group_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scope_operation_status_operations.py deleted file mode 100644 index ea0578e3e668..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scope_operation_status_operations.py +++ /dev/null @@ -1,145 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - async_operation_id: str, 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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "asyncOperationId": _SERIALIZER.url("async_operation_id", async_operation_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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) - - -class PrivateLinkScopeOperationStatusOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`private_link_scope_operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, async_operation_id: str, resource_group_name: str, **kwargs: Any) -> _models.OperationStatus: - """Get the status of an azure asynchronous operation associated with a private link scope - operation. - - :param async_operation_id: The operation Id. Required. - :type async_operation_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: OperationStatus or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationStatus - :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", "2019-10-17-preview")) - cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - async_operation_id=async_operation_id, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("OperationStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scoped_resources_operations.py deleted file mode 100644 index 9051cd2b3bd0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scoped_resources_operations.py +++ /dev/null @@ -1,632 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, scope_name: str, 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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "name": _SERIALIZER.url("name", 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_or_update_request( - resource_group_name: str, scope_name: str, 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", "2019-10-17-preview")) - 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/privateLinkScopes/{scopeName}/scopedResources/{name}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "name": _SERIALIZER.url("name", 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_group_name: str, scope_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-10-17-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_list_by_private_link_scope_request( - resource_group_name: str, scope_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources", - ) # pylint: disable=line-too-long - 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 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_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) - - -class PrivateLinkScopedResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`private_link_scoped_resources` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any) -> _models.ScopedResource: - """Gets a scoped resource in a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :return: ScopedResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ScopedResource - :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", "2019-10-17-preview")) - cls: ClsType[_models.ScopedResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ScopedResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: Union[_models.ScopedResource, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ScopedResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=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) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: _models.ScopedResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.monitor.models.ScopedResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Required. - :type parameters: 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: An instance of LROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - name: str, - parameters: Union[_models.ScopedResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ScopedResource]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :param parameters: Is either a ScopedResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.ScopedResource or IO[bytes] - :return: An instance of LROPoller that returns either ScopedResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.ScopedResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopedResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopedResource", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ScopedResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ScopedResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any) -> Iterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, scope_name: str, name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param name: The name of the scoped resource object. Required. - :type name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - name=name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> Iterable["_models.ScopedResource"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either ScopedResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ScopedResource] - :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", "2019-10-17-preview")) - cls: ClsType[_models.ScopedResourceListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_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("ScopedResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scopes_operations.py deleted file mode 100644 index 10afda7150b0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,807 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes") - 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_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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_delete_request(resource_group_name: str, scope_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-10-17-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_request(resource_group_name: str, scope_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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_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_or_update_request( - resource_group_name: str, scope_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", "2019-10-17-preview")) - 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/privateLinkScopes/{scopeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_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_tags_request( - resource_group_name: str, scope_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", "2019-10-17-preview")) - 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/privateLinkScopes/{scopeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_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) - - -class PrivateLinkScopesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`private_link_scopes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.AzureMonitorPrivateLinkScope"]: - """Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - - :return: An iterator like instance of either AzureMonitorPrivateLinkScope or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScopeListResult] = 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_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("AzureMonitorPrivateLinkScopeListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.AzureMonitorPrivateLinkScope"]: - """Gets a list of Azure Monitor PrivateLinkScopes within a 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 AzureMonitorPrivateLinkScope or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope] - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScopeListResult] = 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("AzureMonitorPrivateLinkScopeListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _delete_initial(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> Iterator[bytes]: - 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", "2019-10-17-preview")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - 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, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :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", "2019-10-17-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> _models.AzureMonitorPrivateLinkScope: - """Returns a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: _models.AzureMonitorPrivateLinkScope, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Required. - :type azure_monitor_private_link_scope_payload: - ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Required. - :type azure_monitor_private_link_scope_payload: 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: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - azure_monitor_private_link_scope_payload: Union[_models.AzureMonitorPrivateLinkScope, IO[bytes]], - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param azure_monitor_private_link_scope_payload: Properties that need to be specified to create - or update a Azure Monitor PrivateLinkScope. Is either a AzureMonitorPrivateLinkScope type or a - IO[bytes] type. Required. - :type azure_monitor_private_link_scope_payload: - ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope or IO[bytes] - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(azure_monitor_private_link_scope_payload, (IOBase, bytes)): - _content = azure_monitor_private_link_scope_payload - else: - _json = self._serialize.body(azure_monitor_private_link_scope_payload, "AzureMonitorPrivateLinkScope") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: ~azure.mgmt.monitor.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: 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: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.AzureMonitorPrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Monitor PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type private_link_scope_tags: ~azure.mgmt.monitor.models.TagsResource or IO[bytes] - :return: AzureMonitorPrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.AzureMonitorPrivateLinkScope - :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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureMonitorPrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_link_scope_tags, (IOBase, bytes)): - _content = private_link_scope_tags - else: - _json = self._serialize.body(private_link_scope_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - scope_name=scope_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AzureMonitorPrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_scheduled_query_rules_operations.py index 349f83a477c8..b35b49c94022 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_scheduled_query_rules_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # 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 -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import MonitorManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,27 +37,19 @@ _SERIALIZER.client_side_validation = False -def build_create_or_update_request( - resource_group_name: str, rule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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", "2018-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", - ) # pylint: disable=line-too-long + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules" + ) 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 - ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,31 +58,28 @@ def build_create_or_update_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(resource_group_name: str, rule_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", + ) 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 ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -105,25 +93,24 @@ def build_get_request(resource_group_name: str, rule_name: str, subscription_id: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request(resource_group_name: str, rule_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request(resource_group_name: str, 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", "2018-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", + ) 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 ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[^#<>%&:\?/{}*]{1,260}$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -132,31 +119,32 @@ def build_update_request(resource_group_name: str, rule_name: str, subscription_ _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request(resource_group_name: str, rule_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request( + resource_group_name: str, 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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + 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/scheduledQueryRules/{ruleName}", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", + ) 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 ), - "ruleName": _SERIALIZER.url("rule_name", rule_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[^#<>%&:\?/{}*]{1,260}$"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -165,73 +153,76 @@ def build_delete_request(resource_group_name: str, rule_name: str, subscription_ _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request( - subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_update_request(resource_group_name: str, 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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + 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}/providers/Microsoft.Insights/scheduledQueryRules" + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", ) 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 + ), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[^#<>%&:\?/{}*]{1,260}$"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_delete_request(resource_group_name: str, 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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", - ) # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", + ) 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 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[^#<>%&:\?/{}*]{1,260}$"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) class ScheduledQueryRulesOperations: @@ -248,22 +239,214 @@ class ScheduledQueryRulesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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_subscription(self, **kwargs: Any) -> Iterable["_models.ScheduledQueryRuleResource"]: + """Retrieve a scheduled query rule definitions in a subscription. + + :return: An iterator like instance of either ScheduledQueryRuleResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResourceCollection] = 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("ScheduledQueryRuleResourceCollection", 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.ErrorContract, 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_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ScheduledQueryRuleResource"]: + """Retrieve scheduled query rule definitions in a 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 ScheduledQueryRuleResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ScheduledQueryRuleResource] + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResourceCollection] = 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("ScheduledQueryRuleResourceCollection", 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.ErrorContract, 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, rule_name: str, **kwargs: Any) -> _models.ScheduledQueryRuleResource: + """Retrieve an scheduled query rule definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param rule_name: The name of the rule. Required. + :type rule_name: str + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource + :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", "2025-01-01-preview")) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + rule_name=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.ErrorContract, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: _models.LogSearchRuleResource, + parameters: _models.ScheduledQueryRuleResource, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -271,12 +454,12 @@ def create_or_update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -289,8 +472,8 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -302,8 +485,8 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -312,10 +495,10 @@ def create_or_update( self, resource_group_name: str, rule_name: str, - parameters: Union[_models.LogSearchRuleResource, IO[bytes]], + parameters: Union[_models.ScheduledQueryRuleResource, IO[bytes]], **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates an log search rule. + ) -> _models.ScheduledQueryRuleResource: + """Creates or updates a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -323,10 +506,10 @@ def create_or_update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to create or update. Is either a - LogSearchRuleResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource or IO[bytes] - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + ScheduledQueryRuleResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource or IO[bytes] + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -340,9 +523,9 @@ def create_or_update( _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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -350,7 +533,7 @@ def create_or_update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LogSearchRuleResource") + _json = self._serialize.body(parameters, "ScheduledQueryRuleResource") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -377,63 +560,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorContract, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, rule_name: str, **kwargs: Any) -> _models.LogSearchRuleResource: - """Gets an Log Search rule. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param rule_name: The name of the rule. Required. - :type rule_name: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - rule_name=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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,12 +572,12 @@ def update( self, resource_group_name: str, rule_name: str, - parameters: _models.LogSearchRuleResourcePatch, + parameters: _models.ScheduledQueryRuleResourcePatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -458,12 +585,12 @@ def update( :param rule_name: The name of the rule. Required. :type rule_name: str :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResourcePatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -476,8 +603,8 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -489,8 +616,8 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ @@ -499,21 +626,21 @@ def update( self, resource_group_name: str, rule_name: str, - parameters: Union[_models.LogSearchRuleResourcePatch, IO[bytes]], + parameters: Union[_models.ScheduledQueryRuleResourcePatch, IO[bytes]], **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update log search Rule. + ) -> _models.ScheduledQueryRuleResource: + """Update a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param rule_name: The name of the rule. Required. :type rule_name: str - :param parameters: The parameters of the rule to update. Is either a LogSearchRuleResourcePatch - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch or IO[bytes] - :return: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource + :param parameters: The parameters of the rule to update. Is either a + ScheduledQueryRuleResourcePatch type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.monitor.models.ScheduledQueryRuleResourcePatch or IO[bytes] + :return: ScheduledQueryRuleResource or the result of cls(response) + :rtype: ~azure.mgmt.monitor.models.ScheduledQueryRuleResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -527,9 +654,9 @@ def update( _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", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ScheduledQueryRuleResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -537,7 +664,7 @@ def update( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LogSearchRuleResourcePatch") + _json = self._serialize.body(parameters, "ScheduledQueryRuleResourcePatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -564,7 +691,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorContract, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LogSearchRuleResource", pipeline_response.http_response) + deserialized = self._deserialize("ScheduledQueryRuleResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -575,7 +702,7 @@ def update( def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, rule_name: str, **kwargs: Any ) -> None: - """Deletes a Log Search rule. + """Deletes a scheduled query rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -597,7 +724,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-04-16")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -624,149 +751,3 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_subscription( - self, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.LogSearchRuleResource"]: - """List the Log Search rules within a subscription group. - - :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. - :type filter: str - :return: An iterator like instance of either LogSearchRuleResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.LogSearchRuleResource] - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResourceCollection] = 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, - filter=filter, - 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("LogSearchRuleResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorContract, 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_resource_group( - self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.LogSearchRuleResource"]: - """List the Log Search rules within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param filter: The filter to apply on the operation. For more information please see - https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. Default value is None. - :type filter: str - :return: An iterator like instance of either LogSearchRuleResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.LogSearchRuleResource] - :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", "2018-04-16")) - cls: ClsType[_models.LogSearchRuleResourceCollection] = 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, - filter=filter, - 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("LogSearchRuleResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_service_diagnostic_settings_operations.py deleted file mode 100644 index bc195b45a455..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_service_diagnostic_settings_operations.py +++ /dev/null @@ -1,420 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_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", "2016-09-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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_or_update_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", "2016-09-01")) - 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/diagnosticSettings/service") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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_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", "2016-09-01")) - 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/diagnosticSettings/service") - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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) - - -class ServiceDiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`service_diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_uri: str, **kwargs: Any) -> _models.ServiceDiagnosticSettingsResource: - """Gets the active diagnostic settings for the specified resource. **WARNING**\\ : This method - will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_uri: str, - parameters: _models.ServiceDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, resource_uri: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, resource_uri: str, parameters: Union[_models.ServiceDiagnosticSettingsResource, IO[bytes]], **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Create or update new diagnostic settings for the specified resource. **WARNING**\\ : This - method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param parameters: Parameters supplied to the operation. Is either a - ServiceDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource or IO[bytes] - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ServiceDiagnosticSettingsResource") - - _request = build_create_or_update_request( - resource_uri=resource_uri, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: _models.ServiceDiagnosticSettingsResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Required. - :type service_diagnostic_settings_resource: - ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResourcePatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Required. - :type service_diagnostic_settings_resource: 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: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_uri: str, - service_diagnostic_settings_resource: Union[_models.ServiceDiagnosticSettingsResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.ServiceDiagnosticSettingsResource: - """Updates an existing ServiceDiagnosticSettingsResource. To update other fields use the - CreateOrUpdate method. **WARNING**\\ : This method will be deprecated in future releases. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :param service_diagnostic_settings_resource: Parameters supplied to the operation. Is either a - ServiceDiagnosticSettingsResourcePatch type or a IO[bytes] type. Required. - :type service_diagnostic_settings_resource: - ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResourcePatch or IO[bytes] - :return: ServiceDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ServiceDiagnosticSettingsResource - :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", "2016-09-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service_diagnostic_settings_resource, (IOBase, bytes)): - _content = service_diagnostic_settings_resource - else: - _json = self._serialize.body(service_diagnostic_settings_resource, "ServiceDiagnosticSettingsResourcePatch") - - _request = build_update_request( - resource_uri=resource_uri, - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_subscription_diagnostic_settings_operations.py deleted file mode 100644 index 9b81f58f573e..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_subscription_diagnostic_settings_operations.py +++ /dev/null @@ -1,427 +0,0 @@ -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(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", "2017-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "name": _SERIALIZER.url("name", 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_or_update_request(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", "2017-05-01-preview")) - 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}/providers/microsoft.insights/diagnosticSettings/{name}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "name": _SERIALIZER.url("name", 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(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", "2017-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings/{name}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "name": _SERIALIZER.url("name", 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) - - -def build_list_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", "2017-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/diagnosticSettings") - 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) - - -class SubscriptionDiagnosticSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`subscription_diagnostic_settings` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, name: str, **kwargs: Any) -> _models.SubscriptionDiagnosticSettingsResource: - """Gets the active subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :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", "2017-05-01-preview")) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResource] = kwargs.pop("cls", None) - - _request = build_get_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SubscriptionDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - name: str, - parameters: _models.SubscriptionDiagnosticSettingsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Required. - :type parameters: 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: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, name: str, parameters: Union[_models.SubscriptionDiagnosticSettingsResource, IO[bytes]], **kwargs: Any - ) -> _models.SubscriptionDiagnosticSettingsResource: - """Creates or updates subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type name: str - :param parameters: Parameters supplied to the operation. Is either a - SubscriptionDiagnosticSettingsResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource or - IO[bytes] - :return: SubscriptionDiagnosticSettingsResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource - :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", "2017-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "SubscriptionDiagnosticSettingsResource") - - _request = build_create_or_update_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SubscriptionDiagnosticSettingsResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Deletes existing subscription diagnostic settings for the specified resource. - - :param name: The name of the diagnostic setting. Required. - :type 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", "2017-05-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - name=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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> _models.SubscriptionDiagnosticSettingsResourceCollection: - """Gets the active subscription diagnostic settings list for the specified subscriptionId. - - :return: SubscriptionDiagnosticSettingsResourceCollection or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResourceCollection - :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", "2017-05-01-preview")) - cls: ClsType[_models.SubscriptionDiagnosticSettingsResourceCollection] = kwargs.pop("cls", None) - - _request = build_list_request( - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "SubscriptionDiagnosticSettingsResourceCollection", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_tenant_activity_logs_operations.py deleted file mode 100644 index a6784437a9f9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_tenant_activity_logs_operations.py +++ /dev/null @@ -1,176 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(*, filter: Optional[str] = None, select: Optional[str] = None, **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", "2015-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/eventtypes/management/values") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if select is not None: - _params["$select"] = _SERIALIZER.query("select", select, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class TenantActivityLogsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`tenant_activity_logs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, filter: Optional[str] = None, select: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.EventData"]: - """Gets the Activity Logs for the Tenant.\\ :code:`
`Everything that is applicable to the API - to get the Activity Logs for the subscription is applicable to this API (the parameters, - $filter, etc.).\\ :code:`
`One thing to point out here is that this API does *not* retrieve - the logs at the individual subscription of the tenant but only surfaces the logs that were - generated at the tenant level. - - :param filter: Reduces the set of data collected. :code:`
`The **$filter** is very - restricted and allows only the following patterns.\\ :code:`
`- List events for a resource - group: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp le '\\ - :code:``' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '\\ - :code:``'.\\ :code:`
`- List events for resource: $filter=eventTimestamp - ge '\\ :code:``' and eventTimestamp le '\\ :code:``' and eventChannels eq - 'Admin, Operation' and resourceUri eq '\\ :code:``'.\\ :code:`
`- List events - for a subscription: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp le - '\\ :code:``' and eventChannels eq 'Admin, Operation'.\\ :code:`
`- List events - for a resource provider: $filter=eventTimestamp ge '\\ :code:``' and eventTimestamp - le '\\ :code:``' and eventChannels eq 'Admin, Operation' and resourceProvider eq '\\ - :code:``'.\\ :code:`
`- List events for a correlation Id: - api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and - correlationId eq '\\ :code:``'.\\ :code:`
`\\ **NOTE**\\ : No other syntax is - allowed. Default value is None. - :type filter: str - :param select: Used to fetch events with only the given properties.\\ :code:`
`The - **$select** argument is a comma separated list of property names to be returned. Possible - values are: *authorization*\\ , *claims*\\ , *correlationId*\\ , *description*\\ , - *eventDataId*\\ , *eventName*\\ , *eventTimestamp*\\ , *httpRequest*\\ , *level*\\ , - *operationId*\\ , *operationName*\\ , *properties*\\ , *resourceGroupName*\\ , - *resourceProviderName*\\ , *resourceId*\\ , *status*\\ , *submissionTimestamp*\\ , - *subStatus*\\ , *subscriptionId*. Default value is None. - :type select: str - :return: An iterator like instance of either EventData or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.EventData] - :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", "2015-04-01")) - cls: ClsType[_models.EventDataCollection] = 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_request( - filter=filter, - select=select, - 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("EventDataCollection", 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_vm_insights_operations.py deleted file mode 100644 index fde3c9121d45..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_vm_insights_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# 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 sys -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_onboarding_status_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", "2018-11-27-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default" - ) - path_format_arguments = { - "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), - } - - _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) - - -class VMInsightsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`vm_insights` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_onboarding_status(self, resource_uri: str, **kwargs: Any) -> _models.VMInsightsOnboardingStatus: - """Retrieves the VM Insights onboarding status for the specified resource or resource scope. - - :param resource_uri: The fully qualified Azure Resource manager identifier of the resource, or - scope, whose status to retrieve. Required. - :type resource_uri: str - :return: VMInsightsOnboardingStatus or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.VMInsightsOnboardingStatus - :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", "2018-11-27-preview")) - cls: ClsType[_models.VMInsightsOnboardingStatus] = kwargs.pop("cls", None) - - _request = build_get_onboarding_status_request( - resource_uri=resource_uri, - 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.ResponseWithError, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VMInsightsOnboardingStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_action_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_action_group.py index 5fe194e611c9..b44fc9c9036a 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_action_group.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_action_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -34,6 +35,13 @@ def main(): resource_group_name="Default-NotificationRules", action_group_name="SampleActionGroup", action_group={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_123": {}, + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/AzSecPackAutoConfigRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ThomasTestManagedIdentity_456": {}, + }, + }, "location": "Global", "properties": { "armRoleReceivers": [ @@ -47,6 +55,7 @@ def main(): { "automationAccountId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest", "isGlobalRunbook": False, + "managedIdentity": "30fe7a91-cd31-4edf-96ab-52883b3199cd", "name": "testRunbook", "runbookName": "Sample runbook", "serviceUri": "", @@ -60,6 +69,7 @@ def main(): "functionAppResourceId": "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp", "functionName": "HttpTriggerCSharp1", "httpTriggerUrl": "http://test.me", + "managedIdentity": "30fe7a91-cd31-4edf-96ab-52883b3199cd", "name": "Sample azureFunction", "useCommonAlertSchema": True, } @@ -73,12 +83,29 @@ def main(): { "eventHubName": "testEventHub", "eventHubNameSpace": "testEventHubNameSpace", + "managedIdentity": "30fe7a91-cd31-4edf-96ab-52883b3199cd", "name": "Sample eventHub", "subscriptionId": "187f412d-1758-44d9-b052-169e2564721d", "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", } ], "groupShortName": "sample", + "incidentReceivers": [ + { + "connection": {"id": "8be638e7-1419-42d4-a059-437a5f4f4e4e", "name": "IncidentConnection"}, + "incidentManagementService": "Icm", + "mappings": { + "icm.automitigationenabled": "true", + "icm.correlationid": "${data.essentials.signalType}://${data.essentials.originAlertId}", + "icm.monitorid": "${data.essentials.alertRule}", + "icm.occurringlocation.environment": "PROD", + "icm.routingid": "${data.essentials.monitoringService}://${data.essentials.signalType}", + "icm.title": "${data.essentials.severity}:${data.essentials.monitorCondition} ${data.essentials.monitoringService}:${data.essentials.signalType} ${data.essentials.alertTargetIds}", + "icm.tsgid": "https://microsoft.com", + }, + "name": "IncidentAction", + } + ], "itsmReceivers": [ { "connectionId": "a3b9076c-ce8e-434e-85b4-aff10cb3c8f1", @@ -91,6 +118,7 @@ def main(): "logicAppReceivers": [ { "callbackUrl": "https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w", + "managedIdentity": "30fe7a91-cd31-4edf-96ab-52883b3199cd", "name": "Sample logicApp", "resourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp", "useCommonAlertSchema": False, @@ -109,6 +137,7 @@ def main(): }, { "identifierUri": "http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a", + "managedIdentity": "30fe7a91-cd31-4edf-96ab-52883b3199cd", "name": "Sample webhook 2", "objectId": "d3bb868c-fe44-452c-aa26-769a6538c808", "serviceUri": "http://www.example.com/webhook2", @@ -124,6 +153,6 @@ def main(): print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/createOrUpdateActionGroup.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/createOrUpdateActionGroup.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_autoscale_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_autoscale_setting.py deleted file mode 100644 index 15996ea7970f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_autoscale_setting.py +++ /dev/null @@ -1,161 +0,0 @@ -# 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 create_or_update_autoscale_setting.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.autoscale_settings.create_or_update( - resource_group_name="TestingMetricsScaleSet", - autoscale_setting_name="MySetting", - parameters={ - "location": "West US", - "properties": { - "enabled": True, - "notifications": [ - { - "email": { - "customEmails": ["gu@ms.com", "ge@ns.net"], - "sendToSubscriptionAdministrator": True, - "sendToSubscriptionCoAdministrators": True, - }, - "operation": "Scale", - "webhooks": [{"properties": {}, "serviceUri": "http://myservice.com"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "Enabled"}, - "profiles": [ - { - "capacity": {"default": "1", "maximum": "10", "minimum": "1"}, - "fixedDate": { - "end": "2015-03-05T14:30:00Z", - "start": "2015-03-05T14:00:00Z", - "timeZone": "UTC", - }, - "name": "adios", - "rules": [ - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 10, - "timeAggregation": "Average", - "timeGrain": "PT1M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT5M", - "direction": "Increase", - "type": "ChangeCount", - "value": "1", - }, - }, - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 15, - "timeAggregation": "Average", - "timeGrain": "PT2M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT6M", - "direction": "Decrease", - "type": "ChangeCount", - "value": "2", - }, - }, - ], - }, - { - "capacity": {"default": "1", "maximum": "10", "minimum": "1"}, - "name": "saludos", - "recurrence": { - "frequency": "Week", - "schedule": {"days": ["1"], "hours": [5], "minutes": [15], "timeZone": "UTC"}, - }, - "rules": [ - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 10, - "timeAggregation": "Average", - "timeGrain": "PT1M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT5M", - "direction": "Increase", - "type": "ChangeCount", - "value": "1", - }, - }, - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 15, - "timeAggregation": "Average", - "timeGrain": "PT2M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT6M", - "direction": "Decrease", - "type": "ChangeCount", - "value": "2", - }, - }, - ], - }, - ], - "targetResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - }, - "tags": {"key1": "value1", "key2": "value2"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting.py deleted file mode 100644 index 1484f6033e11..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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 create_or_update_diagnostic_setting.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.diagnostic_settings.create_or_update( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="mysetting", - parameters={ - "properties": { - "eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule", - "eventHubName": "myeventhub", - "logAnalyticsDestinationType": "Dedicated", - "logs": [ - {"categoryGroup": "allLogs", "enabled": True, "retentionPolicy": {"days": 0, "enabled": False}} - ], - "marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1", - "metrics": [ - {"category": "WorkflowMetrics", "enabled": True, "retentionPolicy": {"days": 0, "enabled": False}} - ], - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1", - "workspaceId": "", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting_category.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting_category.py deleted file mode 100644 index 8c683b5e8f1d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_diagnostic_setting_category.py +++ /dev/null @@ -1,58 +0,0 @@ -# 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 create_or_update_diagnostic_setting_category.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.diagnostic_settings.create_or_update( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="mysetting", - parameters={ - "properties": { - "eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule", - "eventHubName": "myeventhub", - "logAnalyticsDestinationType": "Dedicated", - "logs": [ - {"category": "WorkflowRuntime", "enabled": True, "retentionPolicy": {"days": 0, "enabled": False}} - ], - "marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1", - "metrics": [ - {"category": "WorkflowMetrics", "enabled": True, "retentionPolicy": {"days": 0, "enabled": False}} - ], - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1", - "workspaceId": "", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_multiple_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_multiple_resource.py deleted file mode 100644 index f6eaf24252f2..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_multiple_resource.py +++ /dev/null @@ -1,82 +0,0 @@ -# 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 create_or_update_dynamic_metric_alert_multiple_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="00000000-0000-0000-0000-000000000000", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="MetricAlertOnMultipleResources", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "alertSensitivity": "Medium", - "criterionType": "DynamicThresholdCriterion", - "dimensions": [], - "failingPeriods": {"minFailingPeriodsToAlert": 4, "numberOfEvaluationPeriods": 4}, - "metricName": "Percentage CPU", - "metricNamespace": "microsoft.compute/virtualmachines", - "name": "High_CPU_80", - "operator": "GreaterOrLessThan", - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1", - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2", - ], - "severity": 3, - "targetResourceRegion": "southcentralus", - "targetResourceType": "Microsoft.Compute/virtualMachines", - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_single_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_single_resource.py deleted file mode 100644 index 83c268d41d44..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_metric_alert_single_resource.py +++ /dev/null @@ -1,80 +0,0 @@ -# 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 create_or_update_dynamic_metric_alert_single_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="00000000-0000-0000-0000-000000000000", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="chiricutin", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "alertSensitivity": "Medium", - "criterionType": "DynamicThresholdCriterion", - "dimensions": [], - "failingPeriods": {"minFailingPeriodsToAlert": 4, "numberOfEvaluationPeriods": 4}, - "ignoreDataBefore": "2019-04-04T21:00:00.000Z", - "metricName": "Percentage CPU", - "metricNamespace": "microsoft.compute/virtualmachines", - "name": "High_CPU_80", - "operator": "GreaterOrLessThan", - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme" - ], - "severity": 3, - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_threshold_scheduled_query_rule.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_threshold_scheduled_query_rule.py new file mode 100644 index 000000000000..d54b8a1248b9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_dynamic_threshold_scheduled_query_rule.py @@ -0,0 +1,84 @@ +# 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 create_or_update_dynamic_threshold_scheduled_query_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="dd4bfc94-a096-412b-9c43-4bd13e35afbc", + ) + + response = client.scheduled_query_rules.create_or_update( + resource_group_name="QueryResourceGroupName", + rule_name="perf", + parameters={ + "location": "eastus", + "properties": { + "actions": { + "actionGroups": [ + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup" + ], + "actionProperties": {"Icm.Title": "Custom title in ICM", "Icm.TsgId": "https://tsg.url"}, + "customProperties": {"key11": "value11", "key12": "value12"}, + }, + "checkWorkspaceAlertsStorageConfigured": True, + "criteria": { + "allOf": [ + { + "alertSensitivity": "Medium", + "criterionType": "DynamicThresholdCriterion", + "dimensions": [ + {"name": "ComputerIp", "operator": "Exclude", "values": ["192.168.1.1"]}, + {"name": "OSType", "operator": "Include", "values": ["*"]}, + ], + "ignoreDataBefore": "2024-06-01T21:00:00.000Z", + "metricMeasureColumn": "% Processor Time", + "operator": "GreaterOrLessThan", + "query": 'Perf | where ObjectName == "Processor"', + "resourceIdColumn": "resourceId", + "timeAggregation": "Average", + } + ] + }, + "description": "Performance rule", + "enabled": True, + "evaluationFrequency": "PT5M", + "muteActionsDuration": "PT30M", + "scopes": [ + "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1" + ], + "severity": 4, + "skipQueryValidation": True, + "windowSize": "PT10M", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/createOrUpdateDynamicThresholdScheduledQueryRule.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings.py deleted file mode 100644 index aeb02e6166c5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings.py +++ /dev/null @@ -1,87 +0,0 @@ -# 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 create_or_update_guest_diagnostic_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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.guest_diagnostics_settings.create_or_update( - resource_group_name="Default-ResourceGroup", - diagnostic_settings_name="SampleDiagSetting", - diagnostic_settings={ - "location": "Global", - "properties": { - "dataSources": [ - { - "configuration": { - "perfCounters": [ - {"name": "\\Process(_Total)\\%Processor Time", "samplingPeriod": "PT1M"}, - {"name": "\\Process(_Total)\\Working Set", "samplingPeriod": "PT1M"}, - ] - }, - "kind": "PerformanceCounter", - "sinks": [{"kind": "LogAnalytics"}], - }, - { - "configuration": { - "providers": [ - {"filter": "filter exp", "id": 1, "name": "AuditLog"}, - {"id": 2, "name": "TraceLog"}, - ] - }, - "kind": "ETWProviders", - "sinks": [{"kind": "LogAnalytics"}], - }, - { - "configuration": { - "eventLogs": [ - { - "filter": 'SourceName == Xyz AND EventId = "100" AND $Xpath/Column="DCName" = "CatWoman"', - "logName": "Application", - }, - { - "filter": 'SourceName == Xyz AND EventId = "100" AND $Xpath/Column="DCName" = "BatMan"', - "logName": "Application", - }, - ] - }, - "kind": "WindowsEventLogs", - "sinks": [{"kind": "LogAnalytics"}], - }, - ], - "osType": "Windows", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-06-01-preview/examples/createOrUpdateGuestDiagnosticSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings_association.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings_association.py deleted file mode 100644 index 2aaeee6173f9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_guest_diagnostic_settings_association.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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 create_or_update_guest_diagnostic_settings_association.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.guest_diagnostics_settings_association.create_or_update( - resource_uri="subscriptions/8498f01b-8064-4e37-856e-318f3c6c685f/resourceGroups/healthsystem/providers/Microsoft.Compute/virtualMachines/eastussojai", - association_name="healthSystemMachineConfigAssociation", - diagnostic_settings_association={ - "location": "Global", - "properties": { - "guestDiagnosticSettingsName": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-Association-ResourceGroup/providers/providers/microsoft.insights/guestDiagnosticSettings/vmSettingForSecurity" - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-06-01-preview/examples/createOrUpdateGuestDiagnosticSettingsAssociation.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_log_profile.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_log_profile.py deleted file mode 100644 index 8b64fb714b96..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_log_profile.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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 create_or_update_log_profile.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="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", - ) - - response = client.log_profiles.create_or_update( - log_profile_name="Rac46PostSwapRG", - parameters={ - "location": "", - "properties": { - "categories": ["Write", "Delete", "Action"], - "locations": ["global"], - "retentionPolicy": {"days": 3, "enabled": True}, - "serviceBusRuleId": "", - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_multiple_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_multiple_resource.py deleted file mode 100644 index 2a39423d1530..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_multiple_resource.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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 create_or_update_metric_alert_multiple_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="MetricAlertOnMultipleResources", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [], - "metricName": "Percentage CPU", - "metricNamespace": "microsoft.compute/virtualmachines", - "name": "High_CPU_80", - "operator": "GreaterThan", - "threshold": 80.5, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2", - ], - "severity": 3, - "targetResourceRegion": "southcentralus", - "targetResourceType": "Microsoft.Compute/virtualMachines", - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_resource_group.py deleted file mode 100644 index 321d34bccacd..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_resource_group.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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 create_or_update_metric_alert_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest1", - rule_name="MetricAlertAtResourceGroupLevel", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [], - "metricName": "Percentage CPU", - "metricNamespace": "microsoft.compute/virtualmachines", - "name": "High_CPU_80", - "operator": "GreaterThan", - "threshold": 80.5, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2", - ], - "severity": 3, - "targetResourceRegion": "southcentralus", - "targetResourceType": "Microsoft.Compute/virtualMachines", - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_single_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_single_resource.py deleted file mode 100644 index 1e672eb045f6..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_single_resource.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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 create_or_update_metric_alert_single_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="chiricutin", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [], - "metricName": "\\Processor(_Total)\\% Processor Time", - "name": "High_CPU_80", - "operator": "GreaterThan", - "threshold": 80.5, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme" - ], - "severity": 3, - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_subscription.py deleted file mode 100644 index b22ee9a388d8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_subscription.py +++ /dev/null @@ -1,78 +0,0 @@ -# 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 create_or_update_metric_alert_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="MetricAlertAtSubscriptionLevel", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [], - "metricName": "Percentage CPU", - "metricNamespace": "microsoft.compute/virtualmachines", - "name": "High_CPU_80", - "operator": "GreaterThan", - "threshold": 80.5, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": ["/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"], - "severity": 3, - "targetResourceRegion": "southcentralus", - "targetResourceType": "Microsoft.Compute/virtualMachines", - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_with_dimensions.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_with_dimensions.py deleted file mode 100644 index 71810f9082bb..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_metric_alert_with_dimensions.py +++ /dev/null @@ -1,81 +0,0 @@ -# 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 create_or_update_metric_alert_with_dimensions.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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="gigtest", - rule_name="MetricAlertOnMultipleDimensions", - parameters={ - "location": "global", - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [ - {"name": "ActivityName", "operator": "Include", "values": ["*"]}, - {"name": "StatusCode", "operator": "Include", "values": ["200"]}, - ], - "metricName": "Availability", - "metricNamespace": "Microsoft.KeyVault/vaults", - "name": "Metric1", - "operator": "GreaterThan", - "threshold": 55, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1H", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource" - ], - "severity": 3, - "windowSize": "P1D", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule.py new file mode 100644 index 000000000000..f38f76caafd2 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule.py @@ -0,0 +1,84 @@ +# 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 create_or_update_scheduled_query_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="dd4bfc94-a096-412b-9c43-4bd13e35afbc", + ) + + response = client.scheduled_query_rules.create_or_update( + resource_group_name="QueryResourceGroupName", + rule_name="perf", + parameters={ + "location": "eastus", + "properties": { + "actions": { + "actionGroups": [ + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup" + ], + "actionProperties": {"Icm.Title": "Custom title in ICM", "Icm.TsgId": "https://tsg.url"}, + "customProperties": {"key11": "value11", "key12": "value12"}, + }, + "checkWorkspaceAlertsStorageConfigured": True, + "criteria": { + "allOf": [ + { + "dimensions": [ + {"name": "ComputerIp", "operator": "Exclude", "values": ["192.168.1.1"]}, + {"name": "OSType", "operator": "Include", "values": ["*"]}, + ], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "metricMeasureColumn": "% Processor Time", + "operator": "GreaterThan", + "query": 'Perf | where ObjectName == "Processor"', + "resourceIdColumn": "resourceId", + "threshold": 70, + "timeAggregation": "Average", + } + ] + }, + "description": "Performance rule", + "enabled": True, + "evaluationFrequency": "PT5M", + "muteActionsDuration": "PT30M", + "resolveConfiguration": {"autoResolved": True, "timeToResolve": "PT10M"}, + "scopes": [ + "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1" + ], + "severity": 4, + "skipQueryValidation": True, + "windowSize": "PT10M", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/createOrUpdateScheduledQueryRule.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_log_to_metric_action.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_log_to_metric_action.py deleted file mode 100644 index 0a7cc5ba6cb0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_log_to_metric_action.py +++ /dev/null @@ -1,57 +0,0 @@ -# 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 create_or_update_scheduled_query_rule_log_to_metric_action.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="af52d502-a447-4bc6-8cb7-4780fbb00490", - ) - - response = client.scheduled_query_rules.create_or_update( - resource_group_name="alertsweu", - rule_name="logtometricfoo", - parameters={ - "location": "West Europe", - "properties": { - "action": { - "criteria": [{"dimensions": [], "metricName": "Average_% Idle Time"}], - "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction", - }, - "description": "log to metric description", - "enabled": "true", - "source": { - "dataSourceId": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu" - }, - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_resource_group.py new file mode 100644 index 000000000000..c9717359fecd --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_resource_group.py @@ -0,0 +1,78 @@ +# 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 create_or_update_scheduled_query_rule_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="dd4bfc94-a096-412b-9c43-4bd13e35afbc", + ) + + response = client.scheduled_query_rules.create_or_update( + resource_group_name="QueryResourceGroupName", + rule_name="heartbeat", + parameters={ + "location": "eastus", + "properties": { + "actions": { + "actionGroups": [ + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup" + ], + "actionProperties": {"Icm.Title": "Custom title in ICM", "Icm.TsgId": "https://tsg.url"}, + "customProperties": {"key11": "value11", "key12": "value12"}, + }, + "checkWorkspaceAlertsStorageConfigured": True, + "criteria": { + "allOf": [ + { + "dimensions": [], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "operator": "GreaterThan", + "query": "Heartbeat", + "threshold": 360, + "timeAggregation": "Count", + } + ] + }, + "description": "Health check rule", + "enabled": True, + "evaluationFrequency": "PT5M", + "muteActionsDuration": "PT30M", + "resolveConfiguration": {"autoResolved": True, "timeToResolve": "PT10M"}, + "scopes": ["/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1"], + "severity": 4, + "skipQueryValidation": True, + "targetResourceTypes": ["Microsoft.Compute/virtualMachines"], + "windowSize": "PT10M", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_subscription.py new file mode 100644 index 000000000000..a2ce5a61adb8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rule_subscription.py @@ -0,0 +1,83 @@ +# 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 create_or_update_scheduled_query_rule_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="dd4bfc94-a096-412b-9c43-4bd13e35afbc", + ) + + response = client.scheduled_query_rules.create_or_update( + resource_group_name="QueryResourceGroupName", + rule_name="perf", + parameters={ + "location": "eastus", + "properties": { + "actions": { + "actionGroups": [ + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup" + ], + "actionProperties": {"Icm.Title": "Custom title in ICM", "Icm.TsgId": "https://tsg.url"}, + "customProperties": {"key11": "value11", "key12": "value12"}, + }, + "checkWorkspaceAlertsStorageConfigured": True, + "criteria": { + "allOf": [ + { + "dimensions": [ + {"name": "ComputerIp", "operator": "Exclude", "values": ["192.168.1.1"]}, + {"name": "OSType", "operator": "Include", "values": ["*"]}, + ], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "metricMeasureColumn": "% Processor Time", + "operator": "GreaterThan", + "query": 'Perf | where ObjectName == "Processor"', + "resourceIdColumn": "resourceId", + "threshold": 70, + "timeAggregation": "Average", + } + ] + }, + "description": "Performance rule", + "enabled": True, + "evaluationFrequency": "PT5M", + "muteActionsDuration": "PT30M", + "resolveConfiguration": {"autoResolved": True, "timeToResolve": "PT10M"}, + "scopes": ["/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"], + "severity": 4, + "skipQueryValidation": True, + "targetResourceTypes": ["Microsoft.Compute/virtualMachines"], + "windowSize": "PT10M", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rules.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rules.py deleted file mode 100644 index 1a851fe494bf..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_rules.py +++ /dev/null @@ -1,71 +0,0 @@ -# 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 create_or_update_scheduled_query_rules.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.scheduled_query_rules.create_or_update( - resource_group_name="Rac46PostSwapRG", - rule_name="logalertfoo", - parameters={ - "location": "eastus", - "properties": { - "action": { - "aznsAction": {"actionGroup": [], "customWebhookPayload": "{}", "emailSubject": "Email Header"}, - "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", - "severity": "1", - "trigger": { - "metricTrigger": { - "metricColumn": "Computer", - "metricTriggerType": "Consecutive", - "threshold": 5, - "thresholdOperator": "GreaterThan", - }, - "threshold": 3, - "thresholdOperator": "GreaterThan", - }, - }, - "description": "log alert description", - "enabled": "true", - "schedule": {"frequencyInMinutes": 15, "timeWindowInMinutes": 15}, - "source": { - "dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace", - "query": "Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)", - "queryType": "ResultCount", - }, - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRules.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_ruleswith_cross_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_ruleswith_cross_resource.py deleted file mode 100644 index 32e4dd29f882..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_scheduled_query_ruleswith_cross_resource.py +++ /dev/null @@ -1,71 +0,0 @@ -# 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 create_or_update_scheduled_query_ruleswith_cross_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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.scheduled_query_rules.create_or_update( - resource_group_name="Rac46PostSwapRG", - rule_name="SampleCrossResourceAlert", - parameters={ - "location": "eastus", - "properties": { - "action": { - "aznsAction": { - "actionGroup": [ - "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag" - ], - "emailSubject": "Cross Resource Mail!!", - }, - "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", - "severity": "3", - "trigger": {"threshold": 5000, "thresholdOperator": "GreaterThan"}, - }, - "description": "Sample Cross Resource alert", - "enabled": "true", - "schedule": {"frequencyInMinutes": 60, "timeWindowInMinutes": 60}, - "source": { - "authorizedResources": [ - "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace", - "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI", - ], - "dataSourceId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI", - "query": 'union requests, workspace("sampleWorkspace").Update', - "queryType": "ResultCount", - }, - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRuleswithCrossResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_service_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_service_diagnostic_setting.py deleted file mode 100644 index de1c4127419a..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_service_diagnostic_setting.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 create_or_update_service_diagnostic_setting.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.service_diagnostic_settings.create_or_update( - resource_uri="/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - parameters={ - "location": "", - "properties": { - "eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule", - "logs": [ - {"category": "WorkflowRuntime", "enabled": True, "retentionPolicy": {"days": 0, "enabled": False}} - ], - "metrics": [{"enabled": True, "retentionPolicy": {"days": 0, "enabled": False}, "timeGrain": "PT1M"}], - "serviceBusRuleId": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey", - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1", - "workspaceId": "", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-09-01/examples/createOrUpdateServiceDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_activity_log_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_simple_log_alert_scheduled_query_rule.py similarity index 50% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_activity_log_alert.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_simple_log_alert_scheduled_query_rule.py index de36a187ac94..018d7e64d038 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_activity_log_alert.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_simple_log_alert_scheduled_query_rule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python create_or_update_activity_log_alert.py + python create_or_update_simple_log_alert_scheduled_query_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, @@ -27,36 +28,39 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="187f412d-1758-44d9-b052-169e2564721d", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) - response = client.activity_log_alerts.create_or_update( - resource_group_name="Default-ActivityLogAlerts", - activity_log_alert_name="SampleActivityLogAlert", - activity_log_alert={ - "location": "Global", + response = client.scheduled_query_rules.create_or_update( + resource_group_name="QueryResourceGroupName", + rule_name="perf", + parameters={ + "kind": "SimpleLogAlert", + "location": "eastus", "properties": { "actions": { "actionGroups": [ - { - "actionGroupId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup", - "webhookProperties": {"sampleWebhookProperty": "samplePropertyValue"}, - } - ] + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup" + ], + "actionProperties": {"Icm.Title": "Custom title in ICM", "Icm.TsgId": "https://tsg.url"}, + "customProperties": {"key11": "value11", "key12": "value12"}, }, - "condition": { - "allOf": [{"equals": "Administrative", "field": "Category"}, {"equals": "Error", "field": "Level"}] - }, - "description": "Sample activity log alert description", + "autoMitigate": False, + "checkWorkspaceAlertsStorageConfigured": True, + "criteria": {"allOf": [{"query": 'Perf | where ObjectName == "Processor"'}]}, + "description": "Performance rule", "enabled": True, - "scopes": ["subscriptions/187f412d-1758-44d9-b052-169e2564721d"], + "scopes": [ + "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1" + ], + "severity": 4, + "skipQueryValidation": True, }, - "tags": {}, }, ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/createOrUpdateActivityLogAlert.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/createOrUpdateSimpleLogAlertScheduledQueryRule.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_subscription_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_subscription_diagnostic_setting.py deleted file mode 100644 index 602269696c92..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_subscription_diagnostic_setting.py +++ /dev/null @@ -1,50 +0,0 @@ -# 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 create_or_update_subscription_diagnostic_setting.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="fb9f25f9-5785-4510-a38f-a62f188eb9f8", - ) - - response = client.subscription_diagnostic_settings.create_or_update( - name="ds4", - parameters={ - "properties": { - "eventHubAuthorizationRuleId": "/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule", - "eventHubName": "myeventhub", - "logs": [{"category": "Security", "enabled": True}], - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1", - "workspaceId": "", - } - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/createOrUpdateSubscriptionDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_web_test_metric_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_web_test_metric_alert.py deleted file mode 100644 index f636883a1cda..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_web_test_metric_alert.py +++ /dev/null @@ -1,67 +0,0 @@ -# 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 create_or_update_web_test_metric_alert.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="12345678-1234-1234-1234-123456789101", - ) - - response = client.metric_alerts.create_or_update( - resource_group_name="rg-example", - rule_name="webtest-name-example", - parameters={ - "location": "global", - "properties": { - "actions": [], - "criteria": { - "componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example", - "failedLocationCount": 2, - "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria", - "webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example", - }, - "description": 'Automatically created alert rule for availability test "component-example" a', - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example", - "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example", - ], - "severity": 4, - "windowSize": "PT15M", - }, - "tags": { - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": "Resource", - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": "Resource", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_action_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_action_group.py index 1c3a53ed9bee..5b95471326c1 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_action_group.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_action_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/deleteActionGroup.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/deleteActionGroup.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_activity_log_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_activity_log_alert.py deleted file mode 100644 index 8b771127ec6b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_activity_log_alert.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 delete_activity_log_alert.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - client.activity_log_alerts.delete( - resource_group_name="Default-ActivityLogAlerts", - activity_log_alert_name="SampleActivityLogAlert", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/deleteActivityLogAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_autoscale_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_autoscale_setting.py deleted file mode 100644 index a6149efc8eae..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_autoscale_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 delete_autoscale_setting.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - client.autoscale_settings.delete( - resource_group_name="TestingMetricsScaleSet", - autoscale_setting_name="MySetting", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_diagnostic_setting.py deleted file mode 100644 index 3c4c9085a214..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_diagnostic_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 delete_diagnostic_setting.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.diagnostic_settings.delete( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="mysetting", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_guest_diagnostic_settings_association.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_guest_diagnostic_settings_association.py deleted file mode 100644 index 3345a094fa72..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_guest_diagnostic_settings_association.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 delete_guest_diagnostic_settings_association.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.guest_diagnostics_settings_association.delete( - resource_uri="subscriptions/8498f01b-8064-4e37-856e-318f3c6c685f/resourceGroups/healthsystem/providers/Microsoft.Compute/virtualMachines/eastussojai", - association_name="healthSystemMachineConfigAssociation", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-06-01-preview/examples/deleteGuestDiagnosticSettingsAssociation.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_log_profile.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_log_profile.py deleted file mode 100644 index 03d4cab69a5c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_log_profile.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 delete_log_profile.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - client.log_profiles.delete( - log_profile_name="Rac46PostSwapRG", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_metric_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_metric_alert.py deleted file mode 100644 index 05a38f4462ed..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_metric_alert.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 delete_metric_alert.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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - client.metric_alerts.delete( - resource_group_name="gigtest", - rule_name="chiricutin", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rules.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rule.py similarity index 79% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rules.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rule.py index 5a5d67f2fde6..95169627edb9 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rules.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python delete_scheduled_query_rules.py + python delete_scheduled_query_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, @@ -27,15 +28,15 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) client.scheduled_query_rules.delete( - resource_group_name="Rac46PostSwapRG", - rule_name="logalertfoo", + resource_group_name="QueryResourceGroupName", + rule_name="heartbeat", ) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/deleteScheduledQueryRule.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_subscription_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_subscription_diagnostic_setting.py deleted file mode 100644 index 27b6a9a6371f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_subscription_diagnostic_setting.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 delete_subscription_diagnostic_setting.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="1a66ce04-b633-4a0b-b2bc-a912ec8986a6", - ) - - client.subscription_diagnostic_settings.delete( - name="ds4", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/deleteSubscriptionDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/enable_receiver.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/enable_receiver.py index a044431cdb5e..07f08223d470 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/enable_receiver.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/enable_receiver.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/enableReceiver.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/enableReceiver.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_action_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_action_group.py index 3552f016760b..1f3bc80b9150 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_action_group.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_action_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getActionGroup.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/getActionGroup.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_log_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_log_alert.py deleted file mode 100644 index 0662717cdf40..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_log_alert.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_activity_log_alert.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.activity_log_alerts.get( - resource_group_name="Default-ActivityLogAlerts", - activity_log_alert_name="SampleActivityLogAlert", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/getActivityLogAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered.py deleted file mode 100644 index 30db67fe5e61..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_activity_logs_filtered.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="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", - ) - - response = client.activity_logs.list( - filter="eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered_and_selected.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered_and_selected.py deleted file mode 100644 index f481ff2ed913..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_activity_logs_filtered_and_selected.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_activity_logs_filtered_and_selected.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="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", - ) - - response = client.activity_logs.list( - filter="eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_alert_rule_incident.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_alert_rule_incident.py deleted file mode 100644 index 0a1c4c42a256..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_alert_rule_incident.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 get_alert_rule_incident.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.alert_rule_incidents.get( - resource_group_name="Rac46PostSwapRG", - rule_name="myRuleName", - incident_name="Website_started", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_autoscale_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_autoscale_setting.py deleted file mode 100644 index a48bc8e4dd6b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_autoscale_setting.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_autoscale_setting.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.autoscale_settings.get( - resource_group_name="TestingMetricsScaleSet", - autoscale_setting_name="MySetting", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting.py deleted file mode 100644 index c79500db402f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_diagnostic_setting.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.diagnostic_settings.get( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="mysetting", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting_category.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting_category.py deleted file mode 100644 index a75b63d3d74d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_setting_category.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_diagnostic_setting_category.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.diagnostic_settings.get( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="mysetting", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_settings_category.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_settings_category.py deleted file mode 100644 index 03667b783faa..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_diagnostic_settings_category.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_diagnostic_settings_category.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.diagnostic_settings_category.get( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - name="WorkflowRuntime", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/getDiagnosticSettingsCategory.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_multiple_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_multiple_resource.py deleted file mode 100644 index ef8149673959..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_multiple_resource.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_dynamic_metric_alert_multiple_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="00000000-0000-0000-0000-000000000000", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest", - rule_name="MetricAlertOnMultipleResources", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_single_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_single_resource.py deleted file mode 100644 index 737f6ed33111..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_dynamic_metric_alert_single_resource.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_dynamic_metric_alert_single_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="00000000-0000-0000-0000-000000000000", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest", - rule_name="chiricutin", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_event_categories.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_event_categories.py deleted file mode 100644 index ca18b30119fb..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_event_categories.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 get_event_categories.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.event_categories.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_guest_diagnostic_settings_association.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_guest_diagnostic_settings_association.py deleted file mode 100644 index b44fd0c2130b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_guest_diagnostic_settings_association.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_guest_diagnostic_settings_association.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.guest_diagnostics_settings_association.get( - resource_uri="subscriptions/8498f01b-8064-4e37-856e-318f3c6c685f/resourceGroups/healthsystem/providers/Microsoft.Compute/virtualMachines/eastussojai", - association_name="healthSystemMachineConfigAssociation", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-06-01-preview/examples/getGuestDiagnosticSettingsAssociation.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_log_profile.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_log_profile.py deleted file mode 100644 index 5efa4df692fa..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_log_profile.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_log_profile.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="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", - ) - - response = client.log_profiles.get( - log_profile_name="default", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric.py deleted file mode 100644 index 7a161d9c275e..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_metric.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.metrics.list( - resource_uri="subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetric.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_multiple_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_multiple_resource.py deleted file mode 100644 index 361fca95ce14..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_multiple_resource.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_alert_multiple_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest", - rule_name="MetricAlertOnMultipleResources", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_resource_group.py deleted file mode 100644 index 8e423c8615cb..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_resource_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_alert_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest1", - rule_name="MetricAlertAtResourceGroupLevel", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_single_resource.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_single_resource.py deleted file mode 100644 index 80e094e0df3f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_single_resource.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_alert_single_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest", - rule_name="chiricutin", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status.py deleted file mode 100644 index b46f0bf2896f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_alert_status.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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts_status.list( - resource_group_name="gigtest", - rule_name="chiricutin", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status_by_name.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status_by_name.py deleted file mode 100644 index 38182211c6df..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_status_by_name.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 get_metric_alert_status_by_name.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="009f6022-67ec-423e-9aa7-691182870588", - ) - - response = client.metric_alerts_status.list_by_name( - resource_group_name="EastUs", - rule_name="custom1", - status_name="cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_subscription.py deleted file mode 100644 index 7dfe8b2c35f3..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_alert_subscription.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_alert_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.get( - resource_group_name="gigtest", - rule_name="MetricAlertAtSubscriptionLevel", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions.py deleted file mode 100644 index e5cf555fad82..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_definitions.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.metric_definitions.list( - resource_uri="subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitions.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_application_insights.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_application_insights.py deleted file mode 100644 index 7c6937577009..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_application_insights.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_definitions_application_insights.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.metric_definitions.list( - resource_uri="subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsApplicationInsights.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_metric_class.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_metric_class.py deleted file mode 100644 index 1cb542262090..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_definitions_metric_class.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_definitions_metric_class.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.metric_definitions.list( - resource_uri="subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsMetricClass.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_error.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_error.py deleted file mode 100644 index 58a03ac908e4..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_metric_error.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.metrics.list( - resource_uri="subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricError.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_metadata.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_metadata.py deleted file mode 100644 index e4fe103eeed3..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_metadata.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_metric_metadata.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.metrics.list( - resource_uri="subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_namespaces.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_namespaces.py deleted file mode 100644 index f2172a152748..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_namespaces.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_metric_namespaces.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.metric_namespaces.list( - resource_uri="subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_resource_group.py deleted file mode 100644 index 148af94be14f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_onboarding_status_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="SUBSCRIPTION_ID", - ) - - response = client.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm.py deleted file mode 100644 index 803151e85c65..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_onboarding_status_single_vm.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.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm_unknown.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm_unknown.py deleted file mode 100644 index 6f2761862036..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_single_vm_unknown.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_onboarding_status_single_vm_unknown.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.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_subscription.py deleted file mode 100644 index 9ddfd67d7199..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_subscription.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_onboarding_status_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="SUBSCRIPTION_ID", - ) - - response = client.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_vm_scale_set.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_vm_scale_set.py deleted file mode 100644 index e442d0c3f41c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_vm_scale_set.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_onboarding_status_vm_scale_set.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.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_predictive_metric.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_predictive_metric.py deleted file mode 100644 index a397d0e973a0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_predictive_metric.py +++ /dev/null @@ -1,49 +0,0 @@ -# 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 isodate - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.monitor import MonitorManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-monitor -# USAGE - python get_predictive_metric.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="00000000-0000-0000-0000-000000000000", - ) - - response = client.predictive_metric.get( - resource_group_name="myRG", - autoscale_setting_name="vmss1-Autoscale-775", - timespan="2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", - interval=isodate.parse_duration("PT1H"), - metric_namespace="Microsoft.Compute/virtualMachineScaleSets", - metric_name="PercentageCPU", - aggregation="Total", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rules.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rule.py similarity index 80% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rules.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rule.py index e82413761470..2e5068b65888 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rules.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_scheduled_query_rules.py + python get_scheduled_query_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, @@ -27,16 +28,16 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) response = client.scheduled_query_rules.get( - resource_group_name="Rac46PostSwapRG", - rule_name="logalertfoo", + resource_group_name="QueryResourceGroupName", + rule_name="perf", ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/getScheduledQueryRules.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/getScheduledQueryRule.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_service_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_service_diagnostic_setting.py deleted file mode 100644 index e3a47061f615..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_service_diagnostic_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_service_diagnostic_setting.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.service_diagnostic_settings.get( - resource_uri="/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-09-01/examples/getServiceDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_subscription_diagnostic_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_subscription_diagnostic_setting.py deleted file mode 100644 index 7229d2d1d495..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_subscription_diagnostic_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_subscription_diagnostic_setting.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="fb9f25f9-5785-4510-a38f-a62f188eb9f8", - ) - - response = client.subscription_diagnostic_settings.get( - name="mysetting", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/getSubscriptionDiagnosticSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered.py deleted file mode 100644 index 3715c67b4930..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 get_tenant_activity_logs_filtered.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="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", - ) - - response = client.tenant_activity_logs.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_no_params.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_no_params.py deleted file mode 100644 index 155e748e8126..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_no_params.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 get_tenant_activity_logs_no_params.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="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", - ) - - response = client.tenant_activity_logs.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_selected.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_selected.py deleted file mode 100644 index 71e69fce0f68..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_selected.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 get_tenant_activity_logs_selected.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="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", - ) - - response = client.tenant_activity_logs.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications.py deleted file mode 100644 index 9f72676a7730..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 get_test_notifications.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.get_test_notifications( - notification_id="11000222191287", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotifications.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_action_group_resource_level.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_action_group_resource_level.py index ffd519f62f4b..ed24c3bec19a 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_action_group_resource_level.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_action_group_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtActionGroupResourceLevel.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/getTestNotificationsAtActionGroupResourceLevel.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_resource_group_level.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_resource_group_level.py deleted file mode 100644 index 1661a7cca685..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_resource_group_level.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_test_notifications_at_resource_group_level.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.get_test_notifications_at_resource_group_level( - resource_group_name="Default-TestNotifications", - notification_id="11000222191287", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtResourceGroupLevel.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_web_test_metric_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_web_test_metric_alert.py deleted file mode 100644 index 3a2a1978a048..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_web_test_metric_alert.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 get_web_test_metric_alert.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="12345678-1234-1234-1234-123456789101", - ) - - response = client.metric_alerts.get( - resource_group_name="rg-example", - rule_name="webtest-name-example", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_action_groups.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_action_groups.py index bb0384104296..d9c627782af4 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_action_groups.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_action_groups.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,13 +31,11 @@ def main(): subscription_id="187f412d-1758-44d9-b052-169e2564721d", ) - response = client.action_groups.list_by_resource_group( - resource_group_name="Default-NotificationRules", - ) + response = client.action_groups.list_by_subscription_id() for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/listActionGroups.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/listActionGroups.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_activity_log_alerts.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_activity_log_alerts.py deleted file mode 100644 index accdd53f5c5c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_activity_log_alerts.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 list_activity_log_alerts.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.activity_log_alerts.list_by_resource_group( - resource_group_name="Default-ActivityLogAlerts", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/listActivityLogAlerts.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_alert_rule_incidents.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_alert_rule_incidents.py deleted file mode 100644 index 9bc1c28e73d0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_alert_rule_incidents.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 list_alert_rule_incidents.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.alert_rule_incidents.list_by_alert_rule( - resource_group_name="Rac46PostSwapRG", - rule_name="myRuleName", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting.py deleted file mode 100644 index 4f01aae1b9bc..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 list_autoscale_setting.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.autoscale_settings.list_by_resource_group( - resource_group_name="TestingMetricsScaleSet", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting_by_subscription.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting_by_subscription.py deleted file mode 100644 index 57f152abfa69..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_autoscale_setting_by_subscription.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 list_autoscale_setting_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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.autoscale_settings.list_by_subscription() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings.py deleted file mode 100644 index 72cee34c916b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 list_diagnostic_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="SUBSCRIPTION_ID", - ) - - response = client.diagnostic_settings.list( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_categories.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_categories.py deleted file mode 100644 index e3cc50259244..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_categories.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 list_diagnostic_settings_categories.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.diagnostic_settings_category.list( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/listDiagnosticSettingsCategories.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_category.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_category.py deleted file mode 100644 index 5ee0448e874f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_diagnostic_settings_category.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 list_diagnostic_settings_category.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.diagnostic_settings.list( - resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_log_profile.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_log_profile.py deleted file mode 100644 index 918d53f6c249..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_log_profile.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 list_log_profile.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="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", - ) - - response = client.log_profiles.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_metric_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_metric_alert.py deleted file mode 100644 index 7b86d8f21b69..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_metric_alert.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 list_metric_alert.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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.list_by_resource_group( - resource_group_name="gigtest", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_resource_group.py similarity index 80% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_resource_group.py index 5b0cda029648..f3a545fb2a10 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python list_scheduled_query_rules.py + python list_scheduled_query_rules_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, @@ -27,16 +28,16 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) response = client.scheduled_query_rules.list_by_resource_group( - resource_group_name="gigtest", + resource_group_name="QueryResourceGroupName", ) for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/listScheduledQueryRules.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/listScheduledQueryRulesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered_and_selected.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_subscription.py similarity index 79% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered_and_selected.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_subscription.py index a4b1aa57da7d..4df711111bd4 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered_and_selected.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_tenant_activity_logs_filtered_and_selected.py + python list_scheduled_query_rules_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, @@ -27,14 +28,14 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) - response = client.tenant_activity_logs.list() + response = client.scheduled_query_rules.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/listScheduledQueryRulesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_subscription_diagnostic_settings.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/list_subscription_diagnostic_settings.py deleted file mode 100644 index e99fda90c43d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_subscription_diagnostic_settings.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 list_subscription_diagnostic_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="fb9f25f9-5785-4510-a38f-a62f188eb9f8", - ) - - response = client.subscription_diagnostic_settings.list() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-05-01-preview/examples/listSubscriptionDiagnosticSettings.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/metric_baselines.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/metric_baselines.py deleted file mode 100644 index 0d0d23f92614..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/metric_baselines.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 metric_baselines.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.baselines.list( - resource_uri="subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/operation_list.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/operation_list.py deleted file mode 100644 index a3b6b066d8c1..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/operation_list.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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 operation_list.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.operations.list() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_action_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_action_group.py index a33358e56d15..c72d35e8e840 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_action_group.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_action_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -33,11 +34,15 @@ def main(): response = client.action_groups.update( resource_group_name="Default-NotificationRules", action_group_name="SampleActionGroup", - action_group_patch={"properties": {"enabled": False}, "tags": {"key1": "value1", "key2": "value2"}}, + action_group_patch={ + "identity": {"type": "SystemAssigned"}, + "properties": {"enabled": False}, + "tags": {"key1": "value1", "key2": "value2"}, + }, ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/patchActionGroup.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/patchActionGroup.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_activity_log_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_activity_log_alert.py deleted file mode 100644 index 0b23789a0ed0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_activity_log_alert.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 patch_activity_log_alert.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.activity_log_alerts.update( - resource_group_name="Default-ActivityLogAlerts", - activity_log_alert_name="SampleActivityLogAlert", - activity_log_alert_patch={"properties": {"enabled": False}, "tags": {"key1": "value1", "key2": "value2"}}, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/patchActivityLogAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_autoscale_setting.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_autoscale_setting.py deleted file mode 100644 index 8e093d4eb272..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_autoscale_setting.py +++ /dev/null @@ -1,160 +0,0 @@ -# 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 patch_autoscale_setting.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="b67f7fec-69fc-4974-9099-a26bd6ffeda3", - ) - - response = client.autoscale_settings.update( - resource_group_name="TestingMetricsScaleSet", - autoscale_setting_name="MySetting", - autoscale_setting_resource={ - "properties": { - "enabled": True, - "notifications": [ - { - "email": { - "customEmails": ["gu@ms.com", "ge@ns.net"], - "sendToSubscriptionAdministrator": True, - "sendToSubscriptionCoAdministrators": True, - }, - "operation": "Scale", - "webhooks": [{"properties": {}, "serviceUri": "http://myservice.com"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "Enabled"}, - "profiles": [ - { - "capacity": {"default": "1", "maximum": "10", "minimum": "1"}, - "fixedDate": { - "end": "2015-03-05T14:30:00Z", - "start": "2015-03-05T14:00:00Z", - "timeZone": "UTC", - }, - "name": "adios", - "rules": [ - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 10, - "timeAggregation": "Average", - "timeGrain": "PT1M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT5M", - "direction": "Increase", - "type": "ChangeCount", - "value": "1", - }, - }, - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 15, - "timeAggregation": "Average", - "timeGrain": "PT2M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT6M", - "direction": "Decrease", - "type": "ChangeCount", - "value": "2", - }, - }, - ], - }, - { - "capacity": {"default": "1", "maximum": "10", "minimum": "1"}, - "name": "saludos", - "recurrence": { - "frequency": "Week", - "schedule": {"days": ["1"], "hours": [5], "minutes": [15], "timeZone": "UTC"}, - }, - "rules": [ - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 10, - "timeAggregation": "Average", - "timeGrain": "PT1M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT5M", - "direction": "Increase", - "type": "ChangeCount", - "value": "1", - }, - }, - { - "metricTrigger": { - "dividePerInstance": False, - "metricName": "Percentage CPU", - "metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - "operator": "GreaterThan", - "statistic": "Average", - "threshold": 15, - "timeAggregation": "Average", - "timeGrain": "PT2M", - "timeWindow": "PT5M", - }, - "scaleAction": { - "cooldown": "PT6M", - "direction": "Decrease", - "type": "ChangeCount", - "value": "2", - }, - }, - ], - }, - ], - "targetResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", - }, - "tags": {"key1": "value1"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_log_profile.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_log_profile.py deleted file mode 100644 index 04b77024f937..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_log_profile.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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 patch_log_profile.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="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", - ) - - response = client.log_profiles.update( - log_profile_name="Rac46PostSwapRG", - log_profiles_resource={ - "properties": { - "categories": ["Write", "Delete", "Action"], - "locations": ["global"], - "retentionPolicy": {"days": 3, "enabled": True}, - "serviceBusRuleId": "", - "storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162", - }, - "tags": {"key1": "value1"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rules.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rule.py similarity index 77% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rules.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rule.py index b9456f3ffd1b..51efae10c378 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rules.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rule.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -15,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python patch_scheduled_query_rules.py + python patch_scheduled_query_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, @@ -27,17 +28,17 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="dd4bfc94-a096-412b-9c43-4bd13e35afbc", ) response = client.scheduled_query_rules.update( - resource_group_name="my-resource-group", - rule_name="logalertfoo", - parameters={"properties": {"enabled": "true"}}, + resource_group_name="QueryResourceGroupName", + rule_name="heartbeat", + parameters={"properties": {"enabled": False}}, ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/patchScheduledQueryRules.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2025-01-01-preview/examples/patchScheduledQueryRule.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications.py deleted file mode 100644 index 6374ae07f2ae..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications.py +++ /dev/null @@ -1,127 +0,0 @@ -# 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 post_test_notifications.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.begin_post_test_notifications( - notification_request={ - "alertType": "budget", - "armRoleReceivers": [ - { - "name": "ArmRole-Common", - "roleId": "11111111-1111-1111-1111-111111111111", - "useCommonAlertSchema": True, - }, - { - "name": "ArmRole-nonCommon", - "roleId": "11111111-1111-1111-1111-111111111111", - "useCommonAlertSchema": False, - }, - ], - "automationRunbookReceivers": [ - { - "automationAccountId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest", - "isGlobalRunbook": False, - "name": "testRunbook", - "runbookName": "Sample runbook", - "serviceUri": "http://test.me", - "useCommonAlertSchema": True, - "webhookResourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084", - } - ], - "azureAppPushReceivers": [{"emailAddress": "johndoe@email.com", "name": "Sample azureAppPush"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp", - "functionName": "HttpTriggerCSharp1", - "httpTriggerUrl": "http://test.me", - "name": "Sample azureFunction", - "useCommonAlertSchema": True, - } - ], - "emailReceivers": [ - {"emailAddress": "johndoe@email.com", "name": "John Doe's email", "useCommonAlertSchema": False}, - {"emailAddress": "janesmith@email.com", "name": "Jane Smith's email", "useCommonAlertSchema": True}, - ], - "eventHubReceivers": [ - { - "eventHubName": "testEventHub", - "eventHubNameSpace": "testEventHubNameSpace", - "name": "Sample eventHub", - "subscriptionId": "187f412d-1758-44d9-b052-169e2564721d", - "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", - } - ], - "itsmReceivers": [ - { - "connectionId": "a3b9076c-ce8e-434e-85b4-aff10cb3c8f1", - "name": "Sample itsm", - "region": "westcentralus", - "ticketConfiguration": '{"PayloadRevision":0,"WorkItemType":"Incident","UseTemplate":false,"WorkItemData":"{}","CreateOneWIPerCI":false}', - "workspaceId": "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c", - } - ], - "logicAppReceivers": [ - { - "callbackUrl": "https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w", - "name": "Sample logicApp", - "resourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp", - "useCommonAlertSchema": False, - } - ], - "smsReceivers": [ - {"countryCode": "1", "name": "John Doe's mobile", "phoneNumber": "1234567890"}, - {"countryCode": "1", "name": "Jane Smith's mobile", "phoneNumber": "0987654321"}, - ], - "voiceReceivers": [{"countryCode": "1", "name": "Sample voice", "phoneNumber": "1234567890"}], - "webhookReceivers": [ - { - "name": "Sample webhook 1", - "serviceUri": "http://www.example.com/webhook1", - "useCommonAlertSchema": True, - }, - { - "identifierUri": "http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a", - "name": "Sample webhook 2", - "objectId": "d3bb868c-fe44-452c-aa26-769a6538c808", - "serviceUri": "http://www.example.com/webhook2", - "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", - "useAadAuth": True, - "useCommonAlertSchema": True, - }, - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotifications.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_action_group_resource_level.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_action_group_resource_level.py index dd3e23cee1e2..a834f7d950cc 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_action_group_resource_level.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_action_group_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -64,6 +65,7 @@ def main(): "functionAppResourceId": "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp", "functionName": "HttpTriggerCSharp1", "httpTriggerUrl": "http://test.me", + "managedIdentity": "f11979a4-36d1-45d0-9097-a0da3c7e855d", "name": "Sample azureFunction", "useCommonAlertSchema": True, } @@ -93,6 +95,7 @@ def main(): "logicAppReceivers": [ { "callbackUrl": "https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w", + "managedIdentity": "f11979a4-36d1-45d0-9097-a0da3c7e855d", "name": "Sample logicApp", "resourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp", "useCommonAlertSchema": False, @@ -124,6 +127,6 @@ def main(): print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtActionGroupResourceLevel.json +# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/examples/postTestNotificationsAtActionGroupResourceLevel.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_resource_group_level.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_resource_group_level.py deleted file mode 100644 index a5ed720e80b2..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_resource_group_level.py +++ /dev/null @@ -1,128 +0,0 @@ -# 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 post_test_notifications_at_resource_group_level.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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.begin_create_notifications_at_resource_group_level( - resource_group_name="Default-TestNotifications", - notification_request={ - "alertType": "budget", - "armRoleReceivers": [ - { - "name": "ArmRole-Common", - "roleId": "11111111-1111-1111-1111-111111111111", - "useCommonAlertSchema": True, - }, - { - "name": "ArmRole-nonCommon", - "roleId": "11111111-1111-1111-1111-111111111111", - "useCommonAlertSchema": False, - }, - ], - "automationRunbookReceivers": [ - { - "automationAccountId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest", - "isGlobalRunbook": False, - "name": "testRunbook", - "runbookName": "Sample runbook", - "serviceUri": "http://test.me", - "useCommonAlertSchema": True, - "webhookResourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084", - } - ], - "azureAppPushReceivers": [{"emailAddress": "johndoe@email.com", "name": "Sample azureAppPush"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp", - "functionName": "HttpTriggerCSharp1", - "httpTriggerUrl": "http://test.me", - "name": "Sample azureFunction", - "useCommonAlertSchema": True, - } - ], - "emailReceivers": [ - {"emailAddress": "johndoe@email.com", "name": "John Doe's email", "useCommonAlertSchema": False}, - {"emailAddress": "janesmith@email.com", "name": "Jane Smith's email", "useCommonAlertSchema": True}, - ], - "eventHubReceivers": [ - { - "eventHubName": "testEventHub", - "eventHubNameSpace": "testEventHubNameSpace", - "name": "Sample eventHub", - "subscriptionId": "187f412d-1758-44d9-b052-169e2564721d", - "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", - } - ], - "itsmReceivers": [ - { - "connectionId": "a3b9076c-ce8e-434e-85b4-aff10cb3c8f1", - "name": "Sample itsm", - "region": "westcentralus", - "ticketConfiguration": '{"PayloadRevision":0,"WorkItemType":"Incident","UseTemplate":false,"WorkItemData":"{}","CreateOneWIPerCI":false}', - "workspaceId": "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c", - } - ], - "logicAppReceivers": [ - { - "callbackUrl": "https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w", - "name": "Sample logicApp", - "resourceId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp", - "useCommonAlertSchema": False, - } - ], - "smsReceivers": [ - {"countryCode": "1", "name": "John Doe's mobile", "phoneNumber": "1234567890"}, - {"countryCode": "1", "name": "Jane Smith's mobile", "phoneNumber": "0987654321"}, - ], - "voiceReceivers": [{"countryCode": "1", "name": "Sample voice", "phoneNumber": "1234567890"}], - "webhookReceivers": [ - { - "name": "Sample webhook 1", - "serviceUri": "http://www.example.com/webhook1", - "useCommonAlertSchema": True, - }, - { - "identifierUri": "http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a", - "name": "Sample webhook 2", - "objectId": "d3bb868c-fe44-452c-aa26-769a6538c808", - "serviceUri": "http://www.example.com/webhook2", - "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", - "useAadAuth": True, - "useCommonAlertSchema": True, - }, - ], - }, - ).result() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtResourceGroupLevel.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_delete.py deleted file mode 100644 index bbfd18b37747..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 private_endpoint_connection_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="00000000-1111-2222-3333-444444444444", - ) - - client.private_endpoint_connections.begin_delete( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - private_endpoint_connection_name="private-endpoint-connection-name", - ).result() - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateEndpointConnectionDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_get.py deleted file mode 100644 index 5bc28d0ed411..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_endpoint_connection_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.get( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - private_endpoint_connection_name="private-endpoint-connection-name", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateEndpointConnectionGet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_list.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_list.py deleted file mode 100644 index 3c5df23a790b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_endpoint_connection_list.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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.list_by_private_link_scope( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateEndpointConnectionList.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_update.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_update.py deleted file mode 100644 index 4d7270430865..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_endpoint_connection_update.py +++ /dev/null @@ -1,51 +0,0 @@ -# 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 private_endpoint_connection_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_endpoint_connections.begin_create_or_update( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - private_endpoint_connection_name="private-endpoint-connection-name", - parameters={ - "properties": { - "privateLinkServiceConnectionState": { - "description": "Approved by johndoe@contoso.com", - "status": "Approved", - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateEndpointConnectionUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_operation_statuses.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_operation_statuses.py deleted file mode 100644 index f6af3a58eaff..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_operation_statuses.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 private_link_scope_operation_statuses.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="613192d7-503f-477a-9cfe-4efc3ee2bd60", - ) - - response = client.private_link_scope_operation_status.get( - async_operation_id="713192d7-503f-477a-9cfe-4efc3ee2bd11", - resource_group_name="MyResourceGroup", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/privateLinkScopeOperationStatuses.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_get.py deleted file mode 100644 index dae06377a0dc..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_link_scope_private_link_resource_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_resources.get( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - group_name="azuremonitor", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_list_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_list_get.py deleted file mode 100644 index 2e04d2dcbce6..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scope_private_link_resource_list_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_link_scope_private_link_resource_list_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_resources.list_by_private_link_scope( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_delete.py deleted file mode 100644 index 0fc6e3021998..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 private_link_scoped_resource_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="00000000-1111-2222-3333-444444444444", - ) - - client.private_link_scoped_resources.begin_delete( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - name="scoped-resource-name", - ).result() - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopedResourceDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_get.py deleted file mode 100644 index 74d8a9c93887..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_link_scoped_resource_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_scoped_resources.get( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - name="scoped-resource-name", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopedResourceGet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_list.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_list.py deleted file mode 100644 index 8cade548c408..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 private_link_scoped_resource_list.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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_scoped_resources.list_by_private_link_scope( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopedResourceList.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_update.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_update.py deleted file mode 100644 index da967cd54e42..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scoped_resource_update.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 private_link_scoped_resource_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="00000000-1111-2222-3333-444444444444", - ) - - response = client.private_link_scoped_resources.begin_create_or_update( - resource_group_name="MyResourceGroup", - scope_name="MyPrivateLinkScope", - name="scoped-resource-name", - parameters={ - "properties": { - "linkedResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component" - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopedResourceUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_delete.py deleted file mode 100644 index df372e18c1ac..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_delete.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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 private_link_scopes_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="86dc51d3-92ed-4d7e-947a-775ea79b4919", - ) - - client.private_link_scopes.begin_delete( - resource_group_name="my-resource-group", - scope_name="my-privatelinkscope", - ).result() - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopesDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_get.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_get.py deleted file mode 100644 index 8f157d9c44b3..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_get.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 private_link_scopes_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="86dc51d3-92ed-4d7e-947a-775ea79b4919", - ) - - response = client.private_link_scopes.get( - resource_group_name="my-resource-group", - scope_name="my-privatelinkscope", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopesGet.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list.py deleted file mode 100644 index 525b277cc1dd..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list.py +++ /dev/null @@ -1,40 +0,0 @@ -# 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 private_link_scopes_list.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="86dc51d3-92ed-4d7e-947a-775ea79b4919", - ) - - response = client.private_link_scopes.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopesList.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list_by_resource_group.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list_by_resource_group.py deleted file mode 100644 index 93ab2115fdc2..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list_by_resource_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 private_link_scopes_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="86dc51d3-92ed-4d7e-947a-775ea79b4919", - ) - - response = client.private_link_scopes.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopesListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/update_guest_diagnostic_settings_association.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/update_guest_diagnostic_settings_association.py deleted file mode 100644 index 0825cc09fbda..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/update_guest_diagnostic_settings_association.py +++ /dev/null @@ -1,48 +0,0 @@ -# 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 update_guest_diagnostic_settings_association.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.guest_diagnostics_settings_association.update( - resource_uri="subscriptions/8498f01b-8064-4e37-856e-318f3c6c685f/resourceGroups/healthsystem/providers/Microsoft.Compute/virtualMachines/eastussojai", - association_name="healthSystemMachineConfigAssociation", - parameters={ - "properties": { - "guestDiagnosticSettingsName": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-Association-ResourceGroup/providers/providers/microsoft.insights/guestDiagnosticSettings/vmSettingForSecurity" - }, - "tags": None, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-06-01-preview/examples/updateGuestDiagnosticSettingsAssociation.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/update_metric_alert.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/update_metric_alert.py deleted file mode 100644 index 9f41fc188390..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/update_metric_alert.py +++ /dev/null @@ -1,76 +0,0 @@ -# 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 update_metric_alert.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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.metric_alerts.update( - resource_group_name="gigtest", - rule_name="chiricutin", - parameters={ - "properties": { - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2", - "webHookProperties": {"key11": "value11", "key12": "value12"}, - } - ], - "autoMitigate": True, - "criteria": { - "allOf": [ - { - "criterionType": "StaticThresholdCriterion", - "dimensions": [], - "metricName": "\\Processor(_Total)\\% Processor Time", - "name": "High_CPU_80", - "operator": "GreaterThan", - "threshold": 80.5, - "timeAggregation": "Average", - } - ], - "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", - }, - "description": "This is the description of the rule1", - "enabled": True, - "evaluationFrequency": "PT1M", - "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme" - ], - "severity": 3, - "windowSize": "PT15M", - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations.py index 027e937ff2a8..1b5180fa61c4 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations.py @@ -33,6 +33,7 @@ def test_action_groups_create_or_update(self, resource_group): "isGlobalRunbook": bool, "runbookName": "str", "webhookResourceId": "str", + "managedIdentity": "str", "name": "str", "serviceUri": "str", "useCommonAlertSchema": False, @@ -45,6 +46,7 @@ def test_action_groups_create_or_update(self, resource_group): "functionName": "str", "httpTriggerUrl": "str", "name": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], @@ -58,12 +60,27 @@ def test_action_groups_create_or_update(self, resource_group): "eventHubNameSpace": "str", "name": "str", "subscriptionId": "str", + "managedIdentity": "str", "tenantId": "str", "useCommonAlertSchema": False, } ], "groupShortName": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "incidentReceivers": [ + { + "connection": {"id": "str", "name": "str"}, + "incidentManagementService": "str", + "mappings": {"str": "str"}, + "name": "str", + } + ], "itsmReceivers": [ { "connectionId": "str", @@ -74,7 +91,13 @@ def test_action_groups_create_or_update(self, resource_group): } ], "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} + { + "callbackUrl": "str", + "name": "str", + "resourceId": "str", + "managedIdentity": "str", + "useCommonAlertSchema": False, + } ], "name": "str", "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], @@ -86,6 +109,7 @@ def test_action_groups_create_or_update(self, resource_group): "name": "str", "serviceUri": "str", "identifierUri": "str", + "managedIdentity": "str", "objectId": "str", "tenantId": "str", "useAadAuth": False, @@ -93,7 +117,7 @@ def test_action_groups_create_or_update(self, resource_group): } ], }, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -105,7 +129,7 @@ def test_action_groups_get(self, resource_group): response = self.client.action_groups.get( resource_group_name=resource_group.name, action_group_name="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -117,7 +141,7 @@ def test_action_groups_delete(self, resource_group): response = self.client.action_groups.delete( resource_group_name=resource_group.name, action_group_name="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -129,8 +153,17 @@ def test_action_groups_update(self, resource_group): response = self.client.action_groups.update( resource_group_name=resource_group.name, action_group_name="str", - action_group_patch={"enabled": True, "tags": {"str": "str"}}, - api_version="2022-06-01", + action_group_patch={ + "enabled": True, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -138,8 +171,10 @@ def test_action_groups_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_action_groups_begin_post_test_notifications(self, resource_group): - response = self.client.action_groups.begin_post_test_notifications( + def test_action_groups_begin_create_notifications_at_action_group_resource_level(self, resource_group): + response = self.client.action_groups.begin_create_notifications_at_action_group_resource_level( + resource_group_name=resource_group.name, + action_group_name="str", notification_request={ "alertType": "str", "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], @@ -149,6 +184,7 @@ def test_action_groups_begin_post_test_notifications(self, resource_group): "isGlobalRunbook": bool, "runbookName": "str", "webhookResourceId": "str", + "managedIdentity": "str", "name": "str", "serviceUri": "str", "useCommonAlertSchema": False, @@ -161,6 +197,7 @@ def test_action_groups_begin_post_test_notifications(self, resource_group): "functionName": "str", "httpTriggerUrl": "str", "name": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], @@ -173,82 +210,17 @@ def test_action_groups_begin_post_test_notifications(self, resource_group): "eventHubNameSpace": "str", "name": "str", "subscriptionId": "str", + "managedIdentity": "str", "tenantId": "str", "useCommonAlertSchema": False, } ], - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], - "webhookReceivers": [ - { - "name": "str", - "serviceUri": "str", - "identifierUri": "str", - "objectId": "str", - "tenantId": "str", - "useAadAuth": False, - "useCommonAlertSchema": False, - } - ], - }, - api_version="2022-06-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_begin_create_notifications_at_resource_group_level(self, resource_group): - response = self.client.action_groups.begin_create_notifications_at_resource_group_level( - resource_group_name=resource_group.name, - notification_request={ - "alertType": "str", - "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], - "automationRunbookReceivers": [ - { - "automationAccountId": "str", - "isGlobalRunbook": bool, - "runbookName": "str", - "webhookResourceId": "str", - "name": "str", - "serviceUri": "str", - "useCommonAlertSchema": False, - } - ], - "azureAppPushReceivers": [{"emailAddress": "str", "name": "str"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "str", - "functionName": "str", - "httpTriggerUrl": "str", - "name": "str", - "useCommonAlertSchema": False, - } - ], - "emailReceivers": [ - {"emailAddress": "str", "name": "str", "status": "str", "useCommonAlertSchema": False} - ], - "eventHubReceivers": [ + "incidentReceivers": [ { - "eventHubName": "str", - "eventHubNameSpace": "str", + "connection": {"id": "str", "name": "str"}, + "incidentManagementService": "str", + "mappings": {"str": "str"}, "name": "str", - "subscriptionId": "str", - "tenantId": "str", - "useCommonAlertSchema": False, } ], "itsmReceivers": [ @@ -261,83 +233,14 @@ def test_action_groups_begin_create_notifications_at_resource_group_level(self, } ], "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], - "webhookReceivers": [ - { - "name": "str", - "serviceUri": "str", - "identifierUri": "str", - "objectId": "str", - "tenantId": "str", - "useAadAuth": False, - "useCommonAlertSchema": False, - } - ], - }, - api_version="2022-06-01", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_begin_create_notifications_at_action_group_resource_level(self, resource_group): - response = self.client.action_groups.begin_create_notifications_at_action_group_resource_level( - resource_group_name=resource_group.name, - action_group_name="str", - notification_request={ - "alertType": "str", - "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], - "automationRunbookReceivers": [ { - "automationAccountId": "str", - "isGlobalRunbook": bool, - "runbookName": "str", - "webhookResourceId": "str", - "name": "str", - "serviceUri": "str", - "useCommonAlertSchema": False, - } - ], - "azureAppPushReceivers": [{"emailAddress": "str", "name": "str"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "str", - "functionName": "str", - "httpTriggerUrl": "str", + "callbackUrl": "str", "name": "str", + "resourceId": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], - "emailReceivers": [ - {"emailAddress": "str", "name": "str", "status": "str", "useCommonAlertSchema": False} - ], - "eventHubReceivers": [ - { - "eventHubName": "str", - "eventHubNameSpace": "str", - "name": "str", - "subscriptionId": "str", - "tenantId": "str", - "useCommonAlertSchema": False, - } - ], - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], "webhookReceivers": [ @@ -345,6 +248,7 @@ def test_action_groups_begin_create_notifications_at_action_group_resource_level "name": "str", "serviceUri": "str", "identifierUri": "str", + "managedIdentity": "str", "objectId": "str", "tenantId": "str", "useAadAuth": False, @@ -352,35 +256,12 @@ def test_action_groups_begin_create_notifications_at_action_group_resource_level } ], }, - api_version="2022-06-01", + api_version="2024-10-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_get_test_notifications(self, resource_group): - response = self.client.action_groups.get_test_notifications( - notification_id="str", - api_version="2022-06-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_get_test_notifications_at_resource_group_level(self, resource_group): - response = self.client.action_groups.get_test_notifications_at_resource_group_level( - resource_group_name=resource_group.name, - notification_id="str", - api_version="2022-06-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_action_groups_get_test_notifications_at_action_group_resource_level(self, resource_group): @@ -388,7 +269,7 @@ def test_action_groups_get_test_notifications_at_action_group_resource_level(sel resource_group_name=resource_group.name, action_group_name="str", notification_id="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -398,7 +279,7 @@ def test_action_groups_get_test_notifications_at_action_group_resource_level(sel @recorded_by_proxy def test_action_groups_list_by_subscription_id(self, resource_group): response = self.client.action_groups.list_by_subscription_id( - api_version="2022-06-01", + api_version="2024-10-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -409,7 +290,7 @@ def test_action_groups_list_by_subscription_id(self, resource_group): def test_action_groups_list_by_resource_group(self, resource_group): response = self.client.action_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -422,7 +303,7 @@ def test_action_groups_enable_receiver(self, resource_group): resource_group_name=resource_group.name, action_group_name="str", enable_request={"receiverName": "str"}, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations_async.py index cd9fa1d74457..d084570bdf5f 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations_async.py @@ -34,6 +34,7 @@ async def test_action_groups_create_or_update(self, resource_group): "isGlobalRunbook": bool, "runbookName": "str", "webhookResourceId": "str", + "managedIdentity": "str", "name": "str", "serviceUri": "str", "useCommonAlertSchema": False, @@ -46,6 +47,7 @@ async def test_action_groups_create_or_update(self, resource_group): "functionName": "str", "httpTriggerUrl": "str", "name": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], @@ -59,12 +61,27 @@ async def test_action_groups_create_or_update(self, resource_group): "eventHubNameSpace": "str", "name": "str", "subscriptionId": "str", + "managedIdentity": "str", "tenantId": "str", "useCommonAlertSchema": False, } ], "groupShortName": "str", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "incidentReceivers": [ + { + "connection": {"id": "str", "name": "str"}, + "incidentManagementService": "str", + "mappings": {"str": "str"}, + "name": "str", + } + ], "itsmReceivers": [ { "connectionId": "str", @@ -75,7 +92,13 @@ async def test_action_groups_create_or_update(self, resource_group): } ], "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} + { + "callbackUrl": "str", + "name": "str", + "resourceId": "str", + "managedIdentity": "str", + "useCommonAlertSchema": False, + } ], "name": "str", "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], @@ -87,6 +110,7 @@ async def test_action_groups_create_or_update(self, resource_group): "name": "str", "serviceUri": "str", "identifierUri": "str", + "managedIdentity": "str", "objectId": "str", "tenantId": "str", "useAadAuth": False, @@ -94,7 +118,7 @@ async def test_action_groups_create_or_update(self, resource_group): } ], }, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -106,7 +130,7 @@ async def test_action_groups_get(self, resource_group): response = await self.client.action_groups.get( resource_group_name=resource_group.name, action_group_name="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -118,7 +142,7 @@ async def test_action_groups_delete(self, resource_group): response = await self.client.action_groups.delete( resource_group_name=resource_group.name, action_group_name="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -130,8 +154,17 @@ async def test_action_groups_update(self, resource_group): response = await self.client.action_groups.update( resource_group_name=resource_group.name, action_group_name="str", - action_group_patch={"enabled": True, "tags": {"str": "str"}}, - api_version="2022-06-01", + action_group_patch={ + "enabled": True, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -139,9 +172,11 @@ async def test_action_groups_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_action_groups_begin_post_test_notifications(self, resource_group): + async def test_action_groups_begin_create_notifications_at_action_group_resource_level(self, resource_group): response = await ( - await self.client.action_groups.begin_post_test_notifications( + await self.client.action_groups.begin_create_notifications_at_action_group_resource_level( + resource_group_name=resource_group.name, + action_group_name="str", notification_request={ "alertType": "str", "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], @@ -151,6 +186,7 @@ async def test_action_groups_begin_post_test_notifications(self, resource_group) "isGlobalRunbook": bool, "runbookName": "str", "webhookResourceId": "str", + "managedIdentity": "str", "name": "str", "serviceUri": "str", "useCommonAlertSchema": False, @@ -163,6 +199,7 @@ async def test_action_groups_begin_post_test_notifications(self, resource_group) "functionName": "str", "httpTriggerUrl": "str", "name": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], @@ -175,84 +212,17 @@ async def test_action_groups_begin_post_test_notifications(self, resource_group) "eventHubNameSpace": "str", "name": "str", "subscriptionId": "str", + "managedIdentity": "str", "tenantId": "str", "useCommonAlertSchema": False, } ], - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], - "webhookReceivers": [ + "incidentReceivers": [ { + "connection": {"id": "str", "name": "str"}, + "incidentManagementService": "str", + "mappings": {"str": "str"}, "name": "str", - "serviceUri": "str", - "identifierUri": "str", - "objectId": "str", - "tenantId": "str", - "useAadAuth": False, - "useCommonAlertSchema": False, - } - ], - }, - api_version="2022-06-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_begin_create_notifications_at_resource_group_level(self, resource_group): - response = await ( - await self.client.action_groups.begin_create_notifications_at_resource_group_level( - resource_group_name=resource_group.name, - notification_request={ - "alertType": "str", - "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], - "automationRunbookReceivers": [ - { - "automationAccountId": "str", - "isGlobalRunbook": bool, - "runbookName": "str", - "webhookResourceId": "str", - "name": "str", - "serviceUri": "str", - "useCommonAlertSchema": False, - } - ], - "azureAppPushReceivers": [{"emailAddress": "str", "name": "str"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "str", - "functionName": "str", - "httpTriggerUrl": "str", - "name": "str", - "useCommonAlertSchema": False, - } - ], - "emailReceivers": [ - {"emailAddress": "str", "name": "str", "status": "str", "useCommonAlertSchema": False} - ], - "eventHubReceivers": [ - { - "eventHubName": "str", - "eventHubNameSpace": "str", - "name": "str", - "subscriptionId": "str", - "tenantId": "str", - "useCommonAlertSchema": False, } ], "itsmReceivers": [ @@ -265,85 +235,14 @@ async def test_action_groups_begin_create_notifications_at_resource_group_level( } ], "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], - "webhookReceivers": [ - { - "name": "str", - "serviceUri": "str", - "identifierUri": "str", - "objectId": "str", - "tenantId": "str", - "useAadAuth": False, - "useCommonAlertSchema": False, - } - ], - }, - api_version="2022-06-01", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_begin_create_notifications_at_action_group_resource_level(self, resource_group): - response = await ( - await self.client.action_groups.begin_create_notifications_at_action_group_resource_level( - resource_group_name=resource_group.name, - action_group_name="str", - notification_request={ - "alertType": "str", - "armRoleReceivers": [{"name": "str", "roleId": "str", "useCommonAlertSchema": False}], - "automationRunbookReceivers": [ - { - "automationAccountId": "str", - "isGlobalRunbook": bool, - "runbookName": "str", - "webhookResourceId": "str", - "name": "str", - "serviceUri": "str", - "useCommonAlertSchema": False, - } - ], - "azureAppPushReceivers": [{"emailAddress": "str", "name": "str"}], - "azureFunctionReceivers": [ - { - "functionAppResourceId": "str", - "functionName": "str", - "httpTriggerUrl": "str", - "name": "str", - "useCommonAlertSchema": False, - } - ], - "emailReceivers": [ - {"emailAddress": "str", "name": "str", "status": "str", "useCommonAlertSchema": False} - ], - "eventHubReceivers": [ { - "eventHubName": "str", - "eventHubNameSpace": "str", + "callbackUrl": "str", "name": "str", - "subscriptionId": "str", - "tenantId": "str", + "resourceId": "str", + "managedIdentity": "str", "useCommonAlertSchema": False, } ], - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], "voiceReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str"}], "webhookReceivers": [ @@ -351,6 +250,7 @@ async def test_action_groups_begin_create_notifications_at_action_group_resource "name": "str", "serviceUri": "str", "identifierUri": "str", + "managedIdentity": "str", "objectId": "str", "tenantId": "str", "useAadAuth": False, @@ -358,36 +258,13 @@ async def test_action_groups_begin_create_notifications_at_action_group_resource } ], }, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_get_test_notifications(self, resource_group): - response = await self.client.action_groups.get_test_notifications( - notification_id="str", - api_version="2022-06-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_get_test_notifications_at_resource_group_level(self, resource_group): - response = await self.client.action_groups.get_test_notifications_at_resource_group_level( - resource_group_name=resource_group.name, - notification_id="str", - api_version="2022-06-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_action_groups_get_test_notifications_at_action_group_resource_level(self, resource_group): @@ -395,7 +272,7 @@ async def test_action_groups_get_test_notifications_at_action_group_resource_lev resource_group_name=resource_group.name, action_group_name="str", notification_id="str", - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself @@ -405,7 +282,7 @@ async def test_action_groups_get_test_notifications_at_action_group_resource_lev @recorded_by_proxy_async async def test_action_groups_list_by_subscription_id(self, resource_group): response = self.client.action_groups.list_by_subscription_id( - api_version="2022-06-01", + api_version="2024-10-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -416,7 +293,7 @@ async def test_action_groups_list_by_subscription_id(self, resource_group): async def test_action_groups_list_by_resource_group(self, resource_group): response = self.client.action_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -429,7 +306,7 @@ async def test_action_groups_enable_receiver(self, resource_group): resource_group_name=resource_group.name, action_group_name="str", enable_request={"receiverName": "str"}, - api_version="2022-06-01", + api_version="2024-10-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations.py index 6ed67b5b0870..60dede8f213b 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations.py @@ -18,6 +18,39 @@ class TestMonitorManagementScheduledQueryRulesOperations(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(MonitorManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scheduled_query_rules_list_by_subscription(self, resource_group): + response = self.client.scheduled_query_rules.list_by_subscription( + api_version="2025-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scheduled_query_rules_list_by_resource_group(self, resource_group): + response = self.client.scheduled_query_rules.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-01-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scheduled_query_rules_get(self, resource_group): + response = self.client.scheduled_query_rules.get( + resource_group_name=resource_group.name, + rule_name="str", + api_version="2025-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_scheduled_query_rules_create_or_update(self, resource_group): @@ -25,38 +58,70 @@ def test_scheduled_query_rules_create_or_update(self, resource_group): resource_group_name=resource_group.name, rule_name="str", parameters={ - "action": "action", "location": "str", - "source": {"dataSourceId": "str", "authorizedResources": ["str"], "query": "str", "queryType": "str"}, - "autoMitigate": False, + "actions": { + "actionGroups": ["str"], + "actionProperties": {"str": "str"}, + "customProperties": {"str": "str"}, + }, + "autoMitigate": bool, + "checkWorkspaceAlertsStorageConfigured": bool, "createdWithApiVersion": "str", + "criteria": { + "allOf": [ + { + "alertSensitivity": "str", + "criterionType": "str", + "dimensions": [{"name": "str", "operator": "str", "values": ["str"]}], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "ignoreDataBefore": "2020-02-20 00:00:00", + "metricMeasureColumn": "str", + "metricName": "str", + "minRecurrenceCount": 0, + "operator": "str", + "query": "str", + "resourceIdColumn": "str", + "threshold": 0.0, + "timeAggregation": "str", + } + ] + }, "description": "str", "displayName": "str", - "enabled": "str", + "enabled": bool, "etag": "str", + "evaluationFrequency": "1 day, 0:00:00", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "isLegacyLogAnalyticsRule": bool, + "isWorkspaceAlertsStorageConfigured": bool, "kind": "str", - "lastUpdatedTime": "2020-02-20 00:00:00", + "muteActionsDuration": "1 day, 0:00:00", "name": "str", - "provisioningState": "str", - "schedule": {"frequencyInMinutes": 0, "timeWindowInMinutes": 0}, + "overrideQueryTimeRange": "1 day, 0:00:00", + "resolveConfiguration": {"autoResolved": bool, "timeToResolve": "1 day, 0:00:00"}, + "scopes": ["str"], + "severity": 0, + "skipQueryValidation": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, + "targetResourceTypes": ["str"], "type": "str", + "windowSize": "1 day, 0:00:00", }, - api_version="2018-04-16", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_scheduled_query_rules_get(self, resource_group): - response = self.client.scheduled_query_rules.get( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-04-16", + api_version="2025-01-01-preview", ) # please add some check logic here by yourself @@ -68,8 +133,57 @@ def test_scheduled_query_rules_update(self, resource_group): response = self.client.scheduled_query_rules.update( resource_group_name=resource_group.name, rule_name="str", - parameters={"enabled": "str", "tags": {"str": "str"}}, - api_version="2018-04-16", + parameters={ + "actions": { + "actionGroups": ["str"], + "actionProperties": {"str": "str"}, + "customProperties": {"str": "str"}, + }, + "autoMitigate": bool, + "checkWorkspaceAlertsStorageConfigured": bool, + "createdWithApiVersion": "str", + "criteria": { + "allOf": [ + { + "alertSensitivity": "str", + "criterionType": "str", + "dimensions": [{"name": "str", "operator": "str", "values": ["str"]}], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "ignoreDataBefore": "2020-02-20 00:00:00", + "metricMeasureColumn": "str", + "metricName": "str", + "minRecurrenceCount": 0, + "operator": "str", + "query": "str", + "resourceIdColumn": "str", + "threshold": 0.0, + "timeAggregation": "str", + } + ] + }, + "description": "str", + "displayName": "str", + "enabled": bool, + "evaluationFrequency": "1 day, 0:00:00", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isLegacyLogAnalyticsRule": bool, + "isWorkspaceAlertsStorageConfigured": bool, + "muteActionsDuration": "1 day, 0:00:00", + "overrideQueryTimeRange": "1 day, 0:00:00", + "resolveConfiguration": {"autoResolved": bool, "timeToResolve": "1 day, 0:00:00"}, + "scopes": ["str"], + "severity": 0, + "skipQueryValidation": bool, + "tags": {"str": "str"}, + "targetResourceTypes": ["str"], + "windowSize": "1 day, 0:00:00", + }, + api_version="2025-01-01-preview", ) # please add some check logic here by yourself @@ -81,29 +195,8 @@ def test_scheduled_query_rules_delete(self, resource_group): response = self.client.scheduled_query_rules.delete( resource_group_name=resource_group.name, rule_name="str", - api_version="2018-04-16", + api_version="2025-01-01-preview", ) # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_scheduled_query_rules_list_by_subscription(self, resource_group): - response = self.client.scheduled_query_rules.list_by_subscription( - api_version="2018-04-16", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_scheduled_query_rules_list_by_resource_group(self, resource_group): - response = self.client.scheduled_query_rules.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-04-16", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations_async.py index 99684931e260..56e53e4387cd 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations_async.py @@ -19,6 +19,39 @@ class TestMonitorManagementScheduledQueryRulesOperationsAsync(AzureMgmtRecordedT 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_scheduled_query_rules_list_by_subscription(self, resource_group): + response = self.client.scheduled_query_rules.list_by_subscription( + api_version="2025-01-01-preview", + ) + 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_scheduled_query_rules_list_by_resource_group(self, resource_group): + response = self.client.scheduled_query_rules.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-01-01-preview", + ) + 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_scheduled_query_rules_get(self, resource_group): + response = await self.client.scheduled_query_rules.get( + resource_group_name=resource_group.name, + rule_name="str", + api_version="2025-01-01-preview", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_scheduled_query_rules_create_or_update(self, resource_group): @@ -26,38 +59,70 @@ async def test_scheduled_query_rules_create_or_update(self, resource_group): resource_group_name=resource_group.name, rule_name="str", parameters={ - "action": "action", "location": "str", - "source": {"dataSourceId": "str", "authorizedResources": ["str"], "query": "str", "queryType": "str"}, - "autoMitigate": False, + "actions": { + "actionGroups": ["str"], + "actionProperties": {"str": "str"}, + "customProperties": {"str": "str"}, + }, + "autoMitigate": bool, + "checkWorkspaceAlertsStorageConfigured": bool, "createdWithApiVersion": "str", + "criteria": { + "allOf": [ + { + "alertSensitivity": "str", + "criterionType": "str", + "dimensions": [{"name": "str", "operator": "str", "values": ["str"]}], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "ignoreDataBefore": "2020-02-20 00:00:00", + "metricMeasureColumn": "str", + "metricName": "str", + "minRecurrenceCount": 0, + "operator": "str", + "query": "str", + "resourceIdColumn": "str", + "threshold": 0.0, + "timeAggregation": "str", + } + ] + }, "description": "str", "displayName": "str", - "enabled": "str", + "enabled": bool, "etag": "str", + "evaluationFrequency": "1 day, 0:00:00", "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "isLegacyLogAnalyticsRule": bool, + "isWorkspaceAlertsStorageConfigured": bool, "kind": "str", - "lastUpdatedTime": "2020-02-20 00:00:00", + "muteActionsDuration": "1 day, 0:00:00", "name": "str", - "provisioningState": "str", - "schedule": {"frequencyInMinutes": 0, "timeWindowInMinutes": 0}, + "overrideQueryTimeRange": "1 day, 0:00:00", + "resolveConfiguration": {"autoResolved": bool, "timeToResolve": "1 day, 0:00:00"}, + "scopes": ["str"], + "severity": 0, + "skipQueryValidation": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "tags": {"str": "str"}, + "targetResourceTypes": ["str"], "type": "str", + "windowSize": "1 day, 0:00:00", }, - api_version="2018-04-16", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_scheduled_query_rules_get(self, resource_group): - response = await self.client.scheduled_query_rules.get( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-04-16", + api_version="2025-01-01-preview", ) # please add some check logic here by yourself @@ -69,8 +134,57 @@ async def test_scheduled_query_rules_update(self, resource_group): response = await self.client.scheduled_query_rules.update( resource_group_name=resource_group.name, rule_name="str", - parameters={"enabled": "str", "tags": {"str": "str"}}, - api_version="2018-04-16", + parameters={ + "actions": { + "actionGroups": ["str"], + "actionProperties": {"str": "str"}, + "customProperties": {"str": "str"}, + }, + "autoMitigate": bool, + "checkWorkspaceAlertsStorageConfigured": bool, + "createdWithApiVersion": "str", + "criteria": { + "allOf": [ + { + "alertSensitivity": "str", + "criterionType": "str", + "dimensions": [{"name": "str", "operator": "str", "values": ["str"]}], + "failingPeriods": {"minFailingPeriodsToAlert": 1, "numberOfEvaluationPeriods": 1}, + "ignoreDataBefore": "2020-02-20 00:00:00", + "metricMeasureColumn": "str", + "metricName": "str", + "minRecurrenceCount": 0, + "operator": "str", + "query": "str", + "resourceIdColumn": "str", + "threshold": 0.0, + "timeAggregation": "str", + } + ] + }, + "description": "str", + "displayName": "str", + "enabled": bool, + "evaluationFrequency": "1 day, 0:00:00", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "isLegacyLogAnalyticsRule": bool, + "isWorkspaceAlertsStorageConfigured": bool, + "muteActionsDuration": "1 day, 0:00:00", + "overrideQueryTimeRange": "1 day, 0:00:00", + "resolveConfiguration": {"autoResolved": bool, "timeToResolve": "1 day, 0:00:00"}, + "scopes": ["str"], + "severity": 0, + "skipQueryValidation": bool, + "tags": {"str": "str"}, + "targetResourceTypes": ["str"], + "windowSize": "1 day, 0:00:00", + }, + api_version="2025-01-01-preview", ) # please add some check logic here by yourself @@ -82,29 +196,8 @@ async def test_scheduled_query_rules_delete(self, resource_group): response = await self.client.scheduled_query_rules.delete( resource_group_name=resource_group.name, rule_name="str", - api_version="2018-04-16", + api_version="2025-01-01-preview", ) # please add some check logic here by yourself # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_scheduled_query_rules_list_by_subscription(self, resource_group): - response = self.client.scheduled_query_rules.list_by_subscription( - api_version="2018-04-16", - ) - 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_scheduled_query_rules_list_by_resource_group(self, resource_group): - response = self.client.scheduled_query_rules.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-04-16", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/setup.py b/sdk/monitor/azure-mgmt-monitor/setup.py index 8528a161d7a7..f5750059ed52 100644 --- a/sdk/monitor/azure-mgmt-monitor/setup.py +++ b/sdk/monitor/azure-mgmt-monitor/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )